Module process
Available on crate feature
dep_rustix
only.Expand description
Process-associated operations.
Structs§
- CpuSet
CpuSet
represents a bit-mask of CPUs.- Cpuid
- A Linux CPU ID.
- Floating
Point Emulation Control PR_FPEMU_*
flags for use withfloating_point_emulation_control
andset_floating_point_emulation_control
.- Floating
Point Exception Mode - Zero means floating point exceptions are disabled.
- Gid
gid_t
—A Unix group ID.- Membarrier
Query - A result from
membarrier_query
. - Pid
pid_t
—A non-zero Unix process ID.- Pidfd
Flags PIDFD_*
flags for use withpidfd_open
.- Pidfd
Getfd Flags - All flags are reserved for future use.
- Prctl
MmMap - This structure provides new memory descriptor map which mostly modifies
/proc/pid/stat[m]
output for a task. This mostly done in a sake of checkpoint/restore functionality. - Rlimit
struct rlimit
—Current and maximum values used ingetrlimit
,setrlimit
, andprlimit
.- Speculation
Feature Control PR_SPEC_*
flags for use withcontrol_speculative_feature
.- Speculation
Feature State - Zero means the processors are not vulnerable.
- Uid
uid_t
—A Unix user ID.- Unaligned
Access Control PR_UNALIGN_*
flags for use withunaligned_access_control
andset_unaligned_access_control
.- Wait
Options - Options for modifying the behavior of
wait
/waitpid
. - Wait
Status - The status of a child process after calling
wait
/waitpid
. - Waitid
Options - Options for modifying the behavior of
waitid
. - Waitid
Status - The status of a process after calling
waitid
.
Enums§
- Dumpable
Behavior SUID_DUMP_*
values for use withdumpable_behavior
andset_dumpable_behavior
.- Endian
Mode PR_ENDIAN_*
values for use withendian_mode
.- Floating
Point Mode PR_FP_MODE_*
values for use withfloating_point_mode
andset_floating_point_mode
.- Machine
Check Memory Corruption Kill Policy PR_MCE_KILL_*
values for use withmachine_check_memory_corruption_kill_policy
andset_machine_check_memory_corruption_kill_policy
.- Membarrier
Command - A command for use with
membarrier
andmembarrier_cpu
. - PTracer
- Process ptracer.
- Resource
- A resource value for use with
getrlimit
,setrlimit
, andprlimit
. - Signal
- A signal number for use with
kill_process
,kill_process_group
, andkill_current_process_group
. - Speculation
Feature PR_SPEC_*
values for use withspeculative_feature_state
andcontrol_speculative_feature
.- Time
Stamp Counter Readability PR_TSC_*
values for use withtime_stamp_counter_readability
andset_time_stamp_counter_readability
.- Timing
Method PR_TIMING_*
values for use withtiming_method
andset_timing_method
.- Virtual
Memory MapAddress PR_SET_MM_*
values for use withset_virtual_memory_map_address
.- WaitId
- The identifier to wait on in a call to
waitid
.
Constants§
- EXIT_
FAILURE EXIT_FAILURE
for use withexit
.- EXIT_
SIGNALED_ SIGABRT - The exit status used by a process terminated with a
Signal::Abort
signal. - EXIT_
SUCCESS EXIT_SUCCESS
for use withexit
.
Functions§
- chdir
chdir(path)
—Change the current working directory.- child_
subreaper - Get the
child subreaper
setting of the calling process. - chroot
chroot(path)
—Change the process root directory.- configure_
io_ flusher_ behavior - Put the process in the
IO_FLUSHER
state, allowing it to make progress when allocating memory. - configure_
performance_ counters - Enable or disable all performance counters attached to the calling process.
- configure_
pointer_ ⚠authentication_ keys - Set enabled pointer authentication keys.
- configure_
virtual_ ⚠memory_ map - Provides one-shot access to all the addresses by passing in a
PrctlMmMap
. - control_
speculative_ feature - Sets the state of the speculation misfeature.
- dumpable_
behavior - Get the current state of the calling process’
dumpable
attribute. - enabled_
pointer_ authentication_ keys - Get enabled pointer authentication keys.
- endian_
mode - Get the endianness of the calling process.
- fchdir
fchdir(fd)
—Change the current working directory.- floating_
point_ emulation_ control - Get floating point emulation control bits.
- floating_
point_ exception_ mode - Get floating point exception mode.
- floating_
point_ mode - Get the current floating point mode.
- getcwd
getcwd
—Return the current working directory.- getegid
getegid()
—Returns the process’ effective group ID.- geteuid
geteuid()
—Returns the process’ effective user ID.- getgid
getgid()
—Returns the process’ real group ID.- getgroups
getgroups()
—Return a list of the current user’s groups.- getpgid
getpgid(pid)
—Returns the process group ID of the given process.- getpgrp
getpgrp()
—Returns the process’ group ID.- getpid
getpid()
—Returns the process’ ID.- getppid
getppid()
—Returns the parent process’ ID.- getpriority_
pgrp getpriority(PRIO_PGRP, gid)
—Get the scheduling priority of the given process group.- getpriority_
process getpriority(PRIO_PROCESS, pid)
—Get the scheduling priority of the given process.- getpriority_
user getpriority(PRIO_USER, uid)
—Get the scheduling priority of the given user.- getrlimit
getrlimit(resource)
—Get a process resource limit value.- getsid
getsid(pid)
—Get the session ID of the given process.- getuid
getuid()
—Returns the process’ real user ID.- ioctl_
tiocsctty ioctl(fd, TIOCSCTTY, 0)
—Sets the controlling terminal for the process.- is_
io_ flusher - Get the
IO_FLUSHER
state of the caller. - kill_
current_ process_ group kill(0, sig)
—Sends a signal to all processes in the current process group.- kill_
process kill(pid, sig)
—Sends a signal to a process.- kill_
process_ group kill(-pid, sig)
—Sends a signal to all processes in a process group.- machine_
check_ memory_ corruption_ kill_ policy - Get the current per-process machine check kill policy.
- membarrier
membarrier(cmd, 0, 0)
—Perform a memory barrier.- membarrier_
cpu membarrier(cmd, MEMBARRIER_CMD_FLAG_CPU, cpu)
—Perform a memory barrier with a specific CPU.- membarrier_
query membarrier(MEMBARRIER_CMD_QUERY, 0, 0)
—Query the supportedmembarrier
commands.- nice
nice(inc)
—Adjust the scheduling priority of the current process.- parent_
process_ death_ signal - Get the current value of the parent process death signal.
- pidfd_
getfd syscall(SYS_pidfd_getfd, pidfd, flags)
—Obtain a duplicate of another process’ file descriptor.- pidfd_
open syscall(SYS_pidfd_open, pid, flags)
—Creates a file descriptor for a process.- pidfd_
send_ signal syscall(SYS_pidfd_send_signal, pidfd, sig, NULL, 0)
—Send a signal to a process specified by a file descriptor.- pivot_
root pivot_root(new_root, put_old)
—Change the root mount.- prlimit
prlimit(pid, resource, new)
—Get and set a process resource limit value.- sched_
getaffinity sched_getaffinity(pid)
—Get a thread’s CPU affinity mask.- sched_
getcpu sched_getcpu()
—Get the CPU that the current thread is currently on.- sched_
setaffinity sched_setaffinity(pid, cpuset)
—Set a thread’s CPU affinity mask.- sched_
yield sched_yield()
—Hints to the OS that other processes should run.- set_
auxiliary_ ⚠vector - Set a new auxiliary vector.
- set_
child_ subreaper - Set the
child subreaper
attribute of the calling process. - set_
dumpable_ behavior - Set the state of the
dumpable
attribute. - set_
endian_ ⚠mode - Set the endianness of the calling process.
- set_
executable_ file - Supersede the
/proc/pid/exe
symbolic link with a new one pointing to a new executable file. - set_
floating_ point_ emulation_ control - Set floating point emulation control bits.
- set_
floating_ point_ exception_ mode - Set floating point exception mode.
- set_
floating_ point_ mode - Allow control of the floating point mode from user space.
- set_
machine_ check_ memory_ corruption_ kill_ policy - Set the machine check memory corruption kill policy for the calling thread.
- set_
parent_ process_ death_ signal - Set the parent-death signal of the calling process.
- set_
ptracer - Declare that the ptracer process can
ptrace
the calling process as if it were a direct process ancestor. - set_
time_ stamp_ counter_ readability - Set the state of the flag determining if the timestamp counter can be read by the process.
- set_
timing_ method - Set whether to use (normal, traditional) statistical process timing or accurate timestamp-based process timing.
- set_
unaligned_ access_ control - Set unaligned access control bits.
- set_
virtual_ ⚠memory_ map_ address - Modify certain kernel memory map descriptor addresses of the calling process.
- set_
virtual_ memory_ region_ name - Set the name for a virtual memory region.
- setpgid
setpgid(pid, pgid)
—Sets the process group ID of the given process.- setpriority_
pgrp setpriority(PRIO_PGRP, pgid)
—Get the scheduling priority of the given process group.- setpriority_
process setpriority(PRIO_PROCESS, pid)
—Get the scheduling priority of the given process.- setpriority_
user setpriority(PRIO_USER, uid)
—Get the scheduling priority of the given user.- setrlimit
setrlimit(resource, new)
—Set a process resource limit value.- setsid
setsid()
—Create a new session.- speculative_
feature_ state - Get the state of the speculation misfeature.
- test_
kill_ current_ process_ group kill(0, 0)
—Check validity of pid and permissions to send signals to the all processes in the current process group, without actually sending any signals.- test_
kill_ process kill(pid, 0)
—Check validity of pid and permissions to send signals to the process, without actually sending any signals.- test_
kill_ process_ group kill(-pid, 0)
—Check validity of pid and permissions to send signals to all processes in the process group, without actually sending any signals.- time_
stamp_ counter_ readability - Get the state of the flag determining if the timestamp counter can be read.
- timing_
method - Get which process timing method is currently in use.
- umask
umask(mask)
—Set the process file creation mask.- unaligned_
access_ control - Get unaligned access control bits.
- virtual_
memory_ map_ config_ struct_ size - Get the size of the
PrctlMmMap
the kernel expects. - wait
wait(waitopts)
—Wait for any of the children of calling process to change state.- waitid
waitid(_, _, _, opts)
—Wait for the specified child process to change state.- waitpgid
waitpid(-pgid, waitopts)
—Wait for a process in a specific process group to change state.- waitpid
waitpid(pid, waitopts)
—Wait for a specific process to change state.
Type Aliases§
- Foreign
RawFd - Raw file descriptor in another process.
- RawGid
- A group identifier as a raw integer.
- RawPid
- A process identifier as a raw integer.
- RawUid
- A user identifier as a raw integer.