From 96c01087a657dfc1c877b63e9e6b0f45c37b9c78 Mon Sep 17 00:00:00 2001 From: Thomas Schwinge Date: Sun, 3 Dec 2006 20:16:16 +0000 Subject: 2006-12-03 Thomas Schwinge [patch #5017 --- ``Remove obsolete IPC interfaces.''] * DEVELOPMENT: Document the removal. * configfrag.ac (MACH_IPC_COMPAT): Don't define. 2006-12-03 Leonardo Lopes Pereira [patch #5017 --- ``Remove obsolete IPC interfaces.''] * kern/act.c [MIGRATING_THREADS]: Don't include . * kern/act.h: Likewise. * i386/include/mach/i386/machine_types.defs: Adapt all users of MACH_IPC_COMPAT as if it were always defined to `0'. * include/mach/mach.defs: Likewise. * include/mach/mach_param.h: Likewise. * include/mach/mach_traps.h: Likewise. * include/mach/message.h: Likewise. * include/mach/mig_errors.h: Likewise. * include/mach/notify.h: Likewise. * include/mach/port.h: Likewise. * include/mach/std_types.defs: Likewise. * include/mach/syscall_sw.h: Likewise. * include/mach/task_special_ports.h: Likewise. * include/mach/thread_special_ports.h: Likewise. * ipc/ipc_kmsg.c: Likewise. * ipc/ipc_kmsg.h: Likewise. * ipc/ipc_marequest.c: Likewise. * ipc/ipc_notify.c: Likewise. * ipc/ipc_notify.h: Likewise. * ipc/ipc_object.c: Likewise. * ipc/ipc_object.h: Likewise. * ipc/ipc_port.c: Likewise. * ipc/ipc_port.h: Likewise. * ipc/ipc_right.c: Likewise. * ipc/ipc_right.h: Likewise. * ipc/ipc_space.c: Likewise. * ipc/ipc_space.h: Likewise. * ipc/mach_debug.c: Likewise. * ipc/mach_msg.c: Likewise * ipc/mach_msg.h: Likewise. * ipc/mach_port.c: Likewise. * kern/act.c: Likewise. * kern/act.h: Likewise. * kern/ipc_host.c: Likewise. * kern/ipc_tt.c: Likewise. * kern/syscall_sw.c: Likewise. * kern/thread.h: Likewise. --- kern/act.c | 13 --- kern/act.h | 5 - kern/ipc_host.c | 26 ----- kern/ipc_tt.c | 277 ------------------------------------------------------ kern/syscall_sw.c | 19 ---- kern/thread.h | 3 - 6 files changed, 343 deletions(-) (limited to 'kern') diff --git a/kern/act.c b/kern/act.c index 18dd7ba..ffbce28 100644 --- a/kern/act.c +++ b/kern/act.c @@ -28,7 +28,6 @@ #include -#include /* XXX */ #include #include #include /* XXX INCALL_... */ @@ -933,12 +932,6 @@ act_get_special_port(Act *act, int which, ipc_port_t *portp) return KERN_INVALID_ARGUMENT; switch (which) { -#if MACH_IPC_COMPAT - case THREAD_REPLY_PORT: - whichp = &act->reply_port; - break; -#endif /* MACH_IPC_COMPAT */ - case THREAD_KERNEL_PORT: whichp = &act->self_port; break; @@ -993,12 +986,6 @@ act_set_special_port(Act *act, int which, ipc_port_t port) return KERN_INVALID_ARGUMENT; switch (which) { -#if MACH_IPC_COMPAT - case THREAD_REPLY_PORT: - whichp = &act->reply_port; - break; -#endif /* MACH_IPC_COMPAT */ - case THREAD_KERNEL_PORT: whichp = &act->self_port; break; diff --git a/kern/act.h b/kern/act.h index 236e6b3..e064724 100644 --- a/kern/act.h +++ b/kern/act.h @@ -34,7 +34,6 @@ #define __dead #endif -#include #include #include #include @@ -141,10 +140,6 @@ struct Act { struct ipc_port *self_port; /* a send right */ struct ipc_port *exception_port; /* a send right */ struct ipc_port *syscall_port; /* a send right */ -#if MACH_IPC_COMPAT - struct ipc_port *reply_port; /* a send right */ - struct task *reply_task; -#endif MACH_IPC_COMPAT }; typedef struct Act Act; typedef struct Act *act_t; diff --git a/kern/ipc_host.c b/kern/ipc_host.c index 2c7a3db..ea8f03a 100644 --- a/kern/ipc_host.c +++ b/kern/ipc_host.c @@ -103,32 +103,6 @@ mach_host_self(void) return ipc_port_copyout_send(sright, current_space()); } -#if MACH_IPC_COMPAT - -/* - * Routine: host_self [mach trap] - * Purpose: - * Give the caller send rights for his own host port. - * If new, the send right is marked with IE_BITS_COMPAT. - * Conditions: - * Nothing locked. - * Returns: - * MACH_PORT_NULL if there are any resource failures - * or other errors. - */ - -port_name_t -host_self(void) -{ - ipc_port_t sright; - - sright = ipc_port_make_send(realhost.host_self); - return (port_name_t) - ipc_port_copyout_send_compat(sright, current_space()); -} - -#endif /* MACH_IPC_COMPAT */ - /* * ipc_processor_init: * diff --git a/kern/ipc_tt.c b/kern/ipc_tt.c index ca1b6d5..fb89fac 100644 --- a/kern/ipc_tt.c +++ b/kern/ipc_tt.c @@ -231,39 +231,6 @@ ipc_thread_init(thread) thread->ith_mig_reply = MACH_PORT_NULL; thread->ith_rpc_reply = IP_NULL; - -#if MACH_IPC_COMPAT - { - ipc_space_t space = thread->task->itk_space; - ipc_port_t port; - mach_port_t name; - kern_return_t kr; - - kr = ipc_port_alloc_compat(space, &name, &port); - if (kr != KERN_SUCCESS) - panic("ipc_thread_init"); - /* port is locked and active */ - - /* - * Now we have a reply port. We need to make a naked - * send right to stash in ith_reply. We can't use - * ipc_port_make_send, because we can't unlock the port - * before making the right. Also we don't want to - * increment ip_mscount. The net effect of all this - * is the same as doing - * ipc_port_alloc_kernel get the port - * ipc_port_make_send make the send right - * ipc_object_copyin_from_kernel grab receive right - * ipc_object_copyout_compat and give to user - */ - - port->ip_srights++; - ip_reference(port); - ip_unlock(port); - - thread->ith_reply = port; - } -#endif /* MACH_IPC_COMPAT */ } /* @@ -344,43 +311,6 @@ ipc_thread_terminate(thread) if (IP_VALID(thread->ith_exception)) ipc_port_release_send(thread->ith_exception); -#if MACH_IPC_COMPAT - if (IP_VALID(thread->ith_reply)) { - ipc_space_t space = thread->task->itk_space; - ipc_port_t port = thread->ith_reply; - ipc_entry_t entry; - mach_port_t name; - - /* destroy any rights the task may have for the port */ - - is_write_lock(space); - if (space->is_active && - ipc_right_reverse(space, (ipc_object_t) port, - &name, &entry)) { - /* reply port is locked and active */ - ip_unlock(port); - - (void) ipc_right_destroy(space, name, entry); - /* space is unlocked */ - } else - is_write_unlock(space); - - ipc_port_release_send(port); - } - - /* - * Note we do *not* destroy any rights the space may have - * for the thread's kernel port. The old IPC code did this, - * to avoid generating a notification when the port is - * destroyed. However, this isn't a good idea when - * the kernel port is interposed, because then it doesn't - * happen, exposing the interposition to the task. - * Because we don't need the efficiency hack, I flushed - * this behaviour, introducing a small incompatibility - * with the old IPC code. - */ -#endif /* MACH_IPC_COMPAT */ - /* destroy the kernel port */ ipc_port_dealloc_kernel(kport); @@ -644,163 +574,6 @@ mach_reply_port(void) return name; } -#if MACH_IPC_COMPAT - -/* - * Routine: retrieve_task_notify - * Purpose: - * Return a reference (or null) for - * the task's notify port. - * Conditions: - * Nothing locked. - */ - -ipc_port_t -retrieve_task_notify(task) - task_t task; -{ - ipc_space_t space = task->itk_space; - ipc_port_t port; - - is_read_lock(space); - if (space->is_active) { - port = space->is_notify; - if (IP_VALID(port)) - ipc_port_reference(port); - } else - port = IP_NULL; - is_read_unlock(space); - - return port; -} - -/* - * Routine: retrieve_thread_reply - * Purpose: - * Return a reference (or null) for - * the thread's reply port. - * Conditions: - * Nothing locked. - */ - -ipc_port_t -retrieve_thread_reply(thread) - thread_t thread; -{ - ipc_port_t port; - - ith_lock(thread); - if (thread->ith_self != IP_NULL) { - port = thread->ith_reply; - if (IP_VALID(port)) - ipc_port_reference(port); - } else - port = IP_NULL; - ith_unlock(thread); - - return port; -} - -/* - * Routine: task_self [mach trap] - * Purpose: - * Give the caller send rights for his task port. - * If new, the send right is marked with IE_BITS_COMPAT. - * Conditions: - * Nothing locked. - * Returns: - * MACH_PORT_NULL if there are any resource failures - * or other errors. - */ - -port_name_t -task_self() -{ - task_t task = current_task(); - ipc_port_t sright; - mach_port_t name; - - sright = retrieve_task_self_fast(task); - name = ipc_port_copyout_send_compat(sright, task->itk_space); - return (port_name_t) name; -} - -/* - * Routine: task_notify [mach trap] - * Purpose: - * Give the caller the name of his own notify port. - * Conditions: - * Nothing locked. - * Returns: - * MACH_PORT_NULL if there isn't a notify port, - * if it is dead, or if the caller doesn't hold - * receive rights for it. - */ - -port_name_t -task_notify() -{ - task_t task = current_task(); - ipc_port_t notify; - mach_port_t name; - - notify = retrieve_task_notify(task); - name = ipc_port_copyout_receiver(notify, task->itk_space); - return (port_name_t) name; -} - -/* - * Routine: thread_self [mach trap] - * Purpose: - * Give the caller send rights for his own thread port. - * If new, the send right is marked with IE_BITS_COMPAT. - * Conditions: - * Nothing locked. - * Returns: - * MACH_PORT_NULL if there are any resource failures - * or other errors. - */ - -port_name_t -thread_self() -{ - thread_t thread = current_thread(); - task_t task = thread->task; - ipc_port_t sright; - mach_port_t name; - - sright = retrieve_thread_self_fast(thread); - name = ipc_port_copyout_send_compat(sright, task->itk_space); - return (port_name_t) name; -} - -/* - * Routine: thread_reply [mach trap] - * Purpose: - * Give the caller the name of his own reply port. - * Conditions: - * Nothing locked. - * Returns: - * MACH_PORT_NULL if there isn't a reply port, - * if it is dead, or if the caller doesn't hold - * receive rights for it. - */ - -port_name_t -thread_reply() -{ - task_t task = current_task(); - thread_t thread = current_thread(); - ipc_port_t reply; - mach_port_t name; - - reply = retrieve_thread_reply(thread); - name = ipc_port_copyout_receiver(reply, task->itk_space); - return (port_name_t) name; -} - -#endif /* MACH_IPC_COMPAT */ - /* * Routine: task_get_special_port [kernel call] * Purpose: @@ -828,24 +601,6 @@ task_get_special_port( return KERN_INVALID_ARGUMENT; switch (which) { -#if MACH_IPC_COMPAT - case TASK_NOTIFY_PORT: { - ipc_space_t space = task->itk_space; - - is_read_lock(space); - if (!space->is_active) { - is_read_unlock(space); - return KERN_FAILURE; - } - - port = ipc_port_copy_send(space->is_notify); - is_read_unlock(space); - - *portp = port; - return KERN_SUCCESS; - } -#endif /* MACH_IPC_COMPAT */ - case TASK_KERNEL_PORT: whichp = &task->itk_sself; break; @@ -903,26 +658,6 @@ task_set_special_port( return KERN_INVALID_ARGUMENT; switch (which) { -#if MACH_IPC_COMPAT - case TASK_NOTIFY_PORT: { - ipc_space_t space = task->itk_space; - - is_write_lock(space); - if (!space->is_active) { - is_write_unlock(space); - return KERN_FAILURE; - } - - old = space->is_notify; - space->is_notify = port; - is_write_unlock(space); - - if (IP_VALID(old)) - ipc_port_release_send(old); - return KERN_SUCCESS; - } -#endif /* MACH_IPC_COMPAT */ - case TASK_KERNEL_PORT: whichp = &task->itk_sself; break; @@ -981,12 +716,6 @@ thread_get_special_port(thread, which, portp) return KERN_INVALID_ARGUMENT; switch (which) { -#if MACH_IPC_COMPAT - case THREAD_REPLY_PORT: - whichp = &thread->ith_reply; - break; -#endif /* MACH_IPC_COMPAT */ - case THREAD_KERNEL_PORT: whichp = &thread->ith_sself; break; @@ -1040,12 +769,6 @@ thread_set_special_port(thread, which, port) return KERN_INVALID_ARGUMENT; switch (which) { -#if MACH_IPC_COMPAT - case THREAD_REPLY_PORT: - whichp = &thread->ith_reply; - break; -#endif /* MACH_IPC_COMPAT */ - case THREAD_KERNEL_PORT: whichp = &thread->ith_sself; break; diff --git a/kern/syscall_sw.c b/kern/syscall_sw.c index d4c3e07..9536a63 100644 --- a/kern/syscall_sw.c +++ b/kern/syscall_sw.c @@ -100,34 +100,19 @@ mach_trap_t mach_trap_table[] = { MACH_TRAP(kern_invalid, 0), /* 7 */ /* Unix */ MACH_TRAP(kern_invalid, 0), /* 8 */ /* Unix */ MACH_TRAP(kern_invalid, 0), /* 9 */ /* Unix */ - -#if MACH_IPC_COMPAT - MACH_TRAP(task_self, 0), /* 10 */ /* obsolete */ - MACH_TRAP(thread_reply, 0), /* 11 */ /* obsolete */ - MACH_TRAP(task_notify, 0), /* 12 */ /* obsolete */ - MACH_TRAP(thread_self, 0), /* 13 */ /* obsolete */ -#else /* MACH_IPC_COMPAT */ MACH_TRAP(null_port, 0), /* 10 */ MACH_TRAP(null_port, 0), /* 11 */ MACH_TRAP(null_port, 0), /* 12 */ MACH_TRAP(null_port, 0), /* 13 */ -#endif /* MACH_IPC_COMPAT */ MACH_TRAP(kern_invalid, 0), /* 14 */ MACH_TRAP(kern_invalid, 0), /* 15 */ MACH_TRAP(kern_invalid, 0), /* 16 */ MACH_TRAP_STACK(evc_wait, 1), /* 17 */ MACH_TRAP_STACK(evc_wait_clear, 1), /* 18 */ MACH_TRAP(kern_invalid, 0), /* 19 */ - -#if MACH_IPC_COMPAT - MACH_TRAP(msg_send_trap, 4), /* 20 */ /* obsolete */ - MACH_TRAP_STACK(msg_receive_trap, 5), /* 21 */ /* obsolete */ - MACH_TRAP_STACK(msg_rpc_trap, 6), /* 22 */ /* obsolete */ -#else /* MACH_IPC_COMPAT */ MACH_TRAP(kern_invalid, 0), /* 20 */ MACH_TRAP(kern_invalid, 0), /* 21 */ MACH_TRAP(kern_invalid, 0), /* 22 */ -#endif /* MACH_IPC_COMPAT */ MACH_TRAP(kern_invalid, 0), /* 23 */ MACH_TRAP(kern_invalid, 0), /* 24 */ MACH_TRAP_STACK(mach_msg_trap, 7), /* 25 */ @@ -164,11 +149,7 @@ mach_trap_t mach_trap_table[] = { MACH_TRAP(kern_invalid, 0), /* 52 emul: htg_syscall */ MACH_TRAP(kern_invalid, 0), /* 53 emul: set_ras_address */ MACH_TRAP(kern_invalid, 0), /* 54 */ -#if MACH_IPC_COMPAT - MACH_TRAP(host_self, 0), /* 55 */ -#else /* MACH_IPC_COMPAT */ MACH_TRAP(null_port, 0), /* 55 */ -#endif /* MACH_IPC_COMPAT */ MACH_TRAP(null_port, 0), /* 56 */ MACH_TRAP(kern_invalid, 0), /* 57 */ MACH_TRAP(kern_invalid, 0), /* 58 */ diff --git a/kern/thread.h b/kern/thread.h index e8008d5..0ac6a32 100644 --- a/kern/thread.h +++ b/kern/thread.h @@ -154,9 +154,6 @@ struct thread { struct ipc_port *ith_self; /* not a right, doesn't hold ref */ struct ipc_port *ith_sself; /* a send right */ struct ipc_port *ith_exception; /* a send right */ -#if MACH_IPC_COMPAT - struct ipc_port *ith_reply; /* a send right */ -#endif /* MACH_IPC_COMPAT */ mach_port_t ith_mig_reply; /* reply port for mig */ struct ipc_port *ith_rpc_reply; /* reply port for kernel RPCs */ -- cgit v1.2.3