1 /* vi: set sw=4 ts=4: */
3 * Linux32/linux64 allows for changing uname emulation.
5 * Copyright 2002 Andi Kleen, SuSE Labs.
7 * Licensed under GPL v2 or later, see file License for details.
10 #include <sys/personality.h>
14 int setarch_main(int argc
, char **argv
) MAIN_EXTERNALLY_VISIBLE
;
15 int setarch_main(int ATTRIBUTE_UNUSED argc
, char **argv
)
19 /* Figure out what personality we are supposed to switch to ...
20 * we can be invoked as either:
21 * argv[0],argv[1] -> "setarch","personality"
22 * argv[0] -> "personality"
25 if (argv
[0][5] == '6') /* linux64 */
27 else if (argv
[0][5] == '3') /* linux32 */
29 else if (pers
== -1 && argv
[1] != NULL
) {
35 /* make user actually gave us something to do */
40 /* Try to set personality */
41 if (personality(pers
) >= 0) {
43 /* Try to execute the program */
44 BB_EXECVP(argv
[0], argv
);
47 bb_simple_perror_msg_and_die(argv
[0]);