From a978f68c06eb1764d401fa0ffce9fb30cd55f2e4 Mon Sep 17 00:00:00 2001 From: Craig Small Date: Mon, 21 Dec 2020 12:48:06 +1100 Subject: [PATCH] docs: Merge procps_uptime_* into procps_misc.3 --- doc/procps_misc.3 | 40 +++++++++++++++++ doc/procps_uptime.3 | 77 -------------------------------- doc/procps_uptime_sprint.3 | 1 - doc/procps_uptime_sprint_short.3 | 1 - 4 files changed, 40 insertions(+), 79 deletions(-) delete mode 100644 doc/procps_uptime.3 delete mode 100644 doc/procps_uptime_sprint.3 delete mode 100644 doc/procps_uptime_sprint_short.3 diff --git a/doc/procps_misc.3 b/doc/procps_misc.3 index 642ed2e7..2ebc1786 100644 --- a/doc/procps_misc.3 +++ b/doc/procps_misc.3 @@ -36,6 +36,12 @@ procps_misc \- API to system information in the /proc filesystem .BI "int procps_loadavg(double * " av1 ", double * " av5 ", double * " av15 ");" .B unsigned int procps_pid_length(void); .PP +.B #include +.PP +.BI "int procps_uptime(double * " uptime_secs ", double * " idle_secs ");" +.B char *procps_uptime_sprint(void); +.B char *procps_uptime_sprint_short(void); +.PP .B #include .PP .B int procps_linux_version(void); @@ -95,6 +101,14 @@ version, use the following macro: .TP .BI LINUX_VERSION( major , minor , patch ) .PP +.BR procps_uptime () +returns the uptime and idle time of the system. Either the +\fIuptime_secs\fR or \fIidle_secs\fR can be \fBNULL\fR in which case that +variable will not be returned. + +The \fBsprint\fR variety of the functions return a human-readable +string of the uptime and other statistics. + .BR procps_ns_get_id () finds the ID of the namespace for the given namespace name. @@ -145,6 +159,27 @@ returns .BR procps_ns_read_pid () Returns 0 on success and \fB\-EINVAL\fR on failure. +.BR procps_uptime () +returns 0 on success. On failure, it +returns a negative integer to one of the values defined below. +.TP +.B -ERANGE +Unable to parse the uptime file. +.PP +.BR procps_uptime () +may also return any (negated) value that \fBfopen\fR() may set errno to. + +.BR procps_uptime_sprint_short () +return a string from a statically allocated buffer which displays uptime. + +.BR procps_uptime_sprint () +also displays users and load average in the buffer. The formats are the +same as +.BR uptime (1) +with and without the +.B \-p +option. + .SH FILES .TP .I /proc/loadavg @@ -155,6 +190,10 @@ Contains the release version of the Linux kernel or proc filesystem. .TP .I /proc/sys/kernel/pid_max Contains the value at which PIDs wrap around, one greater than the maximum PID value. +.TP +.I /proc/uptime +The raw values for uptime and idle time. +.TP .IB /proc/ PID /ns contains the set of namespaces for a particular \fBPID\fR. @@ -168,6 +207,7 @@ out, this function will break. .\" Maj/6yr - In 7452 we'll think of something .SH SEE ALSO +.BR uptime (1), .BR fopen (3), .BR sysconf (3), .BR proc (5). diff --git a/doc/procps_uptime.3 b/doc/procps_uptime.3 deleted file mode 100644 index 20e47d12..00000000 --- a/doc/procps_uptime.3 +++ /dev/null @@ -1,77 +0,0 @@ -.\" (C) Copyright 2016-2020 Craig Small -.\" -.\" %%%LICENSE_START(LGPL_2.1+) -.\" This manual is free software; you can redistribute it and/or -.\" modify it under the terms of the GNU Lesser General Public -.\" License as published by the Free Software Foundation; either -.\" version 2.1 of the License, or (at your option) any later version. -.\" -.\" This manual is distributed in the hope that it will be useful, -.\" but WITHOUT ANY WARRANTY; without even the implied warranty of -.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -.\" Lesser General Public License for more details. -.\" -.\" You should have received a copy of the GNU Lesser General Public -.\" License along with this library; if not, write to the Free Software -.\" Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -.\" %%%LICENSE_END -.\" -.TH PROCPS_UPTIME 3 2020-05-18 "libproc-2" -.\" Please adjust this date whenever revising the manpage. -.\" -.SH NAME -procps_uptime, procps_sprint, procps_uptime_sprint_short \- -provide the uptime and idle time in seconds -.SH SYNOPSIS -.nf -.B #include -.PP -.BI "int procps_uptime(double * " uptime_secs ", double * " idle_secs ");" -.B char *procps_uptime_sprint(void); -.B char *procps_uptime_sprint_short(void); -.sp -Link with \fI\-lprocps\fP. -.SH DESCRIPTION -.BR procps_uptime () -returns the uptime and idle time of the system. Either the -\fIuptime_secs\fR or \fIidle_secs\fR can be \fBNULL\fR in which case that -variable will not be returned. - -The \fBsprint\fR variety of the functions return a human-readable -string of the uptime and other statistics. - -.SH RETURN VALUE -.BR procps_uptime () -returns 0 on success. On failure, it -returns a negative integer to one of the values defined below. -.TP -.B -ERANGE -Unable to parse the uptime file. -.PP -.BR procps_uptime () -may also return any (negated) value that \fBfopen\fR() may set errno to. - -.BR procps_uptime_sprint_short () -return a string from a statically allocated buffer which displays uptime. - -.BR procps_uptime_sprint () -also displays users and load average in the buffer. The formats are the -same as -.BR uptime (1) -with and without the -.B \-p -option. - -.SH FILES -.TP -.I /proc/uptime -The raw values for uptime and idle time. - -.SH VERSIONS -.B procps_uptime() -first appeared in libproc-2 version 0.0. - -.SH SEE ALSO -.BR uptime (1), -.BR fopen (3), -.BR proc (5). diff --git a/doc/procps_uptime_sprint.3 b/doc/procps_uptime_sprint.3 deleted file mode 100644 index c3647c7b..00000000 --- a/doc/procps_uptime_sprint.3 +++ /dev/null @@ -1 +0,0 @@ -.so man3/procps_uptime.3 diff --git a/doc/procps_uptime_sprint_short.3 b/doc/procps_uptime_sprint_short.3 deleted file mode 100644 index c3647c7b..00000000 --- a/doc/procps_uptime_sprint_short.3 +++ /dev/null @@ -1 +0,0 @@ -.so man3/procps_uptime.3