summaryrefslogtreecommitdiff
path: root/startup
diff options
context:
space:
mode:
authorJustus Winter <justus@gnupg.org>2017-03-12 12:35:39 +0100
committerJustus Winter <justus@gnupg.org>2017-03-12 17:41:04 +0100
commitef729f8642cc96ddfd3f5b5db4d6aac057b1d397 (patch)
tree8e7d436fd81af6a962a9e8ea6750b0c12204cf6e /startup
parent34a94ce86b1bada9c0768f631540735d44f41100 (diff)
startup: Simplify reference handling.
* startup/startup.c (launch_core_servers): Instead of copying a send right and then deallocating it, move it. (init_stdarrays): Likewise.
Diffstat (limited to 'startup')
-rw-r--r--startup/startup.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/startup/startup.c b/startup/startup.c
index 913742c1..4a0304ea 100644
--- a/startup/startup.c
+++ b/startup/startup.c
@@ -755,9 +755,7 @@ launch_core_servers (void)
fprintf (stderr, "Installed on /servers/startup\n");
err = startup_authinit_reply (authreply, authreplytype, 0, authproc,
- MACH_MSG_TYPE_COPY_SEND);
- assert_perror (err);
- err = mach_port_deallocate (mach_task_self (), authproc);
+ MACH_MSG_TYPE_MOVE_SEND);
assert_perror (err);
if (verbose)
@@ -818,8 +816,7 @@ launch_core_servers (void)
fprintf (stderr, "Message port registered\n");
/* Give the bootstrap FS its proc and auth ports. */
- err = fsys_init (bootport, fsproc, MACH_MSG_TYPE_COPY_SEND, authserver);
- mach_port_deallocate (mach_task_self (), fsproc);
+ err = fsys_init (bootport, fsproc, MACH_MSG_TYPE_MOVE_SEND, authserver);
if (err)
error (0, err, "fsys_init"); /* Not necessarily fatal. */
@@ -836,7 +833,6 @@ init_stdarrays ()
mach_port_t ref;
mach_port_t *std_port_array;
int *std_int_array;
- int i;
std_port_array = alloca (sizeof (mach_port_t) * INIT_PORT_MAX);
std_int_array = alloca (sizeof (int) * INIT_INT_MAX);
@@ -870,10 +866,8 @@ init_stdarrays ()
std_int_array[INIT_UMASK] = CMASK;
__USEPORT (PROC, proc_setexecdata (port, std_port_array,
- MACH_MSG_TYPE_COPY_SEND, INIT_PORT_MAX,
+ MACH_MSG_TYPE_MOVE_SEND, INIT_PORT_MAX,
std_int_array, INIT_INT_MAX));
- for (i = 0; i < INIT_PORT_MAX; i++)
- mach_port_deallocate (mach_task_self (), std_port_array[i]);
}
/* Frobnicate the kernel task and the proc server's idea of it (PID 2),