]>
Commit | Line | Data |
---|---|---|
1c79356b | 1 | /* |
a39ff7e2 | 2 | * Copyright (c) 2000-2018 Apple Inc. All rights reserved. |
5d5c5d0d | 3 | * |
2d21ac55 | 4 | * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ |
39037602 | 5 | * |
2d21ac55 A |
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. | |
39037602 | 14 | * |
2d21ac55 A |
15 | * Please obtain a copy of the License at |
16 | * http://www.opensource.apple.com/apsl/ and read it before using this file. | |
39037602 | 17 | * |
2d21ac55 A |
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 | |
8f6c56a5 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. | |
39037602 | 25 | * |
2d21ac55 | 26 | * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ |
1c79356b A |
27 | */ |
28 | /* Copyright (c) 1995, 1997 Apple Computer, Inc. All Rights Reserved */ | |
29 | /*- | |
30 | * Copyright (c) 1986, 1989, 1991, 1993 | |
31 | * The Regents of the University of California. All rights reserved. | |
32 | * (c) UNIX System Laboratories, Inc. | |
33 | * All or some portions of this file are derived from material licensed | |
34 | * to the University of California by American Telephone and Telegraph | |
35 | * Co. or Unix System Laboratories, Inc. and are reproduced herein with | |
36 | * the permission of UNIX System Laboratories, Inc. | |
37 | * | |
38 | * Redistribution and use in source and binary forms, with or without | |
39 | * modification, are permitted provided that the following conditions | |
40 | * are met: | |
41 | * 1. Redistributions of source code must retain the above copyright | |
42 | * notice, this list of conditions and the following disclaimer. | |
43 | * 2. Redistributions in binary form must reproduce the above copyright | |
44 | * notice, this list of conditions and the following disclaimer in the | |
45 | * documentation and/or other materials provided with the distribution. | |
46 | * 3. All advertising materials mentioning features or use of this software | |
47 | * must display the following acknowledgement: | |
48 | * This product includes software developed by the University of | |
49 | * California, Berkeley and its contributors. | |
50 | * 4. Neither the name of the University nor the names of its contributors | |
51 | * may be used to endorse or promote products derived from this software | |
52 | * without specific prior written permission. | |
53 | * | |
54 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | |
55 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
56 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
57 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
58 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
59 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
60 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
61 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
62 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
63 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
64 | * SUCH DAMAGE. | |
65 | * | |
66 | * @(#)proc.h 8.15 (Berkeley) 5/19/95 | |
67 | */ | |
68 | ||
69 | #ifndef _SYS_PROC_H_ | |
70 | #define _SYS_PROC_H_ | |
71 | ||
9bccf70c | 72 | #include <sys/appleapiopts.h> |
1c79356b | 73 | #include <sys/cdefs.h> |
1c79356b A |
74 | #include <sys/select.h> /* For struct selinfo. */ |
75 | #include <sys/queue.h> | |
76 | #include <sys/lock.h> | |
77 | #include <sys/param.h> | |
55e303ae | 78 | #include <sys/event.h> |
5ba3f43e | 79 | #include <sys/time.h> |
91447636 A |
80 | #ifdef KERNEL |
81 | #include <sys/kernel_types.h> | |
fe8ab488 | 82 | #include <uuid/uuid.h> |
91447636 A |
83 | #endif |
84 | #include <mach/boolean.h> | |
1c79356b | 85 | |
3e170ce0 A |
86 | #ifdef XNU_KERNEL_PRIVATE |
87 | #include <mach/coalition.h> /* COALITION_NUM_TYPES */ | |
88 | #endif | |
89 | ||
39037602 | 90 | #if defined(XNU_KERNEL_PRIVATE) || !defined(KERNEL) |
1c79356b | 91 | |
9bccf70c A |
92 | struct session; |
93 | struct pgrp; | |
94 | struct proc; | |
9bccf70c | 95 | |
1c79356b A |
96 | /* Exported fields for kern sysctls */ |
97 | struct extern_proc { | |
9bccf70c A |
98 | union { |
99 | struct { | |
100 | struct proc *__p_forw; /* Doubly-linked run/sleep queue. */ | |
101 | struct proc *__p_back; | |
102 | } p_st1; | |
103 | struct timeval __p_starttime; /* process start time */ | |
104 | } p_un; | |
105 | #define p_forw p_un.p_st1.__p_forw | |
106 | #define p_back p_un.p_st1.__p_back | |
107 | #define p_starttime p_un.__p_starttime | |
1c79356b A |
108 | struct vmspace *p_vmspace; /* Address space. */ |
109 | struct sigacts *p_sigacts; /* Signal actions, state (PROC ONLY). */ | |
110 | int p_flag; /* P_* flags. */ | |
111 | char p_stat; /* S* process status. */ | |
112 | pid_t p_pid; /* Process identifier. */ | |
113 | pid_t p_oppid; /* Save parent pid during ptrace. XXX */ | |
114 | int p_dupfd; /* Sideways return value from fdopen. XXX */ | |
115 | /* Mach related */ | |
116 | caddr_t user_stack; /* where user stack was allocated */ | |
117 | void *exit_thread; /* XXX Which thread is exiting? */ | |
118 | int p_debugger; /* allow to debug */ | |
119 | boolean_t sigwait; /* indication to suspend */ | |
120 | /* scheduling */ | |
121 | u_int p_estcpu; /* Time averaged value of p_cpticks. */ | |
122 | int p_cpticks; /* Ticks of cpu time. */ | |
123 | fixpt_t p_pctcpu; /* %cpu for this process during p_swtime */ | |
124 | void *p_wchan; /* Sleep address. */ | |
125 | char *p_wmesg; /* Reason for sleep. */ | |
126 | u_int p_swtime; /* Time swapped in or out. */ | |
127 | u_int p_slptime; /* Time since last blocked. */ | |
128 | struct itimerval p_realtimer; /* Alarm timer. */ | |
129 | struct timeval p_rtime; /* Real time. */ | |
130 | u_quad_t p_uticks; /* Statclock hits in user mode. */ | |
131 | u_quad_t p_sticks; /* Statclock hits in system mode. */ | |
132 | u_quad_t p_iticks; /* Statclock hits processing intr. */ | |
133 | int p_traceflag; /* Kernel trace points. */ | |
134 | struct vnode *p_tracep; /* Trace to vnode. */ | |
b0d623f7 | 135 | int p_siglist; /* DEPRECATED. */ |
1c79356b A |
136 | struct vnode *p_textvp; /* Vnode of executable. */ |
137 | int p_holdcnt; /* If non-zero, don't swap. */ | |
9bccf70c | 138 | sigset_t p_sigmask; /* DEPRECATED. */ |
1c79356b A |
139 | sigset_t p_sigignore; /* Signals being ignored. */ |
140 | sigset_t p_sigcatch; /* Signals being caught by user. */ | |
141 | u_char p_priority; /* Process priority. */ | |
142 | u_char p_usrpri; /* User-priority based on p_cpu and p_nice. */ | |
143 | char p_nice; /* Process "nice" value. */ | |
144 | char p_comm[MAXCOMLEN+1]; | |
145 | struct pgrp *p_pgrp; /* Pointer to process group. */ | |
146 | struct user *p_addr; /* Kernel virtual addr of u-area (PROC ONLY). */ | |
147 | u_short p_xstat; /* Exit status for wait; also stop signal. */ | |
148 | u_short p_acflag; /* Accounting flags. */ | |
149 | struct rusage *p_ru; /* Exit information. XXX */ | |
150 | }; | |
151 | ||
1c79356b A |
152 | |
153 | /* Status values. */ | |
154 | #define SIDL 1 /* Process being created by fork. */ | |
155 | #define SRUN 2 /* Currently runnable. */ | |
156 | #define SSLEEP 3 /* Sleeping on an address. */ | |
157 | #define SSTOP 4 /* Process debugging or suspension. */ | |
158 | #define SZOMB 5 /* Awaiting collection by parent. */ | |
159 | ||
2d21ac55 | 160 | /* These flags are kept in extern_proc.p_flag. */ |
91447636 A |
161 | #define P_ADVLOCK 0x00000001 /* Process may hold POSIX adv. lock */ |
162 | #define P_CONTROLT 0x00000002 /* Has a controlling terminal */ | |
163 | #define P_LP64 0x00000004 /* Process is LP64 */ | |
164 | #define P_NOCLDSTOP 0x00000008 /* No SIGCHLD when children stop */ | |
165 | ||
166 | #define P_PPWAIT 0x00000010 /* Parent waiting for chld exec/exit */ | |
167 | #define P_PROFIL 0x00000020 /* Has started profiling */ | |
168 | #define P_SELECT 0x00000040 /* Selecting; wakeup/waiting danger */ | |
169 | #define P_CONTINUED 0x00000080 /* Process was stopped and continued */ | |
170 | ||
171 | #define P_SUGID 0x00000100 /* Has set privileges since last exec */ | |
172 | #define P_SYSTEM 0x00000200 /* Sys proc: no sigs, stats or swap */ | |
173 | #define P_TIMEOUT 0x00000400 /* Timing out during sleep */ | |
174 | #define P_TRACED 0x00000800 /* Debugged process being traced */ | |
175 | ||
6d2010ae | 176 | #define P_DISABLE_ASLR 0x00001000 /* Disable address space layout randomization */ |
2d21ac55 | 177 | #define P_WEXIT 0x00002000 /* Working on exiting */ |
91447636 | 178 | #define P_EXEC 0x00004000 /* Process called exec. */ |
1c79356b | 179 | |
1c79356b | 180 | /* Should be moved to machine-dependent areas. */ |
91447636 | 181 | #define P_OWEUPC 0x00008000 /* Owe process an addupc() call at next ast. */ |
1c79356b | 182 | |
91447636 | 183 | #define P_AFFINITY 0x00010000 /* xxx */ |
0c530ab8 A |
184 | #define P_TRANSLATED 0x00020000 /* xxx */ |
185 | #define P_CLASSIC P_TRANSLATED /* xxx */ | |
1c79356b | 186 | |
316670eb | 187 | #define P_DELAYIDLESLEEP 0x00040000 /* Process is marked to delay idle sleep on disk IO */ |
2d21ac55 | 188 | #define P_CHECKOPENEVT 0x00080000 /* check if a vnode has the OPENEVT flag set on open */ |
91447636 | 189 | |
2d21ac55 | 190 | #define P_DEPENDENCY_CAPABLE 0x00100000 /* process is ok to call vfs_markdependency() */ |
91447636 | 191 | #define P_REBOOT 0x00200000 /* Process called reboot() */ |
fe8ab488 | 192 | #define P_RESV6 0x00400000 /* used to be P_TBE */ |
2d21ac55 | 193 | #define P_RESV7 0x00800000 /* (P_SIGEXC)signal exceptions */ |
91447636 | 194 | |
2d21ac55 A |
195 | #define P_THCWD 0x01000000 /* process has thread cwd */ |
196 | #define P_RESV9 0x02000000 /* (P_VFORK)process has vfork children */ | |
490019cf | 197 | #define P_ADOPTPERSONA 0x04000000 /* process adopted a persona (used to be P_NOATTACH) */ |
2d21ac55 | 198 | #define P_RESV11 0x08000000 /* (P_INVFORK) proc in vfork */ |
91447636 | 199 | |
9bccf70c A |
200 | #define P_NOSHLIB 0x10000000 /* no shared libs are in use for proc */ |
201 | /* flag set on exec */ | |
202 | #define P_FORCEQUOTA 0x20000000 /* Force quota for root */ | |
203 | #define P_NOCLDWAIT 0x40000000 /* No zombies when chil procs exit */ | |
55e303ae | 204 | #define P_NOREMOTEHANG 0x80000000 /* Don't hang on remote FS ops */ |
0b4e3aa0 | 205 | |
91447636 A |
206 | #define P_INMEM 0 /* Obsolete: retained for compilation */ |
207 | #define P_NOSWAP 0 /* Obsolete: retained for compilation */ | |
208 | #define P_PHYSIO 0 /* Obsolete: retained for compilation */ | |
209 | #define P_FSTRACE 0 /* Obsolete: retained for compilation */ | |
210 | #define P_SSTEP 0 /* Obsolete: retained for compilation */ | |
1c79356b | 211 | |
316670eb A |
212 | #define P_DIRTY_TRACK 0x00000001 /* track dirty state */ |
213 | #define P_DIRTY_ALLOW_IDLE_EXIT 0x00000002 /* process can be idle-exited when clean */ | |
39236c6e A |
214 | #define P_DIRTY_DEFER 0x00000004 /* defer initial opt-in to idle-exit */ |
215 | #define P_DIRTY 0x00000008 /* process is dirty */ | |
216 | #define P_DIRTY_SHUTDOWN 0x00000010 /* process is dirty during shutdown */ | |
217 | #define P_DIRTY_TERMINATED 0x00000020 /* process has been marked for termination */ | |
218 | #define P_DIRTY_BUSY 0x00000040 /* serialization flag */ | |
219 | #define P_DIRTY_MARKED 0x00000080 /* marked dirty previously */ | |
39037602 | 220 | #define P_DIRTY_AGING_IN_PROGRESS 0x00000100 /* aging in one of the 'aging bands' */ |
fe8ab488 | 221 | #define P_DIRTY_LAUNCH_IN_PROGRESS 0x00000200 /* launch is in progress */ |
d9a64523 A |
222 | #define P_DIRTY_DEFER_ALWAYS 0x00000400 /* defer going to idle-exit after every dirty->clean transition. |
223 | * For legacy jetsam policy only. This is the default with the other policies.*/ | |
316670eb | 224 | |
316670eb | 225 | #define P_DIRTY_IS_DIRTY (P_DIRTY | P_DIRTY_SHUTDOWN) |
39236c6e | 226 | #define P_DIRTY_IDLE_EXIT_ENABLED (P_DIRTY_TRACK|P_DIRTY_ALLOW_IDLE_EXIT) |
316670eb | 227 | |
b0d623f7 | 228 | #endif /* XNU_KERNEL_PRIVATE || !KERNEL */ |
1c79356b A |
229 | |
230 | #ifdef KERNEL | |
1c79356b | 231 | __BEGIN_DECLS |
91447636 A |
232 | |
233 | extern proc_t kernproc; | |
234 | ||
2d21ac55 A |
235 | extern int proc_is_classic(proc_t p); |
236 | proc_t current_proc_EXTERNAL(void); | |
9bccf70c | 237 | |
91447636 | 238 | extern int msleep(void *chan, lck_mtx_t *mtx, int pri, const char *wmesg, struct timespec * ts ); |
91447636 A |
239 | extern void wakeup(void *chan); |
240 | extern void wakeup_one(caddr_t chan); | |
241 | ||
242 | /* proc kpis */ | |
243 | /* this routine returns the pid of the current process */ | |
244 | extern int proc_selfpid(void); | |
245 | /* this routine returns the pid of the parent of the current process */ | |
246 | extern int proc_selfppid(void); | |
490019cf A |
247 | /* this routine returns the csflags of the current process */ |
248 | extern int proc_selfcsflags(void); | |
91447636 A |
249 | /* this routine returns sends a signal signum to the process identified by the pid */ |
250 | extern void proc_signal(int pid, int signum); | |
251 | /* this routine checks whether any signal identified by the mask are pending in the process identified by the pid. The check is on all threads of the process. */ | |
252 | extern int proc_issignal(int pid, sigset_t mask); | |
253 | /* this routine returns 1 if the pid1 is inferior of pid2 */ | |
254 | extern int proc_isinferior(int pid1, int pid2); | |
39037602 A |
255 | /* this routine copies the process's name of the executable to the passed in buffer. It |
256 | * is always null terminated. The size of the buffer is to be passed in as well. This | |
257 | * routine is to be used typically for debugging | |
91447636 A |
258 | */ |
259 | void proc_name(int pid, char * buf, int size); | |
d9a64523 A |
260 | /* returns the 32-byte name if it exists, otherwise returns the 16-byte name */ |
261 | extern char *proc_best_name(proc_t p); | |
91447636 A |
262 | /* This routine is simillar to proc_name except it returns for current process */ |
263 | void proc_selfname(char * buf, int size); | |
264 | ||
265 | /* find a process with a given pid. This comes with a reference which needs to be dropped by proc_rele */ | |
266 | extern proc_t proc_find(int pid); | |
267 | /* returns a handle to current process which is referenced. The reference needs to be dropped with proc_rele */ | |
268 | extern proc_t proc_self(void); | |
269 | /* releases the held reference on the process */ | |
270 | extern int proc_rele(proc_t p); | |
271 | /* returns the pid of the given process */ | |
272 | extern int proc_pid(proc_t); | |
273 | /* returns the pid of the parent of a given process */ | |
274 | extern int proc_ppid(proc_t); | |
275 | /* returns 1 if the process is marked for no remote hangs */ | |
276 | extern int proc_noremotehang(proc_t); | |
6d2010ae | 277 | /* returns 1 if the process is marked for force quota */ |
91447636 | 278 | extern int proc_forcequota(proc_t); |
3e170ce0 A |
279 | /* returns 1 if the process is chrooted */ |
280 | extern int proc_chrooted(proc_t); | |
d9a64523 A |
281 | /* returns TRUE if a sync EXC_RESOURCE should be sent for the process */ |
282 | extern boolean_t proc_send_synchronous_EXC_RESOURCE(proc_t p); | |
91447636 | 283 | |
d9a64523 | 284 | /* this routine returns 1 if the process is running with a 64bit address space, else 0 */ |
91447636 | 285 | extern int proc_is64bit(proc_t); |
d9a64523 A |
286 | /* this routine returns 1 if the process is running with a 64bit register state, else 0 */ |
287 | extern int proc_is64bit_data(proc_t); | |
91447636 A |
288 | /* is this process exiting? */ |
289 | extern int proc_exiting(proc_t); | |
d9a64523 A |
290 | /* returns whether the process has started down proc_exit() */ |
291 | extern int proc_in_teardown(proc_t); | |
2d21ac55 A |
292 | /* this routine returns error if the process is not one with super user privileges */ |
293 | int proc_suser(proc_t p); | |
294 | /* returns the cred assicaited with the process; temporary api */ | |
295 | kauth_cred_t proc_ucred(proc_t p); | |
d9a64523 A |
296 | /* returns 1 if the process is tainted by uid or gid changes,e else 0 */ |
297 | extern int proc_issetugid(proc_t p); | |
2d21ac55 | 298 | |
2d21ac55 | 299 | extern int proc_tbe(proc_t); |
91447636 | 300 | |
b0d623f7 A |
301 | /*! |
302 | @function proc_selfpgrpid | |
303 | @abstract Get the process group id for the current process, as with proc_pgrpid(). | |
304 | @return pgrpid of current process. | |
305 | */ | |
306 | pid_t proc_selfpgrpid(void); | |
307 | ||
308 | /*! | |
309 | @function proc_pgrpid | |
310 | @abstract Get the process group id for the passed-in process. | |
311 | @param p Process whose pgrpid to grab. | |
312 | @return pgrpid for "p". | |
313 | */ | |
39037602 | 314 | pid_t proc_pgrpid(proc_t p); |
b0d623f7 | 315 | |
2d21ac55 | 316 | #ifdef KERNEL_PRIVATE |
b0d623f7 A |
317 | // mark a process as being allowed to call vfs_markdependency() |
318 | void bsd_set_dependency_capable(task_t task); | |
5ba3f43e A |
319 | #ifdef __arm__ |
320 | static inline int IS_64BIT_PROCESS(__unused proc_t p) { return 0; } | |
321 | #else | |
91447636 | 322 | extern int IS_64BIT_PROCESS(proc_t); |
5ba3f43e | 323 | #endif /* __arm__ */ |
91447636 | 324 | |
91447636 A |
325 | extern int tsleep(void *chan, int pri, const char *wmesg, int timo); |
326 | extern int msleep1(void *chan, lck_mtx_t *mtx, int pri, const char *wmesg, u_int64_t timo); | |
593a1d5f | 327 | |
316670eb | 328 | task_t proc_task(proc_t); |
593a1d5f | 329 | extern int proc_pidversion(proc_t); |
490019cf A |
330 | extern uint32_t proc_persona_id(proc_t); |
331 | extern uint32_t proc_getuid(proc_t); | |
332 | extern uint32_t proc_getgid(proc_t); | |
593a1d5f | 333 | extern int proc_getcdhash(proc_t, unsigned char *); |
39236c6e | 334 | |
39037602 | 335 | /*! |
39236c6e A |
336 | @function proc_pidbackgrounded |
337 | @abstract KPI to determine if a process is currently backgrounded. | |
39037602 A |
338 | @discussion The process may move into or out of background state at any time, |
339 | so be prepared for this value to be outdated immediately. | |
39236c6e A |
340 | @param pid PID of the process to be queried. |
341 | @param state Pointer to a value which will be set to 1 if the process | |
39037602 | 342 | is currently backgrounded, 0 otherwise. |
39236c6e A |
343 | @return ESRCH if pid cannot be found or has started exiting. |
344 | ||
345 | EINVAL if state is NULL. | |
346 | */ | |
347 | extern int proc_pidbackgrounded(pid_t pid, uint32_t* state); | |
348 | ||
39037602 A |
349 | /* |
350 | * This returns an unique 64bit id of a given process. | |
351 | * Caller needs to hold proper reference on the | |
6d2010ae A |
352 | * passed in process strucutre. |
353 | */ | |
354 | extern uint64_t proc_uniqueid(proc_t); | |
39236c6e | 355 | |
3e170ce0 A |
356 | extern void proc_set_responsible_pid(proc_t target_proc, pid_t responsible_pid); |
357 | ||
39037602 A |
358 | /* return 1 if process is forcing case-sensitive HFS+ access, 0 for default */ |
359 | extern int proc_is_forcing_hfs_case_sensitivity(proc_t); | |
360 | ||
39236c6e A |
361 | #endif /* KERNEL_PRIVATE */ |
362 | ||
363 | #ifdef XNU_KERNEL_PRIVATE | |
364 | ||
365 | /* unique 64bit id for process's original parent */ | |
366 | extern uint64_t proc_puniqueid(proc_t); | |
367 | ||
6d2010ae | 368 | extern void proc_getexecutableuuid(proc_t, unsigned char *, unsigned long); |
fe8ab488 A |
369 | extern int proc_get_originatorbgstate(uint32_t *is_backgrounded); |
370 | ||
371 | /* Kernel interface to get the uuid of the originator of the work.*/ | |
372 | extern int proc_pidoriginatoruuid(uuid_t uuid_buf, uint32_t buffersize); | |
39236c6e A |
373 | |
374 | extern uint64_t proc_was_throttled(proc_t); | |
375 | extern uint64_t proc_did_throttle(proc_t); | |
376 | ||
3e170ce0 | 377 | extern void proc_coalitionids(proc_t, uint64_t [COALITION_NUM_TYPES]); |
fe8ab488 | 378 | |
527f9951 A |
379 | #ifdef CONFIG_32BIT_TELEMETRY |
380 | extern void proc_log_32bit_telemetry(proc_t p); | |
381 | #endif /* CONFIG_32BIT_TELEMETRY */ | |
d9a64523 | 382 | extern uint64_t get_current_unique_pid(void); |
6d2010ae | 383 | #endif /* XNU_KERNEL_PRIVATE*/ |
1c79356b | 384 | |
fe8ab488 A |
385 | #ifdef KERNEL_PRIVATE |
386 | extern vnode_t proc_getexecutablevnode(proc_t); /* Returned with iocount, use vnode_put() to drop */ | |
a39ff7e2 | 387 | extern int networking_memstatus_callout(proc_t p, uint32_t); |
fe8ab488 A |
388 | #endif |
389 | ||
91447636 | 390 | __END_DECLS |
9bccf70c | 391 | |
1c79356b A |
392 | #endif /* KERNEL */ |
393 | ||
6d2010ae A |
394 | #ifdef PRIVATE |
395 | ||
396 | /* Values for pid_shutdown_sockets */ | |
39037602 A |
397 | #define SHUTDOWN_SOCKET_LEVEL_DISCONNECT_SVC 0x00000001 |
398 | #define SHUTDOWN_SOCKET_LEVEL_DISCONNECT_ALL 0x00000002 | |
399 | ||
6d2010ae | 400 | #ifdef KERNEL |
39037602 A |
401 | #define SHUTDOWN_SOCKET_LEVEL_DISCONNECT_INTERNAL 0x10000000 |
402 | #define SHUTDOWN_SOCKET_LEVEL_NECP 0x20000000 | |
403 | #define SHUTDOWN_SOCKET_LEVEL_CONTENT_FILTER 0x40000000 | |
404 | #endif | |
6d2010ae A |
405 | |
406 | #ifndef KERNEL | |
407 | ||
408 | __BEGIN_DECLS | |
409 | ||
410 | int pid_suspend(int pid); | |
411 | int pid_resume(int pid); | |
412 | ||
5ba3f43e A |
413 | #if defined(__arm__) || defined(__arm64__) |
414 | int pid_hibernate(int pid); | |
415 | #endif /* defined(__arm__) || defined(__arm64__) */ | |
416 | int pid_shutdown_sockets(int pid, int level); | |
417 | int pid_shutdown_networking(int pid, int level); | |
6d2010ae A |
418 | __END_DECLS |
419 | ||
420 | #endif /* !KERNEL */ | |
421 | #endif /* PRIVATE */ | |
422 | ||
1c79356b | 423 | #endif /* !_SYS_PROC_H_ */ |