process: Process Info

getuidR Documentation

Process Info

Description

Get or set attributes of the current process.

Usage

getuid()

getgid()

geteuid()

getegid()

getpid()

getppid()

getpgid()

getpriority()

setuid(uid)

seteuid(uid)

setgid(gid)

setegid(gid)

setpgid(pgid = 0)

setpriority(prio)

kill(pid, signal = SIGTERM)

Arguments

uid

User ID from ⁠/etc/passwd⁠.

gid

Group ID from ⁠/etc/group⁠.

pgid

Process Group ID. Default 0 sets pgid to the current pid.

prio

Priority level

pid

process ID (integer)

signal

a signal number (integer), defaults to tools::SIGTERM.

Details

Acronyms stand for:

  • pid Process ID

  • ppid Parent-Process ID

  • pgid Process-Group ID

  • uid User ID

  • euid Effective User ID

  • gid Group ID

  • egid Effective Group ID

  • prio Priority level

An unprivileged (non-root) process cannot change it's uid and only lower process priority (higher value).

References

GETUID(2) GETPID(2) GETPGID(2) GETPRIORITY(2)

Examples

# Current User:
getuid()
# Current UserGroup:
getgid()
# Current UserGroup:
geteuid()
# Current UserGroup:
getegid()
# Process ID
getpid()
# parent PID:
getppid()
# Process group id:
getpgid()

# Detach process group
setpgid(0)
getpgid()
# Process priority:
getpriority()
# Decrease priority
setpriority(getpriority() + 1)

unix documentation built on Oct. 4, 2024, 5:08 p.m.

Related to process in unix...