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.
FloatingPointEmulationControl
PR_FPEMU_* flags for use with floating_point_emulation_control and set_floating_point_emulation_control.
FloatingPointExceptionMode
Zero means floating point exceptions are disabled.
Gid
gid_t—A Unix group ID.
MembarrierQuery
A result from membarrier_query.
Pid
pid_t—A non-zero Unix process ID.
PidfdFlags
PIDFD_* flags for use with pidfd_open.
PidfdGetfdFlags
All flags are reserved for future use.
PrctlMmMap
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 in getrlimit, setrlimit, and prlimit.
SpeculationFeatureControl
PR_SPEC_* flags for use with control_speculative_feature.
SpeculationFeatureState
Zero means the processors are not vulnerable.
Uid
uid_t—A Unix user ID.
UnalignedAccessControl
PR_UNALIGN_* flags for use with unaligned_access_control and set_unaligned_access_control.
WaitOptions
Options for modifying the behavior of wait/waitpid.
WaitStatus
The status of a child process after calling wait/waitpid.
WaitidOptions
Options for modifying the behavior of waitid.
WaitidStatus
The status of a process after calling waitid.

Enums§

DumpableBehavior
SUID_DUMP_* values for use with dumpable_behavior and set_dumpable_behavior.
EndianMode
PR_ENDIAN_* values for use with endian_mode.
FloatingPointMode
PR_FP_MODE_* values for use with floating_point_mode and set_floating_point_mode.
MachineCheckMemoryCorruptionKillPolicy
PR_MCE_KILL_* values for use with machine_check_memory_corruption_kill_policy and set_machine_check_memory_corruption_kill_policy.
MembarrierCommand
A command for use with membarrier and membarrier_cpu.
PTracer
Process ptracer.
Resource
A resource value for use with getrlimit, setrlimit, and prlimit.
Signal
A signal number for use with kill_process, kill_process_group, and kill_current_process_group.
SpeculationFeature
PR_SPEC_* values for use with speculative_feature_state and control_speculative_feature.
TimeStampCounterReadability
PR_TSC_* values for use with time_stamp_counter_readability and set_time_stamp_counter_readability.
TimingMethod
PR_TIMING_* values for use with timing_method and set_timing_method.
VirtualMemoryMapAddress
PR_SET_MM_* values for use with set_virtual_memory_map_address.
WaitId
The identifier to wait on in a call to waitid.

Constants§

EXIT_FAILURE
EXIT_FAILURE for use with exit.
EXIT_SIGNALED_SIGABRT
The exit status used by a process terminated with a Signal::Abort signal.
EXIT_SUCCESS
EXIT_SUCCESS for use with exit.

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 supported membarrier 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§

ForeignRawFd
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.