diff options
| author | Denys Vlasenko <vda.linux@googlemail.com> | 2016-11-13 22:56:04 +0100 |
|---|---|---|
| committer | Denys Vlasenko <vda.linux@googlemail.com> | 2016-11-13 22:56:04 +0100 |
| commit | c314ca9016530aae61b4e50242ba6a6e09b2914a (patch) | |
| tree | e61d5fa23f075a389756512b23c0ff22a3bf0b97 /util-linux | |
| parent | 67fd2f2858ac63d46f42ef3c096b007ac7362849 (diff) | |
| download | busybox-w32-c314ca9016530aae61b4e50242ba6a6e09b2914a.tar.gz busybox-w32-c314ca9016530aae61b4e50242ba6a6e09b2914a.tar.bz2 busybox-w32-c314ca9016530aae61b4e50242ba6a6e09b2914a.zip | |
Make setarch/linux32/linux64 independently selectable
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'util-linux')
| -rw-r--r-- | util-linux/setarch.c | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/util-linux/setarch.c b/util-linux/setarch.c index 2e989ec2a..ec473e9cb 100644 --- a/util-linux/setarch.c +++ b/util-linux/setarch.c | |||
| @@ -15,12 +15,28 @@ | |||
| 15 | //config: specified program (usually a shell). It only makes sense to have | 15 | //config: specified program (usually a shell). It only makes sense to have |
| 16 | //config: this util on a system that supports both 64bit and 32bit userland | 16 | //config: this util on a system that supports both 64bit and 32bit userland |
| 17 | //config: (like amd64/x86, ppc64/ppc, sparc64/sparc, etc...). | 17 | //config: (like amd64/x86, ppc64/ppc, sparc64/sparc, etc...). |
| 18 | //config: | ||
| 19 | //config:config LINUX32 | ||
| 20 | //config: bool "linux32" | ||
| 21 | //config: default y | ||
| 22 | //config: select PLATFORM_LINUX | ||
| 23 | //config: help | ||
| 24 | //config: Alias to "setarch linux32". | ||
| 25 | //config: | ||
| 26 | //config:config LINUX64 | ||
| 27 | //config: bool "linux64" | ||
| 28 | //config: default y | ||
| 29 | //config: select PLATFORM_LINUX | ||
| 30 | //config: help | ||
| 31 | //config: Alias to "setarch linux64". | ||
| 18 | 32 | ||
| 19 | //applet:IF_SETARCH(APPLET(setarch, BB_DIR_BIN, BB_SUID_DROP)) | 33 | //applet:IF_SETARCH(APPLET(setarch, BB_DIR_BIN, BB_SUID_DROP)) |
| 20 | //applet:IF_SETARCH(APPLET_ODDNAME(linux32, setarch, BB_DIR_BIN, BB_SUID_DROP, linux32)) | 34 | //applet:IF_LINUX32(APPLET_ODDNAME(linux32, setarch, BB_DIR_BIN, BB_SUID_DROP, linux32)) |
| 21 | //applet:IF_SETARCH(APPLET_ODDNAME(linux64, setarch, BB_DIR_BIN, BB_SUID_DROP, linux64)) | 35 | //applet:IF_LINUX64(APPLET_ODDNAME(linux64, setarch, BB_DIR_BIN, BB_SUID_DROP, linux64)) |
| 22 | 36 | ||
| 23 | //kbuild:lib-$(CONFIG_SETARCH) += setarch.o | 37 | //kbuild:lib-$(CONFIG_SETARCH) += setarch.o |
| 38 | //kbuild:lib-$(CONFIG_LINUX32) += setarch.o | ||
| 39 | //kbuild:lib-$(CONFIG_LINUX64) += setarch.o | ||
| 24 | 40 | ||
| 25 | //usage:#define setarch_trivial_usage | 41 | //usage:#define setarch_trivial_usage |
| 26 | //usage: "PERSONALITY [-R] PROG ARGS" | 42 | //usage: "PERSONALITY [-R] PROG ARGS" |
| @@ -58,12 +74,15 @@ int setarch_main(int argc UNUSED_PARAM, char **argv) | |||
| 58 | if (ENABLE_SETARCH && applet_name[0] == 's' | 74 | if (ENABLE_SETARCH && applet_name[0] == 's' |
| 59 | && argv[1] && is_prefixed_with(argv[1], "linux") | 75 | && argv[1] && is_prefixed_with(argv[1], "linux") |
| 60 | ) { | 76 | ) { |
| 61 | applet_name = argv[1]; | ||
| 62 | argv++; | 77 | argv++; |
| 78 | applet_name = argv[0]; | ||
| 63 | } | 79 | } |
| 64 | if (applet_name[5] == '6') /* linux64 */ | 80 | if ((!ENABLE_SETARCH && !ENABLE_LINUX32) || applet_name[5] == '6') |
| 81 | /* linux64 */ | ||
| 65 | pers = PER_LINUX; | 82 | pers = PER_LINUX; |
| 66 | else if (applet_name[5] == '3') /* linux32 */ | 83 | else |
| 84 | if ((!ENABLE_SETARCH && !ENABLE_LINUX64) || applet_name[5] == '3') | ||
| 85 | /* linux32 */ | ||
| 67 | pers = PER_LINUX32; | 86 | pers = PER_LINUX32; |
| 68 | else | 87 | else |
| 69 | bb_show_usage(); | 88 | bb_show_usage(); |
