--- Gnu-Mach/ipc/ipc_notify.c 2020/09/02 04:36:56 1.1 +++ Gnu-Mach/ipc/ipc_notify.c 2020/09/02 04:45:06 1.1.1.3 @@ -1,25 +1,25 @@ -/* +/* * Mach Operating System * Copyright (c) 1991,1990,1989 Carnegie Mellon University * All Rights Reserved. - * + * * Permission to use, copy, modify and distribute this software and its * documentation is hereby granted, provided that both the copyright * notice and this permission notice appear in all copies of the * software, derivative works or modified versions, and any portions * thereof, and that both notices appear in supporting documentation. - * + * * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * + * * Carnegie Mellon requests users of this software to return to - * + * * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU * School of Computer Science * Carnegie Mellon University * Pittsburgh PA 15213-3890 - * + * * any improvements or extensions that they make and grant Carnegie Mellon * the rights to redistribute these changes. */ @@ -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 @@ -277,7 +264,7 @@ ipc_notify_port_deleted(port, name) 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; } @@ -311,7 +298,7 @@ ipc_notify_msg_accepted(port, name) 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; } @@ -348,7 +335,7 @@ ipc_notify_port_destroyed(port, right) 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); @@ -382,16 +369,9 @@ ipc_notify_no_senders(port, 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; } @@ -424,7 +404,7 @@ ipc_notify_send_once(port) 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; } @@ -457,7 +437,7 @@ ipc_notify_dead_name(port, name) 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 +451,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