--- Gnu-Mach/ipc/ipc_notify.c 2020/09/02 04:42:35 1.1.1.2 +++ Gnu-Mach/ipc/ipc_notify.c 2020/09/02 04:47:18 1.1.1.4 @@ -31,8 +31,7 @@ * Notification-sending functions. */ -#include - +#include #include #include #include @@ -51,19 +50,7 @@ mach_no_senders_notification_t ipc_noti mach_send_once_notification_t ipc_notify_send_once_template; mach_dead_name_notification_t ipc_notify_dead_name_template; -#if MACH_IPC_COMPAT -/* - * When notification messages are received via the old - * msg_receive trap, the msg_type field should contain - * MSG_TYPE_EMERGENCY. We arrange for this by putting - * MSG_TYPE_EMERGENCY into msgh_seqno, which - * ipc_kmsg_copyout_compat copies to msg_type. - */ - -#define NOTIFY_MSGH_SEQNO MSG_TYPE_EMERGENCY -#else /* MACH_IPC_COMPAT */ #define NOTIFY_MSGH_SEQNO 0 -#endif /* MACH_IPC_COMPAT */ /* * Routine: ipc_notify_init_port_deleted @@ -72,8 +59,7 @@ mach_dead_name_notification_t ipc_notif */ void -ipc_notify_init_port_deleted(n) - mach_port_deleted_notification_t *n; +ipc_notify_init_port_deleted(mach_port_deleted_notification_t *n) { mach_msg_header_t *m = &n->not_header; mach_msg_type_t *t = &n->not_type; @@ -103,8 +89,7 @@ ipc_notify_init_port_deleted(n) */ void -ipc_notify_init_msg_accepted(n) - mach_msg_accepted_notification_t *n; +ipc_notify_init_msg_accepted(mach_msg_accepted_notification_t *n) { mach_msg_header_t *m = &n->not_header; mach_msg_type_t *t = &n->not_type; @@ -134,8 +119,7 @@ ipc_notify_init_msg_accepted(n) */ void -ipc_notify_init_port_destroyed( - mach_port_destroyed_notification_t *n) +ipc_notify_init_port_destroyed(mach_port_destroyed_notification_t *n) { mach_msg_header_t *m = &n->not_header; mach_msg_type_t *t = &n->not_type; @@ -268,16 +252,16 @@ ipc_notify_init(void) */ void -ipc_notify_port_deleted(port, name) - ipc_port_t port; - mach_port_t name; +ipc_notify_port_deleted( + ipc_port_t port, + mach_port_t name) { ipc_kmsg_t kmsg; mach_port_deleted_notification_t *n; kmsg = ikm_alloc(sizeof *n); if (kmsg == IKM_NULL) { - printf("dropped port-deleted (0x%08x, 0x%x)\n", port, name); + printf("dropped port-deleted (0x%p, 0x%lx)\n", port, name); ipc_port_release_sonce(port); return; } @@ -302,16 +286,16 @@ ipc_notify_port_deleted(port, name) */ void -ipc_notify_msg_accepted(port, name) - ipc_port_t port; - mach_port_t name; +ipc_notify_msg_accepted( + ipc_port_t port, + mach_port_t name) { ipc_kmsg_t kmsg; mach_msg_accepted_notification_t *n; kmsg = ikm_alloc(sizeof *n); if (kmsg == IKM_NULL) { - printf("dropped msg-accepted (0x%08x, 0x%x)\n", port, name); + printf("dropped msg-accepted (0x%p, 0x%lx)\n", port, name); ipc_port_release_sonce(port); return; } @@ -339,16 +323,16 @@ ipc_notify_msg_accepted(port, name) */ void -ipc_notify_port_destroyed(port, right) - ipc_port_t port; - ipc_port_t right; +ipc_notify_port_destroyed( + ipc_port_t port, + ipc_port_t right) { ipc_kmsg_t kmsg; mach_port_destroyed_notification_t *n; kmsg = ikm_alloc(sizeof *n); if (kmsg == IKM_NULL) { - printf("dropped port-destroyed (0x%08x, 0x%08x)\n", + printf("dropped port-destroyed (0x%p, 0x%p)\n", port, right); ipc_port_release_sonce(port); ipc_port_release_receive(right); @@ -375,23 +359,16 @@ ipc_notify_port_destroyed(port, right) */ void -ipc_notify_no_senders(port, mscount) - ipc_port_t port; - mach_port_mscount_t mscount; +ipc_notify_no_senders( + ipc_port_t port, + mach_port_mscount_t mscount) { ipc_kmsg_t kmsg; mach_no_senders_notification_t *n; -#if NORMA_IPC - if (ip_nsproxyp(port)) { - assert(mscount == 0); - norma_ipc_notify_no_senders(ip_nsproxy(port)); - return; - } -#endif /* NORMA_IPC */ kmsg = ikm_alloc(sizeof *n); if (kmsg == IKM_NULL) { - printf("dropped no-senders (0x%08x, %u)\n", port, mscount); + printf("dropped no-senders (0x%p, %u)\n", port, mscount); ipc_port_release_sonce(port); return; } @@ -416,15 +393,14 @@ ipc_notify_no_senders(port, mscount) */ void -ipc_notify_send_once(port) - ipc_port_t port; +ipc_notify_send_once(ipc_port_t port) { ipc_kmsg_t kmsg; mach_send_once_notification_t *n; kmsg = ikm_alloc(sizeof *n); if (kmsg == IKM_NULL) { - printf("dropped send-once (0x%08x)\n", port); + printf("dropped send-once (0x%p)\n", port); ipc_port_release_sonce(port); return; } @@ -448,16 +424,16 @@ ipc_notify_send_once(port) */ void -ipc_notify_dead_name(port, name) - ipc_port_t port; - mach_port_t name; +ipc_notify_dead_name( + ipc_port_t port, + mach_port_t name) { ipc_kmsg_t kmsg; mach_dead_name_notification_t *n; kmsg = ikm_alloc(sizeof *n); if (kmsg == IKM_NULL) { - printf("dropped dead-name (0x%08x, 0x%x)\n", port, name); + printf("dropped dead-name (0x%p, 0x%lx)\n", port, name); ipc_port_release_sonce(port); return; } @@ -471,123 +447,3 @@ ipc_notify_dead_name(port, name) ipc_mqueue_send_always(kmsg); } - -#if MACH_IPC_COMPAT - -/* - * Routine: ipc_notify_port_deleted_compat - * Purpose: - * Send a port-deleted notification. - * Sends it to a send right instead of a send-once right. - * Conditions: - * Nothing locked. - * Consumes a ref/sright for port. - */ - -void -ipc_notify_port_deleted_compat(port, name) - ipc_port_t port; - mach_port_t name; -{ - ipc_kmsg_t kmsg; - mach_port_deleted_notification_t *n; - - kmsg = ikm_alloc(sizeof *n); - if (kmsg == IKM_NULL) { - printf("dropped port-deleted-compat (0x%08x, 0x%x)\n", - port, name); - ipc_port_release_send(port); - return; - } - - ikm_init(kmsg, sizeof *n); - n = (mach_port_deleted_notification_t *) &kmsg->ikm_header; - *n = ipc_notify_port_deleted_template; - - n->not_header.msgh_bits = MACH_MSGH_BITS(MACH_MSG_TYPE_PORT_SEND, 0); - n->not_header.msgh_remote_port = (mach_port_t) port; - n->not_port = name; - - ipc_mqueue_send_always(kmsg); -} - -/* - * Routine: ipc_notify_msg_accepted_compat - * Purpose: - * Send a msg-accepted notification. - * Sends it to a send right instead of a send-once right. - * Conditions: - * Nothing locked. - * Consumes a ref/sright for port. - */ - -void -ipc_notify_msg_accepted_compat(port, name) - ipc_port_t port; - mach_port_t name; -{ - ipc_kmsg_t kmsg; - mach_msg_accepted_notification_t *n; - - kmsg = ikm_alloc(sizeof *n); - if (kmsg == IKM_NULL) { - printf("dropped msg-accepted-compat (0x%08x, 0x%x)\n", - port, name); - ipc_port_release_send(port); - return; - } - - ikm_init(kmsg, sizeof *n); - n = (mach_msg_accepted_notification_t *) &kmsg->ikm_header; - *n = ipc_notify_msg_accepted_template; - - n->not_header.msgh_bits = MACH_MSGH_BITS(MACH_MSG_TYPE_PORT_SEND, 0); - n->not_header.msgh_remote_port = (mach_port_t) port; - n->not_port = name; - - ipc_mqueue_send_always(kmsg); -} - -/* - * Routine: ipc_notify_port_destroyed_compat - * Purpose: - * Send a port-destroyed notification. - * Sends it to a send right instead of a send-once right. - * Conditions: - * Nothing locked. - * Consumes a ref/sright for port. - * Consumes a ref for right, which should be a receive right - * prepped for placement into a message. (In-transit, - * or in-limbo if a circularity was detected.) - */ - -void -ipc_notify_port_destroyed_compat(port, right) - ipc_port_t port; - ipc_port_t right; -{ - ipc_kmsg_t kmsg; - mach_port_destroyed_notification_t *n; - - kmsg = ikm_alloc(sizeof *n); - if (kmsg == IKM_NULL) { - printf("dropped port-destroyed-compat (0x%08x, 0x%08x)\n", - port, right); - ipc_port_release_send(port); - ipc_port_release_receive(right); - return; - } - - ikm_init(kmsg, sizeof *n); - n = (mach_port_destroyed_notification_t *) &kmsg->ikm_header; - *n = ipc_notify_port_destroyed_template; - - n->not_header.msgh_bits = MACH_MSGH_BITS_COMPLEX | - MACH_MSGH_BITS(MACH_MSG_TYPE_PORT_SEND, 0); - n->not_header.msgh_remote_port = (mach_port_t) port; - n->not_port = (mach_port_t) right; - - ipc_mqueue_send_always(kmsg); -} - -#endif /* MACH_IPC_COMPAT */