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.
15 #include <sys/personality.h>
19 int setarch_main(int ATTRIBUTE_UNUSED argc, char **argv)
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"
29 if (argv[0][5] == '6') /* linux64 */
31 else if (argv[0][5] == '3') /* linux32 */
33 else if (pers == -1 && argv[1] != NULL) {
39 /* make user actually gave us something to do */
44 /* Try to set personality */
45 if (personality(pers) >= 0) {
47 /* Try to execute the program */
48 execvp(argv[0], argv);
51 bb_perror_msg_and_die("%s", argv[0]);