Last change
on this file since 1582 was 821, checked in by Bruno Cornec, 18 years ago |
Addition of busybox 1.2.1 as a mindi-busybox new package
This should avoid delivering binary files in mindi not built there (Fedora and Debian are quite serious about that)
|
File size:
1.1 KB
|
Rev | Line | |
---|
[821] | 1 | /* vi: set sw=4 ts=4: */
|
---|
| 2 | /*
|
---|
| 3 | * Linux32/linux64 allows for changing uname emulation.
|
---|
| 4 | *
|
---|
| 5 | * Copyright 2002 Andi Kleen, SuSE Labs.
|
---|
| 6 | *
|
---|
| 7 | * Licensed under GPL v2 or later, see file License for details.
|
---|
| 8 | */
|
---|
| 9 |
|
---|
| 10 | #include <stdlib.h>
|
---|
| 11 | #include <unistd.h>
|
---|
| 12 | #include <string.h>
|
---|
| 13 | #include <errno.h>
|
---|
| 14 | #include <stdio.h>
|
---|
| 15 | #include <sys/personality.h>
|
---|
| 16 |
|
---|
| 17 | #include "busybox.h"
|
---|
| 18 |
|
---|
| 19 | int setarch_main(int ATTRIBUTE_UNUSED argc, char **argv)
|
---|
| 20 | {
|
---|
| 21 | int pers = -1;
|
---|
| 22 |
|
---|
| 23 | /* Figure out what personality we are supposed to switch to ...
|
---|
| 24 | * we can be invoked as either:
|
---|
| 25 | * argv[0],argv[1] -> "setarch","personality"
|
---|
| 26 | * argv[0] -> "personality"
|
---|
| 27 | */
|
---|
| 28 | retry:
|
---|
| 29 | if (argv[0][5] == '6') /* linux64 */
|
---|
| 30 | pers = PER_LINUX;
|
---|
| 31 | else if (argv[0][5] == '3') /* linux32 */
|
---|
| 32 | pers = PER_LINUX32;
|
---|
| 33 | else if (pers == -1 && argv[1] != NULL) {
|
---|
| 34 | pers = PER_LINUX32;
|
---|
| 35 | ++argv;
|
---|
| 36 | goto retry;
|
---|
| 37 | }
|
---|
| 38 |
|
---|
| 39 | /* make user actually gave us something to do */
|
---|
| 40 | ++argv;
|
---|
| 41 | if (argv[0] == NULL)
|
---|
| 42 | bb_show_usage();
|
---|
| 43 |
|
---|
| 44 | /* Try to set personality */
|
---|
| 45 | if (personality(pers) >= 0) {
|
---|
| 46 |
|
---|
| 47 | /* Try to execute the program */
|
---|
| 48 | execvp(argv[0], argv);
|
---|
| 49 | }
|
---|
| 50 |
|
---|
| 51 | bb_perror_msg_and_die("%s", argv[0]);
|
---|
| 52 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.