- * Forward declarations
- */
-void ipc_notify_init_port_deleted(
- mach_port_deleted_notification_t *n);
-
-void ipc_notify_init_port_destroyed(
- mach_port_destroyed_notification_t *n);
-
-void ipc_notify_init_no_senders(
- mach_no_senders_notification_t *n);
-
-void ipc_notify_init_send_once(
- mach_send_once_notification_t *n);
-
-void ipc_notify_init_dead_name(
- mach_dead_name_notification_t *n);
-
-mach_port_deleted_notification_t ipc_notify_port_deleted_template;
-mach_port_destroyed_notification_t ipc_notify_port_destroyed_template;
-mach_no_senders_notification_t ipc_notify_no_senders_template;
-mach_send_once_notification_t ipc_notify_send_once_template;
-mach_dead_name_notification_t ipc_notify_dead_name_template;
-
-/*
- * Routine: ipc_notify_init_port_deleted
- * Purpose:
- * Initialize a template for port-deleted notifications.
- */
-
-void
-ipc_notify_init_port_deleted(
- mach_port_deleted_notification_t *n)
-{
- mach_msg_header_t *m = &n->not_header;
-
- m->msgh_bits = MACH_MSGH_BITS(MACH_MSG_TYPE_PORT_SEND_ONCE, 0);
- m->msgh_local_port = MACH_PORT_NULL;
- m->msgh_remote_port = MACH_PORT_NULL;
- m->msgh_id = MACH_NOTIFY_PORT_DELETED;
- m->msgh_size = ((int)sizeof *n) - sizeof(mach_msg_format_0_trailer_t);
-
- n->not_port = MACH_PORT_NULL;
- n->NDR = NDR_record;
- n->trailer.msgh_seqno = 0;
- n->trailer.msgh_sender = KERNEL_SECURITY_TOKEN;
- n->trailer.msgh_trailer_type = MACH_MSG_TRAILER_FORMAT_0;
- n->trailer.msgh_trailer_size = MACH_MSG_TRAILER_MINIMUM_SIZE;
-}
-
-/*
- * Routine: ipc_notify_init_port_destroyed
- * Purpose:
- * Initialize a template for port-destroyed notifications.
- */
-
-void
-ipc_notify_init_port_destroyed(
- mach_port_destroyed_notification_t *n)
-{
- mach_msg_header_t *m = &n->not_header;
-
- m->msgh_bits = MACH_MSGH_BITS_COMPLEX |
- MACH_MSGH_BITS(MACH_MSG_TYPE_PORT_SEND_ONCE, 0);
- m->msgh_local_port = MACH_PORT_NULL;
- m->msgh_remote_port = MACH_PORT_NULL;
- m->msgh_id = MACH_NOTIFY_PORT_DESTROYED;
- m->msgh_size = ((int)sizeof *n) - sizeof(mach_msg_format_0_trailer_t);
-
- n->not_body.msgh_descriptor_count = 1;
- n->not_port.disposition = MACH_MSG_TYPE_PORT_RECEIVE;
- n->not_port.name = MACH_PORT_NULL;
- n->not_port.type = MACH_MSG_PORT_DESCRIPTOR;
- n->trailer.msgh_seqno = 0;
- n->trailer.msgh_sender = KERNEL_SECURITY_TOKEN;
- n->trailer.msgh_trailer_type = MACH_MSG_TRAILER_FORMAT_0;
- n->trailer.msgh_trailer_size = MACH_MSG_TRAILER_MINIMUM_SIZE;
-}
-
-/*
- * Routine: ipc_notify_init_no_senders
- * Purpose:
- * Initialize a template for no-senders notifications.
- */
-
-void
-ipc_notify_init_no_senders(
- mach_no_senders_notification_t *n)
-{
- mach_msg_header_t *m = &n->not_header;
-
- m->msgh_bits = MACH_MSGH_BITS(MACH_MSG_TYPE_PORT_SEND_ONCE, 0);
- m->msgh_local_port = MACH_PORT_NULL;
- m->msgh_remote_port = MACH_PORT_NULL;
- m->msgh_id = MACH_NOTIFY_NO_SENDERS;
- m->msgh_size = ((int)sizeof *n) - sizeof(mach_msg_format_0_trailer_t);
-
- n->NDR = NDR_record;
- n->trailer.msgh_seqno = 0;
- n->trailer.msgh_sender = KERNEL_SECURITY_TOKEN;
- n->trailer.msgh_trailer_type = MACH_MSG_TRAILER_FORMAT_0;
- n->trailer.msgh_trailer_size = MACH_MSG_TRAILER_MINIMUM_SIZE;
- n->not_count = 0;
-}
-
-/*
- * Routine: ipc_notify_init_send_once
- * Purpose:
- * Initialize a template for send-once notifications.
- */
-
-void
-ipc_notify_init_send_once(
- mach_send_once_notification_t *n)
-{
- mach_msg_header_t *m = &n->not_header;
-
- m->msgh_bits = MACH_MSGH_BITS(MACH_MSG_TYPE_PORT_SEND_ONCE, 0);
- m->msgh_local_port = MACH_PORT_NULL;
- m->msgh_remote_port = MACH_PORT_NULL;
- m->msgh_id = MACH_NOTIFY_SEND_ONCE;
- m->msgh_size = ((int)sizeof *n) - sizeof(mach_msg_format_0_trailer_t);
- n->trailer.msgh_seqno = 0;
- n->trailer.msgh_sender = KERNEL_SECURITY_TOKEN;
- n->trailer.msgh_trailer_type = MACH_MSG_TRAILER_FORMAT_0;
- n->trailer.msgh_trailer_size = MACH_MSG_TRAILER_MINIMUM_SIZE;
-}
-
-/*
- * Routine: ipc_notify_init_dead_name
- * Purpose:
- * Initialize a template for dead-name notifications.
- */
-
-void
-ipc_notify_init_dead_name(
- mach_dead_name_notification_t *n)
-{
- mach_msg_header_t *m = &n->not_header;
-
- m->msgh_bits = MACH_MSGH_BITS(MACH_MSG_TYPE_PORT_SEND_ONCE, 0);
- m->msgh_local_port = MACH_PORT_NULL;
- m->msgh_remote_port = MACH_PORT_NULL;
- m->msgh_id = MACH_NOTIFY_DEAD_NAME;
- m->msgh_size = ((int)sizeof *n) - sizeof(mach_msg_format_0_trailer_t);
-
- n->not_port = MACH_PORT_NULL;
- n->NDR = NDR_record;
- n->trailer.msgh_seqno = 0;
- n->trailer.msgh_sender = KERNEL_SECURITY_TOKEN;
- n->trailer.msgh_trailer_type = MACH_MSG_TRAILER_FORMAT_0;
- n->trailer.msgh_trailer_size = MACH_MSG_TRAILER_MINIMUM_SIZE;
-}
-
-/*
- * Routine: ipc_notify_init