summaryrefslogtreecommitdiff
path: root/init
diff options
context:
space:
mode:
authorMichael I. Bushnell <mib@gnu.org>1994-08-17 18:15:13 +0000
committerMichael I. Bushnell <mib@gnu.org>1994-08-17 18:15:13 +0000
commit27ba3912c75934110d3cb786f2779265a2905723 (patch)
tree0c617af6fb09476c02624dfb4c54149f0fb6b7ac /init
parentaf1647d6db4fde50056665f85c53c4f0efdf974c (diff)
Formerly init.c.~40~
Diffstat (limited to 'init')
-rw-r--r--init/init.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/init/init.c b/init/init.c
index 420c30a2..a3558734 100644
--- a/init/init.c
+++ b/init/init.c
@@ -481,6 +481,45 @@ launch_core_servers (void)
perror ("fsys_init");
}
+/* Set up the initial value of the standard exec data. */
+void
+init_stdarrays ()
+{
+ auth_t nullauth;
+ mach_port_t pt;
+ int pid = getpid ();
+ mach_port_t *std_port_array;
+ int *std_int_array;
+
+ std_port_array = alloca (sizeof (mach_port_t) * INIT_PORT_MAX);
+ std_int_array = alloca (sizeof (int) * INIT_INT_MAX);
+
+ bzero (std_port_array, sizeof (mach_port_t) * INIT_PORT_MAX);
+ bzero (std_int_array, sizeof (int) * INIT_INT_MAX);
+
+ __USEPORT (AUTH, auth_makeauth (port, 0, MACH_MSG_TYPE_COPY_SEND, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, &nullauth));
+
+ pt = getcwdir ();
+ io_reauthenticate (pt, pid);
+ auth_user_authenticate (nullauth, pt, pid, &std_port_array[INIT_PORT_CWDIR]);
+ mach_port_deallocate (mach_task_self (), pt);
+
+ pt = getcrdir ();
+ io_reauthenticate (pt, pid);
+ auth_user_authenticate (nullauth, pt, pid, &std_port_array[INIT_PORT_CRDIR]);
+ mach_port_deallocate (mach_task_self (), pt);
+
+ std_port_array[INIT_PORT_AUTH] = nullauth;
+
+ std_int_array[INIT_UMASK] = CMASK;
+
+ __USEPORT (PROC, proc_setexecdata (port, std_port_array,
+ MACH_MSG_TYPE_MOVE_SEND, INIT_PORT_MAX,
+ std_int_array, INIT_INT_MAX));
+}
+
+
/* Start the single-user environment. This can only be done
when the core servers have fully started. We know that
startup_essential_task is the last thing they do before being
@@ -499,6 +538,8 @@ launch_single_user ()
int fd;
volatile int run_dev=1; /* So you can set this from gdb. */
+ init_stdarrays ();
+
printf ("Hit t for term, else dev: ");
fflush (stdout);
run_dev = getchar () != 't';