1 /* $NetBSD: darwin_proc.h,v 1.7 2008/04/28 20:23:41 martin Exp $ */
2
3 /*-
4 * Copyright (c) 2002 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Emmanuel Dreyfus
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
30 */
31
32 #ifndef _DARWIN_PROC_H_
33 #define _DARWIN_PROC_H_
34
35 #include <machine/darwin_machdep.h>
36
37 struct darwin_ucred {
38 u_long cr_ref;
39 uid_t cr_uid;
40 short cr_ngroups;
41 #define DARWIN_NGROUPS 16
42 gid_t cr_groups[DARWIN_NGROUPS];
43 };
44
45 struct darwin_pcred {
46 struct darwin_lock__bsd__ {
47 struct darwin_slock lk_interlock;
48 u_int lk_flags;
49 int lk_sharecount;
50 int lk_waitcount;
51 short lk_exclusivecount;
52 #undef lk_prio /* Defined in <sys/lock.h> */
53 short lk_prio;
54 char *lk_wmesg;
55 #undef lk_timo /* Defined in <sys/lock.h> */
56 int lk_timo;
57 #undef lk_lockholder /* Defined in <sys/lock.h> */
58 pid_t lk_lockholder;
59 void *lk_lockthread;
60 } pc_lock;
61 struct darwin_ucred *pc_ucred;
62 uid_t pc_ruid;
63 uid_t pc_svuid;
64 gid_t pc_rgid;
65 gid_t pc_svgid;
66 int pc_refcnt;
67 };
68
69 struct darwin_vmspace {
70 int vm_refcnt;
71 void *vm_shm;
72 segsz_t vm_rssize;
73 segsz_t vm_swrss;
74 segsz_t vm_tsize;
75 segsz_t vm_dsize;
76 segsz_t vm_ssize;
77 void *vm_taddr;
78 void *vm_daddr;
79 void *vm_maxsaddr;
80 };
81
82 struct darwin_extern_proc {
83 union {
84 struct {
85 struct darwin_proc *__p_forw;
86 struct darwin_proc *__p_back;
87 } p_st1;
88 struct timeval __p_starttime;
89 } p_un;
90 struct darwin_vmspace *p_vmspace;
91 struct darwin_sigacts *p_sigacts;
92 int p_flag;
93 char p_stat;
94 pid_t p_pid;
95 pid_t p_oppid;
96 int p_dupfd;
97 void *user_stack;
98 void *exit_thread;
99 int p_debugger;
100 mach_boolean_t sigwait;
101 u_int p_estcpu;
102 int p_cpticks;
103 fixpt_t p_pctcpu;
104 void *p_wchan;
105 char *p_wmesg;
106 u_int p_swtime;
107 u_int p_slptime;
108 struct itimerval p_realtimer;
109 struct timeval p_rtime;
110 u_quad_t p_uticks;
111 u_quad_t p_sticks;
112 u_quad_t p_iticks;
113 int p_traceflag;
114 struct darwin_vnode *p_tracep;
115 int p_siglist;
116 struct darwin_vnode *p_textvp;
117 int p_holdcnt;
118 sigset13_t p_sigmask;
119 sigset13_t p_sigignore;
120 sigset13_t p_sigcatch;
121 u_char p_priority;
122 u_char p_usrpri;
123 char p_nice;
124 #define DARWIN_MAXCOMLEN 16
125 char p_comm[DARWIN_MAXCOMLEN + 1];
126 struct darwin_pgrp *p_pgrp;
127 struct darwin_user *p_addr;
128 u_short p_xstat;
129 u_short p_acflag;
130 struct darwin_rusage *p_ru;
131 };
132
133 struct darwin_kinfo_proc {
134 /*
135 * kp_proc is a struct darwin_extern_proc.
136 * Declaring struct darwin_extern_proc here causes an allignement
137 * on a word boundary. We replace it by a char array to avoid that.
138 */
139 char kp_proc[196];
140 struct darwin_eproc {
141 struct darwin_proc *e_paddr;
142 struct darwin_session *e_sess;
143 struct darwin_pcred e_pcred;
144 struct darwin_ucred e_ucred;
145 struct darwin_vmspace e_vm;
146 pid_t e_ppid;
147 pid_t e_pgid;
148 short e_jobc;
149 dev_t e_tdev;
150 pid_t e_tpgid;
151 struct darwin_session *e_tsess;
152 #define DARWIN_WMESGLEN 7
153 char e_wmesg[DARWIN_WMESGLEN + 1];
154 segsz_t e_xsize;
155 short e_xrssize;
156 short e_xccount;
157 short e_xswrss;
158 long e_flag;
159 #define DARWIN_EPROC_CTTY 0x01
160 #define DARWIN_EPROC_SLEADER 0x02
161 #define DARWIN_COMAPT_MAXLOGNAME 12
162 char e_login[DARWIN_COMAPT_MAXLOGNAME];
163 long e_spare[4];
164 } kp_eproc;
165 };
166
167 /* p_flag for Darwin */
168 #define DARWIN_P_ADVLOCK 0x00001
169 #define DARWIN_P_CONTROLT 0x00002
170 #define DARWIN_P_INMEM 0x00004
171 #define DARWIN_P_NOCLDSTOP 0x00008
172 #define DARWIN_P_PPWAIT 0x00010
173 #define DARWIN_P_PROFIL 0x00020
174 #define DARWIN_P_SELECT 0x00040
175 #define DARWIN_P_SINTR 0x00080
176 #define DARWIN_P_SUGID 0x00100
177 #define DARWIN_P_SYSTEM 0x00200
178 #define DARWIN_P_TIMEOUT 0x00400
179 #define DARWIN_P_TRACED 0x00800
180 #define DARWIN_P_WAITED 0x01000
181 #define DARWIN_P_WEXIT 0x02000
182 #define DARWIN_P_EXEC 0x04000
183 #define DARWIN_P_OWEUPC 0x08000
184 #define DARWIN_P_FSTRACE 0x10000
185 #define DARWIN_P_SSTEP 0x20000
186 #define DARWIN_P_WAITING 0x0040000
187 #define DARWIN_P_KDEBUG 0x0080000
188 #define DARWIN_P_TTYSLEEP 0x0100000
189 #define DARWIN_P_REBOOT 0x0200000
190 #define DARWIN_P_TBE 0x0400000
191 #define DARWIN_P_SIGEXC 0x0800000
192 #define DARWIN_P_BTRACE 0x1000000
193 #define DARWIN_P_VFORK 0x2000000
194 #define DARWIN_P_NOATTACH 0x4000000
195 #define DARWIN_P_INVFORK 0x8000000
196 #define DARWIN_P_NOSHLIB 0x10000000
197 #define DARWIN_P_FORCEQUOTA 0x20000000
198 #define DARWIN_P_NOCLDWAIT 0x40000000
199
200 #endif /* _DARWIN_PROC_H_ */
Cache object: 8ef865751fd1731ea897ae42ec1d6ccc
|