CVS commit: src/bin/ps
Module Name:src Committed By: msaitoh Date: Sat Nov 6 06:38:03 UTC 2021 Modified Files: src/bin/ps: ps.1 Log Message: s/maxiumum/maximum/ To generate a diff of this commit: cvs rdiff -u -r1.114 -r1.115 src/bin/ps/ps.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/bin/ps/ps.1 diff -u src/bin/ps/ps.1:1.114 src/bin/ps/ps.1:1.115 --- src/bin/ps/ps.1:1.114 Tue Sep 14 22:14:11 2021 +++ src/bin/ps/ps.1 Sat Nov 6 06:38:03 2021 @@ -1,4 +1,4 @@ -.\" $NetBSD: ps.1,v 1.114 2021/09/14 22:14:11 christos Exp $ +.\" $NetBSD: ps.1,v 1.115 2021/11/06 06:38:03 msaitoh Exp $ .\" .\" Copyright (c) 1980, 1990, 1991, 1993, 1994 .\" The Regents of the University of California. All rights reserved. @@ -29,7 +29,7 @@ .\" .\" @(#)ps.1 8.3 (Berkeley) 4/18/94 .\" -.Dd September 14, 2021 +.Dd November 6, 2021 .Dt PS 1 .Os .Sh NAME @@ -329,7 +329,7 @@ The exact time the command started, usin format described in .Xr strftime 3 . .It Ar maxrss -the maxiumum resident set size of the process (in 1024 byte units). +the maximum resident set size of the process (in 1024 byte units). .It Ar nice The process scheduling increment (see .Xr setpriority 2 ) .
CVS commit: src/bin/ps
Module Name:src Committed By: msaitoh Date: Sat Nov 6 06:38:03 UTC 2021 Modified Files: src/bin/ps: ps.1 Log Message: s/maxiumum/maximum/ To generate a diff of this commit: cvs rdiff -u -r1.114 -r1.115 src/bin/ps/ps.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/bin/ps
Module Name:src Committed By: christos Date: Wed Sep 15 13:16:57 UTC 2021 Modified Files: src/bin/ps: keyword.c Log Message: Don't assign v to newvar, so we can still access the original length. To generate a diff of this commit: cvs rdiff -u -r1.59 -r1.60 src/bin/ps/keyword.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/bin/ps/keyword.c diff -u src/bin/ps/keyword.c:1.59 src/bin/ps/keyword.c:1.60 --- src/bin/ps/keyword.c:1.59 Tue Sep 14 18:01:17 2021 +++ src/bin/ps/keyword.c Wed Sep 15 09:16:57 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: keyword.c,v 1.59 2021/09/14 22:01:17 christos Exp $ */ +/* $NetBSD: keyword.c,v 1.60 2021/09/15 13:16:57 christos Exp $ */ /*- * Copyright (c) 1990, 1993, 1994 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)keyword.c 8.5 (Berkeley) 4/2/94"; #else -__RCSID("$NetBSD: keyword.c,v 1.59 2021/09/14 22:01:17 christos Exp $"); +__RCSID("$NetBSD: keyword.c,v 1.60 2021/09/15 13:16:57 christos Exp $"); #endif #endif /* not lint */ @@ -383,7 +383,6 @@ findvar(const char *p) struct var *newvar = emalloc(sizeof(*newvar)); *newvar = *v; - v = newvar; if (hp) { /* @@ -407,7 +406,7 @@ findvar(const char *p) if (*p != *pp) newvar->flag |= ALTPR|LJUST; - return v; + return newvar; } static int
CVS commit: src/bin/ps
Module Name:src Committed By: christos Date: Wed Sep 15 13:16:57 UTC 2021 Modified Files: src/bin/ps: keyword.c Log Message: Don't assign v to newvar, so we can still access the original length. To generate a diff of this commit: cvs rdiff -u -r1.59 -r1.60 src/bin/ps/keyword.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/bin/ps
Module Name:src Committed By: christos Date: Tue Sep 14 22:14:11 UTC 2021 Modified Files: src/bin/ps: ps.1 Log Message: reflect reality on flags. To generate a diff of this commit: cvs rdiff -u -r1.113 -r1.114 src/bin/ps/ps.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/bin/ps/ps.1 diff -u src/bin/ps/ps.1:1.113 src/bin/ps/ps.1:1.114 --- src/bin/ps/ps.1:1.113 Tue Sep 14 13:09:18 2021 +++ src/bin/ps/ps.1 Tue Sep 14 18:14:11 2021 @@ -1,4 +1,4 @@ -.\" $NetBSD: ps.1,v 1.113 2021/09/14 17:09:18 christos Exp $ +.\" $NetBSD: ps.1,v 1.114 2021/09/14 22:14:11 christos Exp $ .\" .\" Copyright (c) 1980, 1990, 1991, 1993, 1994 .\" The Regents of the University of California. All rights reserved. @@ -292,10 +292,11 @@ The percentage of real memory used by th .It Ar flags The flags (in hexadecimal) associated with the process as in the include file -.In sys/proc.h : +.In sys/sysctl.h : .Bl -column P_NOCLDSTOP P_NOCLDSTOP compact .It Dv "P_ADVLOCK" Ta No "0x0001 process may hold a POSIX advisory lock" .It Dv "P_CONTROLT" Ta No "0x0002 process has a controlling terminal" +.It Dv "P_INMEM" Ta No "0x0004 process is in memory" .It Dv "P_NOCLDSTOP" Ta No "0x0008 no" Dv SIGCHLD No when children stop .It Dv "P_PPWAIT" Ta No "0x0010 parent is waiting for child to exec/exit" .It Dv "P_PROFIL" Ta No "0x0020 process has started profiling" @@ -303,17 +304,21 @@ the include file .It Dv "P_SINTR" Ta No "0x0080 sleep is interruptible" .It Dv "P_SUGID" Ta No "0x0100 process had set id privileges since last exec" .It Dv "P_SYSTEM" Ta No "0x0200 system process: no sigs or stats" -.It Dv "P_TIMEOUT" Ta No "0x0400 timing out during sleep" +.It Dv "P_SA" Ta No "0x0400 process is using scheduler activations (old)" .It Dv "P_TRACED" Ta No "0x0800 process is being traced" .It Dv "P_WAITED" Ta No "0x1000 debugging process has waited for child" .It Dv "P_WEXIT" Ta No "0x2000 working on exiting" .It Dv "P_EXEC" Ta No "0x4000 process called" Xr execve 2 .It Dv "P_OWEUPC" Ta No "0x8000 owe process an addupc() call at next ast" -.\" the routine addupc is not documented in the man pages -.It Dv "P_NOCLDWAIT" Ta No "0x0002 no zombies when children die" +.It Dv "P_NOCLDWAIT" Ta No "0x0002 no zombies if child dies" .It Dv "P_32" Ta No "0x0004 32-bit process (used on 64-bit kernels)" -.It Dv "P_BIGLOCK" Ta No "0x0008 process needs kernel ``big lock'' to run" -.It Dv "P_INEXEC" Ta No "0x0010 process is exec'ing and cannot be traced" +.It Dv "P_CLDSIGIGN" Ta No "0x0008000 no" Dv SIGCHLD when children stop +.It Dv "P_SYSTRACE" Ta No "0x0020 process is under" Xr systrace 1 (old) +.It Dv "P_CHTRACED" Ta No "0x0040 process has been traced and reparented" +.It Dv "P_STOPFORK" Ta No "0x0080 process stops at" Xr fork 2 +.It Dv "P_STOPEXEC" Ta No "0x0100 process stops at" Xr exec 2 +.It Dv "P_STOPEXIT" Ta No "0x0200 process stops at" Xr _exit 2" +.It Dv "P_SYSCALL" Ta No "0x0400 process is tracing syscalls" .El .It Ar lim The soft limit on memory used, specified via a call to
CVS commit: src/bin/ps
Module Name:src Committed By: christos Date: Tue Sep 14 22:14:11 UTC 2021 Modified Files: src/bin/ps: ps.1 Log Message: reflect reality on flags. To generate a diff of this commit: cvs rdiff -u -r1.113 -r1.114 src/bin/ps/ps.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/bin/ps
Module Name:src Committed By: christos Date: Tue Sep 14 22:01:17 UTC 2021 Modified Files: src/bin/ps: keyword.c print.c ps.c ps.h Log Message: use emalloc and friends, add ktrace flag printing. To generate a diff of this commit: cvs rdiff -u -r1.58 -r1.59 src/bin/ps/keyword.c cvs rdiff -u -r1.136 -r1.137 src/bin/ps/print.c cvs rdiff -u -r1.96 -r1.97 src/bin/ps/ps.c cvs rdiff -u -r1.31 -r1.32 src/bin/ps/ps.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/bin/ps/keyword.c diff -u src/bin/ps/keyword.c:1.58 src/bin/ps/keyword.c:1.59 --- src/bin/ps/keyword.c:1.58 Tue Sep 14 13:09:18 2021 +++ src/bin/ps/keyword.c Tue Sep 14 18:01:17 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: keyword.c,v 1.58 2021/09/14 17:09:18 christos Exp $ */ +/* $NetBSD: keyword.c,v 1.59 2021/09/14 22:01:17 christos Exp $ */ /*- * Copyright (c) 1990, 1993, 1994 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)keyword.c 8.5 (Berkeley) 4/2/94"; #else -__RCSID("$NetBSD: keyword.c,v 1.58 2021/09/14 17:09:18 christos Exp $"); +__RCSID("$NetBSD: keyword.c,v 1.59 2021/09/14 22:01:17 christos Exp $"); #endif #endif /* not lint */ @@ -55,6 +55,7 @@ __RCSID("$NetBSD: keyword.c,v 1.58 2021/ #include #include #include +#include #include "ps.h" @@ -136,7 +137,7 @@ VAR var[] = { PUVAR("isrss", "ISRSS", 0, p_uru_isrss, UINT64, PRId64), PUVAR("ixrss", "IXRSS", 0, p_uru_ixrss, UINT64, PRId64), PVAR("jobc", "JOBC", 0, p_jobc, SHORT, "d"), - PVAR("ktrace", "KTRACE", 0, p_traceflag, INT, "x"), + PVAR("ktrace", "KTRACE", 0, p_traceflag, KTRACEFLAG, "x"), /*XXX*/ PVAR("ktracep", "KTRACEP", 0, p_tracep, KPTR, PRIx64), LVAR("laddr", "LADDR", 0, l_laddr, KPTR, PRIx64), LVAR("lid", "LID", 0, l_lid, INT32, "d"), @@ -257,7 +258,7 @@ parsevarlist(const char *pp, struct varl char *p, *sp, *equalsp; /* dup to avoid zapping arguments. We will free sp later. */ - p = sp = strdup(pp); + p = sp = estrdup(pp); /* * Everything after the first '=' is part of a custom header. @@ -305,8 +306,7 @@ parsevarlist(const char *pp, struct varl */ if ((v = findvar(cp)) == NULL) continue; - if ((vent = malloc(sizeof(struct varent))) == NULL) - err(EXIT_FAILURE, NULL); + vent = emalloc(sizeof(*vent)); vent->var = v; if (pos && *pos) SIMPLEQ_INSERT_AFTER(listptr, *pos, vent, next); @@ -369,7 +369,7 @@ findvar(const char *p) for (char *dp = pp; *dp; dp++) *dp = tolower((unsigned char)*dp); - v = bsearch(pp, var, sizeof(var)/sizeof(VAR) - 1, sizeof(VAR), vcmp); + v = bsearch(pp, var, __arraycount(var) - 1, sizeof(*var), vcmp); if (v && v->flag & ALIAS) v = findvar(v->header); if (!v) { @@ -381,11 +381,8 @@ findvar(const char *p) if (!hp && *p == *pp) return v; - struct var *newvar; - - if ((newvar = malloc(sizeof(*newvar))) == NULL) - err(EXIT_FAILURE, NULL); - memcpy(newvar, v, sizeof(*newvar)); + struct var *newvar = emalloc(sizeof(*newvar)); + *newvar = *v; v = newvar; if (hp) { @@ -397,10 +394,7 @@ findvar(const char *p) * used multiple times with different headers. We also * need to strdup the header. */ - char *newheader; - if ((newheader = strdup(hp)) == NULL) - err(EXIT_FAILURE, NULL); - newvar->header = newheader; + newvar->header = estrdup(hp); /* * According to P1003.1-2004, if the header text is null, * such as -o user=, the field width will be at least as Index: src/bin/ps/print.c diff -u src/bin/ps/print.c:1.136 src/bin/ps/print.c:1.137 --- src/bin/ps/print.c:1.136 Tue Sep 14 13:09:18 2021 +++ src/bin/ps/print.c Tue Sep 14 18:01:17 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: print.c,v 1.136 2021/09/14 17:09:18 christos Exp $ */ +/* $NetBSD: print.c,v 1.137 2021/09/14 22:01:17 christos Exp $ */ /* * Copyright (c) 2000, 2007 The NetBSD Foundation, Inc. @@ -63,7 +63,7 @@ #if 0 static char sccsid[] = "@(#)print.c 8.6 (Berkeley) 4/16/94"; #else -__RCSID("$NetBSD: print.c,v 1.136 2021/09/14 17:09:18 christos Exp $"); +__RCSID("$NetBSD: print.c,v 1.137 2021/09/14 22:01:17 christos Exp $"); #endif #endif /* not lint */ @@ -77,6 +77,7 @@ __RCSID("$NetBSD: print.c,v 1.136 2021/0 #include #include #include +#include #include #include @@ -1170,9 +1171,7 @@ printsig(VAR *v, const sigset_t *s, enum strprintorsetwidth(v, buf + i, mode); } else { size_t maxlen = 1024, len = 0; - char *buf = malloc(maxlen); - if (buf == NULL) - err(EXIT_FAILURE, NULL); + char *buf = emalloc(maxlen); *buf = '\0'; for (size_t i = 0; i < SIGSETSIZE; i++) { uint32_t m = s->__bits[i]; @@ -1185,9 +1184,7 @@ printsig(VAR *v, const sigset_t *s, enum sn++; if (len + sn >= maxlen) { maxlen += 1024; - buf = realloc(buf, maxlen); - if (buf == NULL) - err(EXIT_FAILURE, NULL); + buf = erealloc(buf, maxlen); } snprintf(buf + len, sn + 1, "%s%s", len == 0 ? "" : ",", n); @@ -1204,15 +1201,23
CVS commit: src/bin/ps
Module Name:src Committed By: christos Date: Tue Sep 14 22:01:17 UTC 2021 Modified Files: src/bin/ps: keyword.c print.c ps.c ps.h Log Message: use emalloc and friends, add ktrace flag printing. To generate a diff of this commit: cvs rdiff -u -r1.58 -r1.59 src/bin/ps/keyword.c cvs rdiff -u -r1.136 -r1.137 src/bin/ps/print.c cvs rdiff -u -r1.96 -r1.97 src/bin/ps/ps.c cvs rdiff -u -r1.31 -r1.32 src/bin/ps/ps.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/bin/ps
Module Name:src Committed By: christos Date: Tue Sep 14 17:09:18 UTC 2021 Modified Files: src/bin/ps: Makefile keyword.c print.c ps.1 ps.h Log Message: Provide symbolic printing of some keywords by capitalizing them. To generate a diff of this commit: cvs rdiff -u -r1.30 -r1.31 src/bin/ps/Makefile src/bin/ps/ps.h cvs rdiff -u -r1.57 -r1.58 src/bin/ps/keyword.c cvs rdiff -u -r1.135 -r1.136 src/bin/ps/print.c cvs rdiff -u -r1.112 -r1.113 src/bin/ps/ps.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/bin/ps/Makefile diff -u src/bin/ps/Makefile:1.30 src/bin/ps/Makefile:1.31 --- src/bin/ps/Makefile:1.30 Tue Apr 6 00:49:41 2021 +++ src/bin/ps/Makefile Tue Sep 14 13:09:18 2021 @@ -1,10 +1,10 @@ -# $NetBSD: Makefile,v 1.30 2021/04/06 04:49:41 simonb Exp $ +# $NetBSD: Makefile,v 1.31 2021/09/14 17:09:18 christos Exp $ # @(#)Makefile 8.1 (Berkeley) 6/2/93 PROG= ps SRCS= fmt.c keyword.c nlist.c print.c ps.c -DPADD= ${LIBM} ${LIBKVM} -LDADD= -lm -lkvm +DPADD= ${LIBUTIL} ${LIBM} ${LIBKVM} +LDADD= -lutil -lm -lkvm COPTS.print.c = -Wno-format-nonliteral -Wno-format-y2k Index: src/bin/ps/ps.h diff -u src/bin/ps/ps.h:1.30 src/bin/ps/ps.h:1.31 --- src/bin/ps/ps.h:1.30 Fri Sep 10 18:11:03 2021 +++ src/bin/ps/ps.h Tue Sep 14 13:09:18 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: ps.h,v 1.30 2021/09/10 22:11:03 rillig Exp $ */ +/* $NetBSD: ps.h,v 1.31 2021/09/14 17:09:18 christos Exp $ */ /*- * Copyright (c) 1990, 1993 @@ -44,7 +44,7 @@ enum type { UNSPECIFIED, CHAR, UCHAR, SHORT, USHORT, INT, UINT, LONG, ULONG, KPTR, KPTR24, INT32, UINT32, SIGLIST, INT64, UINT64, - TIMEVAL, CPUTIME, PCPU, VSIZE + TIMEVAL, CPUTIME, PCPU, VSIZE, PROCFLAG, PROCACFLAG }; /* Variables. */ @@ -73,6 +73,7 @@ typedef struct var { #define LWP 0x10 /* dispatch to kinfo_lwp routine */ #define UAREA 0x20 /* need to check p_uvalid */ #define ALIAS 0x40 /* entry is alias for 'header' */ +#define ALTPR 0x80 /* use alternate printing method */ u_int flag; /* output routine */ void (*oproc)(struct pinfo *pi, struct varent *, enum mode); Index: src/bin/ps/keyword.c diff -u src/bin/ps/keyword.c:1.57 src/bin/ps/keyword.c:1.58 --- src/bin/ps/keyword.c:1.57 Tue Aug 6 14:07:51 2019 +++ src/bin/ps/keyword.c Tue Sep 14 13:09:18 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: keyword.c,v 1.57 2019/08/06 18:07:51 kamil Exp $ */ +/* $NetBSD: keyword.c,v 1.58 2021/09/14 17:09:18 christos Exp $ */ /*- * Copyright (c) 1990, 1993, 1994 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)keyword.c 8.5 (Berkeley) 4/2/94"; #else -__RCSID("$NetBSD: keyword.c,v 1.57 2019/08/06 18:07:51 kamil Exp $"); +__RCSID("$NetBSD: keyword.c,v 1.58 2021/09/14 17:09:18 christos Exp $"); #endif #endif /* not lint */ @@ -49,6 +49,7 @@ __RCSID("$NetBSD: keyword.c,v 1.57 2019/ #include #include #include +#include #include #include #include @@ -103,7 +104,7 @@ static int vcmp(const void *, const voi VAR var[] = { VAR6("%cpu", "%CPU", 0, pcpu, 0, PCPU), VAR6("%mem", "%MEM", 0, pmem, POFF(p_vm_rssize), INT32), - PVAR("acflag", "ACFLG", 0, p_acflag, USHORT, "x"), + PVAR("acflag", "ACFLG", 0, p_acflag, PROCACFLAG, "x"), VAR3("acflg", "acflag", ALIAS), VAR3("args", "command", ALIAS), VAR3("blocked", "sigmask", ALIAS), @@ -120,7 +121,7 @@ VAR var[] = { VAR6("etime", "ELAPSED", 0, elapsed, POFF(p_ustart_sec), TIMEVAL), UID("euid", "EUID", p_uid), VAR4("euser", "EUSER", LJUST, usrname), - PVAR("f", "F", 0, p_flag, INT, "x"), + PVAR("f", "F", 0, p_flag, PROCFLAG, "x"), VAR3("flags", "f", ALIAS), GID("gid", "GID", p_gid), VAR4("group", "GROUP", LJUST, gname), @@ -359,12 +360,16 @@ findvar(const char *p) { VAR *v; char *hp; + char pp[1024]; + strlcpy(pp, p, sizeof(pp)); - hp = strchr(p, '='); + hp = strchr(pp, '='); if (hp) *hp++ = '\0'; + for (char *dp = pp; *dp; dp++) + *dp = tolower((unsigned char)*dp); - v = bsearch(p, var, sizeof(var)/sizeof(VAR) - 1, sizeof(VAR), vcmp); + v = bsearch(pp, var, sizeof(var)/sizeof(VAR) - 1, sizeof(VAR), vcmp); if (v && v->flag & ALIAS) v = findvar(v->header); if (!v) { @@ -373,7 +378,17 @@ findvar(const char *p) return NULL; } - if (v && hp) { + if (!hp && *p == *pp) + return v; + + struct var *newvar; + + if ((newvar = malloc(sizeof(*newvar))) == NULL) + err(EXIT_FAILURE, NULL); + memcpy(newvar, v, sizeof(*newvar)); + v = newvar; + + if (hp) { /* * Override the header. * @@ -382,16 +397,10 @@ findvar(const char *p) * used multiple times with different headers. We also * need to strdup the header. */ - struct var *newvar; char *newheader; - - if ((newvar = malloc(sizeof(struct var))) == NULL) - err(EXIT_FAILURE, NULL); if ((newheader = strdup(hp)) == NULL) err(EXIT_FAILURE, NULL); - memcpy(newvar, v, sizeof(struct var)); newvar->header = newheader; - /* * According to P1003.1-2004, if the header text
CVS commit: src/bin/ps
Module Name:src Committed By: christos Date: Tue Sep 14 17:09:18 UTC 2021 Modified Files: src/bin/ps: Makefile keyword.c print.c ps.1 ps.h Log Message: Provide symbolic printing of some keywords by capitalizing them. To generate a diff of this commit: cvs rdiff -u -r1.30 -r1.31 src/bin/ps/Makefile src/bin/ps/ps.h cvs rdiff -u -r1.57 -r1.58 src/bin/ps/keyword.c cvs rdiff -u -r1.135 -r1.136 src/bin/ps/print.c cvs rdiff -u -r1.112 -r1.113 src/bin/ps/ps.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/bin/ps
Module Name:src Committed By: kamil Date: Sun Sep 15 15:27:50 UTC 2019 Modified Files: src/bin/ps: ps.c Log Message: ps(1): Guard freeing the memory of pinfo with __NO_LEAKS. No more leaks are detected by LSan/NetBSD as of the LLVM snapshot (clang10svn) from 2019-09-15. To generate a diff of this commit: cvs rdiff -u -r1.92 -r1.93 src/bin/ps/ps.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/bin/ps
Module Name:src Committed By: kamil Date: Sun Sep 15 15:27:50 UTC 2019 Modified Files: src/bin/ps: ps.c Log Message: ps(1): Guard freeing the memory of pinfo with __NO_LEAKS. No more leaks are detected by LSan/NetBSD as of the LLVM snapshot (clang10svn) from 2019-09-15. To generate a diff of this commit: cvs rdiff -u -r1.92 -r1.93 src/bin/ps/ps.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/bin/ps/ps.c diff -u src/bin/ps/ps.c:1.92 src/bin/ps/ps.c:1.93 --- src/bin/ps/ps.c:1.92 Wed Sep 11 17:02:53 2019 +++ src/bin/ps/ps.c Sun Sep 15 15:27:50 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: ps.c,v 1.92 2019/09/11 17:02:53 kamil Exp $ */ +/* $NetBSD: ps.c,v 1.93 2019/09/15 15:27:50 kamil Exp $ */ /* * Copyright (c) 2000-2008 The NetBSD Foundation, Inc. @@ -68,7 +68,7 @@ __COPYRIGHT("@(#) Copyright (c) 1990, 19 #if 0 static char sccsid[] = "@(#)ps.c 8.4 (Berkeley) 4/2/94"; #else -__RCSID("$NetBSD: ps.c,v 1.92 2019/09/11 17:02:53 kamil Exp $"); +__RCSID("$NetBSD: ps.c,v 1.93 2019/09/15 15:27:50 kamil Exp $"); #endif #endif /* not lint */ @@ -526,7 +526,9 @@ main(int argc, char *argv[]) } } +#ifdef __NO_LEAKS free(pinfo); +#endif return eval; }
Re: CVS commit: src/bin/ps
On 13.09.2019 03:51, Roy Marples wrote: > On 12/09/2019 20:55, Joerg Sonnenberger wrote: >> On Thu, Sep 12, 2019 at 01:52:19AM +0100, Roy Marples wrote: >>> On 11/09/2019 20:03, Robert Elz wrote: Date: Wed, 11 Sep 2019 17:02:53 + From: "Kamil Rytarowski" Message-ID: <20190911170253.d097ff...@cvs.netbsd.org> | Free it when no longer used, just before the program termination. Can we please avoid this kind of nonsense. Everything is freed when every program exits - doing explicit free() calls makes the program bigger and slower for no reason at all. By all means fix places where memory is truly leaked (whenre more is continuously allocated, and simply discarded) but anything that is supposed to remain until program exit should simply go away when the exit happens. If the canitisers cannot be instructed to ignore such things, they are much less useful tan they could be. >>> >>> Could we add an #ifdef for this? >>> >>> #ifdef __SANITISATION >>> free(foo); >>> close(bar); >>> #endif >>> >>> return EXIT_SUCCESS; >> >> That's kind of how coverity and valgrind dealt with it. > > Do you happen to know if one #define fits all and if not, can we add it > to sys/cdefs.h? > > Roy Coverity needs: #ifdef __COVERITY__ Valgrind doesn't have any checks, it instruments prebuilt programs. We could add: #ifndef __has_feature #define __has_feature 0 #endif #if defined(__COVERITY__) || __has_feature(address_sanitizer) \ || defined(__SANITIZE_ADDRESS__) #define __NO_LEAKS #endif signature.asc Description: OpenPGP digital signature
Re: CVS commit: src/bin/ps
On 12/09/2019 20:55, Joerg Sonnenberger wrote: On Thu, Sep 12, 2019 at 01:52:19AM +0100, Roy Marples wrote: On 11/09/2019 20:03, Robert Elz wrote: Date:Wed, 11 Sep 2019 17:02:53 + From:"Kamil Rytarowski" Message-ID: <20190911170253.d097ff...@cvs.netbsd.org> | Free it when no longer used, just before the program termination. Can we please avoid this kind of nonsense. Everything is freed when every program exits - doing explicit free() calls makes the program bigger and slower for no reason at all. By all means fix places where memory is truly leaked (whenre more is continuously allocated, and simply discarded) but anything that is supposed to remain until program exit should simply go away when the exit happens. If the canitisers cannot be instructed to ignore such things, they are much less useful tan they could be. Could we add an #ifdef for this? #ifdef __SANITISATION free(foo); close(bar); #endif return EXIT_SUCCESS; That's kind of how coverity and valgrind dealt with it. Do you happen to know if one #define fits all and if not, can we add it to sys/cdefs.h? Roy
Re: CVS commit: src/bin/ps
On Thu, Sep 12, 2019 at 01:52:19AM +0100, Roy Marples wrote: > On 11/09/2019 20:03, Robert Elz wrote: > > Date:Wed, 11 Sep 2019 17:02:53 + > > From:"Kamil Rytarowski" > > Message-ID: <20190911170253.d097ff...@cvs.netbsd.org> > > > >| Free it when no longer used, just before the program termination. > > > > Can we please avoid this kind of nonsense. Everything is freed when > > every program exits - doing explicit free() calls makes the program bigger > > and slower for no reason at all. > > > > By all means fix places where memory is truly leaked (whenre more is > > continuously allocated, and simply discarded) but anything that is supposed > > to remain until program exit should simply go away when the exit happens. > > > > If the canitisers cannot be instructed to ignore such things, they are > > much less useful tan they could be. > > Could we add an #ifdef for this? > > #ifdef __SANITISATION > free(foo); > close(bar); > #endif > > return EXIT_SUCCESS; That's kind of how coverity and valgrind dealt with it. Joerg
Re: CVS commit: src/bin/ps
On Thu, Sep 12, 2019 at 04:33:40AM +0700, Robert Elz wrote: > Does anyone really want to make the shell, or other programs, run slower > just so someone can say that all memory was nicely (but pointlessly) freed > before exit ? I strongly support Robert's view here. There should be *NO* performance penalty in regular builds to cover up design deffects in any sanitizers. Not only for sh(1) but also any other binary. Sanitizers are usefull tools, but only tools. Martin
Re: CVS commit: src/bin/ps
On 12.09.2019 02:52, Roy Marples wrote: > On 11/09/2019 20:03, Robert Elz wrote: >> Date: Wed, 11 Sep 2019 17:02:53 + >> From: "Kamil Rytarowski" >> Message-ID: <20190911170253.d097ff...@cvs.netbsd.org> >> >> | Free it when no longer used, just before the program termination. >> >> Can we please avoid this kind of nonsense. Everything is freed when >> every program exits - doing explicit free() calls makes the program >> bigger >> and slower for no reason at all. >> >> By all means fix places where memory is truly leaked (whenre more is >> continuously allocated, and simply discarded) but anything that is >> supposed >> to remain until program exit should simply go away when the exit happens. >> >> If the canitisers cannot be instructed to ignore such things, they are >> much less useful tan they could be. > > Could we add an #ifdef for this? > > #ifdef __SANITISATION > free(foo); > close(bar); > #endif > > return EXIT_SUCCESS; For answer, please see: http://mail-index.netbsd.org/tech-userlevel/2019/09/12/msg012106.html signature.asc Description: OpenPGP digital signature
Re: CVS commit: src/bin/ps
On 11/09/2019 20:03, Robert Elz wrote: Date:Wed, 11 Sep 2019 17:02:53 + From:"Kamil Rytarowski" Message-ID: <20190911170253.d097ff...@cvs.netbsd.org> | Free it when no longer used, just before the program termination. Can we please avoid this kind of nonsense. Everything is freed when every program exits - doing explicit free() calls makes the program bigger and slower for no reason at all. By all means fix places where memory is truly leaked (whenre more is continuously allocated, and simply discarded) but anything that is supposed to remain until program exit should simply go away when the exit happens. If the canitisers cannot be instructed to ignore such things, they are much less useful tan they could be. Could we add an #ifdef for this? #ifdef __SANITISATION free(foo); close(bar); #endif return EXIT_SUCCESS;
Re: CVS commit: src/bin/ps
Date:Wed, 11 Sep 2019 21:13:24 +0200 From:Kamil Rytarowski Message-ID: <6c853bc7-6510-459e-d451-51f988617...@gmx.com> | We have got even fixups in libc for such "nonsense" cases. Why? In 99% (or more) of libc the fixes are relevant, as those functions can be called over & over and so should not be discarding memory. atexit() is a somewhat special case - if simply calling it leaks, then that ought be fixed, if the "leak" is just the data struct used to keep track of what needs to be run when the program ends, then not freeing that stuff is 100% harmless, and there's no point "fixing" it. | A workaround would be ... I don't know anything about the sanatisers so can't comment on what should be done with them. But if you were ever to test sh (and I would guess not just /bn/sh, but any shell) for this kind of thing, you'd find that at exit none of the user's (or shell's) variables have been freed, the hash table that associates command names with the located paths is not freed, aliases are not freed, nor defined functions, shell history, key bindings for libedit, defined traps, ... and probably much more I cannot remember just now, including (if the shell exits via a call to the exit builtin somewhere in the script) the internal code tree that is currently being evaluated. It would be a lot of code to go free all of that, it would slow down shell exit, and all for no benefit at all, as when _exit() eventually gets called, everything is returned to the kernel, nothing is lost. Further, other than that the shell is exiting, the data structs in question all need to be retained, so nothing in them can be freed any time before the shell exits (obviously other than when that data is being updated, and the old data is freed). Does anyone really want to make the shell, or other programs, run slower just so someone can say that all memory was nicely (but pointlessly) freed before exit ? kre
Re: CVS commit: src/bin/ps
On 11.09.2019 21:03, Robert Elz wrote: > Date:Wed, 11 Sep 2019 17:02:53 + > From:"Kamil Rytarowski" > Message-ID: <20190911170253.d097ff...@cvs.netbsd.org> > > | Free it when no longer used, just before the program termination. > > Can we please avoid this kind of nonsense. Everything is freed when > every program exits - doing explicit free() calls makes the program bigger > and slower for no reason at all. > > By all means fix places where memory is truly leaked (whenre more is > continuously allocated, and simply discarded) but anything that is supposed > to remain until program exit should simply go away when the exit happens. > > If the canitisers cannot be instructed to ignore such things, they are > much less useful tan they could be. > > kre > Every leak detector works in the same way. We have got even fixups in libc for such "nonsense" cases. https://nxr.netbsd.org/xref/src/lib/libc/stdlib/atexit.c#247 A workaround would be to use either __lsan_disable() or __lsan_ignore_object() from lsan_interface.h. But it won't handle leaks from other tools such as Valgrind. Also better to use the standard free(3). signature.asc Description: OpenPGP digital signature
Re: CVS commit: src/bin/ps
Date:Wed, 11 Sep 2019 17:02:53 + From:"Kamil Rytarowski" Message-ID: <20190911170253.d097ff...@cvs.netbsd.org> | Free it when no longer used, just before the program termination. Can we please avoid this kind of nonsense. Everything is freed when every program exits - doing explicit free() calls makes the program bigger and slower for no reason at all. By all means fix places where memory is truly leaked (whenre more is continuously allocated, and simply discarded) but anything that is supposed to remain until program exit should simply go away when the exit happens. If the canitisers cannot be instructed to ignore such things, they are much less useful tan they could be. kre
CVS commit: src/bin/ps
Module Name:src Committed By: kamil Date: Wed Sep 11 17:02:53 UTC 2019 Modified Files: src/bin/ps: ps.c Log Message: Plug memory leak in ps(1) pinfo is allocated in setpinfo() with calloc(3). Free it when no longer used, just before the program termination. Detected with LSan. To generate a diff of this commit: cvs rdiff -u -r1.91 -r1.92 src/bin/ps/ps.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/bin/ps/ps.c diff -u src/bin/ps/ps.c:1.91 src/bin/ps/ps.c:1.92 --- src/bin/ps/ps.c:1.91 Wed Apr 11 18:52:29 2018 +++ src/bin/ps/ps.c Wed Sep 11 17:02:53 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: ps.c,v 1.91 2018/04/11 18:52:29 christos Exp $ */ +/* $NetBSD: ps.c,v 1.92 2019/09/11 17:02:53 kamil Exp $ */ /* * Copyright (c) 2000-2008 The NetBSD Foundation, Inc. @@ -68,7 +68,7 @@ __COPYRIGHT("@(#) Copyright (c) 1990, 19 #if 0 static char sccsid[] = "@(#)ps.c 8.4 (Berkeley) 4/2/94"; #else -__RCSID("$NetBSD: ps.c,v 1.91 2018/04/11 18:52:29 christos Exp $"); +__RCSID("$NetBSD: ps.c,v 1.92 2019/09/11 17:02:53 kamil Exp $"); #endif #endif /* not lint */ @@ -525,6 +525,9 @@ main(int argc, char *argv[]) } } } + + free(pinfo); + return eval; }
CVS commit: src/bin/ps
Module Name:src Committed By: kamil Date: Wed Sep 11 17:02:53 UTC 2019 Modified Files: src/bin/ps: ps.c Log Message: Plug memory leak in ps(1) pinfo is allocated in setpinfo() with calloc(3). Free it when no longer used, just before the program termination. Detected with LSan. To generate a diff of this commit: cvs rdiff -u -r1.91 -r1.92 src/bin/ps/ps.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/bin/ps
Module Name:src Committed By: kamil Date: Tue Aug 6 18:07:51 UTC 2019 Modified Files: src/bin/ps: keyword.c ps.1 Log Message: Restore maxrss, idrss, isrss, ixrss printing in ps(1) The RSS related statistics are now back in the NetBSD kernel. These values were disabled since day0 until today. libkvm(3) users will still receive inappropriate values as RSS statistics are updated upon sysctl(3) call. Patch submitted by To generate a diff of this commit: cvs rdiff -u -r1.56 -r1.57 src/bin/ps/keyword.c cvs rdiff -u -r1.109 -r1.110 src/bin/ps/ps.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/bin/ps
Module Name:src Committed By: kamil Date: Tue Aug 6 18:07:51 UTC 2019 Modified Files: src/bin/ps: keyword.c ps.1 Log Message: Restore maxrss, idrss, isrss, ixrss printing in ps(1) The RSS related statistics are now back in the NetBSD kernel. These values were disabled since day0 until today. libkvm(3) users will still receive inappropriate values as RSS statistics are updated upon sysctl(3) call. Patch submitted by To generate a diff of this commit: cvs rdiff -u -r1.56 -r1.57 src/bin/ps/keyword.c cvs rdiff -u -r1.109 -r1.110 src/bin/ps/ps.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/bin/ps/keyword.c diff -u src/bin/ps/keyword.c:1.56 src/bin/ps/keyword.c:1.57 --- src/bin/ps/keyword.c:1.56 Wed Apr 11 18:52:05 2018 +++ src/bin/ps/keyword.c Tue Aug 6 18:07:51 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: keyword.c,v 1.56 2018/04/11 18:52:05 christos Exp $ */ +/* $NetBSD: keyword.c,v 1.57 2019/08/06 18:07:51 kamil Exp $ */ /*- * Copyright (c) 1990, 1993, 1994 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)keyword.c 8.5 (Berkeley) 4/2/94"; #else -__RCSID("$NetBSD: keyword.c,v 1.56 2018/04/11 18:52:05 christos Exp $"); +__RCSID("$NetBSD: keyword.c,v 1.57 2019/08/06 18:07:51 kamil Exp $"); #endif #endif /* not lint */ @@ -60,13 +60,6 @@ __RCSID("$NetBSD: keyword.c,v 1.56 2018/ static VAR *findvar(const char *); static int vcmp(const void *, const void *); -#if 0 /* kernel doesn't calculate these */ - PUVAR("idrss", "IDRSS", 0, p_uru_idrss, UINT64, PRIu64), - PUVAR("isrss", "ISRSS", 0, p_uru_isrss, UINT64, PRId64), - PUVAR("ixrss", "IXRSS", 0, p_uru_ixrss, UINT64, PRId64), - PUVAR("maxrss", "MAXRSS", 0, p_uru_maxrss, UINT64, PRIu64), -#endif - /* Compute offset in common structures. */ #define POFF(x) offsetof(struct kinfo_proc2, x) #define LOFF(x) offsetof(struct kinfo_lwp, x) @@ -135,9 +128,12 @@ VAR var[] = { VAR4("groups", "GROUPS", LJUST, groups), /* holdcnt: unused, left for compat. */ LVAR("holdcnt", "HOLDCNT", 0, l_holdcnt, INT, "d"), + PUVAR("idrss", "IDRSS", 0, p_uru_idrss, UINT64, PRIu64), VAR3("ignored", "sigignore", ALIAS), PUVAR("inblk", "INBLK", 0, p_uru_inblock, UINT64, PRIu64), VAR3("inblock", "inblk", ALIAS), + PUVAR("isrss", "ISRSS", 0, p_uru_isrss, UINT64, PRId64), + PUVAR("ixrss", "IXRSS", 0, p_uru_ixrss, UINT64, PRId64), PVAR("jobc", "JOBC", 0, p_jobc, SHORT, "d"), PVAR("ktrace", "KTRACE", 0, p_traceflag, INT, "x"), /*XXX*/ PVAR("ktracep", "KTRACEP", 0, p_tracep, KPTR, PRIx64), @@ -151,6 +147,7 @@ VAR var[] = { VAR4("lstate", "STAT", LJUST|LWP, lstate), VAR6("ltime", "LTIME", LWP, lcputime, 0, CPUTIME), PUVAR("majflt", "MAJFLT", 0, p_uru_majflt, UINT64, PRIu64), + PUVAR("maxrss", "MAXRSS", 0, p_uru_maxrss, UINT64, PRIu64), PUVAR("minflt", "MINFLT", 0, p_uru_minflt, UINT64, PRIu64), PUVAR("msgrcv", "MSGRCV", 0, p_uru_msgrcv, UINT64, PRIu64), PUVAR("msgsnd", "MSGSND", 0, p_uru_msgsnd, UINT64, PRIu64), Index: src/bin/ps/ps.1 diff -u src/bin/ps/ps.1:1.109 src/bin/ps/ps.1:1.110 --- src/bin/ps/ps.1:1.109 Mon Aug 28 05:57:37 2017 +++ src/bin/ps/ps.1 Tue Aug 6 18:07:51 2019 @@ -1,4 +1,4 @@ -.\" $NetBSD: ps.1,v 1.109 2017/08/28 05:57:37 wiz Exp $ +.\" $NetBSD: ps.1,v 1.110 2019/08/06 18:07:51 kamil Exp $ .\" .\" Copyright (c) 1980, 1990, 1991, 1993, 1994 .\" The Regents of the University of California. All rights reserved. @@ -29,7 +29,7 @@ .\" .\" @(#)ps.1 8.3 (Berkeley) 4/18/94 .\" -.Dd August 28, 2017 +.Dd August 6, 2019 .Dt PS 1 .Os .Sh NAME @@ -316,6 +316,8 @@ The exact time the command started, usin .Dq \&%c format described in .Xr strftime 3 . +.It Ar maxrss +the maxiumum resident set size of the process (in 1024 byte units). .It Ar nice The process scheduling increment (see .Xr setpriority 2 ) . @@ -513,6 +515,12 @@ group name (from gid) group names (from group access list) .It Ar groups group access list +.It Ar idrss +integral unshared data +.It Ar isrss +integral unshared stack +.It Ar ixrss +integral shared memory size .It Ar inblk total blocks read (alias .Ar inblock ) @@ -543,6 +551,8 @@ symbolic LWP state CPU time of the LWP .It Ar majflt total page faults +.It Ar maxrss +maximum resident set size .It Ar minflt total page reclaims .It Ar msgrcv
CVS commit: src/bin/ps
Module Name:src Committed By: kamil Date: Wed Jun 19 21:25:51 UTC 2019 Modified Files: src/bin/ps: print.c Log Message: Add a fallback definition of LSDEAD in ps(1) The symbol is no longer available in headers. Requested by To generate a diff of this commit: cvs rdiff -u -r1.131 -r1.132 src/bin/ps/print.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/bin/ps
Module Name:src Committed By: kamil Date: Wed Jun 19 21:25:51 UTC 2019 Modified Files: src/bin/ps: print.c Log Message: Add a fallback definition of LSDEAD in ps(1) The symbol is no longer available in headers. Requested by To generate a diff of this commit: cvs rdiff -u -r1.131 -r1.132 src/bin/ps/print.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/bin/ps/print.c diff -u src/bin/ps/print.c:1.131 src/bin/ps/print.c:1.132 --- src/bin/ps/print.c:1.131 Tue Jun 18 02:23:29 2019 +++ src/bin/ps/print.c Wed Jun 19 21:25:50 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: print.c,v 1.131 2019/06/18 02:23:29 kamil Exp $ */ +/* $NetBSD: print.c,v 1.132 2019/06/19 21:25:50 kamil Exp $ */ /* * Copyright (c) 2000, 2007 The NetBSD Foundation, Inc. @@ -63,7 +63,7 @@ #if 0 static char sccsid[] = "@(#)print.c 8.6 (Berkeley) 4/16/94"; #else -__RCSID("$NetBSD: print.c,v 1.131 2019/06/18 02:23:29 kamil Exp $"); +__RCSID("$NetBSD: print.c,v 1.132 2019/06/19 21:25:50 kamil Exp $"); #endif #endif /* not lint */ @@ -104,6 +104,11 @@ static time_t now; #define min(a,b) ((a) <= (b) ? (a) : (b)) +/* pre-NetBSD 5.x support. */ +#ifndef LSDEAD +#define LSDEAD 6 +#endif + static int iwidth(u_int64_t v) { @@ -586,9 +591,7 @@ lstate(struct pinfo *pi, VARENT *ve, enu break; case LSZOMB: -#ifdef LSDEAD case LSDEAD: -#endif *cp = 'Z'; break;
re: CVS commit: src/bin/ps
> It still works on NetBSD-4 kernels (if it doesn't, it's not caused by > this change). > > The only difference is that it will print '?' for (LS)DEAD process > (short-lived state). right - that is what i am wanting not to break. > sysstat ps.c has this change for a long time now. > > How about this change: > > Index: bin/ps/print.c > #ifdef LSDEAD > case LSDEAD: > +#else > + case 6: > #endif gross magic numbers! :) please use something like #include .. /* pre-NetBSD 5.x support. */ #ifndef LSDEAD #define LSDEAD 6 #endif so at least it's not magic any more. might be nice to also add a note to lwp.h that this value shouldn't be re-used (it is still there so there's an implication already, but explicitly stating it seems better.) thanks.
Re: CVS commit: src/bin/ps
On 19.06.2019 00:31, matthew green wrote: > "Kamil Rytarowski" writes: >> Module Name: src >> Committed By:kamil >> Date:Tue Jun 18 02:23:29 UTC 2019 >> >> Modified Files: >> src/bin/ps: print.c >> >> Log Message: >> Make LSDEAD usage conditional >> >> LSDEAD is not used since NetBSD-5.0 and will be gone. >> >> The same conditional usage is already in ps.c in the same program. > > please revert this so that it works on netbsd-4 and earlier > kernels. > > ps(1) is expected to be binary compatible for a very long > time now. > > > .mrg. > It still works on NetBSD-4 kernels (if it doesn't, it's not caused by this change). The only difference is that it will print '?' for (LS)DEAD process (short-lived state). sysstat ps.c has this change for a long time now. How about this change: Index: bin/ps/print.c === RCS file: /cvsroot/src/bin/ps/print.c,v retrieving revision 1.131 diff -u -r1.131 print.c --- bin/ps/print.c 18 Jun 2019 02:23:29 - 1.131 +++ bin/ps/print.c 19 Jun 2019 00:01:20 - @@ -588,6 +588,8 @@ case LSZOMB: #ifdef LSDEAD case LSDEAD: +#else + case 6: #endif *cp = 'Z'; break; signature.asc Description: OpenPGP digital signature
re: CVS commit: src/bin/ps
"Kamil Rytarowski" writes: > Module Name: src > Committed By: kamil > Date: Tue Jun 18 02:23:29 UTC 2019 > > Modified Files: > src/bin/ps: print.c > > Log Message: > Make LSDEAD usage conditional > > LSDEAD is not used since NetBSD-5.0 and will be gone. > > The same conditional usage is already in ps.c in the same program. please revert this so that it works on netbsd-4 and earlier kernels. ps(1) is expected to be binary compatible for a very long time now. .mrg.
CVS commit: src/bin/ps
Module Name:src Committed By: kamil Date: Tue Jun 18 02:23:29 UTC 2019 Modified Files: src/bin/ps: print.c Log Message: Make LSDEAD usage conditional LSDEAD is not used since NetBSD-5.0 and will be gone. The same conditional usage is already in ps.c in the same program. To generate a diff of this commit: cvs rdiff -u -r1.130 -r1.131 src/bin/ps/print.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/bin/ps
Module Name:src Committed By: kamil Date: Tue Jun 18 02:23:29 UTC 2019 Modified Files: src/bin/ps: print.c Log Message: Make LSDEAD usage conditional LSDEAD is not used since NetBSD-5.0 and will be gone. The same conditional usage is already in ps.c in the same program. To generate a diff of this commit: cvs rdiff -u -r1.130 -r1.131 src/bin/ps/print.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/bin/ps/print.c diff -u src/bin/ps/print.c:1.130 src/bin/ps/print.c:1.131 --- src/bin/ps/print.c:1.130 Wed Sep 19 15:20:39 2018 +++ src/bin/ps/print.c Tue Jun 18 02:23:29 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: print.c,v 1.130 2018/09/19 15:20:39 maxv Exp $ */ +/* $NetBSD: print.c,v 1.131 2019/06/18 02:23:29 kamil Exp $ */ /* * Copyright (c) 2000, 2007 The NetBSD Foundation, Inc. @@ -63,7 +63,7 @@ #if 0 static char sccsid[] = "@(#)print.c 8.6 (Berkeley) 4/16/94"; #else -__RCSID("$NetBSD: print.c,v 1.130 2018/09/19 15:20:39 maxv Exp $"); +__RCSID("$NetBSD: print.c,v 1.131 2019/06/18 02:23:29 kamil Exp $"); #endif #endif /* not lint */ @@ -586,7 +586,9 @@ lstate(struct pinfo *pi, VARENT *ve, enu break; case LSZOMB: +#ifdef LSDEAD case LSDEAD: +#endif *cp = 'Z'; break;
Re: CVS commit: src/bin/ps
On Tue, 27 Jul 2010, Nicolas Joly wrote: v = ve-var; - doubleprintorsetwidth(v, getpcpu(k), 1, mode); + dbl = getpcpu(k); + doubleprintorsetwidth(v, dbl, (dbl = 100.0) ? 0 : 1, mode); } I think you need to test (dbl = 99.95); otherwise values in the range from 99.95 to 99.... will be printed with one decimal place, as 100.0. --apb (Alan Barrett)
Re: CVS commit: src/bin/ps
On Wed, Jul 28, 2010 at 01:14:40PM +0200, Alan Barrett wrote: On Tue, 27 Jul 2010, Nicolas Joly wrote: v = ve-var; - doubleprintorsetwidth(v, getpcpu(k), 1, mode); + dbl = getpcpu(k); + doubleprintorsetwidth(v, dbl, (dbl = 100.0) ? 0 : 1, mode); } I think you need to test (dbl = 99.95); otherwise values in the range from 99.95 to 99.... will be printed with one decimal place, as 100.0. Right, will fix. -- Nicolas Joly Biological Software and Databanks. Institut Pasteur, Paris.