CVS commit: src/usr.bin/make/unit-tests
Module Name:src Committed By: rillig Date: Sun Nov 15 06:19:34 UTC 2020 Modified Files: src/usr.bin/make/unit-tests: opt.exp opt.mk Log Message: make(1): add test for passing MAKEFLAGS to sub-makes To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/usr.bin/make/unit-tests/opt.exp cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/unit-tests/opt.mk 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/make/unit-tests/opt.exp diff -u src/usr.bin/make/unit-tests/opt.exp:1.5 src/usr.bin/make/unit-tests/opt.exp:1.6 --- src/usr.bin/make/unit-tests/opt.exp:1.5 Sun Nov 15 06:06:19 2020 +++ src/usr.bin/make/unit-tests/opt.exp Sun Nov 15 06:19:34 2020 @@ -1,3 +1,6 @@ +make -V MAKEFLAGS + -r -k -d 0 + make -: usage: make [-BeikNnqrSstWwX] [-C directory] [-D variable] [-d flags] [-f makefile] Index: src/usr.bin/make/unit-tests/opt.mk diff -u src/usr.bin/make/unit-tests/opt.mk:1.4 src/usr.bin/make/unit-tests/opt.mk:1.5 --- src/usr.bin/make/unit-tests/opt.mk:1.4 Sun Nov 15 06:06:19 2020 +++ src/usr.bin/make/unit-tests/opt.mk Sun Nov 15 06:19:34 2020 @@ -1,12 +1,16 @@ -# $NetBSD: opt.mk,v 1.4 2020/11/15 06:06:19 sjg Exp $ +# $NetBSD: opt.mk,v 1.5 2020/11/15 06:19:34 rillig Exp $ # # Tests for the command line options. -# TODO: Implementation - .MAKEFLAGS: -d0 # make stdout line-buffered all: .IGNORE + # The options from the top-level make are passed to the sub-makes via + # the environment variable MAKEFLAGS. This is where the " -r -k -d 0" + # comes from. See MainParseArg. + ${MAKE} -V MAKEFLAGS + @echo + # Just to see how the custom argument parsing code reacts to a syntax # error. The colon is used in the options string, marking an option # that takes arguments. It is not an option by itself, though.
CVS commit: src/usr.bin/make/unit-tests
Module Name:src Committed By: sjg Date: Sun Nov 15 06:06:20 UTC 2020 Modified Files: src/usr.bin/make/unit-tests: opt.exp opt.mk Log Message: Avoid reading unexpected makefiles To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/unit-tests/opt.exp cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/opt.mk 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/make/unit-tests/opt.exp diff -u src/usr.bin/make/unit-tests/opt.exp:1.4 src/usr.bin/make/unit-tests/opt.exp:1.5 --- src/usr.bin/make/unit-tests/opt.exp:1.4 Sat Nov 14 22:19:13 2020 +++ src/usr.bin/make/unit-tests/opt.exp Sun Nov 15 06:06:19 2020 @@ -5,7 +5,7 @@ usage: make [-BeikNnqrSstWwX] [-V variable] [-v variable] [variable=value] [target ...] *** Error code 2 (ignored) -make -- -VAR=value -f /dev/null +make -r -f /dev/null -- -VAR=value -f /dev/null make: don't know how to make -f (continuing) `/dev/null' is up to date. Index: src/usr.bin/make/unit-tests/opt.mk diff -u src/usr.bin/make/unit-tests/opt.mk:1.3 src/usr.bin/make/unit-tests/opt.mk:1.4 --- src/usr.bin/make/unit-tests/opt.mk:1.3 Sat Nov 14 17:33:51 2020 +++ src/usr.bin/make/unit-tests/opt.mk Sun Nov 15 06:06:19 2020 @@ -1,4 +1,4 @@ -# $NetBSD: opt.mk,v 1.3 2020/11/14 17:33:51 rillig Exp $ +# $NetBSD: opt.mk,v 1.4 2020/11/15 06:06:19 sjg Exp $ # # Tests for the command line options. @@ -14,9 +14,9 @@ all: .IGNORE @echo # See whether a '--' stops handling of command line options, like in - # standard getopt programs. Yes, it does, and it treats the '-f' as - # a target to be created. - ${MAKE} -- -VAR=value -f /dev/null + # standard getopt programs. Yes, it does, and it treats the + # second '-f' as a target to be created. + ${MAKE} -r -f /dev/null -- -VAR=value -f /dev/null @echo # This is the normal way to print the usage of a command.
CVS commit: src/usr.bin/make/unit-tests
Module Name:src Committed By: rillig Date: Sun Nov 15 05:48:18 UTC 2020 Modified Files: src/usr.bin/make/unit-tests: varmod-to-abs.exp varmod-to-abs.mk Log Message: make(1): fix test varmod-to-abs with USE_ABSOLUTE_TESTNAMES=yes When running the tests with specifying absolute filenames, it doesn't make sense to prefix the MAKEFILE with "./", which made the tests fail on FreeBSD. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/varmod-to-abs.exp cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/unit-tests/varmod-to-abs.mk 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/make/unit-tests/varmod-to-abs.exp diff -u src/usr.bin/make/unit-tests/varmod-to-abs.exp:1.3 src/usr.bin/make/unit-tests/varmod-to-abs.exp:1.4 --- src/usr.bin/make/unit-tests/varmod-to-abs.exp:1.3 Sat Nov 14 23:03:08 2020 +++ src/usr.bin/make/unit-tests/varmod-to-abs.exp Sun Nov 15 05:48:17 2020 @@ -1,5 +1,5 @@ make: "varmod-to-abs.mk" line 18: does-not-exist.c make: "varmod-to-abs.mk" line 19: does-not-exist.c -cached_realpath: ./varmod-to-abs.mk -> varmod-to-abs.mk +cached_realpath: varmod-to-abs.mk -> varmod-to-abs.mk make: "varmod-to-abs.mk" line 23: varmod-to-abs.mk exit status 0 Index: src/usr.bin/make/unit-tests/varmod-to-abs.mk diff -u src/usr.bin/make/unit-tests/varmod-to-abs.mk:1.4 src/usr.bin/make/unit-tests/varmod-to-abs.mk:1.5 --- src/usr.bin/make/unit-tests/varmod-to-abs.mk:1.4 Sat Nov 14 23:03:08 2020 +++ src/usr.bin/make/unit-tests/varmod-to-abs.mk Sun Nov 15 05:48:17 2020 @@ -1,4 +1,4 @@ -# $NetBSD: varmod-to-abs.mk,v 1.4 2020/11/14 23:03:08 rillig Exp $ +# $NetBSD: varmod-to-abs.mk,v 1.5 2020/11/15 05:48:17 rillig Exp $ # # Tests for the :tA variable modifier, which returns the absolute path for # each of the words in the variable value. @@ -20,7 +20,7 @@ does-not-exist.c= /dev/null # The output of the following line is modified by the global _SED_CMDS in # unit-tests/Makefile. See the .rawout file for the truth. -.info ${MAKEFILE:S,^,./,:tA} +.info ${MAKEFILE:tA} .MAKEFLAGS: -d0
CVS commit: src/usr.bin/make/unit-tests
Module Name:src Committed By: sjg Date: Sun Nov 15 05:43:56 UTC 2020 Modified Files: src/usr.bin/make/unit-tests: opt-chdir.mk Log Message: Avoid problem with /usr/obj To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/unit-tests/opt-chdir.mk 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/make/unit-tests/opt-chdir.mk diff -u src/usr.bin/make/unit-tests/opt-chdir.mk:1.4 src/usr.bin/make/unit-tests/opt-chdir.mk:1.5 --- src/usr.bin/make/unit-tests/opt-chdir.mk:1.4 Sat Nov 14 22:39:14 2020 +++ src/usr.bin/make/unit-tests/opt-chdir.mk Sun Nov 15 05:43:56 2020 @@ -1,4 +1,4 @@ -# $NetBSD: opt-chdir.mk,v 1.4 2020/11/14 22:39:14 rillig Exp $ +# $NetBSD: opt-chdir.mk,v 1.5 2020/11/15 05:43:56 sjg Exp $ # # Tests for the -C command line option, which changes the directory at the # beginning. @@ -20,7 +20,7 @@ chdir-filename-too-long: .PHONY .IGNORE # In this test, it is the root directory since almost any other directory # is not guaranteed to exist on every platform. chdir-root: .PHONY .IGNORE - @${MAKE} -C / -V 'cwd: $${.CURDIR}' + @MAKE_OBJDIR_CHECK_WRITABLE=no ${MAKE} -C / -V 'cwd: $${.CURDIR}' # Trying to change to a nonexistent directory exits immediately. chdir-nonexistent: .PHONY .IGNORE
CVS commit: src/external/cddl/osnet/dist/uts/common/fs/zfs
Module Name:src Committed By: chs Date: Sun Nov 15 00:54:13 UTC 2020 Modified Files: src/external/cddl/osnet/dist/uts/common/fs/zfs: zfs_vnops.c Log Message: Commit the ZFS file that I forgot in this previous commit: Move the handling of PG_PAGEOUT from uvm_aio_aiodone_pages() to uvm_page_unbusy() so that all callers of uvm_page_unbusy() don't need to handle this flag separately. Split out the pages part of uvm_aio_aiodone() into uvm_aio_aiodone_pages() in rump just like in the real kernel. In ZFS functions that can fail to copy data between the ARC and VM pages, use uvm_aio_aiodone_pages() rather than uvm_page_unbusy() so that we can handle these "I/O" errors. Fixes PR 55702. To generate a diff of this commit: cvs rdiff -u -r1.70 -r1.71 \ src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c diff -u src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c:1.70 src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c:1.71 --- src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c:1.70 Thu Aug 27 09:57:33 2020 +++ src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c Sun Nov 15 00:54:13 2020 @@ -6049,20 +6049,13 @@ zfs_netbsd_getpages(void *v) PAGE_SIZE, va, DMU_READ_PREFETCH); zfs_unmap_page(pg, va); - rw_enter(rw, RW_WRITER); if (err != 0) { -for (i = 0; i < npages; i++) { - pg = ap->a_m[i]; - if ((pg->flags & PG_FAKE) != 0) { - uvm_pagefree(pg); - } else { - uvm_page_unbusy(&pg, 1); - } -} +uvm_aio_aiodone_pages(ap->a_m, npages, false, err); memset(ap->a_m, 0, sizeof(ap->a_m[0]) * npages); break; } + rw_enter(rw, RW_WRITER); pg->flags &= ~(PG_FAKE); } @@ -6089,14 +6082,13 @@ zfs_putapage(vnode_t *vp, page_t **pp, i voff_t len, klen; int err; - bool async = (flags & PGO_SYNCIO) == 0; bool *cleanedp; struct uvm_object *uobj = &vp->v_uobj; krwlock_t *rw = uobj->vmobjlock; if (zp->z_sa_hdl == NULL) { err = 0; - goto out_unbusy; + goto out; } /* @@ -6170,12 +6162,8 @@ zfs_putapage(vnode_t *vp, page_t **pp, i } dmu_tx_commit(tx); -out_unbusy: - rw_enter(rw, RW_WRITER); - uvm_page_unbusy(pp, count); - rw_exit(rw); - out: + uvm_aio_aiodone_pages(pp, count, true, err); return (err); }
CVS commit: src/distrib/evbarm/isoimage
Module Name:src Committed By: jmcneill Date: Sun Nov 15 00:19:17 UTC 2020 Modified Files: src/distrib/evbarm/isoimage: Makefile.cdrom Log Message: Use "efi" boot image platform ID. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/distrib/evbarm/isoimage/Makefile.cdrom Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/evbarm/isoimage/Makefile.cdrom diff -u src/distrib/evbarm/isoimage/Makefile.cdrom:1.1 src/distrib/evbarm/isoimage/Makefile.cdrom:1.2 --- src/distrib/evbarm/isoimage/Makefile.cdrom:1.1 Sun Oct 11 14:24:50 2020 +++ src/distrib/evbarm/isoimage/Makefile.cdrom Sun Nov 15 00:19:17 2020 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.cdrom,v 1.1 2020/10/11 14:24:50 jmcneill Exp $ +# $NetBSD: Makefile.cdrom,v 1.2 2020/11/15 00:19:17 jmcneill Exp $ .include .include @@ -13,7 +13,7 @@ MAKEFS_TIMESTAMP=-T "${MKREPRO_TIMESTAMP # Need multidot for the boot loader to read kernel modules as it doesn't # understand rockridge. -CDMAKEFSOPTIONS= bootimage=i386;${EFIBOOTIMG},platformid=efi,no-emul-boot +CDMAKEFSOPTIONS= bootimage=efi;${EFIBOOTIMG},platformid=efi,no-emul-boot CDRELEASE_NOISOS= true CD_SETS=
CVS commit: src/usr.sbin/makefs
Module Name:src Committed By: jmcneill Date: Sun Nov 15 00:18:48 UTC 2020 Modified Files: src/usr.sbin/makefs: makefs.8 src/usr.sbin/makefs/cd9660: cd9660_eltorito.c Log Message: Add "efi" as a supported boot image type and derive the platform ID for the validation entry from the default boot image instead of hard-coding X86. To generate a diff of this commit: cvs rdiff -u -r1.65 -r1.66 src/usr.sbin/makefs/makefs.8 cvs rdiff -u -r1.23 -r1.24 src/usr.sbin/makefs/cd9660/cd9660_eltorito.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/makefs/makefs.8 diff -u src/usr.sbin/makefs/makefs.8:1.65 src/usr.sbin/makefs/makefs.8:1.66 --- src/usr.sbin/makefs/makefs.8:1.65 Sat Apr 4 13:44:57 2020 +++ src/usr.sbin/makefs/makefs.8 Sun Nov 15 00:18:48 2020 @@ -1,4 +1,4 @@ -.\" $NetBSD: makefs.8,v 1.65 2020/04/04 13:44:57 reinoud Exp $ +.\" $NetBSD: makefs.8,v 1.66 2020/11/15 00:18:48 jmcneill Exp $ .\" .\" Copyright (c) 2001-2003 Wasabi Systems, Inc. .\" All rights reserved. @@ -33,7 +33,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.Dd November 6, 2019 +.Dd November 14, 2020 .Dt MAKEFS 8 .Os .Sh NAME @@ -358,6 +358,7 @@ Filename of a boot image in the format where .Dq sysid is one of +.Ql efi , .Ql i386 , .Ql mac68k , .Ql macppc , Index: src/usr.sbin/makefs/cd9660/cd9660_eltorito.c diff -u src/usr.sbin/makefs/cd9660/cd9660_eltorito.c:1.23 src/usr.sbin/makefs/cd9660/cd9660_eltorito.c:1.24 --- src/usr.sbin/makefs/cd9660/cd9660_eltorito.c:1.23 Wed Mar 28 06:48:55 2018 +++ src/usr.sbin/makefs/cd9660/cd9660_eltorito.c Sun Nov 15 00:18:48 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: cd9660_eltorito.c,v 1.23 2018/03/28 06:48:55 nonaka Exp $ */ +/* $NetBSD: cd9660_eltorito.c,v 1.24 2020/11/15 00:18:48 jmcneill Exp $ */ /* * Copyright (c) 2005 Daniel Watt, Walter Deignan, Ryan Gabrys, Alan @@ -40,7 +40,7 @@ #include #if defined(__RCSID) && !defined(__lint) -__RCSID("$NetBSD: cd9660_eltorito.c,v 1.23 2018/03/28 06:48:55 nonaka Exp $"); +__RCSID("$NetBSD: cd9660_eltorito.c,v 1.24 2020/11/15 00:18:48 jmcneill Exp $"); #endif /* !__lint */ #ifdef DEBUG @@ -109,9 +109,11 @@ cd9660_add_boot_disk(iso9660_disk *diskS else if (strcmp(sysname, "macppc") == 0 || strcmp(sysname, "mac68k") == 0) new_image->system = ET_SYS_MAC; + else if (strcmp(sysname, "efi") == 0) + new_image->system = ET_SYS_EFI; else { warnx("boot disk system must be " - "i386, powerpc, macppc, or mac68k"); + "i386, powerpc, macppc, mac68k, or efi"); free(temp); free(new_image); return 0; @@ -363,6 +365,7 @@ cd9660_setup_boot(iso9660_disk *diskStru struct boot_catalog_entry *x86_head, *mac_head, *ppc_head, *efi_head, *valid_entry, *default_entry, *temp, *head, **headp, *next; struct cd9660_boot_image *tmp_disk; + u_char system; headp = NULL; x86_head = mac_head = ppc_head = efi_head = NULL; @@ -377,9 +380,16 @@ cd9660_setup_boot(iso9660_disk *diskStru cd9660_bothendian_dword(first_sector, diskStructure->boot_descriptor->boot_catalog_pointer); + /* + * Use system type of default image for validation entry. Fallback to + * X86 system type if not found. + */ + system = default_boot_image != NULL ? default_boot_image->system : + ET_SYS_X86; + /* Step 1: Generate boot catalog */ /* Step 1a: Validation entry */ - valid_entry = cd9660_boot_setup_validation_entry(ET_SYS_X86); + valid_entry = cd9660_boot_setup_validation_entry(system); if (valid_entry == NULL) return -1;
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sat Nov 14 23:03:09 UTC 2020 Modified Files: src/usr.bin/make: main.c src/usr.bin/make/unit-tests: varmod-to-abs.exp varmod-to-abs.mk Log Message: make(1): switch cache for realpath from GNode to HashTable An unintended side effect from the GNode implementation was that the variable modifier :tA and the other places where cached_realpath are used could be affected by setting a variable in the global scope, thereby "redirecting" absolute paths to completely unrelated but existing paths. Another unintended side effect was that filenames containing a dollar sign would not be resolved correctly since the dollar sign would be expanded as a variable expression by Var_Set. While here, the debugging output for the realpath cache has been adjusted to the standard behavior. Previously, when a new entry was added to the cache, this was logged for the module VAR, as a side effect of calling Var_Set, but only if the preprocessor macro DEBUG_REALPATH_CACHE was defined at compilation time. When relative paths were purged from the cache because the current directory changed and logging for the DIR module was active, the log output went directly to stderr instead of the usual opts.debug_file. This deviation from the standard behavior was probably not intended as well. All logging concerning the realpath cache now goes into the standard debug log file and is controlled by the -dd option, not -dv. To generate a diff of this commit: cvs rdiff -u -r1.468 -r1.469 src/usr.bin/make/main.c cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/varmod-to-abs.exp cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/varmod-to-abs.mk 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/make/main.c diff -u src/usr.bin/make/main.c:1.468 src/usr.bin/make/main.c:1.469 --- src/usr.bin/make/main.c:1.468 Sat Nov 14 22:19:13 2020 +++ src/usr.bin/make/main.c Sat Nov 14 23:03:08 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.468 2020/11/14 22:19:13 rillig Exp $ */ +/* $NetBSD: main.c,v 1.469 2020/11/14 23:03:08 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -109,7 +109,7 @@ #include "trace.h" /* "@(#)main.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: main.c,v 1.468 2020/11/14 22:19:13 rillig Exp $"); +MAKE_RCSID("$NetBSD: main.c,v 1.469 2020/11/14 23:03:08 rillig Exp $"); #if defined(MAKE_NATIVE) && !defined(lint) __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 " "The Regents of the University of California. " @@ -135,7 +135,7 @@ Boolean doing_depend; /* Set while read static Boolean jobsRunning; /* TRUE if the jobs might be running */ static const char *tracefile; static int ReadMakefile(const char *); -static void purge_cached_realpaths(void); +static void purge_relative_cached_realpaths(void); static Boolean ignorePWD; /* if we use -C, PWD is meaningless */ static char objdir[MAXPATHLEN + 1]; /* where we chdir'ed to */ @@ -147,6 +147,7 @@ int makelevel; Boolean forceJobs = FALSE; static int errors = 0; +static HashTable cached_realpaths; /* * For compatibility with the POSIX version of MAKEFLAGS that includes @@ -737,7 +738,7 @@ Main_SetObjdir(Boolean writable, const c Var_Set(".OBJDIR", objdir, VAR_GLOBAL); setenv("PWD", objdir, 1); Dir_InitDot(); - purge_cached_realpaths(); + purge_relative_cached_realpaths(); rc = TRUE; if (opts.enterFlag && strcmp(objdir, curdir) != 0) enterFlagObj = TRUE; @@ -1341,6 +1342,8 @@ main_Init(int argc, char **argv) /* default to writing debug to stderr */ opts.debug_file = stderr; + HashTable_Init(&cached_realpaths); + #ifdef SIGINFO (void)bmake_signal(SIGINFO, siginfo); #endif @@ -2006,42 +2009,22 @@ execDie(const char *af, const char *av) _exit(1); } -/* - * realpath(3) can get expensive, cache results... - */ -static GNode *cached_realpaths = NULL; - -static GNode * -get_cached_realpaths(void) -{ - - if (cached_realpaths == NULL) { - cached_realpaths = Targ_NewGN("Realpath"); -#ifndef DEBUG_REALPATH_CACHE - cached_realpaths->flags = INTERNAL; -#endif - } - - return cached_realpaths; -} - /* purge any relative paths */ static void -purge_cached_realpaths(void) +purge_relative_cached_realpaths(void) { - GNode *cache = get_cached_realpaths(); HashEntry *he, *nhe; HashIter hi; - HashIter_Init(&hi, &cache->context); + HashIter_Init(&hi, &cached_realpaths); he = HashIter_Next(&hi); while (he != NULL) { nhe = HashIter_Next(&hi); if (he->key[0] != '/') { - if (DEBUG(DIR)) -fprintf(stderr, "cached_realpath: purging %s\n", -he->key); - HashTable_DeleteEntry(&cache->context, he); + DEBUG1(DIR, "cached_realpath: purging %s\n", he->key); + HashTable_DeleteEntry(&cached_realpaths, he); + /* XXX: What about the allocated he->value? Either + * free them or document why they cannot be freed. */ }
CVS commit: src/usr.bin/make/unit-tests
Module Name:src Committed By: rillig Date: Sat Nov 14 22:39:14 UTC 2020 Modified Files: src/usr.bin/make/unit-tests: opt-chdir.exp opt-chdir.mk Log Message: make(1): add tests for the command line option -C To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/usr.bin/make/unit-tests/opt-chdir.exp cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/opt-chdir.mk 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/make/unit-tests/opt-chdir.exp diff -u src/usr.bin/make/unit-tests/opt-chdir.exp:1.1 src/usr.bin/make/unit-tests/opt-chdir.exp:1.2 --- src/usr.bin/make/unit-tests/opt-chdir.exp:1.1 Sun Aug 16 12:07:51 2020 +++ src/usr.bin/make/unit-tests/opt-chdir.exp Sat Nov 14 22:39:14 2020 @@ -1 +1,6 @@ +make: chdir /././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././ ././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././. /././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././ ././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././. /./././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././.
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sat Nov 14 22:19:13 UTC 2020 Modified Files: src/usr.bin/make: main.c make.1 src/usr.bin/make/unit-tests: opt.exp Log Message: make(1): document the -S option This option has been available at least since 1993-03-21, and for the same time it has been undocumented. To generate a diff of this commit: cvs rdiff -u -r1.467 -r1.468 src/usr.bin/make/main.c cvs rdiff -u -r1.291 -r1.292 src/usr.bin/make/make.1 cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/opt.exp 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/make/main.c diff -u src/usr.bin/make/main.c:1.467 src/usr.bin/make/main.c:1.468 --- src/usr.bin/make/main.c:1.467 Sat Nov 14 22:16:17 2020 +++ src/usr.bin/make/main.c Sat Nov 14 22:19:13 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.467 2020/11/14 22:16:17 rillig Exp $ */ +/* $NetBSD: main.c,v 1.468 2020/11/14 22:19:13 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -109,7 +109,7 @@ #include "trace.h" /* "@(#)main.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: main.c,v 1.467 2020/11/14 22:16:17 rillig Exp $"); +MAKE_RCSID("$NetBSD: main.c,v 1.468 2020/11/14 22:19:13 rillig Exp $"); #if defined(MAKE_NATIVE) && !defined(lint) __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 " "The Regents of the University of California. " @@ -190,7 +190,7 @@ usage(void) size_t prognameLen = strcspn(progname, "["); (void)fprintf(stderr, -"usage: %.*s [-BeikNnqrstWwX]\n" +"usage: %.*s [-BeikNnqrSstWwX]\n" "[-C directory] [-D variable] [-d flags] [-f makefile]\n" "[-I directory] [-J private] [-j max_jobs] [-m directory] [-T file]\n" "[-V variable] [-v variable] [variable=value] [target ...]\n", Index: src/usr.bin/make/make.1 diff -u src/usr.bin/make/make.1:1.291 src/usr.bin/make/make.1:1.292 --- src/usr.bin/make/make.1:1.291 Thu Nov 12 23:35:21 2020 +++ src/usr.bin/make/make.1 Sat Nov 14 22:19:13 2020 @@ -1,4 +1,4 @@ -.\" $NetBSD: make.1,v 1.291 2020/11/12 23:35:21 sjg Exp $ +.\" $NetBSD: make.1,v 1.292 2020/11/14 22:19:13 rillig Exp $ .\" .\" Copyright (c) 1990, 1993 .\" The Regents of the University of California. All rights reserved. @@ -29,7 +29,7 @@ .\" .\" from: @(#)make.1 8.4 (Berkeley) 3/19/94 .\" -.Dd November 12, 2020 +.Dd November 14, 2020 .Dt MAKE 1 .Os .Sh NAME @@ -37,7 +37,7 @@ .Nd maintain program dependencies .Sh SYNOPSIS .Nm -.Op Fl BeikNnqrstWwX +.Op Fl BeikNnqrSstWwX .Op Fl C Ar directory .Op Fl D Ar variable .Op Fl d Ar flags @@ -329,6 +329,10 @@ Do not execute any commands, but exit 0 up-to-date and 1, otherwise. .It Fl r Do not use the built-in rules specified in the system makefile. +.It Fl S +Stop processing if an error is encountered. +This is the default behavior and the opposite of +.Fl k . .It Fl s Do not echo any commands as they are executed. Equivalent to specifying Index: src/usr.bin/make/unit-tests/opt.exp diff -u src/usr.bin/make/unit-tests/opt.exp:1.3 src/usr.bin/make/unit-tests/opt.exp:1.4 --- src/usr.bin/make/unit-tests/opt.exp:1.3 Sat Nov 14 22:16:17 2020 +++ src/usr.bin/make/unit-tests/opt.exp Sat Nov 14 22:19:13 2020 @@ -1,5 +1,5 @@ make -: -usage: make [-BeikNnqrstWwX] +usage: make [-BeikNnqrSstWwX] [-C directory] [-D variable] [-d flags] [-f makefile] [-I directory] [-J private] [-j max_jobs] [-m directory] [-T file] [-V variable] [-v variable] [variable=value] [target ...] @@ -10,7 +10,7 @@ make: don't know how to make -f (continu `/dev/null' is up to date. make -? -usage: make [-BeikNnqrstWwX] +usage: make [-BeikNnqrSstWwX] [-C directory] [-D variable] [-d flags] [-f makefile] [-I directory] [-J private] [-j max_jobs] [-m directory] [-T file] [-V variable] [-v variable] [variable=value] [target ...]
CVS commit: src/usr.bin/make/unit-tests
Module Name:src Committed By: rillig Date: Sat Nov 14 22:17:29 UTC 2020 Modified Files: src/usr.bin/make/unit-tests: opt-chdir.mk Log Message: make(1): document since when the -C option is available To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/opt-chdir.mk 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/make/unit-tests/opt-chdir.mk diff -u src/usr.bin/make/unit-tests/opt-chdir.mk:1.2 src/usr.bin/make/unit-tests/opt-chdir.mk:1.3 --- src/usr.bin/make/unit-tests/opt-chdir.mk:1.2 Sun Aug 16 14:25:16 2020 +++ src/usr.bin/make/unit-tests/opt-chdir.mk Sat Nov 14 22:17:29 2020 @@ -1,6 +1,9 @@ -# $NetBSD: opt-chdir.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $ +# $NetBSD: opt-chdir.mk,v 1.3 2020/11/14 22:17:29 rillig Exp $ # -# Tests for the -C command line option. +# Tests for the -C command line option, which changes the directory at the +# beginning. +# +# This option is available since 2009-08-27. # TODO: Implementation
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sat Nov 14 22:16:18 UTC 2020 Modified Files: src/usr.bin/make: main.c src/usr.bin/make/unit-tests: opt.exp Log Message: make(1): fix trailing whitespace in usage (since 2009-08-27) To generate a diff of this commit: cvs rdiff -u -r1.466 -r1.467 src/usr.bin/make/main.c cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/opt.exp 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/make/main.c diff -u src/usr.bin/make/main.c:1.466 src/usr.bin/make/main.c:1.467 --- src/usr.bin/make/main.c:1.466 Sat Nov 14 21:55:22 2020 +++ src/usr.bin/make/main.c Sat Nov 14 22:16:17 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.466 2020/11/14 21:55:22 rillig Exp $ */ +/* $NetBSD: main.c,v 1.467 2020/11/14 22:16:17 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -109,7 +109,7 @@ #include "trace.h" /* "@(#)main.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: main.c,v 1.466 2020/11/14 21:55:22 rillig Exp $"); +MAKE_RCSID("$NetBSD: main.c,v 1.467 2020/11/14 22:16:17 rillig Exp $"); #if defined(MAKE_NATIVE) && !defined(lint) __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 " "The Regents of the University of California. " @@ -190,7 +190,7 @@ usage(void) size_t prognameLen = strcspn(progname, "["); (void)fprintf(stderr, -"usage: %.*s [-BeikNnqrstWwX] \n" +"usage: %.*s [-BeikNnqrstWwX]\n" "[-C directory] [-D variable] [-d flags] [-f makefile]\n" "[-I directory] [-J private] [-j max_jobs] [-m directory] [-T file]\n" "[-V variable] [-v variable] [variable=value] [target ...]\n", Index: src/usr.bin/make/unit-tests/opt.exp diff -u src/usr.bin/make/unit-tests/opt.exp:1.2 src/usr.bin/make/unit-tests/opt.exp:1.3 --- src/usr.bin/make/unit-tests/opt.exp:1.2 Sat Nov 14 17:33:51 2020 +++ src/usr.bin/make/unit-tests/opt.exp Sat Nov 14 22:16:17 2020 @@ -1,5 +1,5 @@ make -: -usage: make [-BeikNnqrstWwX] +usage: make [-BeikNnqrstWwX] [-C directory] [-D variable] [-d flags] [-f makefile] [-I directory] [-J private] [-j max_jobs] [-m directory] [-T file] [-V variable] [-v variable] [variable=value] [target ...] @@ -10,7 +10,7 @@ make: don't know how to make -f (continu `/dev/null' is up to date. make -? -usage: make [-BeikNnqrstWwX] +usage: make [-BeikNnqrstWwX] [-C directory] [-D variable] [-d flags] [-f makefile] [-I directory] [-J private] [-j max_jobs] [-m directory] [-T file] [-V variable] [-v variable] [variable=value] [target ...]
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sat Nov 14 21:55:22 UTC 2020 Modified Files: src/usr.bin/make: main.c Log Message: make(1): don't modify progname in usage To generate a diff of this commit: cvs rdiff -u -r1.465 -r1.466 src/usr.bin/make/main.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.bin/make/main.c diff -u src/usr.bin/make/main.c:1.465 src/usr.bin/make/main.c:1.466 --- src/usr.bin/make/main.c:1.465 Sat Nov 14 18:36:27 2020 +++ src/usr.bin/make/main.c Sat Nov 14 21:55:22 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.465 2020/11/14 18:36:27 rillig Exp $ */ +/* $NetBSD: main.c,v 1.466 2020/11/14 21:55:22 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -109,7 +109,7 @@ #include "trace.h" /* "@(#)main.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: main.c,v 1.465 2020/11/14 18:36:27 rillig Exp $"); +MAKE_RCSID("$NetBSD: main.c,v 1.466 2020/11/14 21:55:22 rillig Exp $"); #if defined(MAKE_NATIVE) && !defined(lint) __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 " "The Regents of the University of California. " @@ -187,16 +187,14 @@ explode(const char *flags) MAKE_ATTR_DEAD static void usage(void) { - char *p; - if ((p = strchr(progname, '[')) != NULL) - *p = '\0'; + size_t prognameLen = strcspn(progname, "["); (void)fprintf(stderr, -"usage: %s [-BeikNnqrstWwX] \n" +"usage: %.*s [-BeikNnqrstWwX] \n" "[-C directory] [-D variable] [-d flags] [-f makefile]\n" "[-I directory] [-J private] [-j max_jobs] [-m directory] [-T file]\n" "[-V variable] [-v variable] [variable=value] [target ...]\n", - progname); + (int)prognameLen, progname); exit(2); }
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sat Nov 14 21:29:44 UTC 2020 Modified Files: src/usr.bin/make: arch.c dir.c hash.c hash.h var.c Log Message: make(1): replace a few HashTable_CreateEntry with HashTable_Set Instead of HashTable_CreateEntry and HashEntry_Set, several places just need the HashEntry for storing a value in it. This makes the calling code simpler to understand. These parts of the code are already hard enough to understand since they are about memory management and aliasing. Having a too detailed API for the HashTable only distracts from these topics. To generate a diff of this commit: cvs rdiff -u -r1.176 -r1.177 src/usr.bin/make/arch.c cvs rdiff -u -r1.209 -r1.210 src/usr.bin/make/dir.c cvs rdiff -u -r1.56 -r1.57 src/usr.bin/make/hash.c cvs rdiff -u -r1.32 -r1.33 src/usr.bin/make/hash.h cvs rdiff -u -r1.684 -r1.685 src/usr.bin/make/var.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.bin/make/arch.c diff -u src/usr.bin/make/arch.c:1.176 src/usr.bin/make/arch.c:1.177 --- src/usr.bin/make/arch.c:1.176 Sat Nov 14 06:10:28 2020 +++ src/usr.bin/make/arch.c Sat Nov 14 21:29:44 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: arch.c,v 1.176 2020/11/14 06:10:28 rillig Exp $ */ +/* $NetBSD: arch.c,v 1.177 2020/11/14 21:29:44 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -125,7 +125,7 @@ #include "config.h" /* "@(#)arch.c 8.2 (Berkeley) 1/2/94" */ -MAKE_RCSID("$NetBSD: arch.c,v 1.176 2020/11/14 06:10:28 rillig Exp $"); +MAKE_RCSID("$NetBSD: arch.c,v 1.177 2020/11/14 21:29:44 rillig Exp $"); typedef struct List ArchList; typedef struct ListNode ArchListNode; @@ -557,10 +557,9 @@ ArchStatMember(const char *archive, cons #endif { - HashEntry *he; - he = HashTable_CreateEntry(&ar->members, memName, NULL); - HashEntry_Set(he, bmake_malloc(sizeof arh)); - memcpy(HashEntry_Get(he), &arh, sizeof arh); + struct ar_hdr *cached_hdr = bmake_malloc(sizeof *cached_hdr); + memcpy(cached_hdr, &arh, sizeof arh); + HashTable_Set(&ar->members, memName, cached_hdr); } if (fseek(arch, ((long)size + 1) & ~1, SEEK_CUR) != 0) Index: src/usr.bin/make/dir.c diff -u src/usr.bin/make/dir.c:1.209 src/usr.bin/make/dir.c:1.210 --- src/usr.bin/make/dir.c:1.209 Sat Nov 14 19:36:31 2020 +++ src/usr.bin/make/dir.c Sat Nov 14 21:29:44 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: dir.c,v 1.209 2020/11/14 19:36:31 rillig Exp $ */ +/* $NetBSD: dir.c,v 1.210 2020/11/14 21:29:44 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -134,7 +134,7 @@ #include "job.h" /* "@(#)dir.c 8.2 (Berkeley) 1/2/94" */ -MAKE_RCSID("$NetBSD: dir.c,v 1.209 2020/11/14 19:36:31 rillig Exp $"); +MAKE_RCSID("$NetBSD: dir.c,v 1.210 2020/11/14 21:29:44 rillig Exp $"); #define DIR_DEBUG0(text) DEBUG0(DIR, text) #define DIR_DEBUG1(fmt, arg1) DEBUG1(DIR, fmt, arg1) @@ -253,12 +253,10 @@ OpenDirs_Find(OpenDirs *odirs, const cha static void OpenDirs_Add(OpenDirs *odirs, CachedDir *cdir) { -HashEntry *he = HashTable_FindEntry(&odirs->table, cdir->name); -if (he != NULL) +if (HashTable_FindEntry(&odirs->table, cdir->name) != NULL) return; -he = HashTable_CreateEntry(&odirs->table, cdir->name, NULL); Lst_Append(odirs->list, cdir); -HashEntry_Set(he, odirs->list->last); +HashTable_Set(&odirs->table, cdir->name, odirs->list->last); } static void @@ -313,7 +311,6 @@ cached_stats(const char *pathname, struc CachedStatsFlags flags) { HashTable *tbl = flags & CST_LSTAT ? &lmtimes : &mtimes; -HashEntry *entry; struct stat sys_st; struct cached_stat *cst; int rc; @@ -321,11 +318,8 @@ cached_stats(const char *pathname, struc if (pathname == NULL || pathname[0] == '\0') return -1; /* This can happen in meta mode. */ -entry = HashTable_FindEntry(tbl, pathname); - -if (entry != NULL && !(flags & CST_UPDATE)) { - cst = HashEntry_Get(entry); - +cst = HashTable_FindValue(tbl, pathname); +if (cst != NULL && !(flags & CST_UPDATE)) { *out_cst = *cst; DIR_DEBUG2("Using cached time %s for %s\n", Targ_FmtTime(cst->cst_mtime), pathname); @@ -339,13 +333,9 @@ cached_stats(const char *pathname, struc if (sys_st.st_mtime == 0) sys_st.st_mtime = 1; /* avoid confusion with missing file */ -if (entry != NULL) - cst = entry->value; -else { - entry = HashTable_CreateEntry(tbl, pathname, NULL); +if (cst == NULL) { cst = bmake_malloc(sizeof *cst); - memset(cst, 0, sizeof *cst); - HashEntry_Set(entry, cst); + HashTable_Set(tbl, pathname, cst); } cst->cst_mtime = sys_st.st_mtime; Index: src/usr.bin/make/hash.c diff -u src/usr.bin/make/hash.c:1.56 src/usr.bin/make/hash.c:1.57 --- src/usr.bin/make/hash.c:1.56 Thu Nov 5 17:27:16 2020 +++ src/usr.bin/make/hash.c Sat Nov 14 21:29:44 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: hash.c,v 1.56 2020/1
CVS commit: src/external/gpl3/gcc/dist/gcc
Module Name:src Committed By: christos Date: Sat Nov 14 21:24:03 UTC 2020 Modified Files: src/external/gpl3/gcc/dist/gcc: file-prefix-map.c Log Message: PR/55802: Andreas Gustafsson: Unbreak reproducible builds. For reproducible builds to work we need to have a consistent command line (because the command line gets recorded in dwarf). So we can't do: -ffile-prefix-map=/joe/random/src=/usr/src because then /joe/random/src gets recorded. We do instead: -ffile-prefix-map=\$NETBSDSRCDIR=/usr/src The patch restores the environment variable parsing that got lost in the last 2 gcc upgrades. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/external/gpl3/gcc/dist/gcc/file-prefix-map.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/gpl3/gcc/dist/gcc/file-prefix-map.c diff -u src/external/gpl3/gcc/dist/gcc/file-prefix-map.c:1.4 src/external/gpl3/gcc/dist/gcc/file-prefix-map.c:1.5 --- src/external/gpl3/gcc/dist/gcc/file-prefix-map.c:1.4 Sat Sep 5 05:12:23 2020 +++ src/external/gpl3/gcc/dist/gcc/file-prefix-map.c Sat Nov 14 16:24:03 2020 @@ -40,7 +40,8 @@ static void add_prefix_map (file_prefix_map *&maps, const char *arg, const char *opt) { file_prefix_map *map; - const char *p; + const char *p, *old; + size_t oldlen; /* Note: looking for the last '='. The thinking is we can control the paths inside our projects but not where the users build them. */ @@ -50,9 +51,28 @@ add_prefix_map (file_prefix_map *&maps, error ("invalid argument %qs to %qs", arg, opt); return; } + if (*arg == '$') +{ + char *env = xstrndup (arg + 1, p - (arg + 1)); + old = getenv(env); + if (!old) + { + warning (0, "environment variable %qs not set in argument to " + "%s", env, opt); + free(env); + return; + } + oldlen = strlen(old); + free(env); +} + else +{ + old = xstrndup (arg, p - arg); + oldlen = p - arg; +} map = XNEW (file_prefix_map); - map->old_prefix = xstrndup (arg, p - arg); - map->old_len = p - arg; + map->old_prefix = old; + map->old_len = oldlen; p++; map->new_prefix = xstrdup (p); map->new_len = strlen (p);
CVS commit: src/usr.sbin/envstat
Module Name:src Committed By: wiz Date: Sat Nov 14 20:07:13 UTC 2020 Modified Files: src/usr.sbin/envstat: envstat.8 Log Message: New sentence, new line. Other whitespace fixes, and some Xr fixes. To generate a diff of this commit: cvs rdiff -u -r1.65 -r1.66 src/usr.sbin/envstat/envstat.8 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/envstat/envstat.8 diff -u src/usr.sbin/envstat/envstat.8:1.65 src/usr.sbin/envstat/envstat.8:1.66 --- src/usr.sbin/envstat/envstat.8:1.65 Sat Nov 14 16:32:53 2020 +++ src/usr.sbin/envstat/envstat.8 Sat Nov 14 20:07:13 2020 @@ -1,4 +1,4 @@ -.\" $NetBSD: envstat.8,v 1.65 2020/11/14 16:32:53 mlelstv Exp $ +.\" $NetBSD: envstat.8,v 1.66 2020/11/14 20:07:13 wiz Exp $ .\" .\" Copyright (c) 2000, 2007, 2008, 2009, 2014 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -27,7 +27,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.Dd May 18, 2014 +.Dd November 14, 2020 .Dt ENVSTAT 8 .Os .Sh NAME @@ -152,11 +152,14 @@ and sensors. If .Ar property is specified, the value of that property is printed. -The property list can be filtered with the -.Fl d or +The property list can be filtered with the +.Fl d +or .Fl s -options. If -.Fl s is used with only a single sensor, only the properties +options. +If +.Fl s +is used with only a single sensor, only the properties of this sensor are returned, not a list of sensors. .El .Sh UNITS @@ -235,7 +238,7 @@ To return values of temperature sensors .Sh SEE ALSO .Xr units 1 , .Xr proplib 3 , -.r acpiacad 4 , +.Xr acpiacad 4 , .Xr acpibat 4 , .Xr acpitz 4 , .Xr admtemp 4 , @@ -245,9 +248,7 @@ To return values of temperature sensors .Xr arcmsr 4 , .Xr battery_pmu 4 , .Xr cac 4 , -.Xr coretemp 4 , .Xr dbcool 4 , -.Xr envctrl 4 , .Xr envsys 4 , .Xr finsio 4 , .Xr hythygtemp 4 , @@ -258,13 +259,15 @@ To return values of temperature sensors .Xr mfi 4 , .Xr nsclpcsio 4 , .Xr owtemp 4 , -.Xr pic16lc 4 , +.\".Xr pic16lc 4 , .Xr smsc 4 , -.Xr tctrl 4 , +.Xr sparc/tctrl 4 , +.Xr sparc64/envctrl 4 , .Xr thinkpad 4 , .Xr tm121temp 4 , .Xr ug 4 , .Xr viaenv 4 , +.Xr x86/coretemp 4 , .Xr envsys.conf 5 .Sh HISTORY .Nm
CVS commit: src/share/man/man4/man4.x86
Module Name:src Committed By: wiz Date: Sat Nov 14 20:04:46 UTC 2020 Modified Files: src/share/man/man4/man4.x86: coretemp.4 est.4 imcsmb.4 odcm.4 powernow.4 Log Message: Add "x86" to Dt To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/share/man/man4/man4.x86/coretemp.4 \ src/share/man/man4/man4.x86/powernow.4 cvs rdiff -u -r1.6 -r1.7 src/share/man/man4/man4.x86/est.4 cvs rdiff -u -r1.9 -r1.10 src/share/man/man4/man4.x86/imcsmb.4 cvs rdiff -u -r1.5 -r1.6 src/share/man/man4/man4.x86/odcm.4 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/share/man/man4/man4.x86/coretemp.4 diff -u src/share/man/man4/man4.x86/coretemp.4:1.4 src/share/man/man4/man4.x86/coretemp.4:1.5 --- src/share/man/man4/man4.x86/coretemp.4:1.4 Tue Mar 18 18:20:40 2014 +++ src/share/man/man4/man4.x86/coretemp.4 Sat Nov 14 20:04:46 2020 @@ -1,4 +1,4 @@ -.\" $NetBSD: coretemp.4,v 1.4 2014/03/18 18:20:40 riastradh Exp $ +.\" $NetBSD: coretemp.4,v 1.5 2020/11/14 20:04:46 wiz Exp $ .\"- .\" Copyright (c) 2007 Juan Romero Pardines. .\" Copyright (c) 2007 Dag-Erling Coïdan Smørgrav @@ -28,7 +28,7 @@ .\" $FreeBSD: src/share/man/man4/coretemp.4,v 1.4 2007/10/15 20:00:19 netchild Exp $ .\" .Dd February 23, 2010 -.Dt CORETEMP 4 +.Dt CORETEMP 4 x86 .Os .Sh NAME .Nm coretemp Index: src/share/man/man4/man4.x86/powernow.4 diff -u src/share/man/man4/man4.x86/powernow.4:1.4 src/share/man/man4/man4.x86/powernow.4:1.5 --- src/share/man/man4/man4.x86/powernow.4:1.4 Sun Oct 25 16:39:00 2020 +++ src/share/man/man4/man4.x86/powernow.4 Sat Nov 14 20:04:46 2020 @@ -1,4 +1,4 @@ -.\" $NetBSD: powernow.4,v 1.4 2020/10/25 16:39:00 nia Exp $ +.\" $NetBSD: powernow.4,v 1.5 2020/11/14 20:04:46 wiz Exp $ .\" .\" Copyright (c) 2011 Jukka Ruohonen .\" All rights reserved. @@ -25,7 +25,7 @@ .\" POSSIBILITY OF SUCH DAMAGE. .\" .Dd September 7, 2020 -.Dt POWERNOW 4 +.Dt POWERNOW 4 x86 .Os .Sh NAME .Nm powernow Index: src/share/man/man4/man4.x86/est.4 diff -u src/share/man/man4/man4.x86/est.4:1.6 src/share/man/man4/man4.x86/est.4:1.7 --- src/share/man/man4/man4.x86/est.4:1.6 Sun Oct 25 16:39:00 2020 +++ src/share/man/man4/man4.x86/est.4 Sat Nov 14 20:04:46 2020 @@ -1,4 +1,4 @@ -.\" $NetBSD: est.4,v 1.6 2020/10/25 16:39:00 nia Exp $ +.\" $NetBSD: est.4,v 1.7 2020/11/14 20:04:46 wiz Exp $ .\" .\" Copyright (c) 2011 Jukka Ruohonen .\" All rights reserved. @@ -25,7 +25,7 @@ .\" POSSIBILITY OF SUCH DAMAGE. .\" .Dd September 7, 2020 -.Dt EST 4 +.Dt EST 4 x86 .Os .Sh NAME .Nm est Index: src/share/man/man4/man4.x86/imcsmb.4 diff -u src/share/man/man4/man4.x86/imcsmb.4:1.9 src/share/man/man4/man4.x86/imcsmb.4:1.10 --- src/share/man/man4/man4.x86/imcsmb.4:1.9 Thu Apr 16 18:56:04 2020 +++ src/share/man/man4/man4.x86/imcsmb.4 Sat Nov 14 20:04:46 2020 @@ -1,4 +1,4 @@ -.\" $NetBSD: imcsmb.4,v 1.9 2020/04/16 18:56:04 pgoyette Exp $ +.\" $NetBSD: imcsmb.4,v 1.10 2020/11/14 20:04:46 wiz Exp $ .\" .\" Copyright (c) 2018 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -55,7 +55,7 @@ .\" $FreeBSD$ .\" .Dd April 16, 2020 -.Dt IMCSMB 4 +.Dt IMCSMB 4 x86 .Os .Sh NAME .Nm imcsmb Index: src/share/man/man4/man4.x86/odcm.4 diff -u src/share/man/man4/man4.x86/odcm.4:1.5 src/share/man/man4/man4.x86/odcm.4:1.6 --- src/share/man/man4/man4.x86/odcm.4:1.5 Fri Feb 17 22:10:47 2017 +++ src/share/man/man4/man4.x86/odcm.4 Sat Nov 14 20:04:46 2020 @@ -1,4 +1,4 @@ -.\" $NetBSD: odcm.4,v 1.5 2017/02/17 22:10:47 christos Exp $ +.\" $NetBSD: odcm.4,v 1.6 2020/11/14 20:04:46 wiz Exp $ .\" .\" Copyright (c) 2011 Jukka Ruohonen .\" All rights reserved. @@ -25,7 +25,7 @@ .\" POSSIBILITY OF SUCH DAMAGE. .\" .Dd February 17, 2017 -.Dt ODCM 4 +.Dt ODCM 4 x86 .Os .Sh NAME .Nm odcm
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sat Nov 14 19:36:31 UTC 2020 Modified Files: src/usr.bin/make: dir.c Log Message: make(1): inline local variable in Dir_UpdateMTime Now that the signature of cached_stats is cleaned up, the line is short enough to contain the whole condition. To generate a diff of this commit: cvs rdiff -u -r1.208 -r1.209 src/usr.bin/make/dir.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.bin/make/dir.c diff -u src/usr.bin/make/dir.c:1.208 src/usr.bin/make/dir.c:1.209 --- src/usr.bin/make/dir.c:1.208 Sat Nov 14 19:24:24 2020 +++ src/usr.bin/make/dir.c Sat Nov 14 19:36:31 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: dir.c,v 1.208 2020/11/14 19:24:24 rillig Exp $ */ +/* $NetBSD: dir.c,v 1.209 2020/11/14 19:36:31 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -134,7 +134,7 @@ #include "job.h" /* "@(#)dir.c 8.2 (Berkeley) 1/2/94" */ -MAKE_RCSID("$NetBSD: dir.c,v 1.208 2020/11/14 19:24:24 rillig Exp $"); +MAKE_RCSID("$NetBSD: dir.c,v 1.209 2020/11/14 19:36:31 rillig Exp $"); #define DIR_DEBUG0(text) DEBUG0(DIR, text) #define DIR_DEBUG1(fmt, arg1) DEBUG1(DIR, fmt, arg1) @@ -1279,7 +1279,6 @@ Dir_UpdateMTime(GNode *gn, Boolean reche { char *fullName; struct cached_stat cst; -CachedStatsFlags flags; if (gn->type & OP_ARCHV) { Arch_UpdateMTime(gn); @@ -1334,8 +1333,7 @@ Dir_UpdateMTime(GNode *gn, Boolean reche if (fullName == NULL) fullName = bmake_strdup(gn->name); -flags = recheck ? CST_UPDATE : CST_NONE; -if (cached_stats(fullName, &cst, flags) < 0) { +if (cached_stats(fullName, &cst, recheck ? CST_UPDATE : CST_NONE) < 0) { if (gn->type & OP_MEMBER) { if (fullName != gn->path) free(fullName);
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sat Nov 14 19:24:24 UTC 2020 Modified Files: src/usr.bin/make: dir.c dir.h meta.c Log Message: make(1): remove redundant struct make_stat In the cache for stat(2) and lstat(2), only one of the two timestamps was ever used. To prevent a result from stat(2) leaking into the cache for lstat(2), there have been two completely separate caches all the time. Using different fields in the struct was therefore unnecessary. By removing the redundant field, the internal struct in the cache is the same as the external struct. This makes one of them redundant, thus struct make_stat has been renamed to cached_stat, which better describes its purpose, and the internal struct cache_st has been removed. Just as before, the cache prevents any direct access to its internal data. When passing it to the caller, it is copied. Just as before, the field names of struct cached_stat cannot correspond to those from struct stat, since the latter are often defined as macros. Therefore they are prefixed with cst instead of st. The redundancy had been added on 2020-06-05. To generate a diff of this commit: cvs rdiff -u -r1.207 -r1.208 src/usr.bin/make/dir.c cvs rdiff -u -r1.33 -r1.34 src/usr.bin/make/dir.h cvs rdiff -u -r1.142 -r1.143 src/usr.bin/make/meta.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.bin/make/dir.c diff -u src/usr.bin/make/dir.c:1.207 src/usr.bin/make/dir.c:1.208 --- src/usr.bin/make/dir.c:1.207 Sat Nov 14 11:51:58 2020 +++ src/usr.bin/make/dir.c Sat Nov 14 19:24:24 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: dir.c,v 1.207 2020/11/14 11:51:58 rillig Exp $ */ +/* $NetBSD: dir.c,v 1.208 2020/11/14 19:24:24 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -134,7 +134,7 @@ #include "job.h" /* "@(#)dir.c 8.2 (Berkeley) 1/2/94" */ -MAKE_RCSID("$NetBSD: dir.c,v 1.207 2020/11/14 11:51:58 rillig Exp $"); +MAKE_RCSID("$NetBSD: dir.c,v 1.208 2020/11/14 19:24:24 rillig Exp $"); #define DIR_DEBUG0(text) DEBUG0(DIR, text) #define DIR_DEBUG1(fmt, arg1) DEBUG1(DIR, fmt, arg1) @@ -300,31 +300,22 @@ static HashTable mtimes; static HashTable lmtimes; /* same as mtimes but for lstat */ -/* - * We use stat(2) a lot, cache the results. - * mtime and mode are all we care about. - */ -struct cache_st { -time_t lmtime; /* lstat; XXX: is probably redundant */ -time_t mtime; /* stat */ -mode_t mode; -}; - typedef enum CachedStatsFlags { CST_NONE = 0, CST_LSTAT = 1 << 0, /* call lstat(2) instead of stat(2) */ CST_UPDATE = 1 << 1 /* ignore existing cached entry */ } CachedStatsFlags; -/* Returns 0 and the result of stat(2) or lstat(2) in *mst, or -1 on error. */ +/* Returns 0 and the result of stat(2) or lstat(2) in *out_cst, + * or -1 on error. */ static int -cached_stats(const char *pathname, struct make_stat *mst, +cached_stats(const char *pathname, struct cached_stat *out_cst, CachedStatsFlags flags) { HashTable *tbl = flags & CST_LSTAT ? &lmtimes : &mtimes; HashEntry *entry; struct stat sys_st; -struct cache_st *cst; +struct cached_stat *cst; int rc; if (pathname == NULL || pathname[0] == '\0') @@ -335,31 +326,19 @@ cached_stats(const char *pathname, struc if (entry != NULL && !(flags & CST_UPDATE)) { cst = HashEntry_Get(entry); - mst->mst_mode = cst->mode; - mst->mst_mtime = (flags & CST_LSTAT) ? cst->lmtime : cst->mtime; - /* XXX: Checking for mst_mtime != 0 is probably redundant since - * nonexistent files are not cached. */ - if (mst->mst_mtime != 0) { - DIR_DEBUG2("Using cached time %s for %s\n", - Targ_FmtTime(mst->mst_mtime), pathname); - return 0; - } - /* Continue with the normal lookup to see whether the file has been - * created in the meantime. */ -} - -rc = (flags & CST_LSTAT) - ? lstat(pathname, &sys_st) - : stat(pathname, &sys_st); + *out_cst = *cst; + DIR_DEBUG2("Using cached time %s for %s\n", + Targ_FmtTime(cst->cst_mtime), pathname); + return 0; +} + +rc = (flags & CST_LSTAT ? lstat : stat)(pathname, &sys_st); if (rc == -1) - return -1; + return -1; /* don't cache negative lookups */ if (sys_st.st_mtime == 0) sys_st.st_mtime = 1; /* avoid confusion with missing file */ -mst->mst_mode = sys_st.st_mode; -mst->mst_mtime = sys_st.st_mtime; - if (entry != NULL) cst = entry->value; else { @@ -368,12 +347,11 @@ cached_stats(const char *pathname, struc memset(cst, 0, sizeof *cst); HashEntry_Set(entry, cst); } -if (flags & CST_LSTAT) { - cst->lmtime = sys_st.st_mtime; -} else { - cst->mtime = sys_st.st_mtime; -} -cst->mode = sys_st.st_mode; + +cst->cst_mtime = sys_st.st_mtime; +cst->cst_mode = sys_st.st_mode; + +*out_cst = *cst; DIR_DEBUG2(" Caching %s for %s\n", Targ_FmtTime(sys_st.st
CVS commit: src/usr.bin/make/unit-tests
Module Name:src Committed By: rillig Date: Sat Nov 14 18:47:21 UTC 2020 Modified Files: src/usr.bin/make/unit-tests: varmod-to-abs.exp varmod-to-abs.mk Log Message: make(1): add test for undocumented path-to-abspath mapping for :tA To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/usr.bin/make/unit-tests/varmod-to-abs.exp cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/varmod-to-abs.mk 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/make/unit-tests/varmod-to-abs.exp diff -u src/usr.bin/make/unit-tests/varmod-to-abs.exp:1.1 src/usr.bin/make/unit-tests/varmod-to-abs.exp:1.2 --- src/usr.bin/make/unit-tests/varmod-to-abs.exp:1.1 Sun Aug 16 12:07:51 2020 +++ src/usr.bin/make/unit-tests/varmod-to-abs.exp Sat Nov 14 18:47:21 2020 @@ -1 +1,2 @@ +make: "varmod-to-abs.mk" line 17: /dev/null exit status 0 Index: src/usr.bin/make/unit-tests/varmod-to-abs.mk diff -u src/usr.bin/make/unit-tests/varmod-to-abs.mk:1.2 src/usr.bin/make/unit-tests/varmod-to-abs.mk:1.3 --- src/usr.bin/make/unit-tests/varmod-to-abs.mk:1.2 Sun Aug 16 14:25:16 2020 +++ src/usr.bin/make/unit-tests/varmod-to-abs.mk Sat Nov 14 18:47:21 2020 @@ -1,9 +1,20 @@ -# $NetBSD: varmod-to-abs.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $ +# $NetBSD: varmod-to-abs.mk,v 1.3 2020/11/14 18:47:21 rillig Exp $ # # Tests for the :tA variable modifier, which returns the absolute path for # each of the words in the variable value. # TODO: Implementation +# Since 2016-06-03, it is possible to trick the :tA modifier into resolving +# completely unrelated absolute paths by defining a global variable that has +# the same name as the path that is to be resolved. There are a few +# restrictions though: The "redirected" path must start with a slash, and it +# must exist. (See ModifyWord_Realpath). +# +# XXX: This is probably not intended. It is caused by cached_realpath using +# a GNode for keeping the cache, instead of a simple HashTable. +does-not-exist.c= /dev/null +.info ${does-not-exist.c:L:tA} + all: @:;
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sat Nov 14 18:36:27 UTC 2020 Modified Files: src/usr.bin/make: main.c Log Message: make(1): clean up Fatal Use the shortest possible scope between va_start and the corresponding va_end. To generate a diff of this commit: cvs rdiff -u -r1.464 -r1.465 src/usr.bin/make/main.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.bin/make/main.c diff -u src/usr.bin/make/main.c:1.464 src/usr.bin/make/main.c:1.465 --- src/usr.bin/make/main.c:1.464 Sat Nov 14 18:14:34 2020 +++ src/usr.bin/make/main.c Sat Nov 14 18:36:27 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.464 2020/11/14 18:14:34 rillig Exp $ */ +/* $NetBSD: main.c,v 1.465 2020/11/14 18:36:27 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -109,7 +109,7 @@ #include "trace.h" /* "@(#)main.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: main.c,v 1.464 2020/11/14 18:14:34 rillig Exp $"); +MAKE_RCSID("$NetBSD: main.c,v 1.465 2020/11/14 18:36:27 rillig Exp $"); #if defined(MAKE_NATIVE) && !defined(lint) __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 " "The Regents of the University of California. " @@ -1596,12 +1596,12 @@ main_PrepareMaking(void) /* Make the targets. * If the -v or -V options are given, print variables instead. - * Return whether the targets are out-of-date. */ + * Return whether any of the targets is out-of-date. */ static Boolean main_Run(void) { - /* print the values of any variables requested by the user */ if (opts.printVars != PVM_NONE) { + /* print the values of any variables requested by the user */ doPrintVars(); return FALSE; } else { @@ -1877,19 +1877,21 @@ Error(const char *fmt, ...) errors++; } -/* Produce a Fatal error message, then exit immediately. +/* Wait for any running jobs to finish, then produce an error message, + * finally exit immediately. * - * If jobs are running, wait for them to finish. */ + * Exiting immediately differs from Parse_Error, which exits only after the + * current top-level makefile has been parsed completely. */ void Fatal(const char *fmt, ...) { va_list ap; - va_start(ap, fmt); if (jobsRunning) Job_Wait(); (void)fflush(stdout); + va_start(ap, fmt); (void)vfprintf(stderr, fmt, ap); va_end(ap); (void)fprintf(stderr, "\n");
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sat Nov 14 18:14:34 UTC 2020 Modified Files: src/usr.bin/make: main.c Log Message: make(1): clean up InitDefSysIncPath Flipping the arguments to strncmp puts the subject first in the sentence. Inverting the condition makes the code flow easier to follow. To generate a diff of this commit: cvs rdiff -u -r1.463 -r1.464 src/usr.bin/make/main.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.bin/make/main.c diff -u src/usr.bin/make/main.c:1.463 src/usr.bin/make/main.c:1.464 --- src/usr.bin/make/main.c:1.463 Sat Nov 14 18:07:26 2020 +++ src/usr.bin/make/main.c Sat Nov 14 18:14:34 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.463 2020/11/14 18:07:26 rillig Exp $ */ +/* $NetBSD: main.c,v 1.464 2020/11/14 18:14:34 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -109,7 +109,7 @@ #include "trace.h" /* "@(#)main.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: main.c,v 1.463 2020/11/14 18:07:26 rillig Exp $"); +MAKE_RCSID("$NetBSD: main.c,v 1.464 2020/11/14 18:14:34 rillig Exp $"); #if defined(MAKE_NATIVE) && !defined(lint) __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 " "The Regents of the University of California. " @@ -1189,14 +1189,14 @@ InitDefSysIncPath(char *syspath) *cp++ = '\0'; /* look for magic parent directory search string */ - if (strncmp(".../", start, 4) != 0) { - (void)Dir_AddDir(defSysIncPath, start); - } else { + if (strncmp(start, ".../", 4) == 0) { char *dir = Dir_FindHereOrAbove(curdir, start + 4); if (dir != NULL) { (void)Dir_AddDir(defSysIncPath, dir); free(dir); } + } else { + (void)Dir_AddDir(defSysIncPath, start); } }
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sat Nov 14 18:07:26 UTC 2020 Modified Files: src/usr.bin/make: main.c src/usr.bin/make/unit-tests: Makefile Log Message: make(1): use progname instead of hard-coded 'make' in warning This only affects the warning that chdir to objdir failed. In sub-makes the progname includes the [n], allowing to narrow down the actual cause of the problem. To generate a diff of this commit: cvs rdiff -u -r1.462 -r1.463 src/usr.bin/make/main.c cvs rdiff -u -r1.199 -r1.200 src/usr.bin/make/unit-tests/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.bin/make/main.c diff -u src/usr.bin/make/main.c:1.462 src/usr.bin/make/main.c:1.463 --- src/usr.bin/make/main.c:1.462 Sat Nov 14 17:39:59 2020 +++ src/usr.bin/make/main.c Sat Nov 14 18:07:26 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.462 2020/11/14 17:39:59 rillig Exp $ */ +/* $NetBSD: main.c,v 1.463 2020/11/14 18:07:26 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -109,7 +109,7 @@ #include "trace.h" /* "@(#)main.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: main.c,v 1.462 2020/11/14 17:39:59 rillig Exp $"); +MAKE_RCSID("$NetBSD: main.c,v 1.463 2020/11/14 18:07:26 rillig Exp $"); #if defined(MAKE_NATIVE) && !defined(lint) __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 " "The Regents of the University of California. " @@ -732,8 +732,8 @@ Main_SetObjdir(Boolean writable, const c if (stat(path, &sb) == 0 && S_ISDIR(sb.st_mode)) { if ((writable && access(path, W_OK) != 0) || (chdir(path) != 0)) { - (void)fprintf(stderr, "make warning: %s: %s.\n", - path, strerror(errno)); + (void)fprintf(stderr, "%s warning: %s: %s.\n", + progname, path, strerror(errno)); } else { snprintf(objdir, sizeof objdir, "%s", path); Var_Set(".OBJDIR", objdir, VAR_GLOBAL); Index: src/usr.bin/make/unit-tests/Makefile diff -u src/usr.bin/make/unit-tests/Makefile:1.199 src/usr.bin/make/unit-tests/Makefile:1.200 --- src/usr.bin/make/unit-tests/Makefile:1.199 Sat Nov 14 15:35:20 2020 +++ src/usr.bin/make/unit-tests/Makefile Sat Nov 14 18:07:26 2020 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.199 2020/11/14 15:35:20 rillig Exp $ +# $NetBSD: Makefile,v 1.200 2020/11/14 18:07:26 rillig Exp $ # # Unit tests for make(1) # @@ -507,6 +507,8 @@ MAKE_TEST_ENV?= MALLOC_OPTIONS="JA" # fo # always pretend .MAKE was called 'make' _SED_CMDS+= -e 's,^${TEST_MAKE:T:S,.,\\.,g}[][0-9]*:,make:,' _SED_CMDS+= -e 's,${TEST_MAKE:S,.,\\.,g},make,' +_SED_CMDS+= -e 's,${TEST_MAKE:T:S,.,\\.,g}[][0-9]* warning,make warning,' +_SED_CMDS+= -e 's,^usage: ${TEST_MAKE:T:S,.,\\.,g} ,usage: make ,' # replace anything after 'stopped in' with unit-tests _SED_CMDS+= -e '/stopped/s, /.*, unit-tests,' # strip ${.CURDIR}/ from the output
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sat Nov 14 17:39:59 UTC 2020 Modified Files: src/usr.bin/make: main.c make.h meta.c Log Message: make(1): remove redundant parameter from str2Lst_Append To generate a diff of this commit: cvs rdiff -u -r1.461 -r1.462 src/usr.bin/make/main.c cvs rdiff -u -r1.207 -r1.208 src/usr.bin/make/make.h cvs rdiff -u -r1.141 -r1.142 src/usr.bin/make/meta.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.bin/make/main.c diff -u src/usr.bin/make/main.c:1.461 src/usr.bin/make/main.c:1.462 --- src/usr.bin/make/main.c:1.461 Sat Nov 14 17:39:14 2020 +++ src/usr.bin/make/main.c Sat Nov 14 17:39:59 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.461 2020/11/14 17:39:14 rillig Exp $ */ +/* $NetBSD: main.c,v 1.462 2020/11/14 17:39:59 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -109,7 +109,7 @@ #include "trace.h" /* "@(#)main.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: main.c,v 1.461 2020/11/14 17:39:14 rillig Exp $"); +MAKE_RCSID("$NetBSD: main.c,v 1.462 2020/11/14 17:39:59 rillig Exp $"); #if defined(MAKE_NATIVE) && !defined(lint) __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 " "The Regents of the University of California. " @@ -778,14 +778,15 @@ SetVarObjdir(Boolean writable, const cha return TRUE; } +/* Splits str into words, adding them to the list. + * The string must be kept alive as long as the list. */ int -str2Lst_Append(StringList *lp, char *str, const char *sep) +str2Lst_Append(StringList *lp, char *str) { char *cp; int n; - if (sep == NULL) - sep = " \t"; + const char *sep = " \t"; for (n = 0, cp = strtok(str, sep); cp; cp = strtok(NULL, sep)) { Lst_Append(lp, cp); @@ -1318,7 +1319,7 @@ ReadFirstDefaultMakefile(void) * since these makefiles do not come from the command line. They * also have different semantics in that only the first file that * is found is processed. See ReadAllMakefiles. */ - (void)str2Lst_Append(opts.makefiles, prefs, NULL); + (void)str2Lst_Append(opts.makefiles, prefs); for (ln = opts.makefiles->first; ln != NULL; ln = ln->next) if (ReadMakefile(ln->datum) == 0) Index: src/usr.bin/make/make.h diff -u src/usr.bin/make/make.h:1.207 src/usr.bin/make/make.h:1.208 --- src/usr.bin/make/make.h:1.207 Sat Nov 14 15:58:01 2020 +++ src/usr.bin/make/make.h Sat Nov 14 17:39:59 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: make.h,v 1.207 2020/11/14 15:58:01 rillig Exp $ */ +/* $NetBSD: make.h,v 1.208 2020/11/14 17:39:59 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -654,7 +654,7 @@ void PrintOnError(GNode *, const char *) void Main_ExportMAKEFLAGS(Boolean); Boolean Main_SetObjdir(Boolean, const char *, ...) MAKE_ATTR_PRINTFLIKE(2, 3); int mkTempFile(const char *, char **); -int str2Lst_Append(StringList *, char *, const char *); +int str2Lst_Append(StringList *, char *); void GNode_FprintDetails(FILE *, const char *, const GNode *, const char *); Boolean GNode_ShouldExecute(GNode *gn); Index: src/usr.bin/make/meta.c diff -u src/usr.bin/make/meta.c:1.141 src/usr.bin/make/meta.c:1.142 --- src/usr.bin/make/meta.c:1.141 Sun Nov 8 15:07:37 2020 +++ src/usr.bin/make/meta.c Sat Nov 14 17:39:59 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: meta.c,v 1.141 2020/11/08 15:07:37 rillig Exp $ */ +/* $NetBSD: meta.c,v 1.142 2020/11/14 17:39:59 rillig Exp $ */ /* * Implement 'meta' mode. @@ -633,7 +633,7 @@ meta_mode_init(const char *make_mode) (void)Var_Subst("${.MAKE.META.BAILIWICK:O:u:tA}", VAR_GLOBAL, VARE_WANTRES, &metaBailiwickStr); /* TODO: handle errors */ -str2Lst_Append(metaBailiwick, metaBailiwickStr, NULL); +str2Lst_Append(metaBailiwick, metaBailiwickStr); /* * We ignore any paths that start with ${.MAKE.META.IGNORE_PATHS} */ @@ -643,7 +643,7 @@ meta_mode_init(const char *make_mode) (void)Var_Subst("${" MAKE_META_IGNORE_PATHS ":O:u:tA}", VAR_GLOBAL, VARE_WANTRES, &metaIgnorePathsStr); /* TODO: handle errors */ -str2Lst_Append(metaIgnorePaths, metaIgnorePathsStr, NULL); +str2Lst_Append(metaIgnorePaths, metaIgnorePathsStr); /* * We ignore any paths that match ${.MAKE.META.IGNORE_PATTERNS}
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sat Nov 14 17:39:14 UTC 2020 Modified Files: src/usr.bin/make: main.c Log Message: make(1): rename Main_SetVarObjdir to SetVarObjdir Only exported functions should be prefixed with the module name. To generate a diff of this commit: cvs rdiff -u -r1.460 -r1.461 src/usr.bin/make/main.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.bin/make/main.c diff -u src/usr.bin/make/main.c:1.460 src/usr.bin/make/main.c:1.461 --- src/usr.bin/make/main.c:1.460 Sat Nov 14 17:29:41 2020 +++ src/usr.bin/make/main.c Sat Nov 14 17:39:14 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.460 2020/11/14 17:29:41 rillig Exp $ */ +/* $NetBSD: main.c,v 1.461 2020/11/14 17:39:14 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -109,7 +109,7 @@ #include "trace.h" /* "@(#)main.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: main.c,v 1.460 2020/11/14 17:29:41 rillig Exp $"); +MAKE_RCSID("$NetBSD: main.c,v 1.461 2020/11/14 17:39:14 rillig Exp $"); #if defined(MAKE_NATIVE) && !defined(lint) __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 " "The Regents of the University of California. " @@ -750,7 +750,7 @@ Main_SetObjdir(Boolean writable, const c } static Boolean -Main_SetVarObjdir(Boolean writable, const char *var, const char *suffix) +SetVarObjdir(Boolean writable, const char *var, const char *suffix) { void *path_freeIt; const char *path = Var_Value(var, VAR_CMDLINE, &path_freeIt); @@ -1092,8 +1092,8 @@ InitObjdir(const char *machine, const ch writable = GetBooleanVar("MAKE_OBJDIR_CHECK_WRITABLE", TRUE); (void)Main_SetObjdir(FALSE, "%s", curdir); - if (!Main_SetVarObjdir(writable, "MAKEOBJDIRPREFIX", curdir) && - !Main_SetVarObjdir(writable, "MAKEOBJDIR", "") && + if (!SetVarObjdir(writable, "MAKEOBJDIRPREFIX", curdir) && + !SetVarObjdir(writable, "MAKEOBJDIR", "") && !Main_SetObjdir(writable, "%s.%s-%s", _PATH_OBJDIR, machine, machine_arch) && !Main_SetObjdir(writable, "%s.%s", _PATH_OBJDIR, machine) && !Main_SetObjdir(writable, "%s", _PATH_OBJDIR))
CVS commit: src/usr.bin/make/unit-tests
Module Name:src Committed By: rillig Date: Sat Nov 14 17:33:51 UTC 2020 Modified Files: src/usr.bin/make/unit-tests: opt.exp opt.mk Log Message: make(1): add tests for edge cases in parsing the command line To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/usr.bin/make/unit-tests/opt.exp cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/opt.mk 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/make/unit-tests/opt.exp diff -u src/usr.bin/make/unit-tests/opt.exp:1.1 src/usr.bin/make/unit-tests/opt.exp:1.2 --- src/usr.bin/make/unit-tests/opt.exp:1.1 Sun Aug 16 12:07:51 2020 +++ src/usr.bin/make/unit-tests/opt.exp Sat Nov 14 17:33:51 2020 @@ -1 +1,19 @@ +make -: +usage: make [-BeikNnqrstWwX] +[-C directory] [-D variable] [-d flags] [-f makefile] +[-I directory] [-J private] [-j max_jobs] [-m directory] [-T file] +[-V variable] [-v variable] [variable=value] [target ...] +*** Error code 2 (ignored) + +make -- -VAR=value -f /dev/null +make: don't know how to make -f (continuing) +`/dev/null' is up to date. + +make -? +usage: make [-BeikNnqrstWwX] +[-C directory] [-D variable] [-d flags] [-f makefile] +[-I directory] [-J private] [-j max_jobs] [-m directory] [-T file] +[-V variable] [-v variable] [variable=value] [target ...] +*** Error code 2 (ignored) + exit status 0 Index: src/usr.bin/make/unit-tests/opt.mk diff -u src/usr.bin/make/unit-tests/opt.mk:1.2 src/usr.bin/make/unit-tests/opt.mk:1.3 --- src/usr.bin/make/unit-tests/opt.mk:1.2 Sun Aug 16 14:25:16 2020 +++ src/usr.bin/make/unit-tests/opt.mk Sat Nov 14 17:33:51 2020 @@ -1,8 +1,24 @@ -# $NetBSD: opt.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $ +# $NetBSD: opt.mk,v 1.3 2020/11/14 17:33:51 rillig Exp $ # # Tests for the command line options. # TODO: Implementation -all: - @:; +.MAKEFLAGS: -d0 # make stdout line-buffered + +all: .IGNORE + # Just to see how the custom argument parsing code reacts to a syntax + # error. The colon is used in the options string, marking an option + # that takes arguments. It is not an option by itself, though. + ${MAKE} -: + @echo + + # See whether a '--' stops handling of command line options, like in + # standard getopt programs. Yes, it does, and it treats the '-f' as + # a target to be created. + ${MAKE} -- -VAR=value -f /dev/null + @echo + + # This is the normal way to print the usage of a command. + ${MAKE} -? + @echo
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sat Nov 14 17:29:41 UTC 2020 Modified Files: src/usr.bin/make: main.c Log Message: make(1): use different style of accessing characters in MainParseArgs The * is preferred for iterators. Since argv[i] is not an iterator but a fixed string, argv[i][0] expresses the idea "read the first character" more directly. To generate a diff of this commit: cvs rdiff -u -r1.459 -r1.460 src/usr.bin/make/main.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.bin/make/main.c diff -u src/usr.bin/make/main.c:1.459 src/usr.bin/make/main.c:1.460 --- src/usr.bin/make/main.c:1.459 Sat Nov 14 15:58:01 2020 +++ src/usr.bin/make/main.c Sat Nov 14 17:29:41 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.459 2020/11/14 15:58:01 rillig Exp $ */ +/* $NetBSD: main.c,v 1.460 2020/11/14 17:29:41 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -109,7 +109,7 @@ #include "trace.h" /* "@(#)main.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: main.c,v 1.459 2020/11/14 15:58:01 rillig Exp $"); +MAKE_RCSID("$NetBSD: main.c,v 1.460 2020/11/14 17:29:41 rillig Exp $"); #if defined(MAKE_NATIVE) && !defined(lint) __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 " "The Regents of the University of California. " @@ -658,9 +658,9 @@ rearg: if (Parse_IsVar(argv[1], &var)) { Parse_DoVar(&var, VAR_CMDLINE); } else { - if (!*argv[1]) + if (argv[1][0] == '\0') Punt("illegal (null) argument."); - if (*argv[1] == '-' && !dashDash) + if (argv[1][0] == '-' && !dashDash) goto rearg; Lst_Append(opts.create, bmake_strdup(argv[1])); }
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sat Nov 14 17:04:01 UTC 2020 Modified Files: src/usr.bin/make: job.c Log Message: make(1): clean up JobExec, JobStart, JobDoOutput The comments about temporary files for shell output are no longer relevant since the output is always handled via pipes. To generate a diff of this commit: cvs rdiff -u -r1.324 -r1.325 src/usr.bin/make/job.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.bin/make/job.c diff -u src/usr.bin/make/job.c:1.324 src/usr.bin/make/job.c:1.325 --- src/usr.bin/make/job.c:1.324 Sat Nov 14 16:44:04 2020 +++ src/usr.bin/make/job.c Sat Nov 14 17:04:01 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: job.c,v 1.324 2020/11/14 16:44:04 rillig Exp $ */ +/* $NetBSD: job.c,v 1.325 2020/11/14 17:04:01 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -143,7 +143,7 @@ #include "trace.h" /* "@(#)job.c 8.2 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: job.c,v 1.324 2020/11/14 16:44:04 rillig Exp $"); +MAKE_RCSID("$NetBSD: job.c,v 1.325 2020/11/14 17:04:01 rillig Exp $"); /* A shell defines how the commands are run. All commands for a target are * written into a single file, which is then given to the shell to execute @@ -1239,9 +1239,7 @@ Job_CheckCommands(GNode *gn, void (*abor /* Execute the shell for the given job. * - * A shell is executed, its output is altered and the Job structure added - * to the job table. - */ + * See Job_CatchOutput for handling the output of the shell. */ static void JobExec(Job *job, char **argv) { @@ -1604,11 +1602,9 @@ JobStart(GNode *gn, JobFlags flags) /* * Unlink and close the command file if we opened one */ - if (job->cmdFILE != stdout) { - if (job->cmdFILE != NULL) { - (void)fclose(job->cmdFILE); - job->cmdFILE = NULL; - } + if (job->cmdFILE != NULL && job->cmdFILE != stdout) { + (void)fclose(job->cmdFILE); + job->cmdFILE = NULL; } /* @@ -1675,34 +1671,20 @@ JobOutput(Job *job, char *cp, char *endp return cp; } -/*- - *--- - * JobDoOutput -- - * This function is called at different times depending on - * whether the user has specified that output is to be collected - * via pipes or temporary files. In the former case, we are called - * whenever there is something to read on the pipe. We collect more - * output from the given job and store it in the job's outBuf. If - * this makes up a line, we print it tagged by the job's identifier, - * as necessary. - * If output has been collected in a temporary file, we open the - * file and read it line by line, transferring it to our own - * output channel until the file is empty. At which point we - * remove the temporary file. - * In both cases, however, we keep our figurative eye out for the - * 'noPrint' line for the shell from which the output came. If - * we recognize a line, we don't print it. If the command is not - * alone on the line (the character after it is not \0 or \n), we - * do print whatever follows it. +/* + * This function is called whenever there is something to read on the pipe. + * We collect more output from the given job and store it in the job's + * outBuf. If this makes up a line, we print it tagged by the job's + * identifier, as necessary. + * + * In the output of the shell, the 'noPrint' lines are removed. If the + * command is not alone on the line (the character after it is not \0 or + * \n), we do print whatever follows it. * * Input: * job the job whose output needs printing * finish TRUE if this is the last time we'll be called * for this job - * - * Side Effects: - * curPos may be shifted as may the contents of outBuf. - *--- */ static void JobDoOutput(Job *job, Boolean finish) @@ -1717,7 +1699,7 @@ JobDoOutput(Job *job, Boolean finish) /* * Read as many bytes as will fit in the buffer. */ -end_loop: +again: gotNL = FALSE; fbuf = FALSE; @@ -1835,7 +1817,7 @@ end_loop: * we do get an EOF, finish will be set FALSE and we'll fall * through and out. */ - goto end_loop; + goto again; } }
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sat Nov 14 16:44:04 UTC 2020 Modified Files: src/usr.bin/make: job.c Log Message: make(1): remove indentation in JobOutput To generate a diff of this commit: cvs rdiff -u -r1.323 -r1.324 src/usr.bin/make/job.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.bin/make/job.c diff -u src/usr.bin/make/job.c:1.323 src/usr.bin/make/job.c:1.324 --- src/usr.bin/make/job.c:1.323 Sat Nov 14 15:58:01 2020 +++ src/usr.bin/make/job.c Sat Nov 14 16:44:04 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: job.c,v 1.323 2020/11/14 15:58:01 rillig Exp $ */ +/* $NetBSD: job.c,v 1.324 2020/11/14 16:44:04 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -143,7 +143,7 @@ #include "trace.h" /* "@(#)job.c 8.2 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: job.c,v 1.323 2020/11/14 15:58:01 rillig Exp $"); +MAKE_RCSID("$NetBSD: job.c,v 1.324 2020/11/14 16:44:04 rillig Exp $"); /* A shell defines how the commands are run. All commands for a target are * written into a single file, which is then given to the shell to execute @@ -1637,36 +1637,39 @@ JobStart(GNode *gn, JobFlags flags) return JOB_RUNNING; } +/* Print the output of the shell command, skipping the noPrint command of + * the shell, if any. */ static char * JobOutput(Job *job, char *cp, char *endp) { char *ecp; -if (commandShell->noPrint != NULL && commandShell->noPrint[0] != '\0') { - while ((ecp = strstr(cp, commandShell->noPrint)) != NULL) { - if (cp != ecp) { - *ecp = '\0'; - /* - * The only way there wouldn't be a newline after - * this line is if it were the last in the buffer. - * however, since the non-printable comes after it, - * there must be a newline, so we don't print one. - */ - (void)fprintf(stdout, "%s", cp); - (void)fflush(stdout); - } - cp = ecp + commandShell->noPrintLen; - if (cp != endp) { - /* - * Still more to print, look again after skipping - * the whitespace following the non-printable - * command - */ - cp++; - pp_skip_whitespace(&cp); - } else { - return cp; - } +if (commandShell->noPrint == NULL || commandShell->noPrint[0] == '\0') + return cp; + +while ((ecp = strstr(cp, commandShell->noPrint)) != NULL) { + if (ecp != cp) { + *ecp = '\0'; + /* + * The only way there wouldn't be a newline after + * this line is if it were the last in the buffer. + * however, since the non-printable comes after it, + * there must be a newline, so we don't print one. + */ + (void)fprintf(stdout, "%s", cp); + (void)fflush(stdout); + } + cp = ecp + commandShell->noPrintLen; + if (cp != endp) { + /* + * Still more to print, look again after skipping + * the whitespace following the non-printable + * command + */ + cp++; + pp_skip_whitespace(&cp); + } else { + return cp; } } return cp;
CVS commit: src/usr.sbin/envstat
Module Name:src Committed By: mlelstv Date: Sat Nov 14 16:32:53 UTC 2020 Modified Files: src/usr.sbin/envstat: envstat.8 envstat.c Log Message: Add option -n to print only the value of a sensor. If statistics are selected with -T, then also display max, min and average. The empty line between each display is skipped when one or more sensors are selected with -s. To generate a diff of this commit: cvs rdiff -u -r1.64 -r1.65 src/usr.sbin/envstat/envstat.8 cvs rdiff -u -r1.99 -r1.100 src/usr.sbin/envstat/envstat.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/envstat/envstat.8 diff -u src/usr.sbin/envstat/envstat.8:1.64 src/usr.sbin/envstat/envstat.8:1.65 --- src/usr.sbin/envstat/envstat.8:1.64 Sat Nov 14 12:36:49 2020 +++ src/usr.sbin/envstat/envstat.8 Sat Nov 14 16:32:53 2020 @@ -1,4 +1,4 @@ -.\" $NetBSD: envstat.8,v 1.64 2020/11/14 12:36:49 mlelstv Exp $ +.\" $NetBSD: envstat.8,v 1.65 2020/11/14 16:32:53 mlelstv Exp $ .\" .\" Copyright (c) 2000, 2007, 2008, 2009, 2014 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -35,7 +35,7 @@ .Nd utility to handle environmental sensors .Sh SYNOPSIS .Nm -.Op Fl DfIklSTW +.Op Fl DfIklnSTW .Op Fl c Ar file .Op Fl d Ar device .Op Fl i Ar interval @@ -106,6 +106,11 @@ List the names of all supported sensors, Use of this flag causes .Nm to ignore all other option flags. +.It Fl n +Print only the current value of a sensor and no headers. +If statistics are selected with +.Fl T +then also display max, min and average. .It Fl r This flag is provided for compatibility reasons and there's no need to use it. Index: src/usr.sbin/envstat/envstat.c diff -u src/usr.sbin/envstat/envstat.c:1.99 src/usr.sbin/envstat/envstat.c:1.100 --- src/usr.sbin/envstat/envstat.c:1.99 Sat Nov 14 12:36:49 2020 +++ src/usr.sbin/envstat/envstat.c Sat Nov 14 16:32:53 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: envstat.c,v 1.99 2020/11/14 12:36:49 mlelstv Exp $ */ +/* $NetBSD: envstat.c,v 1.100 2020/11/14 16:32:53 mlelstv Exp $ */ /*- * Copyright (c) 2007, 2008 Juan Romero Pardines. @@ -27,7 +27,7 @@ #include #ifndef lint -__RCSID("$NetBSD: envstat.c,v 1.99 2020/11/14 12:36:49 mlelstv Exp $"); +__RCSID("$NetBSD: envstat.c,v 1.100 2020/11/14 16:32:53 mlelstv Exp $"); #endif /* not lint */ #include @@ -58,6 +58,7 @@ __RCSID("$NetBSD: envstat.c,v 1.99 2020/ #define ENVSYS_IFLAG 0x0010 /* skip invalid sensors */ #define ENVSYS_SFLAG 0x0020 /* remove all properties set */ #define ENVSYS_TFLAG 0x0040 /* make statistics */ +#define ENVSYS_NFLAG 0x0080 /* print value only */ #define ENVSYS_KFLAG 0x0100 /* show temp in kelvin */ /* Sensors */ @@ -130,7 +131,7 @@ int main(int argc, char **argv) setprogname(argv[0]); - while ((c = getopt(argc, argv, "c:Dd:fIi:klrSs:Tw:Wx")) != -1) { + while ((c = getopt(argc, argv, "c:Dd:fIi:klnrSs:Tw:Wx")) != -1) { switch (c) { case 'c': /* configuration file */ configfile = optarg; @@ -158,6 +159,9 @@ int main(int argc, char **argv) case 'l': /* list sensors */ flags |= ENVSYS_LFLAG; break; + case 'n': /* print value only */ + flags |= ENVSYS_NFLAG; + break; case 'r': /* * This flag is noop.. it's only here for @@ -577,7 +581,7 @@ parse_dictionary(int fd) rval = check_sensors(sensors); if ((flags & ENVSYS_LFLAG) == 0 && (flags & ENVSYS_DFLAG) == 0) print_sensors(); - if (interval) + if (interval && ((flags & ENVSYS_NFLAG) == 0 || sensors == NULL)) (void)printf("\n"); out: @@ -856,6 +860,9 @@ print_sensors(void) double temp = 0; const char *invalid = "N/A", *degrees, *tmpstr, *stype; const char *a, *b, *c, *d, *e, *units; + const char *sep; + int flen; + bool nflag = (flags & ENVSYS_NFLAG) != 0; tmpstr = stype = d = e = NULL; @@ -888,21 +895,29 @@ print_sensors(void) e = "CritMin"; } - if (!sensors || (!header_passes && sensors) || - (header_passes == 10 && sensors)) { - if (statistics) - (void)printf("%s%*s %9s %8s %8s %8s %6s\n", - mydevname ? "" : " ", (int)maxlen, - "", a, b, c, d, units); - else - (void)printf("%s%*s %9s %8s %8s %8s %8s %5s\n", - mydevname ? "" : " ", (int)maxlen, - "", a, b, c, d, e, units); - if (sensors && header_passes == 10) - header_passes = 0; + if (!nflag) { + if (!sensors || (!header_passes && sensors) || + (header_passes == 10 && sensors)) { + if (statistics) +(void)printf("%s%*s %9s %8s %8s %8s %6s\n", +mydevname ? "" : " ", (int)maxlen, +"", a, b, c, d, units); + else +(void)printf("%s%*s %9s %8s %8s %8s %8s %5s\n", +mydevname ? "" : " ", (int)maxlen, +"", a, b, c, d, e, units); + if (sensors && header_passes == 10) +header_passes = 0; + } + if (sensors) + header_passes++; + + sep = ":"; + flen = 10; + } else { + sep = ""; + flen = 1; } - if (sensors) - header_passes++; /* p
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sat Nov 14 16:09:08 UTC 2020 Modified Files: src/usr.bin/make: parse.c Log Message: make(1): clean up comment above ParseDoDependencyTargetSpecial To generate a diff of this commit: cvs rdiff -u -r1.439 -r1.440 src/usr.bin/make/parse.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.bin/make/parse.c diff -u src/usr.bin/make/parse.c:1.439 src/usr.bin/make/parse.c:1.440 --- src/usr.bin/make/parse.c:1.439 Sat Nov 14 15:58:01 2020 +++ src/usr.bin/make/parse.c Sat Nov 14 16:09:08 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: parse.c,v 1.439 2020/11/14 15:58:01 rillig Exp $ */ +/* $NetBSD: parse.c,v 1.440 2020/11/14 16:09:08 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -117,7 +117,7 @@ #include "pathnames.h" /* "@(#)parse.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: parse.c,v 1.439 2020/11/14 15:58:01 rillig Exp $"); +MAKE_RCSID("$NetBSD: parse.c,v 1.440 2020/11/14 16:09:08 rillig Exp $"); /* types and constants */ @@ -1075,38 +1075,7 @@ ParseDependencyTargetWord(/*const*/ char *pp = cp; } -/* - * Certain special targets have special semantics: - * .PATH Have to set the dirSearchPath - * variable too - * .MAIN Its sources are only used if - * nothing has been specified to - * create. - * .DEFAULT Need to create a node to hang - * commands on, but we don't want - * it in the graph, nor do we want - * it to be the Main Target, so we - * create it, set OP_NOTMAIN and - * add it to the list, setting - * defaultNode to the new node for - * later use. We claim the node is - * A transformation rule to make - * life easier later, when we'll - * use Make_HandleUse to actually - * apply the .DEFAULT commands. - * .PHONY The list of targets - * .NOPATH Don't search for file in the path - * .STALE - * .BEGIN - * .END - * .ERROR - * .DELETE_ON_ERROR - * .INTERRUPT Are not to be considered the - * main target. - * .NOTPARALLEL Make only one target at a time. - * .SINGLESHELL Create a shell for each command. - * .ORDER Must set initial predecessor to NULL - */ +/* Handle special targets like .PATH, .DEFAULT, .BEGIN, .ORDER. */ static void ParseDoDependencyTargetSpecial(ParseSpecial *inout_specType, const char *line, @@ -1119,6 +1088,7 @@ ParseDoDependencyTargetSpecial(ParseSpec Lst_Append(*inout_paths, dirSearchPath); break; case SP_MAIN: + /* Allow targets from the command line to override the .MAIN node. */ if (!Lst_IsEmpty(opts.create)) *inout_specType = SP_NOT; break; @@ -1135,6 +1105,11 @@ ParseDoDependencyTargetSpecial(ParseSpec break; } case SP_DEFAULT: { + /* Need to create a node to hang commands on, but we don't want it + * in the graph, nor do we want it to be the Main Target. We claim + * the node is a transformation rule to make life easier later, + * when we'll use Make_HandleUse to actually apply the .DEFAULT + * commands. */ GNode *gn = Targ_NewGN(".DEFAULT"); gn->type |= OP_NOTMAIN|OP_TRANSFORM; Lst_Append(targets, gn);
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sat Nov 14 15:58:01 UTC 2020 Modified Files: src/usr.bin/make: job.c main.c make.h parse.c Log Message: make(1): rename DEFAULT to defaultNode In C, uppercase names are typically used for constants, and this is not a constant. To generate a diff of this commit: cvs rdiff -u -r1.322 -r1.323 src/usr.bin/make/job.c cvs rdiff -u -r1.458 -r1.459 src/usr.bin/make/main.c cvs rdiff -u -r1.206 -r1.207 src/usr.bin/make/make.h cvs rdiff -u -r1.438 -r1.439 src/usr.bin/make/parse.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.bin/make/job.c diff -u src/usr.bin/make/job.c:1.322 src/usr.bin/make/job.c:1.323 --- src/usr.bin/make/job.c:1.322 Sat Nov 14 15:47:35 2020 +++ src/usr.bin/make/job.c Sat Nov 14 15:58:01 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: job.c,v 1.322 2020/11/14 15:47:35 rillig Exp $ */ +/* $NetBSD: job.c,v 1.323 2020/11/14 15:58:01 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -143,7 +143,7 @@ #include "trace.h" /* "@(#)job.c 8.2 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: job.c,v 1.322 2020/11/14 15:47:35 rillig Exp $"); +MAKE_RCSID("$NetBSD: job.c,v 1.323 2020/11/14 15:58:01 rillig Exp $"); /* A shell defines how the commands are run. All commands for a target are * written into a single file, which is then given to the shell to execute @@ -1182,20 +1182,19 @@ Job_CheckCommands(GNode *gn, void (*abor /* * No commands. Look for .DEFAULT rule from which we might infer - * commands + * commands. */ -if (DEFAULT != NULL && !Lst_IsEmpty(DEFAULT->commands) && +if (defaultNode != NULL && !Lst_IsEmpty(defaultNode->commands) && !(gn->type & OP_SPECIAL)) { /* - * Make only looks for a .DEFAULT if the node was never the - * target of an operator, so that's what we do too. If - * a .DEFAULT was given, we substitute its commands for gn's - * commands and set the IMPSRC variable to be the target's name - * The DEFAULT node acts like a transformation rule, in that + * The traditional Make only looks for a .DEFAULT if the node was + * never the target of an operator, so that's what we do too. + * + * The .DEFAULT node acts like a transformation rule, in that * gn also inherits any attributes or sources attached to * .DEFAULT itself. */ - Make_HandleUse(DEFAULT, gn); + Make_HandleUse(defaultNode, gn); Var_Set(IMPSRC, GNode_VarTarget(gn), gn); return TRUE; } Index: src/usr.bin/make/main.c diff -u src/usr.bin/make/main.c:1.458 src/usr.bin/make/main.c:1.459 --- src/usr.bin/make/main.c:1.458 Fri Nov 13 19:45:24 2020 +++ src/usr.bin/make/main.c Sat Nov 14 15:58:01 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.458 2020/11/13 19:45:24 rillig Exp $ */ +/* $NetBSD: main.c,v 1.459 2020/11/14 15:58:01 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -109,7 +109,7 @@ #include "trace.h" /* "@(#)main.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: main.c,v 1.458 2020/11/13 19:45:24 rillig Exp $"); +MAKE_RCSID("$NetBSD: main.c,v 1.459 2020/11/14 15:58:01 rillig Exp $"); #if defined(MAKE_NATIVE) && !defined(lint) __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 " "The Regents of the University of California. " @@ -122,7 +122,7 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 19 CmdOpts opts; time_t now; /* Time at start of make */ -GNode *DEFAULT; /* .DEFAULT node */ +GNode *defaultNode; /* .DEFAULT node */ Boolean allPrecious; /* .PRECIOUS given on line by itself */ Boolean deleteOnError; /* .DELETE_ON_ERROR: set */ @@ -1504,7 +1504,7 @@ main_Init(int argc, char **argv) Suff_Init(); Trace_Init(tracefile); - DEFAULT = NULL; + defaultNode = NULL; (void)time(&now); Trace_Log(MAKESTART, NULL); Index: src/usr.bin/make/make.h diff -u src/usr.bin/make/make.h:1.206 src/usr.bin/make/make.h:1.207 --- src/usr.bin/make/make.h:1.206 Thu Nov 12 23:35:21 2020 +++ src/usr.bin/make/make.h Sat Nov 14 15:58:01 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: make.h,v 1.206 2020/11/12 23:35:21 sjg Exp $ */ +/* $NetBSD: make.h,v 1.207 2020/11/14 15:58:01 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -423,7 +423,7 @@ extern Boolean deleteOnError; /* TRUE while processing .depend */ extern Boolean doing_depend; /* .DEFAULT rule */ -extern GNode *DEFAULT; +extern GNode *defaultNode; /* Variables defined internally by make which should not override those set * by makefiles. */ Index: src/usr.bin/make/parse.c diff -u src/usr.bin/make/parse.c:1.438 src/usr.bin/make/parse.c:1.439 --- src/usr.bin/make/parse.c:1.438 Thu Nov 12 23:35:21 2020 +++ src/usr.bin/make/parse.c Sat Nov 14 15:58:01 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: parse.c,v 1.438 2020/11/12 23:35:21 sjg Exp $ */ +/* $NetBSD: parse.c,v 1.439 2020/11/14 15:58:01 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -117,7 +117,7 @@
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sat Nov 14 15:47:36 UTC 2020 Modified Files: src/usr.bin/make: job.c Log Message: make(1): use stderr for error message about failed touch Error messages belong on stderr, not stdout. Since at least 1993, stdout had been used for no good reason. Plus, in all these years, nobody ever tested this code path since otherwise the missing newline at the end of the error message would have been obvious. This is a good candidate for the "oldest bug in make" trophy. To generate a diff of this commit: cvs rdiff -u -r1.321 -r1.322 src/usr.bin/make/job.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.bin/make/job.c diff -u src/usr.bin/make/job.c:1.321 src/usr.bin/make/job.c:1.322 --- src/usr.bin/make/job.c:1.321 Sat Nov 14 14:16:01 2020 +++ src/usr.bin/make/job.c Sat Nov 14 15:47:35 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: job.c,v 1.321 2020/11/14 14:16:01 rillig Exp $ */ +/* $NetBSD: job.c,v 1.322 2020/11/14 15:47:35 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -143,7 +143,7 @@ #include "trace.h" /* "@(#)job.c 8.2 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: job.c,v 1.321 2020/11/14 14:16:01 rillig Exp $"); +MAKE_RCSID("$NetBSD: job.c,v 1.322 2020/11/14 15:47:35 rillig Exp $"); /* A shell defines how the commands are run. All commands for a target are * written into a single file, which is then given to the shell to execute @@ -1107,9 +1107,9 @@ TouchRegular(GNode *gn) fd = open(file, O_RDWR | O_CREAT, 0666); if (fd < 0) { - (void)fprintf(stdout, "*** couldn't touch %s: %s", + (void)fprintf(stderr, "*** couldn't touch %s: %s\n", file, strerror(errno)); - (void)fflush(stdout); + (void)fflush(stderr); return;/* XXX: What about propagating the error? */ }
CVS commit: [netbsd-9] src/doc
Module Name:src Committed By: martin Date: Sat Nov 14 15:38:43 UTC 2020 Modified Files: src/doc [netbsd-9]: CHANGES-9.2 Log Message: Ticket #1130 To generate a diff of this commit: cvs rdiff -u -r1.1.2.12 -r1.1.2.13 src/doc/CHANGES-9.2 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-9.2 diff -u src/doc/CHANGES-9.2:1.1.2.12 src/doc/CHANGES-9.2:1.1.2.13 --- src/doc/CHANGES-9.2:1.1.2.12 Sat Nov 14 13:03:10 2020 +++ src/doc/CHANGES-9.2 Sat Nov 14 15:38:43 2020 @@ -1,4 +1,4 @@ -# $NetBSD: CHANGES-9.2,v 1.1.2.12 2020/11/14 13:03:10 martin Exp $ +# $NetBSD: CHANGES-9.2,v 1.1.2.13 2020/11/14 15:38:43 martin Exp $ A complete list of changes from the NetBSD 9.1 release to the NetBSD 9.2 release: @@ -1084,3 +1084,14 @@ sys/coda/coda_vnops.c1.114 (patch) PR 55775: fix coda_readdir() to directly process the container file. [hannken, ticket #1131] +sys/conf/param.c1.69 +sys/kern/init_main.c1.533 +sys/sys/param.h 1.679 + + Set a better default for MAXFILES on larger RAM machines if not + otherwise specified the kernel config file. Arbitary numbers are + 20,000 files for 16GB RAM or more and 10,000 files for 1GB RAM or + more. + [fair, ticket #1130] + +
CVS commit: [netbsd-9] src/sys
Module Name:src Committed By: martin Date: Sat Nov 14 15:36:11 UTC 2020 Modified Files: src/sys/conf [netbsd-9]: param.c src/sys/kern [netbsd-9]: init_main.c src/sys/sys [netbsd-9]: param.h Log Message: Pull up following revision(s) (requested by fair in ticket #1130): sys/sys/param.h: revision 1.679 sys/conf/param.c: revision 1.69 sys/kern/init_main.c: revision 1.533 Set a better default for MAXFILES on larger RAM machines if not otherwise specified the kernel config file. Arbitary numbers are 20,000 files for 16GB RAM or more and 10,000 files for 1GB RAM or more. TODO: Adjust this and other values totally dynamically. To generate a diff of this commit: cvs rdiff -u -r1.68 -r1.68.4.1 src/sys/conf/param.c cvs rdiff -u -r1.504 -r1.504.2.1 src/sys/kern/init_main.c cvs rdiff -u -r1.599.2.8 -r1.599.2.9 src/sys/sys/param.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/conf/param.c diff -u src/sys/conf/param.c:1.68 src/sys/conf/param.c:1.68.4.1 --- src/sys/conf/param.c:1.68 Tue Apr 9 22:05:27 2019 +++ src/sys/conf/param.c Sat Nov 14 15:36:11 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: param.c,v 1.68 2019/04/09 22:05:27 pgoyette Exp $ */ +/* $NetBSD: param.c,v 1.68.4.1 2020/11/14 15:36:11 martin Exp $ */ /* * Copyright (c) 1980, 1986, 1989 Regents of the University of California. @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: param.c,v 1.68 2019/04/09 22:05:27 pgoyette Exp $"); +__KERNEL_RCSID(0, "$NetBSD: param.c,v 1.68.4.1 2020/11/14 15:36:11 martin Exp $"); #ifdef _KERNEL_OPT #include "opt_hz.h" @@ -105,10 +105,6 @@ __KERNEL_RCSID(0, "$NetBSD: param.c,v 1. #define HZ 100 #endif -#ifndef MAXFILES -#define MAXFILES (3 * (NPROC + MAXUSERS) + 80) -#endif - #ifndef MAXEXEC #define MAXEXEC 16 #endif Index: src/sys/kern/init_main.c diff -u src/sys/kern/init_main.c:1.504 src/sys/kern/init_main.c:1.504.2.1 --- src/sys/kern/init_main.c:1.504 Fri May 17 03:34:26 2019 +++ src/sys/kern/init_main.c Sat Nov 14 15:36:11 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: init_main.c,v 1.504 2019/05/17 03:34:26 ozaki-r Exp $ */ +/* $NetBSD: init_main.c,v 1.504.2.1 2020/11/14 15:36:11 martin Exp $ */ /*- * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc. @@ -97,7 +97,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: init_main.c,v 1.504 2019/05/17 03:34:26 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: init_main.c,v 1.504.2.1 2020/11/14 15:36:11 martin Exp $"); #include "opt_ddb.h" #include "opt_inet.h" @@ -469,7 +469,22 @@ main(void) 10, VNODE_KMEM_MAXPCT) / VNODE_COST; if (usevnodes > desiredvnodes) desiredvnodes = usevnodes; -#endif +#endif /* NVNODE_IMPLICIT */ +#ifdef MAXFILES_IMPLICIT + /* + * If maximum number of files is not explicitly defined in + * kernel config, adjust the number so that it is somewhat + * more reasonable on machines with larger memory sizes. + * Arbitary numbers are 20,000 files for 16GB RAM or more + * and 10,000 files for 1GB RAM or more. + * + * XXXtodo: adjust this and other values totally dynamically + */ + if (ctob((uint64_t)physmem) >= 16ULL * 1024 * 1024 * 1024) + maxfiles = MAX(maxfiles, 2); + if (ctob((uint64_t)physmem) >= 1024 * 1024 * 1024) + maxfiles = MAX(maxfiles, 1); +#endif /* MAXFILES_IMPLICIT */ /* Initialize fstrans. */ fstrans_init(); Index: src/sys/sys/param.h diff -u src/sys/sys/param.h:1.599.2.8 src/sys/sys/param.h:1.599.2.9 --- src/sys/sys/param.h:1.599.2.8 Thu Oct 22 11:21:41 2020 +++ src/sys/sys/param.h Sat Nov 14 15:36:11 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: param.h,v 1.599.2.8 2020/10/22 11:21:41 martin Exp $ */ +/* $NetBSD: param.h,v 1.599.2.9 2020/11/14 15:36:11 martin Exp $ */ /*- * Copyright (c) 1982, 1986, 1989, 1993 @@ -148,13 +148,17 @@ #include #include #ifndef NPROC -#define NPROC (20 + 16 * MAXUSERS) +#define NPROC (20 + 16 * MAXUSERS) +#endif +#ifndef MAXFILES +#define MAXFILES (3 * (NPROC + MAXUSERS) + 80) +#define MAXFILES_IMPLICIT #endif #ifndef NTEXT -#define NTEXT (80 + NPROC / 8) /* actually the object cache */ +#define NTEXT (80 + NPROC / 8) /* actually the object cache */ #endif #ifndef NVNODE -#define NVNODE (NPROC + NTEXT + 100) +#define NVNODE (NPROC + NTEXT + 100) #define NVNODE_IMPLICIT #endif #ifndef VNODE_KMEM_MAXPCT @@ -163,7 +167,7 @@ #ifndef BUFCACHE_VA_MAXPCT #define BUFCACHE_VA_MAXPCT 20 #endif -#define VNODE_COST 2048 /* assumed space in bytes */ +#define VNODE_COST 2048 /* assumed space in bytes */ #endif /* _KERNEL */ /* Signals. */
CVS commit: src
Module Name:src Committed By: rillig Date: Sat Nov 14 15:35:20 UTC 2020 Modified Files: src/distrib/sets/lists/tests: mi src/usr.bin/make/unit-tests: Makefile Added Files: src/usr.bin/make/unit-tests: opt-touch-jobs.exp opt-touch-jobs.mk Log Message: make(1): add test for the -t option in jobs mode To generate a diff of this commit: cvs rdiff -u -r1.968 -r1.969 src/distrib/sets/lists/tests/mi cvs rdiff -u -r1.198 -r1.199 src/usr.bin/make/unit-tests/Makefile cvs rdiff -u -r0 -r1.1 src/usr.bin/make/unit-tests/opt-touch-jobs.exp \ src/usr.bin/make/unit-tests/opt-touch-jobs.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/sets/lists/tests/mi diff -u src/distrib/sets/lists/tests/mi:1.968 src/distrib/sets/lists/tests/mi:1.969 --- src/distrib/sets/lists/tests/mi:1.968 Fri Nov 13 17:19:06 2020 +++ src/distrib/sets/lists/tests/mi Sat Nov 14 15:35:20 2020 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.968 2020/11/13 17:19:06 sjg Exp $ +# $NetBSD: mi,v 1.969 2020/11/14 15:35:20 rillig Exp $ # # Note: don't delete entries from here - mark them as "obsolete" instead. # @@ -5213,6 +5213,8 @@ ./usr/tests/usr.bin/make/unit-tests/opt-raw.mk tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/make/unit-tests/opt-silent.exptests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/make/unit-tests/opt-silent.mktests-usr.bin-tests compattestfile,atf +./usr/tests/usr.bin/make/unit-tests/opt-touch-jobs.exptests-usr.bin-tests compattestfile,atf +./usr/tests/usr.bin/make/unit-tests/opt-touch-jobs.mktests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/make/unit-tests/opt-touch.exptests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/make/unit-tests/opt-touch.mktests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/make/unit-tests/opt-tracefile.exptests-usr.bin-tests compattestfile,atf Index: src/usr.bin/make/unit-tests/Makefile diff -u src/usr.bin/make/unit-tests/Makefile:1.198 src/usr.bin/make/unit-tests/Makefile:1.199 --- src/usr.bin/make/unit-tests/Makefile:1.198 Thu Nov 12 23:35:21 2020 +++ src/usr.bin/make/unit-tests/Makefile Sat Nov 14 15:35:20 2020 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.198 2020/11/12 23:35:21 sjg Exp $ +# $NetBSD: Makefile,v 1.199 2020/11/14 15:35:20 rillig Exp $ # # Unit tests for make(1) # @@ -232,6 +232,7 @@ TESTS+= opt-query TESTS+= opt-raw TESTS+= opt-silent TESTS+= opt-touch +TESTS+= opt-touch-jobs TESTS+= opt-tracefile TESTS+= opt-var-expanded TESTS+= opt-var-literal Added files: Index: src/usr.bin/make/unit-tests/opt-touch-jobs.exp diff -u /dev/null src/usr.bin/make/unit-tests/opt-touch-jobs.exp:1.1 --- /dev/null Sat Nov 14 15:35:20 2020 +++ src/usr.bin/make/unit-tests/opt-touch-jobs.exp Sat Nov 14 15:35:20 2020 @@ -0,0 +1,4 @@ +: Making opt-touch-make. +`opt-touch-join' is up to date. +`opt-touch-use' is up to date. +exit status 0 Index: src/usr.bin/make/unit-tests/opt-touch-jobs.mk diff -u /dev/null src/usr.bin/make/unit-tests/opt-touch-jobs.mk:1.1 --- /dev/null Sat Nov 14 15:35:20 2020 +++ src/usr.bin/make/unit-tests/opt-touch-jobs.mk Sat Nov 14 15:35:20 2020 @@ -0,0 +1,30 @@ +# $NetBSD: opt-touch-jobs.mk,v 1.1 2020/11/14 15:35:20 rillig Exp $ +# +# Tests for the -t command line option in jobs mode. + +.MAKEFLAGS: -j1 +.MAKEFLAGS: -t +.MAKEFLAGS: opt-touch-phony +.MAKEFLAGS: opt-touch-join +.MAKEFLAGS: opt-touch-use +.MAKEFLAGS: opt-touch-make + +opt-touch-phony: .PHONY + : Making $@. + +opt-touch-join: .JOIN + : Making $@. + +opt-touch-use: .USE + : Making use of $@. + +# Even though it is listed last, in the output it appears first. +# This is because it is the only node that actually needs to be run. +# The "is up to date" of the other nodes happens after all jobs have +# finished, by Make_Run > MakePrintStatusList > MakePrintStatus. +opt-touch-make: .MAKE + : Making $@. + +.END: + @files=$$(ls opt-touch-* 2>/dev/null | grep -v -e '\.' -e '\*'); \ + [ -z "$$files" ] || { echo "created files: $$files" 1>&2; exit 1; }
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sat Nov 14 15:03:37 UTC 2020 Modified Files: src/usr.bin/make: make.c Log Message: make(1): fix debug output for GNode details To generate a diff of this commit: cvs rdiff -u -r1.204 -r1.205 src/usr.bin/make/make.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.bin/make/make.c diff -u src/usr.bin/make/make.c:1.204 src/usr.bin/make/make.c:1.205 --- src/usr.bin/make/make.c:1.204 Sat Nov 14 14:57:05 2020 +++ src/usr.bin/make/make.c Sat Nov 14 15:03:37 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: make.c,v 1.204 2020/11/14 14:57:05 rillig Exp $ */ +/* $NetBSD: make.c,v 1.205 2020/11/14 15:03:37 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -108,7 +108,7 @@ #include "job.h" /* "@(#)make.c 8.1 (Berkeley) 6/6/93" */ -MAKE_RCSID("$NetBSD: make.c,v 1.204 2020/11/14 14:57:05 rillig Exp $"); +MAKE_RCSID("$NetBSD: make.c,v 1.205 2020/11/14 15:03:37 rillig Exp $"); /* Sequence # to detect recursion. */ static unsigned int checked = 1; @@ -651,7 +651,7 @@ Make_Update(GNode *cgn) if (DEBUG(MAKE)) { debug_printf("inspect parent %s%s: ", pgn->name, pgn->cohort_num); GNode_FprintDetails(opts.debug_file, "", pgn, ""); - debug_printf("unmade %d ", pgn->unmade - 1); + debug_printf(", unmade %d ", pgn->unmade - 1); } if (!(pgn->flags & REMAKE)) {
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sat Nov 14 14:57:05 UTC 2020 Modified Files: src/usr.bin/make: make.c Log Message: make(1): use symbolic names in debug output of GNodes To generate a diff of this commit: cvs rdiff -u -r1.203 -r1.204 src/usr.bin/make/make.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.bin/make/make.c diff -u src/usr.bin/make/make.c:1.203 src/usr.bin/make/make.c:1.204 --- src/usr.bin/make/make.c:1.203 Sun Nov 8 11:37:46 2020 +++ src/usr.bin/make/make.c Sat Nov 14 14:57:05 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: make.c,v 1.203 2020/11/08 11:37:46 rillig Exp $ */ +/* $NetBSD: make.c,v 1.204 2020/11/14 14:57:05 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -108,7 +108,7 @@ #include "job.h" /* "@(#)make.c 8.1 (Berkeley) 6/6/93" */ -MAKE_RCSID("$NetBSD: make.c,v 1.203 2020/11/08 11:37:46 rillig Exp $"); +MAKE_RCSID("$NetBSD: make.c,v 1.204 2020/11/14 14:57:05 rillig Exp $"); /* Sequence # to detect recursion. */ static unsigned int checked = 1; @@ -648,11 +648,11 @@ Make_Update(GNode *cgn) for (ln = parents->first; ln != NULL; ln = ln->next) { GNode *pgn = ln->datum; - if (DEBUG(MAKE)) - debug_printf("inspect parent %s%s: flags %x, " - "type %x, made %d, unmade %d ", - pgn->name, pgn->cohort_num, pgn->flags, - pgn->type, pgn->made, pgn->unmade - 1); + if (DEBUG(MAKE)) { + debug_printf("inspect parent %s%s: ", pgn->name, pgn->cohort_num); + GNode_FprintDetails(opts.debug_file, "", pgn, ""); + debug_printf("unmade %d ", pgn->unmade - 1); + } if (!(pgn->flags & REMAKE)) { /* This parent isn't needed */ @@ -855,8 +855,11 @@ MakeBuildChild(void *v_cn, void *toBeMad { GNode *cn = v_cn; -DEBUG4(MAKE, "MakeBuildChild: inspect %s%s, made %d, type %x\n", - cn->name, cn->cohort_num, cn->made, cn->type); +if (DEBUG(MAKE)) { + debug_printf("MakeBuildChild: inspect %s%s, ", + cn->name, cn->cohort_num); + GNode_FprintDetails(opts.debug_file, "", cn, "\n"); +} if (cn->made > DEFERRED) return 0;
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sat Nov 14 14:16:01 UTC 2020 Modified Files: src/usr.bin/make: compat.c job.c Log Message: make(1): clean up Job_Touch Several more outdated comments were removed. To compensate for that, several new comments mark places where errors are not properly propagated. To generate a diff of this commit: cvs rdiff -u -r1.181 -r1.182 src/usr.bin/make/compat.c cvs rdiff -u -r1.320 -r1.321 src/usr.bin/make/job.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.bin/make/compat.c diff -u src/usr.bin/make/compat.c:1.181 src/usr.bin/make/compat.c:1.182 --- src/usr.bin/make/compat.c:1.181 Sun Nov 8 08:33:07 2020 +++ src/usr.bin/make/compat.c Sat Nov 14 14:16:01 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: compat.c,v 1.181 2020/11/08 08:33:07 rillig Exp $ */ +/* $NetBSD: compat.c,v 1.182 2020/11/14 14:16:01 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -96,7 +96,7 @@ #include "pathnames.h" /* "@(#)compat.c 8.2 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: compat.c,v 1.181 2020/11/08 08:33:07 rillig Exp $"); +MAKE_RCSID("$NetBSD: compat.c,v 1.182 2020/11/14 14:16:01 rillig Exp $"); static GNode *curTarg = NULL; static pid_t compatChild; @@ -561,8 +561,7 @@ Compat_Make(GNode *gn, GNode *pgn) if (gn->made != ERROR) { /* * If the node was made successfully, mark it so, update - * its modification time and timestamp all its parents. Note - * that for .ZEROTIME targets, the timestamping isn't done. + * its modification time and timestamp all its parents. * This is to keep its state from affecting that of its parent. */ gn->made = MADE; Index: src/usr.bin/make/job.c diff -u src/usr.bin/make/job.c:1.320 src/usr.bin/make/job.c:1.321 --- src/usr.bin/make/job.c:1.320 Sat Nov 14 13:45:34 2020 +++ src/usr.bin/make/job.c Sat Nov 14 14:16:01 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: job.c,v 1.320 2020/11/14 13:45:34 rillig Exp $ */ +/* $NetBSD: job.c,v 1.321 2020/11/14 14:16:01 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -143,7 +143,7 @@ #include "trace.h" /* "@(#)job.c 8.2 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: job.c,v 1.320 2020/11/14 13:45:34 rillig Exp $"); +MAKE_RCSID("$NetBSD: job.c,v 1.321 2020/11/14 14:16:01 rillig Exp $"); /* A shell defines how the commands are run. All commands for a target are * written into a single file, which is then given to the shell to execute @@ -1051,11 +1051,9 @@ JobFinish(Job *job, int status) #ifdef USE_META if (useMeta) { - int x; - - if ((x = meta_job_finish(job)) != 0 && status == 0) { - status = x; - } + int meta_status = meta_job_finish(job); + if (meta_status != 0 && status == 0) + status = meta_status; } #endif @@ -1086,27 +1084,44 @@ JobFinish(Job *job, int status) job->status = JOB_ST_FREE; } -/* - * Set aborting if any error. - */ -if (errors && !opts.keepgoing && (aborting != ABORT_INTERRUPT)) { - /* - * If we found any errors in this batch of children and the -k flag - * wasn't given, we set the aborting flag so no more jobs get - * started. - */ - aborting = ABORT_ERROR; -} +if (errors > 0 && !opts.keepgoing && aborting != ABORT_INTERRUPT) + aborting = ABORT_ERROR; /* Prevent more jobs from getting started. */ if (return_job_token) Job_TokenReturn(); -if (aborting == ABORT_ERROR && jobTokensRunning == 0) { - /* - * If we are aborting and the job table is now empty, we finish. - */ +if (aborting == ABORT_ERROR && jobTokensRunning == 0) Finish(errors); +} + +static void +TouchRegular(GNode *gn) +{ +const char *file = GNode_Path(gn); +struct utimbuf times = { now, now }; +int fd; +char c; + +if (utime(file, ×) >= 0) + return; + +fd = open(file, O_RDWR | O_CREAT, 0666); +if (fd < 0) { + (void)fprintf(stdout, "*** couldn't touch %s: %s", + file, strerror(errno)); + (void)fflush(stdout); + return;/* XXX: What about propagating the error? */ } + +/* Last resort: update the file's time stamps in the traditional way. + * XXX: This doesn't work for empty files, which are sometimes used + * as marker files. */ +if (read(fd, &c, 1) == 1) { + (void)lseek(fd, 0, SEEK_SET); + while (write(fd, &c, 1) == -1 && errno == EAGAIN) + continue; +} +(void)close(fd); /* XXX: What about propagating the error? */ } /* Touch the given target. Called by JobStart when the -t flag was given. @@ -1116,15 +1131,9 @@ JobFinish(Job *job, int status) void Job_Touch(GNode *gn, Boolean silent) { -int streamID; /* ID of stream opened to do the touch */ -struct utimbuf times; /* Times for utime() call */ - if (gn->type & (OP_JOIN|OP_USE|OP_USEBEFORE|OP_EXEC|OP_OPTIONAL| OP_SPECIAL|OP_PHONY)) { - /*
CVS commit: src/usr.bin/make/unit-tests
Module Name:src Committed By: rillig Date: Sat Nov 14 14:13:09 UTC 2020 Modified Files: src/usr.bin/make/unit-tests: opt-touch.exp opt-touch.mk Log Message: make(1): add test for touching a .MAKE target To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/opt-touch.exp cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/opt-touch.mk 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/make/unit-tests/opt-touch.exp diff -u src/usr.bin/make/unit-tests/opt-touch.exp:1.2 src/usr.bin/make/unit-tests/opt-touch.exp:1.3 --- src/usr.bin/make/unit-tests/opt-touch.exp:1.2 Sat Nov 14 13:59:58 2020 +++ src/usr.bin/make/unit-tests/opt-touch.exp Sat Nov 14 14:13:09 2020 @@ -1,3 +1,4 @@ `opt-touch-join' is up to date. `opt-touch-use' is up to date. +: Making opt-touch-make. exit status 0 Index: src/usr.bin/make/unit-tests/opt-touch.mk diff -u src/usr.bin/make/unit-tests/opt-touch.mk:1.3 src/usr.bin/make/unit-tests/opt-touch.mk:1.4 --- src/usr.bin/make/unit-tests/opt-touch.mk:1.3 Sat Nov 14 13:59:58 2020 +++ src/usr.bin/make/unit-tests/opt-touch.mk Sat Nov 14 14:13:09 2020 @@ -1,8 +1,8 @@ -# $NetBSD: opt-touch.mk,v 1.3 2020/11/14 13:59:58 rillig Exp $ +# $NetBSD: opt-touch.mk,v 1.4 2020/11/14 14:13:09 rillig Exp $ # # Tests for the -t command line option. -.MAKEFLAGS: -t opt-touch-phony opt-touch-join opt-touch-use +.MAKEFLAGS: -t opt-touch-phony opt-touch-join opt-touch-use opt-touch-make opt-touch-phony: .PHONY : Making $@. @@ -13,6 +13,9 @@ opt-touch-join: .JOIN opt-touch-use: .USE : Making use of $@. +opt-touch-make: .MAKE + : Making $@. + .END: @files=$$(ls opt-touch-* 2>/dev/null | grep -v -e '\.' -e '\*'); \ [ -z "$$files" ] || { echo "created files: $$files" 1>&2; exit 1; }
CVS commit: src/usr.bin/make/unit-tests
Module Name:src Committed By: rillig Date: Sat Nov 14 13:59:58 UTC 2020 Modified Files: src/usr.bin/make/unit-tests: opt-touch.exp opt-touch.mk Log Message: make(1): add test for the command line option -t To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/usr.bin/make/unit-tests/opt-touch.exp cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/opt-touch.mk 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/make/unit-tests/opt-touch.exp diff -u src/usr.bin/make/unit-tests/opt-touch.exp:1.1 src/usr.bin/make/unit-tests/opt-touch.exp:1.2 --- src/usr.bin/make/unit-tests/opt-touch.exp:1.1 Sun Aug 16 12:07:51 2020 +++ src/usr.bin/make/unit-tests/opt-touch.exp Sat Nov 14 13:59:58 2020 @@ -1 +1,3 @@ +`opt-touch-join' is up to date. +`opt-touch-use' is up to date. exit status 0 Index: src/usr.bin/make/unit-tests/opt-touch.mk diff -u src/usr.bin/make/unit-tests/opt-touch.mk:1.2 src/usr.bin/make/unit-tests/opt-touch.mk:1.3 --- src/usr.bin/make/unit-tests/opt-touch.mk:1.2 Sun Aug 16 14:25:16 2020 +++ src/usr.bin/make/unit-tests/opt-touch.mk Sat Nov 14 13:59:58 2020 @@ -1,8 +1,18 @@ -# $NetBSD: opt-touch.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $ +# $NetBSD: opt-touch.mk,v 1.3 2020/11/14 13:59:58 rillig Exp $ # # Tests for the -t command line option. -# TODO: Implementation +.MAKEFLAGS: -t opt-touch-phony opt-touch-join opt-touch-use -all: - @:; +opt-touch-phony: .PHONY + : Making $@. + +opt-touch-join: .JOIN + : Making $@. + +opt-touch-use: .USE + : Making use of $@. + +.END: + @files=$$(ls opt-touch-* 2>/dev/null | grep -v -e '\.' -e '\*'); \ + [ -z "$$files" ] || { echo "created files: $$files" 1>&2; exit 1; }
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sat Nov 14 13:45:34 UTC 2020 Modified Files: src/usr.bin/make: job.c Log Message: make(1): rename JobClose to JobClosePipes, remove confusing comments The comments referred to w_status, which had been there in 1993, but not anymore. Several other details were outdated as well. To generate a diff of this commit: cvs rdiff -u -r1.319 -r1.320 src/usr.bin/make/job.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.bin/make/job.c diff -u src/usr.bin/make/job.c:1.319 src/usr.bin/make/job.c:1.320 --- src/usr.bin/make/job.c:1.319 Sat Nov 14 13:27:01 2020 +++ src/usr.bin/make/job.c Sat Nov 14 13:45:34 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: job.c,v 1.319 2020/11/14 13:27:01 rillig Exp $ */ +/* $NetBSD: job.c,v 1.320 2020/11/14 13:45:34 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -143,7 +143,7 @@ #include "trace.h" /* "@(#)job.c 8.2 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: job.c,v 1.319 2020/11/14 13:27:01 rillig Exp $"); +MAKE_RCSID("$NetBSD: job.c,v 1.320 2020/11/14 13:45:34 rillig Exp $"); /* A shell defines how the commands are run. All commands for a target are * written into a single file, which is then given to the shell to execute @@ -720,7 +720,7 @@ JobPrintln(Job *job, const char *line) * If the command is just "..." we take all future commands for this * job to be commands to be executed once the entire graph has been * made and return non-zero to signal that the end of the commands - * was reached. These commands are later attached to the postCommands + * was reached. These commands are later attached to the .END * node and executed by Job_End when all things are done. * * Side Effects: @@ -936,7 +936,7 @@ JobSaveCommands(Job *job) /* Called to close both input and output pipes when a job is finished. */ static void -JobClose(Job *job) +JobClosePipes(Job *job) { clearfd(job); (void)close(job->outPipe); @@ -947,28 +947,17 @@ JobClose(Job *job) job->inPipe = -1; } -/*- - *--- - * JobFinish -- - * Do final processing for the given job including updating - * parents and starting new jobs as available/necessary. Note - * that we pay no attention to the JOB_IGNERR flag here. - * This is because when we're called because of a noexecute flag - * or something, jstat.w_status is 0 and when called from - * Job_CatchChildren, the status is zeroed if it s/b ignored. +/* Do final processing for the given job including updating parent nodes and + * starting new jobs as available/necessary. + * + * Deferred commands for the job are placed on the .END node. + * + * If there was a serious error (errors != 0; not an ignored one), no more + * jobs will be started. * * Input: * job job to finish * status sub-why job went away - * - * Side Effects: - * Final commands for the job are placed on postCommands. - * - * If we got an error and are aborting (aborting == ABORT_ERROR) and - * the job list is now empty, we are done for the day. - * If we recognized an error (errors !=0), we set the aborting flag - * to ABORT_ERROR so no more jobs will be started. - *--- */ static void JobFinish(Job *job, int status) @@ -990,7 +979,7 @@ JobFinish(Job *job, int status) * cases, finish out the job's output before printing the exit * status... */ - JobClose(job); + JobClosePipes(job); if (job->cmdFILE != NULL && job->cmdFILE != stdout) { (void)fclose(job->cmdFILE); job->cmdFILE = NULL; @@ -999,19 +988,11 @@ JobFinish(Job *job, int status) } else if (WIFEXITED(status)) { /* * Deal with ignored errors in -B mode. We need to print a message - * telling of the ignored error as well as setting status.w_status - * to 0 so the next command gets run. To do this, we set done to be - * TRUE if in -B mode and the job exited non-zero. + * telling of the ignored error as well as to run the next command. + * */ done = WEXITSTATUS(status) != 0; - /* - * Old comment said: "Note we don't - * want to close down any of the streams until we know we're at the - * end." - * But we do. Otherwise when are we going to print the rest of the - * stuff? - */ - JobClose(job); + JobClosePipes(job); } else { /* * No need to close things down or anything.
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sat Nov 14 13:27:02 UTC 2020 Modified Files: src/usr.bin/make: job.c job.h Log Message: make(1): fix grammar: setup -> set up To generate a diff of this commit: cvs rdiff -u -r1.318 -r1.319 src/usr.bin/make/job.c cvs rdiff -u -r1.62 -r1.63 src/usr.bin/make/job.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/make/job.c diff -u src/usr.bin/make/job.c:1.318 src/usr.bin/make/job.c:1.319 --- src/usr.bin/make/job.c:1.318 Sat Nov 14 13:07:39 2020 +++ src/usr.bin/make/job.c Sat Nov 14 13:27:01 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: job.c,v 1.318 2020/11/14 13:07:39 rillig Exp $ */ +/* $NetBSD: job.c,v 1.319 2020/11/14 13:27:01 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -143,7 +143,7 @@ #include "trace.h" /* "@(#)job.c 8.2 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: job.c,v 1.318 2020/11/14 13:07:39 rillig Exp $"); +MAKE_RCSID("$NetBSD: job.c,v 1.319 2020/11/14 13:27:01 rillig Exp $"); /* A shell defines how the commands are run. All commands for a target are * written into a single file, which is then given to the shell to execute @@ -169,7 +169,7 @@ MAKE_RCSID("$NetBSD: job.c,v 1.318 2020/ * status. Finally errExit is a printf template for running the command and * causing the shell to exit on error. If any of these strings are empty when * hasErrCtl is FALSE, the command will be executed anyway as is, and if it - * causes an error, so be it. Any templates setup to echo the command will + * causes an error, so be it. Any templates set up to echo the command will * escape any '$ ` \ "' characters in the command string to avoid common * problems with echo "%s\n" as a template. * @@ -846,7 +846,7 @@ JobPrintCommand(Job *job, char *cmd) /* * If errors are being checked and the shell doesn't have error control - * but does supply an errExit template, then setup commands to run + * but does supply an errExit template, then set up commands to run * through it. */ @@ -1513,7 +1513,7 @@ JobStart(GNode *gn, JobFlags flags) memset(job, 0, sizeof *job); job->node = gn; job->tailCmds = NULL; -job->status = JOB_ST_SETUP; +job->status = JOB_ST_SET_UP; if (gn->type & OP_SPECIAL) flags |= JOB_SPECIAL; Index: src/usr.bin/make/job.h diff -u src/usr.bin/make/job.h:1.62 src/usr.bin/make/job.h:1.63 --- src/usr.bin/make/job.h:1.62 Sat Nov 14 12:38:06 2020 +++ src/usr.bin/make/job.h Sat Nov 14 13:27:01 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: job.h,v 1.62 2020/11/14 12:38:06 rillig Exp $ */ +/* $NetBSD: job.h,v 1.63 2020/11/14 13:27:01 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -119,7 +119,7 @@ struct pollfd; typedef enum JobStatus { JOB_ST_FREE = 0, /* Job is available */ -JOB_ST_SETUP = 1, /* Job is allocated but otherwise invalid */ +JOB_ST_SET_UP = 1, /* Job is allocated but otherwise invalid */ /* XXX: What about the 2? */ JOB_ST_RUNNING = 3, /* Job is running, pid valid */ JOB_ST_FINISHED = 4 /* Job is done (ie after SIGCHILD) */
CVS commit: src/usr.bin/make/unit-tests
Module Name:src Committed By: rillig Date: Sat Nov 14 13:17:47 UTC 2020 Modified Files: src/usr.bin/make/unit-tests: job-flags.exp job-flags.mk Log Message: make(1): test ignoring errors from shell commands in jobs mode To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/usr.bin/make/unit-tests/job-flags.exp \ src/usr.bin/make/unit-tests/job-flags.mk 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/make/unit-tests/job-flags.exp diff -u src/usr.bin/make/unit-tests/job-flags.exp:1.1 src/usr.bin/make/unit-tests/job-flags.exp:1.2 --- src/usr.bin/make/unit-tests/job-flags.exp:1.1 Sat Nov 7 20:01:17 2020 +++ src/usr.bin/make/unit-tests/job-flags.exp Sat Nov 14 13:17:47 2020 @@ -4,5 +4,9 @@ ignore true in ignore false in ignore *** [ignore] Error code 1 (ignored) +false without indentation +false space +false tab +*** [ignore-cmds] Error code 1 (ignored) .END exit status 0 Index: src/usr.bin/make/unit-tests/job-flags.mk diff -u src/usr.bin/make/unit-tests/job-flags.mk:1.1 src/usr.bin/make/unit-tests/job-flags.mk:1.2 --- src/usr.bin/make/unit-tests/job-flags.mk:1.1 Sat Nov 7 20:01:17 2020 +++ src/usr.bin/make/unit-tests/job-flags.mk Sat Nov 14 13:17:47 2020 @@ -1,23 +1,32 @@ -# $NetBSD: job-flags.mk,v 1.1 2020/11/07 20:01:17 rillig Exp $ +# $NetBSD: job-flags.mk,v 1.2 2020/11/14 13:17:47 rillig Exp $ # # Tests for Job.flags, which are controlled by special source dependencies # like .SILENT or .IGNORE, as well as the command line options -s or -i. .MAKEFLAGS: -j1 -all: silent .WAIT ignore +all: silent .WAIT ignore .WAIT ignore-cmds .BEGIN: @echo $@ -silent: .SILENT +silent: .SILENT .PHONY echo $@ -ignore: .IGNORE +ignore: .IGNORE .PHONY @echo $@ true in $@ false in $@ @echo 'Still there in $@' +ignore-cmds: .PHONY + # This node is not marked .IGNORE; individual commands can be switched + # to ignore mode by prefixing them with a '-'. + -false without indentation + # This also works if the '-' is indented by a space or a tab. + # Leading whitespace is stripped off by ParseLine_ShellCommand. + -false space + -false tab + .END: @echo $@
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sat Nov 14 13:07:39 UTC 2020 Modified Files: src/usr.bin/make: job.c Log Message: make(1): replace macro DBPRINTF with JobPrintln This macro had been bad in several ways. Its name started with DB, an unnecessary abbreviation for DEBUG. Many places that used this macro used it with the same format string, "%s\n". This format string can better be expressed in a function name, JobPrintln. Only in a few places was the macro used with different format strings. The one for "set -x" was even forced to arbitrarily separate the argument from the format string in order to match the expected macro parameters. A better choice would have been to use the standard form "%s\n", "set -x" from the beginning. Anyway, that call is calling JobPrintln as well now. The remaining templates are user-specified, and if anyone should ever define a completely custom shell with echo handling and error handling enabled, they will easily crash make when the templates don't contain exactly one %s conversion. That's the responsibility of the user, and it has always been. To generate a diff of this commit: cvs rdiff -u -r1.317 -r1.318 src/usr.bin/make/job.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.bin/make/job.c diff -u src/usr.bin/make/job.c:1.317 src/usr.bin/make/job.c:1.318 --- src/usr.bin/make/job.c:1.317 Sat Nov 14 12:38:06 2020 +++ src/usr.bin/make/job.c Sat Nov 14 13:07:39 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: job.c,v 1.317 2020/11/14 12:38:06 rillig Exp $ */ +/* $NetBSD: job.c,v 1.318 2020/11/14 13:07:39 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -143,7 +143,7 @@ #include "trace.h" /* "@(#)job.c 8.2 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: job.c,v 1.317 2020/11/14 12:38:06 rillig Exp $"); +MAKE_RCSID("$NetBSD: job.c,v 1.318 2020/11/14 13:07:39 rillig Exp $"); /* A shell defines how the commands are run. All commands for a target are * written into a single file, which is then given to the shell to execute @@ -692,6 +692,22 @@ EscapeShellDblQuot(const char *cmd) return esc; } +static void +JobPrintf(Job *job, const char *fmt, const char *arg) +{ +if (DEBUG(JOB)) + debug_printf(fmt, arg); + +(void)fprintf(job->cmdFILE, fmt, arg); +(void)fflush(job->cmdFILE); +} + +static void +JobPrintln(Job *job, const char *line) +{ +JobPrintf(job, "%s\n", line); +} + /*- *--- * JobPrintCommand -- @@ -733,12 +749,6 @@ JobPrintCommand(Job *job, char *cmd) noSpecials = !GNode_ShouldExecute(job->node); -#define DBPRINTF(fmt, arg) if (DEBUG(JOB)) { \ - debug_printf(fmt, arg); \ -} \ -(void)fprintf(job->cmdFILE, fmt, arg); \ -(void)fflush(job->cmdFILE); - numCommands++; Var_Subst(cmd, job->node, VARE_WANTRES, &cmd); @@ -771,7 +781,7 @@ JobPrintCommand(Job *job, char *cmd) if (shutUp) { if (!(job->flags & JOB_SILENT) && !noSpecials && (commandShell->hasEchoCtl)) { - DBPRINTF("%s\n", commandShell->echoOff); + JobPrintln(job, commandShell->echoOff); } else { if (commandShell->hasErrCtl) shutUp = FALSE; @@ -791,11 +801,11 @@ JobPrintCommand(Job *job, char *cmd) */ if (!(job->flags & JOB_SILENT) && !shutUp && (commandShell->hasEchoCtl)) { - DBPRINTF("%s\n", commandShell->echoOff); - DBPRINTF("%s\n", commandShell->errOffOrExecIgnore); - DBPRINTF("%s\n", commandShell->echoOn); + JobPrintln(job, commandShell->echoOff); + JobPrintln(job, commandShell->errOffOrExecIgnore); + JobPrintln(job, commandShell->echoOn); } else { - DBPRINTF("%s\n", commandShell->errOffOrExecIgnore); + JobPrintln(job, commandShell->errOffOrExecIgnore); } } else if (commandShell->errOffOrExecIgnore && commandShell->errOffOrExecIgnore[0] != '\0') { @@ -811,14 +821,13 @@ JobPrintCommand(Job *job, char *cmd) job->flags |= JOB_IGNERR; if (!(job->flags & JOB_SILENT) && !shutUp) { if (commandShell->hasEchoCtl) { - DBPRINTF("%s\n", commandShell->echoOff); + JobPrintln(job, commandShell->echoOff); } - DBPRINTF(commandShell->errOnOrEcho, escCmd); + JobPrintf(job, commandShell->errOnOrEcho, escCmd); shutUp = TRUE; } else { - if (!shutUp) { - DBPRINTF(commandShell->errOnOrEcho, escCmd); - } + if (!shutUp) + JobPrintf(job, commandShell->errOnOrEcho, escCmd); } cmdTemplate = commandShell->errOffOrExecIgnore; /* @@ -844,10 +853,9 @@ JobPrintCommand(Job *job, char *cmd) if (!commandShell->hasErrCtl && commandShell->errExit && commandShell->errExit[0] != '\0') { if (!(job->flags & JOB_SILENT) && !shutUp) { - if (commandShell->hasEchoCtl) { - DBPRINTF("%s\n", commandShell->echoOff); - } - DBPRINTF(commandShell->errOnOrEch
CVS commit: src/sys/arch/riscv/riscv
Module Name:src Committed By: skrll Date: Sat Nov 14 13:05:14 UTC 2020 Modified Files: src/sys/arch/riscv/riscv: trap.c Log Message: Improve dump_trapframe output layout and fix printing of s6/s7 To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/sys/arch/riscv/riscv/trap.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/arch/riscv/riscv/trap.c diff -u src/sys/arch/riscv/riscv/trap.c:1.13 src/sys/arch/riscv/riscv/trap.c:1.14 --- src/sys/arch/riscv/riscv/trap.c:1.13 Wed Nov 4 20:04:01 2020 +++ src/sys/arch/riscv/riscv/trap.c Sat Nov 14 13:05:14 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: trap.c,v 1.13 2020/11/04 20:04:01 skrll Exp $ */ +/* $NetBSD: trap.c,v 1.14 2020/11/14 13:05:14 skrll Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -34,7 +34,7 @@ #define __PMAP_PRIVATE #define __UFETCHSTORE_PRIVATE -__RCSID("$NetBSD: trap.c,v 1.13 2020/11/04 20:04:01 skrll Exp $"); +__RCSID("$NetBSD: trap.c,v 1.14 2020/11/14 13:05:14 skrll Exp $"); #include #include @@ -167,32 +167,32 @@ dump_trapframe(const struct trapframe *t && causenames[tf->tf_cause] != NULL) causestr = causenames[tf->tf_cause]; (*pr)("Trapframe @ %p " - "(cause=%d (%s), status=%#x, pc=%#16"PRIxREGISTER - ", va=%#"PRIxREGISTER"):\n", + "(cause=%d (%s), status=%#x, pc=%#18" PRIxREGISTER + ", va=%#" PRIxREGISTER "):\n", tf, tf->tf_cause, causestr, tf->tf_sr, tf->tf_pc, tf->tf_tval); - (*pr)("ra=%#16"PRIxREGISTER", sp=%#16"PRIxREGISTER - ", gp=%#16"PRIxREGISTER", tp=%#16"PRIxREGISTER"\n", + (*pr)("ra =%#18" PRIxREGISTER ", sp =%#18" PRIxREGISTER + ", gp =%#18" PRIxREGISTER ", tp =%#18" PRIxREGISTER "\n", tf->tf_ra, tf->tf_sp, tf->tf_gp, tf->tf_tp); - (*pr)("s0=%#16"PRIxREGISTER", s1=%#16"PRIxREGISTER - ", s2=%#16"PRIxREGISTER", s3=%#16"PRIxREGISTER"\n", + (*pr)("s0 =%#18" PRIxREGISTER ", s1 =%#18" PRIxREGISTER + ", s2 =%#18" PRIxREGISTER ", s3 =%#18" PRIxREGISTER "\n", tf->tf_s0, tf->tf_s1, tf->tf_s2, tf->tf_s3); - (*pr)("s4=%#16"PRIxREGISTER", s5=%#16"PRIxREGISTER - ", s5=%#16"PRIxREGISTER", s3=%#16"PRIxREGISTER"\n", - tf->tf_s4, tf->tf_s5, tf->tf_s2, tf->tf_s3); - (*pr)("s8=%#16"PRIxREGISTER", s9=%#16"PRIxREGISTER - ", s10=%#16"PRIxREGISTER", s11=%#16"PRIxREGISTER"\n", + (*pr)("s4 =%#18" PRIxREGISTER ", s5 =%#18" PRIxREGISTER + ", s6 =%#18" PRIxREGISTER ", s7 =%#18" PRIxREGISTER "\n", + tf->tf_s4, tf->tf_s5, tf->tf_s6, tf->tf_s7); + (*pr)("s8 =%#18" PRIxREGISTER ", s9 =%#18" PRIxREGISTER + ", s10=%#18" PRIxREGISTER ", s11=%#18" PRIxREGISTER "\n", tf->tf_s8, tf->tf_s9, tf->tf_s10, tf->tf_s11); - (*pr)("a0=%#16"PRIxREGISTER", a1=%#16"PRIxREGISTER - ", a2=%#16"PRIxREGISTER", a3=%#16"PRIxREGISTER"\n", + (*pr)("a0 =%#18" PRIxREGISTER ", a1 =%#18" PRIxREGISTER + ", a2 =%#18" PRIxREGISTER ", a3 =%#18" PRIxREGISTER "\n", tf->tf_a0, tf->tf_a1, tf->tf_a2, tf->tf_a3); - (*pr)("a4=%#16"PRIxREGISTER", a5=%#16"PRIxREGISTER - ", a5=%#16"PRIxREGISTER", a7=%#16"PRIxREGISTER"\n", + (*pr)("a4 =%#18" PRIxREGISTER ", a5 =%#18" PRIxREGISTER + ", a5 =%#18" PRIxREGISTER ", a7 =%#18" PRIxREGISTER "\n", tf->tf_a4, tf->tf_a5, tf->tf_a6, tf->tf_a7); - (*pr)("t0=%#16"PRIxREGISTER", t1=%#16"PRIxREGISTER - ", t2=%#16"PRIxREGISTER", t3=%#16"PRIxREGISTER"\n", + (*pr)("t0 =%#18" PRIxREGISTER ", t1 =%#18" PRIxREGISTER + ", t2 =%#18" PRIxREGISTER ", t3 =%#18" PRIxREGISTER "\n", tf->tf_t0, tf->tf_t1, tf->tf_t2, tf->tf_t3); - (*pr)("t4=%#16"PRIxREGISTER", t5=%#16"PRIxREGISTER - ", t6=%#16"PRIxREGISTER"\n", + (*pr)("t4 =%#18" PRIxREGISTER ", t5 =%#18" PRIxREGISTER + ", t6 =%#18" PRIxREGISTER "\n", tf->tf_t4, tf->tf_t5, tf->tf_t6); }
CVS commit: [netbsd-9] src/doc
Module Name:src Committed By: martin Date: Sat Nov 14 13:03:10 UTC 2020 Modified Files: src/doc [netbsd-9]: CHANGES-9.2 Log Message: Ticket #1131 To generate a diff of this commit: cvs rdiff -u -r1.1.2.11 -r1.1.2.12 src/doc/CHANGES-9.2 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-9.2 diff -u src/doc/CHANGES-9.2:1.1.2.11 src/doc/CHANGES-9.2:1.1.2.12 --- src/doc/CHANGES-9.2:1.1.2.11 Tue Nov 10 11:45:35 2020 +++ src/doc/CHANGES-9.2 Sat Nov 14 13:03:10 2020 @@ -1,4 +1,4 @@ -# $NetBSD: CHANGES-9.2,v 1.1.2.11 2020/11/10 11:45:35 martin Exp $ +# $NetBSD: CHANGES-9.2,v 1.1.2.12 2020/11/14 13:03:10 martin Exp $ A complete list of changes from the NetBSD 9.1 release to the NetBSD 9.2 release: @@ -1078,3 +1078,9 @@ tests/net/ipsec/t_ipsec_natt.sh 1.4,1. Fix minor bugs. [knakahara, ticket #1129] +sys/coda/coda.h 1.21 (patch) +sys/coda/coda_vnops.c1.114 (patch) + + PR 55775: fix coda_readdir() to directly process the container file. + [hannken, ticket #1131] +
CVS commit: [netbsd-9] src/sys/coda
Module Name:src Committed By: martin Date: Sat Nov 14 13:01:55 UTC 2020 Modified Files: src/sys/coda [netbsd-9]: coda.h coda_vnops.c Log Message: Pull up following revision(s) (requested by hannken in ticket #1131): sys/coda/coda_vnops.c: revision 1.114 (patch) sys/coda/coda.h: revision 1.21 (patch) Rewrite coda_readdir() to directly process the container file. Passing this operation down to the file system holding the container cannot work for anything but UFS and UFS doesn't allow reading directory from a plain file since ~2015. Fixes PR kern/55775 Coda client, its in-kernel part, opens wrong files ... To generate a diff of this commit: cvs rdiff -u -r1.20 -r1.20.6.1 src/sys/coda/coda.h cvs rdiff -u -r1.107 -r1.107.4.1 src/sys/coda/coda_vnops.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/coda/coda.h diff -u src/sys/coda/coda.h:1.20 src/sys/coda/coda.h:1.20.6.1 --- src/sys/coda/coda.h:1.20 Thu Apr 19 21:50:07 2018 +++ src/sys/coda/coda.h Sat Nov 14 13:01:55 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: coda.h,v 1.20 2018/04/19 21:50:07 christos Exp $ */ +/* $NetBSD: coda.h,v 1.20.6.1 2020/11/14 13:01:55 martin Exp $ */ /* @@ -61,6 +61,10 @@ Mellon the rights to redistribute these #define CODA_MAXSYMLINKS 10 #endif +#ifndef CODA_DIRBLKSIZ +#define CODA_DIRBLKSIZ 0x1000 +#endif + #if defined(DJGPP) || defined(__CYGWIN32__) #ifdef KERNEL typedef unsigned long u_long; @@ -169,7 +173,7 @@ struct venus_dirent { #ifndef _VENUS_DIRENT_T_ #define _VENUS_DIRENT_T_ 1 struct venus_dirent { -unsigned long d_fileno; /* file number of entry */ +unsigned int d_fileno; /* file number of entry */ unsigned short d_reclen; /* length of this record */ unsigned char d_type; /* file type, see below */ unsigned char d_namlen; /* length of string in d_name */ Index: src/sys/coda/coda_vnops.c diff -u src/sys/coda/coda_vnops.c:1.107 src/sys/coda/coda_vnops.c:1.107.4.1 --- src/sys/coda/coda_vnops.c:1.107 Tue Nov 20 19:05:25 2018 +++ src/sys/coda/coda_vnops.c Sat Nov 14 13:01:55 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: coda_vnops.c,v 1.107 2018/11/20 19:05:25 christos Exp $ */ +/* $NetBSD: coda_vnops.c,v 1.107.4.1 2020/11/14 13:01:55 martin Exp $ */ /* * @@ -46,7 +46,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: coda_vnops.c,v 1.107 2018/11/20 19:05:25 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: coda_vnops.c,v 1.107.4.1 2020/11/14 13:01:55 martin Exp $"); #include #include @@ -62,6 +62,7 @@ __KERNEL_RCSID(0, "$NetBSD: coda_vnops.c #include #include #include +#include #include #include @@ -1526,70 +1527,143 @@ int coda_readdir(void *v) { /* true args */ -struct vop_readdir_args *ap = v; -vnode_t *vp = ap->a_vp; -struct cnode *cp = VTOC(vp); -struct uio *uiop = ap->a_uio; -kauth_cred_t cred = ap->a_cred; -int *eofflag = ap->a_eofflag; -off_t **cookies = ap->a_cookies; -int *ncookies = ap->a_ncookies; + struct vop_readdir_args *ap = v; + vnode_t *vp = ap->a_vp; + struct cnode *cp = VTOC(vp); + struct uio *uiop = ap->a_uio; + kauth_cred_t cred = ap->a_cred; + int *eofflag = ap->a_eofflag; /* upcall decl */ /* locals */ -int error = 0; -enum vtype saved_type; - -MARK_ENTRY(CODA_READDIR_STATS); - -CODADEBUG(CODA_READDIR, myprintf(("%s: (%p, %lu, %lld)\n", __func__, - uiop->uio_iov->iov_base, (unsigned long) uiop->uio_resid, - (long long) uiop->uio_offset)); ) - -/* Check for readdir of control object. */ -if (IS_CTL_VP(vp)) { - MARK_INT_FAIL(CODA_READDIR_STATS); - return(ENOENT); -} + size_t initial_resid = uiop->uio_resid; + int error = 0; + int opened_internally = 0; + int ncookies; + char *buf; + struct vnode *cvp; + struct dirent *dirp; + + MARK_ENTRY(CODA_READDIR_STATS); + + CODADEBUG(CODA_READDIR, myprintf(("%s: (%p, %lu, %lld)\n", __func__, + uiop->uio_iov->iov_base, (unsigned long) uiop->uio_resid, + (long long) uiop->uio_offset)); ) -{ - /* Redirect the request to UFS. */ + /* Check for readdir of control object. */ + if (IS_CTL_VP(vp)) { + MARK_INT_FAIL(CODA_READDIR_STATS); + return ENOENT; + } /* If directory is not already open do an "internal open" on it. */ - int opened_internally = 0; if (cp->c_ovp == NULL) { - opened_internally = 1; - MARK_INT_GEN(CODA_OPEN_STATS); - error = VOP_OPEN(vp, FREAD, cred); + opened_internally = 1; + MARK_INT_GEN(CODA_OPEN_STATS); + error = VOP_OPEN(vp, FREAD, cred); #ifdef CODA_VERBOSE - printf("%s: Internally Opening %p\n", __func__, vp); + printf("%s: Internally Opening %p\n", __func__, vp); #endif - if (error) return(error); - } else - vp = cp->c_ovp; + if (error) + return error; + KASSERT(cp->c_ovp != NULL); + } + cvp = cp->c_ovp; - /* Have UFS handle the call. */ CODADEBUG(CODA_READDIR, myprintf(("%s: fid = %s, refcnt = %d\n", - __func__,
CVS commit: [netbsd-8] src/doc
Module Name:src Committed By: martin Date: Sat Nov 14 12:59:56 UTC 2020 Modified Files: src/doc [netbsd-8]: CHANGES-8.3 Log Message: Ticket #1622 To generate a diff of this commit: cvs rdiff -u -r1.1.2.48 -r1.1.2.49 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.48 src/doc/CHANGES-8.3:1.1.2.49 --- src/doc/CHANGES-8.3:1.1.2.48 Wed Nov 4 11:52:47 2020 +++ src/doc/CHANGES-8.3 Sat Nov 14 12:59:56 2020 @@ -1,4 +1,4 @@ -# $NetBSD: CHANGES-8.3,v 1.1.2.48 2020/11/04 11:52:47 martin Exp $ +# $NetBSD: CHANGES-8.3,v 1.1.2.49 2020/11/14 12:59:56 martin Exp $ A complete list of changes from the NetBSD 8.2 release to the NetBSD 8.3 release: @@ -1313,4 +1313,9 @@ sys/dev/pci/if_wmvar.h1.47 (ICH*/PCH*, 82580 and I350). [knakahara, ticket #1620] +sys/coda/coda.h 1.21 (patch) +sys/coda/coda_vnops.c1.114 (patch) + + PR 55775: fix coda_readdir() to directly process the container file. + [hannken, ticket #1622]
CVS commit: [netbsd-8] src/sys/coda
Module Name:src Committed By: martin Date: Sat Nov 14 12:59:06 UTC 2020 Modified Files: src/sys/coda [netbsd-8]: coda.h coda_vnops.c Log Message: Pull up following revision(s) (requested by hannken in ticket #1622): sys/coda/coda_vnops.c: revision 1.114 (patch) sys/coda/coda.h: revision 1.21 (patch) Rewrite coda_readdir() to directly process the container file. Passing this operation down to the file system holding the container cannot work for anything but UFS and UFS doesn't allow reading directory from a plain file since ~2015. Fixes PR kern/55775 Coda client, its in-kernel part, opens wrong files ... To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.19.10.1 src/sys/coda/coda.h cvs rdiff -u -r1.106 -r1.106.2.1 src/sys/coda/coda_vnops.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/coda/coda.h diff -u src/sys/coda/coda.h:1.19 src/sys/coda/coda.h:1.19.10.1 --- src/sys/coda/coda.h:1.19 Sun Sep 6 06:00:59 2015 +++ src/sys/coda/coda.h Sat Nov 14 12:59:06 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: coda.h,v 1.19 2015/09/06 06:00:59 dholland Exp $ */ +/* $NetBSD: coda.h,v 1.19.10.1 2020/11/14 12:59:06 martin Exp $ */ /* @@ -61,6 +61,10 @@ Mellon the rights to redistribute these #define CODA_MAXSYMLINKS 10 #endif +#ifndef CODA_DIRBLKSIZ +#define CODA_DIRBLKSIZ 0x1000 +#endif + #if defined(DJGPP) || defined(__CYGWIN32__) #ifdef KERNEL typedef unsigned long u_long; @@ -169,7 +173,7 @@ struct venus_dirent { #ifndef _VENUS_DIRENT_T_ #define _VENUS_DIRENT_T_ 1 struct venus_dirent { -unsigned long d_fileno; /* file number of entry */ +unsigned int d_fileno; /* file number of entry */ unsigned short d_reclen; /* length of this record */ unsigned char d_type; /* file type, see below */ unsigned char d_namlen; /* length of string in d_name */ Index: src/sys/coda/coda_vnops.c diff -u src/sys/coda/coda_vnops.c:1.106 src/sys/coda/coda_vnops.c:1.106.2.1 --- src/sys/coda/coda_vnops.c:1.106 Fri May 26 14:21:00 2017 +++ src/sys/coda/coda_vnops.c Sat Nov 14 12:59:06 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: coda_vnops.c,v 1.106 2017/05/26 14:21:00 riastradh Exp $ */ +/* $NetBSD: coda_vnops.c,v 1.106.2.1 2020/11/14 12:59:06 martin Exp $ */ /* * @@ -46,7 +46,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: coda_vnops.c,v 1.106 2017/05/26 14:21:00 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: coda_vnops.c,v 1.106.2.1 2020/11/14 12:59:06 martin Exp $"); #include #include @@ -62,6 +62,7 @@ __KERNEL_RCSID(0, "$NetBSD: coda_vnops.c #include #include #include +#include #include #include @@ -1526,63 +1527,143 @@ int coda_readdir(void *v) { /* true args */ -struct vop_readdir_args *ap = v; -vnode_t *vp = ap->a_vp; -struct cnode *cp = VTOC(vp); -struct uio *uiop = ap->a_uio; -kauth_cred_t cred = ap->a_cred; -int *eofflag = ap->a_eofflag; -off_t **cookies = ap->a_cookies; -int *ncookies = ap->a_ncookies; + struct vop_readdir_args *ap = v; + vnode_t *vp = ap->a_vp; + struct cnode *cp = VTOC(vp); + struct uio *uiop = ap->a_uio; + kauth_cred_t cred = ap->a_cred; + int *eofflag = ap->a_eofflag; /* upcall decl */ /* locals */ -int error = 0; - -MARK_ENTRY(CODA_READDIR_STATS); - -CODADEBUG(CODA_READDIR, myprintf(("%s: (%p, %lu, %lld)\n", __func__, - uiop->uio_iov->iov_base, (unsigned long) uiop->uio_resid, - (long long) uiop->uio_offset)); ) - -/* Check for readdir of control object. */ -if (IS_CTL_VP(vp)) { - MARK_INT_FAIL(CODA_READDIR_STATS); - return(ENOENT); -} + size_t initial_resid = uiop->uio_resid; + int error = 0; + int opened_internally = 0; + int ncookies; + char *buf; + struct vnode *cvp; + struct dirent *dirp; + + MARK_ENTRY(CODA_READDIR_STATS); + + CODADEBUG(CODA_READDIR, myprintf(("%s: (%p, %lu, %lld)\n", __func__, + uiop->uio_iov->iov_base, (unsigned long) uiop->uio_resid, + (long long) uiop->uio_offset)); ) -{ - /* Redirect the request to UFS. */ + /* Check for readdir of control object. */ + if (IS_CTL_VP(vp)) { + MARK_INT_FAIL(CODA_READDIR_STATS); + return ENOENT; + } /* If directory is not already open do an "internal open" on it. */ - int opened_internally = 0; if (cp->c_ovp == NULL) { - opened_internally = 1; - MARK_INT_GEN(CODA_OPEN_STATS); - error = VOP_OPEN(vp, FREAD, cred); + opened_internally = 1; + MARK_INT_GEN(CODA_OPEN_STATS); + error = VOP_OPEN(vp, FREAD, cred); #ifdef CODA_VERBOSE - printf("%s: Internally Opening %p\n", __func__, vp); + printf("%s: Internally Opening %p\n", __func__, vp); #endif - if (error) return(error); - } else - vp = cp->c_ovp; + if (error) + return error; + KASSERT(cp->c_ovp != NULL); + } + cvp = cp->c_ovp; - /* Have UFS handle the call. */ CODADEBUG(CODA_READDIR, myprintf(("%s: fid = %s, refcnt = %d\n", - __func__, coda_f2s(&cp->c_fid),
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sat Nov 14 12:38:06 UTC 2020 Modified Files: src/usr.bin/make: job.c job.h Log Message: make(1): rename JobState to JobStatus The status is only part of the whole state of a job. To generate a diff of this commit: cvs rdiff -u -r1.316 -r1.317 src/usr.bin/make/job.c cvs rdiff -u -r1.61 -r1.62 src/usr.bin/make/job.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/make/job.c diff -u src/usr.bin/make/job.c:1.316 src/usr.bin/make/job.c:1.317 --- src/usr.bin/make/job.c:1.316 Sun Nov 8 15:07:37 2020 +++ src/usr.bin/make/job.c Sat Nov 14 12:38:06 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: job.c,v 1.316 2020/11/08 15:07:37 rillig Exp $ */ +/* $NetBSD: job.c,v 1.317 2020/11/14 12:38:06 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -143,7 +143,7 @@ #include "trace.h" /* "@(#)job.c 8.2 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: job.c,v 1.316 2020/11/08 15:07:37 rillig Exp $"); +MAKE_RCSID("$NetBSD: job.c,v 1.317 2020/11/14 12:38:06 rillig Exp $"); /* A shell defines how the commands are run. All commands for a target are * written into a single file, which is then given to the shell to execute @@ -430,7 +430,7 @@ job_table_dump(const char *where) debug_printf("job table @ %s\n", where); for (job = job_table; job < job_table_end; job++) { debug_printf("job %d, status %d, flags %d, pid %d\n", - (int)(job - job_table), job->job_state, job->flags, job->pid); + (int)(job - job_table), job->status, job->flags, job->pid); } } @@ -526,7 +526,7 @@ JobCondPassSig(int signo) DEBUG1(JOB, "JobCondPassSig(%d) called.\n", signo); for (job = job_table; job < job_table_end; job++) { - if (job->job_state != JOB_ST_RUNNING) + if (job->status != JOB_ST_RUNNING) continue; DEBUG2(JOB, "JobCondPassSig passing signal %d to child %d.\n", signo, job->pid); @@ -633,12 +633,12 @@ JobPassSig_suspend(int signo) } static Job * -JobFindPid(int pid, JobState status, Boolean isJobs) +JobFindPid(int pid, JobStatus status, Boolean isJobs) { Job *job; for (job = job_table; job < job_table_end; job++) { - if ((job->job_state == status) && job->pid == pid) + if (job->status == status && job->pid == pid) return job; } if (DEBUG(JOB) && isJobs) @@ -1092,10 +1092,10 @@ JobFinish(Job *job, int status) if (!(job->flags & JOB_SPECIAL)) return_job_token = TRUE; Make_Update(job->node); - job->job_state = JOB_ST_FREE; + job->status = JOB_ST_FREE; } else if (status != 0) { errors++; - job->job_state = JOB_ST_FREE; + job->status = JOB_ST_FREE; } /* @@ -1302,7 +1302,7 @@ JobExec(Job *job, char **argv) JobSigLock(&mask); /* Pre-emptively mark job running, pid still zero though */ -job->job_state = JOB_ST_RUNNING; +job->status = JOB_ST_RUNNING; cpid = vFork(); if (cpid == -1) @@ -1497,7 +1497,7 @@ JobStart(GNode *gn, JobFlags flags) int tfd; /* File descriptor to the temp file */ for (job = job_table; job < job_table_end; job++) { - if (job->job_state == JOB_ST_FREE) + if (job->status == JOB_ST_FREE) break; } if (job >= job_table_end) @@ -1506,7 +1506,7 @@ JobStart(GNode *gn, JobFlags flags) memset(job, 0, sizeof *job); job->node = gn; job->tailCmds = NULL; -job->job_state = JOB_ST_SETUP; +job->status = JOB_ST_SETUP; if (gn->type & OP_SPECIAL) flags |= JOB_SPECIAL; @@ -1646,7 +1646,7 @@ JobStart(GNode *gn, JobFlags flags) job->node->made = MADE; Make_Update(job->node); } - job->job_state = JOB_ST_FREE; + job->status = JOB_ST_FREE; return cmdsOK ? JOB_FINISHED : JOB_ERROR; } @@ -1961,7 +1961,7 @@ JobReapChild(pid_t pid, int status, Bool return; } -job->job_state = JOB_ST_FINISHED; +job->status = JOB_ST_FINISHED; job->exit_status = status; JobFinish(job, status); @@ -2016,7 +2016,7 @@ Job_CatchOutput(void) if (!fds[i].revents) continue; job = jobfds[i]; - if (job->job_state == JOB_ST_RUNNING) + if (job->status == JOB_ST_RUNNING) JobDoOutput(job, FALSE); #if defined(USE_FILEMON) && !defined(USE_FILEMON_DEV) /* @@ -2458,7 +2458,7 @@ JobInterrupt(int runINTERRUPT, int signo JobSigLock(&mask); for (job = job_table; job < job_table_end; job++) { - if (job->job_state != JOB_ST_RUNNING) + if (job->status != JOB_ST_RUNNING) continue; gn = job->node; @@ -2537,7 +2537,7 @@ Job_AbortAll(void) if (jobTokensRunning) { for (job = job_table; job < job_table_end; job++) { - if (job->job_state != JOB_ST_RUNNING) + if (job->status != JOB_ST_RUNNING) continue; /* * kill the child process with increasingly drastic signals to make @@ -2563,8 +2563,8 @@ JobRestartJobs(void) Job *job; for (job = job_table; job < job_
CVS commit: src/usr.sbin/envstat
Module Name:src Committed By: mlelstv Date: Sat Nov 14 12:36:50 UTC 2020 Modified Files: src/usr.sbin/envstat: envstat.8 envstat.c Log Message: Allow to select raw output for a single device or a list of sensors. To generate a diff of this commit: cvs rdiff -u -r1.63 -r1.64 src/usr.sbin/envstat/envstat.8 cvs rdiff -u -r1.98 -r1.99 src/usr.sbin/envstat/envstat.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/envstat/envstat.8 diff -u src/usr.sbin/envstat/envstat.8:1.63 src/usr.sbin/envstat/envstat.8:1.64 --- src/usr.sbin/envstat/envstat.8:1.63 Sat Nov 14 09:11:55 2020 +++ src/usr.sbin/envstat/envstat.8 Sat Nov 14 12:36:49 2020 @@ -1,4 +1,4 @@ -.\" $NetBSD: envstat.8,v 1.63 2020/11/14 09:11:55 mlelstv Exp $ +.\" $NetBSD: envstat.8,v 1.64 2020/11/14 12:36:49 mlelstv Exp $ .\" .\" Copyright (c) 2000, 2007, 2008, 2009, 2014 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -35,12 +35,16 @@ .Nd utility to handle environmental sensors .Sh SYNOPSIS .Nm -.Op Fl DfIklSTWx +.Op Fl DfIklSTW .Op Fl c Ar file .Op Fl d Ar device .Op Fl i Ar interval .Op Fl s Ar "device:sensor,..." .Op Fl w Ar width +.Nm +.Fl x +.Op Fl d Ar device +.Op Fl s Ar "device:sensor,..." .Op Ar property... .Sh DESCRIPTION .Nm @@ -143,6 +147,12 @@ and sensors. If .Ar property is specified, the value of that property is printed. +The property list can be filtered with the +.Fl d or +.Fl s +options. If +.Fl s is used with only a single sensor, only the properties +of this sensor are returned, not a list of sensors. .El .Sh UNITS The display mode may show some values with abbreviated units; @@ -205,10 +215,22 @@ To display statistics for all sensors an invalid states every second: .Pp .Dl $ envstat -ITi1 +.Pp +To return a single temperature value: +.Pp +.Dl $ envstat -s vcmbox0:temperature -x /cur-value +.Pp +To return values of multiple temperature sensors from a single device +.Pp +.Dl $ envstat -s 'thinkpad0:temperature 0,thinkpad0:temperature 1' -x /thinkpad0/0/cur-value /thinkpad0/1/cur-value +.Pp +To return values of temperature sensors from multiple devices: +.Pp +.Dl $ envstat -s 'coretemp0:cpu0 temperature,coretemp1:cpu 2 temperature' -x /coretemp0/0/cur-value /coretemp1/0/cur-value .Sh SEE ALSO .Xr units 1 , .Xr proplib 3 , -.Xr acpiacad 4 , +.r acpiacad 4 , .Xr acpibat 4 , .Xr acpitz 4 , .Xr admtemp 4 , Index: src/usr.sbin/envstat/envstat.c diff -u src/usr.sbin/envstat/envstat.c:1.98 src/usr.sbin/envstat/envstat.c:1.99 --- src/usr.sbin/envstat/envstat.c:1.98 Sat Nov 14 09:11:55 2020 +++ src/usr.sbin/envstat/envstat.c Sat Nov 14 12:36:49 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: envstat.c,v 1.98 2020/11/14 09:11:55 mlelstv Exp $ */ +/* $NetBSD: envstat.c,v 1.99 2020/11/14 12:36:49 mlelstv Exp $ */ /*- * Copyright (c) 2007, 2008 Juan Romero Pardines. @@ -27,7 +27,7 @@ #include #ifndef lint -__RCSID("$NetBSD: envstat.c,v 1.98 2020/11/14 09:11:55 mlelstv Exp $"); +__RCSID("$NetBSD: envstat.c,v 1.99 2020/11/14 12:36:49 mlelstv Exp $"); #endif /* not lint */ #include @@ -109,6 +109,7 @@ static bool statistics; static u_int header_passes; static int parse_dictionary(int); +static int add_sensors(prop_dictionary_t, prop_dictionary_t, const char *, const char *); static int send_dictionary(FILE *); static int find_sensors(prop_array_t, const char *, dvprops_t); static void print_sensors(void); @@ -219,6 +220,61 @@ int main(int argc, char **argv) if (rval) errx(EXIT_FAILURE, "%s", strerror(rval)); + if (mydevname || sensors) { + prop_dictionary_t ndict; + + ndict = prop_dictionary_create(); + if (ndict == NULL) +err(EXIT_FAILURE, "prop_dictionary_create"); + + if (mydevname) { +if (add_sensors(ndict, dict, mydevname, NULL)) + err(EXIT_FAILURE, "add_sensors"); + } + if (sensors) { +char *dvstring, *sstring, *p, *last, *s; +unsigned count = 0; + +s = strdup(sensors); +if (s == NULL) + err(EXIT_FAILURE, "strdup"); + +for ((p = strtok_r(s, ",", &last)); p; + (p = strtok_r(NULL, ",", &last))) { + /* get device name */ + dvstring = strtok(p, ":"); + if (dvstring == NULL) + errx(EXIT_FAILURE, "missing device name"); + + /* get sensor description */ + sstring = strtok(NULL, ":"); + if (sstring == NULL) + errx(EXIT_FAILURE, "missing sensor description"); + + if (add_sensors(ndict, dict, dvstring, sstring)) + err(EXIT_FAILURE, "add_sensors"); + + ++count; +} +free(s); + +/* in case we asked for a single sensor + * show only the sensor dictionary + */ +if (count == 1) { + prop_object_t obj, obj2; + + obj = prop_dictionary_get(ndict, dvstring); + obj2 = prop_array_get(obj, 0); + prop_object_release(ndict); + ndict = obj2; +} + } + + prop_object_release(dict); + dict = ndict; + } + if (argc > 0) { fo
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sat Nov 14 11:51:58 UTC 2020 Modified Files: src/usr.bin/make: dir.c Log Message: make(1): remove redundant parameter from cached_stats The hash table for the cached data depends only on the passed flags, therefore the caller does not need to know about their existence. To generate a diff of this commit: cvs rdiff -u -r1.206 -r1.207 src/usr.bin/make/dir.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.bin/make/dir.c diff -u src/usr.bin/make/dir.c:1.206 src/usr.bin/make/dir.c:1.207 --- src/usr.bin/make/dir.c:1.206 Sat Nov 14 11:22:17 2020 +++ src/usr.bin/make/dir.c Sat Nov 14 11:51:58 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: dir.c,v 1.206 2020/11/14 11:22:17 rillig Exp $ */ +/* $NetBSD: dir.c,v 1.207 2020/11/14 11:51:58 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -134,7 +134,7 @@ #include "job.h" /* "@(#)dir.c 8.2 (Berkeley) 1/2/94" */ -MAKE_RCSID("$NetBSD: dir.c,v 1.206 2020/11/14 11:22:17 rillig Exp $"); +MAKE_RCSID("$NetBSD: dir.c,v 1.207 2020/11/14 11:51:58 rillig Exp $"); #define DIR_DEBUG0(text) DEBUG0(DIR, text) #define DIR_DEBUG1(fmt, arg1) DEBUG1(DIR, fmt, arg1) @@ -318,9 +318,10 @@ typedef enum CachedStatsFlags { /* Returns 0 and the result of stat(2) or lstat(2) in *mst, or -1 on error. */ static int -cached_stats(HashTable *tbl, const char *pathname, struct make_stat *mst, +cached_stats(const char *pathname, struct make_stat *mst, CachedStatsFlags flags) { +HashTable *tbl = flags & CST_LSTAT ? &lmtimes : &mtimes; HashEntry *entry; struct stat sys_st; struct cache_st *cst; @@ -382,13 +383,13 @@ cached_stats(HashTable *tbl, const char int cached_stat(const char *pathname, struct make_stat *st) { -return cached_stats(&mtimes, pathname, st, CST_NONE); +return cached_stats(pathname, st, CST_NONE); } int cached_lstat(const char *pathname, struct make_stat *st) { -return cached_stats(&lmtimes, pathname, st, CST_LSTAT); +return cached_stats(pathname, st, CST_LSTAT); } /* Initialize the directories module. */ @@ -1356,7 +1357,7 @@ Dir_UpdateMTime(GNode *gn, Boolean reche fullName = bmake_strdup(gn->name); flags = recheck ? CST_UPDATE : CST_NONE; -if (cached_stats(&mtimes, fullName, &mst, flags) < 0) { +if (cached_stats(fullName, &mst, flags) < 0) { if (gn->type & OP_MEMBER) { if (fullName != gn->path) free(fullName);
CVS commit: src/sys/coda
Module Name:src Committed By: hannken Date: Sat Nov 14 11:42:05 UTC 2020 Modified Files: src/sys/coda: coda_vnops.c coda_vnops.h Log Message: Add coda_pathconf() always returning EINVAL. To generate a diff of this commit: cvs rdiff -u -r1.112 -r1.113 src/sys/coda/coda_vnops.c cvs rdiff -u -r1.16 -r1.17 src/sys/coda/coda_vnops.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/coda/coda_vnops.c diff -u src/sys/coda/coda_vnops.c:1.112 src/sys/coda/coda_vnops.c:1.113 --- src/sys/coda/coda_vnops.c:1.112 Sat May 16 18:31:48 2020 +++ src/sys/coda/coda_vnops.c Sat Nov 14 11:42:05 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: coda_vnops.c,v 1.112 2020/05/16 18:31:48 christos Exp $ */ +/* $NetBSD: coda_vnops.c,v 1.113 2020/11/14 11:42:05 hannken Exp $ */ /* * @@ -46,7 +46,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: coda_vnops.c,v 1.112 2020/05/16 18:31:48 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: coda_vnops.c,v 1.113 2020/11/14 11:42:05 hannken Exp $"); #include #include @@ -134,7 +134,7 @@ const struct vnodeopv_entry_desc coda_vn { &vop_strategy_desc, coda_strategy }, /* strategy */ { &vop_print_desc, coda_vop_error }, /* print */ { &vop_islocked_desc, coda_islocked }, /* islocked */ -{ &vop_pathconf_desc, coda_vop_error }, /* pathconf */ +{ &vop_pathconf_desc, coda_pathconf }, /* pathconf */ { &vop_advlock_desc, coda_vop_nop }, /* advlock */ { &vop_bwrite_desc, coda_vop_error }, /* bwrite */ { &vop_seek_desc, genfs_seek }, /* seek */ @@ -1739,6 +1739,18 @@ coda_islocked(void *v) return genfs_islocked(v); } +int +coda_pathconf(void *v) +{ + struct vop_pathconf_args *ap = v; + + switch (ap->a_name) { + default: + return EINVAL; + } + /* NOTREACHED */ +} + /* * Given a device and inode, obtain a locked vnode. One reference is * obtained and passed back to the caller. Index: src/sys/coda/coda_vnops.h diff -u src/sys/coda/coda_vnops.h:1.16 src/sys/coda/coda_vnops.h:1.17 --- src/sys/coda/coda_vnops.h:1.16 Thu Aug 2 16:06:59 2012 +++ src/sys/coda/coda_vnops.h Sat Nov 14 11:42:05 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: coda_vnops.h,v 1.16 2012/08/02 16:06:59 christos Exp $ */ +/* $NetBSD: coda_vnops.h,v 1.17 2020/11/14 11:42:05 hannken Exp $ */ /* * @@ -74,6 +74,7 @@ int coda_reclaim(void *); int coda_lock(void *); int coda_unlock(void *); int coda_islocked(void *); +int coda_pathconf(void *); int coda_vop_error(void *); int coda_vop_nop(void *); int coda_getpages(void *);
CVS commit: src/sys/coda
Module Name:src Committed By: hannken Date: Sat Nov 14 11:42:56 UTC 2020 Modified Files: src/sys/coda: coda.h coda_vnops.c Log Message: Rewrite coda_readdir() to directly process the container file. Passing this operation down to the file system holding the container cannot work for anything but UFS and UFS doesn't allow reading directory from a plain file since ~2015. Fixes PR kern/55775 Coda client, its in-kernel part, opens wrong files ... To generate a diff of this commit: cvs rdiff -u -r1.20 -r1.21 src/sys/coda/coda.h cvs rdiff -u -r1.113 -r1.114 src/sys/coda/coda_vnops.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/coda/coda.h diff -u src/sys/coda/coda.h:1.20 src/sys/coda/coda.h:1.21 --- src/sys/coda/coda.h:1.20 Thu Apr 19 21:50:07 2018 +++ src/sys/coda/coda.h Sat Nov 14 11:42:56 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: coda.h,v 1.20 2018/04/19 21:50:07 christos Exp $ */ +/* $NetBSD: coda.h,v 1.21 2020/11/14 11:42:56 hannken Exp $ */ /* @@ -61,6 +61,10 @@ Mellon the rights to redistribute these #define CODA_MAXSYMLINKS 10 #endif +#ifndef CODA_DIRBLKSIZ +#define CODA_DIRBLKSIZ 0x1000 +#endif + #if defined(DJGPP) || defined(__CYGWIN32__) #ifdef KERNEL typedef unsigned long u_long; @@ -169,7 +173,7 @@ struct venus_dirent { #ifndef _VENUS_DIRENT_T_ #define _VENUS_DIRENT_T_ 1 struct venus_dirent { -unsigned long d_fileno; /* file number of entry */ +unsigned int d_fileno; /* file number of entry */ unsigned short d_reclen; /* length of this record */ unsigned char d_type; /* file type, see below */ unsigned char d_namlen; /* length of string in d_name */ Index: src/sys/coda/coda_vnops.c diff -u src/sys/coda/coda_vnops.c:1.113 src/sys/coda/coda_vnops.c:1.114 --- src/sys/coda/coda_vnops.c:1.113 Sat Nov 14 11:42:05 2020 +++ src/sys/coda/coda_vnops.c Sat Nov 14 11:42:56 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: coda_vnops.c,v 1.113 2020/11/14 11:42:05 hannken Exp $ */ +/* $NetBSD: coda_vnops.c,v 1.114 2020/11/14 11:42:56 hannken Exp $ */ /* * @@ -46,7 +46,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: coda_vnops.c,v 1.113 2020/11/14 11:42:05 hannken Exp $"); +__KERNEL_RCSID(0, "$NetBSD: coda_vnops.c,v 1.114 2020/11/14 11:42:56 hannken Exp $"); #include #include @@ -62,6 +62,7 @@ __KERNEL_RCSID(0, "$NetBSD: coda_vnops.c #include #include #include +#include #include #include @@ -1528,70 +1529,143 @@ int coda_readdir(void *v) { /* true args */ -struct vop_readdir_args *ap = v; -vnode_t *vp = ap->a_vp; -struct cnode *cp = VTOC(vp); -struct uio *uiop = ap->a_uio; -kauth_cred_t cred = ap->a_cred; -int *eofflag = ap->a_eofflag; -off_t **cookies = ap->a_cookies; -int *ncookies = ap->a_ncookies; + struct vop_readdir_args *ap = v; + vnode_t *vp = ap->a_vp; + struct cnode *cp = VTOC(vp); + struct uio *uiop = ap->a_uio; + kauth_cred_t cred = ap->a_cred; + int *eofflag = ap->a_eofflag; /* upcall decl */ /* locals */ -int error = 0; -enum vtype saved_type; - -MARK_ENTRY(CODA_READDIR_STATS); - -CODADEBUG(CODA_READDIR, myprintf(("%s: (%p, %lu, %lld)\n", __func__, - uiop->uio_iov->iov_base, (unsigned long) uiop->uio_resid, - (long long) uiop->uio_offset)); ) - -/* Check for readdir of control object. */ -if (IS_CTL_VP(vp)) { - MARK_INT_FAIL(CODA_READDIR_STATS); - return(ENOENT); -} + size_t initial_resid = uiop->uio_resid; + int error = 0; + int opened_internally = 0; + int ncookies; + char *buf; + struct vnode *cvp; + struct dirent *dirp; + + MARK_ENTRY(CODA_READDIR_STATS); + + CODADEBUG(CODA_READDIR, myprintf(("%s: (%p, %lu, %lld)\n", __func__, + uiop->uio_iov->iov_base, (unsigned long) uiop->uio_resid, + (long long) uiop->uio_offset)); ) -{ - /* Redirect the request to UFS. */ + /* Check for readdir of control object. */ + if (IS_CTL_VP(vp)) { + MARK_INT_FAIL(CODA_READDIR_STATS); + return ENOENT; + } /* If directory is not already open do an "internal open" on it. */ - int opened_internally = 0; if (cp->c_ovp == NULL) { - opened_internally = 1; - MARK_INT_GEN(CODA_OPEN_STATS); - error = VOP_OPEN(vp, FREAD, cred); + opened_internally = 1; + MARK_INT_GEN(CODA_OPEN_STATS); + error = VOP_OPEN(vp, FREAD, cred); #ifdef CODA_VERBOSE - printf("%s: Internally Opening %p\n", __func__, vp); + printf("%s: Internally Opening %p\n", __func__, vp); #endif - if (error) return(error); - } else - vp = cp->c_ovp; + if (error) + return error; + KASSERT(cp->c_ovp != NULL); + } + cvp = cp->c_ovp; - /* Have UFS handle the call. */ CODADEBUG(CODA_READDIR, myprintf(("%s: fid = %s, refcnt = %d\n", - __func__, coda_f2s(&cp->c_fid), vrefcnt(vp))); ) - saved_type = vp->v_type; - vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); - vp->v_type = VDIR; /* pretend the container file is a dir */ - error = VOP_READDIR(vp, uiop, cred, eo
CVS commit: src/sys/coda
Module Name:src Committed By: hannken Date: Sat Nov 14 11:41:29 UTC 2020 Modified Files: src/sys/coda: coda_vfsops.c Log Message: Respect "lktype" in all paths in coda_root(). To generate a diff of this commit: cvs rdiff -u -r1.87 -r1.88 src/sys/coda/coda_vfsops.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/coda/coda_vfsops.c diff -u src/sys/coda/coda_vfsops.c:1.87 src/sys/coda/coda_vfsops.c:1.88 --- src/sys/coda/coda_vfsops.c:1.87 Fri Jan 17 20:08:06 2020 +++ src/sys/coda/coda_vfsops.c Sat Nov 14 11:41:29 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: coda_vfsops.c,v 1.87 2020/01/17 20:08:06 ad Exp $ */ +/* $NetBSD: coda_vfsops.c,v 1.88 2020/11/14 11:41:29 hannken Exp $ */ /* * @@ -45,7 +45,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: coda_vfsops.c,v 1.87 2020/01/17 20:08:06 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: coda_vfsops.c,v 1.88 2020/11/14 11:41:29 hannken Exp $"); #include #include @@ -388,7 +388,7 @@ coda_root(struct mount *vfsp, int lktype *vpp = mi->mi_rootvp; vref(*vpp); - vn_lock(*vpp, LK_EXCLUSIVE); + vn_lock(*vpp, lktype); MARK_INT_SAT(CODA_ROOT_STATS); goto exit; } else if (error == ENODEV || error == EINTR) { @@ -403,7 +403,7 @@ coda_root(struct mount *vfsp, int lktype */ *vpp = mi->mi_rootvp; vref(*vpp); - vn_lock(*vpp, LK_EXCLUSIVE); + vn_lock(*vpp, lktype); MARK_INT_FAIL(CODA_ROOT_STATS); error = 0; goto exit;
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sat Nov 14 11:22:17 UTC 2020 Modified Files: src/usr.bin/make: dir.c Log Message: make(1): clean up cached_stats No functional change. To generate a diff of this commit: cvs rdiff -u -r1.205 -r1.206 src/usr.bin/make/dir.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.bin/make/dir.c diff -u src/usr.bin/make/dir.c:1.205 src/usr.bin/make/dir.c:1.206 --- src/usr.bin/make/dir.c:1.205 Sat Nov 14 06:15:11 2020 +++ src/usr.bin/make/dir.c Sat Nov 14 11:22:17 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: dir.c,v 1.205 2020/11/14 06:15:11 rillig Exp $ */ +/* $NetBSD: dir.c,v 1.206 2020/11/14 11:22:17 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -134,7 +134,7 @@ #include "job.h" /* "@(#)dir.c 8.2 (Berkeley) 1/2/94" */ -MAKE_RCSID("$NetBSD: dir.c,v 1.205 2020/11/14 06:15:11 rillig Exp $"); +MAKE_RCSID("$NetBSD: dir.c,v 1.206 2020/11/14 11:22:17 rillig Exp $"); #define DIR_DEBUG0(text) DEBUG0(DIR, text) #define DIR_DEBUG1(fmt, arg1) DEBUG1(DIR, fmt, arg1) @@ -273,7 +273,7 @@ OpenDirs_Remove(OpenDirs *odirs, const c Lst_Remove(odirs->list, ln); } -static OpenDirs openDirs; /* the list of all open directories */ +static OpenDirs openDirs; /* all cached directories */ /* * Variables for gathering statistics on the efficiency of the caching @@ -305,12 +305,11 @@ static HashTable lmtimes; /* same as mti * mtime and mode are all we care about. */ struct cache_st { -time_t lmtime; /* lstat */ +time_t lmtime; /* lstat; XXX: is probably redundant */ time_t mtime; /* stat */ mode_t mode; }; -/* minimize changes below */ typedef enum CachedStatsFlags { CST_NONE = 0, CST_LSTAT = 1 << 0, /* call lstat(2) instead of stat(2) */ @@ -319,7 +318,7 @@ typedef enum CachedStatsFlags { /* Returns 0 and the result of stat(2) or lstat(2) in *mst, or -1 on error. */ static int -cached_stats(HashTable *htp, const char *pathname, struct make_stat *mst, +cached_stats(HashTable *tbl, const char *pathname, struct make_stat *mst, CachedStatsFlags flags) { HashEntry *entry; @@ -328,20 +327,24 @@ cached_stats(HashTable *htp, const char int rc; if (pathname == NULL || pathname[0] == '\0') - return -1; + return -1; /* This can happen in meta mode. */ -entry = HashTable_FindEntry(htp, pathname); +entry = HashTable_FindEntry(tbl, pathname); -if (entry && !(flags & CST_UPDATE)) { +if (entry != NULL && !(flags & CST_UPDATE)) { cst = HashEntry_Get(entry); mst->mst_mode = cst->mode; mst->mst_mtime = (flags & CST_LSTAT) ? cst->lmtime : cst->mtime; - if (mst->mst_mtime) { + /* XXX: Checking for mst_mtime != 0 is probably redundant since + * nonexistent files are not cached. */ + if (mst->mst_mtime != 0) { DIR_DEBUG2("Using cached time %s for %s\n", Targ_FmtTime(mst->mst_mtime), pathname); return 0; } + /* Continue with the normal lookup to see whether the file has been + * created in the meantime. */ } rc = (flags & CST_LSTAT) @@ -356,13 +359,14 @@ cached_stats(HashTable *htp, const char mst->mst_mode = sys_st.st_mode; mst->mst_mtime = sys_st.st_mtime; -if (entry == NULL) - entry = HashTable_CreateEntry(htp, pathname, NULL); -if (HashEntry_Get(entry) == NULL) { - HashEntry_Set(entry, bmake_malloc(sizeof *cst)); - memset(HashEntry_Get(entry), 0, sizeof *cst); +if (entry != NULL) + cst = entry->value; +else { + entry = HashTable_CreateEntry(tbl, pathname, NULL); + cst = bmake_malloc(sizeof *cst); + memset(cst, 0, sizeof *cst); + HashEntry_Set(entry, cst); } -cst = HashEntry_Get(entry); if (flags & CST_LSTAT) { cst->lmtime = sys_st.st_mtime; } else {
CVS commit: src/usr.sbin/envstat
Module Name:src Committed By: mlelstv Date: Sat Nov 14 09:11:56 UTC 2020 Modified Files: src/usr.sbin/envstat: config.c envstat.8 envstat.c envstat.h Log Message: For raw output (-x) allow to extract individual properties like drvctl -p. E.g. # envstat -x /vcmbox0/0/cur-value 32815 To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/usr.sbin/envstat/config.c cvs rdiff -u -r1.62 -r1.63 src/usr.sbin/envstat/envstat.8 cvs rdiff -u -r1.97 -r1.98 src/usr.sbin/envstat/envstat.c cvs rdiff -u -r1.3 -r1.4 src/usr.sbin/envstat/envstat.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.sbin/envstat/config.c diff -u src/usr.sbin/envstat/config.c:1.13 src/usr.sbin/envstat/config.c:1.14 --- src/usr.sbin/envstat/config.c:1.13 Sun Jun 7 00:51:48 2020 +++ src/usr.sbin/envstat/config.c Sat Nov 14 09:11:55 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: config.c,v 1.13 2020/06/07 00:51:48 thorpej Exp $ */ +/* $NetBSD: config.c,v 1.14 2020/11/14 09:11:55 mlelstv Exp $ */ /*- * Copyright (c) 2007 Juan Romero Pardines. @@ -27,9 +27,11 @@ #include #ifndef lint -__RCSID("$NetBSD: config.c,v 1.13 2020/06/07 00:51:48 thorpej Exp $"); +__RCSID("$NetBSD: config.c,v 1.14 2020/11/14 09:11:55 mlelstv Exp $"); #endif /* not lint */ +#include +#include #include #include #include @@ -134,7 +136,7 @@ config_dict_mark(void) } /* - * Only used for debugging purposses. + * Show raw data */ void config_dict_dump(prop_dictionary_t d) @@ -146,6 +148,81 @@ config_dict_dump(prop_dictionary_t d) free(buf); } +static void +display_object(prop_object_t obj, bool nflag) +{ + char *xml; + prop_object_t next_obj; + prop_object_iterator_t iter; + + if (obj == NULL) + exit(EXIT_FAILURE); + switch (prop_object_type(obj)) { + case PROP_TYPE_BOOL: + printf("%s\n", prop_bool_true(obj) ? "true" : "false"); + break; + case PROP_TYPE_NUMBER: + printf("%" PRId64 "\n", prop_number_signed_value(obj)); + break; + case PROP_TYPE_STRING: + printf("%s\n", prop_string_value(obj)); + break; + case PROP_TYPE_DICTIONARY: + xml = prop_dictionary_externalize(obj); + printf("%s", xml); + free(xml); + break; + case PROP_TYPE_ARRAY: + iter = prop_array_iterator(obj); + if (!nflag) + printf("Array:\n"); + while ((next_obj = prop_object_iterator_next(iter)) != NULL) + display_object(next_obj, nflag); + break; + default: + errx(EXIT_FAILURE, "Unhandled type %d", prop_object_type(obj)); + } +} + +void +config_dict_extract(prop_dictionary_t dict, const char *prop, bool nflag) +{ + char *s, *p, *cur, *ep = NULL; + prop_object_t obj; + unsigned long ind; + + obj = dict; + cur = NULL; + s = strdup(prop); + p = strtok_r(s, "/", &ep); + while (p) { + cur = p; + p = strtok_r(NULL, "/", &ep); + + switch (prop_object_type(obj)) { + case PROP_TYPE_DICTIONARY: + obj = prop_dictionary_get(obj, cur); + if (obj == NULL) +exit(EXIT_FAILURE); + break; + case PROP_TYPE_ARRAY: + ind = strtoul(cur, NULL, 0); + obj = prop_array_get(obj, ind); + if (obj == NULL) +exit(EXIT_FAILURE); + break; + default: + errx(EXIT_FAILURE, "Select neither dict nor array with" + " `%s'", cur); + } + } + + if (obj != NULL && cur != NULL) + display_object(obj, nflag); + + free(s); +} + /* * Returns the global dictionary. */ Index: src/usr.sbin/envstat/envstat.8 diff -u src/usr.sbin/envstat/envstat.8:1.62 src/usr.sbin/envstat/envstat.8:1.63 --- src/usr.sbin/envstat/envstat.8:1.62 Sun May 18 11:46:24 2014 +++ src/usr.sbin/envstat/envstat.8 Sat Nov 14 09:11:55 2020 @@ -1,4 +1,4 @@ -.\" $NetBSD: envstat.8,v 1.62 2014/05/18 11:46:24 kardel Exp $ +.\" $NetBSD: envstat.8,v 1.63 2020/11/14 09:11:55 mlelstv Exp $ .\" .\" Copyright (c) 2000, 2007, 2008, 2009, 2014 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -41,6 +41,7 @@ .Op Fl i Ar interval .Op Fl s Ar "device:sensor,..." .Op Fl w Ar width +.Op Ar property... .Sh DESCRIPTION .Nm is a utility that handles various aspects of the sensors @@ -139,6 +140,9 @@ Shows the raw XML property list used by .Xr sysmon_envsys 9 framework that contains details about all registered devices and sensors. +If +.Ar property +is specified, the value of that property is printed. .El .Sh UNITS The display mode may show some values with abbreviated units; Index: src/usr.sbin/envstat/envstat.c diff -u src/usr.sbin/envstat/envstat.c:1.97 src/usr.sbin/envstat/envstat.c:1.98 --- src/usr.sbin/envstat/envstat.c:1.97 Sun Jun 7 00:51:48 2020 +++ src/usr.sbin/envstat/envstat.c Sat Nov 14 09:11:55 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: envstat.c,v 1.97 2020/06/07 00:51:48 thorpej Exp $ */ +/* $NetBSD: envstat.c,v 1.98 2020/11/14 09:11:55 mlelstv Exp $ */ /*- * Copyright (c) 2007, 2008 Juan Romero Pardines. @@ -27,7 +27,7 @@ #include #ifndef lint -__RCSID("$NetBSD: envstat.c,v 1.97 2020/06/07 00:51:48 thorpej Exp $"); +__RCSID("$NetBSD: envstat.c,v 1.98 2020/1