---
title: "notify_register_mach_port(_:_:_:_:)"
framework: Darwin Notify
role: symbol
role_heading: Function
path: "darwinnotify/notify_register_mach_port(_:_:_:_:)"
---

# notify_register_mach_port(_:_:_:_:)

## Declaration

```swift
func notify_register_mach_port(_ name: UnsafePointer<CChar>!, _ notify_port: UnsafeMutablePointer<mach_port_t>!, _ flags: Int32, _ out_token: UnsafeMutablePointer<Int32>!) -> UInt32
```

## Parameters

- `name`: (Input) notification name
- `notify_port`: (Input/Output) pointer to a mach port
- `out_token`: (Output) notification token

## Return Value

Return Value Returns status.

## Discussion

Discussion Request notification by mach message. Notifications are delivered by an empty message sent to a mach port. By default, a new port is allocated and a pointer to it is returned as the value of “notify_port”. A mach port previously returned by a call to this routine may be used for notifications if a pointer to that port is passed in to the routine and NOTIFY_REUSE is set in the flags parameter. The notification service must be able to extract send rights to the port. Note that the kernel limits the size of the message queue for any port. If it is important that notifications should not be lost due to queue overflow, clients should service messages quickly, and be careful about using the same port for notifications for more than one name. A notification message has an empty message body. The msgh_id field in the mach message header will have the value of the notification token. If a port is reused for multiple notification registrations, the msgh_id value may be used to determine which name generated the notification.

## See Also

### Miscellaneous

- [notify_cancel(_:)](darwinnotify/notify_cancel(_:).md)
- [notify_check(_:_:)](darwinnotify/notify_check(_:_:).md)
- [notify_get_state(_:_:)](darwinnotify/notify_get_state(_:_:).md)
- [notify_post(_:)](darwinnotify/notify_post(_:).md)
- [notify_register_check(_:_:)](darwinnotify/notify_register_check(_:_:).md)
- [notify_register_dispatch(_:_:_:_:)](darwinnotify/notify_register_dispatch(_:_:_:_:).md)
- [notify_register_signal(_:_:_:)](darwinnotify/notify_register_signal(_:_:_:).md)
- [notify_resume(_:)](darwinnotify/notify_resume(_:).md)
- [notify_set_state(_:_:)](darwinnotify/notify_set_state(_:_:).md)
- [notify_suspend(_:)](darwinnotify/notify_suspend(_:).md)
