On Tue, 05.01.16 01:11, Pathangi Janardhanan (path.j...@gmail.com) wrote:

> Hi,
> 
>  I am using the function sd_pid_notify_with_fds and am unable to store the
> fds with systemd. My service is a simple echo server,
> and here is the snippet of code that is being called to store the FDS. I
> have also included the debug code.
> 
>  // Store the FDs with systemd
>     e = getenv("NOTIFY_SOCKET");
>     if (e == NULL) {
>         syslog(LOG_NOTICE, "environment variable Notify socket is null");
>     } else {
>         syslog(LOG_NOTICE, "env. variable Notify Socket =%s %d", e,
>                            strlen(e));
>     }
> 
>     syslog(LOG_NOTICE, "Storing %d number of fds", num_fd);
>     ret = sd_pid_notify_with_fds(0, 0, "FDSTORE=1\n", (const int *) fd,
>                            num_fd);

Is "fd" a single fd? If so you need to pass this as &fd of course...

The FDSTORE=1 line doesn't need to be suffixed with "\n" btw (but it
doesn't hurt if you do...)

It might be worth strace'ing your process to see that the right
sendmsg() call is issued. If in doubt, strace this specific code
snippet and paste the sendmsg() line here.

Lennart

-- 
Lennart Poettering, Red Hat
_______________________________________________
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to