Skip to content
This repository was archived by the owner on Feb 8, 2021. It is now read-only.

Commit f49d124

Browse files
committed
Merge pull request #32 from wcwxyz/master
define setns syscall wrapper to fix build issue
2 parents 93c02c0 + ee69739 commit f49d124

File tree

4 files changed

+19
-1
lines changed

4 files changed

+19
-1
lines changed

src/container.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include "util.h"
1818
#include "hyper.h"
1919
#include "parse.h"
20+
#include "syscall.h"
2021

2122
static int container_setup_volume(struct hyper_container *container)
2223
{

src/exec.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@
1212
#include <signal.h>
1313
#include <fcntl.h>
1414
#include <inttypes.h>
15-
#include "syscall.h"
1615

1716
#include "hyper.h"
1817
#include "util.h"
1918
#include "parse.h"
19+
#include "syscall.h"
2020

2121
static void pts_hup(struct hyper_event *de, int efd, int out)
2222
{

src/init.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#include "event.h"
2828
#include "parse.h"
2929
#include "container.h"
30+
#include "syscall.h"
3031

3132
struct hyper_pod global_pod = {
3233
.containers = LIST_HEAD_INIT(global_pod.containers),

src/syscall.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#define _GNU_SOURCE
2+
#include <unistd.h>
3+
#include <sys/syscall.h>
4+
5+
/*
6+
* Use raw syscall for versions of glibc that don't include it. But this
7+
* requires kernel-headers for syscall number hint.
8+
*/
9+
10+
#if !defined SYS_setns && defined __NR_setns
11+
static inline int setns(int fd, int nstype)
12+
{
13+
errno = syscall(__NR_setns, fd, nstype);
14+
return errno == 0 ? 0 : -1;
15+
}
16+
#endif

0 commit comments

Comments
 (0)