4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
28 /* All Rights Reserved */
30 #ifndef _SYS_SEM_IMPL_H
31 #define _SYS_SEM_IMPL_H
33 #pragma ident "%Z%%M% %I% %E% SMI"
35 #include <sys/ipc_impl.h>
36 #if defined(_KERNEL) || defined(_KMEMUSER)
38 #include <sys/t_lock.h>
48 * Argument vectors for the various flavors of semsys().
57 #if defined(_KERNEL) || defined(_KMEMUSER)
60 * There is one semaphore id data structure (semid_ds) for each set of
61 * semaphores in the system.
63 typedef struct ksemid
{
64 kipc_perm_t sem_perm
; /* operation permission struct */
65 struct sem
*sem_base
; /* ptr to first semaphore in set */
66 ushort_t sem_nsems
; /* # of semaphores in set */
67 time_t sem_otime
; /* last semop time */
68 time_t sem_ctime
; /* last change time */
69 int sem_binary
; /* flag indicating semaphore type */
70 int sem_maxops
; /* maximum number of operations */
71 list_t sem_undos
; /* list of undo structures */
75 * There is one semaphore structure (sem) for each semaphore in the system.
78 ushort_t semval
; /* semaphore value */
79 pid_t sempid
; /* pid of last operation */
80 ushort_t semncnt
; /* # awaiting semval > cval */
81 ushort_t semzcnt
; /* # awaiting semval = 0 */
82 kcondvar_t semncnt_cv
;
83 kcondvar_t semzcnt_cv
;
87 * There is one undo structure per process in the system.
90 avl_node_t un_avl
; /* node in per-process avl tree */
91 list_node_t un_list
; /* ptr to next active undo structure */
92 proc_t
*un_proc
; /* back-pointer to process */
93 ksemid_t
*un_sp
; /* back-pointer to semaphore */
94 int un_aoe
[1]; /* adjust on exit values */
98 #if defined(_SYSCALL32)
100 * LP64 view of the ILP32 semid_ds structure
103 struct ipc_perm32 sem_perm
; /* operation permission struct */
104 caddr32_t sem_base
; /* ptr to first semaphore in set */
105 uint16_t sem_nsems
; /* # of semaphores in set */
106 time32_t sem_otime
; /* last semop time */
107 int32_t sem_pad1
; /* reserved for time_t expansion */
108 time32_t sem_ctime
; /* last semop time */
109 int32_t sem_pad2
; /* reserved for time_t expansion */
110 int32_t sem_binary
; /* flag indicating semaphore type */
111 int32_t sem_pad3
[3]; /* reserve area */
116 extern void semexit(proc_t
*);
123 #endif /* _SYS_SEM_IMPL_H */