rem: int delete_sem_etc(sem_id id, int return_code)
add: status_t delete_sem_etc(sem_id id, status_t return_code)
context: int delete_sem_etc(sem_id id, int return_code){	int slot;	int state;	int err = B_NO_ERROR;	struct thread *t;	int released_threads;	char *old_name;	struct thread_queue release_queue;	if (sems_active == false)		return B_NO_MORE_SEMS;	if (id < 0)		return B_BAD_SEM_ID;	slot = id % MAX_SEMS;	state = disable_interrupts();	GRAB_SEM_LOCK(sems[slot]);	if (sems[slot].id != id) {		RELEASE_SEM_LOCK(sems[slot]);		restore_interrupts(state);		dprintf("delete_sem: invalid sem_id %d\n", id);		return B_BAD_SEM_ID;	}	released_threads = 0;	release_queue.head = release_queue.tail = NULL;	// free any threads waiting for this semaphore	while ((t = thread_dequeue(&sems[slot].q)) != NULL) {		t->state = B_THREAD_READY;		t->sem_errcode = B_BAD_SEM_ID;		t->sem_deleted_retcode = return_code;		t->sem_count = 0;		thread_enqueue(t, &release_queue);		released_threads++;	}	sems[slot].id = -1;	old_name = sems[slot].name;	sems[slot].name = NULL;	RELEASE_SEM_LOCK(sems[slot]);	if (released_threads > 0) {		GRAB_THREAD_LOCK();		while ((t = thread_dequeue(&release_queue)) != NULL) {			thread_enqueue_run_q(t);		}		resched();		RELEASE_THREAD_LOCK();	}	restore_interrupts(state);	kfree(old_name);	return err;}