mirror of
https://git.proxmox.com/git/mirror_lxc
synced 2025-08-15 04:09:46 +00:00
syscall_wrappers: move setns()
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
This commit is contained in:
parent
6a886ddf19
commit
59524108dd
@ -360,7 +360,8 @@ lxc_user_nic_SOURCES = cmd/lxc_user_nic.c \
|
|||||||
log.c log.h \
|
log.c log.h \
|
||||||
network.c network.h \
|
network.c network.h \
|
||||||
parse.c parse.h \
|
parse.c parse.h \
|
||||||
raw_syscalls.c raw_syscalls.h
|
raw_syscalls.c raw_syscalls.h \
|
||||||
|
syscall_wrappers.h
|
||||||
lxc_usernsexec_SOURCES = cmd/lxc_usernsexec.c \
|
lxc_usernsexec_SOURCES = cmd/lxc_usernsexec.c \
|
||||||
conf.c conf.h \
|
conf.c conf.h \
|
||||||
list.h \
|
list.h \
|
||||||
|
@ -60,6 +60,7 @@
|
|||||||
#include "mainloop.h"
|
#include "mainloop.h"
|
||||||
#include "namespace.h"
|
#include "namespace.h"
|
||||||
#include "raw_syscalls.h"
|
#include "raw_syscalls.h"
|
||||||
|
#include "syscall_wrappers.h"
|
||||||
#include "terminal.h"
|
#include "terminal.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
|
||||||
|
@ -52,6 +52,7 @@
|
|||||||
#include "network.h"
|
#include "network.h"
|
||||||
#include "parse.h"
|
#include "parse.h"
|
||||||
#include "raw_syscalls.h"
|
#include "raw_syscalls.h"
|
||||||
|
#include "syscall_wrappers.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
|
||||||
#ifndef HAVE_STRLCPY
|
#ifndef HAVE_STRLCPY
|
||||||
|
@ -57,6 +57,7 @@
|
|||||||
#include "network.h"
|
#include "network.h"
|
||||||
#include "nl.h"
|
#include "nl.h"
|
||||||
#include "raw_syscalls.h"
|
#include "raw_syscalls.h"
|
||||||
|
#include "syscall_wrappers.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
|
||||||
#ifndef HAVE_STRLCPY
|
#ifndef HAVE_STRLCPY
|
||||||
|
@ -75,6 +75,7 @@
|
|||||||
#include "storage/storage.h"
|
#include "storage/storage.h"
|
||||||
#include "storage/storage_utils.h"
|
#include "storage/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"
|
||||||
|
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
#endif
|
#endif
|
||||||
#include <asm/unistd.h>
|
#include <asm/unistd.h>
|
||||||
#include <linux/keyctl.h>
|
#include <linux/keyctl.h>
|
||||||
|
#include <sched.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <sys/syscall.h>
|
#include <sys/syscall.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
@ -110,4 +111,35 @@ static int pivot_root(const char *new_root, const char *put_old)
|
|||||||
extern int pivot_root(const char *new_root, const char *put_old);
|
extern int pivot_root(const char *new_root, const char *put_old);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if !defined(__NR_setns) && !defined(__NR_set_ns)
|
||||||
|
#if defined(__x86_64__)
|
||||||
|
#define __NR_setns 308
|
||||||
|
#elif defined(__i386__)
|
||||||
|
#define __NR_setns 346
|
||||||
|
#elif defined(__arm__)
|
||||||
|
#define __NR_setns 375
|
||||||
|
#elif defined(__aarch64__)
|
||||||
|
#define __NR_setns 375
|
||||||
|
#elif defined(__powerpc__)
|
||||||
|
#define __NR_setns 350
|
||||||
|
#elif defined(__s390__)
|
||||||
|
#define __NR_setns 339
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Define setns() if missing from the C library */
|
||||||
|
#ifndef HAVE_SETNS
|
||||||
|
static inline int setns(int fd, int nstype)
|
||||||
|
{
|
||||||
|
#ifdef __NR_setns
|
||||||
|
return syscall(__NR_setns, fd, nstype);
|
||||||
|
#elif defined(__NR_set_ns)
|
||||||
|
return syscall(__NR_set_ns, fd, nstype);
|
||||||
|
#else
|
||||||
|
errno = ENOSYS;
|
||||||
|
return -1;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /* __LXC_SYSCALL_WRAPPER_H */
|
#endif /* __LXC_SYSCALL_WRAPPER_H */
|
||||||
|
@ -56,37 +56,6 @@ extern char *get_rundir(void);
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(__NR_setns) && !defined(__NR_set_ns)
|
|
||||||
#if defined(__x86_64__)
|
|
||||||
#define __NR_setns 308
|
|
||||||
#elif defined(__i386__)
|
|
||||||
#define __NR_setns 346
|
|
||||||
#elif defined(__arm__)
|
|
||||||
#define __NR_setns 375
|
|
||||||
#elif defined(__aarch64__)
|
|
||||||
#define __NR_setns 375
|
|
||||||
#elif defined(__powerpc__)
|
|
||||||
#define __NR_setns 350
|
|
||||||
#elif defined(__s390__)
|
|
||||||
#define __NR_setns 339
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Define setns() if missing from the C library */
|
|
||||||
#ifndef HAVE_SETNS
|
|
||||||
static inline int setns(int fd, int nstype)
|
|
||||||
{
|
|
||||||
#ifdef __NR_setns
|
|
||||||
return syscall(__NR_setns, fd, nstype);
|
|
||||||
#elif defined(__NR_set_ns)
|
|
||||||
return syscall(__NR_set_ns, fd, nstype);
|
|
||||||
#else
|
|
||||||
errno = ENOSYS;
|
|
||||||
return -1;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Define sethostname() if missing from the C library */
|
/* Define sethostname() if missing from the C library */
|
||||||
#ifndef HAVE_SETHOSTNAME
|
#ifndef HAVE_SETHOSTNAME
|
||||||
static inline int sethostname(const char *name, size_t len)
|
static inline int sethostname(const char *name, size_t len)
|
||||||
|
Loading…
Reference in New Issue
Block a user