Deleted Added
full compact
sysv_sem.c (121307) sysv_sem.c (122201)
1/*
2 * Implementation of SVID semaphores
3 *
4 * Author: Daniel Boulet
5 *
6 * This software is provided ``AS IS'' without any warranties of any kind.
7 */
8
9#include <sys/cdefs.h>
1/*
2 * Implementation of SVID semaphores
3 *
4 * Author: Daniel Boulet
5 *
6 * This software is provided ``AS IS'' without any warranties of any kind.
7 */
8
9#include <sys/cdefs.h>
10__FBSDID("$FreeBSD: head/sys/kern/sysv_sem.c 121307 2003-10-21 18:28:36Z silby $");
10__FBSDID("$FreeBSD: head/sys/kern/sysv_sem.c 122201 2003-11-07 04:47:14Z rwatson $");
11
12#include "opt_sysvipc.h"
13
14#include <sys/param.h>
15#include <sys/systm.h>
16#include <sys/sysproto.h>
17#include <sys/eventhandler.h>
18#include <sys/kernel.h>

--- 27 unchanged lines hidden (view full) ---

46int __semctl(struct thread *td, struct __semctl_args *uap);
47struct semget_args;
48int semget(struct thread *td, struct semget_args *uap);
49struct semop_args;
50int semop(struct thread *td, struct semop_args *uap);
51#endif
52
53static struct sem_undo *semu_alloc(struct thread *td);
11
12#include "opt_sysvipc.h"
13
14#include <sys/param.h>
15#include <sys/systm.h>
16#include <sys/sysproto.h>
17#include <sys/eventhandler.h>
18#include <sys/kernel.h>

--- 27 unchanged lines hidden (view full) ---

46int __semctl(struct thread *td, struct __semctl_args *uap);
47struct semget_args;
48int semget(struct thread *td, struct semget_args *uap);
49struct semop_args;
50int semop(struct thread *td, struct semop_args *uap);
51#endif
52
53static struct sem_undo *semu_alloc(struct thread *td);
54static int semundo_adjust(struct thread *td, struct sem_undo **supptr,
54static int semundo_adjust(struct thread *td, struct sem_undo **supptr,
55 int semid, int semnum, int adjval);
56static void semundo_clear(int semid, int semnum);
57
58/* XXX casting to (sy_call_t *) is bogus, as usual. */
59static sy_call_t *semcalls[] = {
60 (sy_call_t *)__semctl, (sy_call_t *)semget,
61 (sy_call_t *)semop
62};

--- 459 unchanged lines hidden (view full) ---

522 case SEM_STAT:
523 if (semid < 0 || semid >= seminfo.semmni)
524 return (EINVAL);
525 if ((error = copyin(arg, &real_arg, sizeof(real_arg))) != 0)
526 return (error);
527 semaptr = &sema[semid];
528 sema_mtxp = &sema_mtx[semid];
529 mtx_lock(sema_mtxp);
55 int semid, int semnum, int adjval);
56static void semundo_clear(int semid, int semnum);
57
58/* XXX casting to (sy_call_t *) is bogus, as usual. */
59static sy_call_t *semcalls[] = {
60 (sy_call_t *)__semctl, (sy_call_t *)semget,
61 (sy_call_t *)semop
62};

--- 459 unchanged lines hidden (view full) ---

522 case SEM_STAT:
523 if (semid < 0 || semid >= seminfo.semmni)
524 return (EINVAL);
525 if ((error = copyin(arg, &real_arg, sizeof(real_arg))) != 0)
526 return (error);
527 semaptr = &sema[semid];
528 sema_mtxp = &sema_mtx[semid];
529 mtx_lock(sema_mtxp);
530 if ((semaptr->sem_perm.mode & SEM_ALLOC) == 0 ) {
530 if ((semaptr->sem_perm.mode & SEM_ALLOC) == 0) {
531 error = EINVAL;
532 goto done2;
533 }
534 if ((error = ipcperm(td, &semaptr->sem_perm, IPC_R)))
535 goto done2;
536 mtx_unlock(sema_mtxp);
537 error = copyout(semaptr, real_arg.buf, sizeof(struct semid_ds));
538 rval = IXSEQ_TO_IPCID(semid,semaptr->sem_perm);

--- 692 unchanged lines hidden ---
531 error = EINVAL;
532 goto done2;
533 }
534 if ((error = ipcperm(td, &semaptr->sem_perm, IPC_R)))
535 goto done2;
536 mtx_unlock(sema_mtxp);
537 error = copyout(semaptr, real_arg.buf, sizeof(struct semid_ds));
538 rval = IXSEQ_TO_IPCID(semid,semaptr->sem_perm);

--- 692 unchanged lines hidden ---