Last change
on this file since 2794 was 2725, checked in by Bruno Cornec, 14 years ago |
- Update mindi-busybox to 1.18.3 to avoid problems with the tar command which is now failing on recent versions with busybox 1.7.3
|
File size:
1.1 KB
|
Rev | Line | |
---|
[821] | 1 | /* vi: set sw=4 ts=4: */
|
---|
| 2 | /*
|
---|
[2725] | 3 | * linux32/linux64 allows for changing uname emulation.
|
---|
[821] | 4 | *
|
---|
| 5 | * Copyright 2002 Andi Kleen, SuSE Labs.
|
---|
| 6 | *
|
---|
[2725] | 7 | * Licensed under GPLv2 or later, see file LICENSE in this source tree.
|
---|
[821] | 8 | */
|
---|
| 9 |
|
---|
| 10 | #include <sys/personality.h>
|
---|
| 11 |
|
---|
[1765] | 12 | #include "libbb.h"
|
---|
[821] | 13 |
|
---|
[2725] | 14 | int setarch_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
---|
| 15 | int setarch_main(int argc UNUSED_PARAM, char **argv)
|
---|
[821] | 16 | {
|
---|
[2725] | 17 | int pers;
|
---|
[821] | 18 |
|
---|
| 19 | /* Figure out what personality we are supposed to switch to ...
|
---|
| 20 | * we can be invoked as either:
|
---|
[2725] | 21 | * argv[0],argv[1] == "setarch","personality"
|
---|
| 22 | * argv[0] == "personality"
|
---|
[821] | 23 | */
|
---|
[2725] | 24 | if (ENABLE_SETARCH && applet_name[0] == 's'
|
---|
| 25 | && argv[1] && strncpy(argv[1], "linux", 5)
|
---|
| 26 | ) {
|
---|
| 27 | applet_name = argv[1];
|
---|
| 28 | argv++;
|
---|
| 29 | }
|
---|
| 30 | if (applet_name[5] == '6') /* linux64 */
|
---|
[821] | 31 | pers = PER_LINUX;
|
---|
[2725] | 32 | else if (applet_name[5] == '3') /* linux32 */
|
---|
[821] | 33 | pers = PER_LINUX32;
|
---|
[2725] | 34 | else
|
---|
| 35 | bb_show_usage();
|
---|
[821] | 36 |
|
---|
[2725] | 37 | argv++;
|
---|
[821] | 38 | if (argv[0] == NULL)
|
---|
| 39 | bb_show_usage();
|
---|
| 40 |
|
---|
| 41 | /* Try to set personality */
|
---|
| 42 | if (personality(pers) >= 0) {
|
---|
| 43 | /* Try to execute the program */
|
---|
[1765] | 44 | BB_EXECVP(argv[0], argv);
|
---|
[821] | 45 | }
|
---|
| 46 |
|
---|
[2725] | 47 | bb_simple_perror_msg_and_die(argv[0]);
|
---|
[821] | 48 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.