]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Do some cleanup for the on-demand support - remove old launchd support (no
authorMichael Sweet <michael.r.sweet@gmail.com>
Tue, 21 Jun 2016 15:57:03 +0000 (11:57 -0400)
committerMichael Sweet <michael.r.sweet@gmail.com>
Tue, 21 Jun 2016 15:57:03 +0000 (11:57 -0400)
longer needed), naming/style updates, fix compiler warnings.

config-scripts/cups-startup.m4
config.h.in
configure
scheduler/client.h
scheduler/conf.c
scheduler/conf.h
scheduler/cupsd.h
scheduler/listen.c
scheduler/main.c
vcnet/config.h
xcode/config.h

index d61bf9cbbf3c63cd0bdbcaa106255e015d5ce4dc..0ab61ec452acdb5107c91ff5c06cd3098423c1ce 100644 (file)
@@ -22,12 +22,9 @@ LAUNCHD_DIR=""
 AC_SUBST(LAUNCHD_DIR)
 
 if test x$enable_launchd != xno; then
-       AC_CHECK_FUNC(launch_msg, AC_DEFINE(HAVE_LAUNCHD))
-       if test $uversion -ge 140; then
-               AC_CHECK_FUNC(launch_activate_socket, [
-                       AC_DEFINE(HAVE_LAUNCHD)
-                       AC_DEFINE(HAVE_LAUNCH_ACTIVATE_SOCKET)])
-       fi
+       AC_CHECK_FUNC(launch_activate_socket, [
+               AC_DEFINE(HAVE_LAUNCHD)
+               AC_DEFINE(HAVE_ONDEMAND)])
        AC_CHECK_HEADER(launch.h, AC_DEFINE(HAVE_LAUNCH_H))
 
        case "$uname" in
@@ -77,6 +74,7 @@ if test x$enable_systemd != xno; then
 
                if test $have_systemd = yes; then
                         AC_DEFINE(HAVE_SYSTEMD)
+                        AC_DEFINE(HAVE_ONDEMAND)
                        AC_CHECK_HEADER(systemd/sd-journal.h,AC_DEFINE(HAVE_SYSTEMD_SD_JOURNAL_H))
                        if test "x$SYSTEMD_DIR" = x; then
                                SYSTEMD_DIR="`$PKGCONFIG --variable=systemdsystemunitdir systemd`"
@@ -92,6 +90,7 @@ if test "x$enable_upstart" = "xyes"; then
                AC_MSG_ERROR(Cannot support both systemd and upstart.)
        fi
        AC_DEFINE(HAVE_UPSTART)
+       AC_DEFINE(HAVE_ONDEMAND)
 fi
 
 dnl Solaris uses smf
index 05490a519fd12648e5dd3e66ffdcf69bf33e43d8..0323eaace97b0785a280ab1ecaa5eb1ff2fbd0f1 100644 (file)
 #undef HAVE_PTHREAD_H
 
 
+/*
+ * Do we have on-demand support (launchd/systemd/upstart)?
+ */
+
+#undef HAVE_ONDEMAND
+
+
 /*
  * Do we have launchd support?
  */
 
 #undef HAVE_LAUNCH_H
 #undef HAVE_LAUNCHD
-#undef HAVE_LAUNCH_ACTIVATE_SOCKET
 
 
 /*
 
 #undef HAVE_SYSTEMD
 
+
 /*
  * Do we have upstart support?
  */
@@ -730,10 +737,4 @@ static __inline int _cups_abs(int i) { return (i < 0 ? -i : i); }
 #  endif /* __GNUC__ || __STDC_VERSION__ */
 #endif /* !HAVE_ABS && !abs */
 
-#if defined(HAVE_LAUNCHD) || defined(HAVE_SYSTEMD) || defined(HAVE_UPSTART)
-#  define HAVE_ONDEMAND
-#else
-#  undef HAVE_ONDEMAND
-#endif
-
 #endif /* !_CUPS_CONFIG_H_ */
index 9b27eaf19a1e0ce5c0f8e3bcd35618f42db55b0a..8185ce4722eef0d1f4d60be1cafcf0c4b4253826 100755 (executable)
--- a/configure
+++ b/configure
@@ -8764,7 +8764,7 @@ else
     We can't simply define LARGE_OFF_T to be 9223372036854775807,
     since some C++ compilers masquerading as C compilers
     incorrectly reject 9223372036854775807.  */
-#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
   int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
                       && LARGE_OFF_T % 2147483647 == 1)
                      ? 1 : -1];
@@ -8810,7 +8810,7 @@ else
     We can't simply define LARGE_OFF_T to be 9223372036854775807,
     since some C++ compilers masquerading as C compilers
     incorrectly reject 9223372036854775807.  */
-#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
   int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
                       && LARGE_OFF_T % 2147483647 == 1)
                      ? 1 : -1];
@@ -8834,7 +8834,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
     We can't simply define LARGE_OFF_T to be 9223372036854775807,
     since some C++ compilers masquerading as C compilers
     incorrectly reject 9223372036854775807.  */
-#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
   int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
                       && LARGE_OFF_T % 2147483647 == 1)
                      ? 1 : -1];
@@ -8879,7 +8879,7 @@ else
     We can't simply define LARGE_OFF_T to be 9223372036854775807,
     since some C++ compilers masquerading as C compilers
     incorrectly reject 9223372036854775807.  */
-#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
   int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
                       && LARGE_OFF_T % 2147483647 == 1)
                      ? 1 : -1];
@@ -8903,7 +8903,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
     We can't simply define LARGE_OFF_T to be 9223372036854775807,
     since some C++ compilers masquerading as C compilers
     incorrectly reject 9223372036854775807.  */
-#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
   int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
                       && LARGE_OFF_T % 2147483647 == 1)
                      ? 1 : -1];
@@ -9124,23 +9124,15 @@ LAUNCHD_DIR=""
 
 
 if test x$enable_launchd != xno; then
-       ac_fn_c_check_func "$LINENO" "launch_msg" "ac_cv_func_launch_msg"
-if test "x$ac_cv_func_launch_msg" = xyes; then :
-  $as_echo "#define HAVE_LAUNCHD 1" >>confdefs.h
-
-fi
-
-       if test $uversion -ge 140; then
-               ac_fn_c_check_func "$LINENO" "launch_activate_socket" "ac_cv_func_launch_activate_socket"
+       ac_fn_c_check_func "$LINENO" "launch_activate_socket" "ac_cv_func_launch_activate_socket"
 if test "x$ac_cv_func_launch_activate_socket" = xyes; then :
 
-                       $as_echo "#define HAVE_LAUNCHD 1" >>confdefs.h
+               $as_echo "#define HAVE_LAUNCHD 1" >>confdefs.h
 
-                       $as_echo "#define HAVE_LAUNCH_ACTIVATE_SOCKET 1" >>confdefs.h
+               $as_echo "#define HAVE_ONDEMAND 1" >>confdefs.h
 
 fi
 
-       fi
        ac_fn_c_check_header_mongrel "$LINENO" "launch.h" "ac_cv_header_launch_h" "$ac_includes_default"
 if test "x$ac_cv_header_launch_h" = xyes; then :
   $as_echo "#define HAVE_LAUNCH_H 1" >>confdefs.h
@@ -9210,6 +9202,8 @@ $as_echo "no" >&6; }
                if test $have_systemd = yes; then
                         $as_echo "#define HAVE_SYSTEMD 1" >>confdefs.h
 
+                        $as_echo "#define HAVE_ONDEMAND 1" >>confdefs.h
+
                        ac_fn_c_check_header_mongrel "$LINENO" "systemd/sd-journal.h" "ac_cv_header_systemd_sd_journal_h" "$ac_includes_default"
 if test "x$ac_cv_header_systemd_sd_journal_h" = xyes; then :
   $as_echo "#define HAVE_SYSTEMD_SD_JOURNAL_H 1" >>confdefs.h
@@ -9235,6 +9229,8 @@ if test "x$enable_upstart" = "xyes"; then
        fi
        $as_echo "#define HAVE_UPSTART 1" >>confdefs.h
 
+       $as_echo "#define HAVE_ONDEMAND 1" >>confdefs.h
+
 fi
 
 SMFMANIFESTDIR=""
index f97f41defa9e627e350a06f0915ec7c51e3111d0..d58d1114818d49cd3c46dffffd1cbcb603003e86 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Client definitions for the CUPS scheduler.
  *
- * Copyright 2007-2014 by Apple Inc.
+ * Copyright 2007-2016 by Apple Inc.
  * Copyright 1997-2007 by Easy Software Products, all rights reserved.
  *
  * These coded instructions, statements, and computer programs are the
@@ -79,7 +79,7 @@ typedef struct
   int                  fd;             /* File descriptor for this server */
   http_addr_t          address;        /* Bind address of socket */
   http_encryption_t    encryption;     /* To encrypt or not to encrypt... */
-#if defined(HAVE_ONDEMAND)
+#ifdef HAVE_ONDEMAND
   int                  on_demand;      /* Is this a socket from launchd/systemd/upstart? */
 #endif /* HAVE_ONDEMAND */
 } cupsd_listener_t;
index 7695f56f4a3b5edf9c43fb42c914d7f7690db012..088501e883e2fe2a986dbd76b78076c822d0cb0e 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Configuration routines for the CUPS scheduler.
  *
- * Copyright 2007-2015 by Apple Inc.
+ * Copyright 2007-2016 by Apple Inc.
  * Copyright 1997-2007 by Easy Software Products, all rights reserved.
  *
  * These coded instructions, statements, and computer programs are the
@@ -89,7 +89,7 @@ static const cupsd_var_t      cupsd_vars[] =
 #ifdef HAVE_GSSAPI
   { "GSSServiceName",          &GSSServiceName,        CUPSD_VARTYPE_STRING },
 #endif /* HAVE_GSSAPI */
-#if defined(HAVE_ONDEMAND)
+#ifdef HAVE_ONDEMAND
   { "IdleExitTimeout",         &IdleExitTimeout,       CUPSD_VARTYPE_TIME },
 #endif /* HAVE_ONDEMAND */
   { "JobKillDelay",            &JobKillDelay,          CUPSD_VARTYPE_TIME },
@@ -810,7 +810,7 @@ cupsdReadConfiguration(void)
   DefaultLeaseDuration       = 86400;
   MaxLeaseDuration           = 0;
 
-#if defined(HAVE_ONDEMAND)
+#ifdef HAVE_ONDEMAND
   IdleExitTimeout = 60;
 #endif /* HAVE_ONDEMAND */
 
@@ -3149,7 +3149,7 @@ read_cupsd_conf(cups_file_t *fp)  /* I - File to read from */
 
         if (lis)
        {
-#if defined(HAVE_ONDEMAND)
+#ifdef HAVE_ONDEMAND
          if (!lis->on_demand)
 #endif /* HAVE_ONDEMAND */
          {
index e11f7c6fe2b63f57c5461520cbf0118e0671507d..80250d94d212097c1a39d644312e0a5c1d5fd3f0 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Configuration file definitions for the CUPS scheduler.
  *
- * Copyright 2007-2015 by Apple Inc.
+ * Copyright 2007-2016 by Apple Inc.
  * Copyright 1997-2007 by Easy Software Products, all rights reserved.
  *
  * These coded instructions, statements, and computer programs are the
@@ -244,7 +244,7 @@ VAR char            *ServerKeychain         VALUE(NULL);
                                        /* Keychain holding cert + key */
 #endif /* HAVE_SSL */
 
-#if defined(HAVE_ONDEMAND)
+#ifdef HAVE_ONDEMAND
 VAR int                        IdleExitTimeout         VALUE(60);
                                        /* Time after which an idle cupsd will exit */
 #endif /* HAVE_ONDEMAND */
index 669560c15b31f29c015c3e6ac02c0d7a4025d958..ad37bee436624bc1ea748257454e29691de30ef4 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Main header file for the CUPS scheduler.
  *
- * Copyright 2007-2014 by Apple Inc.
+ * Copyright 2007-2016 by Apple Inc.
  * Copyright 1997-2007 by Easy Software Products, all rights reserved.
  *
  * These coded instructions, statements, and computer programs are the
@@ -157,7 +157,7 @@ VAR int                     NeedReload      VALUE(RELOAD_ALL),
 VAR void               *DefaultProfile VALUE(0);
                                        /* Default security profile */
 
-#if defined(HAVE_ONDEMAND)
+#ifdef HAVE_ONDEMAND
 VAR int                        OnDemand        VALUE(0);
                                        /* Launched on demand */
 #endif /* HAVE_ONDEMAND */
index 7cfe8dbd1b8262852b46a8f597ee3f9f03dfc748..1103b2510387b72bdd5046e96267005bdaaa6606 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Server listening routines for the CUPS scheduler.
  *
- * Copyright 2007-2014 by Apple Inc.
+ * Copyright 2007-2016 by Apple Inc.
  * Copyright 1997-2006 by Easy Software Products, all rights reserved.
  *
  * These coded instructions, statements, and computer programs are the
@@ -41,7 +41,7 @@ cupsdDeleteAllListeners(void)
   for (lis = (cupsd_listener_t *)cupsArrayFirst(Listeners);
        lis;
        lis = (cupsd_listener_t *)cupsArrayNext(Listeners))
-#if defined(HAVE_ONDEMAND)
+#ifdef HAVE_ONDEMAND
     if (!lis->on_demand)
 #endif /* HAVE_ONDEMAND */
     {
@@ -281,7 +281,7 @@ cupsdStopListening(void)
        lis;
        lis = (cupsd_listener_t *)cupsArrayNext(Listeners))
   {
-#if defined(HAVE_ONDEMAND)
+#ifdef HAVE_ONDEMAND
     if (!lis->on_demand && lis->fd != -1)
     {
       httpAddrClose(&(lis->address), lis->fd);
index 26417b9c759ea1123810884f3bcc6b3174b6b149..0dcd32de0e2588160716056f06f67c579726b072 100644 (file)
 
 #ifdef HAVE_LAUNCH_H
 #  include <launch.h>
-#  include <libgen.h>
-#  ifdef HAVE_LAUNCH_ACTIVATE_SOCKET
-/* Update when we have a public header we can include */
-extern int launch_activate_socket(const char *name, int **fds, size_t *cnt);
-#  endif /* HAVE_LAUNCH_ACTIVATE_SOCKET */
 #endif /* HAVE_LAUNCH_H */
 
 #ifdef HAVE_SYSTEMD
@@ -72,7 +67,7 @@ static void           sigchld_handler(int sig);
 static void            sighup_handler(int sig);
 static void            sigterm_handler(int sig);
 static long            select_timeout(int fds);
-#if defined(HAVE_ONDEMAND)
+#ifdef HAVE_ONDEMAND
 static void            service_checkin(void);
 static void            service_checkout(void);
 #endif /* HAVE_ONDEMAND */
@@ -755,10 +750,10 @@ main(int  argc,                           /* I - Number of command-line args */
        * Shutdown the server...
        */
 
-#if defined(HAVE_LAUNCHD) || defined(HAVE_SYSTEMD)
+#ifdef HAVE_ONDEMAND
        if (OnDemand)
          break;
-#endif /* HAVE_LAUNCHD || HAVE_SYSTEMD */
+#endif /* HAVE_ONDEMAND */
 
         DoingShutdown = 1;
 
@@ -815,7 +810,7 @@ main(int  argc,                             /* I - Number of command-line args */
     if ((timeout = select_timeout(fds)) > 1 && LastEvent)
       timeout = 1;
 
-#if defined(HAVE_ONDEMAND)
+#ifdef HAVE_ONDEMAND
    /*
     * If no other work is scheduled and we're being controlled by
     * launchd then timeout after 'LaunchdTimeout' seconds of
@@ -846,7 +841,6 @@ main(int  argc,                             /* I - Number of command-line args */
       cupsd_printer_t  *p;             /* Current printer */
 #endif /* HAVE_DNSSD || HAVE_AVAHI */
 
-
       if (errno == EINTR)              /* Just interrupted by a signal */
         continue;
 
@@ -931,10 +925,11 @@ main(int  argc,                           /* I - Number of command-line args */
     }
 #endif /* !__APPLE__ */
 
-#if defined(HAVE_ONDEMAND)
+#ifdef HAVE_ONDEMAND
    /*
-    * If no other work was scheduled and we're being controlled by launchd
-    * then timeout after 'LaunchdTimeout' seconds of inactivity...
+    * If no other work was scheduled and we're being controlled by launchd,
+    * systemd, or upstart then timeout after 'LaunchdTimeout' seconds of
+    * inactivity...
     */
 
     if (!fds && service_idle_exit)
@@ -1149,7 +1144,7 @@ main(int  argc,                           /* I - Number of command-line args */
 
   cupsdStopServer();
 
-#if defined(HAVE_ONDEMAND)
+#ifdef HAVE_ONDEMAND
  /*
   * Update the keep-alive file as needed...
   */
@@ -1828,38 +1823,34 @@ sigterm_handler(int sig)                /* I - Signal number */
 }
 
 
-#if defined(HAVE_ONDEMAND)
-
+#ifdef HAVE_ONDEMAND
 /*
- * 'add_ondemand_listener()' - Bind an open fd as a Listener.
+ * 'service_add_listener()' - Bind an open fd as a Listener.
  */
 
 static void
-add_ondemand_listener(int fd,           /* I - Socket file descriptor */
-                      int idx)          /* I - Listener number, for logging */
+service_add_listener(int fd,           /* I - Socket file descriptor */
+                     int idx)          /* I - Listener number, for logging */
 {
   cupsd_listener_t     *lis;           /* Listeners array */
   http_addr_t          addr;           /* Address variable */
   socklen_t            addrlen;        /* Length of address */
   char                 s[256];         /* String addresss */
 
+
   addrlen = sizeof(addr);
 
   if (getsockname(fd, (struct sockaddr *)&addr, &addrlen))
   {
-    cupsdLogMessage(CUPSD_LOG_ERROR,
-                    "service_checkin: Unable to get local address for listener #%d: %s",
-                    idx + 1, strerror(errno));
+    cupsdLogMessage(CUPSD_LOG_ERROR, "service_add_listener: Unable to get local address for listener #%d: %s", idx + 1, strerror(errno));
     return;
   }
 
-  cupsdLogMessage(CUPSD_LOG_DEBUG,
-                  "service_checkin: Listener #%d at fd %d, \"%s\".",
-                  idx + 1, fd, httpAddrString(&addr, s, sizeof(s)));
+  cupsdLogMessage(CUPSD_LOG_DEBUG, "service_add_listener: Listener #%d at fd %d, \"%s\".", idx + 1, fd, httpAddrString(&addr, s, sizeof(s)));
 
 /*
-   * Try to match the on-demand socket address to one of the listeners...
-   */
+ /*
+  * Try to match the on-demand socket address to one of the listeners...
+  */
 
   for (lis = (cupsd_listener_t *)cupsArrayFirst(Listeners);
        lis;
@@ -1873,19 +1864,15 @@ add_ondemand_listener(int fd,           /* I - Socket file descriptor */
 
   if (lis)
   {
-    cupsdLogMessage(CUPSD_LOG_DEBUG,
-                    "service_checkin: Matched existing listener #%d to %s.",
-                    idx + 1, httpAddrString(&(lis->address), s, sizeof(s)));
+    cupsdLogMessage(CUPSD_LOG_DEBUG, "service_add_listener: Matched existing listener #%d to %s.", idx + 1, httpAddrString(&(lis->address), s, sizeof(s)));
   }
   else
   {
-    cupsdLogMessage(CUPSD_LOG_DEBUG,
-                    "service_checkin: Adding new listener #%d for %s.",
-                    idx + 1, httpAddrString(&addr, s, sizeof(s)));
+    cupsdLogMessage(CUPSD_LOG_DEBUG, "service_add_listener: Adding new listener #%d for %s.", idx + 1, httpAddrString(&addr, s, sizeof(s)));
 
     if ((lis = calloc(1, sizeof(cupsd_listener_t))) == NULL)
     {
-      cupsdLogMessage(CUPSD_LOG_ERROR, "service_checkin: Unable to allocate listener: %s.", strerror(errno));
+      cupsdLogMessage(CUPSD_LOG_ERROR, "service_add_listener: Unable to allocate listener: %s.", strerror(errno));
       exit(EXIT_FAILURE);
       return;
     }
@@ -1904,6 +1891,7 @@ add_ondemand_listener(int fd,           /* I - Socket file descriptor */
 #  endif /* HAVE_SSL */
 }
 
+
 /*
  * 'service_checkin()' - Check-in with launchd and collect the listening fds.
  */
@@ -1911,7 +1899,7 @@ add_ondemand_listener(int fd,           /* I - Socket file descriptor */
 static void
 service_checkin(void)
 {
-#  ifdef HAVE_LAUNCH_ACTIVATE_SOCKET
+#  ifdef HAVE_LAUNCHD
   int                  error;          /* Check-in error, if any */
   size_t               i,              /* Looping var */
                        count;          /* Number of listeners */
@@ -1938,100 +1926,10 @@ service_checkin(void)
   cupsdLogMessage(CUPSD_LOG_DEBUG, "service_checkin: %d listeners.", (int)count);
 
   for (i = 0; i < count; i ++)
-  {
-    add_ondemand_listener(ld_sockets[i], i);
-  }
+    service_add_listener(ld_sockets[i], (int)i);
 
   free(ld_sockets);
 
-#  elif defined(HAVE_LAUNCHD)
-  size_t               i,              /* Looping var */
-                       count;          /* Number of listeners */
-  launch_data_t                ld_msg,         /* Launch data message */
-                       ld_resp,        /* Launch data response */
-                       ld_array,       /* Launch data array */
-                       ld_sockets,     /* Launch data sockets dictionary */
-                       tmp;            /* Launch data */
-  int                  fd;             /* File descriptor */
-
-
-  cupsdLogMessage(CUPSD_LOG_DEBUG, "service_checkin: pid=%d", (int)getpid());
-
- /*
-  * Check-in with launchd...
-  */
-
-  ld_msg = launch_data_new_string(LAUNCH_KEY_CHECKIN);
-  if ((ld_resp = launch_msg(ld_msg)) == NULL)
-  {
-    cupsdLogMessage(CUPSD_LOG_ERROR,
-                   "service_checkin: launch_msg(\"" LAUNCH_KEY_CHECKIN
-                   "\") IPC failure");
-    exit(EXIT_FAILURE);
-    return; /* anti-compiler-warning */
-  }
-
-  if (launch_data_get_type(ld_resp) == LAUNCH_DATA_ERRNO)
-  {
-    errno = launch_data_get_errno(ld_resp);
-    cupsdLogMessage(CUPSD_LOG_ERROR, "service_checkin: Check-in failed: %s",
-                    strerror(errno));
-    exit(EXIT_FAILURE);
-    return; /* anti-compiler-warning */
-  }
-
- /*
-  * Get the sockets dictionary...
-  */
-
-  if ((ld_sockets = launch_data_dict_lookup(ld_resp, LAUNCH_JOBKEY_SOCKETS))
-          == NULL)
-  {
-    cupsdLogMessage(CUPSD_LOG_ERROR,
-                    "service_checkin: No sockets found to answer requests on.");
-    exit(EXIT_FAILURE);
-    return; /* anti-compiler-warning */
-  }
-
- /*
-  * Get the array of listener sockets...
-  */
-
-  if ((ld_array = launch_data_dict_lookup(ld_sockets, "Listeners")) == NULL)
-  {
-    cupsdLogMessage(CUPSD_LOG_ERROR,
-                    "service_checkin: No sockets found to answer requests on.");
-    exit(EXIT_FAILURE);
-    return; /* anti-compiler-warning */
-  }
-
- /*
-  * Add listening fd(s) to the Listener array...
-  */
-
-  if (launch_data_get_type(ld_array) == LAUNCH_DATA_ARRAY)
-  {
-    count = launch_data_array_get_count(ld_array);
-
-    cupsdLogMessage(CUPSD_LOG_DEBUG, "service_checkin: %d listeners.", (int)count);
-
-    for (i = 0; i < count; i ++)
-    {
-     /*
-      * Get the launchd file descriptor and address...
-      */
-
-      if ((tmp = launch_data_array_get_index(ld_array, i)) != NULL)
-      {
-       fd      = launch_data_get_fd(tmp);
-        add_ondemand_listener(fd, i);
-      }
-    }
-  }
-
-  launch_data_free(ld_msg);
-  launch_data_free(ld_resp);
-
 #  elif defined(HAVE_SYSTEMD)
   int                  i,              /* Looping var */
                        count;          /* Number of listeners */
@@ -2057,52 +1955,52 @@ service_checkin(void)
   cupsdLogMessage(CUPSD_LOG_DEBUG, "service_checkin: %d listeners.", count);
 
   for (i = 0; i < count; i ++)
-  {
-    add_ondemand_listener(SD_LISTEN_FDS_START + i, i);
-  }
+    service_add_listener(SD_LISTEN_FDS_START + i, i);
+
 #  elif defined(HAVE_UPSTART)
   const char           *e;             /* Environment var */
   int                  fd;             /* File descriptor */
 
+
   if (!(e = getenv("UPSTART_EVENTS")))
   {
-    cupsdLogMessage(CUPSD_LOG_ERROR,
-                   "service_checkin: We did not get started via Upstart.");
+    cupsdLogMessage(CUPSD_LOG_ERROR, "service_checkin: We did not get started via Upstart.");
     exit(EXIT_FAILURE);
     return;
   }
 
   if (strcasecmp(e, "socket"))
   {
-    cupsdLogMessage(CUPSD_LOG_ERROR,
-                   "service_checkin: We did not get triggered via an Upstart socket event.");
+    cupsdLogMessage(CUPSD_LOG_ERROR, "service_checkin: We did not get triggered via an Upstart socket event.");
     exit(EXIT_FAILURE);
     return;
   }
 
-  if (!(e = getenv("UPSTART_FDS")))
+  if ((e = getenv("UPSTART_FDS")) == NULL)
   {
-    cupsdLogMessage(CUPSD_LOG_ERROR,
-                   "service_checkin: Unable to get listener sockets from UPSTART_FDS.");
+    cupsdLogMessage(CUPSD_LOG_ERROR, "service_checkin: Unable to get listener sockets from UPSTART_FDS.");
     exit(EXIT_FAILURE);
     return;
   }
 
   cupsdLogMessage(CUPSD_LOG_DEBUG, "service_checkin: UPSTART_FDS=%s", e);
 
-  fd = strtol(e, NULL, 10);
-  if (fd < 0) {
-    cupsdLogMessage(CUPSD_LOG_ERROR,
-                   "service_checkin: Could not parse UPSTART_FDS: %s", strerror(errno));
+  fd = (int)strtol(e, NULL, 10);
+  if (fd < 0)
+  {
+    cupsdLogMessage(CUPSD_LOG_ERROR, "service_checkin: Could not parse UPSTART_FDS: %s", strerror(errno));
     exit(EXIT_FAILURE);
     return;
   }
 
-  /* Upstart only supportst a single on-demand socket fd */
-  add_ondemand_listener(fd, 0);
+ /*
+  * Upstart only supportst a single on-demand socket file descriptor...
+  */
+
+  service_add_listener(fd, 0);
 
 #  else
-#  error "Error: defined HAVE_ONDEMAND but no launchd/systemd/upstart selection"
+#    error "Error: defined HAVE_ONDEMAND but no launchd/systemd/upstart selection"
 #  endif /* HAVE_LAUNCH_ACTIVATE_SOCKET */
 }
 
@@ -2159,7 +2057,9 @@ usage(int status)                 /* O - Exit status */
   _cupsLangPuts(fp, _("  -f                      Run in the foreground."));
   _cupsLangPuts(fp, _("  -F                      Run in the foreground but detach from console."));
   _cupsLangPuts(fp, _("  -h                      Show this usage message."));
+#ifdef HAVE_ONDEMAND
   _cupsLangPuts(fp, _("  -l                      Run cupsd on demand."));
+#endif /* HAVE_ONDEMAND */
   _cupsLangPuts(fp, _("  -s cups-files.conf      Set cups-files.conf file to use."));
   _cupsLangPuts(fp, _("  -t                      Test the configuration file."));
 
index 2ded18ba21d8d7663782575631b4de3dd65045c2..30c188e13169df17b0eb9d39bd6c3ed3d6c00487 100644 (file)
@@ -533,6 +533,13 @@ typedef unsigned long useconds_t;
 /* #undef HAVE_PTHREAD_H */
 
 
+/*
+ * Do we have on-demand support (launchd/systemd/upstart)?
+ */
+
+/* #undef HAVE_ONDEMAND */
+
+
 /*
  * Do we have launchd support?
  */
@@ -548,6 +555,13 @@ typedef unsigned long useconds_t;
 /* #undef HAVE_SYSTEMD */
 
 
+/*
+ * Do we have upstart support?
+ */
+
+/* #undef HAVE_UPSTART */
+
+
 /*
  * Various scripting languages...
  */
@@ -784,10 +798,4 @@ static __inline int _cups_abs(int i) { return (i < 0 ? -i : i); }
 #  endif /* __GNUC__ || __STDC_VERSION__ */
 #endif /* !HAVE_ABS && !abs */
 
-#if defined(HAVE_LAUNCHD) || defined(HAVE_SYSTEMD) || defined(HAVE_UPSTART)
-#  define HAVE_ONDEMAND
-#else
-#  undef HAVE_ONDEMAND
-#endif
-
 #endif /* !_CUPS_CONFIG_H_ */
index 8b106cd96c78f576cda16b71573ee5cd1090c4a8..54117ac5a07d30761c7a5e766fae81da52d7c3c8 100644 (file)
 #define HAVE_PTHREAD_H 1
 
 
+/*
+ * Do we have on-demand support (launchd/systemd/upstart)?
+ */
+
+#define HAVE_ONDEMAND 1
+
+
 /*
  * Do we have launchd support?
  */
 
 #define HAVE_LAUNCH_H 1
 #define HAVE_LAUNCHD 1
-#define HAVE_LAUNCH_ACTIVATE_SOCKET 1
+
+
+/*
+ * Do we have systemd support?
+ */
+
+/* #undef HAVE_SYSTEMD */
+
+
+/*
+ * Do we have upstart support?
+ */
+
+/* #undef HAVE_UPSTART */
 
 
 /*
@@ -740,10 +760,4 @@ static __inline int _cups_abs(int i) { return (i < 0 ? -i : i); }
 #  endif /* __GNUC__ || __STDC_VERSION__ */
 #endif /* !HAVE_ABS && !abs */
 
-#if defined(HAVE_LAUNCHD) || defined(HAVE_SYSTEMD) || defined(HAVE_UPSTART)
-#  define HAVE_ONDEMAND
-#else
-#  undef HAVE_ONDEMAND
-#endif
-
 #endif /* !_CUPS_CONFIG_H_ */