utils: add lxc_cloexec()

parent 5d4dfde9
...@@ -241,6 +241,11 @@ static inline int memfd_create(const char *name, unsigned int flags) { ...@@ -241,6 +241,11 @@ static inline int memfd_create(const char *name, unsigned int flags) {
extern int memfd_create(const char *name, unsigned int flags); extern int memfd_create(const char *name, unsigned int flags);
#endif #endif
static inline int lxc_set_cloexec(int fd)
{
return fcntl(fd, F_SETFD, FD_CLOEXEC);
}
/* Struct to carry child pid from lxc_popen() to lxc_pclose(). /* Struct to carry child pid from lxc_popen() to lxc_pclose().
* Not an opaque struct to allow direct access to the underlying FILE * * Not an opaque struct to allow direct access to the underlying FILE *
* (i.e., struct lxc_popen_FILE *file; fgets(buf, sizeof(buf), file->f)) * (i.e., struct lxc_popen_FILE *file; fgets(buf, sizeof(buf), file->f))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment