First cut at subset=pid proc mount handling
The procfs mount option subset=pid only shows the processes, not things
such as /proc/stat etc.
For certain programs, this should mean they still work, but have reduced
functionality. This is the first cut at some of them.
pgrep - Removed always loading uptime which we never used anyway. The
program now works fine unless we use --older. Add note in man page
stating it will silently fail.
ps - Load boot time and memory total only when required instead of
always. Changed the error messages to something the user actually
cares about "can't get system boot time" vs "create a structure".
Works for most fields except starts and percent memory.
uptime - Give more useful error messages if uptime not available.
vmstat - move header generation after testing for required proc
files, makes the default output more consistent with the rest
of the options.
References:
procps-ng/procps#227
https://www.kernel.org/doc/html/latest/filesystems/proc.html#chapter-4-configuring-procfs
6814ef2d99
Signed-off-by: Craig Small <csmall@dropbear.xyz>
This commit is contained in:
2
vmstat.c
2
vmstat.c
@@ -373,7 +373,6 @@ static void new_format(void)
|
||||
|
||||
sleep_half = (sleep_time / 2);
|
||||
hz = procps_hertz_get();
|
||||
new_header();
|
||||
|
||||
if (procps_vmstat_new(&vm_info) < 0)
|
||||
xerrx(EXIT_FAILURE, _("Unable to create vmstat structure"));
|
||||
@@ -381,6 +380,7 @@ static void new_format(void)
|
||||
xerrx(EXIT_FAILURE, _("Unable to create system stat structure"));
|
||||
if (procps_meminfo_new(&mem_info) < 0)
|
||||
xerrx(EXIT_FAILURE, _("Unable to create meminfo structure"));
|
||||
new_header();
|
||||
|
||||
pgpgin[tog] = VMSTAT_GET(vm_info, VMSTAT_PGPGIN, ul_int);
|
||||
pgpgout[tog] = VMSTAT_GET(vm_info, VMSTAT_PGPGOUT, ul_int);
|
||||
|
Reference in New Issue
Block a user