From 86c25021825c263d08e45902c95edbd7976f1398 Mon Sep 17 00:00:00 2001 From: peter Date: Mon, 1 May 2000 11:13:41 +0000 Subject: Remove the undocumented, flawed, broken-as-designed semconfig() syscall. --- sys/kern/sysv_ipc.c | 9 ------ sys/kern/sysv_sem.c | 81 ++--------------------------------------------------- sys/sys/sem.h | 8 ------ 3 files changed, 2 insertions(+), 96 deletions(-) diff --git a/sys/kern/sysv_ipc.c b/sys/kern/sysv_ipc.c index 9bea497..d219ae3 100644 --- a/sys/kern/sysv_ipc.c +++ b/sys/kern/sysv_ipc.c @@ -108,15 +108,6 @@ semsys(p, uap) }; int -semconfig(p, uap) - struct proc *p; - struct semconfig_args *uap; -{ - sysv_nosys(p, "SYSVSEM"); - return nosys(p, (struct nosys_args *)uap); -}; - -int __semctl(p, uap) struct proc *p; register struct __semctl_args *uap; diff --git a/sys/kern/sysv_sem.c b/sys/kern/sysv_sem.c index 51c1315..944ae66 100644 --- a/sys/kern/sysv_sem.c +++ b/sys/kern/sysv_sem.c @@ -26,8 +26,6 @@ struct semget_args; int semget __P((struct proc *p, struct semget_args *uap)); struct semop_args; int semop __P((struct proc *p, struct semop_args *uap)); -struct semconfig_args; -int semconfig __P((struct proc *p, struct semconfig_args *uap)); #endif static struct sem_undo *semu_alloc __P((struct proc *p)); @@ -38,7 +36,7 @@ static void semundo_clear __P((int semid, int semnum)); /* XXX casting to (sy_call_t *) is bogus, as usual. */ static sy_call_t *semcalls[] = { (sy_call_t *)__semctl, (sy_call_t *)semget, - (sy_call_t *)semop, (sy_call_t *)semconfig + (sy_call_t *)semop }; static int semtot = 0; @@ -47,8 +45,6 @@ struct sem *sem; /* semaphore pool */ static struct sem_undo *semu_list; /* list of active undo structures */ int *semu; /* undo structure pool */ -static struct proc *semlock_holder = NULL; - void seminit(dummy) void *dummy; @@ -87,64 +83,12 @@ semsys(p, uap) } */ *uap; { - while (semlock_holder != NULL && semlock_holder != p) - (void) tsleep((caddr_t)&semlock_holder, (PZERO - 4), "semsys", 0); - if (uap->which >= sizeof(semcalls)/sizeof(semcalls[0])) return (EINVAL); return ((*semcalls[uap->which])(p, &uap->a2)); } /* - * Lock or unlock the entire semaphore facility. - * - * This will probably eventually evolve into a general purpose semaphore - * facility status enquiry mechanism (I don't like the "read /dev/kmem" - * approach currently taken by ipcs and the amount of info that we want - * to be able to extract for ipcs is probably beyond what the capability - * of the getkerninfo facility. - * - * At the time that the current version of semconfig was written, ipcs is - * the only user of the semconfig facility. It uses it to ensure that the - * semaphore facility data structures remain static while it fishes around - * in /dev/kmem. - */ - -#ifndef _SYS_SYSPROTO_H_ -struct semconfig_args { - semconfig_ctl_t flag; -}; -#endif - -int -semconfig(p, uap) - struct proc *p; - struct semconfig_args *uap; -{ - int eval = 0; - - switch (uap->flag) { - case SEM_CONFIG_FREEZE: - semlock_holder = p; - break; - - case SEM_CONFIG_THAW: - semlock_holder = NULL; - wakeup((caddr_t)&semlock_holder); - break; - - default: - printf("semconfig: unknown flag parameter value (%d) - ignored\n", - uap->flag); - eval = EINVAL; - break; - } - - p->p_retval[0] = 0; - return(eval); -} - -/* * Allocate a new sem_undo structure for a process * (returns ptr to structure or NULL if no more room) */ @@ -873,17 +817,6 @@ semexit(p) register struct sem_undo **supptr; int did_something; - /* - * If somebody else is holding the global semaphore facility lock - * then sleep until it is released. - */ - while (semlock_holder != NULL && semlock_holder != p) { -#ifdef SEM_DEBUG - printf("semaphore facility locked - sleeping ...\n"); -#endif - (void) tsleep((caddr_t)&semlock_holder, (PZERO - 4), "semext", 0); - } - did_something = 0; /* @@ -898,7 +831,7 @@ semexit(p) } if (suptr == NULL) - goto unlock; + return; #ifdef SEM_DEBUG printf("proc @%08x has undo structure with %d entries\n", p, @@ -955,14 +888,4 @@ semexit(p) #endif suptr->un_proc = NULL; *supptr = suptr->un_next; - -unlock: - /* - * If the exiting process is holding the global semaphore facility - * lock then release it. - */ - if (semlock_holder == p) { - semlock_holder = NULL; - wakeup((caddr_t)&semlock_holder); - } } diff --git a/sys/sys/sem.h b/sys/sys/sem.h index 4f31ba1..a05697d 100644 --- a/sys/sys/sem.h +++ b/sys/sys/sem.h @@ -163,14 +163,6 @@ extern int *semu; /* undo structure pool */ * Process sem_undo vectors at proc exit. */ void semexit __P((struct proc *p)); - -/* - * Parameters to the semconfig system call - */ -typedef enum { - SEM_CONFIG_FREEZE, /* Freeze the semaphore facility. */ - SEM_CONFIG_THAW /* Thaw the semaphore facility. */ -} semconfig_ctl_t; #endif /* _KERNEL */ #ifndef _KERNEL -- cgit v1.1