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
96086a6b
Unverified
Commit
96086a6b
authored
May 15, 2020
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
process_utils: add clone3() support
Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
f40988c7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
53 additions
and
2 deletions
+53
-2
configure.ac
configure.ac
+6
-2
process_utils.h
src/lxc/process_utils.h
+47
-0
No files found.
configure.ac
View file @
96086a6b
...
...
@@ -622,7 +622,11 @@ AC_CHECK_HEADER([ifaddrs.h],
AC_HEADER_MAJOR
# Check for some syscalls functions
AC_CHECK_FUNCS([setns pivot_root sethostname unshare rand_r confstr faccessat gettid memfd_create move_mount open_tree execveat])
AC_CHECK_FUNCS([setns pivot_root sethostname unshare rand_r confstr faccessat gettid memfd_create move_mount open_tree execveat clone3])
# HAVE_STRUCT_CLONE_ARGS={0,1}
AC_CHECK_TYPES([struct clone_args], [], [], [[#include <linux/sched.h>]])
AC_CHECK_MEMBERS([struct clone_args.set_tid],[],[],[[#include <linux/sched.h>]])
AC_CHECK_MEMBERS([struct clone_args.cgroup],[],[],[[#include <linux/sched.h>]])
# Check for strerror_r() support. Defines:
# - HAVE_STRERROR_R if available
...
...
@@ -761,7 +765,7 @@ AX_CHECK_COMPILE_FLAG([-Wstringop-overflow], [CFLAGS="$CFLAGS -Wstringop-overflo
AX_CHECK_LINK_FLAG([-z relro], [LDFLAGS="$LDFLAGS -z relro"],,[])
AX_CHECK_LINK_FLAG([-z now], [LDFLAGS="$LDFLAGS -z now"],,[])
CFLAGS="$CFLAGS -Wvla -std=gnu11"
CFLAGS="$CFLAGS -Wvla -std=gnu11
-fms-extensions
"
if test "x$enable_werror" = "xyes"; then
CFLAGS="$CFLAGS -Werror"
fi
...
...
src/lxc/process_utils.h
View file @
96086a6b
...
...
@@ -6,6 +6,7 @@
#ifndef _GNU_SOURCE
#define _GNU_SOURCE 1
#endif
#include <linux/sched.h>
#include <sched.h>
#include <signal.h>
#include <stdbool.h>
...
...
@@ -14,6 +15,9 @@
#include <sys/syscall.h>
#include <unistd.h>
#include "config.h"
#include "syscall_numbers.h"
#ifndef CSIGNAL
#define CSIGNAL 0x000000ff
/* signal mask to be sent at exit */
#endif
...
...
@@ -136,6 +140,49 @@
#define P_PIDFD 3
#endif
#ifndef CLONE_ARGS_SIZE_VER0
#define CLONE_ARGS_SIZE_VER0 64
/* sizeof first published struct */
#endif
#ifndef CLONE_ARGS_SIZE_VER1
#define CLONE_ARGS_SIZE_VER1 80
/* sizeof second published struct */
#endif
#ifndef CLONE_ARGS_SIZE_VER2
#define CLONE_ARGS_SIZE_VER2 88
/* sizeof third published struct */
#endif
#ifndef HAVE_STRUCT_CLONE_ARGS
struct
clone_args
{
__aligned_u64
flags
;
__aligned_u64
pidfd
;
__aligned_u64
child_tid
;
__aligned_u64
parent_tid
;
__aligned_u64
exit_signal
;
__aligned_u64
stack
;
__aligned_u64
stack_size
;
__aligned_u64
tls
;
__aligned_u64
set_tid
;
__aligned_u64
set_tid_size
;
__aligned_u64
cgroup
;
};
#endif
struct
lxc_clone_args
{
struct
clone_args
;
#ifndef HAVE_STRUCT_CLONE_ARGS_SET_TID
__aligned_u64
set_tid
;
__aligned_u64
set_tid_size
;
#endif
#ifndef HAVE_STRUCT_CLONE_ARGS_CGROUP
__aligned_u64
cgroup
;
#endif
};
static
inline
pid_t
lxc_clone3
(
struct
lxc_clone_args
*
args
,
size_t
size
)
{
return
syscall
(
__NR_clone3
,
(
struct
clone_args
*
)
args
,
size
);
}
#if defined(__ia64__)
int
__clone2
(
int
(
*
__fn
)(
void
*
__arg
),
void
*
__child_stack_base
,
...
...
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