[systemd-devel] Unable to store fds with systemd and reterive it back again

Pathangi Janardhanan path.jana at gmail.com
Mon Jan 4 22:11:16 PST 2016


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);
    syslog(LOG_NOTICE, "Result of sd notify %d", ret);

 From the debug printf I see
Jan  5 00:37:23 ctoserver11 /usr/bin/myechoser[13640]: env. variable Notify
Socket =/run/systemd/notify 19
Jan  5 00:37:23 ctoserver11 /usr/bin/myechoser[13640]: Storing 1 number of
fds
Jan  5 00:37:23 ctoserver11 /usr/bin/myechoser[13640]: Result of sd notify
-22


 The return value seems to be -EINVAL, but looking at the code and the
above debug, I am not sure why this is happening?

 Any help would be great.

Thanks
Jana
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20160105/316d50d0/attachment-0001.html>


More information about the systemd-devel mailing list