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 * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
24 */
25
26 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
27 /* All Rights Reserved */
28
29
30 #pragma ident "%Z%%M% %I% %E% SMI"
31
32 #include <sys/types.h>
33 #include <sys/sysmacros.h>
34 #include <sys/param.h>
35 #include <sys/systm.h>
36 #include <sys/file.h>
37 #include <sys/vnode.h>
38 #include <sys/errno.h>
39 #include <sys/signal.h>
40 #include <sys/cred.h>
41 #include <sys/policy.h>
42 #include <sys/conf.h>
43 #include <sys/debug.h>
44 #include <sys/proc.h>
45 #include <sys/session.h>
46 #include <sys/kmem.h>
47 #include <sys/cmn_err.h>
48 #include <sys/strsubr.h>
49 #include <sys/fs/snode.h>
50
51 sess_t session0 = {
52 &pid0, /* s_sidp */
53 {0}, /* s_lock */
54 1, /* s_ref */
55 B_FALSE, /* s_sighuped */
56 B_FALSE, /* s_exit */
57 0, /* s_exit_cv */
58 0, /* s_cnt */
59 0, /* s_cnt_cv */
60 NODEV, /* s_dev */
61 NULL, /* s_vp */
62 NULL /* s_cred */
63 };
64
65 void
66 sess_hold(proc_t *p)
67 {
68 ASSERT(MUTEX_HELD(&pidlock) || MUTEX_HELD(&p->p_splock));
69 mutex_enter(&p->p_sessp->s_lock);
70 p->p_sessp->s_ref++;
71 mutex_exit(&p->p_sessp->s_lock);
72 }
73
74 void
75 sess_rele(sess_t *sp, boolean_t pidlock_held)
76 {
77 ASSERT(MUTEX_HELD(&pidlock) || !pidlock_held);
78
79 mutex_enter(&sp->s_lock);
|
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 * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
24 */
25
26 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
27 /* All Rights Reserved */
28
29
30 #include <sys/types.h>
31 #include <sys/sysmacros.h>
32 #include <sys/param.h>
33 #include <sys/systm.h>
34 #include <sys/file.h>
35 #include <sys/vnode.h>
36 #include <sys/errno.h>
37 #include <sys/signal.h>
38 #include <sys/cred.h>
39 #include <sys/policy.h>
40 #include <sys/conf.h>
41 #include <sys/debug.h>
42 #include <sys/proc.h>
43 #include <sys/session.h>
44 #include <sys/kmem.h>
45 #include <sys/cmn_err.h>
46 #include <sys/strsubr.h>
47 #include <sys/fs/snode.h>
48
49 sess_t session0 = {
50 &pid0, /* s_sidp */
51 {{NULL}}, /* s_lock */
52 1, /* s_ref */
53 B_FALSE, /* s_sighuped */
54 B_FALSE, /* s_exit */
55 {0}, /* s_exit_cv */
56 0, /* s_cnt */
57 {0}, /* s_cnt_cv */
58 NODEV, /* s_dev */
59 NULL, /* s_vp */
60 NULL /* s_cred */
61 };
62
63 void
64 sess_hold(proc_t *p)
65 {
66 ASSERT(MUTEX_HELD(&pidlock) || MUTEX_HELD(&p->p_splock));
67 mutex_enter(&p->p_sessp->s_lock);
68 p->p_sessp->s_ref++;
69 mutex_exit(&p->p_sessp->s_lock);
70 }
71
72 void
73 sess_rele(sess_t *sp, boolean_t pidlock_held)
74 {
75 ASSERT(MUTEX_HELD(&pidlock) || !pidlock_held);
76
77 mutex_enter(&sp->s_lock);
|