From 856361ff5b8ce701cdb447085931d3076ee52008 Mon Sep 17 00:00:00 2001 From: Havoc Pennington Date: Sun, 6 Apr 2003 23:15:41 +0000 Subject: 2003-04-06 Havoc Pennington * dbus/dbus-sysdeps.c (_dbus_become_daemon): write the pidfile here in the parent process, so we can return an error if it fails. Also, move some of the code into the child so the parent is less hosed if we fail midway through. * bus/bus.c (bus_context_new): move pidfile detection further up in the function, before we start overwriting sockets and such. * bus/messagebus.in: adjust this a bit, not sure if it will work. * configure.in: add --with-system-pid-file and --with-system-socket 2003-04-06 Colin Walters * configure.in (DBUS_SYSTEM_PID_FILE): New variable. * bus/system.conf.in: Declare a pidfile. * bus/bus.c (bus_context_new): Test for an existing pid file, and create one (if appropriate). * bus/config-parser.c (enum ElementType) [ELEMENT_PIDFILE]: New. (struct BusConfigParser) [pidfile]: New. (element_type_to_name, merge_included, start_busconfig_child) (bus_config_parser_end_element, bus_config_parser_content): Handle it. (bus_config_parser_unref): Free it. (bus_config_parser_get_pidfile): New function. * bus/config-parser.h (_dbus_write_pid_file): Prototype. * dbus/dbus-errors.h (DBUS_ERROR_PIDFILE_EXISTS): New error. * dbus/dbus-sysdeps.c (_dbus_write_pid_file): New function. * dbus/dbus-sysdeps.h: Prototype it. --- configure.in | 49 ++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 38 insertions(+), 11 deletions(-) (limited to 'configure.in') diff --git a/configure.in b/configure.in index d37a7c4b..e908d3ee 100644 --- a/configure.in +++ b/configure.in @@ -35,6 +35,8 @@ AC_ARG_WITH(xml, [ --with-xml=[libxml/expat] XML library to use] AC_ARG_WITH(init-scripts, [ --with-init-scripts=[redhat] Style of init scripts to install]) AC_ARG_WITH(session-socket-dir, [ --with-session-socket-dir=[dirname] Where to put sockets for the per-login-session message bus]) AC_ARG_WITH(test-socket-dir, [ --with-test-socket-dir=[dirname] Where to put sockets for make check]) +AC_ARG_WITH(system-pid-file, [ --with-system-pid-file=[pidfile] PID file for systemwide daemon]) +AC_ARG_WITH(system-socket, [ --with-system-socket=[filename] UNIX domain socket for systemwide daemon]) dnl DBUS_BUILD_TESTS controls unit tests built in to .c files dnl and also some stuff in the test/ subdir @@ -385,12 +387,9 @@ dnl Qt flags AC_SUBST(DBUS_QT_CXXFLAGS) AC_SUBST(DBUS_QT_LIBS) -##### Set up location for system bus socket -## name of socket relative to localstatedir -DBUS_SYSTEM_SOCKET=run/dbus/system_bus_socket -AC_SUBST(DBUS_SYSTEM_SOCKET) - #### find the actual value for $prefix that we'll end up with +## (I know this is broken and should be done in the Makefile, but +## that's a major pain and almost nobody actually seems to care) REAL_PREFIX= if test "x$prefix" = "xNONE"; then REAL_PREFIX=$ac_default_prefix @@ -421,18 +420,45 @@ EXPANDED_BINDIR=`eval echo $BINDIR_TMP` prefix=$old_prefix AC_SUBST(EXPANDED_BINDIR) +#### Check our operating system +operating_system=unknown +if test -f /etc/redhat-release || test -f $EXPANDED_SYSCONFDIR/redhat-release ; then + operating_system=redhat +fi + #### Sort out init scripts if test x$with_init_scripts = x; then - if test -f /etc/redhat-release || test -f $EXPANDED_SYSCONFDIR/redhat-release ; then - with_init_scripts=redhat - else - with_init_scripts=none - fi + if test xredhat = x$operating_system ; then + with_init_scripts=redhat + else + with_init_scripts=none + fi fi AM_CONDITIONAL(DBUS_INIT_SCRIPTS_RED_HAT, test x$with_init_scripts = xredhat) + +##### Set up location for system bus socket +if ! test -z "$with_system_socket"; then + DBUS_SYSTEM_SOCKET=$with_system_socket +else + DBUS_SYSTEM_SOCKET=${EXPANDED_LOCALSTATEDIR}/run/dbus/system_bus_socket +fi + +AC_SUBST(DBUS_SYSTEM_SOCKET) + +#### Set up the pid file +if ! test -z "$with_system_pid_file"; then + DBUS_SYSTEM_PID_FILE=$with_system_pid_file +elif test x$operating_system = xredhat ; then + DBUS_SYSTEM_PID_FILE=${EXPANDED_LOCALSTATEDIR}/run/messagebus.pid +else + DBUS_SYSTEM_PID_FILE=${EXPANDED_LOCALSTATEDIR}/run/dbus/pid +fi + +AC_SUBST(DBUS_SYSTEM_PID_FILE) + #### Tell tests where to find certain stuff in builddir ABSOLUTE_TOP_BUILDDIR=`cd ${ac_top_builddir}. && pwd` @@ -512,7 +538,8 @@ echo " Building GLib bindings: ${have_glib} Using XML parser: ${with_xml} Init scripts style: ${with_init_scripts} - System bus socket: ${EXPANDED_LOCALSTATEDIR}/${DBUS_SYSTEM_SOCKET} + System bus socket: ${DBUS_SYSTEM_SOCKET} + System bus PID file: ${DBUS_SYSTEM_PID_FILE} Session bus socket dir: ${DBUS_SESSION_SOCKET_DIR} 'make check' socket dir: ${TEST_SOCKET_DIR} " -- cgit