https://bugzilla.novell.com/show_bug.cgi?id=656259
https://bugzilla.novell.com/show_bug.cgi?id=656259#c8
--- Comment #8 from Marius Tomaschewski 2011-02-10 15:35:34 UTC ---
Kay,
I know you've a good connection to systemd upstream, so I ask you :-)
As you can see in bug 656104 comment 21, we've added support to forward
the sockets to a child process to startproc and to fork code in all syslog
daemons [syslogd, rsyslog, syslog-ng] too, so the socket activation works
in Type=forking mode.
Could you try to get this function upstream? :
static void fwd_sd_listen_pid(void)
{
const char *env;
/*
* fork & systemd socket activation:
* fetch listen pid and update to ours,
* when it is set to pid of our parent.
*/
if ((env = getenv("LISTEN_PID"))) {
char *ptr;
long l;
errno = 0;
l = strtol(env, &ptr, 10);
if (errno != 0)
return;
if (ptr == env)
return;
if (*ptr != '\0')
return;
if (l < 0)
return;
if (getppid() == (pid_t)l) {
char buf[24];
snprintf(buf, sizeof(buf), "%d", getpid());
setenv("LISTEN_PID", buf, 1);
}
}
}
Further, the loop in sd_listen_fds setting FD_CLOEXEC disallows to use
the sd_listen_fds use in startproc or in the daemons before fork is done:
for (fd = SD_LISTEN_FDS_START; fd < SD_LISTEN_FDS_START + (int) l; fd
++) {
int flags;
if ((flags = fcntl(fd, F_GETFD)) < 0) {
r = -errno;
goto finish;
}
if (flags & FD_CLOEXEC)
continue;
if (fcntl(fd, F_SETFD, flags | FD_CLOEXEC) < 0) {
r = -errno;
goto finish;
}
}
[or you have to manually revert this...]
Could you also try to add either a parameter to sd_listen_fds to skip
setting of the FD_CLOEXEC flag or a variant of the function not doing
this?
And please again - try to provide alls this as library ...
Thanks in advance!
--
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.