diff options
Diffstat (limited to 'reincarnation.c')
| -rw-r--r-- | reincarnation.c | 59 |
1 files changed, 10 insertions, 49 deletions
diff --git a/reincarnation.c b/reincarnation.c index 8f333cf..29b3505 100644 --- a/reincarnation.c +++ b/reincarnation.c @@ -70,7 +70,7 @@ int excl = 0; int timeout = DEFAULT_TIMEOUT * 1000; /* ms */ /* child stuff */ -mach_port_t ports[INIT_PORT_REINCARNATION + 1]; +mach_port_t ports[INIT_PORT_MAX]; mach_port_t fds[STDERR_FILENO + 1]; int ints[INIT_INT_MAX]; @@ -154,7 +154,7 @@ demuxer (mach_msg_header_t *inp, error_t prepare_child (void) { - for (int i = 0; i < INIT_PORT_REINCARNATION; i++) + for (int i = 0; i < INIT_PORT_MAX; i++) ports[i] = MACH_PORT_NULL; for (int i = 0; i < STDERR_FILENO + 1; i++) @@ -165,7 +165,6 @@ prepare_child (void) ports[INIT_PORT_CWDIR] = getcwdir (); ports[INIT_PORT_CRDIR] = getcrdir (); ports[INIT_PORT_AUTH] = getauth (); - ports[INIT_PORT_REINCARNATION] = reincarnation_port; fds[STDERR_FILENO] = getdport (STDERR_FILENO); return 0; @@ -183,22 +182,18 @@ main (int argc, char **argv) if (err) error (5, err, "mach_port_allocate"); - mach_msg_type_name_t acquired_type; - err = mach_port_extract_right (mach_task_self (), - reincarnation_port, - MACH_MSG_TYPE_MAKE_SEND, - &reincarnation_port, - &acquired_type); + err = mach_port_insert_right (mach_task_self (), + reincarnation_port, + reincarnation_port, + MACH_MSG_TYPE_MAKE_SEND); if (err) - error (3, err, "mach_port_extract_right"); + error (3, err, "mach_port_insert_right"); prepare_child (); - mach_port_t registered_ports[] = { reincarnation_port, }; - err = mach_ports_register (mach_task_self (), - ®istered_ports, 1); + err = reincarnation_set_port (mach_task_self (), reincarnation_port); if (err) - error (5, err, "mach_port_register"); + error (5, err, "reincarnation_set_port"); err = start_child (); if (err) @@ -259,7 +254,7 @@ start_child (void) fds, MACH_MSG_TYPE_COPY_SEND, STDERR_FILENO + 1, ports, MACH_MSG_TYPE_COPY_SEND, - INIT_PORT_REINCARNATION, + INIT_PORT_MAX, ints, INIT_INT_MAX, geteuid (), timeout, &active_control); @@ -336,38 +331,4 @@ S_checkpoint(mach_port_t server, stored_image_len = imageCnt; return 0; } - -/* Stubs for unused notification RPCs. */ - -kern_return_t -do_mach_notify_port_destroyed (mach_port_t notify, - mach_port_t rights) -{ - return EOPNOTSUPP; -} - -kern_return_t -do_mach_notify_send_once (mach_port_t notify) -{ - return EOPNOTSUPP; -} - -kern_return_t -do_mach_notify_no_senders (mach_port_t port, mach_port_mscount_t mscount) -{ - return EOPNOTSUPP; -} - -kern_return_t -do_mach_notify_port_deleted (mach_port_t notify, - mach_port_t name) -{ - return EOPNOTSUPP; -} -kern_return_t -do_mach_notify_msg_accepted (mach_port_t notify, - mach_port_t name) -{ - return EOPNOTSUPP; -} |
