Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
lxc
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
lxc
Commits
8cb8f970
Unverified
Commit
8cb8f970
authored
Oct 03, 2018
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
syscall_wrappers: move setns()
Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
96c7c2a9
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
38 additions
and
32 deletions
+38
-32
Makefile.am
src/lxc/Makefile.am
+2
-1
attach.c
src/lxc/attach.c
+1
-0
lxc_user_nic.c
src/lxc/cmd/lxc_user_nic.c
+1
-0
network.c
src/lxc/network.c
+1
-0
start.c
src/lxc/start.c
+1
-0
syscall_wrappers.h
src/lxc/syscall_wrappers.h
+32
-0
utils.h
src/lxc/utils.h
+0
-31
No files found.
src/lxc/Makefile.am
View file @
8cb8f970
...
...
@@ -350,7 +350,8 @@ lxc_user_nic_SOURCES = cmd/lxc_user_nic.c \
log.c log.h
\
network.c network.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
\
conf.c conf.h
\
list.h
\
...
...
src/lxc/attach.c
View file @
8cb8f970
...
...
@@ -60,6 +60,7 @@
#include "mainloop.h"
#include "namespace.h"
#include "raw_syscalls.h"
#include "syscall_wrappers.h"
#include "terminal.h"
#include "utils.h"
...
...
src/lxc/cmd/lxc_user_nic.c
View file @
8cb8f970
...
...
@@ -52,6 +52,7 @@
#include "network.h"
#include "parse.h"
#include "raw_syscalls.h"
#include "syscall_wrappers.h"
#include "utils.h"
#ifndef HAVE_STRLCPY
...
...
src/lxc/network.c
View file @
8cb8f970
...
...
@@ -57,6 +57,7 @@
#include "network.h"
#include "nl.h"
#include "raw_syscalls.h"
#include "syscall_wrappers.h"
#include "utils.h"
#ifndef HAVE_STRLCPY
...
...
src/lxc/start.c
View file @
8cb8f970
...
...
@@ -75,6 +75,7 @@
#include "storage/storage.h"
#include "storage/storage_utils.h"
#include "sync.h"
#include "syscall_wrappers.h"
#include "terminal.h"
#include "utils.h"
...
...
src/lxc/syscall_wrappers.h
View file @
8cb8f970
...
...
@@ -25,6 +25,7 @@
#endif
#include <asm/unistd.h>
#include <linux/keyctl.h>
#include <sched.h>
#include <stdint.h>
#include <sys/syscall.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
);
#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 */
src/lxc/utils.h
View file @
8cb8f970
...
...
@@ -56,37 +56,6 @@ extern char *get_rundir(void);
#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 */
#ifndef HAVE_SETHOSTNAME
static
inline
int
sethostname
(
const
char
*
name
,
size_t
len
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment