# procps_misc - API for miscellaneous information in the /proc filesystem - man(3) - [phpMan]

[_PROCPS_MISC_(3)](https://www.chedong.com/phpMan.php/man/PROCPSMISC/3/markdown)                        Library Functions Manual                        [_PROCPS_MISC_(3)](https://www.chedong.com/phpMan.php/man/PROCPSMISC/3/markdown)

## NAME
       procps_misc - API for miscellaneous information in the /proc filesystem

## SYNOPSIS
### #include <libproc2/misc.h>

       Platform Particulars

           long         **procps_cpu_count **(void);
           long         **procps_hertz_get **(void);
           unsigned int **procps_pid_length **(void);
           int          **procps_linux_version **(void);

       Runtime Particulars

           int   **procps_loadavg **(double *_av1_, double *_av5_, double *_av15_);
           int   **procps_uptime **(double *_uptime_secs_, double *_idle_secs_);
           char ***procps_uptime_sprint **(void);
           char ***procps_uptime_sprint_short **(void);

       Namespace Particulars

           int         **procps_ns_get_id **(const char *_name_);
           const char ***procps_ns_get_name **(int _id_);
           int         **procps_ns_read_pid **(int _pid_, struct procps_ns *_nsp_);

       Link with _-lproc2_.


## DESCRIPTION
       **procps_cpu_count**()   returns   the   number   of   CPUs   that   are   currently   online  as
       **sysconf(_**_SC_NPROCESSORS_ONLY_**) **or an assumed _1_.

       **procps_hertz_get**() returns the number of clock ticks per second as **sysconf(_**_SC_CLK_TCK_**) **or an
       assumed _100_.  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 be _5_.

       **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 not _NULL_.

       **procps_uptime**() returns uptime and/or idle seconds into location(s) specified by any  pointer
       which is not _NULL_.  The **sprint **varieties 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, MM

       **procps_ns_get_id**()  returns  the  integer  id  (enum namespace_type) of the namespace for the
       given namespace _name_.

       **procps_ns_get_name**()  returns  the  name  of  the  namespace   for   the   given   _id_   (enum
       namespace_type).

       **procps_ns_read_pid**()  returns  the  inodes  for  the  namespaces  of the given process in the
       procps_ns structure pointed to by _nsp_.  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
           };



## RETURN VALUE
### 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.


## FILES
       _/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 uptime and idle time.

       _/proc/<PID>/ns_
              contains the set of namespaces for a particular **PID**.


## SEE ALSO
       [**procps**(3)](https://www.chedong.com/phpMan.php/man/procps/3/markdown), [**procps_pids**(3)](https://www.chedong.com/phpMan.php/man/procpspids/3/markdown), [**proc**(5)](https://www.chedong.com/phpMan.php/man/proc/5/markdown).

libproc2                                     August 2022                              [_PROCPS_MISC_(3)](https://www.chedong.com/phpMan.php/man/PROCPSMISC/3/markdown)
