Compare commits
11 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
907b626736 | ||
|
|
40ea9ad01d | ||
|
|
6f361193c1 | ||
|
|
71798b30ad | ||
|
|
db45477d6b | ||
|
|
5831b51228 | ||
|
|
118787f932 | ||
|
|
09b57d713c | ||
|
|
e403b47b7e | ||
| 938443e9ca | |||
|
|
812f8fb6eb |
14 changed files with 1225 additions and 641 deletions
|
|
@ -1,3 +0,0 @@
|
|||
upstart-0.6.3.tar.bz2
|
||||
upstart-remove-tests.patch
|
||||
init-system-dbus.conf
|
||||
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
upstart-0.6.5.tar.gz
|
||||
21
Makefile
21
Makefile
|
|
@ -1,21 +0,0 @@
|
|||
# Makefile for source rpm: upstart
|
||||
# $Id: Makefile,v 1.1 2008/02/07 02:32:39 kevin Exp $
|
||||
NAME := upstart
|
||||
SPECFILE = $(firstword $(wildcard *.spec))
|
||||
|
||||
define find-makefile-common
|
||||
for d in common ../common ../../common ; do if [ -f $$d/Makefile.common ] ; then if [ -f $$d/CVS/Root -a -w $$d/Makefile.common ] ; then cd $$d ; cvs -Q update ; fi ; echo "$$d/Makefile.common" ; break ; fi ; done
|
||||
endef
|
||||
|
||||
MAKEFILE_COMMON := $(shell $(find-makefile-common))
|
||||
|
||||
ifeq ($(MAKEFILE_COMMON),)
|
||||
# attept a checkout
|
||||
define checkout-makefile-common
|
||||
test -f CVS/Root && { cvs -Q -d $$(cat CVS/Root) checkout common && echo "common/Makefile.common" ; } || { echo "ERROR: I can't figure out how to checkout the 'common' module." ; exit -1 ; } >&2
|
||||
endef
|
||||
|
||||
MAKEFILE_COMMON := $(shell $(checkout-makefile-common))
|
||||
endif
|
||||
|
||||
include $(MAKEFILE_COMMON)
|
||||
6
init-system-dbus.conf
Normal file
6
init-system-dbus.conf
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
# init-system-dbus - tell init process to connect to system dbus server
|
||||
|
||||
start on started messagebus
|
||||
|
||||
task
|
||||
exec /bin/kill -USR1 1
|
||||
3
sources
3
sources
|
|
@ -1,2 +1 @@
|
|||
ef9d2704426423f75d1e0c309ecfceb4 upstart-0.6.3.tar.bz2
|
||||
bf835fea1be622a5d68f168bd63f91e5 init-system-dbus.conf
|
||||
f9466bba72b655c2408353b64105853f upstart-0.6.5.tar.gz
|
||||
|
|
|
|||
|
|
@ -1,63 +1,753 @@
|
|||
diff --git a/util/Makefile.in b/util/Makefile.in
|
||||
index 26025ce..f7b61a3 100644
|
||||
--- a/util/Makefile.in
|
||||
+++ b/util/Makefile.in
|
||||
@@ -376,6 +376,7 @@ reboot_SOURCES = \
|
||||
reboot_LDFLAGS = -static
|
||||
diff --git a/Makefile.in b/Makefile.in
|
||||
index a9550df..bdd0def 100644
|
||||
--- a/Makefile.in
|
||||
+++ b/Makefile.in
|
||||
@@ -49,17 +49,18 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/codeset.m4 \
|
||||
$(top_srcdir)/m4/inttypes-pri.m4 \
|
||||
$(top_srcdir)/m4/inttypes_h.m4 $(top_srcdir)/m4/lcmessage.m4 \
|
||||
$(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
|
||||
- $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libnih.m4 \
|
||||
- $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/lock.m4 \
|
||||
- $(top_srcdir)/m4/longlong.m4 $(top_srcdir)/m4/ltoptions.m4 \
|
||||
- $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
|
||||
- $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \
|
||||
- $(top_srcdir)/m4/pkg.m4 $(top_srcdir)/m4/po.m4 \
|
||||
- $(top_srcdir)/m4/printf-posix.m4 $(top_srcdir)/m4/progtest.m4 \
|
||||
- $(top_srcdir)/m4/size_max.m4 $(top_srcdir)/m4/stdint_h.m4 \
|
||||
- $(top_srcdir)/m4/uintmax_t.m4 $(top_srcdir)/m4/visibility.m4 \
|
||||
- $(top_srcdir)/m4/wchar_t.m4 $(top_srcdir)/m4/wint_t.m4 \
|
||||
- $(top_srcdir)/m4/xsize.m4 $(top_srcdir)/configure.ac
|
||||
+ $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libaudit.m4 \
|
||||
+ $(top_srcdir)/m4/libnih.m4 $(top_srcdir)/m4/libtool.m4 \
|
||||
+ $(top_srcdir)/m4/lock.m4 $(top_srcdir)/m4/longlong.m4 \
|
||||
+ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
|
||||
+ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
|
||||
+ $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/pkg.m4 \
|
||||
+ $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/printf-posix.m4 \
|
||||
+ $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/size_max.m4 \
|
||||
+ $(top_srcdir)/m4/stdint_h.m4 $(top_srcdir)/m4/uintmax_t.m4 \
|
||||
+ $(top_srcdir)/m4/visibility.m4 $(top_srcdir)/m4/wchar_t.m4 \
|
||||
+ $(top_srcdir)/m4/wint_t.m4 $(top_srcdir)/m4/xsize.m4 \
|
||||
+ $(top_srcdir)/configure.ac
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
|
||||
@@ -132,6 +133,7 @@ ALLOCA = @ALLOCA@
|
||||
AMTAR = @AMTAR@
|
||||
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
|
||||
AR = @AR@
|
||||
+AUDIT_LDADD = @AUDIT_LDADD@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
diff --git a/aclocal.m4 b/aclocal.m4
|
||||
index 3d3673e..6e09291 100644
|
||||
--- a/aclocal.m4
|
||||
+++ b/aclocal.m4
|
||||
@@ -1066,6 +1066,7 @@ m4_include([m4/lcmessage.m4])
|
||||
m4_include([m4/lib-ld.m4])
|
||||
m4_include([m4/lib-link.m4])
|
||||
m4_include([m4/lib-prefix.m4])
|
||||
+m4_include([m4/libaudit.m4])
|
||||
m4_include([m4/libnih.m4])
|
||||
m4_include([m4/libtool.m4])
|
||||
m4_include([m4/lock.m4])
|
||||
diff --git a/conf/Makefile.in b/conf/Makefile.in
|
||||
index 29fd9b7..82c3f99 100644
|
||||
--- a/conf/Makefile.in
|
||||
+++ b/conf/Makefile.in
|
||||
@@ -46,17 +46,18 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/codeset.m4 \
|
||||
$(top_srcdir)/m4/inttypes-pri.m4 \
|
||||
$(top_srcdir)/m4/inttypes_h.m4 $(top_srcdir)/m4/lcmessage.m4 \
|
||||
$(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
|
||||
- $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libnih.m4 \
|
||||
- $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/lock.m4 \
|
||||
- $(top_srcdir)/m4/longlong.m4 $(top_srcdir)/m4/ltoptions.m4 \
|
||||
- $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
|
||||
- $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \
|
||||
- $(top_srcdir)/m4/pkg.m4 $(top_srcdir)/m4/po.m4 \
|
||||
- $(top_srcdir)/m4/printf-posix.m4 $(top_srcdir)/m4/progtest.m4 \
|
||||
- $(top_srcdir)/m4/size_max.m4 $(top_srcdir)/m4/stdint_h.m4 \
|
||||
- $(top_srcdir)/m4/uintmax_t.m4 $(top_srcdir)/m4/visibility.m4 \
|
||||
- $(top_srcdir)/m4/wchar_t.m4 $(top_srcdir)/m4/wint_t.m4 \
|
||||
- $(top_srcdir)/m4/xsize.m4 $(top_srcdir)/configure.ac
|
||||
+ $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libaudit.m4 \
|
||||
+ $(top_srcdir)/m4/libnih.m4 $(top_srcdir)/m4/libtool.m4 \
|
||||
+ $(top_srcdir)/m4/lock.m4 $(top_srcdir)/m4/longlong.m4 \
|
||||
+ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
|
||||
+ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
|
||||
+ $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/pkg.m4 \
|
||||
+ $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/printf-posix.m4 \
|
||||
+ $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/size_max.m4 \
|
||||
+ $(top_srcdir)/m4/stdint_h.m4 $(top_srcdir)/m4/uintmax_t.m4 \
|
||||
+ $(top_srcdir)/m4/visibility.m4 $(top_srcdir)/m4/wchar_t.m4 \
|
||||
+ $(top_srcdir)/m4/wint_t.m4 $(top_srcdir)/m4/xsize.m4 \
|
||||
+ $(top_srcdir)/configure.ac
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
@@ -100,6 +101,7 @@ ALLOCA = @ALLOCA@
|
||||
AMTAR = @AMTAR@
|
||||
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
|
||||
AR = @AR@
|
||||
+AUDIT_LDADD = @AUDIT_LDADD@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
diff --git a/config.h.in b/config.h.in
|
||||
index 8a7d63f..8d000aa 100644
|
||||
--- a/config.h.in
|
||||
+++ b/config.h.in
|
||||
@@ -118,6 +118,9 @@
|
||||
/* Define if your <locale.h> file defines LC_MESSAGES. */
|
||||
#undef HAVE_LC_MESSAGES
|
||||
|
||||
+/* linux audit support */
|
||||
+#undef HAVE_LIBAUDIT
|
||||
+
|
||||
/* Define to 1 if you have the <limits.h> header file. */
|
||||
#undef HAVE_LIMITS_H
|
||||
|
||||
diff --git a/configure b/configure
|
||||
index 9bad2db..2f93ef5 100755
|
||||
--- a/configure
|
||||
+++ b/configure
|
||||
@@ -751,6 +751,7 @@ ac_subst_vars='am__EXEEXT_FALSE
|
||||
am__EXEEXT_TRUE
|
||||
LTLIBOBJS
|
||||
LIBOBJS
|
||||
+AUDIT_LDADD
|
||||
DBUS_LIBS
|
||||
DBUS_CFLAGS
|
||||
NIH_DBUS_LIBS
|
||||
@@ -938,6 +939,7 @@ with_included_gettext
|
||||
with_libintl_prefix
|
||||
with_local_libnih
|
||||
enable_threading
|
||||
+with_libaudit
|
||||
enable_compiler_warnings
|
||||
enable_compiler_optimisations
|
||||
enable_compiler_coverage
|
||||
@@ -1620,6 +1622,7 @@ Optional Packages:
|
||||
--without-libintl-prefix don't search for libintl in includedir and libdir
|
||||
--with-local-libnih[=DIR]
|
||||
Use libnih from source tree DIR
|
||||
+ --with-libaudit=auto/yes/no Add Linux audit support default=auto
|
||||
|
||||
Some influential environment variables:
|
||||
CC C compiler command
|
||||
@@ -5220,13 +5223,13 @@ if test "${lt_cv_nm_interface+set}" = set; then :
|
||||
else
|
||||
lt_cv_nm_interface="BSD nm"
|
||||
echo "int some_variable = 0;" > conftest.$ac_ext
|
||||
- (eval echo "\"\$as_me:5223: $ac_compile\"" >&5)
|
||||
+ (eval echo "\"\$as_me:5226: $ac_compile\"" >&5)
|
||||
(eval "$ac_compile" 2>conftest.err)
|
||||
cat conftest.err >&5
|
||||
- (eval echo "\"\$as_me:5226: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
|
||||
+ (eval echo "\"\$as_me:5229: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
|
||||
(eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
|
||||
cat conftest.err >&5
|
||||
- (eval echo "\"\$as_me:5229: output\"" >&5)
|
||||
+ (eval echo "\"\$as_me:5232: output\"" >&5)
|
||||
cat conftest.out >&5
|
||||
if $GREP 'External.*some_variable' conftest.out > /dev/null; then
|
||||
lt_cv_nm_interface="MS dumpbin"
|
||||
@@ -6431,7 +6434,7 @@ ia64-*-hpux*)
|
||||
;;
|
||||
*-*-irix6*)
|
||||
# Find out which ABI we are using.
|
||||
- echo '#line 6434 "configure"' > conftest.$ac_ext
|
||||
+ echo '#line 6437 "configure"' > conftest.$ac_ext
|
||||
if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
|
||||
(eval $ac_compile) 2>&5
|
||||
ac_status=$?
|
||||
@@ -7693,11 +7696,11 @@ else
|
||||
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
|
||||
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
|
||||
-e 's:$: $lt_compiler_flag:'`
|
||||
- (eval echo "\"\$as_me:7696: $lt_compile\"" >&5)
|
||||
+ (eval echo "\"\$as_me:7699: $lt_compile\"" >&5)
|
||||
(eval "$lt_compile" 2>conftest.err)
|
||||
ac_status=$?
|
||||
cat conftest.err >&5
|
||||
- echo "$as_me:7700: \$? = $ac_status" >&5
|
||||
+ echo "$as_me:7703: \$? = $ac_status" >&5
|
||||
if (exit $ac_status) && test -s "$ac_outfile"; then
|
||||
# The compiler can only warn and ignore the option if not recognized
|
||||
# So say no if there are warnings other than the usual output.
|
||||
@@ -8032,11 +8035,11 @@ else
|
||||
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
|
||||
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
|
||||
-e 's:$: $lt_compiler_flag:'`
|
||||
- (eval echo "\"\$as_me:8035: $lt_compile\"" >&5)
|
||||
+ (eval echo "\"\$as_me:8038: $lt_compile\"" >&5)
|
||||
(eval "$lt_compile" 2>conftest.err)
|
||||
ac_status=$?
|
||||
cat conftest.err >&5
|
||||
- echo "$as_me:8039: \$? = $ac_status" >&5
|
||||
+ echo "$as_me:8042: \$? = $ac_status" >&5
|
||||
if (exit $ac_status) && test -s "$ac_outfile"; then
|
||||
# The compiler can only warn and ignore the option if not recognized
|
||||
# So say no if there are warnings other than the usual output.
|
||||
@@ -8137,11 +8140,11 @@ else
|
||||
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
|
||||
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
|
||||
-e 's:$: $lt_compiler_flag:'`
|
||||
- (eval echo "\"\$as_me:8140: $lt_compile\"" >&5)
|
||||
+ (eval echo "\"\$as_me:8143: $lt_compile\"" >&5)
|
||||
(eval "$lt_compile" 2>out/conftest.err)
|
||||
ac_status=$?
|
||||
cat out/conftest.err >&5
|
||||
- echo "$as_me:8144: \$? = $ac_status" >&5
|
||||
+ echo "$as_me:8147: \$? = $ac_status" >&5
|
||||
if (exit $ac_status) && test -s out/conftest2.$ac_objext
|
||||
then
|
||||
# The compiler can only warn and ignore the option if not recognized
|
||||
@@ -8192,11 +8195,11 @@ else
|
||||
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
|
||||
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
|
||||
-e 's:$: $lt_compiler_flag:'`
|
||||
- (eval echo "\"\$as_me:8195: $lt_compile\"" >&5)
|
||||
+ (eval echo "\"\$as_me:8198: $lt_compile\"" >&5)
|
||||
(eval "$lt_compile" 2>out/conftest.err)
|
||||
ac_status=$?
|
||||
cat out/conftest.err >&5
|
||||
- echo "$as_me:8199: \$? = $ac_status" >&5
|
||||
+ echo "$as_me:8202: \$? = $ac_status" >&5
|
||||
if (exit $ac_status) && test -s out/conftest2.$ac_objext
|
||||
then
|
||||
# The compiler can only warn and ignore the option if not recognized
|
||||
@@ -10576,7 +10579,7 @@ else
|
||||
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
|
||||
lt_status=$lt_dlunknown
|
||||
cat > conftest.$ac_ext <<_LT_EOF
|
||||
-#line 10579 "configure"
|
||||
+#line 10582 "configure"
|
||||
#include "confdefs.h"
|
||||
|
||||
#if HAVE_DLFCN_H
|
||||
@@ -10672,7 +10675,7 @@ else
|
||||
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
|
||||
lt_status=$lt_dlunknown
|
||||
cat > conftest.$ac_ext <<_LT_EOF
|
||||
-#line 10675 "configure"
|
||||
+#line 10678 "configure"
|
||||
#include "confdefs.h"
|
||||
|
||||
#if HAVE_DLFCN_H
|
||||
@@ -17209,6 +17212,72 @@ fi
|
||||
|
||||
# Checks for library functions.
|
||||
|
||||
+
|
||||
+# Check whether --with-libaudit was given.
|
||||
+if test "${with_libaudit+set}" = set; then :
|
||||
+ withval=$with_libaudit;
|
||||
+else
|
||||
+ with_libaudit=auto
|
||||
+fi
|
||||
+
|
||||
+
|
||||
+ # Check for Linux auditing API
|
||||
+ #
|
||||
+ # libaudit detection
|
||||
+
|
||||
+ if test x$with_libaudit = xno ; then
|
||||
+ have_libaudit=no;
|
||||
+ else
|
||||
+ # See if we have audit daemon library
|
||||
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for audit_log_user_message in -laudit" >&5
|
||||
+$as_echo_n "checking for audit_log_user_message in -laudit... " >&6; }
|
||||
+if test "${ac_cv_lib_audit_audit_log_user_message+set}" = set; then :
|
||||
+ $as_echo_n "(cached) " >&6
|
||||
+else
|
||||
+ ac_check_lib_save_LIBS=$LIBS
|
||||
+LIBS="-laudit $LIBS"
|
||||
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
+/* end confdefs.h. */
|
||||
+
|
||||
+/* Override any GCC internal prototype to avoid an error.
|
||||
+ Use char because int might match the return type of a GCC
|
||||
+ builtin and then its argument prototype would still apply. */
|
||||
+#ifdef __cplusplus
|
||||
+extern "C"
|
||||
+#endif
|
||||
+char audit_log_user_message ();
|
||||
+int
|
||||
+main ()
|
||||
+{
|
||||
+return audit_log_user_message ();
|
||||
+ ;
|
||||
+ return 0;
|
||||
+}
|
||||
+_ACEOF
|
||||
+if ac_fn_c_try_link "$LINENO"; then :
|
||||
+ ac_cv_lib_audit_audit_log_user_message=yes
|
||||
+else
|
||||
+ ac_cv_lib_audit_audit_log_user_message=no
|
||||
+fi
|
||||
+rm -f core conftest.err conftest.$ac_objext \
|
||||
+ conftest$ac_exeext conftest.$ac_ext
|
||||
+LIBS=$ac_check_lib_save_LIBS
|
||||
+fi
|
||||
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_audit_audit_log_user_message" >&5
|
||||
+$as_echo "$ac_cv_lib_audit_audit_log_user_message" >&6; }
|
||||
+if test "x$ac_cv_lib_audit_audit_log_user_message" = x""yes; then :
|
||||
+ AUDIT_LDADD=-laudit
|
||||
+fi
|
||||
+
|
||||
+ fi
|
||||
+
|
||||
+ if test x$AUDIT_LDADD != x ; then
|
||||
+
|
||||
+$as_echo "#define HAVE_LIBAUDIT 1" >>confdefs.h
|
||||
+
|
||||
+ fi
|
||||
+
|
||||
+
|
||||
# Other checks
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to include sbindir in PATH" >&5
|
||||
$as_echo_n "checking whether to include sbindir in PATH... " >&6; }
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index fb79a13..3dc1550 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -54,6 +54,7 @@ AM_PROG_CC_C_O
|
||||
NIH_C_THREAD
|
||||
|
||||
# Checks for library functions.
|
||||
+LINUX_AUDIT
|
||||
|
||||
# Other checks
|
||||
AC_MSG_CHECKING([whether to include sbindir in PATH])
|
||||
diff --git a/contrib/Makefile.in b/contrib/Makefile.in
|
||||
index dfe910b..32c7ebd 100644
|
||||
--- a/contrib/Makefile.in
|
||||
+++ b/contrib/Makefile.in
|
||||
@@ -44,17 +44,18 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/codeset.m4 \
|
||||
$(top_srcdir)/m4/inttypes-pri.m4 \
|
||||
$(top_srcdir)/m4/inttypes_h.m4 $(top_srcdir)/m4/lcmessage.m4 \
|
||||
$(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
|
||||
- $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libnih.m4 \
|
||||
- $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/lock.m4 \
|
||||
- $(top_srcdir)/m4/longlong.m4 $(top_srcdir)/m4/ltoptions.m4 \
|
||||
- $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
|
||||
- $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \
|
||||
- $(top_srcdir)/m4/pkg.m4 $(top_srcdir)/m4/po.m4 \
|
||||
- $(top_srcdir)/m4/printf-posix.m4 $(top_srcdir)/m4/progtest.m4 \
|
||||
- $(top_srcdir)/m4/size_max.m4 $(top_srcdir)/m4/stdint_h.m4 \
|
||||
- $(top_srcdir)/m4/uintmax_t.m4 $(top_srcdir)/m4/visibility.m4 \
|
||||
- $(top_srcdir)/m4/wchar_t.m4 $(top_srcdir)/m4/wint_t.m4 \
|
||||
- $(top_srcdir)/m4/xsize.m4 $(top_srcdir)/configure.ac
|
||||
+ $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libaudit.m4 \
|
||||
+ $(top_srcdir)/m4/libnih.m4 $(top_srcdir)/m4/libtool.m4 \
|
||||
+ $(top_srcdir)/m4/lock.m4 $(top_srcdir)/m4/longlong.m4 \
|
||||
+ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
|
||||
+ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
|
||||
+ $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/pkg.m4 \
|
||||
+ $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/printf-posix.m4 \
|
||||
+ $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/size_max.m4 \
|
||||
+ $(top_srcdir)/m4/stdint_h.m4 $(top_srcdir)/m4/uintmax_t.m4 \
|
||||
+ $(top_srcdir)/m4/visibility.m4 $(top_srcdir)/m4/wchar_t.m4 \
|
||||
+ $(top_srcdir)/m4/wint_t.m4 $(top_srcdir)/m4/xsize.m4 \
|
||||
+ $(top_srcdir)/configure.ac
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
@@ -75,6 +76,7 @@ ALLOCA = @ALLOCA@
|
||||
AMTAR = @AMTAR@
|
||||
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
|
||||
AR = @AR@
|
||||
+AUDIT_LDADD = @AUDIT_LDADD@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
diff --git a/dbus/Makefile.in b/dbus/Makefile.in
|
||||
index 8294845..38a55ad 100644
|
||||
--- a/dbus/Makefile.in
|
||||
+++ b/dbus/Makefile.in
|
||||
@@ -46,17 +46,18 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/codeset.m4 \
|
||||
$(top_srcdir)/m4/inttypes-pri.m4 \
|
||||
$(top_srcdir)/m4/inttypes_h.m4 $(top_srcdir)/m4/lcmessage.m4 \
|
||||
$(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
|
||||
- $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libnih.m4 \
|
||||
- $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/lock.m4 \
|
||||
- $(top_srcdir)/m4/longlong.m4 $(top_srcdir)/m4/ltoptions.m4 \
|
||||
- $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
|
||||
- $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \
|
||||
- $(top_srcdir)/m4/pkg.m4 $(top_srcdir)/m4/po.m4 \
|
||||
- $(top_srcdir)/m4/printf-posix.m4 $(top_srcdir)/m4/progtest.m4 \
|
||||
- $(top_srcdir)/m4/size_max.m4 $(top_srcdir)/m4/stdint_h.m4 \
|
||||
- $(top_srcdir)/m4/uintmax_t.m4 $(top_srcdir)/m4/visibility.m4 \
|
||||
- $(top_srcdir)/m4/wchar_t.m4 $(top_srcdir)/m4/wint_t.m4 \
|
||||
- $(top_srcdir)/m4/xsize.m4 $(top_srcdir)/configure.ac
|
||||
+ $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libaudit.m4 \
|
||||
+ $(top_srcdir)/m4/libnih.m4 $(top_srcdir)/m4/libtool.m4 \
|
||||
+ $(top_srcdir)/m4/lock.m4 $(top_srcdir)/m4/longlong.m4 \
|
||||
+ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
|
||||
+ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
|
||||
+ $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/pkg.m4 \
|
||||
+ $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/printf-posix.m4 \
|
||||
+ $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/size_max.m4 \
|
||||
+ $(top_srcdir)/m4/stdint_h.m4 $(top_srcdir)/m4/uintmax_t.m4 \
|
||||
+ $(top_srcdir)/m4/visibility.m4 $(top_srcdir)/m4/wchar_t.m4 \
|
||||
+ $(top_srcdir)/m4/wint_t.m4 $(top_srcdir)/m4/xsize.m4 \
|
||||
+ $(top_srcdir)/configure.ac
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
@@ -100,6 +101,7 @@ ALLOCA = @ALLOCA@
|
||||
AMTAR = @AMTAR@
|
||||
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
|
||||
AR = @AR@
|
||||
+AUDIT_LDADD = @AUDIT_LDADD@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
diff --git a/doc/Makefile.in b/doc/Makefile.in
|
||||
index b17181c..add3022 100644
|
||||
--- a/doc/Makefile.in
|
||||
+++ b/doc/Makefile.in
|
||||
@@ -44,17 +44,18 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/codeset.m4 \
|
||||
$(top_srcdir)/m4/inttypes-pri.m4 \
|
||||
$(top_srcdir)/m4/inttypes_h.m4 $(top_srcdir)/m4/lcmessage.m4 \
|
||||
$(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
|
||||
- $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libnih.m4 \
|
||||
- $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/lock.m4 \
|
||||
- $(top_srcdir)/m4/longlong.m4 $(top_srcdir)/m4/ltoptions.m4 \
|
||||
- $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
|
||||
- $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \
|
||||
- $(top_srcdir)/m4/pkg.m4 $(top_srcdir)/m4/po.m4 \
|
||||
- $(top_srcdir)/m4/printf-posix.m4 $(top_srcdir)/m4/progtest.m4 \
|
||||
- $(top_srcdir)/m4/size_max.m4 $(top_srcdir)/m4/stdint_h.m4 \
|
||||
- $(top_srcdir)/m4/uintmax_t.m4 $(top_srcdir)/m4/visibility.m4 \
|
||||
- $(top_srcdir)/m4/wchar_t.m4 $(top_srcdir)/m4/wint_t.m4 \
|
||||
- $(top_srcdir)/m4/xsize.m4 $(top_srcdir)/configure.ac
|
||||
+ $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libaudit.m4 \
|
||||
+ $(top_srcdir)/m4/libnih.m4 $(top_srcdir)/m4/libtool.m4 \
|
||||
+ $(top_srcdir)/m4/lock.m4 $(top_srcdir)/m4/longlong.m4 \
|
||||
+ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
|
||||
+ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
|
||||
+ $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/pkg.m4 \
|
||||
+ $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/printf-posix.m4 \
|
||||
+ $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/size_max.m4 \
|
||||
+ $(top_srcdir)/m4/stdint_h.m4 $(top_srcdir)/m4/uintmax_t.m4 \
|
||||
+ $(top_srcdir)/m4/visibility.m4 $(top_srcdir)/m4/wchar_t.m4 \
|
||||
+ $(top_srcdir)/m4/wint_t.m4 $(top_srcdir)/m4/xsize.m4 \
|
||||
+ $(top_srcdir)/configure.ac
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
@@ -75,6 +76,7 @@ ALLOCA = @ALLOCA@
|
||||
AMTAR = @AMTAR@
|
||||
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
|
||||
AR = @AR@
|
||||
+AUDIT_LDADD = @AUDIT_LDADD@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
diff --git a/init/Makefile.in b/init/Makefile.in
|
||||
index c677761..9ca3de6 100644
|
||||
--- a/init/Makefile.in
|
||||
+++ b/init/Makefile.in
|
||||
@@ -55,17 +55,18 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/codeset.m4 \
|
||||
$(top_srcdir)/m4/inttypes-pri.m4 \
|
||||
$(top_srcdir)/m4/inttypes_h.m4 $(top_srcdir)/m4/lcmessage.m4 \
|
||||
$(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
|
||||
- $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libnih.m4 \
|
||||
- $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/lock.m4 \
|
||||
- $(top_srcdir)/m4/longlong.m4 $(top_srcdir)/m4/ltoptions.m4 \
|
||||
- $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
|
||||
- $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \
|
||||
- $(top_srcdir)/m4/pkg.m4 $(top_srcdir)/m4/po.m4 \
|
||||
- $(top_srcdir)/m4/printf-posix.m4 $(top_srcdir)/m4/progtest.m4 \
|
||||
- $(top_srcdir)/m4/size_max.m4 $(top_srcdir)/m4/stdint_h.m4 \
|
||||
- $(top_srcdir)/m4/uintmax_t.m4 $(top_srcdir)/m4/visibility.m4 \
|
||||
- $(top_srcdir)/m4/wchar_t.m4 $(top_srcdir)/m4/wint_t.m4 \
|
||||
- $(top_srcdir)/m4/xsize.m4 $(top_srcdir)/configure.ac
|
||||
+ $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libaudit.m4 \
|
||||
+ $(top_srcdir)/m4/libnih.m4 $(top_srcdir)/m4/libtool.m4 \
|
||||
+ $(top_srcdir)/m4/lock.m4 $(top_srcdir)/m4/longlong.m4 \
|
||||
+ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
|
||||
+ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
|
||||
+ $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/pkg.m4 \
|
||||
+ $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/printf-posix.m4 \
|
||||
+ $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/size_max.m4 \
|
||||
+ $(top_srcdir)/m4/stdint_h.m4 $(top_srcdir)/m4/uintmax_t.m4 \
|
||||
+ $(top_srcdir)/m4/visibility.m4 $(top_srcdir)/m4/wchar_t.m4 \
|
||||
+ $(top_srcdir)/m4/wint_t.m4 $(top_srcdir)/m4/xsize.m4 \
|
||||
+ $(top_srcdir)/configure.ac
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
@@ -283,6 +284,7 @@ ALLOCA = @ALLOCA@
|
||||
AMTAR = @AMTAR@
|
||||
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
|
||||
AR = @AR@
|
||||
+AUDIT_LDADD = @AUDIT_LDADD@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
diff --git a/m4/libaudit.m4 b/m4/libaudit.m4
|
||||
new file mode 100644
|
||||
index 0000000..6865fb8
|
||||
--- /dev/null
|
||||
+++ b/m4/libaudit.m4
|
||||
@@ -0,0 +1,25 @@
|
||||
+# libaudit.m4 - Checks for the Linux Audit System support
|
||||
+# Copyright (c) 2009 Steve Grubb sgrubb@redhat.com
|
||||
+#
|
||||
+AC_DEFUN([LINUX_AUDIT],
|
||||
+[
|
||||
+ AC_ARG_WITH(libaudit,
|
||||
+ [ --with-libaudit=[auto/yes/no] Add Linux audit support [default=auto]],,
|
||||
+ with_libaudit=auto)
|
||||
+
|
||||
+ # Check for Linux auditing API
|
||||
+ #
|
||||
+ # libaudit detection
|
||||
+
|
||||
+ if test x$with_libaudit = xno ; then
|
||||
+ have_libaudit=no;
|
||||
+ else
|
||||
+ # See if we have audit daemon library
|
||||
+ AC_CHECK_LIB(audit, audit_log_user_message,
|
||||
+ AUDIT_LDADD=-laudit,)
|
||||
+ fi
|
||||
+ AC_SUBST(AUDIT_LDADD)
|
||||
+ if test x$AUDIT_LDADD != x ; then
|
||||
+ AC_DEFINE(HAVE_LIBAUDIT,1,[linux audit support])
|
||||
+ fi
|
||||
+])
|
||||
diff --git a/util/Makefile.am b/util/Makefile.am
|
||||
index 0b49c10..9a772d5 100644
|
||||
--- a/util/Makefile.am
|
||||
+++ b/util/Makefile.am
|
||||
@@ -45,14 +45,17 @@ reboot_SOURCES = \
|
||||
utmp.c utmp.h
|
||||
reboot_LDADD = \
|
||||
../nih/libnih.la \
|
||||
+ -laudit \
|
||||
$(LTLIBINTL)
|
||||
$(LTLIBINTL) \
|
||||
- $(NIH_LIBS)
|
||||
+ $(NIH_LIBS) \
|
||||
+ $(AUDIT_LDADD)
|
||||
+
|
||||
|
||||
runlevel_SOURCES = \
|
||||
@@ -399,6 +400,7 @@ shutdown_LDFLAGS = -static
|
||||
shutdown_LDADD = \
|
||||
../nih/libnih.la \
|
||||
../nih-dbus/libnih-dbus.la \
|
||||
+ -laudit \
|
||||
runlevel.c \
|
||||
utmp.c utmp.h
|
||||
runlevel_LDADD = \
|
||||
$(LTLIBINTL) \
|
||||
$(DBUS_LIBS)
|
||||
- $(NIH_LIBS)
|
||||
+ $(NIH_LIBS) \
|
||||
+ $(AUDIT_LDADD)
|
||||
|
||||
@@ -414,6 +416,7 @@ telinit_LDFLAGS = -static
|
||||
telinit_LDADD = \
|
||||
../nih/libnih.la \
|
||||
../nih-dbus/libnih-dbus.la \
|
||||
+ -laudit \
|
||||
shutdown_SOURCES = \
|
||||
shutdown.c \
|
||||
@@ -64,7 +67,8 @@ shutdown_LDADD = \
|
||||
$(LTLIBINTL) \
|
||||
$(DBUS_LIBS)
|
||||
$(NIH_LIBS) \
|
||||
$(NIH_DBUS_LIBS) \
|
||||
- $(DBUS_LIBS)
|
||||
+ $(DBUS_LIBS) \
|
||||
+ $(AUDIT_LDADD)
|
||||
|
||||
@@ -477,6 +480,7 @@ test_sysv_LDADD = \
|
||||
sysv.o utmp.o \
|
||||
../nih/libnih.la \
|
||||
../nih-dbus/libnih-dbus.la \
|
||||
+ -laudit \
|
||||
telinit_SOURCES = \
|
||||
telinit.c \
|
||||
@@ -76,7 +80,8 @@ telinit_LDADD = \
|
||||
$(LTLIBINTL) \
|
||||
$(DBUS_LIBS)
|
||||
$(NIH_LIBS) \
|
||||
$(NIH_DBUS_LIBS) \
|
||||
- $(DBUS_LIBS)
|
||||
+ $(DBUS_LIBS) \
|
||||
+ $(AUDIT_LDADD)
|
||||
|
||||
@@ -489,6 +493,7 @@ test_telinit_LDADD = \
|
||||
|
||||
com_ubuntu_Upstart_OUTPUTS = \
|
||||
@@ -201,7 +206,8 @@ test_sysv_LDADD = \
|
||||
$(LTLIBINTL) \
|
||||
$(NIH_LIBS) \
|
||||
$(NIH_DBUS_LIBS) \
|
||||
- $(DBUS_LIBS)
|
||||
+ $(DBUS_LIBS) \
|
||||
+ $(AUDIT_LDADD)
|
||||
|
||||
test_telinit_SOURCES = tests/test_telinit.c telinit.c
|
||||
test_telinit_CFLAGS = $(AM_CFLAGS) -DTEST
|
||||
@@ -211,7 +217,8 @@ test_telinit_LDADD = \
|
||||
com.ubuntu.Upstart.Job.o com.ubuntu.Upstart.Instance.o \
|
||||
../nih/libnih.la \
|
||||
../nih-dbus/libnih-dbus.la \
|
||||
+ -laudit \
|
||||
$(DBUS_LIBS)
|
||||
$(NIH_LIBS) \
|
||||
$(NIH_DBUS_LIBS) \
|
||||
- $(DBUS_LIBS)
|
||||
+ $(DBUS_LIBS) \
|
||||
+ $(AUDIT_LDADD)
|
||||
|
||||
|
||||
.PHONY: tests
|
||||
diff --git a/util/Makefile.in b/util/Makefile.in
|
||||
index 55e17e5..40776d5 100644
|
||||
--- a/util/Makefile.in
|
||||
+++ b/util/Makefile.in
|
||||
@@ -51,17 +51,18 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/codeset.m4 \
|
||||
$(top_srcdir)/m4/inttypes-pri.m4 \
|
||||
$(top_srcdir)/m4/inttypes_h.m4 $(top_srcdir)/m4/lcmessage.m4 \
|
||||
$(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
|
||||
- $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libnih.m4 \
|
||||
- $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/lock.m4 \
|
||||
- $(top_srcdir)/m4/longlong.m4 $(top_srcdir)/m4/ltoptions.m4 \
|
||||
- $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
|
||||
- $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \
|
||||
- $(top_srcdir)/m4/pkg.m4 $(top_srcdir)/m4/po.m4 \
|
||||
- $(top_srcdir)/m4/printf-posix.m4 $(top_srcdir)/m4/progtest.m4 \
|
||||
- $(top_srcdir)/m4/size_max.m4 $(top_srcdir)/m4/stdint_h.m4 \
|
||||
- $(top_srcdir)/m4/uintmax_t.m4 $(top_srcdir)/m4/visibility.m4 \
|
||||
- $(top_srcdir)/m4/wchar_t.m4 $(top_srcdir)/m4/wint_t.m4 \
|
||||
- $(top_srcdir)/m4/xsize.m4 $(top_srcdir)/configure.ac
|
||||
+ $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libaudit.m4 \
|
||||
+ $(top_srcdir)/m4/libnih.m4 $(top_srcdir)/m4/libtool.m4 \
|
||||
+ $(top_srcdir)/m4/lock.m4 $(top_srcdir)/m4/longlong.m4 \
|
||||
+ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
|
||||
+ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
|
||||
+ $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/pkg.m4 \
|
||||
+ $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/printf-posix.m4 \
|
||||
+ $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/size_max.m4 \
|
||||
+ $(top_srcdir)/m4/stdint_h.m4 $(top_srcdir)/m4/uintmax_t.m4 \
|
||||
+ $(top_srcdir)/m4/visibility.m4 $(top_srcdir)/m4/wchar_t.m4 \
|
||||
+ $(top_srcdir)/m4/wint_t.m4 $(top_srcdir)/m4/xsize.m4 \
|
||||
+ $(top_srcdir)/configure.ac
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
@@ -88,20 +89,24 @@ am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY))
|
||||
am__v_lt_0 = --silent
|
||||
am_reboot_OBJECTS = reboot.$(OBJEXT) utmp.$(OBJEXT)
|
||||
reboot_OBJECTS = $(am_reboot_OBJECTS)
|
||||
-reboot_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
|
||||
+reboot_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
|
||||
+ $(am__DEPENDENCIES_1)
|
||||
am_runlevel_OBJECTS = runlevel.$(OBJEXT) utmp.$(OBJEXT)
|
||||
runlevel_OBJECTS = $(am_runlevel_OBJECTS)
|
||||
-runlevel_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
|
||||
+runlevel_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
|
||||
+ $(am__DEPENDENCIES_1)
|
||||
am_shutdown_OBJECTS = shutdown.$(OBJEXT) utmp.$(OBJEXT) sysv.$(OBJEXT)
|
||||
nodist_shutdown_OBJECTS = $(am__objects_1)
|
||||
shutdown_OBJECTS = $(am_shutdown_OBJECTS) $(nodist_shutdown_OBJECTS)
|
||||
shutdown_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
|
||||
- $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
|
||||
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
|
||||
+ $(am__DEPENDENCIES_1)
|
||||
am_telinit_OBJECTS = telinit.$(OBJEXT) utmp.$(OBJEXT) sysv.$(OBJEXT)
|
||||
nodist_telinit_OBJECTS = $(am__objects_1)
|
||||
telinit_OBJECTS = $(am_telinit_OBJECTS) $(nodist_telinit_OBJECTS)
|
||||
telinit_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
|
||||
- $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
|
||||
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
|
||||
+ $(am__DEPENDENCIES_1)
|
||||
am_test_initctl_OBJECTS = test_initctl-test_initctl.$(OBJEXT) \
|
||||
test_initctl-initctl.$(OBJEXT)
|
||||
test_initctl_OBJECTS = $(am_test_initctl_OBJECTS)
|
||||
@@ -118,14 +123,14 @@ test_sysv_OBJECTS = $(am_test_sysv_OBJECTS) \
|
||||
$(nodist_test_sysv_OBJECTS)
|
||||
test_sysv_DEPENDENCIES = sysv.o utmp.o $(am__DEPENDENCIES_1) \
|
||||
$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
|
||||
- $(am__DEPENDENCIES_1)
|
||||
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
|
||||
am_test_telinit_OBJECTS = test_telinit-test_telinit.$(OBJEXT) \
|
||||
test_telinit-telinit.$(OBJEXT)
|
||||
test_telinit_OBJECTS = $(am_test_telinit_OBJECTS)
|
||||
test_telinit_DEPENDENCIES = sysv.o utmp.o com.ubuntu.Upstart.o \
|
||||
com.ubuntu.Upstart.Job.o com.ubuntu.Upstart.Instance.o \
|
||||
$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
|
||||
- $(am__DEPENDENCIES_1)
|
||||
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
|
||||
test_telinit_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(test_telinit_CFLAGS) \
|
||||
$(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
|
||||
@@ -216,6 +221,7 @@ ALLOCA = @ALLOCA@
|
||||
AMTAR = @AMTAR@
|
||||
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
|
||||
AR = @AR@
|
||||
+AUDIT_LDADD = @AUDIT_LDADD@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
@@ -419,7 +425,8 @@ reboot_SOURCES = \
|
||||
|
||||
reboot_LDADD = \
|
||||
$(LTLIBINTL) \
|
||||
- $(NIH_LIBS)
|
||||
+ $(NIH_LIBS) \
|
||||
+ $(AUDIT_LDADD)
|
||||
|
||||
runlevel_SOURCES = \
|
||||
runlevel.c \
|
||||
@@ -427,7 +434,8 @@ runlevel_SOURCES = \
|
||||
|
||||
runlevel_LDADD = \
|
||||
$(LTLIBINTL) \
|
||||
- $(NIH_LIBS)
|
||||
+ $(NIH_LIBS) \
|
||||
+ $(AUDIT_LDADD)
|
||||
|
||||
shutdown_SOURCES = \
|
||||
shutdown.c \
|
||||
@@ -441,7 +449,8 @@ shutdown_LDADD = \
|
||||
$(LTLIBINTL) \
|
||||
$(NIH_LIBS) \
|
||||
$(NIH_DBUS_LIBS) \
|
||||
- $(DBUS_LIBS)
|
||||
+ $(DBUS_LIBS) \
|
||||
+ $(AUDIT_LDADD)
|
||||
|
||||
telinit_SOURCES = \
|
||||
telinit.c \
|
||||
@@ -455,7 +464,8 @@ telinit_LDADD = \
|
||||
$(LTLIBINTL) \
|
||||
$(NIH_LIBS) \
|
||||
$(NIH_DBUS_LIBS) \
|
||||
- $(DBUS_LIBS)
|
||||
+ $(DBUS_LIBS) \
|
||||
+ $(AUDIT_LDADD)
|
||||
|
||||
com_ubuntu_Upstart_OUTPUTS = \
|
||||
com.ubuntu.Upstart.c \
|
||||
@@ -515,7 +525,8 @@ test_sysv_LDADD = \
|
||||
$(LTLIBINTL) \
|
||||
$(NIH_LIBS) \
|
||||
$(NIH_DBUS_LIBS) \
|
||||
- $(DBUS_LIBS)
|
||||
+ $(DBUS_LIBS) \
|
||||
+ $(AUDIT_LDADD)
|
||||
|
||||
test_telinit_SOURCES = tests/test_telinit.c telinit.c
|
||||
test_telinit_CFLAGS = $(AM_CFLAGS) -DTEST
|
||||
@@ -525,7 +536,8 @@ test_telinit_LDADD = \
|
||||
com.ubuntu.Upstart.Job.o com.ubuntu.Upstart.Instance.o \
|
||||
$(NIH_LIBS) \
|
||||
$(NIH_DBUS_LIBS) \
|
||||
- $(DBUS_LIBS)
|
||||
+ $(DBUS_LIBS) \
|
||||
+ $(AUDIT_LDADD)
|
||||
|
||||
all: $(BUILT_SOURCES)
|
||||
$(MAKE) $(AM_MAKEFLAGS) all-am
|
||||
diff --git a/util/reboot.c b/util/reboot.c
|
||||
index dda2935..eef9ed2 100644
|
||||
index 7a9c071..15028eb 100644
|
||||
--- a/util/reboot.c
|
||||
+++ b/util/reboot.c
|
||||
@@ -36,6 +36,10 @@
|
||||
#include <nih/logging.h>
|
||||
#include <nih/error.h>
|
||||
|
||||
+#if 1 /* HAVE_LIBAUDIT */
|
||||
+#ifdef HAVE_LIBAUDIT
|
||||
+#include <libaudit.h>
|
||||
+#endif
|
||||
+
|
||||
#include "utmp.h"
|
||||
|
||||
|
||||
@@ -96,7 +100,6 @@ static int poweroff = FALSE;
|
||||
@@ -103,7 +107,6 @@ static int poweroff = FALSE;
|
||||
**/
|
||||
static int exit_only = FALSE;
|
||||
|
||||
|
|
@ -65,7 +755,7 @@ index dda2935..eef9ed2 100644
|
|||
/**
|
||||
* options:
|
||||
*
|
||||
@@ -119,6 +122,7 @@ static NihOption options[] = {
|
||||
@@ -127,6 +130,7 @@ static NihOption options[] = {
|
||||
NIH_OPTION_LAST
|
||||
};
|
||||
|
||||
|
|
@ -73,7 +763,7 @@ index dda2935..eef9ed2 100644
|
|||
|
||||
int
|
||||
main (int argc,
|
||||
@@ -216,6 +220,8 @@ main (int argc,
|
||||
@@ -227,6 +231,8 @@ main (int argc,
|
||||
/* Re-enable Control-Alt-Delete in case it breaks */
|
||||
reboot (RB_ENABLE_CAD);
|
||||
|
||||
|
|
@ -82,7 +772,7 @@ index dda2935..eef9ed2 100644
|
|||
/* Do the syscall */
|
||||
switch (mode) {
|
||||
case REBOOT:
|
||||
@@ -237,3 +243,21 @@ main (int argc,
|
||||
@@ -248,3 +254,21 @@ main (int argc,
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -95,7 +785,7 @@ index dda2935..eef9ed2 100644
|
|||
+static void
|
||||
+send_audit_event (void)
|
||||
+{
|
||||
+#if 1 /* HAVE_LIBAUDIT */
|
||||
+#ifdef HAVE_LIBAUDIT
|
||||
+ int fd = audit_open ();
|
||||
+ if (fd < 0)
|
||||
+ return;
|
||||
|
|
@ -105,20 +795,23 @@ index dda2935..eef9ed2 100644
|
|||
+#endif
|
||||
+}
|
||||
diff --git a/util/sysv.c b/util/sysv.c
|
||||
index fbca39f..32b5540 100644
|
||||
index fbca39f..5476f79 100644
|
||||
--- a/util/sysv.c
|
||||
+++ b/util/sysv.c
|
||||
@@ -36,6 +36,9 @@
|
||||
@@ -36,6 +36,12 @@
|
||||
#include <nih/logging.h>
|
||||
#include <nih/error.h>
|
||||
|
||||
+#include <unistd.h>
|
||||
+#ifdef HAVE_LIBAUDIT
|
||||
+#include <stdio.h>
|
||||
+#include <libaudit.h>
|
||||
+#endif
|
||||
+
|
||||
#include "dbus/upstart.h"
|
||||
|
||||
#include "utmp.h"
|
||||
@@ -54,6 +57,7 @@
|
||||
@@ -54,6 +60,7 @@
|
||||
|
||||
/* Prototypes for static functions */
|
||||
static void error_handler (NihError **err, NihDBusMessage *message);
|
||||
|
|
@ -126,7 +819,7 @@ index fbca39f..32b5540 100644
|
|||
|
||||
|
||||
/**
|
||||
@@ -161,6 +165,8 @@ sysv_change_runlevel (int runlevel,
|
||||
@@ -161,6 +168,8 @@ sysv_change_runlevel (int runlevel,
|
||||
runlevel, prevlevel) < 0)
|
||||
nih_free (nih_error_get ());
|
||||
|
||||
|
|
@ -135,7 +828,7 @@ index fbca39f..32b5540 100644
|
|||
/* Make the EmitEvent call, we don't wait for the event to finish
|
||||
* because sysvinit never did.
|
||||
*/
|
||||
@@ -199,3 +205,41 @@ error_handler (NihError ** err,
|
||||
@@ -199,3 +208,41 @@ error_handler (NihError ** err,
|
||||
{
|
||||
*err = nih_error_steal ();
|
||||
}
|
||||
|
|
@ -151,7 +844,7 @@ index fbca39f..32b5540 100644
|
|||
+static void
|
||||
+send_audit_event (int old, int level)
|
||||
+{
|
||||
+#if 1 /* HAVE_LIBAUDIT */
|
||||
+#ifdef HAVE_LIBAUDIT
|
||||
+ int fd = audit_open ();
|
||||
+
|
||||
+ if (fd < 0)
|
||||
|
|
|
|||
23
upstart-close-fd.patch
Normal file
23
upstart-close-fd.patch
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
diff --git a/init/job_process.c b/init/job_process.c
|
||||
index 8ce2f72..c2c96cb 100644
|
||||
--- a/init/job_process.c
|
||||
+++ b/init/job_process.c
|
||||
@@ -298,6 +298,7 @@ job_process_run (Job *job,
|
||||
|
||||
/* Feed the script to the child process */
|
||||
if (shell) {
|
||||
+ nih_local char *cmd = NULL;
|
||||
NihIo *io;
|
||||
|
||||
/* Clean up and close the reading end (we don't need it) */
|
||||
@@ -317,6 +318,10 @@ job_process_run (Job *job,
|
||||
nih_free (err);
|
||||
}
|
||||
|
||||
+ /* Close leaking fd first */
|
||||
+ cmd = NIH_MUST (nih_sprintf (NULL, "<&%d- ;", fds[0]));
|
||||
+ NIH_ZERO (nih_io_write (io, cmd, strlen (cmd)));
|
||||
+
|
||||
NIH_ZERO (nih_io_write (io, script, strlen (script)));
|
||||
nih_io_shutdown (io);
|
||||
}
|
||||
|
|
@ -1,63 +0,0 @@
|
|||
--- upstart-0.6.3/nih/alloc.c.orig 2010-01-17 17:28:33.000000000 +0000
|
||||
+++ upstart-0.6.3/nih/alloc.c 2010-01-17 17:28:38.000000000 +0000
|
||||
@@ -54,6 +54,8 @@
|
||||
NihDestructor destructor;
|
||||
} NihAllocCtx;
|
||||
|
||||
+#define NIH_ALLOC_CTX_SIZE (sizeof(NihAllocCtx) + __alignof__(NihAllocCtx))
|
||||
+
|
||||
/**
|
||||
* NihAllocRef:
|
||||
* @children_entry: list head in parent's children list,
|
||||
@@ -82,7 +84,7 @@
|
||||
*
|
||||
* Returns: pointer to NihAllocCtx structure.
|
||||
**/
|
||||
-#define NIH_ALLOC_CTX(ptr) ((NihAllocCtx *)(ptr) - 1)
|
||||
+#define NIH_ALLOC_CTX(ptr) ((NihAllocCtx *)((void*)ptr - NIH_ALLOC_CTX_SIZE))
|
||||
|
||||
/**
|
||||
* NIH_ALLOC_PTR:
|
||||
@@ -93,7 +95,7 @@
|
||||
*
|
||||
* Returns: pointer to block of memory.
|
||||
**/
|
||||
-#define NIH_ALLOC_PTR(ctx) ((void *)((NihAllocCtx *)(ctx) + 1))
|
||||
+#define NIH_ALLOC_PTR(ctx) ((void*)((void*)ctx + NIH_ALLOC_CTX_SIZE))
|
||||
|
||||
/**
|
||||
* NIH_ALLOC_FINALISED:
|
||||
@@ -145,7 +147,7 @@
|
||||
{
|
||||
NihAllocCtx *ctx;
|
||||
|
||||
- ctx = __nih_malloc (sizeof (NihAllocCtx) + size);
|
||||
+ ctx = __nih_malloc (NIH_ALLOC_CTX_SIZE + size);
|
||||
if (! ctx)
|
||||
return NULL;
|
||||
|
||||
@@ -230,7 +232,7 @@
|
||||
/* Now do the actual realloc(), if this fails then we can just
|
||||
* return NULL since we've not actually changed anything.
|
||||
*/
|
||||
- ctx = __nih_realloc (ctx, sizeof (NihAllocCtx) + size);
|
||||
+ ctx = __nih_realloc (ctx, NIH_ALLOC_CTX_SIZE + size);
|
||||
if (! ctx)
|
||||
return NULL;
|
||||
|
||||
@@ -562,7 +564,7 @@
|
||||
nih_assert (child != NULL);
|
||||
nih_assert (child->destructor != NIH_ALLOC_FINALISED);
|
||||
|
||||
- ref = NIH_MUST (malloc (sizeof (NihAllocRef)));
|
||||
+ ref = NIH_MUST (malloc (NIH_ALLOC_CTX_SIZE));
|
||||
|
||||
nih_list_init (&ref->children_entry);
|
||||
nih_list_init (&ref->parents_entry);
|
||||
@@ -739,5 +741,5 @@
|
||||
ctx = NIH_ALLOC_CTX (ptr);
|
||||
nih_assert (ctx->destructor != NIH_ALLOC_FINALISED);
|
||||
|
||||
- return malloc_usable_size (ctx) - sizeof (NihAllocCtx);
|
||||
+ return malloc_usable_size (ctx) - NIH_ALLOC_CTX_SIZE;
|
||||
}
|
||||
65
upstart-reexec.patch
Normal file
65
upstart-reexec.patch
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
diff -up upstart-0.6.5/init/main.c.foo upstart-0.6.5/init/main.c
|
||||
--- upstart-0.6.5/init/main.c.foo 2010-04-30 19:38:07.846260462 -0400
|
||||
+++ upstart-0.6.5/init/main.c 2010-04-30 21:35:38.690487114 -0400
|
||||
@@ -67,6 +67,7 @@ static void kbd_handler (void *data,
|
||||
static void pwr_handler (void *data, NihSignal *signal);
|
||||
static void hup_handler (void *data, NihSignal *signal);
|
||||
static void usr1_handler (void *data, NihSignal *signal);
|
||||
+static void term_handler (void *data, NihSignal *signal);
|
||||
#endif /* DEBUG */
|
||||
|
||||
|
||||
@@ -241,6 +242,10 @@ main (int argc,
|
||||
/* SIGUSR1 instructs us to reconnect to D-Bus */
|
||||
nih_signal_set_handler (SIGUSR1, nih_signal_handler);
|
||||
NIH_MUST (nih_signal_add_handler (NULL, SIGUSR1, usr1_handler, NULL));
|
||||
+
|
||||
+ /* SIGTERM instructs us to re-exec ourselves */
|
||||
+ nih_signal_set_handler (SIGTERM, nih_signal_handler);
|
||||
+ NIH_MUST (nih_signal_add_handler (NULL, SIGTERM, term_handler, NULL));
|
||||
#endif /* DEBUG */
|
||||
|
||||
|
||||
@@ -485,4 +490,42 @@ usr1_handler (void *data,
|
||||
}
|
||||
}
|
||||
}
|
||||
+
|
||||
+/**
|
||||
+ * term_handler:
|
||||
+ * @data: unused,
|
||||
+ * @signal: signal that called this handler
|
||||
+ *
|
||||
+ * This is called when we recieve the TERM signal, which instructs us
|
||||
+ * to reexec ourselves.
|
||||
+ **/
|
||||
+static void
|
||||
+term_handler (void *data,
|
||||
+ NihSignal *signal)
|
||||
+{
|
||||
+ NihError *err;
|
||||
+ sigset_t mask, oldmask;
|
||||
+
|
||||
+ nih_assert (argv0 != NULL);
|
||||
+ nih_assert (signal != NULL);
|
||||
+
|
||||
+ nih_warn (_("Re-executing %s"), argv0);
|
||||
+
|
||||
+ /* Block signals while we work. We're the last signal handler
|
||||
+ * installed so this should mean that they're all handled now.
|
||||
+ *
|
||||
+ * The child must make sure that it unblocks these again when
|
||||
+ * it's ready.
|
||||
+ */
|
||||
+ sigfillset (&mask);
|
||||
+ sigprocmask (SIG_BLOCK, &mask, &oldmask);
|
||||
+ execl (argv0, argv0, "--restart", NULL);
|
||||
+ nih_error_raise_system ();
|
||||
+
|
||||
+ err = nih_error_get ();
|
||||
+ nih_error (_("Failed to re-execute %s: %s"), argv0, err->message);
|
||||
+ nih_free (err);
|
||||
+
|
||||
+ sigprocmask (SIG_SETMASK, &oldmask, NULL);
|
||||
+}
|
||||
#endif /* DEBUG */
|
||||
|
|
@ -1,429 +0,0 @@
|
|||
diff -uNr upstart-0.3.9.orig/init/main.c upstart-0.3.9/init/main.c
|
||||
--- upstart-0.3.9.orig/init/main.c 2009-01-23 13:44:32.000000000 -0500
|
||||
+++ upstart-0.3.9/init/main.c 2009-01-23 13:44:54.000000000 -0500
|
||||
@@ -59,6 +59,7 @@
|
||||
#include "cfgfile.h"
|
||||
#include "paths.h"
|
||||
#include "tty.h"
|
||||
+#include "restore.h"
|
||||
|
||||
|
||||
/* Prototypes for static functions */
|
||||
@@ -278,6 +279,10 @@
|
||||
exit (1);
|
||||
}
|
||||
|
||||
+ /* Restore the state of previously active jobs, if re-exec'd by
|
||||
+ * a previously running init. */
|
||||
+
|
||||
+ if (restart) restore_configuration(args);
|
||||
|
||||
/* Generate and run the startup event or read the state from the
|
||||
* init daemon that exec'd us
|
||||
@@ -534,6 +539,8 @@
|
||||
NihError *err;
|
||||
const char *loglevel;
|
||||
sigset_t mask, oldmask;
|
||||
+ char **args;
|
||||
+ size_t len;
|
||||
|
||||
nih_assert (argv0 != NULL);
|
||||
nih_assert (signal != NULL);
|
||||
@@ -559,7 +566,20 @@
|
||||
} else {
|
||||
loglevel = NULL;
|
||||
}
|
||||
- execl (argv0, argv0, "--restart", loglevel, NULL);
|
||||
+ args = nih_str_array_new(NULL);
|
||||
+ len = 0;
|
||||
+ if (args) args = nih_str_array_add(&args, NULL, &len, argv0);
|
||||
+ if (args) args = nih_str_array_add(&args, NULL, &len, "--restart");
|
||||
+ if (args && loglevel)
|
||||
+ args = nih_str_array_add(&args, NULL, &len, loglevel);
|
||||
+ if (args) save_current_configuration(&args, NULL, &len);
|
||||
+ if (args) {
|
||||
+ execv (argv0, args);
|
||||
+ nih_free(args);
|
||||
+ } else {
|
||||
+ nih_warn (_("Unable to save list of currently running jobs"));
|
||||
+ execl(argv0, argv0, "--restart", loglevel, NULL);
|
||||
+ }
|
||||
nih_error_raise_system ();
|
||||
|
||||
err = nih_error_get ();
|
||||
diff -uNr upstart-0.3.9.orig/init/Makefile.in upstart-0.3.9/init/Makefile.in
|
||||
--- upstart-0.3.9.orig/init/Makefile.in 2009-01-23 13:44:32.000000000 -0500
|
||||
+++ upstart-0.3.9/init/Makefile.in 2009-01-23 13:44:54.000000000 -0500
|
||||
@@ -72,7 +72,7 @@
|
||||
PROGRAMS = $(sbin_PROGRAMS)
|
||||
am_init_OBJECTS = main.$(OBJEXT) tty.$(OBJEXT) process.$(OBJEXT) \
|
||||
job.$(OBJEXT) event.$(OBJEXT) control.$(OBJEXT) \
|
||||
- notify.$(OBJEXT) cfgfile.$(OBJEXT)
|
||||
+ notify.$(OBJEXT) cfgfile.$(OBJEXT) restore.$(OBJEXT)
|
||||
init_OBJECTS = $(am_init_OBJECTS)
|
||||
am__DEPENDENCIES_1 =
|
||||
init_DEPENDENCIES = ../upstart/libupstart.la ../nih/libnih.la \
|
||||
@@ -315,7 +315,8 @@
|
||||
event.c event.h \
|
||||
control.c control.h \
|
||||
notify.c notify.h \
|
||||
- cfgfile.c cfgfile.h
|
||||
+ cfgfile.c cfgfile.h \
|
||||
+ restore.c restore.h
|
||||
|
||||
init_LDFLAGS = -static
|
||||
init_LDADD = \
|
||||
diff -uNr upstart-0.3.9.orig/init/restore.c upstart-0.3.9/init/restore.c
|
||||
--- upstart-0.3.9.orig/init/restore.c 1969-12-31 19:00:00.000000000 -0500
|
||||
+++ upstart-0.3.9/init/restore.c 2009-01-23 13:44:54.000000000 -0500
|
||||
@@ -0,0 +1,333 @@
|
||||
+/* Modifications to upstart to allow passing of the state of currently
|
||||
+ * running jobs when upstart re-execs itself.
|
||||
+ */
|
||||
+
|
||||
+#ifdef HAVE_CONFIG_H
|
||||
+# include <config.h>
|
||||
+#endif /* HAVE_CONFIG_H */
|
||||
+
|
||||
+
|
||||
+#include <sys/types.h>
|
||||
+#include <string.h>
|
||||
+#include <nih/string.h>
|
||||
+#include <nih/logging.h>
|
||||
+#include <nih/alloc.h>
|
||||
+#include "job.h"
|
||||
+#include "restore.h"
|
||||
+
|
||||
+
|
||||
+/**
|
||||
+ * store_pid:
|
||||
+ * @proc: pointer to a JobProcess structure or NULL
|
||||
+ * @args: array of arguments
|
||||
+ * @parent: parent of @args
|
||||
+ * @len: current length of @args
|
||||
+ *
|
||||
+ * Does nothing if @args is null.
|
||||
+ * Pushes "X" onto @args if @args is non-null but @process is null.
|
||||
+ * Otherwise: extracts the pid from @process, creates a hexadecimal string
|
||||
+ * form of it, pushes a copy onto the array @args, then frees the original.
|
||||
+ */
|
||||
+
|
||||
+void store_pid(JobProcess *proc, char ***args, const void *parent, size_t *len)
|
||||
+{
|
||||
+ char *pidstr;
|
||||
+ if (! *args) return;
|
||||
+ pidstr = (proc ? nih_sprintf(NULL, "%x", proc->pid) : "X");
|
||||
+
|
||||
+ if (! pidstr) {
|
||||
+ nih_error("Unable to allocate storage to save process id");
|
||||
+ *args = NULL;
|
||||
+ return;
|
||||
+ }
|
||||
+ if (! nih_str_array_add(args, parent, len, pidstr)) {
|
||||
+ nih_error("Unable to add process id to argument list");
|
||||
+ *args = NULL;
|
||||
+ }
|
||||
+
|
||||
+ if (proc) nih_free(pidstr);
|
||||
+}
|
||||
+
|
||||
+/**
|
||||
+ * unpack_pid:
|
||||
+ * @pidstr: hexadecimal string created by pack_pid
|
||||
+ * @err: pointer to flag to set if error occurs
|
||||
+ *
|
||||
+ * Returns the process id corresponding to the string passed in pidstr.
|
||||
+ * If an error occurs, returns 0 and sets the flag pointed to by @err.
|
||||
+ **/
|
||||
+
|
||||
+pid_t unpack_pid(char *pidstr, int *err) {
|
||||
+ pid_t result = 0;
|
||||
+ while (*pidstr) {
|
||||
+ unsigned char c = *pidstr++;
|
||||
+ result <<= 4;
|
||||
+ if (c >= '0' && c <= '9') result += (c-'0');
|
||||
+ else if (c >= 'a' && c <= 'f') result += 10 + (c-'a');
|
||||
+ else {
|
||||
+ *err = 1;
|
||||
+ return 0;
|
||||
+ }
|
||||
+ }
|
||||
+ return result;
|
||||
+}
|
||||
+
|
||||
+/**
|
||||
+ * retrieve_pid:
|
||||
+ * @arg: pointer to array of arguments from which to read pid string
|
||||
+ * @jobname: name of job whose pids are being retrieved
|
||||
+ * @err: pointer to flag to set if error occurs
|
||||
+ * @pid: pointer to location to hold the retrieved process id
|
||||
+ * @present: pointer to a location to hold 1 if the process id was present
|
||||
+ *
|
||||
+ * Reads a process id or no-process-present indicator from the hexadecimal
|
||||
+ * string pointed to by @arg, increments @arg to point to the next string in
|
||||
+ * the array unless it already points to a null string, and stores into
|
||||
+ * @present a value of 0 or 1 indicating whether or not a process id is
|
||||
+ * present, and stores into @pid the unpacked process id (or zero if there
|
||||
+ * is no process present or an error occurred). If an error occured, sets
|
||||
+ * the flag pointed to by @err and printes an error message.
|
||||
+ **/
|
||||
+
|
||||
+void retrieve_pid(char ***arg, char *jobname, int *err,
|
||||
+ pid_t *pid, int *present)
|
||||
+{
|
||||
+ *pid = 0;
|
||||
+ *present = 0;
|
||||
+ char *str;
|
||||
+ if (! arg || ! *arg || ! **arg) {
|
||||
+ nih_error("Ran out of arguments when restoring job %s",
|
||||
+ jobname);
|
||||
+ *err = 1;
|
||||
+ return;
|
||||
+ }
|
||||
+ str = **arg;
|
||||
+ if (str) ++(*arg);
|
||||
+ if (strcmp(str, "X")==0) return;
|
||||
+ *present = 1;
|
||||
+ *pid = unpack_pid(str, err);
|
||||
+ if (*err) nih_error("Cannot parse pid %s for job %s", str, jobname);
|
||||
+}
|
||||
+
|
||||
+/**
|
||||
+ * restore_pid:
|
||||
+ * @proc: pointer to a JobProcess structure, or NULL
|
||||
+ * @pid: process id
|
||||
+ * @present: integer which is 1 if process id is applicable
|
||||
+ * @jobname: name of job whose process ids are being restored
|
||||
+ *
|
||||
+ * Checks that the non-null status of @proc matches the true/false
|
||||
+ * status of @present. If there is a mismatch, prints an error message.
|
||||
+ * If @present is true and @proc is non-null, stores the process id from
|
||||
+ * @pid into the JobProcess structure pointed to by @proc.
|
||||
+ */
|
||||
+
|
||||
+void restore_pid(JobProcess *proc, pid_t pid, int present, char *jobname)
|
||||
+{
|
||||
+ if (proc == NULL && ! present) return;
|
||||
+ if (proc != NULL && present) {
|
||||
+ proc->pid = pid;
|
||||
+ return;
|
||||
+ }
|
||||
+ nih_error("Unable to restore process id for job %s", jobname);
|
||||
+}
|
||||
+
|
||||
+/**
|
||||
+ * save_current_configuration:
|
||||
+ * @args: array of arguments to pass to new init
|
||||
+ * @parent: parent of @args
|
||||
+ * @len: current length of @args
|
||||
+ *
|
||||
+ * Pushes, onto the array @args, information about currently running
|
||||
+ * jobs. Each job consists of seven arguments:
|
||||
+ * (1) The job name
|
||||
+ * (2) A 3-character state/goal string:
|
||||
+ * First character for the goal: 0=goal JOB_STOP, 1=goal JOB_START
|
||||
+ * Second character for the current state:
|
||||
+ * W=JOB_WAITING,
|
||||
+ * S=JOB_STARTING, A=JOB_PRE_START, B=JOB_SPAWNED, C=JOB_POST_START,
|
||||
+ * R=JOB_RUNNING,
|
||||
+ * T=JOB_STOPPING, X=JOB_PRE_STOP, Y=JOB_KILLED, Z=JOB_POST_STOP
|
||||
+ * Third character: N=normal job, I=instance job
|
||||
+ * (3) The associated PROCESS_MAIN process id
|
||||
+ * (4) The associated PROCESS_PRE_START process id
|
||||
+ * (5) The associated PROCESS_POST_START process id
|
||||
+ * (6) The associated PROCESS_PRE_STOP process id
|
||||
+ * (7) The associated PROCESS_POST_STOP process id
|
||||
+ * Process ids are in hexadecimal using lower-case letters (0-9,a-f),
|
||||
+ * or 0 if there is a JobProcess structure but no running process, or
|
||||
+ * "X" if there is no JobProcess structure.
|
||||
+ *
|
||||
+ */
|
||||
+
|
||||
+void save_current_configuration(char ***args, const void *parent, size_t *len)
|
||||
+{
|
||||
+ NIH_HASH_FOREACH(jobs, iter) {
|
||||
+ Job *job = (Job *) iter;
|
||||
+ char goal_state[4];
|
||||
+ JobProcess **pids;
|
||||
+
|
||||
+
|
||||
+ if (job->replacement_for != NULL) continue;
|
||||
+ if (job->state == JOB_DELETED) continue;
|
||||
+ if (job->instance && ! job->instance_of) continue;
|
||||
+
|
||||
+ if (! nih_str_array_add(args, parent, len, job->name))
|
||||
+ return;
|
||||
+
|
||||
+ if (job->goal == JOB_START) goal_state[0] = '1';
|
||||
+ else goal_state[0] = '0';
|
||||
+
|
||||
+ switch (job->state)
|
||||
+ {
|
||||
+ case JOB_WAITING: goal_state[1] = 'W'; break;
|
||||
+ case JOB_STARTING: goal_state[1] = 'S'; break;
|
||||
+ case JOB_PRE_START: goal_state[1] = 'A'; break;
|
||||
+ case JOB_SPAWNED: goal_state[1] = 'B'; break;
|
||||
+ case JOB_POST_START: goal_state[1] = 'C'; break;
|
||||
+ case JOB_RUNNING: goal_state[1] = 'R'; break;
|
||||
+ case JOB_STOPPING: goal_state[1] = 'T'; break;
|
||||
+ case JOB_PRE_STOP: goal_state[1] = 'X'; break;
|
||||
+ case JOB_KILLED: goal_state[1] = 'Y'; break;
|
||||
+ case JOB_POST_STOP: goal_state[1] = 'Z'; break;
|
||||
+ default: goal_state[1] = '?';
|
||||
+ }
|
||||
+ if (job->instance_of) goal_state[2] = 'I';
|
||||
+ else goal_state[2] = 'N';
|
||||
+ goal_state[3] = 0;
|
||||
+
|
||||
+ if (! nih_str_array_add(args, parent, len, goal_state))
|
||||
+ return;
|
||||
+
|
||||
+ pids = job->process;
|
||||
+ store_pid(pids[PROCESS_MAIN], args, parent, len);
|
||||
+ store_pid(pids[PROCESS_PRE_START], args, parent, len);
|
||||
+ store_pid(pids[PROCESS_POST_START], args, parent, len);
|
||||
+ store_pid(pids[PROCESS_PRE_STOP], args, parent, len);
|
||||
+ store_pid(pids[PROCESS_POST_STOP], args, parent, len);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+/**
|
||||
+ * restore_job_state:
|
||||
+ * @jobname: name of job whose state we are to restore
|
||||
+ * @goal_state: the goal/state string generated by save_current_configuration
|
||||
+ * @pids: array of five process ids
|
||||
+ * @presents: array of five integers indicating which process ids are applicable
|
||||
+ */
|
||||
+
|
||||
+void restore_job_state (char *jobname, char *goal_state,
|
||||
+ pid_t *pids, int *presents)
|
||||
+{
|
||||
+ Job *job;
|
||||
+ JobGoal goal = JOB_STOP;
|
||||
+ JobState state = JOB_WAITING;
|
||||
+ int is_instance = 0;
|
||||
+ int is_invalid = 0;
|
||||
+ JobProcess **procs;
|
||||
+
|
||||
+ if (jobname == NULL) {
|
||||
+ nih_error("Missing name for restored job");
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ if (goal_state == NULL) {
|
||||
+ nih_error("Missing goal/state for restored job %s", jobname);
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ if (strlen(goal_state) != 3) {
|
||||
+ nih_error("Invalid length goal/state %s for restored job %s",
|
||||
+ goal_state, jobname);
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ switch (goal_state[0])
|
||||
+ {
|
||||
+ case '0': goal = JOB_STOP; break;
|
||||
+ case '1': goal = JOB_START; break;
|
||||
+ default: is_invalid = 1; break;
|
||||
+ }
|
||||
+
|
||||
+ switch (goal_state[1])
|
||||
+ {
|
||||
+ case 'W': state = JOB_WAITING; break;
|
||||
+ case 'S': state = JOB_STARTING; break;
|
||||
+ case 'A': state = JOB_PRE_START; break;
|
||||
+ case 'B': state = JOB_SPAWNED; break;
|
||||
+ case 'C': state = JOB_POST_START; break;
|
||||
+ case 'R': state = JOB_RUNNING; break;
|
||||
+ case 'T': state = JOB_STOPPING; break;
|
||||
+ case 'X': state = JOB_PRE_STOP; break;
|
||||
+ case 'Y': state = JOB_KILLED; break;
|
||||
+ case 'Z': state = JOB_POST_STOP; break;
|
||||
+ default: is_invalid = 1;
|
||||
+ }
|
||||
+
|
||||
+ switch (goal_state[2])
|
||||
+ {
|
||||
+ case 'N': break;
|
||||
+ case 'I': is_instance = 1; break;
|
||||
+ default: is_invalid = 1;
|
||||
+ }
|
||||
+
|
||||
+ if (is_invalid) {
|
||||
+ nih_error("Invalid goal/state %s for restored job %s",
|
||||
+ goal_state, jobname);
|
||||
+ return;
|
||||
+ }
|
||||
+ job = job_find_by_name(jobname);
|
||||
+ if (! job) {
|
||||
+ nih_error("Unknown job %s passed to re-exec", jobname);
|
||||
+ return;
|
||||
+ }
|
||||
+ if (is_instance) {
|
||||
+ if (! job->instance) {
|
||||
+ nih_error("Can not restore job %s as instance job",
|
||||
+ jobname);
|
||||
+ return;
|
||||
+ }
|
||||
+ job = job_instance(job);
|
||||
+ } else {
|
||||
+ if (job->instance) {
|
||||
+ nih_error("Can not restore job %s as non-instance job",
|
||||
+ jobname);
|
||||
+ return;
|
||||
+ }
|
||||
+ }
|
||||
+ job->goal = goal;
|
||||
+ job->state = state;
|
||||
+ procs=job->process;
|
||||
+ restore_pid(procs[PROCESS_MAIN], pids[0], presents[0], jobname);
|
||||
+ restore_pid(procs[PROCESS_PRE_START], pids[1], presents[1], jobname);
|
||||
+ restore_pid(procs[PROCESS_POST_START], pids[2], presents[2], jobname);
|
||||
+ restore_pid(procs[PROCESS_PRE_STOP], pids[3], presents[3], jobname);
|
||||
+ restore_pid(procs[PROCESS_POST_STOP], pids[4], presents[4], jobname);
|
||||
+}
|
||||
+
|
||||
+/**
|
||||
+ * restore_current_configuration:
|
||||
+ * @args: non-option arguments that were passed to the new init
|
||||
+ */
|
||||
+
|
||||
+void restore_configuration(char **args)
|
||||
+{
|
||||
+ if (! args) return;
|
||||
+
|
||||
+ char **arg = args;
|
||||
+ while (arg && *arg) {
|
||||
+ char *jobname = *(arg++);
|
||||
+ char *goal_state = *arg;
|
||||
+ pid_t pids[5];
|
||||
+ int presents[5];
|
||||
+ int is_invalid = 0;
|
||||
+
|
||||
+ if (*arg) ++arg;
|
||||
+ for (int i = 0; i < 5; i++)
|
||||
+ retrieve_pid(&arg, jobname, &is_invalid,
|
||||
+ &pids[i], &presents[i]);
|
||||
+
|
||||
+ if (! is_invalid)
|
||||
+ restore_job_state (jobname, goal_state, pids, presents);
|
||||
+ }
|
||||
+}
|
||||
diff -uNr upstart-0.3.9.orig/init/restore.h upstart-0.3.9/init/restore.h
|
||||
--- upstart-0.3.9.orig/init/restore.h 1969-12-31 19:00:00.000000000 -0500
|
||||
+++ upstart-0.3.9/init/restore.h 2009-01-23 13:44:54.000000000 -0500
|
||||
@@ -0,0 +1,13 @@
|
||||
+#ifndef INIT_RESTORE_H
|
||||
+#define INIT_RESTORE_H
|
||||
+
|
||||
+#include <nih/string.h>
|
||||
+
|
||||
+NIH_BEGIN_EXTERN
|
||||
+
|
||||
+void save_current_configuration(char ***args, const void *parent, size_t *len);
|
||||
+void restore_configuration(char **args);
|
||||
+
|
||||
+NIH_END_EXTERN
|
||||
+
|
||||
+#endif /* INIT_RESTORE_H */
|
||||
28
upstart-shutdown-exitcode.patch
Normal file
28
upstart-shutdown-exitcode.patch
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
diff --git a/util/shutdown.c b/util/shutdown.c
|
||||
index 0a6d8bf..2ef847a 100644
|
||||
--- a/util/shutdown.c
|
||||
+++ b/util/shutdown.c
|
||||
@@ -459,6 +459,7 @@ shutdown_now (void)
|
||||
{
|
||||
nih_local char **extra_env = NULL;
|
||||
NihDBusError * dbus_err;
|
||||
+ int exit_val = 0;
|
||||
|
||||
if (init_halt) {
|
||||
char *e;
|
||||
@@ -486,12 +487,14 @@ shutdown_now (void)
|
||||
* yet rebooted ... so try /dev/initctl
|
||||
*/
|
||||
sysvinit_shutdown ();
|
||||
+ nih_fatal ("Unable to shutdown system");
|
||||
+ exit_val = 1;
|
||||
}
|
||||
|
||||
unlink (ETC_NOLOGIN);
|
||||
nih_main_unlink_pidfile ();
|
||||
|
||||
- exit (0);
|
||||
+ exit (exit_val);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -1,55 +0,0 @@
|
|||
diff --git a/init/main.c b/init/main.c
|
||||
index 2836583..0fb6a64 100644
|
||||
--- a/init/main.c
|
||||
+++ b/init/main.c
|
||||
@@ -66,6 +66,7 @@ static void cad_handler (void *data, NihSignal *signal);
|
||||
static void kbd_handler (void *data, NihSignal *signal);
|
||||
static void pwr_handler (void *data, NihSignal *signal);
|
||||
static void hup_handler (void *data, NihSignal *signal);
|
||||
+static void usr1_handler (void *data, NihSignal *signal);
|
||||
#endif /* DEBUG */
|
||||
|
||||
|
||||
@@ -234,6 +235,10 @@ main (int argc,
|
||||
/* SIGHUP instructs us to re-load our configuration */
|
||||
nih_signal_set_handler (SIGHUP, nih_signal_handler);
|
||||
NIH_MUST (nih_signal_add_handler (NULL, SIGHUP, hup_handler, NULL));
|
||||
+
|
||||
+ /* SIGHUSR1 instructs us to reconnect to system bus */
|
||||
+ nih_signal_set_handler (SIGUSR1, nih_signal_handler);
|
||||
+ NIH_MUST (nih_signal_add_handler (NULL, SIGUSR1, usr1_handler, NULL));
|
||||
#endif /* DEBUG */
|
||||
|
||||
|
||||
@@ -465,4 +470,31 @@ hup_handler (void *data,
|
||||
}
|
||||
}
|
||||
}
|
||||
+
|
||||
+/**
|
||||
+ * usr1_handler:
|
||||
+ * @data: unused,
|
||||
+ * @signal: signal that called this handler.
|
||||
+ *
|
||||
+ * Handle having recieved the SIGHUSR1 signal, which we use to instruct us to
|
||||
+ * connect to system bus.
|
||||
+ **/
|
||||
+static void
|
||||
+usr1_handler (void *data,
|
||||
+ NihSignal *signal)
|
||||
+{
|
||||
+
|
||||
+ if (! control_bus) {
|
||||
+ nih_info (_("Connecting to system bus"));
|
||||
+
|
||||
+ if (control_bus_open () < 0) {
|
||||
+ NihError *err;
|
||||
+
|
||||
+ err = nih_error_get ();
|
||||
+ nih_warn ("%s: %s", _("Unable to connect to the system bus"),
|
||||
+ err->message);
|
||||
+ nih_free (err);
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
#endif /* DEBUG */
|
||||
317
upstart-utmp.patch
Normal file
317
upstart-utmp.patch
Normal file
|
|
@ -0,0 +1,317 @@
|
|||
diff --git a/init/job_class.c b/init/job_class.c
|
||||
index b521cf4..1b8d1cf 100644
|
||||
--- a/init/job_class.c
|
||||
+++ b/init/job_class.c
|
||||
@@ -218,6 +218,8 @@ job_class_new (const void *parent,
|
||||
class->chroot = NULL;
|
||||
class->chdir = NULL;
|
||||
|
||||
+ class->utmp_id = NULL;
|
||||
+
|
||||
class->deleted = FALSE;
|
||||
|
||||
return class;
|
||||
diff --git a/init/job_class.h b/init/job_class.h
|
||||
index b7d4eed..1d29c59 100644
|
||||
--- a/init/job_class.h
|
||||
+++ b/init/job_class.h
|
||||
@@ -145,6 +145,7 @@ typedef struct job_class {
|
||||
struct rlimit *limits[RLIMIT_NLIMITS];
|
||||
char *chroot;
|
||||
char *chdir;
|
||||
+ char *utmp_id;
|
||||
|
||||
int deleted;
|
||||
} JobClass;
|
||||
diff --git a/init/job_process.c b/init/job_process.c
|
||||
index e3080d8..8ce2f72 100644
|
||||
--- a/init/job_process.c
|
||||
+++ b/init/job_process.c
|
||||
@@ -38,6 +38,8 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
+#include <utmp.h>
|
||||
+#include <utmpx.h>
|
||||
|
||||
#include <nih/macros.h>
|
||||
#include <nih/alloc.h>
|
||||
@@ -361,11 +363,13 @@ job_process_spawn (JobClass *class,
|
||||
char * const *env,
|
||||
int trace)
|
||||
{
|
||||
- sigset_t child_set, orig_set;
|
||||
- pid_t pid;
|
||||
- int i, fds[2];
|
||||
- char filename[PATH_MAX];
|
||||
- FILE *fd;
|
||||
+ sigset_t child_set, orig_set;
|
||||
+ pid_t pid;
|
||||
+ int i, fds[2];
|
||||
+ char filename[PATH_MAX];
|
||||
+ FILE *fd;
|
||||
+ struct utmpx utmp;
|
||||
+ struct timeval tv;
|
||||
|
||||
nih_assert (class != NULL);
|
||||
|
||||
@@ -524,6 +528,20 @@ job_process_spawn (JobClass *class,
|
||||
}
|
||||
}
|
||||
|
||||
+ /* Write utmp INIT_PROCESS entry */
|
||||
+ if (class->utmp_id) {
|
||||
+ memset(&utmp, 0, sizeof(struct utmpx));
|
||||
+ strncpy(utmp.ut_id, class->utmp_id, sizeof(utmp.ut_id));
|
||||
+ utmp.ut_pid = getpid();
|
||||
+ utmp.ut_type = INIT_PROCESS;
|
||||
+ gettimeofday(&tv, NULL);
|
||||
+ utmp.ut_tv.tv_sec = tv.tv_sec;
|
||||
+ utmp.ut_tv.tv_usec = tv.tv_usec;
|
||||
+ setutxent();
|
||||
+ pututxline(&utmp);
|
||||
+ endutxent();
|
||||
+ }
|
||||
+
|
||||
/* Execute the process, if we escape from here it failed */
|
||||
if (execvp (argv[0], argv) < 0) {
|
||||
nih_error_raise_system ();
|
||||
@@ -967,6 +985,8 @@ job_process_terminated (Job *job,
|
||||
int status)
|
||||
{
|
||||
int failed = FALSE, stop = FALSE, state = TRUE;
|
||||
+ struct utmpx *utmptr;
|
||||
+ struct timeval tv;
|
||||
|
||||
nih_assert (job != NULL);
|
||||
|
||||
@@ -1129,6 +1149,36 @@ job_process_terminated (Job *job,
|
||||
job->kill_process = -1;
|
||||
}
|
||||
|
||||
+ /* Find existing utmp entry for the process pid */
|
||||
+ setutxent();
|
||||
+ while ((utmptr = getutxent()) != NULL) {
|
||||
+ if (utmptr->ut_pid == job->pid[process]) {
|
||||
+ /* set type and clean ut_user, ut_host,
|
||||
+ * ut_time as described in utmp(5)
|
||||
+ */
|
||||
+ utmptr->ut_type = DEAD_PROCESS;
|
||||
+ memset(utmptr->ut_user, 0, UT_NAMESIZE);
|
||||
+ memset(utmptr->ut_host, 0, UT_HOSTSIZE);
|
||||
+ utmptr->ut_time = 0;
|
||||
+
|
||||
+ /* Set class utmp_id for next spawn */
|
||||
+ job->class->utmp_id = nih_strdup (job->class, utmptr->ut_id);
|
||||
+
|
||||
+ /* Update existing utmp file. */
|
||||
+ pututxline(utmptr);
|
||||
+
|
||||
+ /* set ut_time for log */
|
||||
+ gettimeofday(&tv, NULL);
|
||||
+ utmptr->ut_tv.tv_sec = tv.tv_sec;
|
||||
+ utmptr->ut_tv.tv_usec = tv.tv_usec;
|
||||
+ /* Write wtmp entry */
|
||||
+ updwtmpx (_PATH_WTMP, utmptr);
|
||||
+
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+ endutxent();
|
||||
+
|
||||
/* Clear the process pid field */
|
||||
job->pid[process] = 0;
|
||||
|
||||
diff --git a/init/tests/test_job_process.c b/init/tests/test_job_process.c
|
||||
index d43fa6e..b4f94e4 100644
|
||||
--- a/init/tests/test_job_process.c
|
||||
+++ b/init/tests/test_job_process.c
|
||||
@@ -36,6 +36,8 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
+#include <utmp.h>
|
||||
+#include <utmpx.h>
|
||||
|
||||
#include <nih/macros.h>
|
||||
#include <nih/string.h>
|
||||
@@ -4474,6 +4476,171 @@ test_find (void)
|
||||
}
|
||||
|
||||
|
||||
+void
|
||||
+test_utmp (void)
|
||||
+{
|
||||
+ JobClass * class;
|
||||
+ Job * job = NULL;
|
||||
+ Blocked * blocked = NULL;
|
||||
+ Event * event;
|
||||
+ FILE * output;
|
||||
+ char utmpname[PATH_MAX];
|
||||
+ struct utmpx utmp, *utmptr;
|
||||
+ struct timeval tv;
|
||||
+
|
||||
+ TEST_FUNCTION ("job_process_handler");
|
||||
+ program_name = "test";
|
||||
+
|
||||
+ class = job_class_new (NULL, "test");
|
||||
+ class->process[PROCESS_MAIN] = process_new (class);
|
||||
+ class->process[PROCESS_MAIN]->command = "echo";
|
||||
+
|
||||
+ class->start_on = event_operator_new (class, EVENT_MATCH,
|
||||
+ "foo", NULL);
|
||||
+ class->stop_on = event_operator_new (class, EVENT_MATCH,
|
||||
+ "foo", NULL);
|
||||
+ nih_hash_add (job_classes, &class->entry);
|
||||
+
|
||||
+ event = event_new (NULL, "foo", NULL);
|
||||
+
|
||||
+ TEST_FILENAME(utmpname);
|
||||
+
|
||||
+ /* Check that utmp record for the running task of the job terminating
|
||||
+ * is properly changed to DEAD_PROCESS
|
||||
+ */
|
||||
+ TEST_FEATURE ("with LOGIN_PROCESS utmp entry");
|
||||
+ TEST_ALLOC_FAIL {
|
||||
+ TEST_ALLOC_SAFE {
|
||||
+ job = job_new (class, "");
|
||||
+
|
||||
+ blocked = blocked_new (job, BLOCKED_EVENT, event);
|
||||
+ event_block (event);
|
||||
+ nih_list_add (&job->blocking, &blocked->entry);
|
||||
+ }
|
||||
+
|
||||
+ job->goal = JOB_START;
|
||||
+ job->state = JOB_RUNNING;
|
||||
+ job->pid[PROCESS_MAIN] = 1;
|
||||
+
|
||||
+ TEST_FREE_TAG (blocked);
|
||||
+
|
||||
+ job->blocker = NULL;
|
||||
+ event->failed = FALSE;
|
||||
+
|
||||
+ job->failed = FALSE;
|
||||
+ job->failed_process = -1;
|
||||
+ job->exit_status = 0;
|
||||
+
|
||||
+ output = fopen (utmpname, "w");
|
||||
+ fclose (output);
|
||||
+
|
||||
+ /* set utmp file */
|
||||
+ utmpxname(utmpname);
|
||||
+
|
||||
+ /* set up utmp entries */
|
||||
+ memset (&utmp, 0, sizeof utmp);
|
||||
+
|
||||
+ strcpy(utmp.ut_id, "2");
|
||||
+ utmp.ut_type = LOGIN_PROCESS;
|
||||
+ utmp.ut_pid = 2;
|
||||
+
|
||||
+ gettimeofday(&tv, NULL);
|
||||
+ utmp.ut_tv.tv_sec = tv.tv_sec;
|
||||
+ utmp.ut_tv.tv_usec = tv.tv_usec;
|
||||
+
|
||||
+ setutxent();
|
||||
+ pututxline(&utmp);
|
||||
+
|
||||
+ strcpy(utmp.ut_id, "1");
|
||||
+ utmp.ut_pid = 1;
|
||||
+ pututxline(&utmp);
|
||||
+
|
||||
+ endutxent();
|
||||
+
|
||||
+ job_process_handler (NULL, 1, NIH_CHILD_EXITED, 0);
|
||||
+
|
||||
+ setutxent();
|
||||
+
|
||||
+ utmptr = getutxent();
|
||||
+ TEST_NE_P(utmptr, NULL);
|
||||
+ TEST_EQ(utmptr->ut_pid, 2);
|
||||
+ TEST_EQ(utmptr->ut_type, LOGIN_PROCESS);
|
||||
+
|
||||
+ utmptr = getutxent();
|
||||
+ TEST_NE_P(utmptr, NULL);
|
||||
+ TEST_EQ(utmptr->ut_pid, 1);
|
||||
+ TEST_EQ(utmptr->ut_type, DEAD_PROCESS);
|
||||
+
|
||||
+ nih_free (job);
|
||||
+ }
|
||||
+ TEST_FEATURE ("with USER_PROCESS utmp entry");
|
||||
+ TEST_ALLOC_FAIL {
|
||||
+ TEST_ALLOC_SAFE {
|
||||
+ job = job_new (class, "");
|
||||
+
|
||||
+ blocked = blocked_new (job, BLOCKED_EVENT, event);
|
||||
+ event_block (event);
|
||||
+ nih_list_add (&job->blocking, &blocked->entry);
|
||||
+ }
|
||||
+
|
||||
+ job->goal = JOB_START;
|
||||
+ job->state = JOB_RUNNING;
|
||||
+ job->pid[PROCESS_MAIN] = 1;
|
||||
+
|
||||
+ TEST_FREE_TAG (blocked);
|
||||
+
|
||||
+ job->blocker = NULL;
|
||||
+ event->failed = FALSE;
|
||||
+
|
||||
+ job->failed = FALSE;
|
||||
+ job->failed_process = -1;
|
||||
+ job->exit_status = 0;
|
||||
+
|
||||
+ output = fopen (utmpname, "w");
|
||||
+ fclose (output);
|
||||
+
|
||||
+ /* set utmp file */
|
||||
+ utmpxname(utmpname);
|
||||
+
|
||||
+ /* set up utmp entries */
|
||||
+ memset (&utmp, 0, sizeof utmp);
|
||||
+
|
||||
+ strcpy(utmp.ut_id, "2");
|
||||
+ utmp.ut_type = USER_PROCESS;
|
||||
+ utmp.ut_pid = 2;
|
||||
+
|
||||
+ gettimeofday(&tv, NULL);
|
||||
+ utmp.ut_tv.tv_sec = tv.tv_sec;
|
||||
+ utmp.ut_tv.tv_usec = tv.tv_usec;
|
||||
+
|
||||
+ setutxent();
|
||||
+ pututxline(&utmp);
|
||||
+
|
||||
+ strcpy(utmp.ut_id, "1");
|
||||
+ utmp.ut_pid = 1;
|
||||
+ pututxline(&utmp);
|
||||
+
|
||||
+ endutxent();
|
||||
+
|
||||
+ job_process_handler (NULL, 1, NIH_CHILD_EXITED, 0);
|
||||
+
|
||||
+ setutxent();
|
||||
+
|
||||
+ utmptr = getutxent();
|
||||
+ TEST_NE_P(utmptr, NULL);
|
||||
+ TEST_EQ(utmptr->ut_pid, 2);
|
||||
+ TEST_EQ(utmptr->ut_type, USER_PROCESS);
|
||||
+
|
||||
+ utmptr = getutxent();
|
||||
+ TEST_NE_P(utmptr, NULL);
|
||||
+ TEST_EQ(utmptr->ut_pid, 1);
|
||||
+ TEST_EQ(utmptr->ut_type, DEAD_PROCESS);
|
||||
+
|
||||
+ nih_free (job);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+
|
||||
int
|
||||
main (int argc,
|
||||
char *argv[])
|
||||
@@ -4505,6 +4672,7 @@ main (int argc,
|
||||
test_spawn ();
|
||||
test_kill ();
|
||||
test_handler ();
|
||||
+ test_utmp ();
|
||||
|
||||
test_find ();
|
||||
|
||||
75
upstart.spec
75
upstart.spec
|
|
@ -1,27 +1,28 @@
|
|||
Name: upstart
|
||||
Version: 0.6.3
|
||||
Version: 0.6.5
|
||||
Release: 7%{?dist}
|
||||
Summary: An event-driven init system
|
||||
|
||||
Group: System Environment/Base
|
||||
License: GPLv2 and LGPLv2+
|
||||
URL: http://upstart.ubuntu.com
|
||||
Source0: http://upstart.ubuntu.com/download/0.6/upstart-%{version}.tar.bz2
|
||||
Source0: http://upstart.ubuntu.com/download/0.6/upstart-%{version}.tar.gz
|
||||
Source1: init-system-dbus.conf
|
||||
# remove tests which fail in koji
|
||||
Patch0: upstart-remove-tests.patch
|
||||
Patch1: upstart-telinit.patch
|
||||
Patch2: upstart-audit-events.patch
|
||||
# pulled from https://bugs.launchpad.net/ubuntu/+source/upstart/+bug/436758
|
||||
# sparc specific allignment errors
|
||||
Patch3: upstart-nih-alloc.patch
|
||||
# SIGUSR1 handler - connect to system dbus
|
||||
Patch4: upstart-usr1-handler.patch
|
||||
Patch1: upstart-telinit.patch
|
||||
Patch2: upstart-audit-events.patch
|
||||
# set DEAD_PROCESS for dead process with pid in utmp table (#572199, #632568)
|
||||
Patch3: upstart-utmp.patch
|
||||
Patch4: upstart-reexec.patch
|
||||
# shutdown exits with nonzero exitcode when fails
|
||||
Patch5: upstart-shutdown-exitcode.patch
|
||||
# send close fd command to shell first (#646894)
|
||||
Patch6: upstart-close-fd.patch
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
||||
Obsoletes: SysVinit < 2.86-24, sysvinit < 2.86-24
|
||||
Provides: SysVinit = 2.86-24, sysvinit = 2.86-24
|
||||
BuildRequires: gettext, audit-libs-devel, expat-devel
|
||||
BuildRequires: dbus-devel >= 1:1.2.16
|
||||
BuildRequires: dbus-devel >= 1:1.2.16, libnih-devel >= 1.0.1
|
||||
Conflicts: initscripts < 9.12
|
||||
|
||||
%description
|
||||
Upstart is an event-based replacement for the /sbin/init daemon which
|
||||
|
|
@ -30,11 +31,12 @@ during shutdown and supervising them while the system is running.
|
|||
|
||||
%prep
|
||||
%setup -q
|
||||
%patch0 -p1 -b .tests
|
||||
%patch1 -p1 -b .u
|
||||
%patch2 -p1 -b .audit
|
||||
%patch3 -p1 -b .alignment
|
||||
%patch4 -p1 -b .usr1
|
||||
%patch3 -p1 -b .utmp
|
||||
%patch4 -p1 -b .reexec
|
||||
%patch5 -p1 -b .exitcode
|
||||
%patch6 -p1 -b .closefd
|
||||
|
||||
%build
|
||||
%configure --sbindir=/sbin --libdir=/%{_lib}
|
||||
|
|
@ -44,16 +46,6 @@ make %{?_smp_mflags}
|
|||
rm -rf %{buildroot}
|
||||
make install DESTDIR=%{buildroot}
|
||||
|
||||
# libupstart and libnih aren't shipped
|
||||
rm -f %{buildroot}/%{_lib}/libupstart.*
|
||||
rm -f %{buildroot}/%{_lib}/libnih.*
|
||||
rm -f %{buildroot}/%{_includedir}/libnih.h
|
||||
rm -f %{buildroot}/%{_includedir}/libupstart.h
|
||||
rm -rf %{buildroot}/%{_includedir}/nih
|
||||
rm -rf %{buildroot}/%{_includedir}/upstart
|
||||
rm -rf %{buildroot}/%{_datadir}/aclocal/compiler.m4
|
||||
rm -rf %{buildroot}/%{_datadir}/aclocal/linker.m4
|
||||
rm -rf %{buildroot}/%{_datadir}/aclocal/misc.m4
|
||||
# don't ship default jobs
|
||||
rm -f %{buildroot}/%{_sysconfdir}/init/*
|
||||
install -m 644 %{SOURCE1} %{buildroot}/%{_sysconfdir}/init/
|
||||
|
|
@ -61,11 +53,18 @@ install -m 644 %{SOURCE1} %{buildroot}/%{_sysconfdir}/init/
|
|||
%find_lang %{name}
|
||||
|
||||
%check
|
||||
make check
|
||||
#some tests fail in koji while pass in mock and local build
|
||||
#to run make check use "--with check"
|
||||
%if %{?_with_check:1}%{!?_with_check:0}
|
||||
make check
|
||||
%endif
|
||||
|
||||
%clean
|
||||
rm -rf %{buildroot}
|
||||
|
||||
%triggerpostun -- upstart < 0.6.0
|
||||
[ -f /proc/1/exe -a -d /proc/1/root ] && kill -TERM 1
|
||||
|
||||
%files -f %{name}.lang
|
||||
%defattr(-,root,root,-)
|
||||
%doc AUTHORS
|
||||
|
|
@ -88,6 +87,7 @@ rm -rf %{buildroot}
|
|||
/sbin/stop
|
||||
/sbin/restart
|
||||
/sbin/telinit
|
||||
/sbin/reload
|
||||
%{_mandir}/man5/init.5.gz
|
||||
%{_mandir}/man5/inittab.5.gz
|
||||
%{_mandir}/man7/control-alt-delete.7.gz
|
||||
|
|
@ -112,8 +112,31 @@ rm -rf %{buildroot}
|
|||
%{_mandir}/man8/status.8.gz
|
||||
%{_mandir}/man8/stop.8.gz
|
||||
%{_mandir}/man8/telinit.8.gz
|
||||
%{_mandir}/man8/reload.8.gz
|
||||
|
||||
%changelog
|
||||
* Tue Oct 26 2010 Petr Lautrbach <plautrba@redhat.com> 0.6.5-7
|
||||
- send close fd command to shell first (#646894)
|
||||
|
||||
* Tue Sep 21 2010 Petr Lautrbach <plautrba@redhat.com> 0.6.5-6
|
||||
- set DEAD_PROCESS for dead process with pid in utmp table (#572199, #632568)
|
||||
- exit shutdown with nonzero exitcode when fails shutdown
|
||||
|
||||
* Tue May 4 2010 Bill Nottingham <notting@redhat.com> 0.6.5-5
|
||||
- re-add SIGTERM handler so restart on shutdown works, avoiding dirty inodes (#576662)
|
||||
|
||||
* Tue Apr 6 2010 Casey Dahlin <cdahlin@redhat.com> 0.6.5-4
|
||||
- Reload init after install
|
||||
|
||||
* Wed Feb 24 2010 Petr Lautrbach <plautrba@redhat.com> 0.6.5-3
|
||||
- run "make check" only with --with check
|
||||
|
||||
* Fri Feb 19 2010 Casey Dahlin <cdahlin@redhat.com> 0.6.5-2
|
||||
- be more specific about which libnih we need.
|
||||
|
||||
* Wed Feb 17 2010 Petr Lautrbach <plautrba@redhat.com> 0.6.5-1
|
||||
- upgrade to 0.6.5
|
||||
|
||||
* Fri Jan 29 2010 Petr Lautrbach <plautrba@redhat.com> 0.6.3-7
|
||||
- add SIGUSR1 handler and init-system-dbus.conf (#559660)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue