| * Linux32/linux64 allows for changing uname emulation. |
| * Copyright 2002 Andi Kleen, SuSE Labs. |
| * Licensed under GPL v2 or later, see file License for details. |
| #include <sys/personality.h> |
| int setarch_main(int ATTRIBUTE_UNUSED argc, char **argv) |
| /* Figure out what personality we are supposed to switch to ... |
| * we can be invoked as either: |
| * argv[0],argv[1] -> "setarch","personality" |
| * argv[0] -> "personality" |
| if (argv[0][5] == '6') /* linux64 */ |
| else if (argv[0][5] == '3') /* linux32 */ |
| else if (pers == -1 && argv[1] != NULL) { |
| /* make user actually gave us something to do */ |
| /* Try to set personality */ |
| if (personality(pers) >= 0) { |
| /* Try to execute the program */ |
| bb_perror_msg_and_die("%s", argv[0]); |