sysv_sem.c (11626) | sysv_sem.c (12819) |
---|---|
1/* $Id: sysv_sem.c,v 1.9 1995/09/09 18:10:07 davidg Exp $ */ | 1/* $Id: sysv_sem.c,v 1.10 1995/10/21 19:49:59 bde Exp $ */ |
2 3/* 4 * Implementation of SVID semaphores 5 * 6 * Author: Daniel Boulet 7 * 8 * This software is provided ``AS IS'' without any warranties of any kind. 9 */ --- 11 unchanged lines hidden (view full) --- 21 22struct semctl_args; 23static int semctl __P((struct proc *p, struct semctl_args *uap, int *retval)); 24struct semget_args; 25static int semget __P((struct proc *p, struct semget_args *uap, int *retval)); 26struct semop_args; 27static int semop __P((struct proc *p, struct semop_args *uap, int *retval)); 28struct semconfig_args; | 2 3/* 4 * Implementation of SVID semaphores 5 * 6 * Author: Daniel Boulet 7 * 8 * This software is provided ``AS IS'' without any warranties of any kind. 9 */ --- 11 unchanged lines hidden (view full) --- 21 22struct semctl_args; 23static int semctl __P((struct proc *p, struct semctl_args *uap, int *retval)); 24struct semget_args; 25static int semget __P((struct proc *p, struct semget_args *uap, int *retval)); 26struct semop_args; 27static int semop __P((struct proc *p, struct semop_args *uap, int *retval)); 28struct semconfig_args; |
29static int semconfig __P((struct proc *p, struct semconfig_args *uap, int *retval)); | 29static int semconfig __P((struct proc *p, struct semconfig_args *uap, 30 int *retval)); |
30 | 31 |
31struct sem_undo *semu_alloc __P((struct proc *p)); 32int semundo_adjust __P((struct proc *p, struct sem_undo **supptr, int semid, int semnum, int adjval)); 33void semundo_clear __P((int semid, int semnum)); 34void semexit __P((struct proc *p)); | 32static struct sem_undo *semu_alloc __P((struct proc *p)); 33static int semundo_adjust __P((struct proc *p, struct sem_undo **supptr, 34 int semid, int semnum, int adjval)); 35static void semundo_clear __P((int semid, int semnum)); 36static void semexit __P((struct proc *p)); |
35 36/* XXX casting to (sy_call_t *) is bogus, as usual. */ | 37 38/* XXX casting to (sy_call_t *) is bogus, as usual. */ |
37sy_call_t *semcalls[] = { | 39static sy_call_t *semcalls[] = { |
38 (sy_call_t *)semctl, (sy_call_t *)semget, 39 (sy_call_t *)semop, (sy_call_t *)semconfig 40}; 41 | 40 (sy_call_t *)semctl, (sy_call_t *)semget, 41 (sy_call_t *)semop, (sy_call_t *)semconfig 42}; 43 |
42int semtot = 0; | 44static int semtot = 0; |
43struct semid_ds *sema; /* semaphore id pool */ 44struct sem *sem; /* semaphore pool */ | 45struct semid_ds *sema; /* semaphore id pool */ 46struct sem *sem; /* semaphore pool */ |
45struct map *semmap; /* semaphore allocation map */ 46struct sem_undo *semu_list; /* list of active undo structures */ | 47static struct map *semmap; /* semaphore allocation map */ 48static struct sem_undo *semu_list; /* list of active undo structures */ |
47int *semu; /* undo structure pool */ 48 49static struct proc *semlock_holder = NULL; 50 51void 52seminit(dummy) 53 void *dummy; 54{ --- 88 unchanged lines hidden (view full) --- 143 return(eval); 144} 145 146/* 147 * Allocate a new sem_undo structure for a process 148 * (returns ptr to structure or NULL if no more room) 149 */ 150 | 49int *semu; /* undo structure pool */ 50 51static struct proc *semlock_holder = NULL; 52 53void 54seminit(dummy) 55 void *dummy; 56{ --- 88 unchanged lines hidden (view full) --- 145 return(eval); 146} 147 148/* 149 * Allocate a new sem_undo structure for a process 150 * (returns ptr to structure or NULL if no more room) 151 */ 152 |
151struct sem_undo * | 153static struct sem_undo * |
152semu_alloc(p) 153 struct proc *p; 154{ 155 register int i; 156 register struct sem_undo *suptr; 157 register struct sem_undo **supptr; 158 int attempt; 159 --- 53 unchanged lines hidden (view full) --- 213 } 214 return (NULL); 215} 216 217/* 218 * Adjust a particular entry for a particular proc 219 */ 220 | 154semu_alloc(p) 155 struct proc *p; 156{ 157 register int i; 158 register struct sem_undo *suptr; 159 register struct sem_undo **supptr; 160 int attempt; 161 --- 53 unchanged lines hidden (view full) --- 215 } 216 return (NULL); 217} 218 219/* 220 * Adjust a particular entry for a particular proc 221 */ 222 |
221int | 223static int |
222semundo_adjust(p, supptr, semid, semnum, adjval) 223 register struct proc *p; 224 struct sem_undo **supptr; 225 int semid, semnum; 226 int adjval; 227{ 228 register struct sem_undo *suptr; 229 register struct undo *sunptr; --- 50 unchanged lines hidden (view full) --- 280 suptr->un_cnt++; 281 sunptr->un_adjval = adjval; 282 sunptr->un_id = semid; sunptr->un_num = semnum; 283 } else 284 return(EINVAL); 285 return(0); 286} 287 | 224semundo_adjust(p, supptr, semid, semnum, adjval) 225 register struct proc *p; 226 struct sem_undo **supptr; 227 int semid, semnum; 228 int adjval; 229{ 230 register struct sem_undo *suptr; 231 register struct undo *sunptr; --- 50 unchanged lines hidden (view full) --- 282 suptr->un_cnt++; 283 sunptr->un_adjval = adjval; 284 sunptr->un_id = semid; sunptr->un_num = semnum; 285 } else 286 return(EINVAL); 287 return(0); 288} 289 |
288void | 290static void |
289semundo_clear(semid, semnum) 290 int semid, semnum; 291{ 292 register struct sem_undo *suptr; 293 294 for (suptr = semu_list; suptr != NULL; suptr = suptr->un_next) { 295 register struct undo *sunptr = &suptr->un_ent[0]; 296 register int i = 0; --- 561 unchanged lines hidden (view full) --- 858 *retval = 0; 859 return(0); 860} 861 862/* 863 * Go through the undo structures for this process and apply the adjustments to 864 * semaphores. 865 */ | 291semundo_clear(semid, semnum) 292 int semid, semnum; 293{ 294 register struct sem_undo *suptr; 295 296 for (suptr = semu_list; suptr != NULL; suptr = suptr->un_next) { 297 register struct undo *sunptr = &suptr->un_ent[0]; 298 register int i = 0; --- 561 unchanged lines hidden (view full) --- 860 *retval = 0; 861 return(0); 862} 863 864/* 865 * Go through the undo structures for this process and apply the adjustments to 866 * semaphores. 867 */ |
866void | 868static void |
867semexit(p) 868 struct proc *p; 869{ 870 register struct sem_undo *suptr; 871 register struct sem_undo **supptr; 872 int did_something; 873 874 /* --- 96 unchanged lines hidden --- | 869semexit(p) 870 struct proc *p; 871{ 872 register struct sem_undo *suptr; 873 register struct sem_undo **supptr; 874 int did_something; 875 876 /* --- 96 unchanged lines hidden --- |