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

Pathangi Janardhanan path.jana at gmail.com
Tue Jan 5 09:33:45 PST 2016


Hi,
>>     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...

No, fd is a int array, which holds num_fd,  "fd" values.

>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.

 This is the output of the strace call on this section of the code in the
sd_pid_notify_with_fds, when I try to save the fds.

socket(PF_LOCAL, SOCK_DGRAM|SOCK_CLOEXEC, 0) = 8

sendmsg(8, {msg_name(21)={sa_family=AF_LOCAL,
sun_path="/run/systemd/notify"}, msg_iov(1)=[{"FDSTORE=1\n", 10}],
msg_controllen=40, {cmsg_len=20, cmsg_level=SOL_SOCKET,
cmsg_type=SCM_RIGHTS, {7}}, msg_flags=0}, MSG_NOSIGNAL) = -1 EINVAL
(Invalid argument)

close(8)                                = 0

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


More information about the systemd-devel mailing list