CVS commit: [netbsd-8] src/doc
Module Name:src Committed By: msaitoh Date: Wed Sep 15 05:12:03 UTC 2021 Modified Files: src/doc [netbsd-8]: CHANGES-8.3 Log Message: Ticket #1695. To generate a diff of this commit: cvs rdiff -u -r1.1.2.99 -r1.1.2.100 src/doc/CHANGES-8.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/doc/CHANGES-8.3 diff -u src/doc/CHANGES-8.3:1.1.2.99 src/doc/CHANGES-8.3:1.1.2.100 --- src/doc/CHANGES-8.3:1.1.2.99 Tue Sep 7 22:29:07 2021 +++ src/doc/CHANGES-8.3 Wed Sep 15 05:12:03 2021 @@ -1,4 +1,4 @@ -# $NetBSD: CHANGES-8.3,v 1.1.2.99 2021/09/07 22:29:07 snj Exp $ +# $NetBSD: CHANGES-8.3,v 1.1.2.100 2021/09/15 05:12:03 msaitoh Exp $ A complete list of changes from the NetBSD 8.2 release to the NetBSD 8.3 release: @@ -2018,3 +2018,8 @@ distrib/sets/makesrctars 1.43 in source sets. [martin, ticket #1694] +build.sh 1.348-1.352, 1.356 + + Support for MKREPRO and automatic timestamps when the source + tree is from git or mercurial. + [martin, ticket #1695]
CVS commit: [netbsd-8] src/doc
Module Name:src Committed By: msaitoh Date: Wed Sep 15 05:12:03 UTC 2021 Modified Files: src/doc [netbsd-8]: CHANGES-8.3 Log Message: Ticket #1695. To generate a diff of this commit: cvs rdiff -u -r1.1.2.99 -r1.1.2.100 src/doc/CHANGES-8.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [netbsd-8] src
Module Name:src Committed By: msaitoh Date: Wed Sep 15 05:07:42 UTC 2021 Modified Files: src [netbsd-8]: build.sh Log Message: Pull up following revision(s) (requested by martin in ticket #1695): build.sh: revision 1.348 build.sh: revision 1.349 build.sh: revision 1.350 build.sh: revision 1.351 build.sh: revision 1.352 build.sh: revision 1.356 ignore cvslatest errors in expert mode Handle git and mercurial for reproducible builds. for mercurial, use the latest revision instead of limiting the output to 1 (requested by joerg) handle different flavors of date(1) kre@ does not like the subshell :-) Add a new operation "mkrepro-timestamp" to extract the timestamp a build with -P would use. Example usage: ./build.sh -T /usr/tools -P mkrepro-timestamp This allows us to extract this information once, make other use of it, and replicate it on other machines with -V MKREPRO=yes -V MKREPRO_TIMESTAMP=.. To generate a diff of this commit: cvs rdiff -u -r1.316.4.2 -r1.316.4.3 src/build.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/build.sh diff -u src/build.sh:1.316.4.2 src/build.sh:1.316.4.3 --- src/build.sh:1.316.4.2 Mon Feb 26 13:52:00 2018 +++ src/build.sh Wed Sep 15 05:07:42 2021 @@ -1,5 +1,5 @@ #! /usr/bin/env sh -# $NetBSD: build.sh,v 1.316.4.2 2018/02/26 13:52:00 martin Exp $ +# $NetBSD: build.sh,v 1.316.4.3 2021/09/15 05:07:42 msaitoh Exp $ # # Copyright (c) 2001-2011 The NetBSD Foundation, Inc. # All rights reserved. @@ -1052,6 +1052,8 @@ Usage: ${progname} [-EhnoPRrUuxy] [-a ar list-arch Display a list of valid MACHINE/MACHINE_ARCH values, and exit. The list may be narrowed by passing glob patterns or exact values in MACHINE or MACHINE_ARCH. +mkrepro-timestamp Show the latest source timestamp used for reproducable +builds and exit. Requires -P or -V MKREPRO=yes. Options: -a archSet MACHINE_ARCH to arch. [Default: deduced from MACHINE] @@ -1323,7 +1325,12 @@ parseoptions() list-arch) listarch "${MACHINE}" "${MACHINE_ARCH}" - exit $? + exit + ;; + mkrepro-timestamp) + setup_mkrepro quiet + echo ${MKREPRO_TIMESTAMP:-0} + [ ${MKREPRO_TIMESTAMP:-0} -ne 0 ]; exit ;; kernel=*|releasekernel=*|kernel.gdb=*) @@ -1907,7 +1914,7 @@ createmakewrapper() eval cat < /dev/null || date -u -d "@$1" +} + setup_mkrepro() { + local quiet="$1" + if [ ${MKREPRO-no} != "yes" ]; then return fi + if [ ${MKREPRO_TIMESTAMP-0} -ne 0 ]; then + return; + fi + local dirs=${NETBSDSRCDIR-/usr/src}/ if [ ${MKX11-no} = "yes" ]; then dirs="$dirs ${X11SRCDIR-/usr/xsrc}/" fi + local cvslatest=$(print_tooldir_program cvslatest) if [ ! -x "${cvslatest}" ]; then buildtools fi - MKREPRO_TIMESTAMP=$("${cvslatest}" ${dirs}) - [ -n "${MKREPRO_TIMESTAMP}" ] || bomb "Failed to compute timestamp" - statusmsg2 "MKREPRO_TIMESTAMP" "$(TZ=UTC date -r ${MKREPRO_TIMESTAMP})" + + local cvslatestflags= + if ${do_expertmode}; then + cvslatestflags=-i + fi + + MKREPRO_TIMESTAMP=0 + local d + local t + local vcs + for d in ${dirs}; do + if [ -d "${d}CVS" ]; then + t=$("${cvslatest}" ${cvslatestflags} "${d}") + vcs=cvs + elif [ -d "${d}.git" ]; then + t=$(cd "${d}" && git log -1 --format=%ct) + vcs=git + elif [ -d "${d}.hg" ]; then + t=$(cd "${d}" && + hg log -r . --template '{date(date, "%s")}\n') + vcs=hg + else + bomb "Cannot determine VCS for '$d'" + fi + + if [ -z "$t" ]; then + bomb "Failed to get timestamp for vcs=$vcs in '$d'" + fi + + #echo "latest $d $vcs $t" + if [ "$t" -gt "$MKREPRO_TIMESTAMP" ]; then + MKREPRO_TIMESTAMP="$t" + fi + done + + [ "${MKREPRO_TIMESTAMP}" != "0" ] || bomb "Failed to compute timestamp" + if [ -z "${quiet}" ]; then + statusmsg2 "MKREPRO_TIMESTAMP" \ + "$(repro_date "${MKREPRO_TIMESTAMP}")" + fi export MKREPRO MKREPRO_TIMESTAMP }
CVS commit: [netbsd-8] src
Module Name:src Committed By: msaitoh Date: Wed Sep 15 05:07:42 UTC 2021 Modified Files: src [netbsd-8]: build.sh Log Message: Pull up following revision(s) (requested by martin in ticket #1695): build.sh: revision 1.348 build.sh: revision 1.349 build.sh: revision 1.350 build.sh: revision 1.351 build.sh: revision 1.352 build.sh: revision 1.356 ignore cvslatest errors in expert mode Handle git and mercurial for reproducible builds. for mercurial, use the latest revision instead of limiting the output to 1 (requested by joerg) handle different flavors of date(1) kre@ does not like the subshell :-) Add a new operation "mkrepro-timestamp" to extract the timestamp a build with -P would use. Example usage: ./build.sh -T /usr/tools -P mkrepro-timestamp This allows us to extract this information once, make other use of it, and replicate it on other machines with -V MKREPRO=yes -V MKREPRO_TIMESTAMP=.. To generate a diff of this commit: cvs rdiff -u -r1.316.4.2 -r1.316.4.3 src/build.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Re: CVS commit: src/usr.sbin/acpitools/acpidump
> On Sep 14, 2021, at 1:34 PM, Roland Illig wrote: > > When lint runs on the code, it defines the preprocessor macro 'lint' to > be 1. Due to that, this name cannot be used as a regular identifier. Perhaps all of the "#ifdef lint" conditions should become "#ifdef __lint__"? -- thorpej
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/sys/sys
Module Name:src Committed By: christos Date: Tue Sep 14 22:01:40 UTC 2021 Modified Files: src/sys/sys: ktrace.h Log Message: add format for flags. To generate a diff of this commit: cvs rdiff -u -r1.66 -r1.67 src/sys/sys/ktrace.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/sys/ktrace.h diff -u src/sys/sys/ktrace.h:1.66 src/sys/sys/ktrace.h:1.67 --- src/sys/sys/ktrace.h:1.66 Thu Apr 19 17:19:07 2018 +++ src/sys/sys/ktrace.h Tue Sep 14 18:01:40 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: ktrace.h,v 1.66 2018/04/19 21:19:07 christos Exp $ */ +/* $NetBSD: ktrace.h,v 1.67 2021/09/14 22:01:40 christos Exp $ */ /* * Copyright (c) 1988, 1993 @@ -248,6 +248,27 @@ struct ktr_execfd { #define KTRFAC_EXEC_ENV (1<
CVS commit: src/sys/sys
Module Name:src Committed By: christos Date: Tue Sep 14 22:01:40 UTC 2021 Modified Files: src/sys/sys: ktrace.h Log Message: add format for flags. To generate a diff of this commit: cvs rdiff -u -r1.66 -r1.67 src/sys/sys/ktrace.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 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/sys/dev/fdt
Module Name:src Committed By: jmcneill Date: Tue Sep 14 22:00:11 UTC 2021 Modified Files: src/sys/dev/fdt: dwc3_fdt.c Log Message: Remove "no IOMMU" hack. To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/sys/dev/fdt/dwc3_fdt.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/fdt/dwc3_fdt.c diff -u src/sys/dev/fdt/dwc3_fdt.c:1.17 src/sys/dev/fdt/dwc3_fdt.c:1.18 --- src/sys/dev/fdt/dwc3_fdt.c:1.17 Mon Aug 30 22:49:42 2021 +++ src/sys/dev/fdt/dwc3_fdt.c Tue Sep 14 22:00:11 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: dwc3_fdt.c,v 1.17 2021/08/30 22:49:42 jmcneill Exp $ */ +/* $NetBSD: dwc3_fdt.c,v 1.18 2021/09/14 22:00:11 jmcneill Exp $ */ /*- * Copyright (c) 2018 Jared McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: dwc3_fdt.c,v 1.17 2021/08/30 22:49:42 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: dwc3_fdt.c,v 1.18 2021/09/14 22:00:11 jmcneill Exp $"); #include #include @@ -242,12 +242,6 @@ dwc3_fdt_attach(device_t parent, device_ void *ih; u_int n; - /* XXX IOMMUs not supported yet */ - if (of_hasprop(phandle, "iommus")) { - aprint_error(": devices behind IOMMUs not supported\n"); - return; - } - /* Find dwc3 sub-node */ if (of_compatible_lookup(phandle, compat_data_dwc3) == NULL) { dwc3_phandle = of_find_firstchild_byname(phandle, "dwc3");
CVS commit: src/sys/dev/fdt
Module Name:src Committed By: jmcneill Date: Tue Sep 14 22:00:11 UTC 2021 Modified Files: src/sys/dev/fdt: dwc3_fdt.c Log Message: Remove "no IOMMU" hack. To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/sys/dev/fdt/dwc3_fdt.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/crypto/dist/ipsec-tools/src/racoon
Module Name:src Committed By: rillig Date: Tue Sep 14 21:49:31 UTC 2021 Modified Files: src/crypto/dist/ipsec-tools/src/racoon: privsep.c Log Message: ipsectools: fix lint error Returning a value from a void function is a GNU extension, but even in GNU mode, lint does not allow these. No functional change. To generate a diff of this commit: cvs rdiff -u -r1.25 -r1.26 src/crypto/dist/ipsec-tools/src/racoon/privsep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/crypto/dist/ipsec-tools/src/racoon/privsep.c diff -u src/crypto/dist/ipsec-tools/src/racoon/privsep.c:1.25 src/crypto/dist/ipsec-tools/src/racoon/privsep.c:1.26 --- src/crypto/dist/ipsec-tools/src/racoon/privsep.c:1.25 Tue Aug 28 09:10:28 2018 +++ src/crypto/dist/ipsec-tools/src/racoon/privsep.c Tue Sep 14 21:49:31 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: privsep.c,v 1.25 2018/08/28 09:10:28 christos Exp $ */ +/* $NetBSD: privsep.c,v 1.26 2021/09/14 21:49:31 rillig Exp $ */ /* Id: privsep.c,v 1.15 2005/08/08 11:23:44 vanhu Exp */ @@ -1762,8 +1762,10 @@ privsep_cleanup_pam(port) size_t len; char *data; - if (geteuid() == 0) - return cleanup_pam(port); + if (geteuid() == 0) { + cleanup_pam(port); + return; + } len = sizeof(*msg) + sizeof(port)
CVS commit: src/crypto/dist/ipsec-tools/src/racoon
Module Name:src Committed By: rillig Date: Tue Sep 14 21:49:31 UTC 2021 Modified Files: src/crypto/dist/ipsec-tools/src/racoon: privsep.c Log Message: ipsectools: fix lint error Returning a value from a void function is a GNU extension, but even in GNU mode, lint does not allow these. No functional change. To generate a diff of this commit: cvs rdiff -u -r1.25 -r1.26 src/crypto/dist/ipsec-tools/src/racoon/privsep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.sbin/sysinst
Module Name:src Committed By: rillig Date: Tue Sep 14 21:45:20 UTC 2021 Modified Files: src/usr.sbin/sysinst: partman.c Log Message: sysinst: fix lint error about empty compound literal In C99, a compound literal must have at least one expression between the braces. Empty structs and compound literals are a GNU extension. The first member of struct part_entry has type size_t, therefore 0 fits well. No functional change. To generate a diff of this commit: cvs rdiff -u -r1.52 -r1.53 src/usr.sbin/sysinst/partman.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/sysinst/partman.c diff -u src/usr.sbin/sysinst/partman.c:1.52 src/usr.sbin/sysinst/partman.c:1.53 --- src/usr.sbin/sysinst/partman.c:1.52 Sat Jul 17 11:32:50 2021 +++ src/usr.sbin/sysinst/partman.c Tue Sep 14 21:45:20 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: partman.c,v 1.52 2021/07/17 11:32:50 martin Exp $ */ +/* $NetBSD: partman.c,v 1.53 2021/09/14 21:45:20 rillig Exp $ */ /* * Copyright 2012 Eugene Lozovoy @@ -403,12 +403,12 @@ pm_dev_list(int type) (num_devs+1<3)?3:num_devs+1, 13, MC_SCROLL | MC_NOCLEAR, NULL, NULL, NULL, NULL, MSG_cancel); if (menu_no == -1) - return (struct part_entry) { }; + return (struct part_entry) { 0 }; process_menu(menu_no, _num); free_menu(menu_no); if (dev_num < 0 || dev_num >= num_devs) - return (struct part_entry) { }; + return (struct part_entry) { 0 }; pm_retvalue = dev_num; return disk_entries[dev_num];
CVS commit: src/usr.sbin/sysinst
Module Name:src Committed By: rillig Date: Tue Sep 14 21:45:20 UTC 2021 Modified Files: src/usr.sbin/sysinst: partman.c Log Message: sysinst: fix lint error about empty compound literal In C99, a compound literal must have at least one expression between the braces. Empty structs and compound literals are a GNU extension. The first member of struct part_entry has type size_t, therefore 0 fits well. No functional change. To generate a diff of this commit: cvs rdiff -u -r1.52 -r1.53 src/usr.sbin/sysinst/partman.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.sbin/bta2dpd/bta2dpd
Module Name:src Committed By: rillig Date: Tue Sep 14 20:45:19 UTC 2021 Modified Files: src/usr.sbin/bta2dpd/bta2dpd: Makefile Log Message: bta2dpd: fix lint build To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/usr.sbin/bta2dpd/bta2dpd/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/bta2dpd/bta2dpd/Makefile diff -u src/usr.sbin/bta2dpd/bta2dpd/Makefile:1.3 src/usr.sbin/bta2dpd/bta2dpd/Makefile:1.4 --- src/usr.sbin/bta2dpd/bta2dpd/Makefile:1.3 Sat Jul 27 20:10:29 2019 +++ src/usr.sbin/bta2dpd/bta2dpd/Makefile Tue Sep 14 20:45:19 2021 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.3 2019/07/27 20:10:29 nakayama Exp $ +# $NetBSD: Makefile,v 1.4 2021/09/14 20:45:19 rillig Exp $ .include @@ -8,7 +8,7 @@ PROG= bta2dpd SRCS= bta2dpd.c avdtp.c sbc_encode.c MAN= bta2dpd.8 -CFLAGS+= -I. +CPPFLAGS+= -I. DPADD+= ${LIBBLUETOOTH} ${LIBEVENT} ${LIBUTIL} LDADD+= -lbluetooth -levent -lutil CLEANFILES+= sbc_crc.h sbc_coeffs.h
CVS commit: src/usr.sbin/bta2dpd/bta2dpd
Module Name:src Committed By: rillig Date: Tue Sep 14 20:45:19 UTC 2021 Modified Files: src/usr.sbin/bta2dpd/bta2dpd: Makefile Log Message: bta2dpd: fix lint build To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/usr.sbin/bta2dpd/bta2dpd/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.sbin/autofs
Module Name:src Committed By: rillig Date: Tue Sep 14 20:40:55 UTC 2021 Modified Files: src/usr.sbin/autofs: common.c Log Message: autofs: fix lint errors common.c(1034): error: void function parse_map cannot return value [213] common.c(1053): error: void function parse_map cannot return value [213] To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/usr.sbin/autofs/common.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.sbin/autofs
Module Name:src Committed By: rillig Date: Tue Sep 14 20:40:55 UTC 2021 Modified Files: src/usr.sbin/autofs: common.c Log Message: autofs: fix lint errors common.c(1034): error: void function parse_map cannot return value [213] common.c(1053): error: void function parse_map cannot return value [213] To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/usr.sbin/autofs/common.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/autofs/common.c diff -u src/usr.sbin/autofs/common.c:1.3 src/usr.sbin/autofs/common.c:1.4 --- src/usr.sbin/autofs/common.c:1.3 Sat Nov 16 12:21:06 2019 +++ src/usr.sbin/autofs/common.c Tue Sep 14 20:40:55 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: common.c,v 1.3 2019/11/16 12:21:06 tkusumi Exp $ */ +/* $NetBSD: common.c,v 1.4 2021/09/14 20:40:55 rillig Exp $ */ /*- * Copyright (c) 2017 The NetBSD Foundation, Inc. @@ -36,7 +36,7 @@ * $FreeBSD: head/usr.sbin/autofs/common.c 303527 2016-07-30 01:10:05Z bapt $ */ #include -__RCSID("$NetBSD: common.c,v 1.3 2019/11/16 12:21:06 tkusumi Exp $"); +__RCSID("$NetBSD: common.c,v 1.4 2021/09/14 20:40:55 rillig Exp $"); #include #include @@ -1031,7 +1031,8 @@ parse_map(struct node *parent, const cha if (map[0] == '-') { if (wildcards != NULL) *wildcards = true; - return parse_special_map(parent, map, key); + parse_special_map(parent, map, key); + return; } if (map[0] == '/') { @@ -1050,7 +1051,8 @@ parse_map(struct node *parent, const cha if (error != 0) { log_debugx("map file \"%s\" does not exist; falling " "back to directory services", path); - return parse_included_map(parent, map); + parse_included_map(parent, map); + return; } }
CVS commit: src/usr.sbin
Module Name:src Committed By: rillig Date: Tue Sep 14 20:36:02 UTC 2021 Modified Files: src/usr.sbin: Makefile.inc Log Message: usr.sbin: enable lint for all programs To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/usr.sbin/Makefile.inc Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/Makefile.inc diff -u src/usr.sbin/Makefile.inc:1.7 src/usr.sbin/Makefile.inc:1.8 --- src/usr.sbin/Makefile.inc:1.7 Sat Jan 23 21:22:50 2016 +++ src/usr.sbin/Makefile.inc Tue Sep 14 20:36:02 2021 @@ -1,6 +1,11 @@ -# $NetBSD: Makefile.inc,v 1.7 2016/01/23 21:22:50 christos Exp $ +# $NetBSD: Makefile.inc,v 1.8 2021/09/14 20:36:02 rillig Exp $ # from: @(#)Makefile.inc 8.1 (Berkeley) 6/6/93 BINDIR?= /usr/sbin WARNS?= 4 CPPFLAGS+= -D_KERNTYPES + +.include +.if ${MKLINT} != "no" && ${LINT_SUPPORTED:Uyes} == "yes" +realall: lint +.endif
CVS commit: src/usr.sbin
Module Name:src Committed By: rillig Date: Tue Sep 14 20:36:02 UTC 2021 Modified Files: src/usr.sbin: Makefile.inc Log Message: usr.sbin: enable lint for all programs To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/usr.sbin/Makefile.inc Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.sbin/acpitools/acpidump
Module Name:src Committed By: rillig Date: Tue Sep 14 20:34:36 UTC 2021 Modified Files: src/usr.sbin/acpitools/acpidump: acpi.c Log Message: acpidump: fix lint errors When lint runs on the code, it defines the preprocessor macro 'lint' to be 1. Due to that, this name cannot be used as a regular identifier. acpi.c(86): error: syntax error '1' [249] acpi.c(1004): error: syntax error '1' [249] acpi.c(2422): error: void function acpi_print_lpit cannot return value [213] The FreeBSD code doesn't need this name change since lint is specific to NetBSD. No functional change. To generate a diff of this commit: cvs rdiff -u -r1.50 -r1.51 src/usr.sbin/acpitools/acpidump/acpi.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/acpitools/acpidump/acpi.c diff -u src/usr.sbin/acpitools/acpidump/acpi.c:1.50 src/usr.sbin/acpitools/acpidump/acpi.c:1.51 --- src/usr.sbin/acpitools/acpidump/acpi.c:1.50 Wed Jan 20 15:27:51 2021 +++ src/usr.sbin/acpitools/acpidump/acpi.c Tue Sep 14 20:34:36 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: acpi.c,v 1.50 2021/01/20 15:27:51 skrll Exp $ */ +/* $NetBSD: acpi.c,v 1.51 2021/09/14 20:34:36 rillig Exp $ */ /*- * Copyright (c) 1998 Doug Rabson @@ -30,7 +30,7 @@ */ #include -__RCSID("$NetBSD: acpi.c,v 1.50 2021/01/20 15:27:51 skrll Exp $"); +__RCSID("$NetBSD: acpi.c,v 1.51 2021/09/14 20:34:36 rillig Exp $"); #include #include @@ -83,7 +83,7 @@ static void acpi_print_io_apic(uint32_t uint64_t apic_addr); static void acpi_print_mps_flags(uint16_t flags); static void acpi_print_intr(uint32_t intr, uint16_t mps_flags); -static void acpi_print_local_nmi(u_int lint, uint16_t mps_flags); +static void acpi_print_local_nmi(u_int local_int, uint16_t mps_flags); static void acpi_print_madt(ACPI_SUBTABLE_HEADER *mp); static void acpi_handle_bert(ACPI_TABLE_HEADER *sdp); static void acpi_handle_bgrt(ACPI_TABLE_HEADER *sdp); @@ -1001,10 +1001,10 @@ acpi_print_intr(uint32_t intr, uint16_t } static void -acpi_print_local_nmi(u_int lint, uint16_t mps_flags) +acpi_print_local_nmi(u_int local_int, uint16_t mps_flags) { - printf("\tLINT Pin=%d\n", lint); + printf("\tLINT Pin=%d\n", local_int); acpi_print_mps_flags(mps_flags); } @@ -2419,7 +2419,7 @@ acpi_print_lpit(ACPI_LPIT_HEADER *lpit) #undef PRINTFLAG if (lpit->Type == ACPI_LPIT_TYPE_NATIVE_CSTATE) - return acpi_print_native_lpit((ACPI_LPIT_NATIVE *)lpit); + acpi_print_native_lpit((ACPI_LPIT_NATIVE *)lpit); } static void
CVS commit: src/usr.sbin/acpitools/acpidump
Module Name:src Committed By: rillig Date: Tue Sep 14 20:34:36 UTC 2021 Modified Files: src/usr.sbin/acpitools/acpidump: acpi.c Log Message: acpidump: fix lint errors When lint runs on the code, it defines the preprocessor macro 'lint' to be 1. Due to that, this name cannot be used as a regular identifier. acpi.c(86): error: syntax error '1' [249] acpi.c(1004): error: syntax error '1' [249] acpi.c(2422): error: void function acpi_print_lpit cannot return value [213] The FreeBSD code doesn't need this name change since lint is specific to NetBSD. No functional change. To generate a diff of this commit: cvs rdiff -u -r1.50 -r1.51 src/usr.sbin/acpitools/acpidump/acpi.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sbin
Module Name:src Committed By: rillig Date: Tue Sep 14 20:13:03 UTC 2021 Modified Files: src/sbin: Makefile.inc src/sbin/fsck_lfs: Makefile src/sbin/newfs_lfs: Makefile src/sbin/resize_ffs: Makefile Log Message: sbin: enable lint for almost all programs The programs fsck_lfs and newfs_lfs both trigger a longstanding bug in lint that is difficult to fix, so ignore them for now. For resize_ffs, lint thinks that 'struct fs' is incomplete, but GCC and Clang accept it. Needs further investigation. To generate a diff of this commit: cvs rdiff -u -r1.22 -r1.23 src/sbin/Makefile.inc cvs rdiff -u -r1.22 -r1.23 src/sbin/fsck_lfs/Makefile cvs rdiff -u -r1.14 -r1.15 src/sbin/newfs_lfs/Makefile cvs rdiff -u -r1.6 -r1.7 src/sbin/resize_ffs/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/Makefile.inc diff -u src/sbin/Makefile.inc:1.22 src/sbin/Makefile.inc:1.23 --- src/sbin/Makefile.inc:1.22 Wed Mar 21 05:47:53 2012 +++ src/sbin/Makefile.inc Tue Sep 14 20:13:03 2021 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.inc,v 1.22 2012/03/21 05:47:53 matt Exp $ +# $NetBSD: Makefile.inc,v 1.23 2021/09/14 20:13:03 rillig Exp $ # @(#)Makefile.inc 8.1 (Berkeley) 6/8/93 .include # for MKDYNAMICROOT definition @@ -9,3 +9,7 @@ BINDIR?= /sbin .if (${MKDYNAMICROOT} == "no") LDSTATIC?= -static .endif + +.if ${MKLINT} != "no" && ${LINT_SUPPORTED:Uyes} == "yes" +realall: lint +.endif Index: src/sbin/fsck_lfs/Makefile diff -u src/sbin/fsck_lfs/Makefile:1.22 src/sbin/fsck_lfs/Makefile:1.23 --- src/sbin/fsck_lfs/Makefile:1.22 Mon Sep 7 03:19:04 2020 +++ src/sbin/fsck_lfs/Makefile Tue Sep 14 20:13:03 2021 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.22 2020/09/07 03:19:04 mrg Exp $ +# $NetBSD: Makefile,v 1.23 2021/09/14 20:13:03 rillig Exp $ # @(#)Makefile 8.1 (Berkeley) 6/5/93 WARNS?= 3 # XXX: sign-compare issues @@ -19,4 +19,9 @@ CPPFLAGS+=-I${.CURDIR} -I${FSCK} -DIN_FS LDADD+=-lutil DPADD+=${LIBUTIL} +# As of 2021-09-14, lint does not recognize the types as equal, but it should. +# vnode.c(104): error: redeclaration of register_vget [27] +# vnode.h(75): previous declaration of register_vget [260] +LINT_SUPPORTED= no + .include Index: src/sbin/newfs_lfs/Makefile diff -u src/sbin/newfs_lfs/Makefile:1.14 src/sbin/newfs_lfs/Makefile:1.15 --- src/sbin/newfs_lfs/Makefile:1.14 Mon Sep 7 03:09:53 2020 +++ src/sbin/newfs_lfs/Makefile Tue Sep 14 20:13:03 2021 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.14 2020/09/07 03:09:53 mrg Exp $ +# $NetBSD: Makefile,v 1.15 2021/09/14 20:13:03 rillig Exp $ # @(#)Makefile 8.1 (Berkeley) 6/18/93 WARNS?= 3 # XXX: sign-compare issues @@ -25,4 +25,9 @@ DPADD+=${LIBPROP} CPPFLAGS+=-I${FSCK_LFS} -I${FSCK} # -DNDEBUG # -DVERBOSE_BLOCKMAP +# As of 2021-09-14, lint does not recognize the types as equal, but it should. +# vnode.c(104): error: redeclaration of register_vget [27] +# vnode.h(75): previous declaration of register_vget [260] +LINT_SUPPORTED= no + .include Index: src/sbin/resize_ffs/Makefile diff -u src/sbin/resize_ffs/Makefile:1.6 src/sbin/resize_ffs/Makefile:1.7 --- src/sbin/resize_ffs/Makefile:1.6 Sun May 24 14:41:26 2020 +++ src/sbin/resize_ffs/Makefile Tue Sep 14 20:13:03 2021 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.6 2020/05/24 14:41:26 jmcneill Exp $ +# $NetBSD: Makefile,v 1.7 2021/09/14 20:13:03 rillig Exp $ .include @@ -14,4 +14,7 @@ LDADD+= -lutil .PATH: ${NETBSDSRCDIR}/sys/ufs/ffs .PATH: ${NETBSDSRCDIR}/sbin/fsck +# resize_ffs.c(90): error: cannot take size/alignment of incomplete type [143] +LINT_SUPPORTED= no + .include
CVS commit: src/sbin
Module Name:src Committed By: rillig Date: Tue Sep 14 20:13:03 UTC 2021 Modified Files: src/sbin: Makefile.inc src/sbin/fsck_lfs: Makefile src/sbin/newfs_lfs: Makefile src/sbin/resize_ffs: Makefile Log Message: sbin: enable lint for almost all programs The programs fsck_lfs and newfs_lfs both trigger a longstanding bug in lint that is difficult to fix, so ignore them for now. For resize_ffs, lint thinks that 'struct fs' is incomplete, but GCC and Clang accept it. Needs further investigation. To generate a diff of this commit: cvs rdiff -u -r1.22 -r1.23 src/sbin/Makefile.inc cvs rdiff -u -r1.22 -r1.23 src/sbin/fsck_lfs/Makefile cvs rdiff -u -r1.14 -r1.15 src/sbin/newfs_lfs/Makefile cvs rdiff -u -r1.6 -r1.7 src/sbin/resize_ffs/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Tue Sep 14 19:44:40 UTC 2021 Modified Files: src/usr.bin/xlint/lint1: cgram.y lint1.h Log Message: lint: allow [*] everywhere where [] and [integer] are allowed It's a seldom used feature, but now it's at least consistent. To generate a diff of this commit: cvs rdiff -u -r1.363 -r1.364 src/usr.bin/xlint/lint1/cgram.y cvs rdiff -u -r1.128 -r1.129 src/usr.bin/xlint/lint1/lint1.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/xlint/lint1/cgram.y diff -u src/usr.bin/xlint/lint1/cgram.y:1.363 src/usr.bin/xlint/lint1/cgram.y:1.364 --- src/usr.bin/xlint/lint1/cgram.y:1.363 Tue Sep 14 19:06:27 2021 +++ src/usr.bin/xlint/lint1/cgram.y Tue Sep 14 19:44:40 2021 @@ -1,5 +1,5 @@ %{ -/* $NetBSD: cgram.y,v 1.363 2021/09/14 19:06:27 rillig Exp $ */ +/* $NetBSD: cgram.y,v 1.364 2021/09/14 19:44:40 rillig Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. @@ -35,7 +35,7 @@ #include #if defined(__RCSID) && !defined(lint) -__RCSID("$NetBSD: cgram.y,v 1.363 2021/09/14 19:06:27 rillig Exp $"); +__RCSID("$NetBSD: cgram.y,v 1.364 2021/09/14 19:44:40 rillig Exp $"); #endif #include @@ -143,6 +143,7 @@ anonymize(sym_t *s) qual_ptr *y_qual_ptr; bool y_seen_statement; struct generic_association *y_generic; + struct array_size y_array_size; }; %token T_LBRACE T_RBRACE T_LBRACK T_RBRACK T_LPAREN T_RPAREN @@ -335,6 +336,7 @@ anonymize(sym_t *s) %type direct_param_declarator %type direct_notype_param_declarator %type param_list +%type array_size_opt %type array_size %type identifier_list %type type_name @@ -1225,11 +1227,8 @@ notype_direct_declarator: | type_attribute notype_direct_declarator { $$ = $2; } - | notype_direct_declarator T_LBRACK T_RBRACK { - $$ = add_array($1, false, 0); - } - | notype_direct_declarator T_LBRACK array_size T_RBRACK { - $$ = add_array($1, true, to_int_constant($3, false)); + | notype_direct_declarator T_LBRACK array_size_opt T_RBRACK { + $$ = add_array($1, $3.has_dim, $3.dim); } | notype_direct_declarator param_list asm_or_symbolrename_opt { $$ = add_function(symbolrename($1, $3), $2); @@ -1249,11 +1248,8 @@ type_direct_declarator: | type_attribute type_direct_declarator { $$ = $2; } - | type_direct_declarator T_LBRACK T_RBRACK { - $$ = add_array($1, false, 0); - } - | type_direct_declarator T_LBRACK array_size T_RBRACK { - $$ = add_array($1, true, to_int_constant($3, false)); + | type_direct_declarator T_LBRACK array_size_opt T_RBRACK { + $$ = add_array($1, $3.has_dim, $3.dim); } | type_direct_declarator param_list asm_or_symbolrename_opt { $$ = add_function(symbolrename($1, $3), $2); @@ -1294,12 +1290,9 @@ direct_param_declarator: | T_LPAREN notype_param_declarator T_RPAREN { $$ = $2; } - | direct_param_declarator T_LBRACK T_RBRACK gcc_attribute_list_opt { - $$ = add_array($1, false, 0); - } - | direct_param_declarator T_LBRACK array_size T_RBRACK + | direct_param_declarator T_LBRACK array_size_opt T_RBRACK gcc_attribute_list_opt { - $$ = add_array($1, true, to_int_constant($3, false)); + $$ = add_array($1, $3.has_dim, $3.dim); } | direct_param_declarator param_list asm_or_symbolrename_opt { $$ = add_function(symbolrename($1, $3), $2); @@ -1315,11 +1308,8 @@ direct_notype_param_declarator: | T_LPAREN notype_param_declarator T_RPAREN { $$ = $2; } - | direct_notype_param_declarator T_LBRACK T_RBRACK { - $$ = add_array($1, false, 0); - } - | direct_notype_param_declarator T_LBRACK array_size T_RBRACK { - $$ = add_array($1, true, to_int_constant($3, false)); + | direct_notype_param_declarator T_LBRACK array_size_opt T_RBRACK { + $$ = add_array($1, $3.has_dim, $3.dim); } | direct_notype_param_declarator param_list asm_or_symbolrename_opt { $$ = add_function(symbolrename($1, $3), $2); @@ -1342,6 +1332,22 @@ id_list_lparen: } ; +array_size_opt: + /* empty */ { + $$.has_dim = false; + $$.dim = 0; + } + | T_ASTERISK { + /* since C99; variable length array of unspecified size */ + $$.has_dim = false; /* TODO: maybe change to true */ + $$.dim = 0; /* just as a placeholder */ + } + | array_size { + $$.has_dim = true; + $$.dim = to_int_constant($1, false); + } + ; + array_size: type_qualifier_list_opt T_SCLASS constant_expr { /* C11 6.7.6.3p7 */ @@ -1407,29 +1413,14 @@ direct_abstract_declarator: T_LPAREN abstract_declarator T_RPAREN { $$ = $2; } - | T_LBRACK T_RBRACK { - $$ = add_array(abstract_name(), false, 0); - } - | T_LBRACK T_ASTERISK T_RBRACK { - /* since C99 */ - $$ = add_array(abstract_name(), false, 0); - } - | T_LBRACK array_size T_RBRACK { - $$ = add_array(abstract_name(), true, - to_int_constant($2, false)); + | T_LBRACK array_size_opt T_RBRACK { + $$ = add_array(abstract_name(), $2.has_dim, $2.dim); }
CVS commit: src/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Tue Sep 14 19:44:40 UTC 2021 Modified Files: src/usr.bin/xlint/lint1: cgram.y lint1.h Log Message: lint: allow [*] everywhere where [] and [integer] are allowed It's a seldom used feature, but now it's at least consistent. To generate a diff of this commit: cvs rdiff -u -r1.363 -r1.364 src/usr.bin/xlint/lint1/cgram.y cvs rdiff -u -r1.128 -r1.129 src/usr.bin/xlint/lint1/lint1.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tests/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Tue Sep 14 19:08:41 UTC 2021 Modified Files: src/tests/usr.bin/xlint/lint1: decl_direct_abstract.c Log Message: tests/lint: fix typo from previous commit To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/xlint/lint1/decl_direct_abstract.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/usr.bin/xlint/lint1/decl_direct_abstract.c diff -u src/tests/usr.bin/xlint/lint1/decl_direct_abstract.c:1.3 src/tests/usr.bin/xlint/lint1/decl_direct_abstract.c:1.4 --- src/tests/usr.bin/xlint/lint1/decl_direct_abstract.c:1.3 Tue Sep 14 19:06:27 2021 +++ src/tests/usr.bin/xlint/lint1/decl_direct_abstract.c Tue Sep 14 19:08:40 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: decl_direct_abstract.c,v 1.3 2021/09/14 19:06:27 rillig Exp $ */ +/* $NetBSD: decl_direct_abstract.c,v 1.4 2021/09/14 19:08:40 rillig Exp $ */ # 3 "decl_direct_abstract.c" /* @@ -64,7 +64,7 @@ double type_of_c99_6_7_6_example_h = c99 void int_array(int[]); void int_array_3(int[3]); -/* supported since cgram.y 1.362 from 2021-09-14 */ +/* supported since cgram.y 1.363 from 2021-09-14 */ void int_array_ast(int[*]); /* expect+1: error: null dimension [17] */ void int_array_7_array(int[7][]); @@ -74,5 +74,5 @@ void int_array_7_array_ast(int[7][*]); void int_array_array(int[][7]); void int_array_3_array(int[3][7]); -/* supported since cgram.y 1.362 from 2021-09-14 */ +/* supported since cgram.y 1.363 from 2021-09-14 */ void int_array_ast_array(int[*][7]);
CVS commit: src/tests/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Tue Sep 14 19:08:41 UTC 2021 Modified Files: src/tests/usr.bin/xlint/lint1: decl_direct_abstract.c Log Message: tests/lint: fix typo from previous commit To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/xlint/lint1/decl_direct_abstract.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src
Module Name:src Committed By: rillig Date: Tue Sep 14 19:06:27 UTC 2021 Modified Files: src/tests/usr.bin/xlint/lint1: decl_direct_abstract.c decl_direct_abstract.exp src/usr.bin/xlint/lint1: cgram.y Log Message: lint: support int[*][3] from C99 No warning in pre-C99 mode since this declarator is not used in practice anyway. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/xlint/lint1/decl_direct_abstract.c \ src/tests/usr.bin/xlint/lint1/decl_direct_abstract.exp cvs rdiff -u -r1.362 -r1.363 src/usr.bin/xlint/lint1/cgram.y Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/usr.bin/xlint/lint1/decl_direct_abstract.c diff -u src/tests/usr.bin/xlint/lint1/decl_direct_abstract.c:1.2 src/tests/usr.bin/xlint/lint1/decl_direct_abstract.c:1.3 --- src/tests/usr.bin/xlint/lint1/decl_direct_abstract.c:1.2 Tue Sep 14 19:02:15 2021 +++ src/tests/usr.bin/xlint/lint1/decl_direct_abstract.c Tue Sep 14 19:06:27 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: decl_direct_abstract.c,v 1.2 2021/09/14 19:02:15 rillig Exp $ */ +/* $NetBSD: decl_direct_abstract.c,v 1.3 2021/09/14 19:06:27 rillig Exp $ */ # 3 "decl_direct_abstract.c" /* @@ -64,8 +64,7 @@ double type_of_c99_6_7_6_example_h = c99 void int_array(int[]); void int_array_3(int[3]); -/* TODO: support this in direct_abstract_declarator */ -/* expect+1: syntax error ']' [249] */ +/* supported since cgram.y 1.362 from 2021-09-14 */ void int_array_ast(int[*]); /* expect+1: error: null dimension [17] */ void int_array_7_array(int[7][]); @@ -75,6 +74,5 @@ void int_array_7_array_ast(int[7][*]); void int_array_array(int[][7]); void int_array_3_array(int[3][7]); -/* TODO: support this in direct_abstract_declarator */ -/* expect+1: syntax error ']' [249] */ +/* supported since cgram.y 1.362 from 2021-09-14 */ void int_array_ast_array(int[*][7]); Index: src/tests/usr.bin/xlint/lint1/decl_direct_abstract.exp diff -u src/tests/usr.bin/xlint/lint1/decl_direct_abstract.exp:1.2 src/tests/usr.bin/xlint/lint1/decl_direct_abstract.exp:1.3 --- src/tests/usr.bin/xlint/lint1/decl_direct_abstract.exp:1.2 Tue Sep 14 19:02:15 2021 +++ src/tests/usr.bin/xlint/lint1/decl_direct_abstract.exp Tue Sep 14 19:06:27 2021 @@ -8,7 +8,5 @@ decl_direct_abstract.c(56): error: canno decl_direct_abstract.c(59): error: cannot initialize 'double' from 'pointer to function(void) returning void' [185] decl_direct_abstract.c(61): error: cannot initialize 'double' from 'pointer to function(pointer to function(void) returning int) returning void' [185] decl_direct_abstract.c(63): error: cannot initialize 'double' from 'pointer to function(pointer to const pointer to function(unsigned int, ...) returning int) returning void' [185] -decl_direct_abstract.c(69): error: syntax error ']' [249] -decl_direct_abstract.c(71): error: null dimension [17] -decl_direct_abstract.c(74): error: null dimension [17] -decl_direct_abstract.c(80): error: syntax error ']' [249] +decl_direct_abstract.c(70): error: null dimension [17] +decl_direct_abstract.c(73): error: null dimension [17] Index: src/usr.bin/xlint/lint1/cgram.y diff -u src/usr.bin/xlint/lint1/cgram.y:1.362 src/usr.bin/xlint/lint1/cgram.y:1.363 --- src/usr.bin/xlint/lint1/cgram.y:1.362 Mon Sep 13 06:11:51 2021 +++ src/usr.bin/xlint/lint1/cgram.y Tue Sep 14 19:06:27 2021 @@ -1,5 +1,5 @@ %{ -/* $NetBSD: cgram.y,v 1.362 2021/09/13 06:11:51 rillig Exp $ */ +/* $NetBSD: cgram.y,v 1.363 2021/09/14 19:06:27 rillig Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. @@ -35,7 +35,7 @@ #include #if defined(__RCSID) && !defined(lint) -__RCSID("$NetBSD: cgram.y,v 1.362 2021/09/13 06:11:51 rillig Exp $"); +__RCSID("$NetBSD: cgram.y,v 1.363 2021/09/14 19:06:27 rillig Exp $"); #endif #include @@ -1410,7 +1410,10 @@ direct_abstract_declarator: | T_LBRACK T_RBRACK { $$ = add_array(abstract_name(), false, 0); } - /* TODO: T_LBRACK T_ASTERISK T_RBRACK; see below */ + | T_LBRACK T_ASTERISK T_RBRACK { + /* since C99 */ + $$ = add_array(abstract_name(), false, 0); + } | T_LBRACK array_size T_RBRACK { $$ = add_array(abstract_name(), true, to_int_constant($2, false)); @@ -1421,7 +1424,8 @@ direct_abstract_declarator: | direct_abstract_declarator T_LBRACK T_RBRACK { $$ = add_array($1, false, 0); } - | direct_abstract_declarator T_LBRACK T_ASTERISK T_RBRACK { /* C99 */ + | direct_abstract_declarator T_LBRACK T_ASTERISK T_RBRACK { + /* since C99 */ $$ = add_array($1, false, 0); } | direct_abstract_declarator T_LBRACK array_size T_RBRACK {
CVS commit: src
Module Name:src Committed By: rillig Date: Tue Sep 14 19:06:27 UTC 2021 Modified Files: src/tests/usr.bin/xlint/lint1: decl_direct_abstract.c decl_direct_abstract.exp src/usr.bin/xlint/lint1: cgram.y Log Message: lint: support int[*][3] from C99 No warning in pre-C99 mode since this declarator is not used in practice anyway. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/xlint/lint1/decl_direct_abstract.c \ src/tests/usr.bin/xlint/lint1/decl_direct_abstract.exp cvs rdiff -u -r1.362 -r1.363 src/usr.bin/xlint/lint1/cgram.y Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tests/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Tue Sep 14 19:02:15 UTC 2021 Modified Files: src/tests/usr.bin/xlint/lint1: decl_direct_abstract.c decl_direct_abstract.exp Log Message: tests/lint: test missing support for int[*][3] To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/xlint/lint1/decl_direct_abstract.c \ src/tests/usr.bin/xlint/lint1/decl_direct_abstract.exp Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/usr.bin/xlint/lint1/decl_direct_abstract.c diff -u src/tests/usr.bin/xlint/lint1/decl_direct_abstract.c:1.1 src/tests/usr.bin/xlint/lint1/decl_direct_abstract.c:1.2 --- src/tests/usr.bin/xlint/lint1/decl_direct_abstract.c:1.1 Mon Sep 13 22:09:06 2021 +++ src/tests/usr.bin/xlint/lint1/decl_direct_abstract.c Tue Sep 14 19:02:15 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: decl_direct_abstract.c,v 1.1 2021/09/13 22:09:06 rillig Exp $ */ +/* $NetBSD: decl_direct_abstract.c,v 1.2 2021/09/14 19:02:15 rillig Exp $ */ # 3 "decl_direct_abstract.c" /* @@ -61,3 +61,20 @@ double type_of_c99_6_7_6_example_f = c99 double type_of_c99_6_7_6_example_g = c99_6_7_6_example_g; /* expect+1: 'pointer to function(pointer to const pointer to function(unsigned int, ...) returning int) returning void' */ double type_of_c99_6_7_6_example_h = c99_6_7_6_example_h; + +void int_array(int[]); +void int_array_3(int[3]); +/* TODO: support this in direct_abstract_declarator */ +/* expect+1: syntax error ']' [249] */ +void int_array_ast(int[*]); +/* expect+1: error: null dimension [17] */ +void int_array_7_array(int[7][]); +void int_array_7_array_3(int[7][3]); +/* expect+1: error: null dimension [17] */ +void int_array_7_array_ast(int[7][*]); + +void int_array_array(int[][7]); +void int_array_3_array(int[3][7]); +/* TODO: support this in direct_abstract_declarator */ +/* expect+1: syntax error ']' [249] */ +void int_array_ast_array(int[*][7]); Index: src/tests/usr.bin/xlint/lint1/decl_direct_abstract.exp diff -u src/tests/usr.bin/xlint/lint1/decl_direct_abstract.exp:1.1 src/tests/usr.bin/xlint/lint1/decl_direct_abstract.exp:1.2 --- src/tests/usr.bin/xlint/lint1/decl_direct_abstract.exp:1.1 Mon Sep 13 22:09:06 2021 +++ src/tests/usr.bin/xlint/lint1/decl_direct_abstract.exp Tue Sep 14 19:02:15 2021 @@ -8,3 +8,7 @@ decl_direct_abstract.c(56): error: canno decl_direct_abstract.c(59): error: cannot initialize 'double' from 'pointer to function(void) returning void' [185] decl_direct_abstract.c(61): error: cannot initialize 'double' from 'pointer to function(pointer to function(void) returning int) returning void' [185] decl_direct_abstract.c(63): error: cannot initialize 'double' from 'pointer to function(pointer to const pointer to function(unsigned int, ...) returning int) returning void' [185] +decl_direct_abstract.c(69): error: syntax error ']' [249] +decl_direct_abstract.c(71): error: null dimension [17] +decl_direct_abstract.c(74): error: null dimension [17] +decl_direct_abstract.c(80): error: syntax error ']' [249]
CVS commit: src/tests/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Tue Sep 14 19:02:15 UTC 2021 Modified Files: src/tests/usr.bin/xlint/lint1: decl_direct_abstract.c decl_direct_abstract.exp Log Message: tests/lint: test missing support for int[*][3] To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/xlint/lint1/decl_direct_abstract.c \ src/tests/usr.bin/xlint/lint1/decl_direct_abstract.exp Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/sys
Module Name:src Committed By: christos Date: Tue Sep 14 17:10:46 UTC 2021 Modified Files: src/sys/sys: acct.h sysctl.h Log Message: Provide some snprintb(3) formats. To generate a diff of this commit: cvs rdiff -u -r1.27 -r1.28 src/sys/sys/acct.h cvs rdiff -u -r1.234 -r1.235 src/sys/sys/sysctl.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/sys/acct.h diff -u src/sys/sys/acct.h:1.27 src/sys/sys/acct.h:1.28 --- src/sys/sys/acct.h:1.27 Sat Jan 10 21:45:55 2009 +++ src/sys/sys/acct.h Tue Sep 14 13:10:46 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: acct.h,v 1.27 2009/01/11 02:45:55 christos Exp $ */ +/* $NetBSD: acct.h,v 1.28 2021/09/14 17:10:46 christos Exp $ */ /*- * Copyright (c) 1990, 1993, 1994 @@ -66,6 +66,14 @@ struct acct { uint8_t ac_flag; /* accounting flags */ }; +#define __ACCT_FLAG_BITS \ + "\020" \ + "\1FORK" \ + "\2SU" \ + "\3COMPAT" \ + "\4CORE" \ + "\5XSIG" + /* * 1/AHZ is the granularity of the data encoded in the comp_t fields. * This is not necessarily equal to hz. Index: src/sys/sys/sysctl.h diff -u src/sys/sys/sysctl.h:1.234 src/sys/sys/sysctl.h:1.235 --- src/sys/sys/sysctl.h:1.234 Sat Jul 24 09:28:14 2021 +++ src/sys/sys/sysctl.h Tue Sep 14 13:10:46 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: sysctl.h,v 1.234 2021/07/24 13:28:14 simonb Exp $ */ +/* $NetBSD: sysctl.h,v 1.235 2021/09/14 17:10:46 christos Exp $ */ /* * Copyright (c) 1989, 1993 @@ -548,6 +548,34 @@ struct kinfo_proc2 { */ #define L_DETACHED 0x0080 +#define __SYSCTL_PROC_FLAG_BITS \ + "\20" \ + "\1ADVLOCK" \ + "\2CONTROLT" \ + "\3INMEM" \ + "\4NOCLDSTOP" \ + "\5PPWAIT" \ + "\6PROFIL" \ + "\7SELECT" \ + "\10SINTR" \ + "\11SUGID" \ + "\12SYSTEM" \ + "\13SA" \ + "\14TRACED" \ + "\15WAITED" \ + "\16WEXIT" \ + "\17EXEC" \ + "\20OWEUPC" \ + "\22NOCLDWAIT" \ + "\22P32" \ + "\24CLDSIGIGN" \ + "\26SYSTRACE" \ + "\27CHTRACED" \ + "\30STOPFORK" \ + "\31STOPEXEC" \ + "\32STOPEXIT" \ + "\33SYSCALL" + /* * KERN_LWP structure. See notes on KERN_PROC2 about adding elements. */
CVS commit: src/sys/sys
Module Name:src Committed By: christos Date: Tue Sep 14 17:10:46 UTC 2021 Modified Files: src/sys/sys: acct.h sysctl.h Log Message: Provide some snprintb(3) formats. To generate a diff of this commit: cvs rdiff -u -r1.27 -r1.28 src/sys/sys/acct.h cvs rdiff -u -r1.234 -r1.235 src/sys/sys/sysctl.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/sh
Module Name:src Committed By: christos Date: Tue Sep 14 15:04:09 UTC 2021 Modified Files: src/bin/sh: histedit.c Log Message: Quote the filenames like before To generate a diff of this commit: cvs rdiff -u -r1.56 -r1.57 src/bin/sh/histedit.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/sh/histedit.c diff -u src/bin/sh/histedit.c:1.56 src/bin/sh/histedit.c:1.57 --- src/bin/sh/histedit.c:1.56 Sun Aug 15 06:17:55 2021 +++ src/bin/sh/histedit.c Tue Sep 14 11:04:09 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: histedit.c,v 1.56 2021/08/15 10:17:55 christos Exp $ */ +/* $NetBSD: histedit.c,v 1.57 2021/09/14 15:04:09 christos Exp $ */ /*- * Copyright (c) 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)histedit.c 8.2 (Berkeley) 5/4/95"; #else -__RCSID("$NetBSD: histedit.c,v 1.56 2021/08/15 10:17:55 christos Exp $"); +__RCSID("$NetBSD: histedit.c,v 1.57 2021/09/14 15:04:09 christos Exp $"); #endif #endif /* not lint */ @@ -622,9 +622,9 @@ out: unsigned char sh_complete(EditLine *sel, int ch __unused) { - return (unsigned char)fn_complete(sel, NULL, sh_matches, + return (unsigned char)fn_complete2(sel, NULL, sh_matches, L" \t\n\"\\'`@$><=;|&{(", NULL, NULL, (size_t)100, - NULL, &((int) {0}), NULL, NULL); + NULL, &((int) {0}), NULL, NULL, FN_QUOTE_MATCH); } static int
CVS commit: src/bin/sh
Module Name:src Committed By: christos Date: Tue Sep 14 15:04:09 UTC 2021 Modified Files: src/bin/sh: histedit.c Log Message: Quote the filenames like before To generate a diff of this commit: cvs rdiff -u -r1.56 -r1.57 src/bin/sh/histedit.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/bin/sh
Module Name:src Committed By: kre Date: Tue Sep 14 14:49:39 UTC 2021 Modified Files: src/bin/sh: parser.c redir.c Log Message: Deal with some issues where fds intended only for internal use by the shell were available for manipulation by scripts (or the user). These issues were reported by Jan Schaumann on netbsd-users. The first allows the user to reference sh internal fds, and is a simple fix - any sh internal fd is simply treated as if it were closed when referenced by the script. These fds can be discovered by examining /proc/N/fd so it is not difficult for a script to discover which fd it should attempt to access. The second allows the user to reference a user level fd which is one that is normally available to it, but at a point where it should no longer be visible (when that fd has been redirected, for a built in command, so the original fd needs to be saved so it can be restored, the saving fd should not be accessible). It is not as easy for the script to determine which fd to attempt here, as the relevant one exists only during the lifetime of a built-in command (and similar), but there are ways in some cases (aside from looking at /proc from another process). Fix this one by watching which fds the user script is attempting to use, and avoid using those as temporary fds. This is possible in this case as we know what command is being run, before we need to save the fds it uses. That's different from the earlier case where when the shell allocates its fds we have no idea what it might reference later. Also clean up a couple of other minor code issues (NFC intended) that I noticed while here... To generate a diff of this commit: cvs rdiff -u -r1.172 -r1.173 src/bin/sh/parser.c cvs rdiff -u -r1.66 -r1.67 src/bin/sh/redir.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/sh/parser.c diff -u src/bin/sh/parser.c:1.172 src/bin/sh/parser.c:1.173 --- src/bin/sh/parser.c:1.172 Thu Sep 9 01:14:04 2021 +++ src/bin/sh/parser.c Tue Sep 14 14:49:39 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: parser.c,v 1.172 2021/09/09 01:14:04 kre Exp $ */ +/* $NetBSD: parser.c,v 1.173 2021/09/14 14:49:39 kre Exp $ */ /*- * Copyright (c) 1991, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)parser.c 8.7 (Berkeley) 5/16/95"; #else -__RCSID("$NetBSD: parser.c,v 1.172 2021/09/09 01:14:04 kre Exp $"); +__RCSID("$NetBSD: parser.c,v 1.173 2021/09/14 14:49:39 kre Exp $"); #endif #endif /* not lint */ @@ -55,6 +55,7 @@ __RCSID("$NetBSD: parser.c,v 1.172 2021/ #include "options.h" #include "input.h" #include "output.h" +#include "redir.h" /* defines max_user_fd */ #include "var.h" #include "error.h" #include "memalloc.h" @@ -756,6 +757,8 @@ fixredir(union node *n, const char *text else n->ndup.vname = makeword(startlinno - elided_nl); } + if (n->ndup.dupfd > max_user_fd) + max_user_fd = n->ndup.dupfd; } @@ -1590,6 +1593,8 @@ parseredir(const char *out, int c) np->nfile.fd = fd; /* do this again later with updated fd */ if (fd != np->nfile.fd) error("file descriptor (%d) out of range", fd); + if (fd > max_user_fd) + max_user_fd = fd; VTRACE(DBG_LEXER, ("parseredir after '%s%c' ", out, c)); if (c == '>') { Index: src/bin/sh/redir.c diff -u src/bin/sh/redir.c:1.66 src/bin/sh/redir.c:1.67 --- src/bin/sh/redir.c:1.66 Fri Mar 1 06:15:01 2019 +++ src/bin/sh/redir.c Tue Sep 14 14:49:39 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: redir.c,v 1.66 2019/03/01 06:15:01 kre Exp $ */ +/* $NetBSD: redir.c,v 1.67 2021/09/14 14:49:39 kre Exp $ */ /*- * Copyright (c) 1991, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)redir.c 8.2 (Berkeley) 5/4/95"; #else -__RCSID("$NetBSD: redir.c,v 1.66 2019/03/01 06:15:01 kre Exp $"); +__RCSID("$NetBSD: redir.c,v 1.67 2021/09/14 14:49:39 kre Exp $"); #endif #endif /* not lint */ @@ -237,10 +237,14 @@ redirect(union node *redir, int flags) } if ((flags & REDIR_PUSH) && !is_renamed(sv->renamed, fd)) { + int bigfd; + INTOFF; if (big_sh_fd < 10) find_big_fd(); - if ((i = fcntl(fd, F_DUPFD, big_sh_fd)) == -1) { + if ((bigfd = big_sh_fd) < max_user_fd) +bigfd = max_user_fd; + if ((i = fcntl(fd, F_DUPFD, bigfd + 1)) == -1) { switch (errno) { case EBADF: i = CLOSED; @@ -253,8 +257,7 @@ redirect(union node *redir, int flags) break; /* FALLTHRU */ default: - i = errno; - error("%d: %s", fd, strerror(i)); + error("%d: %s", fd, strerror(errno)); /* NOTREACHED */ } } @@ -350,6 +353,9 @@ openredirect(union node *redir, char mem case NTOFD: case NFROMFD: if (redir->ndup.dupfd >= 0) { /* if not ">&-" */ + if (sh_fd(redir->ndup.dupfd) != NULL) +error("Redirect (from %d to %d) failed: %s", +redir->ndup.dupfd, fd, strerror(EBADF)); if (fd < 10 && redir->ndup.dupfd < 10 && memory[redir->ndup.dupfd]) memory[fd] = 1;
CVS commit: src/bin/sh
Module Name:src Committed By: kre Date: Tue Sep 14 14:49:39 UTC 2021 Modified Files: src/bin/sh: parser.c redir.c Log Message: Deal with some issues where fds intended only for internal use by the shell were available for manipulation by scripts (or the user). These issues were reported by Jan Schaumann on netbsd-users. The first allows the user to reference sh internal fds, and is a simple fix - any sh internal fd is simply treated as if it were closed when referenced by the script. These fds can be discovered by examining /proc/N/fd so it is not difficult for a script to discover which fd it should attempt to access. The second allows the user to reference a user level fd which is one that is normally available to it, but at a point where it should no longer be visible (when that fd has been redirected, for a built in command, so the original fd needs to be saved so it can be restored, the saving fd should not be accessible). It is not as easy for the script to determine which fd to attempt here, as the relevant one exists only during the lifetime of a built-in command (and similar), but there are ways in some cases (aside from looking at /proc from another process). Fix this one by watching which fds the user script is attempting to use, and avoid using those as temporary fds. This is possible in this case as we know what command is being run, before we need to save the fds it uses. That's different from the earlier case where when the shell allocates its fds we have no idea what it might reference later. Also clean up a couple of other minor code issues (NFC intended) that I noticed while here... To generate a diff of this commit: cvs rdiff -u -r1.172 -r1.173 src/bin/sh/parser.c cvs rdiff -u -r1.66 -r1.67 src/bin/sh/redir.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.