sysv_sem.c (67708) | sysv_sem.c (68024) |
---|---|
1/* $FreeBSD: head/sys/kern/sysv_sem.c 67708 2000-10-27 11:45:49Z phk $ */ | 1/* $FreeBSD: head/sys/kern/sysv_sem.c 68024 2000-10-31 01:34:00Z rwatson $ */ |
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 */ --- 4 unchanged lines hidden (view full) --- 14#include <sys/systm.h> 15#include <sys/sysproto.h> 16#include <sys/kernel.h> 17#include <sys/proc.h> 18#include <sys/sem.h> 19#include <sys/sysent.h> 20#include <sys/sysctl.h> 21#include <sys/malloc.h> | 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 */ --- 4 unchanged lines hidden (view full) --- 14#include <sys/systm.h> 15#include <sys/sysproto.h> 16#include <sys/kernel.h> 17#include <sys/proc.h> 18#include <sys/sem.h> 19#include <sys/sysent.h> 20#include <sys/sysctl.h> 21#include <sys/malloc.h> |
22#include <sys/jail.h> |
|
22 23static MALLOC_DEFINE(M_SEM, "sem", "SVID compatible semaphores"); 24 25static void seminit __P((void *)); 26 27#ifndef _SYS_SYSPROTO_H_ 28struct __semctl_args; 29int __semctl __P((struct proc *p, struct __semctl_args *uap)); --- 166 unchanged lines hidden (view full) --- 196 u_int which; 197 int a2; 198 int a3; 199 int a4; 200 int a5; 201 } */ *uap; 202{ 203 | 23 24static MALLOC_DEFINE(M_SEM, "sem", "SVID compatible semaphores"); 25 26static void seminit __P((void *)); 27 28#ifndef _SYS_SYSPROTO_H_ 29struct __semctl_args; 30int __semctl __P((struct proc *p, struct __semctl_args *uap)); --- 166 unchanged lines hidden (view full) --- 197 u_int which; 198 int a2; 199 int a3; 200 int a4; 201 int a5; 202 } */ *uap; 203{ 204 |
205 if (!jail_sysvipc_allowed && p->p_prison != NULL) 206 return (ENOSYS); 207 |
|
204 if (uap->which >= sizeof(semcalls)/sizeof(semcalls[0])) 205 return (EINVAL); 206 return ((*semcalls[uap->which])(p, &uap->a2)); 207} 208 209/* 210 * Allocate a new sem_undo structure for a process 211 * (returns ptr to structure or NULL if no more room) --- 190 unchanged lines hidden (view full) --- 402 int i, rval, eval; 403 struct semid_ds sbuf; 404 register struct semid_ds *semaptr; 405 406#ifdef SEM_DEBUG 407 printf("call to semctl(%d, %d, %d, 0x%x)\n", semid, semnum, cmd, arg); 408#endif 409 | 208 if (uap->which >= sizeof(semcalls)/sizeof(semcalls[0])) 209 return (EINVAL); 210 return ((*semcalls[uap->which])(p, &uap->a2)); 211} 212 213/* 214 * Allocate a new sem_undo structure for a process 215 * (returns ptr to structure or NULL if no more room) --- 190 unchanged lines hidden (view full) --- 406 int i, rval, eval; 407 struct semid_ds sbuf; 408 register struct semid_ds *semaptr; 409 410#ifdef SEM_DEBUG 411 printf("call to semctl(%d, %d, %d, 0x%x)\n", semid, semnum, cmd, arg); 412#endif 413 |
414 if (!jail_sysvipc_allowed && p->p_prison != NULL) 415 return (ENOSYS); 416 |
|
410 semid = IPCID_TO_IX(semid); 411 if (semid < 0 || semid >= seminfo.semmsl) 412 return(EINVAL); 413 414 semaptr = &sema[semid]; 415 if ((semaptr->sem_perm.mode & SEM_ALLOC) == 0 || 416 semaptr->sem_perm.seq != IPCID_TO_SEQ(uap->semid)) 417 return(EINVAL); --- 144 unchanged lines hidden (view full) --- 562 int nsems = uap->nsems; 563 int semflg = uap->semflg; 564 struct ucred *cred = p->p_ucred; 565 566#ifdef SEM_DEBUG 567 printf("semget(0x%x, %d, 0%o)\n", key, nsems, semflg); 568#endif 569 | 417 semid = IPCID_TO_IX(semid); 418 if (semid < 0 || semid >= seminfo.semmsl) 419 return(EINVAL); 420 421 semaptr = &sema[semid]; 422 if ((semaptr->sem_perm.mode & SEM_ALLOC) == 0 || 423 semaptr->sem_perm.seq != IPCID_TO_SEQ(uap->semid)) 424 return(EINVAL); --- 144 unchanged lines hidden (view full) --- 569 int nsems = uap->nsems; 570 int semflg = uap->semflg; 571 struct ucred *cred = p->p_ucred; 572 573#ifdef SEM_DEBUG 574 printf("semget(0x%x, %d, 0%o)\n", key, nsems, semflg); 575#endif 576 |
577 if (!jail_sysvipc_allowed && p->p_prison != NULL) 578 return (ENOSYS); 579 |
|
570 if (key != IPC_PRIVATE) { 571 for (semid = 0; semid < seminfo.semmni; semid++) { 572 if ((sema[semid].sem_perm.mode & SEM_ALLOC) && 573 sema[semid].sem_perm.key == key) 574 break; 575 } 576 if (semid < seminfo.semmni) { 577#ifdef SEM_DEBUG --- 102 unchanged lines hidden (view full) --- 680 struct sem_undo *suptr = NULL; 681 int i, j, eval; 682 int do_wakeup, do_undos; 683 684#ifdef SEM_DEBUG 685 printf("call to semop(%d, 0x%x, %d)\n", semid, sops, nsops); 686#endif 687 | 580 if (key != IPC_PRIVATE) { 581 for (semid = 0; semid < seminfo.semmni; semid++) { 582 if ((sema[semid].sem_perm.mode & SEM_ALLOC) && 583 sema[semid].sem_perm.key == key) 584 break; 585 } 586 if (semid < seminfo.semmni) { 587#ifdef SEM_DEBUG --- 102 unchanged lines hidden (view full) --- 690 struct sem_undo *suptr = NULL; 691 int i, j, eval; 692 int do_wakeup, do_undos; 693 694#ifdef SEM_DEBUG 695 printf("call to semop(%d, 0x%x, %d)\n", semid, sops, nsops); 696#endif 697 |
698 if (!jail_sysvipc_allowed && p->p_prison != NULL) 699 return (ENOSYS); 700 |
|
688 semid = IPCID_TO_IX(semid); /* Convert back to zero origin */ 689 690 if (semid < 0 || semid >= seminfo.semmsl) 691 return(EINVAL); 692 693 semaptr = &sema[semid]; 694 if ((semaptr->sem_perm.mode & SEM_ALLOC) == 0) 695 return(EINVAL); --- 307 unchanged lines hidden --- | 701 semid = IPCID_TO_IX(semid); /* Convert back to zero origin */ 702 703 if (semid < 0 || semid >= seminfo.semmsl) 704 return(EINVAL); 705 706 semaptr = &sema[semid]; 707 if ((semaptr->sem_perm.mode & SEM_ALLOC) == 0) 708 return(EINVAL); --- 307 unchanged lines hidden --- |