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)
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
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
#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 {
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(); }
+++ /dev/null
-/*
-
- nsjail - CLONE_NEWUTS routines
- -----------------------------------------
-
- Copyright 2014 Google Inc. All Rights Reserved.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-*/
-
-#include "uts.h"
-
-#include <string.h>
-#include <unistd.h>
-
-#include "log.h"
-
-bool utsInitNs(struct nsjconf_t* nsjconf) {
- if (nsjconf->clone_newuts == false) {
- return true;
- }
-
- LOG_D("Setting hostname to '%s'", nsjconf->hostname);
- if (sethostname(nsjconf->hostname, strlen(nsjconf->hostname)) == -1) {
- PLOG_E("sethostname('%s')", nsjconf->hostname);
- return false;
- }
- return true;
-}
--- /dev/null
+/*
+
+ nsjail - CLONE_NEWUTS routines
+ -----------------------------------------
+
+ Copyright 2014 Google Inc. All Rights Reserved.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+*/
+
+#include "uts.h"
+
+#include <string.h>
+#include <unistd.h>
+
+extern "C" {
+#include "log.h"
+}
+
+namespace uts {
+
+bool initNs(struct nsjconf_t* nsjconf) {
+ if (nsjconf->clone_newuts == false) {
+ return true;
+ }
+
+ LOG_D("Setting hostname to '%s'", nsjconf->hostname);
+ if (sethostname(nsjconf->hostname, strlen(nsjconf->hostname)) == -1) {
+ PLOG_E("sethostname('%s')", nsjconf->hostname);
+ return false;
+ }
+ return true;
+}
+
+} // namespace uts
#include "nsjail.h"
-bool utsInitNs(struct nsjconf_t* nsjconf);
+namespace uts {
+
+bool initNs(struct nsjconf_t* nsjconf);
+
+} // namespace uts
#endif /* NS_UTS_H */