171 |
} |
} |
172 |
else |
else |
173 |
{ |
{ |
174 |
|
error_t err; |
175 |
printf ("%s: %sing Mach (flags %#x)...\n", |
printf ("%s: %sing Mach (flags %#x)...\n", |
176 |
program_invocation_short_name, BOOT (flags), flags); |
program_invocation_short_name, BOOT (flags), flags); |
177 |
fflush (stdout); |
fflush (stdout); |
178 |
sleep (5); |
sleep (5); |
179 |
while ((errno = host_reboot (host_priv, flags))) |
while ((err = host_reboot (host_priv, flags))) |
180 |
error (0, errno, "reboot"); |
error (0, err, "reboot"); |
181 |
for (;;); |
for (;;); |
182 |
} |
} |
183 |
} |
} |
358 |
while (1) |
while (1) |
359 |
{ |
{ |
360 |
file_t file; |
file_t file; |
361 |
|
error_t err; |
362 |
|
|
363 |
file = file_name_lookup (prog, O_EXEC, 0); |
file = file_name_lookup (prog, O_EXEC, 0); |
364 |
if (file == MACH_PORT_NULL) |
if (file == MACH_PORT_NULL) |
375 |
printf ("Pausing for %s\n", prog); |
printf ("Pausing for %s\n", prog); |
376 |
getchar (); |
getchar (); |
377 |
} |
} |
378 |
errno = file_exec (file, *task, 0, |
err = file_exec (file, *task, 0, |
379 |
(char *)prog, strlen (prog) + 1, /* Args. */ |
(char *)prog, strlen (prog) + 1, /* Args. */ |
380 |
startup_envz, startup_envz_len, |
startup_envz, startup_envz_len, |
381 |
default_dtable, MACH_MSG_TYPE_COPY_SEND, 3, |
default_dtable, MACH_MSG_TYPE_COPY_SEND, 3, |
382 |
ports, MACH_MSG_TYPE_COPY_SEND, INIT_PORT_MAX, |
ports, MACH_MSG_TYPE_COPY_SEND, INIT_PORT_MAX, |
383 |
default_ints, INIT_INT_MAX, |
default_ints, INIT_INT_MAX, |
384 |
NULL, 0, NULL, 0); |
NULL, 0, NULL, 0); |
385 |
if (!errno) |
if (!err) |
386 |
break; |
break; |
387 |
|
|
388 |
error (0, errno, "%s", prog); |
error (0, err, "%s", prog); |
389 |
} |
} |
390 |
|
|
391 |
printf ("File name for server %s (or nothing to reboot): ", server); |
printf ("File name for server %s (or nothing to reboot): ", server); |
428 |
if (getstring (buf, sizeof (buf)) && *buf) |
if (getstring (buf, sizeof (buf)) && *buf) |
429 |
filename = buf; |
filename = buf; |
430 |
file = file_name_lookup (filename, O_EXEC, 0); |
file = file_name_lookup (filename, O_EXEC, 0); |
431 |
if (!file) |
if (file == MACH_PORT_NULL) |
432 |
error (0, errno, "%s", filename); |
error (0, errno, "%s", filename); |
433 |
} |
} |
434 |
while (!file); |
while (file == MACH_PORT_NULL); |
435 |
#else |
#else |
436 |
file = file_name_lookup (filename, O_EXEC, 0); |
file = file_name_lookup (filename, O_EXEC, 0); |
437 |
if (!file) |
if (file == MACH_PORT_NULL) |
438 |
{ |
{ |
439 |
error (0, errno, "%s", filename); |
error (0, errno, "%s", filename); |
440 |
return 0; |
return 0; |
694 |
mach_port_deallocate (mach_task_self (), old); |
mach_port_deallocate (mach_task_self (), old); |
695 |
|
|
696 |
/* Give the bootstrap FS its proc and auth ports. */ |
/* Give the bootstrap FS its proc and auth ports. */ |
697 |
errno = fsys_init (bootport, fsproc, MACH_MSG_TYPE_COPY_SEND, authserver); |
err = fsys_init (bootport, fsproc, MACH_MSG_TYPE_COPY_SEND, authserver); |
698 |
mach_port_deallocate (mach_task_self (), fsproc); |
mach_port_deallocate (mach_task_self (), fsproc); |
699 |
if (errno) |
if (err) |
700 |
error (0, errno, "fsys_init"); /* Not necessarily fatal. */ |
error (0, err, "fsys_init"); /* Not necessarily fatal. */ |
701 |
} |
} |
702 |
|
|
703 |
/* Set up the initial value of the standard exec data. */ |
/* Set up the initial value of the standard exec data. */ |
1031 |
assert_perror (err); |
assert_perror (err); |
1032 |
|
|
1033 |
file = file_name_lookup (args, O_EXEC, 0); |
file = file_name_lookup (args, O_EXEC, 0); |
1034 |
if (!file) |
if (file == MACH_PORT_NULL) |
1035 |
{ |
{ |
1036 |
error (0, errno, "%s", args); |
error (0, errno, "%s", args); |
1037 |
free (args); |
free (args); |