rem: dprintf("delete_port: invalid port_id %ld\n", id);
add: TRACE(("delete_port: invalid port_id %ld\n", id));
context: delete_port(port_id id){	cpu_status state;	sem_id readSem, writeSem;	const char *name;	struct list list;	port_msg *msg;	int slot;	if (!sPortsActive || id < 0)		return B_BAD_PORT_ID;	slot = id % sMaxPorts;	state = disable_interrupts();	GRAB_PORT_LOCK(sPorts[slot]);	if (sPorts[slot].id != id) {		RELEASE_PORT_LOCK(sPorts[slot]);		restore_interrupts(state);		dprintf("delete_port: invalid port_id %ld\n", id);		return B_BAD_PORT_ID;	}	/* mark port as invalid */	sPorts[slot].id	= -1;	name = sPorts[slot].name;	readSem = sPorts[slot].read_sem;	writeSem = sPorts[slot].write_sem;	sPorts[slot].name = NULL;	list_move_to_list(&sPorts[slot].msg_queue, &list);	RELEASE_PORT_LOCK(sPorts[slot]);	restore_interrupts(state);	atomic_add(&sUsedPorts, -1);	// free the queue	while ((msg = (port_msg *)list_remove_head_item(&list)) != NULL) {		put_port_msg(msg);	}	free((char *)name);	// release the threads that were blocking on this port by deleting the sem	// read_port() will see the B_BAD_SEM_ID acq_sem() return value, and act accordingly	delete_sem(readSem);	delete_sem(writeSem);	return B_OK;}