util: introduce {send,receive}_one_fd()

Introduce two new helpers that send/receive a single fd via a unix
transport. Also make nspawn use them instead of hard-coding it.

Based on a patch by Krzesimir Nowak.
This commit is contained in:
David Herrmann
2015-09-22 14:09:54 +02:00
parent 8e112c803c
commit d960371482
4 changed files with 83 additions and 62 deletions
+3
View File
@@ -938,3 +938,6 @@ int reset_uid_gid(void);
int getxattr_malloc(const char *path, const char *name, char **value, bool allow_symlink);
int fgetxattr_malloc(int fd, const char *name, char **value);
int send_one_fd(int transport_fd, int fd);
int receive_one_fd(int transport_fd);