fi
fi
+dnl Upstart is also used on Linux (e.g., Chrome OS)
+AC_ARG_ENABLE(upstart, [ --enable-upstart enable upstart support])
+if test "x$enable_upstart" = "xyes"; then
+ if test "x$have_systemd" = "xyes"; then
+ AC_MSG_ERROR(Cannot support both systemd and upstart.)
+ fi
+ AC_DEFINE(HAVE_UPSTART)
+fi
+
dnl Solaris uses smf
SMFMANIFESTDIR=""
AC_SUBST(SMFMANIFESTDIR)
#undef HAVE_SYSTEMD
+/*
+ * Do we have upstart support?
+ */
+
+#undef HAVE_UPSTART
+
/*
* Various scripting languages...
# endif /* __GNUC__ || __STDC_VERSION__ */
#endif /* !HAVE_ABS && !abs */
-#if defined(HAVE_LAUNCHD) || defined(HAVE_SYSTEMD)
+#if defined(HAVE_LAUNCHD) || defined(HAVE_SYSTEMD) || defined(HAVE_UPSTART)
# define HAVE_ONDEMAND
#else
# undef HAVE_ONDEMAND
enable_launchd
enable_systemd
with_systemd
+enable_upstart
with_smfmanifestdir
with_rcdir
with_rclevels
--disable-dnssd disable DNS Service Discovery support using mDNSResponder
--disable-launchd disable launchd support
--disable-systemd disable systemd support
+ --enable-upstart enable upstart support
--enable-page-logging enable page_log by default
--disable-browsing disable Browsing by default
--disable-default-shared
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 << 62) - 1 + ((off_t) 1 << 62))
+#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
&& LARGE_OFF_T % 2147483647 == 1)
? 1 : -1];
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 << 62) - 1 + ((off_t) 1 << 62))
+#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
&& LARGE_OFF_T % 2147483647 == 1)
? 1 : -1];
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 << 62) - 1 + ((off_t) 1 << 62))
+#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
&& LARGE_OFF_T % 2147483647 == 1)
? 1 : -1];
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 << 62) - 1 + ((off_t) 1 << 62))
+#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
&& LARGE_OFF_T % 2147483647 == 1)
? 1 : -1];
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 << 62) - 1 + ((off_t) 1 << 62))
+#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
&& LARGE_OFF_T % 2147483647 == 1)
? 1 : -1];
fi
fi
+# Check whether --enable-upstart was given.
+if test "${enable_upstart+set}" = set; then :
+ enableval=$enable_upstart;
+fi
+
+if test "x$enable_upstart" = "xyes"; then
+ if test "x$have_systemd" = "xyes"; then
+ as_fn_error $? "Cannot support both systemd and upstart." "$LINENO" 5
+ fi
+ $as_echo "#define HAVE_UPSTART 1" >>confdefs.h
+
+fi
+
SMFMANIFESTDIR=""
http_addr_t address; /* Bind address of socket */
http_encryption_t encryption; /* To encrypt or not to encrypt... */
#if defined(HAVE_ONDEMAND)
- int on_demand; /* Is this a socket from launchd/systemd? */
+ int on_demand; /* Is this a socket from launchd/systemd/upstart? */
#endif /* HAVE_ONDEMAND */
} cupsd_listener_t;
#ifdef HAVE_LAUNCH_H
# include <launch.h>
# include <libgen.h>
-# define CUPS_KEEPALIVE CUPS_CACHEDIR "/org.cups.cupsd"
- /* Name of the launchd KeepAlive file */
# 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);
#ifdef HAVE_SYSTEMD
# include <systemd/sd-daemon.h>
-# define CUPS_KEEPALIVE CUPS_CACHEDIR "/org.cups.cupsd"
- /* Name of the systemd path file */
#endif /* HAVE_SYSTEMD */
+#ifdef HAVE_ONDEMAND
+# define CUPS_KEEPALIVE CUPS_CACHEDIR "/org.cups.cupsd"
+ /* Name of the KeepAlive file */
+#endif
+
#if defined(HAVE_MALLOC_H) && defined(HAVE_MALLINFO)
# include <malloc.h>
#endif /* HAVE_MALLOC_H && HAVE_MALLINFO */
usage(0);
break;
- case 'l' : /* Started by launchd/systemd... */
+ case 'l' : /* Started by launchd/systemd/upstart... */
#if defined(HAVE_ONDEMAND)
OnDemand = 1;
fg = 1;
launch_data_free(ld_msg);
launch_data_free(ld_resp);
-# else /* HAVE_SYSTEMD */
+# elif defined(HAVE_SYSTEMD)
int i, /* Looping var */
count; /* Number of listeners */
{
add_ondemand_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.");
+ exit(EXIT_FAILURE);
+ return;
+ }
+
+ if (strcasecmp(e, "socket"))
+ {
+ 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")))
+ {
+ 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));
+ exit(EXIT_FAILURE);
+ return;
+ }
+
+ /* Upstart only supportst a single on-demand socket fd */
+ add_ondemand_listener(fd, 0);
+
+# else
+# error "Error: defined HAVE_ONDEMAND but no launchd/systemd/upstart selection"
# endif /* HAVE_LAUNCH_ACTIVATE_SOCKET */
}
# endif /* __GNUC__ || __STDC_VERSION__ */
#endif /* !HAVE_ABS && !abs */
-#if defined(HAVE_LAUNCHD) || defined(HAVE_SYSTEMD)
+#if defined(HAVE_LAUNCHD) || defined(HAVE_SYSTEMD) || defined(HAVE_UPSTART)
# define HAVE_ONDEMAND
#else
# undef HAVE_ONDEMAND
# endif /* __GNUC__ || __STDC_VERSION__ */
#endif /* !HAVE_ABS && !abs */
-#if defined(HAVE_LAUNCHD) || defined(HAVE_SYSTEMD)
+#if defined(HAVE_LAUNCHD) || defined(HAVE_SYSTEMD) || defined(HAVE_UPSTART)
# define HAVE_ONDEMAND
#else
# undef HAVE_ONDEMAND