5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
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.
12 *
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]
18 *
19 * CDDL HEADER END
20 */
21
22 /*
23 * Copyright (c) 1988, 2010, Oracle and/or its affiliates. All rights reserved.
24 * Copyright 2013 Nexenta Systems, Inc. All rights reserved.
25 */
26
27 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
28 /* All Rights Reserved */
29
30 #ifndef _SYS_PROC_H
31 #define _SYS_PROC_H
32
33 #include <sys/time.h>
34 #include <sys/thread.h>
35 #include <sys/cred.h>
36 #include <sys/debug.h>
37 #include <sys/signal.h>
38 #include <sys/list.h>
39 #include <sys/avl.h>
40 #include <sys/refstr.h>
41
42 #ifdef __cplusplus
43 extern "C" {
44 #endif
93
94 #define PID_HOLD(pidp) ASSERT(MUTEX_HELD(&pidlock)); \
95 ++(pidp)->pid_ref;
96 #define PID_RELE(pidp) ASSERT(MUTEX_HELD(&pidlock)); \
97 (pidp)->pid_ref > 1 ? \
98 --(pidp)->pid_ref : pid_rele(pidp);
99
100 /*
101 * Structure containing persistent process lock. The structure and
102 * macro allow "mutex_enter(&p->p_lock)" to continue working.
103 */
104 struct plock {
105 kmutex_t pl_lock;
106 };
107 #define p_lock p_lockp->pl_lock
108
109 extern proc_t p0; /* process 0 */
110 extern struct plock p0lock; /* p0's plock */
111 extern struct pid pid0; /* p0's pid */
112
113
114 /*
115 * This is normally in sunddi.h but
116 * I didn't want to drag that in here.
117 */
118 pid_t
119 ddi_get_pid(void);
120
121 #ifdef __cplusplus
122 }
123 #endif
124
125 #endif /* _SYS_PROC_H */
|
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
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.
12 *
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]
18 *
19 * CDDL HEADER END
20 */
21
22 /*
23 * Copyright (c) 1988, 2010, Oracle and/or its affiliates. All rights reserved.
24 * Copyright 2013 Nexenta Systems, Inc. All rights reserved.
25 * Copyright 2017 RackTop Systems.
26 */
27
28 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
29 /* All Rights Reserved */
30
31 #ifndef _SYS_PROC_H
32 #define _SYS_PROC_H
33
34 #include <sys/time.h>
35 #include <sys/thread.h>
36 #include <sys/cred.h>
37 #include <sys/debug.h>
38 #include <sys/signal.h>
39 #include <sys/list.h>
40 #include <sys/avl.h>
41 #include <sys/refstr.h>
42
43 #ifdef __cplusplus
44 extern "C" {
45 #endif
94
95 #define PID_HOLD(pidp) ASSERT(MUTEX_HELD(&pidlock)); \
96 ++(pidp)->pid_ref;
97 #define PID_RELE(pidp) ASSERT(MUTEX_HELD(&pidlock)); \
98 (pidp)->pid_ref > 1 ? \
99 --(pidp)->pid_ref : pid_rele(pidp);
100
101 /*
102 * Structure containing persistent process lock. The structure and
103 * macro allow "mutex_enter(&p->p_lock)" to continue working.
104 */
105 struct plock {
106 kmutex_t pl_lock;
107 };
108 #define p_lock p_lockp->pl_lock
109
110 extern proc_t p0; /* process 0 */
111 extern struct plock p0lock; /* p0's plock */
112 extern struct pid pid0; /* p0's pid */
113
114 extern int issig(int);
115 #define ISSIG(thr, why) issig(why)
116
117 /* Reasons for calling issig() */
118
119 #define FORREAL 0 /* Usual side-effects */
120 #define JUSTLOOKING 1 /* Don't stop the process */
121
122 extern void tsd_create(uint_t *, void (*)(void *));
123 extern void tsd_destroy(uint_t *);
124 extern void *tsd_get(uint_t);
125 extern int tsd_set(uint_t, void *);
126
127 /*
128 * This is normally in sunddi.h but
129 * I didn't want to drag that in here.
130 */
131 pid_t
132 ddi_get_pid(void);
133
134 #ifdef __cplusplus
135 }
136 #endif
137
138 #endif /* _SYS_PROC_H */
|