From: Michael R Sweet Date: Wed, 18 Jul 2018 03:52:38 +0000 (-0400) Subject: The scheduler was being backgrounded on macOS, causing applications to spin X-Git-Tag: v2.3b6~125 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bbe495b0ea167d92095be6aa8fdb226d5b33969e;p=thirdparty%2Fcups.git The scheduler was being backgrounded on macOS, causing applications to spin (rdar://40436080) scheduler/main.c: - Start/end transactions on startup/shutdown. scheduler/sysman.c: - Remove transactions from cupsdSetBusy. --- diff --git a/CHANGES.md b/CHANGES.md index d04c0b92d9..482e6f3e34 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,4 +1,4 @@ -CHANGES - 2.3b6 - 2018-06-29 +CHANGES - 2.3b6 - 2018-07-17 ============================ Changes in CUPS v2.3b6 @@ -17,6 +17,8 @@ Changes in CUPS v2.3b6 - The web interface did not list the IPP Everywhere "driver" (Issue #5338) - The scheduler did not report all of the supported job options and values (Issue #5340) +- The scheduler was being backgrounded on macOS, causing applications to spin + (rdar://40436080) - Authentication in the web interface did not work on macOS (rdar://41444473) - Fixed a memory leak for some IPP (extension) syntaxes. diff --git a/scheduler/main.c b/scheduler/main.c index a992b540d1..371dce549b 100644 --- a/scheduler/main.c +++ b/scheduler/main.c @@ -1,7 +1,7 @@ /* * Main loop for the CUPS scheduler. * - * Copyright 2007-2017 by Apple Inc. + * Copyright 2007-2018 by Apple Inc. * Copyright 1997-2007 by Easy Software Products, all rights reserved. * * Licensed under Apache License v2.0. See the file "LICENSE" for more @@ -15,6 +15,9 @@ #define _MAIN_C_ #include "cupsd.h" #include +#ifdef __APPLE__ +# include +#endif /* __APPLE__ */ #ifdef HAVE_ASL_H # include #elif defined(HAVE_SYSTEMD_SD_JOURNAL_H) @@ -1954,6 +1957,10 @@ service_checkin(void) service_add_listener(ld_sockets[i], (int)i); free(ld_sockets); + +# ifdef __APPLE__ + xpc_transaction_begin(); +# endif /* __APPLE__ */ } #elif defined(HAVE_SYSTEMD) @@ -2092,6 +2099,12 @@ service_checkout(int shutdown) /* I - Shutting down? */ else cupsdLogMessage(CUPSD_LOG_ERROR, "Unable to create KeepAlive/PID file \"%s\": %s", pidfile, strerror(errno)); } + + +# ifdef __APPLE__ + if (shutdown) + xpc_transaction_end(); +# endif /* __APPLE__ */ } diff --git a/scheduler/org.cups.cupsd.plist b/scheduler/org.cups.cupsd.plist index 8e1d0e96e5..20ff05da7e 100644 --- a/scheduler/org.cups.cupsd.plist +++ b/scheduler/org.cups.cupsd.plist @@ -8,8 +8,6 @@ Adaptive EnableTransactions - EnablePressuredExit - ExitTimeOut 60 KeepAlive diff --git a/scheduler/sysman.c b/scheduler/sysman.c index 8c8cf1cdeb..e7f79e3dec 100644 --- a/scheduler/sysman.c +++ b/scheduler/sysman.c @@ -1,7 +1,7 @@ /* * System management functions for the CUPS scheduler. * - * Copyright 2007-2017 by Apple Inc. + * Copyright 2007-2018 by Apple Inc. * Copyright 2006 by Easy Software Products. * * Licensed under Apache License v2.0. See the file "LICENSE" for more information. @@ -14,7 +14,6 @@ #include "cupsd.h" #ifdef __APPLE__ -# include # include #endif /* __APPLE__ */ @@ -125,7 +124,6 @@ cupsdSetBusyState(int working) /* I - Doing significant work? */ "Active clients, printing jobs, and dirty files" }; #ifdef __APPLE__ - static int tran = 0; /* Current busy transaction */ static IOPMAssertionID keep_awake = 0;/* Keep the system awake while printing */ #endif /* __APPLE__ */ @@ -164,23 +162,8 @@ cupsdSetBusyState(int working) /* I - Doing significant work? */ */ if (newbusy != busy) - { busy = newbusy; -#ifdef __APPLE__ - if (busy && !tran) - { - xpc_transaction_begin(); - tran = 1; - } - else if (!busy && tran) - { - xpc_transaction_end(); - tran = 0; - } -#endif /* __APPLE__ */ - } - #ifdef __APPLE__ if (cupsArrayCount(PrintingJobs) > 0 && !keep_awake) {