View Source perc (perc v1.0.2)
Link to this section Summary
Functions
getpriority(2): get the process priority
getrlimit(2): get process resource limits
getumask(3): safer version of umask/0
kill(2): send a signal to a Unix process
prlimit(2): set resource limits for a specified process
renice: reset the process priority
setpriority(2): set the process priority
setrlimit(2): set process resource limits
status: retrieve process status
umask(2): get the process mask
umask(2): set the process mask
Link to this section Types
-type int32_t() :: -2147483647..2147483647.
-type pid_t() :: int32_t().
-type posix() ::
e2big | eacces | eaddrinuse | eaddrnotavail | eadv | eafnosupport | eagain | ealign |
ealready | ebade | ebadf | ebadfd | ebadmsg | ebadr | ebadrpc | ebadrqc | ebadslt | ebfont |
ebusy | ecapmode | echild | echrng | ecomm | econnaborted | econnrefused | econnreset |
edeadlk | edeadlock | edestaddrreq | edirty | edom | edotdot | edquot | eduppkg | eexist |
efault | efbig | ehostdown | ehostunreach | eidrm | einit | einprogress | eintr | einval |
eio | eisconn | eisdir | eisnam | el2hlt | el2nsync | el3hlt | el3rst | elbin | elibacc |
elibbad | elibexec | elibmax | elibscn | elnrng | eloop | emfile | emlink | emsgsize |
emultihop | enametoolong | enavail | enet | enetdown | enetreset | enetunreach | enfile |
enoano | enobufs | enocsi | enodata | enodev | enoent | enoexec | enolck | enolink | enomem |
enomsg | enonet | enopkg | enoprotoopt | enospc | enosr | enostr | enosym | enosys | enotblk |
enotcapable | enotconn | enotdir | enotempty | enotnam | enotrecoverable | enotsock |
enotsup | enotty | enotuniq | enxio | eopnotsupp | eoverflow | eownerdead | eperm |
epfnosupport | epipe | eproclim | eprocunavail | eprogmismatch | eprogunavail | eproto |
eprotonosupport | eprototype | erange | erefused | eremchg | eremdev | eremote | eremoteio |
eremoterelease | erofs | erpcmismatch | erremote | eshutdown | esocktnosupport | espipe |
esrch | esrmnt | estale | esuccess | etime | etimedout | etoomanyrefs | etxtbsy | euclean |
eunatch | eusers | eversion | ewouldblock | exdev | exfull.
-type uint32_t() :: 0..4294967295.
-type uint64_t() :: 0..18446744073709551615.
Link to this section Functions
-spec getegid() -> uint32_t().
-spec geteuid() -> uint32_t().
-spec getgid() -> uint32_t().
-spec getgroups() -> [uint32_t()].
getpriority(2): get the process priority
Get the priority (the "nice" value) of processes by pid, process group or user.getrlimit(2): get process resource limits
Get process limits for beam. See prlimit/4 for a list of the resource atoms.
The value returned is a struct rlimit:
1> {ok, <<Soft:8/native-unsigned-integer-unit:8, Hard:8/native-unsigned-integer-unit:8>>} = perc:getrlimit(rlimit_nofile).
2> Soft.
1024
3> Hard.
4096
-spec getuid() -> uint32_t().
-spec getumask() -> int32_t().
getumask(3): safer version of umask/0
Obtain the current process mask by parsing /proc/self/status, avoiding the race condition in umask/0.
If /proc/self/status does not exist or is not parsable, getumask/0 fails back to umask/0.kill(2): send a signal to a Unix process
Process IDs and signals are signed 32-bit integers. A signal can also be the lower cased signal name as an atom.
Sending a signal to PID 0 will send the signal to the Erlang VM.-spec prlimit(pid_t(), atom() | int32_t(), binary(), binary()) -> {ok, binary(), binary()} | {error, posix()}.
prlimit(2): set resource limits for a specified process
Linux only: on other platforms, {error, unsupported} will be returned to the caller.
Set or retrieve process limits for a process. Passing in an empty binary for NewLimit or OldLimit indicates the caller is not interested in these values.
The binary size of NewLimit/OldLimit must otherwise match the size of a struct rlimit for the platform. struct rlimit is usually composed of two 8 byte values in native format. To retrieve the current settings, pass in a zeroed 16 byte value.renice: reset the process priority
Convenience wrapper around getpriority/2 and setpriority/3, similar to renice(1).
WARNING: renice/2 makes successive calls to getpriority/2 and setpriority/3. Since this sequence is not atomic, the priority may change between calls or the process may have been terminated.
Sets the priority of a process or processes by pid, pgroup or user. The new priority may be an integer or a list containing a relative priority, indicated by using a "+" or "-". For example, using "+10" will increase the niceness of the process by 10.setpriority(2): set the process priority
Set the priority (the "nice" value) of processes by pid, process group or user.setrlimit(2): set process resource limits
Set process limits for beam. See prlimit/4 for a list of the resource atoms.-spec status() -> {ok, #{binary() => binary()}} | {error, atom()}.
status: retrieve process status
Reads /proc/self/status as a map.-spec umask() -> int32_t().
umask(2): get the process mask
WARNING: umask/0 is destructive: the umask is retrieved by setting the process mask to 0, then re-setting it back to the original mask. Between the successive calls to umask(2), the process mask is 0. An erlang process calling umask/0 concurrently with a process creating a file may have unexpected results.umask(2): set the process mask
Sets the file creation mask for beam. The mask may be either an integer or a list representing an octal number, e.g., either 8#022 or "022".
The old mask value is returned. To retrieve the current umask, use umask/0 or getumask/0.