Esempio n. 1
0
/*
 *	Check whether the object is a port if so, free it.  But
 *	keep track of that fact.
 */
void
io_free(
	unsigned int	otype,
	ipc_object_t	object)
{
	ipc_port_t	port;

	if (otype == IOT_PORT) {
		port = (ipc_port_t) object;
#if	MACH_ASSERT
		ipc_port_track_dealloc(port);
#endif	/* MACH_ASSERT */

#if CONFIG_MACF_MACH
		/* Port label should have been initialized after creation. */
		mac_port_label_destroy(&port->ip_label);
#endif	  
	}
	io_lock_destroy(object);
	zfree(ipc_object_zones[otype], object);
}
Esempio n. 2
0
/*
 *	Routine:	ipc_port_finalize
 *	Purpose:
 *		Called on last reference deallocate to
 *		free any remaining data associated with the
 *		port.
 *	Conditions:
 *		Nothing locked.
 */
void
ipc_port_finalize(
	ipc_port_t		port)
{
	ipc_port_request_t requests = port->ip_requests;

	assert(!ip_active(port));
	if (requests != IPR_NULL) {
		ipc_table_size_t its = requests->ipr_size;
		it_requests_free(its, requests);
		port->ip_requests = IPR_NULL;
	}
	
#if	MACH_ASSERT
	ipc_port_track_dealloc(port);
#endif	/* MACH_ASSERT */

#if CONFIG_MACF_MACH
	/* Port label should have been initialized after creation. */
	mac_port_label_destroy(&port->ip_label);
#endif	  
}