From b1ec48747c065e339ad11944000f7cd4a25967b8 Mon Sep 17 00:00:00 2001 From: Nedko Arnaudov Date: Sat, 18 Nov 2023 16:47:38 +0200 Subject: [PATCH] Revert "Solving problems while compiling jack2 on macOS X with dbus support (#434)" Reduce code bloat by removing support of non-libre operating system This reverts commit bb3f5cb2963dc74ba045a1553e05f755af8623cc. --- dbus/controller.c | 18 +++++++++--------- dbus/wscript | 3 --- linux/uptime.c | 12 ------------ linux/uptime.h | 27 --------------------------- 4 files changed, 9 insertions(+), 51 deletions(-) delete mode 100644 linux/uptime.c delete mode 100644 linux/uptime.h diff --git a/dbus/controller.c b/dbus/controller.c index 69180114..f4ed8397 100644 --- a/dbus/controller.c +++ b/dbus/controller.c @@ -27,13 +27,13 @@ #include #include #include +#include #include #include "controller.h" #include "controller_internal.h" #include "xml.h" #include "reserve.h" -#include "uptime.h" struct jack_dbus_interface_descriptor * g_jackcontroller_interfaces[] = { @@ -787,18 +787,18 @@ void jack_controller_run( void * context) { - long ut; + struct sysinfo si; if (controller_ptr->pending_save == 0) { return; } - if ((ut = uptime()) < 0) + if (sysinfo(&si) != 0) { - jack_error(UPTIME_FUNCTION_NAME "() failed with %d", errno); + jack_error("sysinfo() failed with %d", errno); } - else if (ut < controller_ptr->pending_save + 2) /* delay save by two seconds */ + else if (si.uptime < controller_ptr->pending_save + 2) /* delay save by two seconds */ { return; } @@ -813,15 +813,15 @@ void jack_controller_pending_save( struct jack_controller * controller_ptr) { - long ut; + struct sysinfo si; - if ((ut = uptime()) < 0) + if (sysinfo(&si) != 0) { - jack_error(UPTIME_FUNCTION_NAME "() failed with %d.", errno); + jack_error("sysinfo() failed with %d.", errno); controller_ptr->pending_save = 0; jack_controller_settings_save_auto(controller_ptr); return; } - controller_ptr->pending_save = ut; + controller_ptr->pending_save = si.uptime; } diff --git a/dbus/wscript b/dbus/wscript index 717af71c..4f464c47 100644 --- a/dbus/wscript +++ b/dbus/wscript @@ -79,9 +79,6 @@ def build(bld): 'reserve.c', ] obj.use = ['JACKSERVER'] - obj.source += [ - '../linux/uptime.c', - ] if bld.env['IS_LINUX']: obj.use += ['PTHREAD', 'DL', 'RT', 'DBUS-1', 'EXPAT'] if bld.env['IS_FREEBSD']: diff --git a/linux/uptime.c b/linux/uptime.c deleted file mode 100644 index d6e6c9d5..00000000 --- a/linux/uptime.c +++ /dev/null @@ -1,12 +0,0 @@ -#include - -long uptime(void) { - struct sysinfo si; - - if (sysinfo(&si) != 0) - { - return -1; - } - - return si.uptime; -} diff --git a/linux/uptime.h b/linux/uptime.h deleted file mode 100644 index f0587bfd..00000000 --- a/linux/uptime.h +++ /dev/null @@ -1,27 +0,0 @@ -/* -Copyright (C) 2004-2005 Grame - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -*/ - -#ifndef __uptime_LINUX__ -#define __uptime_LINUX__ - -#define UPTIME_FUNCTION_NAME "sysinfo" - -long uptime(void); - -#endif