rem: if (*cookie == NULL) {
add: if (*cookie == 0) {
context: _get_next_sem_info(team_id team, int32 *cookie, struct sem_info *info, size_t sz){	int state;	int slot;	if (gSemsActive == false)		return B_NO_MORE_SEMS;	if (cookie == NULL)		return EINVAL;	/* prevents gSems[].owner == -1 >= means owned by a port */	if (team < 0)		return B_BAD_TEAM_ID; 	if (*cookie == NULL) {		// return first found		slot = 0;	}	else {		// start at index cookie, but check cookie against MAX_PORTS		slot = *cookie;		if (slot >= MAX_SEMS)			return B_BAD_SEM_ID;	}	// spinlock	state = disable_interrupts();	GRAB_SEM_LIST_LOCK();	while (slot < MAX_SEMS) {		if (gSems[slot].id != -1 && gSems[slot].owner == team) {			GRAB_SEM_LOCK(gSems[slot]);			if (gSems[slot].id != -1 && gSems[slot].owner == team) {				// found one!				info->sem			= gSems[slot].id;				info->team			= gSems[slot].owner;				strncpy(info->name, gSems[slot].name, SYS_MAX_OS_NAME_LEN-1);				info->count			= gSems[slot].count;				info->latest_holder	= gSems[slot].q.head->id; // XXX not sure if this is the latest holder, or the next holder...				RELEASE_SEM_LOCK(gSems[slot]);				slot++;				break;			}			RELEASE_SEM_LOCK(gSems[slot]);		}		slot++;	}	RELEASE_SEM_LIST_LOCK();	restore_interrupts(state);	if (slot == MAX_SEMS)		return B_BAD_SEM_ID;	*cookie = slot;	return B_NO_ERROR;}