1 /* vi: set sw=4 ts=4: */
3 * Linux32/linux64 allows for changing uname emulation.
5 * Copyright 2002 Andi Kleen, SuSE Labs.
6 * This file is subject to the GNU General Public License v2
8 * Licensed under GPL v2 or later, see file License for details.
16 #include <sys/personality.h>
20 int setarch_main(int argc, char **argv)
24 /* Figure out what personality we are supposed to switch to ...
25 * we can be invoked as either:
26 * argv[0],argv[1] -> "setarch","personality"
27 * argv[0] -> "personality"
30 if (!strcmp(argv[0], "linux64"))
32 else if (!strcmp(argv[0], "linux32"))
34 else if (pers == -1 && argv[1] != NULL) {
40 /* make user actually gave us something to do */
45 /* Try to set personality */
46 if (personality(pers) < 0)
49 /* Try to execute the program */
50 execvp(argv[0], argv);
53 bb_perror_msg_and_die(argv[0]);