aboutsummaryrefslogtreecommitdiff
path: root/toys/other
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2018-11-19 16:42:06 -0600
committerRob Landley <rob@landley.net>2018-11-19 16:42:06 -0600
commit30ebb153fb129bae14c4d2d95e42db9b1a45416d (patch)
tree82a72dc4970d8256f563259d9f255c33043d85be /toys/other
parent3d4219014ae5f5a6553423994ff5ccd1d490a6fc (diff)
downloadtoybox-30ebb153fb129bae14c4d2d95e42db9b1a45416d.tar.gz
A few more GLOBALS() single character argument style conversions.
Diffstat (limited to 'toys/other')
-rw-r--r--toys/other/blockdev.c7
-rw-r--r--toys/other/lspci.c14
-rw-r--r--toys/other/nsenter.c14
3 files changed, 18 insertions, 17 deletions
diff --git a/toys/other/blockdev.c b/toys/other/blockdev.c
index 75f71ad3..a9bc3e78 100644
--- a/toys/other/blockdev.c
+++ b/toys/other/blockdev.c
@@ -34,8 +34,7 @@ config BLOCKDEV
#include <linux/fs.h>
GLOBALS(
- long bsz;
- long ra;
+ long setbsz, setra;
)
void blockdev_main(void)
@@ -56,10 +55,10 @@ void blockdev_main(void)
if (!flag) continue;
- if (flag & FLAG_setbsz) val = TT.bsz;
+ if (flag & FLAG_setbsz) val = TT.setbsz;
else val = !!(flag & FLAG_setro);
- if (flag & FLAG_setra) val = TT.ra;
+ if (flag & FLAG_setra) val = TT.setra;
xioctl(fd, cmds[i], &val);
diff --git a/toys/other/lspci.c b/toys/other/lspci.c
index a0671791..c208484d 100644
--- a/toys/other/lspci.c
+++ b/toys/other/lspci.c
@@ -31,8 +31,8 @@ config LSPCI_TEXT
#include "toys.h"
GLOBALS(
- char *ids;
- long numeric;
+ char *i;
+ long n;
FILE *db;
)
@@ -74,7 +74,7 @@ static int do_lspci(struct dirtree *new)
// Lookup/display data from pci.ids?
if (CFG_LSPCI_TEXT && TT.db) {
- if (TT.numeric != 1) {
+ if (TT.n != 1) {
char *s;
fseek(TT.db, 0, SEEK_SET);
@@ -94,7 +94,7 @@ static int do_lspci(struct dirtree *new)
}
}
- if (TT.numeric > 1) {
+ if (TT.n > 1) {
printf((toys.optflags & FLAG_m)
? "%s, \"%s\" \"%s [%s]\" \"%s [%s]\""
: "%s Class %s: %s [%s] %s [%s]",
@@ -119,9 +119,9 @@ driver:
void lspci_main(void)
{
- if (CFG_LSPCI_TEXT && TT.numeric != 1) {
- if (!TT.ids) TT.ids = "/usr/share/misc/pci.ids";
- if (!(TT.db = fopen(TT.ids, "r"))) perror_msg("%s", TT.ids);
+ if (CFG_LSPCI_TEXT && TT.n != 1) {
+ if (!TT.i) TT.i = "/usr/share/misc/pci.ids";
+ if (!(TT.db = fopen(TT.i, "r"))) perror_msg("%s", TT.i);
}
dirtree_read("/sys/bus/pci/devices", do_lspci);
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;
}