NAME |SYNOPSIS |DESCRIPTION |RETURN VALUE |FILES |SEE ALSO |COLOPHON | |
PROCPS_MISC(3) Library Functions ManualPROCPS_MISC(3)procps_misc - API for miscellaneous information in the /proc filesystem
#include <libproc2/misc.h> Platform Particulars longprocps_cpu_count(void); longprocps_hertz_get(void); unsigned intprocps_pid_length(void); intprocps_linux_version(void); Runtime Particulars intprocps_container_uptime(double *uptime_secs); intprocps_loadavg(double *av1, double *av5, double *av15); intprocps_uptime(double *uptime_secs, double *idle_secs); intprocps_uptime_snprint( char *restrictstr, size_tsize, doubleuptime_secs, const intpretty); char *procps_uptime_sprint(void); char *procps_uptime_sprint_short(void); intprocps_users(void); Namespace Particulars intprocps_ns_get_id(const char *name); const char*procps_ns_get_name(intid); intprocps_ns_read_pid(intpid, struct procps_ns *nsp); Mask Name Resolving intprocps_sigmask_names(char *conststr, size_tsize , const char *sigmask); intprocps_capmask_names(char *conststr, size_tsize, const char *capmask); Link with-lproc2.
procps_cpu_count() returns the number of CPUs that are currently online assysconf(_SC_NPROCESSORS_ONLY)or an assumed1.procps_hertz_get() returns the number of clock ticks per second assysconf(_SC_CLK_TCK)or an assumed100. Dividing tics by this value yields seconds.procps_pid_length() returns the maximum string length for a PID on the system. For example, if the largest possible PID value on was 123, then the length would be 3. If the file/proc/sys/kernel/pid_max is unreadable, the value is assumed to be5.procps_linux_version() returns the current Linux version as an encoded integer. On non-Linux systems that have an emulated proc filesystem this function returns the version of the Linux emulation instead. The version consists of three positive integers representing the major, minor and patch levels. The following macros are provided for encoding a given Linux version or separating out the components of the current version. LINUX_VERSION( major , minor , patch ) LINUX_VERSION_MAJOR( ver ) LINUX_VERSION_MINOR( ver ) LINUX_VERSION_PATCH( ver )procps_loadavg() fetches the system load average and puts the 1, 5 and 15 minute averages into location(s) specified by any pointer which is notNULL.procps_container_uptime() returns the uptime of a container into location specified by the pointer if it is notNULL. This is currently determined by the elapsed time of PID 1, which could be given with the command: $ps -o etimes 1 ELAPSED 12345 There is no concept of idle time in a container soprocps_container_uptime() doesn't have that parameter.procps_uptime() returns uptime and/or idle seconds into location(s) specified by any pointer which is notNULL. Thesprintvarieties return a human-readable string in one of two forms. HH:MM:SS up HH:MM, # users, load average: 1, 5, 15 MM averages up HH, MMprocps_uptime_snprint() Uses the given bufferstr ofsize length to fill in the uptime string instead of a statically allocated buffer. The function requires theuptime_secs value, which can be obtained fromprocps_uptime() orprocps_container_uptime() and thepretty flag determines if the output is standard or pretty/short.procps_users() returns the number of users on the system. This value comes fromsd_get_sessions(3) and counting the sessions of user, user-early and user-incomplete class or enumerating throughgetutent(3).procps_ns_get_id() returns the integer id (enum namespace_type) of the namespace for the given namespacename.procps_ns_get_name() returns the name of the namespace for the givenid (enum namespace_type).procps_ns_read_pid() returns the inodes for the namespaces of the given process in the procps_ns structure pointed to bynsp. Those inodes will appear in the order proscribed by enum namespace_type. enum namespace_type { PROCPS_NS_CGROUP, PROCPS_NS_IPC, PROCPS_NS_MNT, PROCPS_NS_NET, PROCPS_NS_PID, PROCPS_NS_TIME, PROCPS_NS_USER, PROCPS_NS_UTS };procps_sigmask_names() Fillsstr with a human-readable text string of up tosize bytes of the signals set in the hexadecimal signal masksigmask, seesignal(7). If the list of signals exceedssize bytes, the string will be truncated and will end with a '+'. It is up to the calling program to ensure thatstr is correctly allocated with at leastsize bytes.procps_capmask_names() Fillsstr with a human-readable text string of up tosize bytes of the capabilites set in the hexadecimal capability maskcapmask, seecapabilities(7). If the list of capabilities exceedssize bytes, the string will be truncated and will end with a '+'. It is up to the calling program to ensure thatstr is correctly allocated with at leastsize bytes. For a process that has no capabilities or all capabilities the string will be "-" and "full" respectively.Functions Returning an ‘int’ or ‘long’ An error will be indicated by a negative number that is always the inverse of some well known errno.h value.Functions Returning an ‘address’ An error will be indicated by a NULL return pointer with the reason found in the formal errno value.
/proc/loadavg The raw values for load average./proc/sys/kernel/osrelease Contains the release version of the Linux kernel or proc filesystem./proc/sys/kernel/pid_max Contains the value at which PIDs wrap around, one greater than the maximum PID value./proc/uptime The raw values for system uptime and idle time./proc/PID/ns contains the set of namespaces for a particularPID.
procps(3),procps_pids(3),getutent(3),sd_get_sessions(3),proc(5),capabilities(7),signal(7).
This page is part of theprocps-ng (/proc filesystem utilities) project. Information about the project can be found at ⟨https://gitlab.com/procps-ng/procps⟩. If you have a bug report for this manual page, see ⟨https://gitlab.com/procps-ng/procps/blob/master/Documentation/bugs.md⟩. This page was obtained from the project's upstream Git repository ⟨https://gitlab.com/procps-ng/procps.git⟩ on 2025-08-11. (At that time, the date of the most recent commit that was found in the repository was 2025-07-30.) If you discover any rendering problems in this HTML version of the page, or you believe there is a better or more up-to-date source for the page, or you have corrections or improvements to the information in this COLOPHON (which isnot part of the original manual page), send a mail to man-pages@man7.orgprocps-ng 2024-07-06PROCPS_MISC(3)Pages that refer to this page:procps(3), procps_pids(3)
HTML rendering created 2025-09-06 byMichael Kerrisk, author ofThe Linux Programming Interface. For details of in-depthLinux/UNIX system programming training courses that I teach, lookhere. Hosting byjambit GmbH. | ![]() |