uts: move to C++
This commit is contained in:
parent
a07f389a50
commit
8e8fcc2815
10
Makefile
10
Makefile
@ -35,8 +35,8 @@ LDFLAGS += -pie -Wl,-z,noexecstack -lpthread $(shell pkg-config --libs protobuf)
|
||||
|
||||
BIN = nsjail
|
||||
LIBS = kafel/libkafel.a
|
||||
SRCS_C = log.c cgroup.c mount.c user.c util.c uts.c
|
||||
SRCS_CXX = caps.cc cmdline.cc config.cc contain.cc cpu.cc net.cc nsjail.cc pid.cc sandbox.cc subproc.cc
|
||||
SRCS_C = log.c cgroup.c mount.c user.c util.c
|
||||
SRCS_CXX = caps.cc cmdline.cc config.cc contain.cc cpu.cc net.cc nsjail.cc pid.cc sandbox.cc subproc.cc uts.cc
|
||||
SRCS_PROTO = config.proto
|
||||
SRCS_PB_CXX = $(SRCS_PROTO:.proto=.pb.cc)
|
||||
SRCS_PB_H = $(SRCS_PROTO:.proto=.pb.h)
|
||||
@ -102,14 +102,13 @@ cgroup.o: cgroup.h nsjail.h log.h util.h
|
||||
mount.o: mount.h nsjail.h common.h log.h subproc.h util.h
|
||||
user.o: user.h nsjail.h common.h log.h subproc.h util.h
|
||||
util.o: util.h nsjail.h common.h log.h
|
||||
uts.o: uts.h nsjail.h log.h
|
||||
caps.o: caps.h nsjail.h common.h log.h util.h
|
||||
cmdline.o: cmdline.h nsjail.h common.h log.h mount.h user.h util.h caps.h
|
||||
cmdline.o: config.h sandbox.h
|
||||
config.o: common.h config.h nsjail.h log.h mount.h user.h util.h caps.h
|
||||
config.o: cmdline.h
|
||||
contain.o: contain.h nsjail.h cgroup.h log.h mount.h user.h uts.h caps.h
|
||||
contain.o: cpu.h net.h pid.h
|
||||
contain.o: contain.h nsjail.h cgroup.h log.h mount.h user.h caps.h cpu.h
|
||||
contain.o: net.h pid.h uts.h
|
||||
cpu.o: cpu.h nsjail.h log.h util.h
|
||||
net.o: net.h nsjail.h log.h subproc.h
|
||||
nsjail.o: nsjail.h cmdline.h common.h log.h net.h subproc.h util.h
|
||||
@ -117,3 +116,4 @@ pid.o: pid.h nsjail.h log.h subproc.h
|
||||
sandbox.o: sandbox.h nsjail.h kafel/include/kafel.h log.h
|
||||
subproc.o: subproc.h nsjail.h contain.h net.h sandbox.h cgroup.h common.h
|
||||
subproc.o: log.h user.h util.h
|
||||
uts.o: uts.h nsjail.h log.h
|
||||
|
@ -42,13 +42,13 @@ extern "C" {
|
||||
#include "log.h"
|
||||
#include "mount.h"
|
||||
#include "user.h"
|
||||
#include "uts.h"
|
||||
}
|
||||
|
||||
#include "caps.h"
|
||||
#include "cpu.h"
|
||||
#include "net.h"
|
||||
#include "pid.h"
|
||||
#include "uts.h"
|
||||
|
||||
namespace contain {
|
||||
|
||||
@ -58,7 +58,7 @@ static bool containInitPidNs(struct nsjconf_t* nsjconf) { return pid::initNs(nsj
|
||||
|
||||
static bool containInitNetNs(struct nsjconf_t* nsjconf) { return net::initNsFromChild(nsjconf); }
|
||||
|
||||
static bool containInitUtsNs(struct nsjconf_t* nsjconf) { return utsInitNs(nsjconf); }
|
||||
static bool containInitUtsNs(struct nsjconf_t* nsjconf) { return uts::initNs(nsjconf); }
|
||||
|
||||
static bool containInitCgroupNs(void) { return cgroupInitNs(); }
|
||||
|
||||
|
@ -24,9 +24,13 @@
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
extern "C" {
|
||||
#include "log.h"
|
||||
}
|
||||
|
||||
bool utsInitNs(struct nsjconf_t* nsjconf) {
|
||||
namespace uts {
|
||||
|
||||
bool initNs(struct nsjconf_t* nsjconf) {
|
||||
if (nsjconf->clone_newuts == false) {
|
||||
return true;
|
||||
}
|
||||
@ -38,3 +42,5 @@ bool utsInitNs(struct nsjconf_t* nsjconf) {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace uts
|
Loading…
Reference in New Issue
Block a user