[prev in list] [next in list] [prev in thread] [next in thread]
List: opensuse-commit
Subject: commit syslogd for openSUSE:Factory
From: root () hilbert ! suse ! de (h_root)
Date: 2011-01-25 12:29:55
Message-ID: 20110125122955.310D9202AE () hilbert ! suse ! de
[Download RAW message or body]
Hello community,
here is the log from the commit of package syslogd for openSUSE:Factory
checked in at Tue Jan 25 13:29:55 CET 2011.
--------
--- syslogd/syslogd.changes 2010-11-30 11:09:34.000000000 +0100
+++ /mounts/work_src_done/STABLE/syslogd/syslogd.changes 2011-01-20 10:42:29.000000000 +0100
@@ -1,0 +2,6 @@
+Thu Jan 20 09:37:15 UTC 2011 - mt@suse.de
+
+- Improved systemd socket activation support to support multiple
+ sockets and activation in forking mode (bnc#656104)
+
+-------------------------------------------------------------------
calling whatdependson for head-i586
New:
----
sysklogd-1.4.1-systemd-multi.dif
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ syslogd.spec ++++++
--- /var/tmp/diff_new_pack.mnVDVR/_old 2011-01-25 13:29:34.000000000 +0100
+++ /var/tmp/diff_new_pack.mnVDVR/_new 2011-01-25 13:29:34.000000000 +0100
@@ -1,7 +1,7 @@
#
-# spec file for package syslogd (Version 1.4.1)
+# spec file for package syslogd
#
-# Copyright (c) 2010 SUSE LINUX Products GmbH, Nuernberg, Germany.
+# Copyright (c) 2011 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -27,7 +27,7 @@
Provides: syslog
AutoReqProv: on
Version: 1.4.1
-Release: 726
+Release: 727
Summary: The Syslog daemon
Source: sysklogd-1.4.1.tar.bz2
Source1: logrotate.syslog
@@ -61,6 +61,7 @@
Patch22: sysklogd-1.4.1-sysmap-prior-to-2.5.patch
Patch23: sysklogd-1.4.1-reload.dif
Patch24: sysklogd-1.4.1-systemd.dif
+Patch25: sysklogd-1.4.1-systemd-multi.dif
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description
@@ -130,6 +131,7 @@
%patch22 -p0 -b .sysmap
%patch23 -p0 -b .reload
%patch24 -p0 -b .sd
+%patch25 -p0 -b .sd2
%patch0 -p0
%build
++++++ sysklogd-1.4.1-systemd-multi.dif ++++++
--- syslogd.c
+++ syslogd.c 2011/01/20 10:55:18
@@ -574,6 +574,9 @@ static volatile sig_atomic_t restart;
int nfunix = 1;
char *funixn[MAXFUNIX] = { _PATH_LOG };
int funix[MAXFUNIX] = { -1, };
+#if defined(__linux__)
+int sd_fds = 0;
+#endif
#ifdef UT_NAMESIZE
# define UNAMESZ UT_NAMESIZE /* length of a login name */
@@ -1000,12 +1003,44 @@ int main(argc, argv)
exit(1);
}
+ i = 0;
num_fds = getdtablesize();
#if defined(__linux__)
- if (sd_listen_fds(0) <= 0)
-#endif
- for (i = 0; i < num_fds; i++)
+ /* if (sd_booted()) */ {
+ const char *e;
+ char buf[24] = { '\0' };
+ char *p = NULL;
+ unsigned long l;
+
+ /* fork & systemd socket activation:
+ * fetch listen pid and update to ours,
+ * when it is set to pid of our parent.
+ */
+ if ( (e = getenv("LISTEN_PID"))) {
+ errno = 0;
+ l = strtoul(e, &p, 10);
+ if (errno == 0 && l > 0 && (!p || !*p)) {
+ if (getppid() == (pid_t)l) {
+ snprintf(buf, sizeof(buf), "%d",
+ getpid());
+ setenv("LISTEN_PID", buf, 1);
+ }
+ }
+ }
+
+ /*
+ * init sd_fds and close all fds, except
+ * of the fds provided by systemd.
+ */
+ sd_fds = sd_listen_fds(0);
+ for( ; i < SD_LISTEN_FDS_START; i++)
(void) close(i);
+ if (sd_fds > 0)
+ i = SD_LISTEN_FDS_START + sd_fds;
+ }
+#endif
+ for ( ; i < num_fds; i++)
+ (void) close(i);
untty();
break;
}
@@ -1041,7 +1076,12 @@ int main(argc, argv)
dprintf("Pidfile (and pid) already exist.\n");
exit(1);
}
- } /* if ( !Debug ) */
+ } /* if ( !(Debug || NoFork)) */
+#if defined(__linux__)
+ /* if (sd_booted()) */ {
+ sd_fds = sd_listen_fds(0);
+ }
+#endif
}
#endif
@@ -1323,54 +1363,30 @@ static int create_unix_socket(const char
return -1;
#if defined(__linux__)
- if (strcmp(path, _PATH_LOG) == 0) {
- int r;
-
- /* Check whether an FD was passed in from systemd. If
- * so, it's the /dev/log socket, so use it. */
-
- r = sd_listen_fds(0);
- if (r < 0) {
- logerror("Failed to acquire systemd socket");
+ /*
+ * Check whether an FD was passed in from systemd.
+ * If so and it matches this socket, so use it.
+ */
+ if (sd_fds < 0) {
+ logerror("Failed to acquire systemd socket");
#ifndef SYSV
- dienow();
+ dienow();
#else
- return -1;
+ return -1;
#endif
- }
+ }
-
- if (r > 1) {
- logerror("Wrong number of systemd sockets passed");
-#ifndef SYSV
- dienow();
-#else
- return -1;
-#endif
- }
-
- if (r == 1) {
- fd = SD_LISTEN_FDS_START;
- r = sd_is_socket_unix(fd, SOCK_DGRAM, -1, _PATH_LOG, 0);
- if (r < 0) {
- logerror("Failed to verify systemd socket type");
-#ifndef SYSV
- dienow();
-#else
- return -1;
-#endif
+ if (sd_fds > 0) {
+ for (fd = SD_LISTEN_FDS_START; fd < SD_LISTEN_FDS_START + sd_fds; fd++) {
+ if( sd_is_socket_unix(fd, SOCK_DGRAM, -1, path, 0) == 1) {
+ /* ok, it matches -- just use as is */
+ return fd;
}
-
- if (!r) {
- logerror("Passed systemd socket of wrong type");
-#ifndef SYSV
- dienow();
-#else
- return -1;
-#endif
- }
-
- return fd;
+ /*
+ * otherwise it either didn't matched *this* socket and
+ * we just continue to check the next one or there were
+ * an error and we will recreate it bellow.
+ */
}
}
#endif
@@ -2485,14 +2501,17 @@ void dienow(void)
if (InetInuse) close(inetm);
/* Clean-up files. */
- i = 0;
+ for (i = 0; i < nfunix; i++) {
+ if (funixn[i] && funix[i] != -1) {
#if defined(__linux__)
- if (sd_listen_fds(0) > 0)
- i = 1;
+ if (sd_fds > 0 &&
+ funix[i] >= SD_LISTEN_FDS_START &&
+ funix[i] < SD_LISTEN_FDS_START + sd_fds)
+ continue;
#endif
- for (; i < nfunix; i++)
- if (funixn[i] && funix[i] != -1)
(void)unlink(funixn[i]);
+ }
+ }
for (lognum = 0; lognum <= nlogs; lognum++) {
f = &Files[lognum];
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Remember to have fun...
--
To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org
For additional commands, e-mail: opensuse-commit+help@opensuse.org
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic