]>
Commit | Line | Data |
---|---|---|
0c530ab8 A |
1 | /* |
2 | * Copyright (c) 2005 Apple Computer, Inc. All rights reserved. | |
3 | * | |
2d21ac55 A |
4 | * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ |
5 | * | |
6 | * This file contains Original Code and/or Modifications of Original Code | |
7 | * as defined in and that are subject to the Apple Public Source License | |
8 | * Version 2.0 (the 'License'). You may not use this file except in | |
9 | * compliance with the License. The rights granted to you under the License | |
10 | * may not be used to create, or enable the creation or redistribution of, | |
11 | * unlawful or unlicensed copies of an Apple operating system, or to | |
12 | * circumvent, violate, or enable the circumvention or violation of, any | |
13 | * terms of an Apple operating system software license agreement. | |
14 | * | |
15 | * Please obtain a copy of the License at | |
16 | * http://www.opensource.apple.com/apsl/ and read it before using this file. | |
17 | * | |
18 | * The Original Code and all software distributed under the License are | |
19 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER | |
0c530ab8 A |
20 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, |
21 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
2d21ac55 A |
22 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. |
23 | * Please see the License for the specific language governing rights and | |
24 | * limitations under the License. | |
25 | * | |
26 | * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ | |
0c530ab8 A |
27 | */ |
28 | ||
29 | #ifndef _SYS_PROC_INFO_H | |
30 | #define _SYS_PROC_INFO_H | |
31 | ||
32 | #include <sys/cdefs.h> | |
33 | #include <sys/param.h> | |
34 | #include <sys/types.h> | |
35 | #include <sys/stat.h> | |
36 | #include <sys/mount.h> | |
37 | #include <sys/socket.h> | |
38 | #include <sys/un.h> | |
39 | #include <sys/kern_control.h> | |
40 | #include <net/if.h> | |
41 | #include <net/route.h> | |
42 | #include <netinet/in.h> | |
43 | #include <netinet/tcp.h> | |
44 | ||
45 | __BEGIN_DECLS | |
46 | ||
47 | ||
b0d623f7 | 48 | #define PROC_ALL_PIDS 1 |
0c530ab8 A |
49 | #define PROC_PGRP_ONLY 2 |
50 | #define PROC_TTY_ONLY 3 | |
51 | #define PROC_UID_ONLY 4 | |
52 | #define PROC_RUID_ONLY 5 | |
53 | ||
54 | struct proc_bsdinfo { | |
55 | uint32_t pbi_flags; /* 64bit; emulated etc */ | |
56 | uint32_t pbi_status; | |
57 | uint32_t pbi_xstatus; | |
58 | uint32_t pbi_pid; | |
59 | uint32_t pbi_ppid; | |
60 | uid_t pbi_uid; | |
61 | gid_t pbi_gid; | |
62 | uid_t pbi_ruid; | |
63 | gid_t pbi_rgid; | |
64 | uid_t pbi_svuid; | |
65 | gid_t pbi_svgid; | |
b0d623f7 A |
66 | uint32_t rfu_1; /* reserved */ |
67 | char pbi_comm[MAXCOMLEN]; | |
68 | char pbi_name[2*MAXCOMLEN]; /* empty if no name is registered */ | |
0c530ab8 A |
69 | uint32_t pbi_nfiles; |
70 | uint32_t pbi_pgid; | |
71 | uint32_t pbi_pjobc; | |
72 | uint32_t e_tdev; /* controlling tty dev */ | |
73 | uint32_t e_tpgid; /* tty process group id */ | |
0c530ab8 | 74 | int32_t pbi_nice; |
b0d623f7 A |
75 | uint64_t pbi_start_tvsec; |
76 | uint64_t pbi_start_tvusec; | |
0c530ab8 A |
77 | }; |
78 | ||
79 | ||
80 | ||
81 | /* pbi_flags values */ | |
82 | #define PROC_FLAG_SYSTEM 1 | |
83 | #define PROC_FLAG_TRACED 2 | |
84 | #define PROC_FLAG_INEXIT 4 | |
85 | #define PROC_FLAG_PPWAIT 8 | |
86 | #define PROC_FLAG_LP64 0x10 | |
87 | #define PROC_FLAG_SLEADER 0x20 | |
88 | #define PROC_FLAG_CTTY 0x40 | |
89 | #define PROC_FLAG_CONTROLT 0x80 | |
2d21ac55 | 90 | #define PROC_FLAG_THCWD 0x100 |
b0d623f7 A |
91 | /* process control bits for resource starvation */ |
92 | #define PROC_FLAG_PC_THROTTLE 0x200 | |
93 | #define PROC_FLAG_PC_SUSP 0x400 | |
94 | #define PROC_FLAG_PC_KILL 0x600 | |
95 | #define PROC_FLAG_PC_MASK 0x600 | |
96 | /* process action bits for resource starvation */ | |
97 | #define PROC_FLAG_PA_THROTTLE 0x800 | |
98 | #define PROC_FLAG_PA_SUSP 0x1000 | |
0c530ab8 A |
99 | |
100 | ||
101 | struct proc_taskinfo { | |
b0d623f7 A |
102 | uint64_t pti_virtual_size; /* virtual memory size (bytes) */ |
103 | uint64_t pti_resident_size; /* resident memory size (bytes) */ | |
0c530ab8 A |
104 | uint64_t pti_total_user; /* total time */ |
105 | uint64_t pti_total_system; | |
106 | uint64_t pti_threads_user; /* existing threads only */ | |
107 | uint64_t pti_threads_system; | |
108 | int32_t pti_policy; /* default policy for new threads */ | |
109 | int32_t pti_faults; /* number of page faults */ | |
b0d623f7 A |
110 | int32_t pti_pageins; /* number of actual pageins */ |
111 | int32_t pti_cow_faults; /* number of copy-on-write faults */ | |
0c530ab8 | 112 | int32_t pti_messages_sent; /* number of messages sent */ |
b0d623f7 A |
113 | int32_t pti_messages_received; /* number of messages received */ |
114 | int32_t pti_syscalls_mach; /* number of mach system calls */ | |
115 | int32_t pti_syscalls_unix; /* number of unix system calls */ | |
116 | int32_t pti_csw; /* number of context switches */ | |
0c530ab8 A |
117 | int32_t pti_threadnum; /* number of threads in the task */ |
118 | int32_t pti_numrunning; /* number of running threads */ | |
119 | int32_t pti_priority; /* task priority*/ | |
120 | }; | |
121 | ||
122 | struct proc_taskallinfo { | |
b0d623f7 A |
123 | struct proc_bsdinfo pbsd; |
124 | struct proc_taskinfo ptinfo; | |
0c530ab8 A |
125 | }; |
126 | ||
b0d623f7 | 127 | #define MAXTHREADNAMESIZE 64 |
0c530ab8 A |
128 | |
129 | struct proc_threadinfo { | |
b0d623f7 A |
130 | uint64_t pth_user_time; /* user run time */ |
131 | uint64_t pth_system_time; /* system run time */ | |
132 | int32_t pth_cpu_usage; /* scaled cpu usage percentage */ | |
0c530ab8 | 133 | int32_t pth_policy; /* scheduling policy in effect */ |
b0d623f7 A |
134 | int32_t pth_run_state; /* run state (see below) */ |
135 | int32_t pth_flags; /* various flags (see below) */ | |
136 | int32_t pth_sleep_time; /* number of seconds that thread */ | |
0c530ab8 A |
137 | int32_t pth_curpri; /* cur priority*/ |
138 | int32_t pth_priority; /* priority*/ | |
b0d623f7 A |
139 | int32_t pth_maxpriority; /* max priority*/ |
140 | char pth_name[MAXTHREADNAMESIZE]; /* thread name, if any */ | |
0c530ab8 A |
141 | }; |
142 | ||
143 | struct proc_regioninfo { | |
144 | uint32_t pri_protection; | |
145 | uint32_t pri_max_protection; | |
146 | uint32_t pri_inheritance; | |
147 | uint32_t pri_flags; /* shared, external pager, is submap */ | |
148 | uint64_t pri_offset; | |
149 | uint32_t pri_behavior; | |
150 | uint32_t pri_user_wired_count; | |
151 | uint32_t pri_user_tag; | |
152 | uint32_t pri_pages_resident; | |
153 | uint32_t pri_pages_shared_now_private; | |
b0d623f7 A |
154 | uint32_t pri_pages_swapped_out; |
155 | uint32_t pri_pages_dirtied; | |
156 | uint32_t pri_ref_count; | |
157 | uint32_t pri_shadow_depth; | |
158 | uint32_t pri_share_mode; | |
0c530ab8 A |
159 | uint32_t pri_private_pages_resident; |
160 | uint32_t pri_shared_pages_resident; | |
161 | uint32_t pri_obj_id; | |
2d21ac55 | 162 | uint32_t pri_depth; |
0c530ab8 A |
163 | uint64_t pri_address; |
164 | uint64_t pri_size; | |
0c530ab8 A |
165 | }; |
166 | ||
167 | #define PROC_REGION_SUBMAP 1 | |
168 | #define PROC_REGION_SHARED 2 | |
169 | ||
170 | #define SM_COW 1 | |
171 | #define SM_PRIVATE 2 | |
172 | #define SM_EMPTY 3 | |
173 | #define SM_SHARED 4 | |
174 | #define SM_TRUESHARED 5 | |
175 | #define SM_PRIVATE_ALIASED 6 | |
176 | #define SM_SHARED_ALIASED 7 | |
177 | ||
178 | ||
179 | /* | |
180 | * Thread run states (state field). | |
181 | */ | |
182 | ||
183 | #define TH_STATE_RUNNING 1 /* thread is running normally */ | |
184 | #define TH_STATE_STOPPED 2 /* thread is stopped */ | |
185 | #define TH_STATE_WAITING 3 /* thread is waiting normally */ | |
186 | #define TH_STATE_UNINTERRUPTIBLE 4 /* thread is in an uninterruptible | |
187 | wait */ | |
188 | #define TH_STATE_HALTED 5 /* thread is halted at a | |
189 | clean point */ | |
190 | ||
191 | /* | |
192 | * Thread flags (flags field). | |
193 | */ | |
194 | #define TH_FLAGS_SWAPPED 0x1 /* thread is swapped out */ | |
195 | #define TH_FLAGS_IDLE 0x2 /* thread is an idle thread */ | |
196 | ||
197 | ||
b0d623f7 A |
198 | struct proc_workqueueinfo { |
199 | uint32_t pwq_nthreads; /* total number of workqueue threads */ | |
200 | uint32_t pwq_runthreads; /* total number of running workqueue threads */ | |
201 | uint32_t pwq_blockedthreads; /* total number of blocked workqueue threads */ | |
202 | uint32_t reserved[1]; /* reserved for future use */ | |
203 | }; | |
0c530ab8 A |
204 | |
205 | struct proc_fileinfo { | |
206 | uint32_t fi_openflags; | |
207 | uint32_t fi_status; | |
208 | off_t fi_offset; | |
209 | int32_t fi_type; | |
b0d623f7 | 210 | int32_t rfu_1; /* reserved */ |
0c530ab8 A |
211 | }; |
212 | ||
2d21ac55 A |
213 | /* stats flags in proc_fileinfo */ |
214 | #define PROC_FP_SHARED 1 /* shared by more than one fd */ | |
215 | #define PROC_FP_CLEXEC 2 /* close on exec */ | |
216 | ||
217 | /* | |
218 | * A copy of stat64 with static sized fields. | |
219 | */ | |
220 | struct vinfo_stat { | |
221 | uint32_t vst_dev; /* [XSI] ID of device containing file */ | |
222 | uint16_t vst_mode; /* [XSI] Mode of file (see below) */ | |
223 | uint16_t vst_nlink; /* [XSI] Number of hard links */ | |
224 | uint64_t vst_ino; /* [XSI] File serial number */ | |
225 | uid_t vst_uid; /* [XSI] User ID of the file */ | |
226 | gid_t vst_gid; /* [XSI] Group ID of the file */ | |
227 | int64_t vst_atime; /* [XSI] Time of last access */ | |
228 | int64_t vst_atimensec; /* nsec of last access */ | |
229 | int64_t vst_mtime; /* [XSI] Last data modification time */ | |
230 | int64_t vst_mtimensec; /* last data modification nsec */ | |
231 | int64_t vst_ctime; /* [XSI] Time of last status change */ | |
232 | int64_t vst_ctimensec; /* nsec of last status change */ | |
233 | int64_t vst_birthtime; /* File creation time(birth) */ | |
234 | int64_t vst_birthtimensec; /* nsec of File creation time */ | |
235 | off_t vst_size; /* [XSI] file size, in bytes */ | |
236 | int64_t vst_blocks; /* [XSI] blocks allocated for file */ | |
237 | int32_t vst_blksize; /* [XSI] optimal blocksize for I/O */ | |
238 | uint32_t vst_flags; /* user defined flags for file */ | |
239 | uint32_t vst_gen; /* file generation number */ | |
240 | uint32_t vst_rdev; /* [XSI] Device ID */ | |
241 | int64_t vst_qspare[2]; /* RESERVED: DO NOT USE! */ | |
242 | }; | |
0c530ab8 A |
243 | |
244 | struct vnode_info { | |
2d21ac55 A |
245 | struct vinfo_stat vi_stat; |
246 | int vi_type; | |
2d21ac55 | 247 | int vi_pad; |
b0d623f7 | 248 | fsid_t vi_fsid; |
0c530ab8 A |
249 | }; |
250 | ||
251 | struct vnode_info_path { | |
252 | struct vnode_info vip_vi; | |
b0d623f7 | 253 | char vip_path[MAXPATHLEN]; /* tail end of it */ |
0c530ab8 A |
254 | }; |
255 | ||
256 | struct vnode_fdinfo { | |
2d21ac55 | 257 | struct proc_fileinfo pfi; |
0c530ab8 A |
258 | struct vnode_info pvi; |
259 | }; | |
260 | ||
261 | struct vnode_fdinfowithpath { | |
b0d623f7 A |
262 | struct proc_fileinfo pfi; |
263 | struct vnode_info_path pvip; | |
0c530ab8 A |
264 | }; |
265 | ||
0c530ab8 | 266 | struct proc_regionwithpathinfo { |
b0d623f7 A |
267 | struct proc_regioninfo prp_prinfo; |
268 | struct vnode_info_path prp_vip; | |
0c530ab8 A |
269 | }; |
270 | ||
271 | struct proc_vnodepathinfo { | |
b0d623f7 A |
272 | struct vnode_info_path pvi_cdir; |
273 | struct vnode_info_path pvi_rdir; | |
0c530ab8 A |
274 | }; |
275 | ||
2d21ac55 | 276 | struct proc_threadwithpathinfo { |
b0d623f7 A |
277 | struct proc_threadinfo pt; |
278 | struct vnode_info_path pvip; | |
2d21ac55 | 279 | }; |
0c530ab8 A |
280 | |
281 | /* | |
282 | * Socket | |
283 | */ | |
284 | ||
285 | ||
286 | /* | |
287 | * IPv4 and IPv6 Sockets | |
288 | */ | |
289 | ||
290 | #define INI_IPV4 0x1 | |
291 | #define INI_IPV6 0x2 | |
292 | ||
293 | struct in4in6_addr { | |
b0d623f7 A |
294 | u_int32_t i46a_pad32[3]; |
295 | struct in_addr i46a_addr4; | |
0c530ab8 A |
296 | }; |
297 | ||
298 | struct in_sockinfo { | |
b0d623f7 A |
299 | int insi_fport; /* foreign port */ |
300 | int insi_lport; /* local port */ | |
0c530ab8 A |
301 | uint64_t insi_gencnt; /* generation count of this instance */ |
302 | uint32_t insi_flags; /* generic IP/datagram flags */ | |
303 | uint32_t insi_flow; | |
304 | ||
305 | uint8_t insi_vflag; /* ini_IPV4 or ini_IPV6 */ | |
b0d623f7 A |
306 | uint8_t insi_ip_ttl; /* time to live proto */ |
307 | uint32_t rfu_1; /* reserved */ | |
0c530ab8 A |
308 | /* protocol dependent part */ |
309 | union { | |
b0d623f7 A |
310 | struct in4in6_addr ina_46; |
311 | struct in6_addr ina_6; | |
312 | } insi_faddr; /* foreign host table entry */ | |
0c530ab8 | 313 | union { |
b0d623f7 A |
314 | struct in4in6_addr ina_46; |
315 | struct in6_addr ina_6; | |
316 | } insi_laddr; /* local host table entry */ | |
0c530ab8 | 317 | struct { |
b0d623f7 A |
318 | u_char in4_tos; /* type of service */ |
319 | } insi_v4; | |
0c530ab8 | 320 | struct { |
b0d623f7 A |
321 | uint8_t in6_hlim; |
322 | int in6_cksum; | |
323 | u_short in6_ifindex; | |
324 | short in6_hops; | |
325 | } insi_v6; | |
0c530ab8 A |
326 | }; |
327 | ||
328 | /* | |
329 | * TCP Sockets | |
330 | */ | |
331 | ||
b0d623f7 A |
332 | #define TSI_T_REXMT 0 /* retransmit */ |
333 | #define TSI_T_PERSIST 1 /* retransmit persistence */ | |
334 | #define TSI_T_KEEP 2 /* keep alive */ | |
335 | #define TSI_T_2MSL 3 /* 2*msl quiet time timer */ | |
0c530ab8 A |
336 | #define TSI_T_NTIMERS 4 |
337 | ||
b0d623f7 A |
338 | #define TSI_S_CLOSED 0 /* closed */ |
339 | #define TSI_S_LISTEN 1 /* listening for connection */ | |
340 | #define TSI_S_SYN_SENT 2 /* active, have sent syn */ | |
341 | #define TSI_S_SYN_RECEIVED 3 /* have send and received syn */ | |
342 | #define TSI_S_ESTABLISHED 4 /* established */ | |
343 | #define TSI_S__CLOSE_WAIT 5 /* rcvd fin, waiting for close */ | |
344 | #define TSI_S_FIN_WAIT_1 6 /* have closed, sent fin */ | |
345 | #define TSI_S_CLOSING 7 /* closed xchd FIN; await FIN ACK */ | |
346 | #define TSI_S_LAST_ACK 8 /* had fin and close; await FIN ACK */ | |
347 | #define TSI_S_FIN_WAIT_2 9 /* have closed, fin is acked */ | |
348 | #define TSI_S_TIME_WAIT 10 /* in 2*msl quiet wait after close */ | |
349 | #define TSI_S_RESERVED 11 /* pseudo state: reserved */ | |
0c530ab8 A |
350 | |
351 | struct tcp_sockinfo { | |
b0d623f7 A |
352 | struct in_sockinfo tcpsi_ini; |
353 | int tcpsi_state; | |
354 | int tcpsi_timer[TSI_T_NTIMERS]; | |
355 | int tcpsi_mss; | |
356 | uint32_t tcpsi_flags; | |
357 | uint32_t rfu_1; /* reserved */ | |
358 | uint64_t tcpsi_tp; /* opaque handle of TCP protocol control block */ | |
0c530ab8 A |
359 | }; |
360 | ||
361 | /* | |
362 | * Unix Domain Sockets | |
363 | */ | |
364 | ||
365 | ||
366 | struct un_sockinfo { | |
b0d623f7 A |
367 | uint64_t unsi_conn_so; /* opaque handle of connected socket */ |
368 | uint64_t unsi_conn_pcb; /* opaque handle of connected protocol control block */ | |
0c530ab8 | 369 | union { |
b0d623f7 A |
370 | struct sockaddr_un ua_sun; |
371 | char ua_dummy[SOCK_MAXADDRLEN]; | |
372 | } unsi_addr; /* bound address */ | |
0c530ab8 | 373 | union { |
b0d623f7 A |
374 | struct sockaddr_un ua_sun; |
375 | char ua_dummy[SOCK_MAXADDRLEN]; | |
376 | } unsi_caddr; /* address of socket connected to */ | |
0c530ab8 A |
377 | }; |
378 | ||
379 | /* | |
380 | * PF_NDRV Sockets | |
381 | */ | |
382 | ||
383 | struct ndrv_info { | |
b0d623f7 A |
384 | uint32_t ndrvsi_if_family; |
385 | uint32_t ndrvsi_if_unit; | |
386 | char ndrvsi_if_name[IF_NAMESIZE]; | |
0c530ab8 A |
387 | }; |
388 | ||
389 | /* | |
390 | * Kernel Event Sockets | |
391 | */ | |
392 | ||
393 | struct kern_event_info { | |
b0d623f7 A |
394 | uint32_t kesi_vendor_code_filter; |
395 | uint32_t kesi_class_filter; | |
396 | uint32_t kesi_subclass_filter; | |
0c530ab8 A |
397 | }; |
398 | ||
399 | /* | |
400 | * Kernel Control Sockets | |
401 | */ | |
402 | ||
403 | struct kern_ctl_info { | |
b0d623f7 A |
404 | uint32_t kcsi_id; |
405 | uint32_t kcsi_reg_unit; | |
406 | uint32_t kcsi_flags; /* support flags */ | |
407 | uint32_t kcsi_recvbufsize; /* request more than the default buffer size */ | |
408 | uint32_t kcsi_sendbufsize; /* request more than the default buffer size */ | |
409 | uint32_t kcsi_unit; | |
410 | char kcsi_name[MAX_KCTL_NAME]; /* unique nke identifier, provided by DTS */ | |
0c530ab8 A |
411 | }; |
412 | ||
413 | /* soi_state */ | |
414 | ||
b0d623f7 A |
415 | #define SOI_S_NOFDREF 0x0001 /* no file table ref any more */ |
416 | #define SOI_S_ISCONNECTED 0x0002 /* socket connected to a peer */ | |
417 | #define SOI_S_ISCONNECTING 0x0004 /* in process of connecting to peer */ | |
418 | #define SOI_S_ISDISCONNECTING 0x0008 /* in process of disconnecting */ | |
419 | #define SOI_S_CANTSENDMORE 0x0010 /* can't send more data to peer */ | |
420 | #define SOI_S_CANTRCVMORE 0x0020 /* can't receive more data from peer */ | |
421 | #define SOI_S_RCVATMARK 0x0040 /* at mark on input */ | |
422 | #define SOI_S_PRIV 0x0080 /* privileged for broadcast, raw... */ | |
423 | #define SOI_S_NBIO 0x0100 /* non-blocking ops */ | |
424 | #define SOI_S_ASYNC 0x0200 /* async i/o notify */ | |
425 | #define SOI_S_INCOMP 0x0800 /* Unaccepted, incomplete connection */ | |
426 | #define SOI_S_COMP 0x1000 /* unaccepted, complete connection */ | |
427 | #define SOI_S_ISDISCONNECTED 0x2000 /* socket disconnected from peer */ | |
428 | #define SOI_S_DRAINING 0x4000 /* close waiting for blocked system calls to drain */ | |
0c530ab8 A |
429 | |
430 | struct sockbuf_info { | |
b0d623f7 A |
431 | uint32_t sbi_cc; |
432 | uint32_t sbi_hiwat; /* SO_RCVBUF, SO_SNDBUF */ | |
433 | uint32_t sbi_mbcnt; | |
434 | uint32_t sbi_mbmax; | |
435 | uint32_t sbi_lowat; | |
436 | short sbi_flags; | |
437 | short sbi_timeo; | |
0c530ab8 A |
438 | }; |
439 | ||
440 | enum { | |
b0d623f7 A |
441 | SOCKINFO_GENERIC = 0, |
442 | SOCKINFO_IN = 1, | |
0c530ab8 | 443 | SOCKINFO_TCP = 2, |
b0d623f7 | 444 | SOCKINFO_UN = 3, |
0c530ab8 A |
445 | SOCKINFO_NDRV = 4, |
446 | SOCKINFO_KERN_EVENT = 5, | |
447 | SOCKINFO_KERN_CTL = 6 | |
448 | }; | |
449 | ||
450 | struct socket_info { | |
b0d623f7 | 451 | struct vinfo_stat soi_stat; |
0c530ab8 A |
452 | uint64_t soi_so; /* opaque handle of socket */ |
453 | uint64_t soi_pcb; /* opaque handle of protocol control block */ | |
b0d623f7 A |
454 | int soi_type; |
455 | int soi_protocol; | |
456 | int soi_family; | |
0c530ab8 A |
457 | short soi_options; |
458 | short soi_linger; | |
459 | short soi_state; | |
460 | short soi_qlen; | |
461 | short soi_incqlen; | |
462 | short soi_qlimit; | |
463 | short soi_timeo; | |
464 | u_short soi_error; | |
465 | uint32_t soi_oobmark; | |
b0d623f7 A |
466 | struct sockbuf_info soi_rcv; |
467 | struct sockbuf_info soi_snd; | |
468 | int soi_kind; | |
469 | uint32_t rfu_1; /* reserved */ | |
0c530ab8 | 470 | union { |
b0d623f7 A |
471 | struct in_sockinfo pri_in; /* SOCKINFO_IN */ |
472 | struct tcp_sockinfo pri_tcp; /* SOCKINFO_TCP */ | |
473 | struct un_sockinfo pri_un; /* SOCKINFO_UN */ | |
474 | struct ndrv_info pri_ndrv; /* SOCKINFO_NDRV */ | |
475 | struct kern_event_info pri_kern_event; /* SOCKINFO_KERN_EVENT */ | |
476 | struct kern_ctl_info pri_kern_ctl; /* SOCKINFO_KERN_CTL */ | |
477 | } soi_proto; | |
0c530ab8 A |
478 | }; |
479 | ||
480 | struct socket_fdinfo { | |
b0d623f7 A |
481 | struct proc_fileinfo pfi; |
482 | struct socket_info psi; | |
0c530ab8 A |
483 | }; |
484 | ||
485 | ||
486 | ||
487 | struct psem_info { | |
b0d623f7 | 488 | struct vinfo_stat psem_stat; |
0c530ab8 A |
489 | char psem_name[MAXPATHLEN]; |
490 | }; | |
491 | ||
492 | struct psem_fdinfo { | |
b0d623f7 | 493 | struct proc_fileinfo pfi; |
0c530ab8 A |
494 | struct psem_info pseminfo; |
495 | }; | |
496 | ||
497 | ||
498 | ||
499 | struct pshm_info { | |
b0d623f7 | 500 | struct vinfo_stat pshm_stat; |
0c530ab8 A |
501 | uint64_t pshm_mappaddr; |
502 | char pshm_name[MAXPATHLEN]; | |
503 | }; | |
504 | ||
505 | struct pshm_fdinfo { | |
b0d623f7 A |
506 | struct proc_fileinfo pfi; |
507 | struct pshm_info pshminfo; | |
0c530ab8 A |
508 | }; |
509 | ||
510 | ||
511 | struct pipe_info { | |
b0d623f7 A |
512 | struct vinfo_stat pipe_stat; |
513 | uint64_t pipe_handle; | |
514 | uint64_t pipe_peerhandle; | |
0c530ab8 | 515 | int pipe_status; |
b0d623f7 | 516 | int rfu_1; /* reserved */ |
0c530ab8 A |
517 | }; |
518 | ||
519 | struct pipe_fdinfo { | |
b0d623f7 | 520 | struct proc_fileinfo pfi; |
0c530ab8 A |
521 | struct pipe_info pipeinfo; |
522 | }; | |
523 | ||
524 | ||
525 | struct kqueue_info { | |
b0d623f7 A |
526 | struct vinfo_stat kq_stat; |
527 | uint32_t kq_state; | |
528 | uint32_t rfu_1; /* reserved */ | |
0c530ab8 A |
529 | }; |
530 | #define PROC_KQUEUE_SELECT 1 | |
531 | #define PROC_KQUEUE_SLEEP 2 | |
532 | ||
533 | struct kqueue_fdinfo { | |
b0d623f7 | 534 | struct proc_fileinfo pfi; |
0c530ab8 A |
535 | struct kqueue_info kqueueinfo; |
536 | }; | |
537 | ||
538 | struct appletalk_info { | |
b0d623f7 | 539 | struct vinfo_stat atalk_stat; |
0c530ab8 A |
540 | }; |
541 | ||
542 | struct appletalk_fdinfo { | |
b0d623f7 A |
543 | struct proc_fileinfo pfi; |
544 | struct appletalk_info appletalkinfo; | |
0c530ab8 A |
545 | }; |
546 | ||
547 | ||
548 | ||
549 | /* defns of process file desc type */ | |
b0d623f7 A |
550 | #define PROX_FDTYPE_ATALK 0 |
551 | #define PROX_FDTYPE_VNODE 1 | |
552 | #define PROX_FDTYPE_SOCKET 2 | |
553 | #define PROX_FDTYPE_PSHM 3 | |
554 | #define PROX_FDTYPE_PSEM 4 | |
555 | #define PROX_FDTYPE_KQUEUE 5 | |
556 | #define PROX_FDTYPE_PIPE 6 | |
557 | #define PROX_FDTYPE_FSEVENTS 7 | |
0c530ab8 A |
558 | |
559 | struct proc_fdinfo { | |
b0d623f7 A |
560 | int32_t proc_fd; |
561 | uint32_t proc_fdtype; | |
0c530ab8 A |
562 | }; |
563 | ||
b0d623f7 A |
564 | /* Flavors for proc_pidinfo() */ |
565 | #define PROC_PIDLISTFDS 1 | |
566 | #define PROC_PIDLISTFD_SIZE (sizeof(struct proc_fdinfo)) | |
0c530ab8 | 567 | |
b0d623f7 A |
568 | #define PROC_PIDTASKALLINFO 2 |
569 | #define PROC_PIDTASKALLINFO_SIZE (sizeof(struct proc_taskallinfo)) | |
0c530ab8 | 570 | |
b0d623f7 A |
571 | #define PROC_PIDTBSDINFO 3 |
572 | #define PROC_PIDTBSDINFO_SIZE (sizeof(struct proc_bsdinfo)) | |
0c530ab8 | 573 | |
b0d623f7 A |
574 | #define PROC_PIDTASKINFO 4 |
575 | #define PROC_PIDTASKINFO_SIZE (sizeof(struct proc_taskinfo)) | |
0c530ab8 | 576 | |
b0d623f7 A |
577 | #define PROC_PIDTHREADINFO 5 |
578 | #define PROC_PIDTHREADINFO_SIZE (sizeof(struct proc_threadinfo)) | |
0c530ab8 | 579 | |
b0d623f7 A |
580 | #define PROC_PIDLISTTHREADS 6 |
581 | #define PROC_PIDLISTTHREADS_SIZE (2* sizeof(uint32_t)) | |
0c530ab8 A |
582 | |
583 | ||
b0d623f7 A |
584 | #define PROC_PIDREGIONINFO 7 |
585 | #define PROC_PIDREGIONINFO_SIZE (sizeof(struct proc_regioninfo)) | |
0c530ab8 | 586 | |
b0d623f7 A |
587 | #define PROC_PIDREGIONPATHINFO 8 |
588 | #define PROC_PIDREGIONPATHINFO_SIZE (sizeof(struct proc_regionwithpathinfo)) | |
0c530ab8 | 589 | |
b0d623f7 A |
590 | #define PROC_PIDVNODEPATHINFO 9 |
591 | #define PROC_PIDVNODEPATHINFO_SIZE (sizeof(struct proc_vnodepathinfo)) | |
0c530ab8 | 592 | |
b0d623f7 A |
593 | #define PROC_PIDTHREADPATHINFO 10 |
594 | #define PROC_PIDTHREADPATHINFO_SIZE (sizeof(struct proc_threadwithpathinfo)) | |
2d21ac55 | 595 | |
b0d623f7 A |
596 | #define PROC_PIDPATHINFO 11 |
597 | #define PROC_PIDPATHINFO_SIZE (MAXPATHLEN) | |
598 | #define PROC_PIDPATHINFO_MAXSIZE (4*MAXPATHLEN) | |
2d21ac55 | 599 | |
b0d623f7 A |
600 | #define PROC_PIDWORKQUEUEINFO 12 |
601 | #define PROC_PIDWORKQUEUEINFO_SIZE (sizeof(struct proc_workqueueinfo)) | |
0c530ab8 | 602 | |
b0d623f7 | 603 | /* Flavors for proc_pidfdinfo */ |
0c530ab8 | 604 | |
b0d623f7 A |
605 | #define PROC_PIDFDVNODEINFO 1 |
606 | #define PROC_PIDFDVNODEINFO_SIZE (sizeof(struct vnode_fdinfo)) | |
0c530ab8 | 607 | |
b0d623f7 A |
608 | #define PROC_PIDFDVNODEPATHINFO 2 |
609 | #define PROC_PIDFDVNODEPATHINFO_SIZE (sizeof(struct vnode_fdinfowithpath)) | |
0c530ab8 | 610 | |
b0d623f7 A |
611 | #define PROC_PIDFDSOCKETINFO 3 |
612 | #define PROC_PIDFDSOCKETINFO_SIZE (sizeof(struct socket_fdinfo)) | |
0c530ab8 | 613 | |
b0d623f7 A |
614 | #define PROC_PIDFDPSEMINFO 4 |
615 | #define PROC_PIDFDPSEMINFO_SIZE (sizeof(struct psem_fdinfo)) | |
0c530ab8 | 616 | |
b0d623f7 A |
617 | #define PROC_PIDFDPSHMINFO 5 |
618 | #define PROC_PIDFDPSHMINFO_SIZE (sizeof(struct pshm_fdinfo)) | |
0c530ab8 | 619 | |
b0d623f7 A |
620 | #define PROC_PIDFDPIPEINFO 6 |
621 | #define PROC_PIDFDPIPEINFO_SIZE (sizeof(struct pipe_fdinfo)) | |
0c530ab8 | 622 | |
b0d623f7 A |
623 | #define PROC_PIDFDKQUEUEINFO 7 |
624 | #define PROC_PIDFDKQUEUEINFO_SIZE (sizeof(struct kqueue_fdinfo)) | |
0c530ab8 | 625 | |
b0d623f7 A |
626 | #define PROC_PIDFDATALKINFO 8 |
627 | #define PROC_PIDFDATALKINFO_SIZE (sizeof(struct appletalk_fdinfo)) | |
0c530ab8 | 628 | |
b0d623f7 A |
629 | /* used for proc_setcontrol */ |
630 | #define PROC_SELFSET_PCONTROL 1 | |
0c530ab8 A |
631 | |
632 | #ifdef XNU_KERNEL_PRIVATE | |
b0d623f7 A |
633 | #ifndef pshmnode |
634 | struct pshmnode; | |
635 | #endif | |
636 | ||
637 | #ifndef psemnode | |
638 | struct psemnode ; | |
639 | #endif | |
640 | ||
641 | #ifndef pipe | |
642 | struct pipe; | |
643 | #endif | |
644 | ||
0c530ab8 A |
645 | extern int fill_socketinfo(socket_t so, struct socket_info *si); |
646 | extern int fill_pshminfo(struct pshmnode * pshm, struct pshm_info * pinfo); | |
647 | extern int fill_pseminfo(struct psemnode * psem, struct psem_info * pinfo); | |
648 | extern int fill_pipeinfo(struct pipe * cpipe, struct pipe_info * pinfo); | |
649 | extern int fill_kqueueinfo(struct kqueue * kq, struct kqueue_info * kinfo); | |
b0d623f7 | 650 | extern int fill_procworkqueue(proc_t, struct proc_workqueueinfo *); |
0c530ab8 A |
651 | #endif /* XNU_KERNEL_PRIVATE */ |
652 | ||
0c530ab8 A |
653 | __END_DECLS |
654 | ||
655 | #endif /*_SYS_PROC_INFO_H */ |