+ fd = open(from, O_RDWR|O_NDELAY|O_CLOEXEC);
+ if (fd < 0) {
+ log_error("Failed to open fifo: %m");
+ r = -errno;
+ goto finish;
+ }
+
+ zero(mh);
+ zero(control);
+
+ mh.msg_control = &control;
+ mh.msg_controllen = sizeof(control);
+
+ cmsg = CMSG_FIRSTHDR(&mh);
+ cmsg->cmsg_level = SOL_SOCKET;
+ cmsg->cmsg_type = SCM_RIGHTS;
+ cmsg->cmsg_len = CMSG_LEN(sizeof(int));
+ memcpy(CMSG_DATA(cmsg), &fd, sizeof(int));
+
+ mh.msg_controllen = cmsg->cmsg_len;
+
+ /* Store away the fd in the socket, so that it stays open as
+ * long as we run the child */
+ k = sendmsg(kmsg_socket, &mh, MSG_DONTWAIT|MSG_NOSIGNAL);
+ close_nointr_nofail(fd);
+
+ if (k < 0) {
+ log_error("Failed to send FIFO fd: %m");
+ r = -errno;
+ goto finish;
+ }
+
+ /* And now make the FIFO unavailable as /dev/kmsg... */
+ unlink(from);
+