4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 /* Copyright (c) 1984 AT&T */
28 /* All Rights Reserved */
30 #pragma ident "%Z%%M% %I% %E% SMI"
32 #include <sys/syscall.h>
34 #include <sys/types.h>
38 /* semsys dispatch argument */
44 semctl(int semid
, int semnum
, int cmd
, union semun
*arg
)
55 return (_syscall(SYS_semsys
, SEMCTL
,
56 semid
, semnum
, cmd
, arg
->val
));
62 return (_syscall(SYS_semsys
, SEMCTL
,
63 semid
, semnum
, cmd
, 0));
68 semget(key_t key
, int nsems
, int semflg
)
70 return (_syscall(SYS_semsys
, SEMGET
, key
, nsems
, semflg
));
74 semop(int semid
, struct sembuf
*sops
, int nsops
)
76 return (_syscall(SYS_semsys
, SEMOP
, semid
, sops
, nsops
));
80 semsys(int sysnum
, ...)
94 semid
= va_arg(ap
, int);
95 semnum
= va_arg(ap
, int);
96 cmd
= va_arg(ap
, int);
97 val
= va_arg(ap
, int);
98 if ((cmd
== IPC_STAT
) || (cmd
== IPC_SET
) || (cmd
== IPC_RMID
))
101 return (_syscall(SYS_semsys
, SEMCTL
, semid
, semnum
, cmd
, val
));
103 key
= va_arg(ap
, key_t
);
104 nsems
= va_arg(ap
, int);
105 semflg
= va_arg(ap
, int);
107 return (semget(key
, nsems
, semflg
));
109 semid
= va_arg(ap
, int);
110 sops
= va_arg(ap
, struct sembuf
*);
111 nsops
= va_arg(ap
, int);
113 return (semop(semid
, sops
, nsops
));