- if (ip_active(port) && IKOT_AU_SESSIONPORT == ip_kotype(port)) {
- port_aia_p = (struct auditinfo_addr *)port->ip_kobject;
- assert(NULL != port_aia_p);
- if (port->ip_mscount <= notification->not_count)
- ipc_kobject_set_atomically(port, IKO_NULL, IKOT_NONE);
- else {
- /* re-arm the notification */
- ip_unlock(port);
- notifyport = ipc_port_make_sonce(port);
- ip_lock(port);
- /* unlocked by ipc_port_nsrequest */
- ipc_port_nsrequest(port, port->ip_mscount, notifyport,
- ¬ifyport);
- return;
+ assert(ip_active(port));
+ port_aia_p = (struct auditinfo_addr *)port->ip_kobject;
+ assert(NULL != port_aia_p);
+
+ /*
+ * if new send rights have been made since the last notify
+ * request, re-arm the notification with the new threshold.
+ */
+ if (port->ip_mscount > notification->not_count) {
+ notifyport = ipc_port_make_sonce_locked(port);
+ ipc_port_nsrequest(port, port->ip_mscount, notifyport, ¬ifyport);
+ /* port unlocked */
+
+ if (IP_NULL != notifyport) {
+ /* race re-arming the notification */
+ ipc_port_release_sonce(notifyport);
+ audit_session_aiaunref(port_aia_p);