diff options
author | Rob Landley <rob@landley.net> | 2018-11-19 16:42:06 -0600 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2018-11-19 16:42:06 -0600 |
commit | 30ebb153fb129bae14c4d2d95e42db9b1a45416d (patch) | |
tree | 82a72dc4970d8256f563259d9f255c33043d85be /toys/other/nsenter.c | |
parent | 3d4219014ae5f5a6553423994ff5ccd1d490a6fc (diff) | |
download | toybox-30ebb153fb129bae14c4d2d95e42db9b1a45416d.tar.gz |
A few more GLOBALS() single character argument style conversions.
Diffstat (limited to 'toys/other/nsenter.c')
-rw-r--r-- | toys/other/nsenter.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/toys/other/nsenter.c b/toys/other/nsenter.c index 5424df7e..007e0556 100644 --- a/toys/other/nsenter.c +++ b/toys/other/nsenter.c @@ -64,13 +64,15 @@ config NSENTER #define FOR_nsenter #include "toys.h" +#include <sys/syscall.h> #include <linux/sched.h> -int unshare(int flags); -int setns(int fd, int nstype); + +#define unshare(flags) syscall(SYS_unshare, flags) +#define setns(fd, nstype) syscall(SYS_setns, fd, nstype) GLOBALS( - char *nsnames[6]; - long targetpid; + char *Uupnmi[6]; + long t; ) // Code that must run in unshare's flag context @@ -144,12 +146,12 @@ void unshare_main(void) char *nsnames = "user\0uts\0pid\0net\0mnt\0ipc"; for (i = 0; i<ARRAY_LEN(flags); i++) { - char *filename = TT.nsnames[i]; + char *filename = TT.Uupnmi[i]; if (toys.optflags & (1<<i)) { if (!filename || !*filename) { if (!(toys.optflags & FLAG_t)) error_exit("need -t or =filename"); - sprintf(toybuf, "/proc/%ld/ns/%s", TT.targetpid, nsnames); + sprintf(toybuf, "/proc/%ld/ns/%s", TT.t, nsnames); filename = toybuf; } |