12 #include <sys/resource.h>
19 #define PGD_BOUND (4 * 1024 * 1024)
20 #define STACKSIZE (8 * 1024 * 1024)
21 #define THREAD_NAME_LEN (256)
25 static void set_stklim(
void)
42 static __init void do_uml_initcalls(
void)
47 while (call < &__uml_initcall_end) {
53 static void last_ditch_exit(
int sig)
59 static void install_fatal_handler(
int sig)
64 sigemptyset(&
action.sa_mask);
74 action.sa_handler = last_ditch_exit;
76 printf(
"failed to install handler for signal %d - errno = %d\n",
82 #define UML_LIB_PATH ":" OS_LIB_PATH "/uml"
84 static void setup_env_path(
void)
86 char *new_path =
NULL;
87 char *old_path =
NULL;
90 old_path = getenv(
"PATH");
95 if (!old_path || (path_len =
strlen(old_path)) == 0) {
97 perror(
"couldn't putenv");
103 new_path =
malloc(path_len);
105 perror(
"couldn't malloc to set a new PATH");
109 if (putenv(new_path)) {
110 perror(
"couldn't putenv to set a new PATH");
126 new_argv =
malloc((argc + 1) *
sizeof(
char *));
127 if (new_argv ==
NULL) {
128 perror(
"Mallocing argv");
131 for (i = 0; i <
argc; i++) {
132 new_argv[
i] = strdup(argv[i]);
133 if (new_argv[i] ==
NULL) {
134 perror(
"Mallocing an arg");
144 install_fatal_handler(
SIGINT);
145 install_fatal_handler(
SIGTERM);
147 #ifdef CONFIG_ARCH_REUSE_HOST_VSYSCALL_AREA
174 printf(
"deactivate_all_fds failed, errno = %d\n", -err);
186 execvp(new_argv[0], new_argv);
187 perror(
"Failed to exec kernel");
202 else if (size <= UM_KERN_PAGE_SIZE)
233 unsigned long addr = (
unsigned long) ptr;