2 * CDDL HEADER START
3 *
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.
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 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
24 *
25 * Portions Copyright 2009 Chad Mynhier
26 */
27
28 #ifndef _PRTABLE_H
29 #define _PRTABLE_H
30
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34
35 #include <limits.h>
36 #include <zone.h>
37 #include "prstat.h"
38
39 #define PLWP_TBL_SZ 4096 /* hash table of plwp_t structures */
40 #define LWP_ACTIVE 1
41
53
54 typedef struct {
55 zoneid_t z_id;
56 char z_name[ZONENAME_MAX];
57 } zonename_t;
58
59 typedef struct {
60 size_t z_size;
61 size_t z_nent;
62 zonename_t *z_list;
63 } zonetbl_t;
64
65 typedef struct plwp { /* linked list of pointers to lwps */
66 pid_t l_pid;
67 id_t l_lwpid;
68 int l_active;
69 lwp_info_t *l_lwp;
70 struct plwp *l_next;
71 } plwp_t;
72
73 extern void pwd_getname(uid_t, char *, int, int);
74 extern void add_uid(uidtbl_t *, char *);
75 extern int has_uid(uidtbl_t *, uid_t);
76 extern void add_element(table_t *, long);
77 extern int has_element(table_t *, long);
78 extern void add_zone(zonetbl_t *, char *);
79 extern int has_zone(zonetbl_t *, zoneid_t);
80 extern void convert_zone(zonetbl_t *);
81 extern int foreach_element(table_t *, void *, void (*)(long, void *));
82 extern void lwpid_init();
83 extern void lwpid_add(lwp_info_t *, pid_t, id_t);
84 extern lwp_info_t *lwpid_get(pid_t, id_t);
85 extern int lwpid_pidcheck(pid_t);
86 extern void lwpid_del(pid_t, id_t);
87 extern void lwpid_set_active(pid_t, id_t);
88 extern int lwpid_is_active(pid_t, id_t);
89
90 #ifdef __cplusplus
91 }
92 #endif
93
|
2 * CDDL HEADER START
3 *
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.
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 * Copyright (c) 2013 Gary Mills
23 *
24 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
25 * Use is subject to license terms.
26 *
27 * Portions Copyright 2009 Chad Mynhier
28 */
29
30 #ifndef _PRTABLE_H
31 #define _PRTABLE_H
32
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36
37 #include <limits.h>
38 #include <zone.h>
39 #include "prstat.h"
40
41 #define PLWP_TBL_SZ 4096 /* hash table of plwp_t structures */
42 #define LWP_ACTIVE 1
43
55
56 typedef struct {
57 zoneid_t z_id;
58 char z_name[ZONENAME_MAX];
59 } zonename_t;
60
61 typedef struct {
62 size_t z_size;
63 size_t z_nent;
64 zonename_t *z_list;
65 } zonetbl_t;
66
67 typedef struct plwp { /* linked list of pointers to lwps */
68 pid_t l_pid;
69 id_t l_lwpid;
70 int l_active;
71 lwp_info_t *l_lwp;
72 struct plwp *l_next;
73 } plwp_t;
74
75 extern void pwd_getname(uid_t, char *, size_t, int, int, size_t);
76 extern void add_uid(uidtbl_t *, char *);
77 extern int has_uid(uidtbl_t *, uid_t);
78 extern void add_element(table_t *, long);
79 extern int has_element(table_t *, long);
80 extern void add_zone(zonetbl_t *, char *);
81 extern int has_zone(zonetbl_t *, zoneid_t);
82 extern void convert_zone(zonetbl_t *);
83 extern int foreach_element(table_t *, void *, void (*)(long, void *));
84 extern void lwpid_init();
85 extern void lwpid_add(lwp_info_t *, pid_t, id_t);
86 extern lwp_info_t *lwpid_get(pid_t, id_t);
87 extern int lwpid_pidcheck(pid_t);
88 extern void lwpid_del(pid_t, id_t);
89 extern void lwpid_set_active(pid_t, id_t);
90 extern int lwpid_is_active(pid_t, id_t);
91
92 #ifdef __cplusplus
93 }
94 #endif
95
|