syscall_wrappers: move unshare()

parent 364932cf
...@@ -369,6 +369,7 @@ lxc_usernsexec_SOURCES = cmd/lxc_usernsexec.c \ ...@@ -369,6 +369,7 @@ lxc_usernsexec_SOURCES = cmd/lxc_usernsexec.c \
macro.h \ macro.h \
file_utils.c file_utils.h \ file_utils.c file_utils.h \
string_utils.c string_utils.h \ string_utils.c string_utils.h \
syscall_wrappers.h \
utils.c utils.h utils.c utils.h
endif endif
......
...@@ -49,6 +49,7 @@ ...@@ -49,6 +49,7 @@
#include "macro.h" #include "macro.h"
#include "file_utils.h" #include "file_utils.h"
#include "string_utils.h" #include "string_utils.h"
#include "syscall_wrappers.h"
#include "utils.h" #include "utils.h"
extern int lxc_log_fd; extern int lxc_log_fd;
......
...@@ -45,6 +45,7 @@ ...@@ -45,6 +45,7 @@
#include "lxclock.h" #include "lxclock.h"
#include "network.h" #include "network.h"
#include "storage.h" #include "storage.h"
#include "syscall_wrappers.h"
#include "utils.h" #include "utils.h"
#if IS_BIONIC #if IS_BIONIC
......
...@@ -73,6 +73,7 @@ ...@@ -73,6 +73,7 @@
#include "storage/overlay.h" #include "storage/overlay.h"
#include "storage_utils.h" #include "storage_utils.h"
#include "sync.h" #include "sync.h"
#include "syscall_wrappers.h"
#include "terminal.h" #include "terminal.h"
#include "utils.h" #include "utils.h"
#include "version.h" #include "version.h"
......
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
#include "log.h" #include "log.h"
#include "rsync.h" #include "rsync.h"
#include "storage.h" #include "storage.h"
#include "syscall_wrappers.h"
#include "utils.h" #include "utils.h"
lxc_log_define(rsync, lxc); lxc_log_define(rsync, lxc);
......
...@@ -48,6 +48,7 @@ ...@@ -48,6 +48,7 @@
#include "parse.h" #include "parse.h"
#include "storage.h" #include "storage.h"
#include "storage_utils.h" #include "storage_utils.h"
#include "syscall_wrappers.h"
#include "utils.h" #include "utils.h"
#ifndef HAVE_STRLCPY #ifndef HAVE_STRLCPY
......
...@@ -155,4 +155,19 @@ static inline int setns(int fd, int nstype) ...@@ -155,4 +155,19 @@ static inline int setns(int fd, int nstype)
} }
#endif #endif
/* Define unshare() if missing from the C library */
#ifndef HAVE_UNSHARE
static inline int unshare(int flags)
{
#ifdef __NR_unshare
return syscall(__NR_unshare, flags);
#else
errno = ENOSYS;
return -1;
#endif
}
#else
extern int unshare(int);
#endif
#endif /* __LXC_SYSCALL_WRAPPER_H */ #endif /* __LXC_SYSCALL_WRAPPER_H */
...@@ -56,21 +56,6 @@ extern char *get_rundir(void); ...@@ -56,21 +56,6 @@ extern char *get_rundir(void);
#endif #endif
#endif #endif
/* Define unshare() if missing from the C library */
#ifndef HAVE_UNSHARE
static inline int unshare(int flags)
{
#ifdef __NR_unshare
return syscall(__NR_unshare, flags);
#else
errno = ENOSYS;
return -1;
#endif
}
#else
extern int unshare(int);
#endif
/* Define signalfd() if missing from the C library */ /* Define signalfd() if missing from the C library */
#ifdef HAVE_SYS_SIGNALFD_H #ifdef HAVE_SYS_SIGNALFD_H
# include <sys/signalfd.h> # include <sys/signalfd.h>
......
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