rem: panic("port %id: tail > cap %d", ports[slot].id, ports[slot].capacity);
add: panic("port %ld: tail > cap %ld", ports[slot].id, ports[slot].capacity);
context: port_buffer_size_etc(port_id id,					uint32 flags,					bigtime_t timeout){	int slot;	int res;	int t;	int len;	int state;			if(ports_active == false)		return B_BAD_PORT_ID;	if(id < 0)		return B_BAD_PORT_ID;	slot = id % MAX_PORTS;	state = disable_interrupts();	GRAB_PORT_LOCK(ports[slot]);	if(ports[slot].id != id) {		RELEASE_PORT_LOCK(ports[slot]);		restore_interrupts(state);		dprintf("get_port_info: invalid port_id %d\n", id);		return B_BAD_PORT_ID;	}	RELEASE_PORT_LOCK(ports[slot]);	restore_interrupts(state);	// block if no message, 	// if TIMEOUT flag set, block with timeout	// XXX - is it a race condition to acquire a sem just after we	// unlocked the port ?	// XXX: call an acquire_sem which does the release lock, restore int & block the right way	res = acquire_sem_etc(ports[slot].read_sem, 1, flags & (B_TIMEOUT | B_CAN_INTERRUPT), timeout);	GRAB_PORT_LOCK(ports[slot]);	if (res == B_BAD_SEM_ID) {		// somebody deleted the port		RELEASE_PORT_LOCK(ports[slot]);		return B_BAD_PORT_ID;	}	if (res == B_TIMED_OUT) {		RELEASE_PORT_LOCK(ports[slot]);		return B_TIMED_OUT;	}	// once message arrived, read data's length		// determine tail	// read data's head length	t = ports[slot].head;	if (t < 0)		panic("port %id: tail < 0", ports[slot].id);	if (t > ports[slot].capacity)		panic("port %id: tail > cap %d", ports[slot].id, ports[slot].capacity);	len = ports[slot].msg_queue[t].data_len;		// restore readsem	release_sem(ports[slot].read_sem);	RELEASE_PORT_LOCK(ports[slot]);		// return length of item at end of queue	return len;}