rem: if (*cookie == NULL) {
add: if (*cookie == 0) {
context: _get_next_port_info(team_id team, int32 *cookie, struct port_info *info, size_t size){	int state;	int slot;		if (ports_active == false)		return B_BAD_PORT_ID;	if (cookie == NULL)		return B_BAD_VALUE;	if (*cookie == NULL) {		// return first found		slot = 0;	} else {		// start at index cookie, but check cookie against MAX_PORTS		slot = *cookie;		if (slot >= MAX_PORTS)			return B_BAD_PORT_ID;	}	// spinlock	state = disable_interrupts();	GRAB_PORT_LIST_LOCK();		info->port = -1; // used as found flag	while (slot < MAX_PORTS) {		GRAB_PORT_LOCK(ports[slot]);		if (ports[slot].id != -1)			if (ports[slot].owner == team) {				// found one!				// copy the info				info->port			= ports[slot].id;//				info->owner 		= ports[slot].owner;				strncpy(info->name, ports[slot].name, min(strlen(ports[slot].name),SYS_MAX_OS_NAME_LEN-1));				info->capacity		= ports[slot].capacity;				get_sem_count(ports[slot].read_sem, &info->queue_count);				info->total_count	= ports[slot].total_count;				RELEASE_PORT_LOCK(ports[slot]);				slot++;				break;			}		RELEASE_PORT_LOCK(ports[slot]);		slot++;	}	RELEASE_PORT_LIST_LOCK();	restore_interrupts(state);	if (info->port == -1)		return B_BAD_PORT_ID;	*cookie = slot;	return B_NO_ERROR;}