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
dbe40686
Unverified
Commit
dbe40686
authored
Oct 03, 2018
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
syscall_wrappers: move signalfd()
Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
dd425984
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
82 additions
and
80 deletions
+82
-80
nbd.c
src/lxc/storage/nbd.c
+1
-0
syscall_wrappers.h
src/lxc/syscall_wrappers.h
+80
-0
terminal.c
src/lxc/terminal.c
+1
-0
utils.h
src/lxc/utils.h
+0
-80
No files found.
src/lxc/storage/nbd.c
View file @
dbe40686
...
@@ -38,6 +38,7 @@
...
@@ -38,6 +38,7 @@
#include "nbd.h"
#include "nbd.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
...
...
src/lxc/syscall_wrappers.h
View file @
dbe40686
...
@@ -24,6 +24,7 @@
...
@@ -24,6 +24,7 @@
#define _GNU_SOURCE 1
#define _GNU_SOURCE 1
#endif
#endif
#include <asm/unistd.h>
#include <asm/unistd.h>
#include <errno.h>
#include <linux/keyctl.h>
#include <linux/keyctl.h>
#include <sched.h>
#include <sched.h>
#include <stdint.h>
#include <stdint.h>
...
@@ -37,6 +38,10 @@
...
@@ -37,6 +38,10 @@
#include <linux/memfd.h>
#include <linux/memfd.h>
#endif
#endif
#ifdef HAVE_SYS_SIGNALFD_H
#include <sys/signalfd.h>
#endif
typedef
int32_t
key_serial_t
;
typedef
int32_t
key_serial_t
;
#if !HAVE_KEYCTL
#if !HAVE_KEYCTL
...
@@ -155,6 +160,81 @@ static inline int setns(int fd, int nstype)
...
@@ -155,6 +160,81 @@ static inline int setns(int fd, int nstype)
}
}
#endif
#endif
#ifndef HAVE_SYS_SIGNALFD_H
struct
signalfd_siginfo
{
uint32_t
ssi_signo
;
int32_t
ssi_errno
;
int32_t
ssi_code
;
uint32_t
ssi_pid
;
uint32_t
ssi_uid
;
int32_t
ssi_fd
;
uint32_t
ssi_tid
;
uint32_t
ssi_band
;
uint32_t
ssi_overrun
;
uint32_t
ssi_trapno
;
int32_t
ssi_status
;
int32_t
ssi_int
;
uint64_t
ssi_ptr
;
uint64_t
ssi_utime
;
uint64_t
ssi_stime
;
uint64_t
ssi_addr
;
uint8_t
__pad
[
48
];
};
#ifndef __NR_signalfd4
/* assume kernel headers are too old */
#if __i386__
#define __NR_signalfd4 327
#elif __x86_64__
#define __NR_signalfd4 289
#elif __powerpc__
#define __NR_signalfd4 313
#elif __s390x__
#define __NR_signalfd4 322
#elif __arm__
#define __NR_signalfd4 355
#elif __mips__ && _MIPS_SIM == _ABIO32
#define __NR_signalfd4 4324
#elif __mips__ && _MIPS_SIM == _ABI64
#define __NR_signalfd4 5283
#elif __mips__ && _MIPS_SIM == _ABIN32
#define __NR_signalfd4 6287
#endif
#endif
#ifndef __NR_signalfd
/* assume kernel headers are too old */
#if __i386__
#define __NR_signalfd 321
#elif __x86_64__
#define __NR_signalfd 282
#elif __powerpc__
#define __NR_signalfd 305
#elif __s390x__
#define __NR_signalfd 316
#elif __arm__
#define __NR_signalfd 349
#elif __mips__ && _MIPS_SIM == _ABIO32
#define __NR_signalfd 4317
#elif __mips__ && _MIPS_SIM == _ABI64
#define __NR_signalfd 5276
#elif __mips__ && _MIPS_SIM == _ABIN32
#define __NR_signalfd 6280
#endif
#endif
static
inline
int
signalfd
(
int
fd
,
const
sigset_t
*
mask
,
int
flags
)
{
int
retval
;
retval
=
syscall
(
__NR_signalfd4
,
fd
,
mask
,
_NSIG
/
8
,
flags
);
if
(
errno
==
ENOSYS
&&
flags
==
0
)
retval
=
syscall
(
__NR_signalfd
,
fd
,
mask
,
_NSIG
/
8
);
return
retval
;
}
#endif
/* Define unshare() if missing from the C library */
/* Define unshare() if missing from the C library */
#ifndef HAVE_UNSHARE
#ifndef HAVE_UNSHARE
static
inline
int
unshare
(
int
flags
)
static
inline
int
unshare
(
int
flags
)
...
...
src/lxc/terminal.c
View file @
dbe40686
...
@@ -45,6 +45,7 @@
...
@@ -45,6 +45,7 @@
#include "lxclock.h"
#include "lxclock.h"
#include "mainloop.h"
#include "mainloop.h"
#include "start.h"
#include "start.h"
#include "syscall_wrappers.h"
#include "terminal.h"
#include "terminal.h"
#include "utils.h"
#include "utils.h"
...
...
src/lxc/utils.h
View file @
dbe40686
...
@@ -56,86 +56,6 @@ extern char *get_rundir(void);
...
@@ -56,86 +56,6 @@ extern char *get_rundir(void);
#endif
#endif
#endif
#endif
/* Define signalfd() if missing from the C library */
#ifdef HAVE_SYS_SIGNALFD_H
# include <sys/signalfd.h>
#else
/* assume kernel headers are too old */
#include <stdint.h>
struct
signalfd_siginfo
{
uint32_t
ssi_signo
;
int32_t
ssi_errno
;
int32_t
ssi_code
;
uint32_t
ssi_pid
;
uint32_t
ssi_uid
;
int32_t
ssi_fd
;
uint32_t
ssi_tid
;
uint32_t
ssi_band
;
uint32_t
ssi_overrun
;
uint32_t
ssi_trapno
;
int32_t
ssi_status
;
int32_t
ssi_int
;
uint64_t
ssi_ptr
;
uint64_t
ssi_utime
;
uint64_t
ssi_stime
;
uint64_t
ssi_addr
;
uint8_t
__pad
[
48
];
};
# ifndef __NR_signalfd4
/* assume kernel headers are too old */
# if __i386__
# define __NR_signalfd4 327
# elif __x86_64__
# define __NR_signalfd4 289
# elif __powerpc__
# define __NR_signalfd4 313
# elif __s390x__
# define __NR_signalfd4 322
# elif __arm__
# define __NR_signalfd4 355
# elif __mips__ && _MIPS_SIM == _ABIO32
# define __NR_signalfd4 4324
# elif __mips__ && _MIPS_SIM == _ABI64
# define __NR_signalfd4 5283
# elif __mips__ && _MIPS_SIM == _ABIN32
# define __NR_signalfd4 6287
# endif
#endif
# ifndef __NR_signalfd
/* assume kernel headers are too old */
# if __i386__
# define __NR_signalfd 321
# elif __x86_64__
# define __NR_signalfd 282
# elif __powerpc__
# define __NR_signalfd 305
# elif __s390x__
# define __NR_signalfd 316
# elif __arm__
# define __NR_signalfd 349
# elif __mips__ && _MIPS_SIM == _ABIO32
# define __NR_signalfd 4317
# elif __mips__ && _MIPS_SIM == _ABI64
# define __NR_signalfd 5276
# elif __mips__ && _MIPS_SIM == _ABIN32
# define __NR_signalfd 6280
# endif
#endif
static
inline
int
signalfd
(
int
fd
,
const
sigset_t
*
mask
,
int
flags
)
{
int
retval
;
retval
=
syscall
(
__NR_signalfd4
,
fd
,
mask
,
_NSIG
/
8
,
flags
);
if
(
errno
==
ENOSYS
&&
flags
==
0
)
retval
=
syscall
(
__NR_signalfd
,
fd
,
mask
,
_NSIG
/
8
);
return
retval
;
}
#endif
static
inline
int
lxc_set_cloexec
(
int
fd
)
static
inline
int
lxc_set_cloexec
(
int
fd
)
{
{
return
fcntl
(
fd
,
F_SETFD
,
FD_CLOEXEC
);
return
fcntl
(
fd
,
F_SETFD
,
FD_CLOEXEC
);
...
...
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