rem: if (status == B_TIMED_OUT || B_WOULD_BLOCK)
add: if (status == B_TIMED_OUT || status == B_WOULD_BLOCK)
context: port_buffer_size_etc(port_id id, uint32 flags, bigtime_t timeout){	cpu_status state;	sem_id cachedSem;	status_t status;	ssize_t size;	int slot;	int tail;	if (!ports_active || id < 0)		return B_BAD_PORT_ID;	slot = id % MAX_PORTS;	state = disable_interrupts();	GRAB_PORT_LOCK(gPorts[slot]);	if (gPorts[slot].id != id) {		RELEASE_PORT_LOCK(gPorts[slot]);		restore_interrupts(state);		TRACE(("get_buffer_size_etc: invalid port_id %ld\n", id));		return B_BAD_PORT_ID;	}		cachedSem = gPorts[slot].read_sem;	RELEASE_PORT_LOCK(gPorts[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	status = acquire_sem_etc(cachedSem, 1, flags, timeout);	if (status == B_BAD_SEM_ID) {		// somebody deleted the port		return B_BAD_PORT_ID;	}	if (status == B_TIMED_OUT || B_WOULD_BLOCK)		return status;	state = disable_interrupts();	GRAB_PORT_LOCK(gPorts[slot]);	if (gPorts[slot].id != id) {		// the port is no longer there		RELEASE_PORT_LOCK(gPorts[slot]);		restore_interrupts(state);		return B_BAD_PORT_ID;	}	// determine tail & get the length of the message	tail = gPorts[slot].tail;	if (tail < 0)		panic("port %ld: tail < 0", gPorts[slot].id);	if (tail > gPorts[slot].capacity)		panic("port %ld: tail > cap %ld", gPorts[slot].id, gPorts[slot].capacity);	size = gPorts[slot].msg_queue[tail].data_len;	RELEASE_PORT_LOCK(gPorts[slot]);	restore_interrupts(state);	// restore read_sem, as we haven't read from the port	release_sem(cachedSem);	// return length of item at end of queue	return size;}