ps_status: Current process status

View source: R/low-level.R

ps_statusR Documentation

Current process status

Description

One of the following:

  • "idle": Process being created by fork, or process has been sleeping for a long time. macOS only.

  • "running": Currently runnable on macOS and Windows. Actually running on Linux.

  • "sleeping" Sleeping on a wait or poll.

  • "disk_sleep" Uninterruptible sleep, waiting for an I/O operation (Linux only).

  • "stopped" Stopped, either by a job control signal or because it is being traced.

  • "uninterruptible" Process is in uninterruptible wait. macOS only.

  • "tracing_stop" Stopped for tracing (Linux only).

  • "zombie" Zombie. Finished, but parent has not read out the exit status yet.

  • "dead" Should never be seen (Linux).

  • "wake_kill" Received fatal signal (Linux only).

  • "waking" Paging (Linux only, not valid since the 2.6.xx kernel).

Usage

ps_status(p = ps_handle())

Arguments

p

Process handle.

Details

It might return NA_character_ on macOS.

Works for zombie processes.

Value

Character scalar.

Note on macOS

On macOS ps_status() often falls back to calling the external ps program, because macOS does not let R access the status of most other processes. Notably, it is usually able to access the status of other R processes.

The external ps program always runs as the root user, and it also has special entitlements, so it can typically access the status of most processes.

If this behavior is problematic for you, e.g. because calling an external program is too slow, set the ps.no_external_ps option to TRUE:

options(ps.no_external_ps = TRUE)

Note that setting this option to TRUE will cause ps_status() to return NA_character_ for most processes.

See Also

Other process handle functions: ps_children(), ps_cmdline(), ps_connections(), ps_cpu_times(), ps_create_time(), ps_cwd(), ps_descent(), ps_environ(), ps_exe(), ps_handle(), ps_interrupt(), ps_is_running(), ps_kill(), ps_memory_info(), ps_name(), ps_num_fds(), ps_num_threads(), ps_open_files(), ps_pid(), ps_ppid(), ps_resume(), ps_send_signal(), ps_shared_libs(), ps_suspend(), ps_terminal(), ps_terminate(), ps_uids(), ps_username()

Examples


p <- ps_handle()
p
ps_status(p)


ps documentation built on Sept. 13, 2024, 1:12 a.m.