Commit 1b7cbece authored by Wayne Porter's avatar Wayne Porter

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

parents fd42ecbb 639c5831
Pipeline #3669547 failed with stage
in 2 minutes and 30 seconds
# This file is generated by GitLab CI
Testsuites:
before_script:
- apt-get update -qq && apt-get install -y -qq autopoint autoconf automake libtool-bin gettext libncursesw5-dev dejagnu libnuma-dev libsystemd-dev
MakeCheck:
script:
- "./autogen.sh"
- "./configure"
- make
- make check
- make clean
tags:
except:
- tags
pages:
script:
- echo "Building website"
artifacts:
paths:
- public
only:
- master
- "./autogen.sh"
- "./configure"
- make
- make check
- make clean
......@@ -3,6 +3,12 @@ procps-ng-NEXT
* ps: sort by cgroup Debian #692279
* ps: display control group name with -o cgname
* ps: Fallback to attr/current for context Debian #786956
* tests: Conditionally add prctl Debian #816237
* pidof: check cmd if space in argv0. GitLab #4
* kill: report error if cannot kill process Debian #733172
* watch: Add hostname to header
* library: Find tty quicker Debian #770215
* watch,free: use locale-independent float Debian #692113
procps-ng-3.3.11
----------------
......
......@@ -203,14 +203,6 @@ AC_ARG_ENABLE([examples],
)
AM_CONDITIONAL(EXAMPLE_FILES, test "x$enable_examples" = xyes)
AC_ARG_ENABLE([oomem],
AS_HELP_STRING([--enable-oomem], [add out-of-memory fields to the library and top]),
[], [enable_oomem=no]
)
if test "x$enable_oomem" = xyes; then
AC_DEFINE(OOMEM_ENABLE, 1, [add out-of-memory fields to the library and top])
fi
AC_ARG_ENABLE([sigwinch],
AS_HELP_STRING([--enable-sigwinch], [reduce impact of x-windows resize operations on top]),
[], [enable_sigwinch=no]
......
......@@ -2,7 +2,7 @@
.\" This page Copyright (C) 1993 Matt Welsh, mdw@sunsite.unc.edu.
.\" Long options where added at April 15th, 2011.
.\" Freely distributable under the terms of the GPL
.TH FREE 1 "Apr 2015" "procps-ng" "User Commands"
.TH FREE 1 "2016-06-03" "procps-ng" "User Commands"
.SH NAME
free \- Display amount of free and used memory in the system
.SH SYNOPSIS
......@@ -25,8 +25,7 @@ Used memory (calculated as \fBtotal\fR - \fBfree\fR - \fBbuffers\fR - \fBcache\f
Unused memory (MemFree and SwapFree in /proc/meminfo)
.TP
\fBshared\fR
Memory used (mostly) by tmpfs (Shmem in /proc/meminfo, available on
kernels 2.6.32, displayed as zero if not available)
Memory used (mostly) by tmpfs (Shmem in /proc/meminfo)
.TP
\fBbuffers\fR
Memory used by kernel buffers (Buffers in /proc/meminfo)
......@@ -111,11 +110,10 @@ option.
\fB\-l\fR, \fB\-\-lohi\fR
Show detailed low and high memory statistics.
.TP
\fB\-s\fR, \fB\-\-seconds\fR \fIseconds\fR
Continuously display the result delay
.I seconds
\fB\-s\fR, \fB\-\-seconds\fR \fIdelay\fR
Continuously display the result \fIdelay\fR seconds
apart. You may actually specify any floating point number for
.IR delay ,
\fIdelay\fR using either . or , for decimal point.
.BR usleep (3)
is used for microsecond resolution delay times.
.TP
......@@ -137,14 +135,15 @@ Display version information.
/proc/meminfo
memory information
.PD
.SH BUGS
The value for the \fBshared\fR column is not available from kernels before
2.6.32 and is displayed as zero.
.TP
Please send bug reports to
.UR procps@freelists.org
.UE
.SH "SEE ALSO"
.BR ps (1),
.BR slabtop (1),
.BR top "(1),
.BR vmstat (8).
.SH AUTHORS
Written by Brian Edmonds.
.SH "REPORTING BUGS"
Please send bug reports to
.UR procps@freelists.org
.UE
......@@ -324,9 +324,7 @@ int main(int argc, char **argv)
case 's':
flags |= FREE_REPEAT;
errno = 0;
args.repeat_interval = (1000000 * strtof(optarg, &endptr));
if (errno || optarg == endptr || (endptr && *endptr))
xerrx(EXIT_FAILURE, _("seconds argument `%s' failed"), optarg);
args.repeat_interval = (1000000 * strtod_nol_or_err(optarg, "seconds argument failed"));
if (args.repeat_interval < 1)
xerrx(EXIT_FAILURE,
_("seconds argument `%s' is not positive number"), optarg);
......
......@@ -21,7 +21,7 @@
#include <stdlib.h>
#include <unistd.h>
#include <signal.h>
#ifndef __CYGWIN__
#ifdef __linux__
#include <sys/prctl.h>
#endif
#include "c.h"
......@@ -80,7 +80,7 @@ int main(int argc, char *argv[])
sigaction(SIGUSR1, &signal_action, NULL);
sigaction(SIGUSR2, &signal_action, NULL);
#ifndef __CYGWIN__
#ifdef __linux__
/* set process name */
prctl(PR_SET_NAME, MY_NAME, NULL, NULL, NULL);
#endif
......
......@@ -210,6 +210,12 @@ static void select_procs (void)
match = 1;
}
}
/* If there is a space in arg0 then process probably has
* setproctitle so use the cmdline
*/
if (!match && strchr(cmd_arg0, ' ')) {
match = (strcmp(program, task.cmd)==0);
}
safe_free(exe_link);
......
......@@ -201,7 +201,7 @@ static void discover_shm_minor(void)
perror(_("shared memory detach"));
out_destroy:
if (shmctl(shmid, IPC_RMID, NULL))
if (shmctl(shmid, IPC_RMID, NULL) && errno != EINVAL)
perror(_("shared memory remove"));
return;
......@@ -629,9 +629,9 @@ static int one_proc(proc_t * p)
diff = 0;
continue;
}
/* Other keys */
continue;
}
/* Other keys or not a key-value pair */
continue;
}
sscanf(mapbuf, "%" KLF "x-%" KLF "x %31s %llx %x:%x %llu", &start,
&end, perms, &file_offset, &dev_major, &dev_minor,
......
......@@ -133,9 +133,12 @@ static int driver_name(char *restrict const buf, unsigned maj, unsigned min){
}
sprintf(buf, "/dev/%s%d", tmn->name, min); /* like "/dev/ttyZZ255" */
if(stat(buf, &sbuf) < 0){
if(tmn->devfs_type) return 0;
sprintf(buf, "/dev/%s", tmn->name); /* like "/dev/ttyZZ255" */
if(stat(buf, &sbuf) < 0) return 0;
sprintf(buf, "/dev/%s/%d", tmn->name, min); /* like "/dev/pts/255" */
if(stat(buf, &sbuf) < 0){
if(tmn->devfs_type) return 0;
sprintf(buf, "/dev/%s", tmn->name); /* like "/dev/ttyZZ255" */
if(stat(buf, &sbuf) < 0) return 0;
}
}
if(min != MINOR_OF(sbuf.st_rdev)) return 0;
if(maj != MAJOR_OF(sbuf.st_rdev)) return 0;
......
......@@ -58,7 +58,7 @@ global:
tty_to_dev;
unix_print_signals;
uptime;
user_from_uid;
pwcache_get_user;
procps_linux_version;
local:
*;
......
......@@ -41,7 +41,7 @@ static struct pwbuf {
char name[P_G_SZ];
} *pwhash[HASHSIZE];
char *user_from_uid(uid_t uid) {
char *pwcache_get_user(uid_t uid) {
struct pwbuf **p;
struct passwd *pw;
......@@ -69,7 +69,7 @@ static struct grpbuf {
char name[P_G_SZ];
} *grphash[HASHSIZE];
char *group_from_gid(gid_t gid) {
char *pwcache_get_group(gid_t gid) {
struct grpbuf **g;
struct group *gr;
......
......@@ -9,8 +9,8 @@ EXTERN_C_BEGIN
// used in pwcache and in readproc to set size of username or groupname
#define P_G_SZ 33
extern char *user_from_uid(uid_t uid);
extern char *group_from_gid(gid_t gid);
char *pwcache_get_user(uid_t uid);
char *pwcache_get_group(gid_t gid);
EXTERN_C_END
......
This diff is collapsed.
......@@ -116,6 +116,9 @@ typedef struct proc_t {
vm_size, // status equals 'size' (as kb)
vm_lock, // status locked pages (as kb)
vm_rss, // status equals 'rss' and/or 'resident' (as kb)
vm_rss_anon, // status the 'anonymous' portion of vm_rss (as kb)
vm_rss_file, // status the 'file-backed' portion of vm_rss (as kb)
vm_rss_shared, // status the 'shared' portion of vm_rss (as kb)
vm_data, // status data only size (as kb)
vm_stack, // status stack only size (as kb)
vm_swap, // status based on linux-2.6.34 "swap ents" (as kb)
......@@ -134,6 +137,7 @@ typedef struct proc_t {
**environ, // (special) environment string vector (/proc/#/environ)
**cmdline, // (special) command line string vector (/proc/#/cmdline)
**cgroup, // (special) cgroup string vector (/proc/#/cgroup)
*cgname, // (special) name portion of above (if possible)
*supgid, // status supplementary gids as comma delimited str
*supgrp; // supp grp names as comma delimited str, derived from supgid
char
......@@ -164,14 +168,11 @@ typedef struct proc_t {
tpgid, // stat terminal process group id
exit_signal, // stat might not be SIGCHLD
processor; // stat current (or most recent?) CPU
#ifdef OOMEM_ENABLE
int
oom_score, // oom_score (badness for OOM killer)
oom_adj; // oom_adj (adjustment to OOM score)
#endif
long
ns[NUM_NS]; // (ns subdir) inode number of namespaces
#ifdef WITH_SYSTEMD
char
*sd_mach, // n/a systemd vm/container name
*sd_ouid, // n/a systemd session owner uid
......@@ -180,7 +181,6 @@ typedef struct proc_t {
*sd_slice, // n/a systemd slice unit
*sd_unit, // n/a systemd system unit id
*sd_uunit; // n/a systemd user unit id
#endif
const char
*lxcname; // n/a lxc container name
} proc_t;
......
......@@ -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 * (curr->nr_active_objs / curr->nr_objs);
stats->nr_active_caches++;
} else
curr->use = 0;
......
......@@ -962,7 +962,7 @@ unsigned int getdiskstat(struct disk_stat **disks, struct partition_stat **parti
int cPartition = 0;
int fields;
unsigned dummy;
char devname[32];
char devname[35];
*disks = NULL;
*partitions = NULL;
......@@ -975,10 +975,10 @@ unsigned int getdiskstat(struct disk_stat **disks, struct partition_stat **parti
fclose(fd);
break;
}
fields = sscanf(buff, " %*d %*d %15s %*u %*u %*u %*u %*u %*u %*u %*u %*u %*u %u", devname, &dummy);
fields = sscanf(buff, " %*d %*d %34s %*u %*u %*u %*u %*u %*u %*u %*u %*u %*u %u", devname, &dummy);
if (fields == 2 && is_disk(devname)){
(*disks) = xrealloc(*disks, (cDisk+1)*sizeof(struct disk_stat));
sscanf(buff, " %*d %*d %15s %u %u %llu %u %u %u %llu %u %u %u %u",
sscanf(buff, " %*d %*d %31s %u %u %llu %u %u %u %llu %u %u %u %u",
//&disk_major,
//&disk_minor,
(*disks)[cDisk].disk_name,
......@@ -1000,8 +1000,8 @@ unsigned int getdiskstat(struct disk_stat **disks, struct partition_stat **parti
(*partitions) = xrealloc(*partitions, (cPartition+1)*sizeof(struct partition_stat));
fflush(stdout);
sscanf(buff, (fields == 2)
? " %*d %*d %15s %u %*u %llu %*u %u %*u %llu %*u %*u %*u %*u"
: " %*d %*d %15s %u %llu %u %llu",
? " %*d %*d %34s %u %*u %llu %*u %u %*u %llu %*u %*u %*u %*u"
: " %*d %*d %34s %u %llu %u %llu",
//&part_major,
//&part_minor,
(*partitions)[cPartition].partition_name,
......
......@@ -101,7 +101,7 @@ extern void vminfo(void);
typedef struct disk_stat{
unsigned long long reads_sectors;
unsigned long long written_sectors;
char disk_name [16];
char disk_name [32];
unsigned inprogress_IO;
unsigned merged_reads;
unsigned merged_writes;
......@@ -115,7 +115,7 @@ typedef struct disk_stat{
}disk_stat;
typedef struct partition_stat{
char partition_name [16];
char partition_name [35];
unsigned long long reads_sectors;
unsigned parent_disk; // index into a struct disk_stat array
unsigned reads;
......
......@@ -104,26 +104,6 @@ static int sr_cgroup(const proc_t* a, const proc_t* b)
return strcmp(*a->cgroup, *b->cgroup);
}
static int sr_cgname(const proc_t* a, const proc_t* b)
{
char *aname, *bname;
/* This is a "vector" of one */
if (*a->cgroup == NULL || *b->cgroup == NULL)
return 0;
aname = strstr(*a->cgroup, ":name=");
bname = strstr(*b->cgroup, ":name=");
/* check for missing names, they win */
if (aname == NULL || aname[6] == '\0') {
if (bname == NULL || bname[6] == '\0')
return 0;
return -1;
} else if (bname == NULL || bname[6] == '\0')
return 1;
return strcmp(aname+6,bname+6);
}
#define CMP_STR(NAME) \
static int sr_ ## NAME(const proc_t* P, const proc_t* Q) { \
return strcmp(P->NAME, Q->NAME); \
......@@ -255,6 +235,7 @@ CMP_NS(userns, USERNS);
CMP_NS(utsns, UTSNS);
CMP_STR(lxcname)
CMP_STR(cgname)
/* approximation to: kB of address space that could end up in swap */
static int sr_swapable(const proc_t* P, const proc_t* Q) {
......@@ -464,27 +445,18 @@ static int pr_comm(char *restrict const outbuf, const proc_t *restrict const pp)
return max_rightward-rightward;
}
static int pr_cgroup(char *restrict const outbuf,const proc_t *restrict const pp) {
static int pr_cgname(char *restrict const outbuf, const proc_t *restrict const pp){
int rightward = max_rightward;
escaped_copy(outbuf, *pp->cgroup, OUTBUF_SIZE, &rightward);
escaped_copy(outbuf, pp->cgname, OUTBUF_SIZE, &rightward);
return max_rightward-rightward;
}
static int pr_cgname(char *restrict const outbuf,const proc_t *restrict const pp) {
static int pr_cgroup(char *restrict const outbuf,const proc_t *restrict const pp) {
int rightward = max_rightward;
int i;
char *name;
if ((name = strstr(*pp->cgroup, ":name=")) != NULL) {
name += 6;
if (name != '\0') {
escape_str(outbuf, name, OUTBUF_SIZE, &rightward);
return max_rightward - rightward;
}
}
/* fallback: use full cgroup for name */
return pr_cgroup(outbuf, pp);
escaped_copy(outbuf, *pp->cgroup, OUTBUF_SIZE, &rightward);
return max_rightward-rightward;
}
/* Non-standard, from SunOS 5 */
......@@ -1229,7 +1201,6 @@ static int pr_sgi_p(char *restrict const outbuf, const proc_t *restrict const pp
return snprintf(outbuf, COLWID, "*");
}
#ifdef WITH_SYSTEMD
/************************* Systemd stuff ********************************/
static int pr_sd_unit(char *restrict const outbuf, const proc_t *restrict const pp){
return snprintf(outbuf, COLWID, "%s", pp->sd_unit);
......@@ -1258,7 +1229,6 @@ static int pr_sd_seat(char *restrict const outbuf, const proc_t *restrict const
static int pr_sd_slice(char *restrict const outbuf, const proc_t *restrict const pp){
return snprintf(outbuf, COLWID, "%s", pp->sd_slice);
}
#endif
/************************ Linux namespaces ******************************/
#define _pr_ns(NAME, ID)\
......@@ -1441,9 +1411,7 @@ static int pr_t_left2(char *restrict const outbuf, const proc_t *restrict const
#define GRP PROC_FILLGRP /* gid_t -> group names */
#define NS PROC_FILLNS /* read namespace information */
#define LXC PROC_FILL_LXC /* value the lxc name field */
#ifdef WITH_SYSTEMD
#define SD PROC_FILLSYSTEMD /* retrieve systemd stuff */
#endif
#define SGRP PROC_FILLSTATUS | PROC_FILLSUPGRP /* supgid -> supgrp (names) */
#define CGRP PROC_FILLCGROUP | PROC_EDITCGRPCVT /* read cgroup */
......@@ -1543,9 +1511,7 @@ static const format_struct format_array[] = {
{"login", "LOGNAME", pr_nop, sr_nop, 8, 0, BSD, AN|LEFT}, /*logname*/ /* double check */
{"logname", "LOGNAME", pr_nop, sr_nop, 8, 0, XXX, AN|LEFT}, /*login*/
{"longtname", "TTY", pr_tty8, sr_tty, 8, 0, DEC, PO|LEFT},
#ifdef WITH_SYSTEMD
{"lsession", "SESSION", pr_sd_session, sr_nop, 11, SD, LNX, ET|LEFT},
#endif
{"lstart", "STARTED", pr_lstart, sr_nop, 24, 0, XXX, ET|RIGHT},
{"luid", "LUID", pr_nop, sr_nop, 5, 0, LNX, ET|RIGHT}, /* login ID */
{"luser", "LUSER", pr_nop, sr_nop, 8, USR, LNX, ET|USER}, /* login USER */
......@@ -1559,9 +1525,7 @@ static const format_struct format_array[] = {
{"m_size", "SIZE", pr_size, sr_size, 5, MEM, LNX, PO|RIGHT},
{"m_swap", "SWAP", pr_nop, sr_nop, 5, 0, LNx, PO|RIGHT},
{"m_trs", "TRS", pr_trs, sr_trs, 5, MEM, LNx, PO|RIGHT},
#ifdef WITH_SYSTEMD
{"machine", "MACHINE", pr_sd_machine, sr_nop, 31, SD, LNX, ET|LEFT},
#endif
{"maj_flt", "MAJFL", pr_majflt, sr_maj_flt, 6, 0, LNX, AN|RIGHT},
{"majflt", "MAJFLT", pr_majflt, sr_maj_flt, 6, 0, XXX, AN|RIGHT},
{"min_flt", "MINFL", pr_minflt, sr_min_flt, 6, 0, LNX, AN|RIGHT},
......@@ -1584,9 +1548,7 @@ static const format_struct format_array[] = {
{"osz", "SZ", pr_nop, sr_nop, 2, 0, SUN, PO|RIGHT},
{"oublk", "OUBLK", pr_nop, sr_nop, 5, 0, BSD, AN|RIGHT}, /*oublock*/
{"oublock", "OUBLK", pr_nop, sr_nop, 5, 0, DEC, AN|RIGHT}, /*oublk*/
#ifdef WITH_SYSTEMD
{"ouid", "OWNER", pr_sd_ouid, sr_nop, 5, SD, LNX, ET|LEFT},
#endif
{"p_ru", "P_RU", pr_nop, sr_nop, 6, 0, BSD, AN|RIGHT},
{"paddr", "PADDR", pr_nop, sr_nop, 6, 0, BSD, AN|RIGHT},
{"pagein", "PAGEIN", pr_majflt, sr_maj_flt, 6, 0, XXX, AN|RIGHT},
......@@ -1628,9 +1590,7 @@ static const format_struct format_array[] = {
{"sched", "SCH", pr_sched, sr_sched, 3, 0, AIX, TO|RIGHT},
{"scnt", "SCNT", pr_nop, sr_nop, 4, 0, DEC, AN|RIGHT}, /* man page misspelling of scount? */
{"scount", "SC", pr_nop, sr_nop, 4, 0, AIX, AN|RIGHT}, /* scnt==scount, DEC claims both */
#ifdef WITH_SYSTEMD
{"seat", "SEAT", pr_sd_seat, sr_nop, 11, SD, LNX, ET|LEFT},
#endif
{"sess", "SESS", pr_sess, sr_session, 5, 0, XXX, PO|PIDMAX|RIGHT},
{"session", "SESS", pr_sess, sr_session, 5, 0, LNX, PO|PIDMAX|RIGHT},
{"sgi_p", "P", pr_sgi_p, sr_nop, 1, 0, LNX, TO|RIGHT}, /* "cpu" number */
......@@ -1649,9 +1609,7 @@ static const format_struct format_array[] = {
{"sigmask", "BLOCKED", pr_sigmask, sr_nop, 9, 0, XXX, TO|SIGNAL}, /*blocked*/
{"size", "SIZE", pr_swapable, sr_swapable, 5, 0, SCO, PO|RIGHT},
{"sl", "SL", pr_nop, sr_nop, 3, 0, XXX, AN|RIGHT},
#ifdef WITH_SYSTEMD
{"slice", "SLICE", pr_sd_slice, sr_nop, 31, SD, LNX, ET|LEFT},
#endif
{"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*/
{"start", "STARTED", pr_start, sr_nop, 8, 0, XXX, ET|RIGHT},
......@@ -1700,9 +1658,7 @@ static const format_struct format_array[] = {
{"uid_hack", "UID", pr_euser, sr_euser, 8, USR, XXX, ET|USER},
{"umask", "UMASK", pr_nop, sr_nop, 5, 0, DEC, AN|RIGHT},
{"uname", "USER", pr_euser, sr_euser, 8, USR, DEC, ET|USER}, /* man page misspelling of user? */
#ifdef WITH_SYSTEMD
{"unit", "UNIT", pr_sd_unit, sr_nop, 31, SD, LNX, ET|LEFT},
#endif
{"upr", "UPR", pr_nop, sr_nop, 3, 0, BSD, TO|RIGHT}, /*usrpri*/
{"uprocp", "UPROCP", pr_nop, sr_nop, 8, 0, BSD, AN|RIGHT},
{"user", "USER", pr_euser, sr_euser, 8, USR, U98, ET|USER}, /* BSD n forces this to UID */
......@@ -1712,9 +1668,7 @@ static const format_struct format_array[] = {
{"util", "C", pr_c, sr_pcpu, 2, 0, SGI, ET|RIGHT}, // not sure about "C"
{"utime", "UTIME", pr_nop, sr_utime, 6, 0, LNx, ET|RIGHT},
{"utsns", "UTSNS", pr_utsns, sr_utsns, 10, NS, LNX, ET|RIGHT},
#ifdef WITH_SYSTEMD
{"uunit", "UUNIT", pr_sd_uunit, sr_nop, 31, SD, LNX, ET|LEFT},
#endif
{"vm_data", "DATA", pr_nop, sr_vm_data, 5, 0, LNx, PO|RIGHT},
{"vm_exe", "EXE", pr_nop, sr_vm_exe, 5, 0, LNx, PO|RIGHT},
{"vm_lib", "LIB", pr_nop, sr_vm_lib, 5, 0, LNx, PO|RIGHT},
......
......@@ -43,7 +43,7 @@
#include "proc/pwcache.h"
#include "proc/sig.h"
#include "proc/devname.h"
#include "proc/procps.h" /* char *user_from_uid(uid_t uid) */
#include "proc/procps.h" /* char *pwcache_get_user(uid_t uid) */
#include "proc/readproc.h"
#include "proc/version.h" /* procps_version */
#include "rpmatch.h"
......@@ -134,7 +134,7 @@ static void hurt_proc(int tty, int uid, int pid, const char *restrict const cmd,
char *buf;
size_t len = 0;
fprintf(stderr, "%-8s %-8s %5d %-16.16s ? ",
(char *)dn_buf, user_from_uid(uid), pid, cmd);
(char *)dn_buf, pwcache_get_user(uid), pid, cmd);
fflush (stdout);
if (getline(&buf, &len, stdin) == -1)
return;
......@@ -152,7 +152,7 @@ static void hurt_proc(int tty, int uid, int pid, const char *restrict const cmd,
failed = setpriority(PRIO_PROCESS, pid, sig_or_pri);
if ((run_time->warnings && failed) || run_time->debugging || run_time->verbose) {
fprintf(stderr, "%-8s %-8s %5d %-16.16s ",
(char *)dn_buf, user_from_uid(uid), pid, cmd);
(char *)dn_buf, pwcache_get_user(uid), pid, cmd);
perror("");
return;
}
......@@ -479,7 +479,7 @@ static void __attribute__ ((__noreturn__))
} else {
/* Special case for signal digit negative
* PIDs */
pid = (long)('0' - optopt);
pid = atoi(argv[optind]);
if (kill((pid_t)pid, signo) != 0)
exitvalue = EXIT_FAILURE;
exit(exitvalue);
......@@ -500,6 +500,7 @@ static void __attribute__ ((__noreturn__))
pid = strtol_or_err(argv[i], _("failed to parse argument"));
if (!kill((pid_t) pid, signo))
continue;
error(0, errno, "(%ld)", pid);
exitvalue = EXIT_FAILURE;
continue;
}
......
This diff is collapsed.
This diff is collapsed.
......@@ -26,7 +26,6 @@
//#define BOOST_PERCNT /* enable extra precision for two % fields */
//#define NOBOOST_MEMS /* disable extra precision for mem fields */
//#define NUMA_DISABLE /* disable summary area NUMA/Nodes display */
//#define OOMEM_ENABLE /* enable the SuSE out-of-memory additions */
//#define ORIG_TOPDEFS /* with no rcfile retain original defaults */
//#define SIGNALS_LESS /* favor reduced signal load over response */
......@@ -198,14 +197,14 @@ enum pflag {
EU_FL1, EU_FL2, EU_DRT,
EU_STA, EU_CMD, EU_WCH, EU_FLG, EU_CGR,
EU_SGD, EU_SGN, EU_TGD,
#ifdef OOMEM_ENABLE
EU_OOA, EU_OOM,
#endif
EU_ENV,
EU_FV1, EU_FV2,
EU_USE,
EU_NS1, EU_NS2, EU_NS3, EU_NS4, EU_NS5, EU_NS6,
EU_LXC,
EU_RZA, EU_RZF, EU_RZL, EU_RZS,
EU_CGN,
#ifdef USE_X_COLHDR
// not really pflags, used with tbl indexing
EU_MAXPFLGS
......@@ -607,16 +606,11 @@ typedef struct WIN_t {
#define JOB_FIELDS "(Ļ@<)*+,-./012568>?ABCFGHIJKLMNOPQRSTUVWXYZ[" RCF_PLUS_H
#define MEM_FIELDS "<MBND34&'()*+,-./0125689FGHIJKLOPQRSTUVWXYZ[" RCF_PLUS_H
#define USR_FIELDS ")+,-./1234568;<=>?@ABCFGHIJKLMNOPQRSTUVWXYZ[" RCF_PLUS_H
#ifdef OOMEM_ENABLE
// the suse old top fields ( 'a'-'z' + '{|' ) in positions 0-27
// ( the extra chars above represent the 'off' state )
// old top fields ( 'a'-'z' ) in positions 0-25
// other suse old top fields ( '{|' ) in positions 26-27
#define CVT_FIELDS "%&*'(-0346789:;<=>?@ACDEFGML)+,./125BHIJKNOPQRSTUVWXYZ["
#define CVT_FLDMAX 28
#else
// other old top fields ( 'a'-'z' ) in positions 0-25
#define CVT_FIELDS "%&*'(-0346789:;<=>?@ACDEFG)+,./125BHIJKLMNOPQRSTUVWXYZ["
#define CVT_FLDMAX 26
#endif
/* The default values for the local config file */
#define DEF_RCFILE { \
......@@ -713,7 +707,7 @@ typedef struct WIN_t {
/*------ Basic Formatting support --------------------------------------*/
//atic inline const char *justify_pad (const char *str, int width, int justr);
//atic inline const char *make_chr (const char ch, int width, int justr);
//atic inline const char *make_num (long num, int width, int justr, int col);
//atic inline const char *make_num (long num, int width, int justr, int col, int noz);
//atic inline const char *make_str (const char *str, int width, int justr, int col);
//atic const char *scale_mem (int target, unsigned long num, int width, int justr);
//atic const char *scale_num (unsigned long num, int width, int justr);
......
......@@ -237,14 +237,12 @@ static void build_two_nlstabs (void) {
/* Translation Hint: maximum 'TGID' = 5 */
Head_nlstab[EU_TGD] = _("TGID");
Desc_nlstab[EU_TGD] = _("Thread Group Id");
#ifdef OOMEM_ENABLE
/* Translation Hint: maximum 'Adj' = 3 */
Head_nlstab[EU_OOA] = _("Adj");
Desc_nlstab[EU_OOA] = _("oom_adjustment (2^X)");
/* Translation Hint: maximum 'Badness' = 7 */
Head_nlstab[EU_OOM] = _("Badness");
Desc_nlstab[EU_OOM] = _("oom_score (badness)");
#endif
/* Translation Hint: maximum 'OOMa' = 5 */
Head_nlstab[EU_OOA] = _("OOMa");
Desc_nlstab[EU_OOA] = _("OOMEM Adjustment");
/* Translation Hint: maximum 'OOMs' = 4 */
Head_nlstab[EU_OOM] = _("OOMs");
Desc_nlstab[EU_OOM] = _("OOMEM Score current");
/* Translation Hint: maximum 'ENVIRON' = 7 */
Head_nlstab[EU_ENV] = _("ENVIRON");
/* Translation Hint: the abbreviation 'vars' below is shorthand for
......@@ -280,6 +278,21 @@ static void build_two_nlstabs (void) {
/* Translation Hint: maximum 'LXC' = 7 */
Head_nlstab[EU_LXC] = _("LXC");
Desc_nlstab[EU_LXC] = _("LXC container name");
/* Translation Hint: maximum 'RSan' = 4 */
Head_nlstab[EU_RZA] = _("RSan");
Desc_nlstab[EU_RZA] = _("RES Anonymous (KiB)");
/* Translation Hint: maximum 'RSfd' = 4 */
Head_nlstab[EU_RZF] = _("RSfd");
Desc_nlstab[EU_RZF] = _("RES File-based (KiB)");
/* Translation Hint: maximum 'RSlk' = 4 */
Head_nlstab[EU_RZL] = _("RSlk");
Desc_nlstab[EU_RZL] = _("RES Locked (KiB)");
/* Translation Hint: maximum 'RSsh' = 4 */
Head_nlstab[EU_RZS] = _("RSsh");
Desc_nlstab[EU_RZS] = _("RES Shared (KiB)");
/* Translation Hint: maximum 'CGNAME' = 7 */
Head_nlstab[EU_CGN] = _("CGNAME");
Desc_nlstab[EU_CGN] = _("Control Group name");
}
......
.TH WATCH "1" "June 2011" "procps-ng" "User Commands"
.TH WATCH 1 "2016-06-03" "procps-ng" "User Commands"
.SH NAME
watch \- execute a program periodically, showing output fullscreen
.SH SYNOPSIS
......@@ -9,11 +9,8 @@ watch \- execute a program periodically, showing output fullscreen
runs
.I command
repeatedly, displaying its output and errors (the first screenfull). This
allows you to watch the program output change over time. By default, the
program is run every 2 seconds.
By default,
.B watch
will run until interrupted.
allows you to watch the program output change over time. By default,
\fIcommand\fR is run every 2 seconds and \fBwatch\fR will run until interrupted.
.SH OPTIONS
.TP
\fB\-d\fR, \fB\-\-differences\fR [\fIpermanent\fR]
......@@ -23,7 +20,8 @@ has changed at least once since first iteration.
.TP
\fB\-n\fR, \fB\-\-interval\fR \fIseconds\fR
Specify update interval. The command will not allow quicker than 0.1 second
interval, in which the smaller values are converted.
interval, in which the smaller values are converted. Both '.' and ',' work
for any locales.
.TP
\fB\-p\fR, \fB\-\-precise\fR
Make
......@@ -69,13 +67,81 @@ Display help text and exit.
.TP
\fB\-v\fR, \fB\-\-version\fR
Display version information and exit.
.SH NOTE
Note that POSIX option processing is used (i.e., option processing stops at
.SH "EXIT STATUS"
.PP
.RS
.PD 0
.TP
.B 0
Success.
.TP
.B 1
Various failures.
.TP
.B 2
Forking the process to watch failed.
.TP
.B 3
Replacing child process stdout with write side pipe failed.
.TP
.B 4
Command execution failed.
.TP
.B 5
Closing child process write pipe failed.
.TP
.B 7
IPC pipe creation failed.
.TP
.B 8
Getting child process return value with
.BR waitpid (2)
failed, or command exited up on error.
.TP
.B other
The watch will propagate command exit status as child exit status.
.SH NOTES
POSIX option processing is used (i.e., option processing stops at
the first non\-option argument). This means that flags after
.I command
don't get interpreted by
.BR watch
itself.
.SH BUGS
Upon terminal resize, the screen will not be correctly repainted until the
next scheduled update. All
.B \-\-differences
highlighting is lost on that update as well.
Non-printing characters are stripped from program output. Use "cat -v" as
part of the command pipeline if you want to see them.
Combining Characters that are supposed to display on the character at the
last column on the screen may display one column early, or they may not
display at all.
Combining Characters never count as different in
.I \-\-differences
mode. Only the base character counts.
Blank lines directly after a line which ends in the last column do not
display.
.I \-\-precise
mode doesn't yet have advanced temporal distortion technology to compensate
for a
.I command
that takes more than
.I interval
seconds to execute.
.B watch
also can get into a state where it rapid-fires as many executions of