1 /* Copyright (C) 1995, 1997, 1998 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3 Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public License as
7 published by the Free Software Foundation; either version 2 of the
8 License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
15 You should have received a copy of the GNU Library General Public
16 License along with the GNU C Library; see the file COPYING.LIB. If not,
17 write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. */
26 /* Return identifier for array of NSEMS semaphores associated with
29 /* arg for semctl system calls. */
31 int val; /* value for SETVAL */
32 struct semid_ds *buf; /* buffer for IPC_STAT & IPC_SET */
33 unsigned short *array; /* array for GETALL & SETALL */
34 struct seminfo *__buf; /* buffer for IPC_INFO */
40 #define __NR___semctl __NR_semctl
41 static inline _syscall4(int, __semctl, int, semid, int, semnum, int, cmd, void *, arg);
44 int semctl(int semid, int semnum, int cmd, ...)
49 /* Get the argument. */
51 arg = va_arg (ap, union semun);
54 return __semctl(semid, semnum, cmd | __IPC_64, arg.__pad);
56 return __syscall_ipc(IPCOP_semctl, semid, semnum, cmd | __IPC_64, &arg, 0);
62 /* for definition of NULL */
66 _syscall3(int, semget, key_t, key, int, nsems, int, semflg);
69 /* Return identifier for array of NSEMS semaphores associated
71 int semget (key_t key, int nsems, int semflg)
73 return __syscall_ipc(IPCOP_semget, key, nsems, semflg, NULL, 0);
81 _syscall3(int, semop, int, semid, struct sembuf *, sops, size_t, nsops);
84 /* Perform user-defined atomical operation of array of semaphores. */
85 int semop (int semid, struct sembuf *sops, size_t nsops)
87 return __syscall_ipc(IPCOP_semop, semid, (int) nsops, 0, sops, 0);
94 #ifdef __NR_semtimedop
95 _syscall4(int, semtimedop, int, semid, struct sembuf *, sops, size_t, nsops, const struct timespec *, timeout);
99 int semtimedop(int semid, struct sembuf *sops, size_t nsops,
100 const struct timespec *timeout)
102 return __syscall_ipc(IPCOP_semtimedop, semid, nsops, 0, sops, timeout);