#include <sys/proc.h>

sys/proc.h Kernel.framework

51 functions · 1 variable

variablekernproc

extern proc_t kernproc

functionproc_is_classic

extern int proc_is_classic(proc_t p)
claude-fable-5, 2026-08-23 · not from Apple sources · verified against xnu bsd/kern/kern_proc.c
Obsolete stub; always returns 0. Formerly reported whether the process ran in the Classic compatibility environment.

functionproc_is_exotic

extern bool proc_is_exotic(proc_t p)
claude-fable-5, 2026-08-23 · not from Apple sources · verified against xnu bsd/kern/kern_proc.c, osfmk/kern/task.c, osfmk/vm/vm_map_internal.h
Returns true if the process's task runs in an exotic VM map (task_is_exotic): on arm64, a map whose page size is smaller than the kernel's or whose pmap is exotic. Returns false for a NULL proc.

functionproc_is_alien

extern bool proc_is_alien(proc_t p)
claude-fable-5, 2026-08-23 · not from Apple sources · verified against xnu bsd/kern/kern_proc.c, osfmk/kern/task.c, osfmk/vm/vm_map_internal.h
Returns true if the process's task runs in an "alien" VM map (task_is_alien) -- one intended to mostly behave as it would on iOS. On macOS this reflects the map's is_alien flag; on non-macOS platforms every map is considered alien. Returns false for a NULL proc.

functioncurrent_proc_EXTERNAL

proc_t current_proc_EXTERNAL(void)
claude-fable-5, 2026-08-23 · not from Apple sources · verified against xnu bsd/kern/kern_proc.c
Exported wrapper that simply returns current_proc(), the process of the calling thread. The implementation is marked for removal ("Why does this function exist? Need to kill it off"); use current_proc() instead.

functionmsleep

extern int msleep(
	void *chan,
	lck_mtx_t *mtx,
	int pri,
	const char *__unsafe_indexable wmesg,
	struct timespec * ts
)
__unsafe_indexable is a workaround for rdar://88409003 (PredefinedExpr trips C string detection)

functionmsleep0

extern int msleep0(
	void *chan,
	lck_mtx_t *mtx,
	int pri,
	const char *__unsafe_indexable wmesg,
	int timo,
	int (*continuation)(int)
)
claude-fable-5, 2026-08-23 · not from Apple sources · verified against xnu bsd/kern/kern_synch.c
General sleep primitive underlying msleep(). Puts the calling thread to sleep on wait channel chan until a wakeup(chan) or wakeup_one(chan), releasing mutex mtx while asleep and reacquiring it before return (unless pri includes PDROP, which leaves it unlocked). pri also carries PCATCH to allow signals to interrupt the sleep; wmesg names the wait for diagnostic tools; timo is a timeout in hz ticks, 0 for none. If continuation is non-NULL, the sleep returns through that function instead of resuming the blocked call. Returns 0 on wakeup, EWOULDBLOCK on timeout, and EINTR or ERESTART when interrupted by a signal.

functionwakeup

extern void wakeup(void *chan)
claude-fable-5, 2026-08-23 · not from Apple sources · verified against xnu bsd/kern/kern_synch.c
Wakes up all threads sleeping on wait channel chan via msleep, tsleep, or sleep; wraps thread_wakeup().

functionwakeup_one

extern void wakeup_one(caddr_t chan)
claude-fable-5, 2026-08-23 · not from Apple sources · verified against xnu bsd/kern/kern_synch.c
Wakes up the first thread sleeping on wait channel chan; wraps thread_wakeup_one(). The source cautions to be very sure the first sleeper is really the right one to wake.

functionproc_selfpid

extern int proc_selfpid(void)
proc kpis this routine returns the pid of the current process

functionproc_selfppid

extern int proc_selfppid(void)
this routine returns the pid of the parent of the current process

functionproc_selfcsflags

extern uint64_t proc_selfcsflags(void)
this routine returns the csflags of the current process

functionproc_csflags

extern int proc_csflags(proc_t p, uint64_t* flags)
this routine populates the given flags param with the csflags of the given process. Returns 0 on success, -1 on error.

functionproc_signal

extern void proc_signal(int pid, int signum)
this routine returns sends a signal signum to the process identified by the pid

functionproc_issignal

extern int proc_issignal(int pid, sigset_t mask)
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.

functionproc_isinferior

extern int proc_isinferior(int pid1, int pid2)
this routine returns 1 if the pid1 is inferior of pid2

functionproc_name

void proc_name(int pid, char * buf, int size)
this routine copies the process's name of the executable to the passed in buffer. It is always null terminated. The size of the buffer is to be passed in as well. This routine is to be used typically for debugging

functionproc_best_name

extern char *proc_best_name(proc_t p)
returns the 32-byte name if it exists, otherwise returns the 16-byte name

functionproc_selfname

void proc_selfname(char * buf, int size)
this routine is similar to proc_name except it returns for current process

functionproc_find

extern proc_t proc_find(int pid)
find a process with a given pid. This comes with a reference which needs to be dropped by proc_rele

functionproc_find_ident

extern proc_t proc_find_ident(const proc_ident_t i)
Function: proc_find_ident Description: Obtain a proc ref from the provided proc_ident. Returns: - Non-null proc_t on success - PROC_NULL on error

functionproc_find_audit_token

extern proc_t proc_find_audit_token(const audit_token_t token)
find a process with a given audit token

functionproc_self

extern proc_t proc_self(void)
returns a handle to current process which is referenced. The reference needs to be dropped with proc_rele

functionproc_rele

extern int proc_rele(proc_t p)
releases the held reference on the process

functionproc_pid

extern int proc_pid(proc_t)
returns the pid of the given process

functionproc_ppid

extern int proc_ppid(proc_t)
returns the pid of the parent of a given process

functionproc_original_ppid

extern int proc_original_ppid(proc_t)
returns the original pid of the parent of a given process

functionproc_orig_ppidversion

extern int proc_orig_ppidversion(proc_t)
returns the pid version of the original parent of a given process

functionproc_starttime

extern int proc_starttime(proc_t, struct timeval *)
returns the start time of the given process

functionproc_is_simulated

extern boolean_t proc_is_simulated(const proc_t)
returns whether the given process is on simulated platform

functionproc_platform

extern uint32_t proc_platform(const proc_t)
returns the platform (macos, ios, watchos, tvos, ...) of the given process

functionproc_min_sdk

extern uint32_t proc_min_sdk(proc_t)
returns the minimum sdk version used by the current process

functionproc_sdk

extern uint32_t proc_sdk(proc_t)
returns the sdk version used by the current process

functionproc_sdk_26_4_or_later

extern bool proc_sdk_26_4_or_later(proc_t proc)
returns whether the proc's sdk version is OS 26.4 (Fall 2025 SU E) aligned or greater

functionproc_noremotehang

extern int proc_noremotehang(proc_t)
returns 1 if the process is marked for no remote hangs

functionproc_forcequota

extern int proc_forcequota(proc_t)
returns 1 if the process is marked for force quota

functionproc_chrooted

extern int proc_chrooted(proc_t)
returns 1 if the process is chrooted

functionproc_send_synchronous_EXC_RESOURCE

extern boolean_t proc_send_synchronous_EXC_RESOURCE(proc_t p)
returns TRUE if a sync EXC_RESOURCE should be sent for the process

functionproc_is64bit

extern int proc_is64bit(proc_t)
this routine returns 1 if the process is running with a 64bit address space, else 0

functionproc_is64bit_data

extern int proc_is64bit_data(proc_t)
this routine returns 1 if the process is running with a 64bit register state, else 0

functionproc_isinitproc

extern int proc_isinitproc(proc_t)
this routine returns 1 if the process is initproc

functionproc_exiting

extern int proc_exiting(proc_t)
is this process exiting?

functionproc_in_teardown

extern int proc_in_teardown(proc_t)
returns whether the process has started down proc_exit()

functionproc_suser

extern int proc_suser(proc_t p)
this routine returns error if the process is not one with super user privileges

functionproc_ucred

__deprecated_msg("proc_ucred is unsafe, use kauth_cred_proc_ref() or current_cached_proc_cred()")
kauth_cred_t proc_ucred(proc_t p)
deprecated
returns the cred assicaited with the process; temporary api

functionproc_issetugid

extern int proc_issetugid(proc_t p)
returns 1 if the process is tainted by uid or gid changes,e else 0

functionproc_tbe

extern int proc_tbe(proc_t)
claude-fable-5, 2026-08-23 · not from Apple sources
Declared in sys/proc.h but no implementation exists in current xnu sources; the corresponding P_TBE process flag has been retired (its bit is now P_RESV6). Takes a proc_t and returns an int; historically a P_TBE flag test.

functionproc_gettty

extern int proc_gettty(proc_t p, vnode_t *vp)
@function proc_gettty @abstract Copies the associated tty vnode for a given process if it exists. The caller needs to decrement the iocount of the vnode. @return 0 on success. ENOENT if the process has no associated TTY. EINVAL if arguments are NULL or vnode_getwithvid fails.

functionproc_gettty_dev

extern int proc_gettty_dev(proc_t p, dev_t *dev)
this routine populates the associated tty device for a given process if it exists, returns 0 on success or else returns EINVAL

functionproc_selfpgrpid

pid_t proc_selfpgrpid(void)
@function proc_selfpgrpid @abstract Get the process group id for the current process, as with proc_pgrpid(). @return pgrpid of current process.

functionproc_pgrpid

pid_t proc_pgrpid(proc_t p)
@function proc_pgrpid @abstract Get the process group id for the passed-in process. @param p Process whose pgrpid to grab. @return pgrpid for "p".

functionproc_sessionid

pid_t proc_sessionid(proc_t p)
@function proc_sessionid @abstract Get the process session id for the passed-in process. @param p Process whose session id to grab. @return session id of current process.