Commit d123854e authored by Wayne Porter's avatar Wayne Porter

Merge branch 'master' of gitlab.com:procps-ng/procps

parents 419ded4b 4b44aebd
Pipeline #9024484 failed with stage
in 3 minutes and 8 seconds
......@@ -223,6 +223,8 @@ proc_libprocps_la_SOURCES = \
proc/devname.h \
proc/escape.c \
proc/escape.h \
proc/numa.c \
proc/numa.h \
proc/procps-private.h \
proc/procps.h \
proc/pwcache.c \
......@@ -247,6 +249,7 @@ proc_libprocps_la_include_HEADERS = \
proc/alloc.h \
proc/devname.h \
proc/escape.h \
proc/numa.h \
proc/procps.h \
proc/pwcache.h \
proc/readproc.h \
......
procps-ng-NEXT
----------------
* watch: define HOST_NAME_MAX where not defined Debian #830734
* library: dont use vm_min_free on non Linux Debian #831396
* library: dont use SIGPWR on FreeBSD Debian #832148
* library: don't strip off wchan prefixes (ps & top) Redhat #1322111
* pgrep: warn about 15+ char name only if -f not used
* pkill: Return 0 only if we can kill process Debian #852758
* kill: -l space between name parses correctly Debian #854407
* pmap: fix duplicate output line under '-x' option Redhat #1374061
* ps: avoid eip/esp address truncations Debian #846361
* ps: recognizes SCHED_DEADLINE as valid CPU scheduler
* ps: display NUMA node under which a thread ran
* top: add config file support for XDG specification
* top: eliminated minor libnuma memory leak
* top: show fewer memory decimal places (configurable)
* top: provide command line switch for memory scaling
* top: provide command line switch for CPU States
* top: provides more accurate cpu usage at startup
* top: display NUMA node under which a thread ran
* top: fix argument parsing quirk resulting in SEGV Redhat #1450429
* watch: define HOST_NAME_MAX where not defined Debian #830734
procps-ng-3.3.12
----------------
......
......@@ -222,11 +222,11 @@ if test "x$enable_wide_percent" = xyes; then
fi
AC_ARG_ENABLE([wide-memory],
AS_HELP_STRING([--disable-wide-memory], [disable extra precision under memory fields for top]),
[], [enable_wide_memory=yes]
AS_HELP_STRING([--enable-wide-memory], [provide extra precision under memory fields for top]),
[], [enable_wide_memory=no]
)
if test "x$enable_wide_memory" = xno; then
AC_DEFINE(NOBOOST_MEMS, 1, [disable extra precision under memory fields for top])
if test "x$enable_wide_memory" = xyes; then
AC_DEFINE(BOOST_MEMORY, 1, [provide extra precision under memory fields for top])
fi
AC_ARG_ENABLE([modern-top],
......
......@@ -202,7 +202,6 @@ static void check_unit_set(int *unit_set)
int main(int argc, char **argv)
{
int c, flags = 0, unit_set = 0;
char *endptr;
struct commandline_arguments args;
/*
......
......@@ -4592,6 +4592,9 @@ msgstr "Le programme B<watch> a été écrit par Tony Rems E<lt>I<rembo@unisoft.
#~ msgid "IDL\tSCHED_IDLE\n"
#~ msgstr "IDL\tSCHED_IDLE\n"
#~ msgid "DLN\tSCHED_DEADLINE\n"
#~ msgstr "DLN\tSCHED_DEADLINE\n"
#~ msgid "?\tunknown value\n"
#~ msgstr "?\tvaleur inconnue\n"
......@@ -5199,11 +5202,11 @@ msgstr "Le programme B<watch> a été écrit par Tony Rems E<lt>I<rembo@unisoft.
#~ msgid "scheduling policy of the process. The policies SCHED_OTHER (SCHED_NORMAL),\n"
#~ msgstr "Ordonnancement de la politique du processus. Les politiques SCHED_OTHER (SCHED_NORMAL),\n"
#~ msgid "SCHED_FIFO, SCHED_RR, SCHED_BATCH, SCHED_ISO, and SCHED_IDLE are respectively\n"
#~ msgstr "SCHED_FIFO, SCHED_RR, SCHED_BATCH, SCHED_ISO et SCHED_IDLE sont respectivement\n"
#~ msgid "SCHED_FIFO, SCHED_RR, SCHED_BATCH, SCHED_ISO, SCHED_IDLE and SCHED_DEADLINE are respectively\n"
#~ msgstr "SCHED_FIFO, SCHED_RR, SCHED_BATCH, SCHED_ISO, SCHED_IDLE et SCHED_DEADLINE sont respectivement\n"
#~ msgid "displayed as 0, 1, 2, 3, 4, and 5.\n"
#~ msgstr "affichées comme 0, 1, 2, 3, 4 et 5.\n"
#~ msgid "displayed as 0, 1, 2, 3, 4, 5 and 6.\n"
#~ msgstr "affichées comme 0, 1, 2, 3, 4, 5 et 6.\n"
#~ msgid "seat\tSEAT\tT{\n"
#~ msgstr "seat\tSEAT\tT{\n"
......
.\" Manual page for pgrep / pkill.
.\" Licensed under version 2 of the GNU General Public License.
.\"
.\" Copyright 2000 Kjetil Torgrim Homme
.\" 2017 Craig Small
.\"
.\" This program is free software; you can redistribute it and/or modify
.\" it under the terms of the GNU General Public License as published by
.\" the Free Software Foundation; either version 2 of the License, or
.\" (at your option) any later version.
.\"
.TH PGREP "1" "March 2015" "procps-ng" "User Commands"
.TH PGREP "1" "2017-02-04" "procps-ng" "User Commands"
.SH NAME
pgrep, pkill \- look up or signal processes based on name and other attributes
.SH SYNOPSIS
......@@ -197,10 +202,11 @@ $ renice +4 $(pgrep netscape)
.PD 0
.TP
0
One or more processes matched the criteria.
One or more processes matched the criteria. For pkill the process must also
have been successfully signalled.
.TP
1
No processes matched.
No processes matched or none of them could be signalled.
.TP
2
Syntax error in the command line.
......
......@@ -651,6 +651,11 @@ static struct el * select_procs (int *num)
}
closeproc (ptp);
*num = matches;
if ((!matches) && (!opt_full) && (strlen(opt_pattern) > 15))
xwarnx(_("pattern that searches for process name longer than 15 characters will result in zero matches\n"
"Try `%s -f' option to match against the complete command line."),
program_invocation_short_name);
return list;
}
......@@ -886,14 +891,7 @@ static void parse_opts (int argc, char **argv)
}
if (argc - optind == 1)
{
opt_pattern = argv[optind];
if ((!opt_full) && (strlen(opt_pattern) > 15))
xwarnx(_("pattern that contains program name longer than 15 characters will result in zero matches\n"
"Try `%s -f' option for thorough search."),
program_invocation_short_name);
}
else if (argc - optind > 1)
xerrx(EXIT_USAGE, _("only one pattern can be provided\n"
"Try `%s --help' for more information."),
......@@ -923,10 +921,12 @@ int main (int argc, char **argv)
procs = select_procs (&num);
if (i_am_pkill) {
int i;
int kill_count = 0;
for (i = 0; i < num; i++) {
if (kill (procs[i].num, opt_signal) != -1) {
if (opt_echo)
printf(_("%s killed (pid %lu)\n"), procs[i].str, procs[i].num);
kill_count++;
continue;
}
if (errno==ESRCH)
......@@ -936,6 +936,7 @@ int main (int argc, char **argv)
}
if (opt_count)
fprintf(stdout, "%d\n", num);
return !kill_count;
} else {
if (opt_count) {
fprintf(stdout, "%d\n", num);
......
......@@ -39,6 +39,10 @@ global:
look_up_our_self;
lookup_wchan;
meminfo;
numa_init;
numa_max_node;
numa_node_of_cpu;
numa_uninit;
openproc;
page_bytes;
pretty_print_signals;
......
/*
* NUMA node support for <PIDS> & <STAT> interfaces
* Copyright 2017 by James C. Warmer
*
* This library 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 library 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
*/
#ifndef NUMA_DISABLE
#include <dlfcn.h>
#endif
#include <stdlib.h>
#include "numa.h"
/*
* We're structured so that if numa_init() is NOT called or that ./configure |
* --disable-numa WAS specified, then calls to both of our primary functions |
* of numa_max_node() plus numa_node_of_cpu() would always return a negative |
* 1 which signifies that NUMA information isn't available. That ./configure |
* option might be required when libdl.so (necessary for dlopen) is missing. |
*/
/* ------------------------------------------------------------------------- +
a strictly development #define, existing specifically for the top program |
( and it has no affect if ./configure --disable-numa has been specified ) | */
//#define PRETEND_NUMA // pretend there are 3 'discontiguous' numa nodes |
// ------------------------------------------------------------------------- +
static int null_max_node (void) { return -1; }
static int null_node_of_cpu (int n) { (void)n; return -1; }
#ifndef NUMA_DISABLE
#ifdef PRETEND_NUMA
static int fake_max_node (void) { return 3; }
static int fake_node_of_cpu (int n) { return (1 == (n % 4)) ? 0 : (n % 4); }
#endif
#endif
#ifndef NUMA_DISABLE
static void *libnuma_handle;
#endif
int (*numa_max_node) (void) = null_max_node;
int (*numa_node_of_cpu) (int) = null_node_of_cpu;
void numa_init (void) {
static int initialized;
if (initialized)
return;
#ifndef NUMA_DISABLE
#ifndef PRETEND_NUMA
// we'll try for the most recent version, then a version we know works...
if ((libnuma_handle = dlopen("libnuma.so", RTLD_LAZY))
|| (libnuma_handle = dlopen("libnuma.so.1", RTLD_LAZY))) {
numa_max_node = dlsym(libnuma_handle, "numa_max_node");
numa_node_of_cpu = dlsym(libnuma_handle, "numa_node_of_cpu");
if (numa_max_node == NULL
|| (numa_node_of_cpu == NULL)) {
// this dlclose is safe - we've yet to call numa_node_of_cpu
// ( there's one other dlclose which has now been disabled )
dlclose(libnuma_handle);
libnuma_handle = NULL;
numa_max_node = null_max_node;
numa_node_of_cpu = null_node_of_cpu;
}
}
#else
libnuma_handle = (void *)-1;
numa_max_node = fake_max_node;
numa_node_of_cpu = fake_node_of_cpu;
#endif
#endif
initialized = 1;
} // end: numa_init
void numa_uninit (void) {
#ifndef PRETEND_NUMA
/* note: we'll skip a dlcose() to avoid the following libnuma memory
* leak which is triggered after a call to numa_node_of_cpu():
* ==1234== LEAK SUMMARY:
* ==1234== definitely lost: 512 bytes in 1 blocks
* ==1234== indirectly lost: 48 bytes in 2 blocks
* ==1234== ...
* [ thanks very much libnuma for all the pains you have caused us ]
*/
// if (libnuma_handle)
// dlclose(libnuma_handle);
#endif
} // end: numa_uninit
#if defined(PRETEND_NUMA) && defined(NUMA_DISABLE)
# warning 'PRETEND_NUMA' ignored, 'NUMA_DISABLE' is active
#endif
/*
* NUMA node support for <PIDS> & <STAT> interfaces
* Copyright 2017 by James C. Warmer
*
* This library 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 library 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
*/
#ifndef PROCPS_NUMA_H
#define PROCPS_NUMA_H
#include <features.h>
__BEGIN_DECLS
void numa_init (void);
void numa_uninit (void);
extern int (*numa_max_node) (void);
extern int (*numa_node_of_cpu) (int);
__END_DECLS
#endif
......@@ -624,11 +624,9 @@ LEAVE(0x160);
/////////////////////////////////////////////////////////////////////////
static void statm2proc(const char* s, proc_t *restrict P) {
int num __attribute__ ((unused));
num = sscanf(s, "%ld %ld %ld %ld %ld %ld %ld",
sscanf(s, "%ld %ld %ld %ld %ld %ld %ld",
&P->size, &P->resident, &P->share,
&P->trs, &P->lrs, &P->drs, &P->dt);
/* fprintf(stderr, "statm2proc converted %d fields.\n",num); */
}
static int file2str(const char *directory, const char *what, struct utlbuf_s *ub) {
......
......@@ -179,7 +179,7 @@ static int parse_slabinfo20(struct slab_info **list, struct slab_stat *stats,
curr->cache_size = (unsigned long)curr->nr_slabs * curr->pages_per_slab * page_size;
if (curr->nr_objs) {
curr->use = 100 * (curr->nr_active_objs / curr->nr_objs);
curr->use = 100 * (float)curr->nr_active_objs / curr->nr_objs;
stats->nr_active_caches++;
} else
curr->use = 0;
......@@ -258,7 +258,7 @@ static int parse_slabinfo11(struct slab_info **list, struct slab_stat *stats,
curr->cache_size = (unsigned long)curr->nr_slabs * curr->pages_per_slab * page_size;
if (curr->nr_objs) {
curr->use = 100 * curr->nr_active_objs / curr->nr_objs;
curr->use = 100 * (float)curr->nr_active_objs / curr->nr_objs;
stats->nr_active_caches++;
} else
curr->use = 0;
......
......@@ -46,11 +46,7 @@ const char * lookup_wchan (int pid) {
// lame ppc64 has a '.' in front of every name
if (*ret=='.') ret++;
switch (*ret){
case 's': if(!strncmp(ret, "sys_", 4)) ret += 4; break;
case 'd': if(!strncmp(ret, "do_", 3)) ret += 3; break;
case '_': while(*ret=='_') ret++; break;
default : break;
}
while(*ret=='_') ret++;
return ret;
}
......@@ -70,6 +70,7 @@
#include "../proc/procps.h"
#include "../proc/devname.h"
#include "../proc/escape.h"
#include "../proc/numa.h"
#include "common.h"
......@@ -147,8 +148,8 @@ static int sr_ ## NAME (const proc_t* P, const proc_t* Q) { \
#define CMP_NS(NAME, ID) \
static int sr_ ## NAME (const proc_t* P, const proc_t* Q) { \
if (P->ns[ID] < Q->ns[ID]) return -1; \
if (P->ns[ID] > Q->ns[ID]) return 1; \
if ((unsigned long)P->ns[ID] < (unsigned long)Q->ns[ID]) return -1; \
if ((unsigned long)P->ns[ID] > (unsigned long)Q->ns[ID]) return 1; \
return 0; \
}
......@@ -694,7 +695,7 @@ static int pr_class(char *restrict const outbuf, const proc_t *restrict const pp
case 3: return snprintf(outbuf, COLWID, "B"); // SCHED_BATCH
case 4: return snprintf(outbuf, COLWID, "ISO"); // reserved for SCHED_ISO (Con Kolivas)
case 5: return snprintf(outbuf, COLWID, "IDL"); // SCHED_IDLE
case 6: return snprintf(outbuf, COLWID, "#6"); //
case 6: return snprintf(outbuf, COLWID, "DLN"); // SCHED_DEADLINE
case 7: return snprintf(outbuf, COLWID, "#7"); //
case 8: return snprintf(outbuf, COLWID, "#8"); //
case 9: return snprintf(outbuf, COLWID, "#9"); //
......@@ -843,15 +844,15 @@ tsiz text size (in Kbytes)
***/
static int pr_stackp(char *restrict const outbuf, const proc_t *restrict const pp){
return snprintf(outbuf, COLWID, "%08x", (unsigned)(pp->start_stack));
return snprintf(outbuf, COLWID, "%0*lx", (int)(2*sizeof(long)), pp->start_stack);
}
static int pr_esp(char *restrict const outbuf, const proc_t *restrict const pp){
return snprintf(outbuf, COLWID, "%08x", (unsigned)(pp->kstk_esp));
return snprintf(outbuf, COLWID, "%0*lx", (int)(2*sizeof(long)), pp->kstk_esp);
}
static int pr_eip(char *restrict const outbuf, const proc_t *restrict const pp){
return snprintf(outbuf, COLWID, "%08x", (unsigned)(pp->kstk_eip));
return snprintf(outbuf, COLWID, "%0*lx", (int)(2*sizeof(long)), pp->kstk_eip);
}
/* This function helps print old-style time formats */
......@@ -975,6 +976,12 @@ static int pr_psr(char *restrict const outbuf, const proc_t *restrict const pp){
return snprintf(outbuf, COLWID, "%d", pp->processor);
}
static int pr_numa(char *restrict const outbuf, const proc_t *restrict const pp){
static int first = 1;
if (first) { numa_init(); first = 0; } // we'll keep this dependency local
return snprintf(outbuf, COLWID, "%d", numa_node_of_cpu(pp->processor));
}
static int pr_rss(char *restrict const outbuf, const proc_t *restrict const pp){
return snprintf(outbuf, COLWID, "%lu", pp->vm_rss);
}
......@@ -1236,7 +1243,7 @@ static int pr_sd_slice(char *restrict const outbuf, const proc_t *restrict const
#define _pr_ns(NAME, ID)\
static int pr_##NAME(char *restrict const outbuf, const proc_t *restrict const pp) {\
if (pp->ns[ID])\
return snprintf(outbuf, COLWID, "%li", pp->ns[ID]);\
return snprintf(outbuf, COLWID, "%lu", (unsigned long)pp->ns[ID]);\
else\
return snprintf(outbuf, COLWID, "-");\
}
......@@ -1262,13 +1269,14 @@ static int pr_lxcname(char *restrict const outbuf, const proc_t *restrict const
static int pr_context(char *restrict const outbuf, const proc_t *restrict const pp){
static void (*ps_freecon)(char*) = 0;
static int (*ps_getpidcon)(pid_t pid, char **context) = 0;
static int (*ps_is_selinux_enabled)(void) = 0;
static int tried_load = 0;
static int selinux_enabled = 0;
static int selinux_enabled = 0;;
size_t len;
char *context;
#if ENABLE_LIBSELINUX
static int (*ps_is_selinux_enabled)(void) = 0;
static int tried_load = 0;
if(!ps_getpidcon && !tried_load){
void *handle = dlopen("libselinux.so.1", RTLD_NOW);
if(handle){
......@@ -1475,11 +1483,11 @@ static const format_struct format_array[] = {
{"dsiz", "DSIZ", pr_dsiz, sr_nop, 4, 0, LNX, PO|RIGHT},
{"egid", "EGID", pr_egid, sr_egid, 5, 0, LNX, ET|RIGHT},
{"egroup", "EGROUP", pr_egroup, sr_egroup, 8, GRP, LNX, ET|USER},
{"eip", "EIP", pr_eip, sr_kstk_eip, 8, 0, LNX, TO|RIGHT},
{"eip", "EIP", pr_eip, sr_kstk_eip, (int)(2*sizeof(long)), 0, LNX, TO|RIGHT},
{"emul", "EMUL", pr_nop, sr_nop, 13, 0, BSD, PO|LEFT}, /* "FreeBSD ELF32" and such */
{"end_code", "E_CODE", pr_nop, sr_end_code, 8, 0, LNx, PO|RIGHT},
{"end_code", "E_CODE", pr_nop, sr_end_code, (int)(2*sizeof(long)), 0, LNx, PO|RIGHT},
{"environ","ENVIRONMENT",pr_nop, sr_nop, 11, ENV, LNx, PO|UNLIMITED},
{"esp", "ESP", pr_esp, sr_kstk_esp, 8, 0, LNX, TO|RIGHT},
{"esp", "ESP", pr_esp, sr_kstk_esp, (int)(2*sizeof(long)), 0, LNX, TO|RIGHT},
{"etime", "ELAPSED", pr_etime, sr_etime, 11, 0, U98, ET|RIGHT}, /* was 7 wide */
{"etimes", "ELAPSED", pr_etimes, sr_etime, 7, 0, BSD, ET|RIGHT}, /* FreeBSD */
{"euid", "EUID", pr_euid, sr_euid, 5, 0, LNX, ET|RIGHT},
......@@ -1544,6 +1552,7 @@ static const format_struct format_array[] = {
{"nsignals", "NSIGS", pr_nop, sr_nop, 5, 0, DEC, AN|RIGHT}, /*nsigs*/
{"nsigs", "NSIGS", pr_nop, sr_nop, 5, 0, BSD, AN|RIGHT}, /*nsignals*/
{"nswap", "NSWAP", pr_nop, sr_nop, 5, 0, XXX, AN|RIGHT},
{"numa", "NUMA", pr_numa, sr_nop, 4, 0, XXX, AN|RIGHT},
{"nvcsw", "VCSW", pr_nop, sr_nop, 5, 0, XXX, AN|RIGHT},
{"nwchan", "WCHAN", pr_nwchan, sr_nop, 6, 0, XXX, TO|RIGHT},
{"opri", "PRI", pr_opri, sr_priority, 3, 0, SUN, TO|RIGHT},
......@@ -1613,10 +1622,10 @@ static const format_struct format_array[] = {
{"sl", "SL", pr_nop, sr_nop, 3, 0, XXX, AN|RIGHT},
{"slice", "SLICE", pr_sd_slice, sr_nop, 31, SD, LNX, ET|LEFT},
{"spid", "SPID", pr_tasks, sr_tasks, 5, 0, SGI, TO|PIDMAX|RIGHT},
{"stackp", "STACKP", pr_stackp, sr_start_stack, 8, 0, LNX, PO|RIGHT}, /*start_stack*/
{"stackp", "STACKP", pr_stackp, sr_start_stack, (int)(2*sizeof(long)), 0, LNX, PO|RIGHT}, /*start_stack*/
{"start", "STARTED", pr_start, sr_nop, 8, 0, XXX, ET|RIGHT},
{"start_code", "S_CODE", pr_nop, sr_start_code, 8, 0, LNx, PO|RIGHT},
{"start_stack", "STACKP", pr_stackp, sr_start_stack, 8, 0, LNX, PO|RIGHT}, /*stackp*/
{"start_code", "S_CODE", pr_nop, sr_start_code, (int)(2*sizeof(long)), 0, LNx, PO|RIGHT},
{"start_stack", "STACKP", pr_stackp, sr_start_stack, (int)(2*sizeof(long)), 0, LNX, PO|RIGHT}, /*stackp*/
{"start_time", "START", pr_stime, sr_start_time, 5, 0, LNx, ET|RIGHT},
{"stat", "STAT", pr_stat, sr_state, 4, 0, BSD, TO|LEFT}, /*state,s*/
{"state", "S", pr_s, sr_state, 1, 0, XXX, TO|LEFT}, /*stat,s*/ /* was STAT */
......@@ -1792,7 +1801,7 @@ static const aix_struct aix_array[] = {
{'z', "vsz", "VSZ"},
{'~', "~", "~"} /* NULL would ruin alphabetical order */
};
static const int aix_array_count = sizeof(aix_array)/sizeof(aix_struct);
//static const int aix_array_count = sizeof(aix_array)/sizeof(aix_struct);
/********************* sorting ***************************/
......@@ -1826,7 +1835,7 @@ static const shortsort_struct shortsort_array[] = {
{'y', "priority" }, /* nice */
{'~', "~" } /* NULL would ruin alphabetical order */
};
static const int shortsort_array_count = sizeof(shortsort_array)/sizeof(shortsort_struct);
//static const int shortsort_array_count = sizeof(shortsort_array)/sizeof(shortsort_struct);
/*********** print format_array **********/
......
......@@ -1096,7 +1096,7 @@ static int arg_type(const char *str){
if((tmp>='a') && (tmp<='z')) return ARG_GNU;
if((tmp>='A') && (tmp<='Z')) return ARG_GNU;
if(tmp=='\0') return ARG_END;
return ARG_FAIL;
return ARG_FAIL;
}
/* First assume sysv, because that is the POSIX and Unix98 standard. */
......
......@@ -4,7 +4,7 @@
.\" Quick hack conversion by Albert Cahalan, 1998.
.\" Licensed under version 2 of the Gnu General Public License.
.\"
.TH PS 1 "August 2015" "procps-ng" "User Commands"
.TH PS 1 "May 2017" "procps-ng" "User Commands"
.\"
.\" To render this page:
.\" groff -t -b -man -X -P-resolution -P100 -Tps ps.1 &
......@@ -1107,6 +1107,8 @@ ISO SCHED_ISO
.br
IDL SCHED_IDLE
.br
DLN SCHED_DEADLINE
.br
? unknown value
T}
......@@ -1129,6 +1131,8 @@ ISO SCHED_ISO
.br
IDL SCHED_IDLE
.br
DLN SCHED_DEADLINE
.br
? unknown value
T}
......@@ -1375,6 +1379,11 @@ number of lwps (threads) in the process. (alias
.BR thcount ).
T}
numa NUMA T{
The node assocated with the most recently used processor.
A -1 means that NUMA information is unavailable.
T}
nwchan WCHAN T{
address of the kernel function where the process is sleeping (use
.B wchan
......@@ -1455,6 +1464,8 @@ ISO SCHED_ISO
.br
IDL SCHED_IDLE
.br
DLN SCHED_DEADLINE
.br
? unknown value
T}
......@@ -1523,8 +1534,8 @@ T}
sched SCH T{
scheduling policy of the process. The policies SCHED_OTHER (SCHED_NORMAL),
SCHED_FIFO, SCHED_RR, SCHED_BATCH, SCHED_ISO, and SCHED_IDLE are respectively
displayed as 0, 1, 2, 3, 4, and 5.
SCHED_FIFO, SCHED_RR, SCHED_BATCH, SCHED_ISO, SCHED_IDLE and SCHED_DEADLINE are
respectively displayed as 0, 1, 2, 3, 4, 5 and 6.
T}
seat SEAT T{
......
......@@ -238,7 +238,7 @@ static const char *format_parse(sf_node *sfn){
need_item=0;
}
} while (*++walk);
out:
if(!items){
free(buf);
goto empty;
......
......@@ -173,10 +173,12 @@ void debug(int method, char *prog_name){
}
/************/
#if 0
static void stack_trace_sigsegv(int signum){
(void)signum;
debug(STACK_TRACE, stored_prog_name);
}
#endif
/************/
#ifdef DEBUG
......
......@@ -422,6 +422,7 @@ static void __attribute__ ((__noreturn__))
int loop = 1;
long pid;
int exitvalue = EXIT_SUCCESS;
char *sig_option;
static const struct option longopts[] = {
{"list", optional_argument, NULL, 'l'},
......@@ -448,14 +449,20 @@ static void __attribute__ ((__noreturn__))
while (loop == 1 && (i = getopt_long(argc, argv, "l::Ls:hV", longopts, NULL)) != -1)
switch (i) {
case 'l':
if (optarg) {
sig_option = NULL;
if (optarg) {
sig_option = optarg;
} else if (argv[optind] != NULL && argv[optind][0] != '-') {
sig_option = argv[optind];
}
if (sig_option) {
char *s;
s = strtosig(optarg);
s = strtosig(sig_option);
if (s)
printf("%s\n", s);
else
xwarnx(_("unknown signal name %s"),
optarg);
sig_option);
free(s);
} else {
unix_print_signals();
......
......@@ -209,8 +209,13 @@ static int ReadSetting(const char *restrict const name)
}
if (pattern && !pattern_match(outname, pattern)) {
free(outname);
return 0;
rc = 0;
goto out;
}
if (NameOnly) {
fprintf(stdout, "%s\n", outname);
goto out;
}
fp = fopen(tmpname, "r");
......@@ -239,24 +244,25 @@ static int ReadSetting(const char *restrict const name)
* /sbin/sysctl -a | egrep -6 dev.cdrom.info
*/
do {
if (NameOnly) {
fprintf(stdout, "%s\n", outname);
} else {
/* already has the \n in it */
if (PrintName) {
fprintf(stdout, "%s = %s",
outname, inbuf);
if (inbuf[strlen(inbuf) - 1] != '\n')
putchar('\n');
} else {
if (!PrintNewline) {
char *nlptr =
strchr(inbuf, '\n');
if (nlptr)
*nlptr = '\0';
}
char *nlptr;
if (PrintName) {
fprintf(stdout, "%s = ", outname);
do {
fprintf(stdout, "%s", inbuf);
nlptr = &inbuf[strlen(inbuf) - 1];
/* already has the \n in it */
if (*nlptr == '\n')
break;
} while (fgets(inbuf, sizeof inbuf - 1, fp));
if (*nlptr != '\n')
putchar('\n');
} else {
if (!PrintNewline) {
nlptr = strchr(inbuf, '\n');
if (nlptr)
*nlptr = '\0';
}
fprintf(stdout, "%s", inbuf);
}
} while (fgets(inbuf, sizeof inbuf - 1, fp));
} else {
......
......@@ -29,13 +29,13 @@ Note that blank lines are ignored, and whitespace before and after a token or
value is ignored, although a value can contain whitespace within. Lines which
begin with a # or ; are considered comments and ignored.
.SH NOTES
As the
As the
.BR /etc/sysctl.conf
file is used to override default kernel parameter values, only a small number of parameters is predefined in the file.
Use
Use
.IR /sbin/sysctl\ \-a
or follow
.BR sysctl (8)
or follow
.BR sysctl (8)
to list all possible parameters. The description of individual parameters can be found in the kernel documentation.
.SH EXAMPLE
.RS
......
......@@ -20,15 +20,28 @@ set test "kill list signal names in table"
spawn $kill -L
expect_pass "$test" "^\(\\s+\\d+ \[A-Z12+-\]+\)+\\s*$"
set test "kill convert signal name to number"
set test "kill convert signal name to number no space"
spawn $kill -lHUP
expect_pass "$test" "^1\\s*"
set test "kill convert SIG-prefixed signal name to number"
set test "kill convert signal name to number with space"
spawn $kill -l HUP
expect_pass "$test" "^1\\s*"
set test "kill convert SIG-prefixed signal name to number no space"
spawn $kill -lSIGHUP
expect_pass "$test" "^1\\s*$"
set test "kill convert signal number to name"
set test "kill convert SIG-prefixed signal name to number with space"
spawn $kill -l SIGHUP