diff options
author | landley <landley@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2006-06-30 22:20:43 +0000 |
---|---|---|
committer | landley <landley@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2006-06-30 22:20:43 +0000 |
commit | 5bd3b1110220190ec1dbbbb9702a8bec52a59705 (patch) | |
tree | bf31bbda19a078002c20fc70776ebe749f54683e | |
parent | d4f5f3d2dd3fb32c286325d22ca36ea060f0183f (diff) | |
download | busybox-w32-5bd3b1110220190ec1dbbbb9702a8bec52a59705.tar.gz busybox-w32-5bd3b1110220190ec1dbbbb9702a8bec52a59705.tar.bz2 busybox-w32-5bd3b1110220190ec1dbbbb9702a8bec52a59705.zip |
Revert taskset for 1.2.0. It emits a warning, breaks building under RH9,
and nobody seemed interested in fixing it despite repeated complaints.
I'll worry about it in the 1.3 timeframe...
git-svn-id: svn://busybox.net/trunk/busybox@15563 69ca8d6d-28ef-0310-b511-8ec308f3f277
-rw-r--r-- | include/applets.h | 1 | ||||
-rw-r--r-- | include/usage.h | 17 | ||||
-rw-r--r-- | miscutils/Config.in | 6 | ||||
-rw-r--r-- | miscutils/Makefile.in | 1 | ||||
-rw-r--r-- | miscutils/taskset.c | 67 | ||||
-rwxr-xr-x | testsuite/taskset.tests | 17 |
6 files changed, 6 insertions, 103 deletions
diff --git a/include/applets.h b/include/applets.h index 3acb3ba53..f07d005cb 100644 --- a/include/applets.h +++ b/include/applets.h | |||
@@ -262,7 +262,6 @@ USE_BB_SYSCTL(APPLET(sysctl, _BB_DIR_SBIN, _BB_SUID_NEVER)) | |||
262 | USE_SYSLOGD(APPLET(syslogd, _BB_DIR_SBIN, _BB_SUID_NEVER)) | 262 | USE_SYSLOGD(APPLET(syslogd, _BB_DIR_SBIN, _BB_SUID_NEVER)) |
263 | USE_TAIL(APPLET(tail, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) | 263 | USE_TAIL(APPLET(tail, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) |
264 | USE_TAR(APPLET(tar, _BB_DIR_BIN, _BB_SUID_NEVER)) | 264 | USE_TAR(APPLET(tar, _BB_DIR_BIN, _BB_SUID_NEVER)) |
265 | USE_TASKSET(APPLET(taskset, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) | ||
266 | USE_TEE(APPLET(tee, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) | 265 | USE_TEE(APPLET(tee, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) |
267 | USE_TELNET(APPLET(telnet, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) | 266 | USE_TELNET(APPLET(telnet, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) |
268 | USE_TELNETD(APPLET(telnetd, _BB_DIR_USR_SBIN, _BB_SUID_NEVER)) | 267 | USE_TELNETD(APPLET(telnetd, _BB_DIR_USR_SBIN, _BB_SUID_NEVER)) |
diff --git a/include/usage.h b/include/usage.h index 9d890930f..3e957092a 100644 --- a/include/usage.h +++ b/include/usage.h | |||
@@ -2967,23 +2967,6 @@ USE_FEATURE_START_STOP_DAEMON_FANCY( \ | |||
2967 | "$ zcat /tmp/tarball.tar.gz | tar -xf -\n" \ | 2967 | "$ zcat /tmp/tarball.tar.gz | tar -xf -\n" \ |
2968 | "$ tar -cf /tmp/tarball.tar /usr/local\n" | 2968 | "$ tar -cf /tmp/tarball.tar /usr/local\n" |
2969 | 2969 | ||
2970 | #define taskset_trivial_usage \ | ||
2971 | "[OPTIONS] [mask] [pid | command [arg]...]" | ||
2972 | #define taskset_full_usage \ | ||
2973 | "Set or get CPU affinity.\n\n" \ | ||
2974 | "Options:\n" \ | ||
2975 | "\t-p\toperate on an existing PID" | ||
2976 | #define taskset_example_usage \ | ||
2977 | "$ taskset 0x7 ./dgemm_test&\n" \ | ||
2978 | "$ taskset -p 0x1 $!\n" \ | ||
2979 | "pid 4790's current affinity mask: 7\n" \ | ||
2980 | "pid 4790's new affinity mask: 1\n" \ | ||
2981 | "$ taskset 0x7 /bin/sh -c './taskset -p 0x1 $$'\n" \ | ||
2982 | "pid 6671's current affinity mask: 1\n" \ | ||
2983 | "pid 6671's new affinity mask: 1\n" \ | ||
2984 | "$ taskset -p 1\n" | ||
2985 | "pid 1's current affinity mask: 3\n" | ||
2986 | |||
2987 | #define tee_trivial_usage \ | 2970 | #define tee_trivial_usage \ |
2988 | "[OPTION]... [FILE]..." | 2971 | "[OPTION]... [FILE]..." |
2989 | #define tee_full_usage \ | 2972 | #define tee_full_usage \ |
diff --git a/miscutils/Config.in b/miscutils/Config.in index 75a48c879..2d60fb65e 100644 --- a/miscutils/Config.in +++ b/miscutils/Config.in | |||
@@ -311,6 +311,12 @@ config CONFIG_TASKSET | |||
311 | help | 311 | help |
312 | Retrieve or set a processes's CPU affinity | 312 | Retrieve or set a processes's CPU affinity |
313 | 313 | ||
314 | config CONFIG_TASKSET | ||
315 | bool "taskset" | ||
316 | default n | ||
317 | help | ||
318 | Retrieve or set a processes's CPU affinity (on linux) | ||
319 | |||
314 | config CONFIG_TIME | 320 | config CONFIG_TIME |
315 | bool "time" | 321 | bool "time" |
316 | default n | 322 | default n |
diff --git a/miscutils/Makefile.in b/miscutils/Makefile.in index d60d687b0..a0b6b7233 100644 --- a/miscutils/Makefile.in +++ b/miscutils/Makefile.in | |||
@@ -28,7 +28,6 @@ MISCUTILS-$(CONFIG_RUNLEVEL) += runlevel.o | |||
28 | MISCUTILS-$(CONFIG_RX) += rx.o | 28 | MISCUTILS-$(CONFIG_RX) += rx.o |
29 | MISCUTILS-$(CONFIG_SETSID) += setsid.o | 29 | MISCUTILS-$(CONFIG_SETSID) += setsid.o |
30 | MISCUTILS-$(CONFIG_STRINGS) += strings.o | 30 | MISCUTILS-$(CONFIG_STRINGS) += strings.o |
31 | MISCUTILS-$(CONFIG_TASKSET) += taskset.o | ||
32 | MISCUTILS-$(CONFIG_TIME) += time.o | 31 | MISCUTILS-$(CONFIG_TIME) += time.o |
33 | MISCUTILS-$(CONFIG_WATCHDOG) += watchdog.o | 32 | MISCUTILS-$(CONFIG_WATCHDOG) += watchdog.o |
34 | 33 | ||
diff --git a/miscutils/taskset.c b/miscutils/taskset.c deleted file mode 100644 index a72f3ff53..000000000 --- a/miscutils/taskset.c +++ /dev/null | |||
@@ -1,67 +0,0 @@ | |||
1 | /* vi: set sw=4 ts=4: */ | ||
2 | /* | ||
3 | * taskset - retrieve or set a processes's CPU affinity | ||
4 | * Copyright (c) 2006 Bernhard Fischer | ||
5 | * | ||
6 | * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. | ||
7 | */ | ||
8 | |||
9 | #include "busybox.h" | ||
10 | #include <sched.h> | ||
11 | #include <unistd.h> | ||
12 | #include <getopt.h> /* optind */ | ||
13 | |||
14 | int taskset_main(int argc, char** argv) | ||
15 | { | ||
16 | cpu_set_t mask, new_mask; | ||
17 | pid_t pid = 0; | ||
18 | unsigned long ul; | ||
19 | const char *state = "current\0new"; | ||
20 | char *p_opt = NULL, *aff = NULL; | ||
21 | |||
22 | ul = bb_getopt_ulflags(argc, argv, "+p:", &p_opt); | ||
23 | #define TASKSET_OPT_p (1) | ||
24 | |||
25 | if (ul & TASKSET_OPT_p) { | ||
26 | if (argc == optind+1) { /* -p <aff> <pid> */ | ||
27 | aff = p_opt; | ||
28 | p_opt = argv[optind]; | ||
29 | } | ||
30 | argv += optind; /* me -p <arg> */ | ||
31 | pid = bb_xgetularg10_bnd(p_opt, 1, ULONG_MAX); /* -p <pid> */ | ||
32 | } else | ||
33 | aff = *++argv; /* <aff> <cmd...> */ | ||
34 | if (aff) { | ||
35 | /* to_cpuset(bb_xgetularg_bnd(aff, 16, 1, ULONG_MAX), &new_mask); */ | ||
36 | unsigned i = 0; | ||
37 | unsigned long l = bb_xgetularg_bnd(aff, 16, 1, ULONG_MAX); | ||
38 | |||
39 | CPU_ZERO(&new_mask); | ||
40 | while (i < CPU_SETSIZE && l >= (1<<i)) { | ||
41 | if ((1<<i) & l) | ||
42 | CPU_SET(i, &new_mask); | ||
43 | ++i; | ||
44 | } | ||
45 | } | ||
46 | |||
47 | if (ul & TASKSET_OPT_p) { | ||
48 | print_aff: | ||
49 | if (sched_getaffinity(pid, sizeof (mask), &mask) < 0) | ||
50 | bb_perror_msg_and_die("Failed to %cet pid %d's affinity", 'g', pid); | ||
51 | bb_printf("pid %d's %s affinity mask: %x\n", /* %x .. perhaps _FANCY */ | ||
52 | pid, state, mask); | ||
53 | if (!*argv) /* no new affinity given or we did print already, done. */ | ||
54 | return EXIT_SUCCESS; | ||
55 | } | ||
56 | |||
57 | if (sched_setaffinity(pid, sizeof (new_mask), &new_mask)) | ||
58 | bb_perror_msg_and_die("Failed to %cet pid %d's affinity", 's', pid); | ||
59 | if (ul & TASKSET_OPT_p) { | ||
60 | state += 8; | ||
61 | ++argv; | ||
62 | goto print_aff; | ||
63 | } | ||
64 | ++argv; | ||
65 | execvp(*argv, argv); | ||
66 | bb_perror_msg_and_die("%s", *argv); | ||
67 | } | ||
diff --git a/testsuite/taskset.tests b/testsuite/taskset.tests deleted file mode 100755 index 6001c3e32..000000000 --- a/testsuite/taskset.tests +++ /dev/null | |||
@@ -1,17 +0,0 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | # Copyright 2006 Bernhard Fischer | ||
4 | # Licensed under GPL v2 or later, see file LICENSE for details. | ||
5 | |||
6 | . testing.sh | ||
7 | a="taskset" | ||
8 | |||
9 | # testing "test name" "opts" "expected result" "file inp" "stdin" | ||
10 | testing "taskset (get from pid 1)" "$a -p1 >/dev/null;echo \$?" "0\n" "" "" | ||
11 | testing "taskset (invalid pid)" "$a -p0 >/dev/null 2>&1;echo \$?" "1\n" "" "" | ||
12 | testing "taskset (set_aff, needs CAP_SYS_NICE)" \ | ||
13 | "$a 0x1 $SHELL -c $a\ -p\ \$$\|grep\ \"current\ affinity\ mask:\ 1\" >/dev/null;echo \$?" \ | ||
14 | "0\n" "" "" | ||
15 | |||
16 | unset a | ||
17 | exit $FAILCOUNT | ||