diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2023-09-07 23:48:17 +0000 |
---|---|---|
committer | Laurent Bercot <ska-skaware@skarnet.org> | 2023-09-07 23:48:49 +0000 |
commit | e8c7ac9a7990d41daada0f2a3b49ba7030051b49 (patch) | |
tree | d44f4fdc78f97bc350b639b7a3fa37947241d88d | |
parent | 74266756a204f730fef84d30f8ad5ba5627a4921 (diff) | |
download | s6-linux-utils-e8c7ac9a7990d41daada0f2a3b49ba7030051b49.tar.xz |
Prepare for 2.6.2.0, add minflt/majflt to s6-ps
Signed-off-by: Laurent Bercot <ska@appnovation.com>
-rw-r--r-- | NEWS | 3 | ||||
-rw-r--r-- | doc/index.html | 4 | ||||
-rw-r--r-- | doc/s6-ps.html | 4 | ||||
-rw-r--r-- | doc/upgrade.html | 2 | ||||
-rw-r--r-- | package/info | 2 | ||||
-rw-r--r-- | src/include-local/s6ps.h | 14 | ||||
-rw-r--r-- | src/libs6ps/s6ps_pfield.c | 36 | ||||
-rw-r--r-- | src/libs6ps/s6ps_statparse.c | 8 | ||||
-rw-r--r-- | src/s6-linux-utils/s6-ps.c | 120 |
9 files changed, 127 insertions, 66 deletions
@@ -1,9 +1,10 @@ Changelog for s6-linux-utils. -In 2.6.1.3 +In 2.6.2.0 ---------- - Bugfixes. + - s6-ps now supports minflt, cminflt, majflt, cmajflt. In 2.6.1.2 diff --git a/doc/index.html b/doc/index.html index 3c59b96..5ea0813 100644 --- a/doc/index.html +++ b/doc/index.html @@ -47,7 +47,7 @@ on the wrong page. I apologize for the confusion. The Linux kernel must be 3.5 or later. </li> <li> GNU make, version 3.81 or later </li> <li> <a href="//skarnet.org/software/skalibs/">skalibs</a> version -2.13.1.0 or later. It's a build-time requirement. It's also a run-time +2.13.2.0 or later. It's a build-time requirement. It's also a run-time requirement if you link against the shared version of the skalibs library. </li> </ul> @@ -63,7 +63,7 @@ library. </li> <ul> <li> The current released version of s6-linux-utils is -<a href="s6-linux-utils-2.6.1.3.tar.gz">2.6.1.3</a>. </li> +<a href="s6-linux-utils-2.6.2.0.tar.gz">2.6.2.0</a>. </li> <li> Alternatively, you can checkout a copy of the <a href="//git.skarnet.org/cgi-bin/cgit.cgi/s6-linux-utils/">s6-linux-utils git repository</a>: diff --git a/doc/s6-ps.html b/doc/s6-ps.html index 12a986c..09d6a1d 100644 --- a/doc/s6-ps.html +++ b/doc/s6-ps.html @@ -81,6 +81,10 @@ cannot tell whether a process has locked memory pages or not. </li> <li> <tt>sess</tt> : the session leader's pid. </li> <li> <tt>tty</tt> : the name of the process's controlling terminal.</li> <li> <tt>tpgid</tt> : the pid of the foreground process group. </li> + <li> <tt>minflt</tt> : the number of minor page fault the process has encountered. </li> + <li> <tt>cminflt</tt> : the cumulative number of minor page fault the process and its dead children have encountered. </li> + <li> <tt>majflt</tt> : the number of major page fault the process has encountered. </li> + <li> <tt>cmajflt</tt> : the cumulative number of major page fault the process and its dead children have encountered. </li> <li> <tt>utime</tt> : the time the process spent in user mode. </li> <li> <tt>stime</tt> : the time the process spent in kernel mode. </li> <li> <tt>cutime</tt> : the time spent in user mode by the process <em>and</em> diff --git a/doc/upgrade.html b/doc/upgrade.html index 62c0aa6..34b2cb4 100644 --- a/doc/upgrade.html +++ b/doc/upgrade.html @@ -18,7 +18,7 @@ <h1> What has changed in s6-linux-utils </h1> -<h2> in 2.6.1.3 </h2> +<h2> in 2.6.2.0 </h2> <ul> <li> <a href="//skarnet.org/software/skalibs/">skalibs</a> diff --git a/package/info b/package/info index 6d82570..cb03f7a 100644 --- a/package/info +++ b/package/info @@ -1,4 +1,4 @@ package=s6-linux-utils -version=2.6.1.3 +version=2.6.2.0 category=admin package_macro_name=S6_LINUX_UTILS diff --git a/src/include-local/s6ps.h b/src/include-local/s6ps.h index 951cc3a..ca33a73 100644 --- a/src/include-local/s6ps.h +++ b/src/include-local/s6ps.h @@ -23,7 +23,11 @@ enum pfield_e PFIELD_PGRP, PFIELD_SESSION, PFIELD_TTY, - PFIELD_TPGID, + PFIELD_TPGID, + PFIELD_MINFLT, + PFIELD_CMINFLT, + PFIELD_MAJFLT, + PFIELD_CMAJFLT, PFIELD_UTIME, PFIELD_STIME, PFIELD_CUTIME, @@ -70,6 +74,10 @@ struct pscan_s pid_t session ; dev_t ttynr ; pid_t tpgid ; + uint64_t minflt ; + uint64_t cminflt ; + uint64_t majflt ; + uint64_t cmajflt ; uint64_t utime ; uint64_t stime ; uint64_t cutime ; @@ -104,6 +112,10 @@ struct pscan_s .session = 0, \ .ttynr = 0, \ .tpgid = -1, \ + .minflt = 0, \ + .cminflt = 0, \ + .majflt = 0, \ + .cmajflt = 0, \ .utime = 0, \ .stime = 0, \ .cutime = 0, \ diff --git a/src/libs6ps/s6ps_pfield.c b/src/libs6ps/s6ps_pfield.c index 6d84ea0..ae589aa 100644 --- a/src/libs6ps/s6ps_pfield.c +++ b/src/libs6ps/s6ps_pfield.c @@ -25,6 +25,10 @@ static char const *const fieldheaders[PFIELD_PHAIL] = "SESSION", "TTY", "TPGID", + "MINFLT", + "CMINFLT", + "MAJFLT", + "CMAJFLT", "UTIME", "STIME", "CUTIME", @@ -64,6 +68,10 @@ static char const *const opttable[PFIELD_PHAIL] = "sess", "tty", "tpgid", + "minflt", + "cminflt", + "majflt", + "cmajflt", "utime", "stime", "cutime", @@ -257,6 +265,30 @@ static int fmt_jiffies (s6ps_auxinfo_t *aux, pscan_t *p, size_t *pos, size_t *le return 1 ; } +static int fmt_minflt (s6ps_auxinfo_t *aux, pscan_t *p, size_t *pos, size_t *len) +{ + (void)aux ; + return fmt_64(p, pos, len, p->minflt) ; +} + +static int fmt_cminflt (s6ps_auxinfo_t *aux, pscan_t *p, size_t *pos, size_t *len) +{ + (void)aux ; + return fmt_64(p, pos, len, p->cminflt) ; +} + +static int fmt_majflt (s6ps_auxinfo_t *aux, pscan_t *p, size_t *pos, size_t *len) +{ + (void)aux ; + return fmt_64(p, pos, len, p->majflt) ; +} + +static int fmt_cmajflt (s6ps_auxinfo_t *aux, pscan_t *p, size_t *pos, size_t *len) +{ + (void)aux ; + return fmt_64(p, pos, len, p->cmajflt) ; +} + static int fmt_utime (s6ps_auxinfo_t *aux, pscan_t *p, size_t *pos, size_t *len) { return fmt_jiffies(aux, p, pos, len, p->utime) ; @@ -545,6 +577,10 @@ static pfieldfmt_func_ref const pfieldfmt_table[PFIELD_PHAIL] = &fmt_session, &fmt_ttynr, &fmt_tpgid, + &fmt_minflt, + &fmt_cminflt, + &fmt_majflt, + &fmt_cmajflt, &fmt_utime, &fmt_stime, &fmt_cutime, diff --git a/src/libs6ps/s6ps_statparse.c b/src/libs6ps/s6ps_statparse.c index 8cc5a93..601e14a 100644 --- a/src/libs6ps/s6ps_statparse.c +++ b/src/libs6ps/s6ps_statparse.c @@ -116,10 +116,10 @@ int s6ps_statparse (pscan_t *p) &p->ttynr, &p->tpgid, &dummy64, - &dummy64, - &dummy64, - &dummy64, - &dummy64, + &p->minflt, + &p->cminflt, + &p->majflt, + &p->cmajflt, &p->utime, &p->stime, &p->cutime, diff --git a/src/s6-linux-utils/s6-ps.c b/src/s6-linux-utils/s6-ps.c index 255b195..49cb4fb 100644 --- a/src/s6-linux-utils/s6-ps.c +++ b/src/s6-linux-utils/s6-ps.c @@ -32,22 +32,26 @@ #define USAGE "s6-ps [ -H ] [ -w spacing ] [ -W wchanfile ] [ -l | -o field,field... ]" #define RIGHTFORMATTED ( \ - (1 << PFIELD_PID) | \ - (1 << PFIELD_PPID) | \ - (1 << PFIELD_PGRP) | \ - (1 << PFIELD_SESSION) | \ - (1 << PFIELD_TPGID) | \ - (1 << PFIELD_PRIO) | \ - (1 << PFIELD_NICE) | \ - (1 << PFIELD_THREADS) | \ - (1 << PFIELD_VSIZE) | \ - (1 << PFIELD_RSS) | \ - (1 << PFIELD_RSSLIM) | \ - (1 << PFIELD_CPUNO) | \ - (1 << PFIELD_RTPRIO) | \ - (1 << PFIELD_PMEM) | \ - (1 << PFIELD_PCPU) | \ - ((uint64_t)1 << PFIELD_CPCPU)) + (1ULL << PFIELD_PID) | \ + (1ULL << PFIELD_PPID) | \ + (1ULL << PFIELD_PGRP) | \ + (1ULL << PFIELD_SESSION) | \ + (1ULL << PFIELD_TPGID) | \ + (1ULL << PFIELD_MINFLT) | \ + (1ULL << PFIELD_CMINFLT) | \ + (1ULL << PFIELD_MAJFLT) | \ + (1ULL << PFIELD_CMAJFLT) | \ + (1ULL << PFIELD_PRIO) | \ + (1ULL << PFIELD_NICE) | \ + (1ULL << PFIELD_THREADS) | \ + (1ULL << PFIELD_VSIZE) | \ + (1ULL << PFIELD_RSS) | \ + (1ULL << PFIELD_RSSLIM) | \ + (1ULL << PFIELD_CPUNO) | \ + (1ULL << PFIELD_RTPRIO) | \ + (1ULL << PFIELD_PMEM) | \ + (1ULL << PFIELD_PCPU) | \ + (1ULL << PFIELD_CPCPU)) static void *pid_dtok (unsigned int d, void *x) { @@ -81,7 +85,7 @@ static inline unsigned int ps_fieldscan (char const *s, pfield_t *list, uint64_t for (; i < PFIELD_PHAIL ; i++) if (!strcmp(tmp, s6ps_opttable[i])) break ; if (i >= PFIELD_PHAIL) strerr_dief4x(100, "invalid", " field for -o option", ": ", tmp) ; - if (bits & ((uint64_t)1 << i)) + if (bits & (1ULL << i)) strerr_dief4x(100, "duplicate", " field for -o option", ": ", tmp) ; } s += len + 1 ; @@ -130,7 +134,7 @@ int main (int argc, char const *const *argv) case 'l' : { nfields = 11 ; - fbf = (1 << PFIELD_USER) | (1 << PFIELD_PID) | ((uint64_t)1 << PFIELD_CPCPU) | (1 << PFIELD_PMEM) | (1 << PFIELD_VSIZE) | (1 << PFIELD_RSS) | (1 << PFIELD_TTY) | (1 << PFIELD_STATE) | (1 << PFIELD_START) | (1 << PFIELD_CTTIME) | (1 << PFIELD_ARGS) ; + fbf = (1ULL << PFIELD_USER) | (1ULL << PFIELD_PID) | (1ULL << PFIELD_CPCPU) | (1ULL << PFIELD_PMEM) | (1ULL << PFIELD_VSIZE) | (1ULL << PFIELD_RSS) | (1ULL << PFIELD_TTY) | (1ULL << PFIELD_STATE) | (1ULL << PFIELD_START) | (1ULL << PFIELD_CTTIME) | (1ULL << PFIELD_ARGS) ; fieldlist[0] = PFIELD_USER ; fieldlist[1] = PFIELD_PID ; fieldlist[2] = PFIELD_CPCPU ; @@ -165,35 +169,39 @@ int main (int argc, char const *const *argv) if (spacing > 256) spacing = 256 ; needstat = flagtree || !!(fbf & ( - (1 << PFIELD_PID) | - (1 << PFIELD_COMM) | - (1 << PFIELD_STATE) | - (1 << PFIELD_PPID) | - (1 << PFIELD_PGRP) | - (1 << PFIELD_SESSION) | - (1 << PFIELD_TTY) | - (1 << PFIELD_TPGID) | - (1 << PFIELD_UTIME) | - (1 << PFIELD_STIME) | - (1 << PFIELD_CUTIME) | - (1 << PFIELD_CSTIME) | - (1 << PFIELD_PRIO) | - (1 << PFIELD_NICE) | - (1 << PFIELD_THREADS) | - (1 << PFIELD_START) | - (1 << PFIELD_VSIZE) | - (1 << PFIELD_RSS) | - (1 << PFIELD_RSSLIM) | - (1 << PFIELD_CPUNO) | - (1 << PFIELD_RTPRIO) | - (1 << PFIELD_RTPOLICY) | - (1 << PFIELD_PMEM) | - (1 << PFIELD_WCHAN) | - (1 << PFIELD_PCPU) | - (1 << PFIELD_TTIME) | - (1 << PFIELD_CTTIME) | - ((uint64_t)1 << PFIELD_TSTART) | - ((uint64_t)1 << PFIELD_CPCPU))) ; + (1ULL << PFIELD_PID) | + (1ULL << PFIELD_COMM) | + (1ULL << PFIELD_STATE) | + (1ULL << PFIELD_PPID) | + (1ULL << PFIELD_PGRP) | + (1ULL << PFIELD_SESSION) | + (1ULL << PFIELD_TTY) | + (1ULL << PFIELD_TPGID) | + (1ULL << PFIELD_MINFLT) | + (1ULL << PFIELD_CMINFLT) | + (1ULL << PFIELD_MAJFLT) | + (1ULL << PFIELD_CMAJFLT) | + (1ULL << PFIELD_UTIME) | + (1ULL << PFIELD_STIME) | + (1ULL << PFIELD_CUTIME) | + (1ULL << PFIELD_CSTIME) | + (1ULL << PFIELD_PRIO) | + (1ULL << PFIELD_NICE) | + (1ULL << PFIELD_THREADS) | + (1ULL << PFIELD_START) | + (1ULL << PFIELD_VSIZE) | + (1ULL << PFIELD_RSS) | + (1ULL << PFIELD_RSSLIM) | + (1ULL << PFIELD_CPUNO) | + (1ULL << PFIELD_RTPRIO) | + (1ULL << PFIELD_RTPOLICY) | + (1ULL << PFIELD_PMEM) | + (1ULL << PFIELD_WCHAN) | + (1ULL << PFIELD_PCPU) | + (1ULL << PFIELD_TTIME) | + (1ULL << PFIELD_CTTIME) | + (1ULL << PFIELD_TSTART) | + (1ULL << PFIELD_CPCPU))) ; /* Scan /proc */ @@ -293,18 +301,18 @@ int main (int argc, char const *const *argv) /* Format, compute length, output */ - if (fbf & ((1 << PFIELD_START) | ((uint64_t)1 << PFIELD_TSTART) | (1 << PFIELD_PCPU) | ((uint64_t)1 << PFIELD_CPCPU))) + if (fbf & ((1ULL << PFIELD_START) | (1ULL << PFIELD_TSTART) | (1ULL << PFIELD_PCPU) | (1ULL << PFIELD_CPCPU))) { tain_wallclock_read_g() ; s6ps_compute_boottime(&aux, p, mypos) ; } - if (fbf & (1 << PFIELD_USER) && !s6ps_cache_init(&aux.caches[0])) + if (fbf & (1ULL << PFIELD_USER) && !s6ps_cache_init(&aux.caches[0])) strerr_diefu1sys(111, "init user name cache") ; - if (fbf & (1 << PFIELD_GROUP) && !s6ps_cache_init(&aux.caches[1])) + if (fbf & (1ULL << PFIELD_GROUP) && !s6ps_cache_init(&aux.caches[1])) strerr_diefu1sys(111, "init group name cache") ; - if (fbf & (1 << PFIELD_TTY) && !s6ps_cache_init(&aux.caches[2])) + if (fbf & (1ULL << PFIELD_TTY) && !s6ps_cache_init(&aux.caches[2])) strerr_diefu1sys(111, "init tty name cache") ; - if (fbf & (1 << PFIELD_WCHAN) && !s6ps_wchan_init(&aux.wchan, wchanfile)) + if (fbf & (1ULL << PFIELD_WCHAN) && !s6ps_wchan_init(&aux.wchan, wchanfile)) { if (wchanfile) strerr_warnwu2sys("init wchan file ", wchanfile) ; else strerr_warnwu1sys("init wchan") ; @@ -329,10 +337,10 @@ int main (int argc, char const *const *argv) for (i = 0 ; i < nfields ; i++) if (maxlen[i] > maxspaces) maxspaces = maxlen[i] ; maxspaces += spacing ; - if (fbf & (1 << PFIELD_USER)) s6ps_cache_finish(&aux.caches[0]) ; - if (fbf & (1 << PFIELD_GROUP)) s6ps_cache_finish(&aux.caches[1]) ; - if (fbf & (1 << PFIELD_TTY)) s6ps_cache_finish(&aux.caches[2]) ; - if (fbf & (1 << PFIELD_WCHAN)) s6ps_wchan_finish(&aux.wchan) ; + if (fbf & (1ULL << PFIELD_USER)) s6ps_cache_finish(&aux.caches[0]) ; + if (fbf & (1ULL << PFIELD_GROUP)) s6ps_cache_finish(&aux.caches[1]) ; + if (fbf & (1ULL << PFIELD_TTY)) s6ps_cache_finish(&aux.caches[2]) ; + if (fbf & (1ULL << PFIELD_WCHAN)) s6ps_wchan_finish(&aux.wchan) ; stralloc_free(&satmp) ; { char spaces[maxspaces] ; |