CVS commit: src/sys/arch/arm/sunxi
Module Name:src Committed By: rin Date: Mon Oct 19 01:13:41 UTC 2020 Modified Files: src/sys/arch/arm/sunxi: sunxi_debe.c Log Message: sunxi_debe_set_videomode(): As byte-swapped framebuffer is now handled by FDT override, do not configure FB to little-endian format for __ARMEB__. XXX This function is not actually called at the moment. IIRC, it worked in the pre-FDT era. Something went wrong since then... To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/sunxi/sunxi_debe.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/arm/sunxi/sunxi_debe.c diff -u src/sys/arch/arm/sunxi/sunxi_debe.c:1.9 src/sys/arch/arm/sunxi/sunxi_debe.c:1.10 --- src/sys/arch/arm/sunxi/sunxi_debe.c:1.9 Fri Jun 1 17:18:44 2018 +++ src/sys/arch/arm/sunxi/sunxi_debe.c Mon Oct 19 01:13:41 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: sunxi_debe.c,v 1.9 2018/06/01 17:18:44 bouyer Exp $ */ +/* $NetBSD: sunxi_debe.c,v 1.10 2020/10/19 01:13:41 rin Exp $ */ /*- * Copyright (c) 2018 Manuel Bouyer @@ -38,7 +38,7 @@ #define SUNXI_DEBE_CURMAX 64 #include -__KERNEL_RCSID(0, "$NetBSD: sunxi_debe.c,v 1.9 2018/06/01 17:18:44 bouyer Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sunxi_debe.c,v 1.10 2020/10/19 01:13:41 rin Exp $"); #include #include @@ -560,6 +560,10 @@ sunxi_debe_ep_enable(device_t dev, struc return 0; } +/* + * FIXME 2020/10/19 + * This function is not called actually at the moment. + */ void sunxi_debe_set_videomode(device_t dev, const struct videomode *mode) { @@ -613,7 +617,12 @@ sunxi_debe_set_videomode(device_t dev, c SUNXI_DEBE_ATTCTL1_LAY_FBFMT); val &= ~SUNXI_DEBE_ATTCTL1_LAY_BRSWAPEN; val &= ~SUNXI_DEBE_ATTCTL1_LAY_FBPS; -#if __ARMEB__ +#if 0 /* __ARMEB__ */ + /* + * For big endian, we dynamically override FDT to let + * genfb(4) know that framebuffer is byte-swapped. + * See fdt_update_fb_format() in fdt_machdep.c. + */ val |= __SHIFTIN(SUNXI_DEBE_ATTCTL1_LAY_FBPS_32BPP_BGRA, SUNXI_DEBE_ATTCTL1_LAY_FBPS); #else
CVS commit: src/sys
Module Name:src Committed By: rin Date: Mon Oct 19 01:12:14 UTC 2020 Modified Files: src/sys/arch/arm/fdt: arm_simplefb.c src/sys/arch/evbarm/fdt: fdt_machdep.c src/sys/dev/fdt: simplefb.c Log Message: Fix colors of 32-bpp raster console for evbarm/aarch64eb and armeb. Most boards are configured to little-endian in initial, and switched to big-endian after kernel is loaded. In this case, framebuffer seems byte-swapped to CPU. It is best to reconfigure framebuffer (as done recently for sunxi_mixer by jmcneill), but in most cases, HW is incapable, or we just don't know register bits to configure them. Therefore, override "format" FDT property for "simple-framebuffer" to let drivers know byte-order for 32-bpp framebuffer. Then, make fdt/simplefb (genfb) and arm_simplefb (early console) detect byte-swapped FB, and configure genfb(4) or rasops(4) layers accordingly. Tested on Pine A64+ (arm_simplefb) and Cubietruck (both fdt/simplefb and arm_simplefb). Discussed with jmcneill. Thanks!! To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/fdt/arm_simplefb.c cvs rdiff -u -r1.75 -r1.76 src/sys/arch/evbarm/fdt/fdt_machdep.c cvs rdiff -u -r1.8 -r1.9 src/sys/dev/fdt/simplefb.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/arm/fdt/arm_simplefb.c diff -u src/sys/arch/arm/fdt/arm_simplefb.c:1.1 src/sys/arch/arm/fdt/arm_simplefb.c:1.2 --- src/sys/arch/arm/fdt/arm_simplefb.c:1.1 Sat Oct 10 15:25:31 2020 +++ src/sys/arch/arm/fdt/arm_simplefb.c Mon Oct 19 01:12:14 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: arm_simplefb.c,v 1.1 2020/10/10 15:25:31 jmcneill Exp $ */ +/* $NetBSD: arm_simplefb.c,v 1.2 2020/10/19 01:12:14 rin Exp $ */ /*- * Copyright (c) 2019 The NetBSD Foundation, Inc. @@ -33,7 +33,7 @@ #include "opt_pci.h" #include -__KERNEL_RCSID(0, "$NetBSD: arm_simplefb.c,v 1.1 2020/10/10 15:25:31 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: arm_simplefb.c,v 1.2 2020/10/19 01:12:14 rin Exp $"); #include #include @@ -66,6 +66,7 @@ static struct arm_simplefb_softc { uint32_t sc_height; uint32_t sc_stride; uint16_t sc_depth; + bool sc_swapped; void *sc_bits; } arm_simplefb_softc; @@ -120,6 +121,14 @@ arm_simplefb_init_screen(void *cookie, s ri->ri_bits = sc->sc_bits; ri->ri_flg = RI_CENTER | RI_FULLCLEAR | RI_CLEAR; + if (sc->sc_swapped) { + KASSERT(ri->ri_depth == 32); + ri->ri_rnum = ri->ri_gnum = ri->ri_bnum = 8; + ri->ri_rpos = 8; + ri->ri_gpos = 16; + ri->ri_bpos = 24; + } + scr->scr_flags |= VCONS_LOADFONT; scr->scr_flags |= VCONS_DONT_READ; @@ -161,6 +170,7 @@ arm_simplefb_preattach(void) bus_size_t size; uint16_t depth; long defattr; + bool swapped = false; const int phandle = arm_simplefb_find_node(); if (phandle == -1) @@ -181,6 +191,10 @@ arm_simplefb_preattach(void) if (strcmp(format, "a8b8g8r8") == 0 || strcmp(format, "x8r8g8b8") == 0) { depth = 32; + } else if (strcmp(format, "r8g8b8a8") == 0 || + strcmp(format, "b8g8r8x8") == 0) { + depth = 32; + swapped = true; } else if (strcmp(format, "r5g6b5") == 0) { depth = 16; } else { @@ -196,6 +210,7 @@ arm_simplefb_preattach(void) sc->sc_depth = depth; sc->sc_stride = stride; sc->sc_bits = bus_space_vaddr(bst, bsh); + sc->sc_swapped = swapped; wsfont_init(); Index: src/sys/arch/evbarm/fdt/fdt_machdep.c diff -u src/sys/arch/evbarm/fdt/fdt_machdep.c:1.75 src/sys/arch/evbarm/fdt/fdt_machdep.c:1.76 --- src/sys/arch/evbarm/fdt/fdt_machdep.c:1.75 Sat Oct 10 15:25:30 2020 +++ src/sys/arch/evbarm/fdt/fdt_machdep.c Mon Oct 19 01:12:14 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: fdt_machdep.c,v 1.75 2020/10/10 15:25:30 jmcneill Exp $ */ +/* $NetBSD: fdt_machdep.c,v 1.76 2020/10/19 01:12:14 rin Exp $ */ /*- * Copyright (c) 2015-2017 Jared McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: fdt_machdep.c,v 1.75 2020/10/10 15:25:30 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: fdt_machdep.c,v 1.76 2020/10/19 01:12:14 rin Exp $"); #include "opt_machdep.h" #include "opt_bootconfig.h" @@ -48,6 +48,7 @@ __KERNEL_RCSID(0, "$NetBSD: fdt_machdep. #include #include #include +#include #include #include #include @@ -143,6 +144,10 @@ static void fdt_cpu_rootconf(void); static void fdt_reset(void); static void fdt_powerdown(void); +#if BYTE_ORDER == BIG_ENDIAN +static void fdt_update_fb_format(void); +#endif + static void earlyconsputc(dev_t dev, int c) { @@ -578,6 +583,17 @@ initarm(void *arg) VPRINTF("stdout\n"); fdt_update_stdout_path(); +#if BYTE_ORDER == BIG_ENDIAN + /* + * Most boards are configured to little-endian mode in initial, and + * switched to big-endian mode after kernel is loaded. In this case, + * framebuffer seems byte-swapped to CPU. Override FDT to let + * drivers know. + */ + VPRINTF("fb_format\n"); + fdt_update_fb_format(); +#endif + /* * Done making c
CVS commit: src/sys/dev/wsfb
Module Name:src Committed By: rin Date: Mon Oct 19 01:08:06 UTC 2020 Modified Files: src/sys/dev/wsfb: genfb.c Log Message: Add "is_swapped" property which indicates 32-bpp framebuffer is byte-swapped. To generate a diff of this commit: cvs rdiff -u -r1.77 -r1.78 src/sys/dev/wsfb/genfb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wsfb/genfb.c diff -u src/sys/dev/wsfb/genfb.c:1.77 src/sys/dev/wsfb/genfb.c:1.78 --- src/sys/dev/wsfb/genfb.c:1.77 Sun Oct 18 12:47:37 2020 +++ src/sys/dev/wsfb/genfb.c Mon Oct 19 01:08:06 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: genfb.c,v 1.77 2020/10/18 12:47:37 rin Exp $ */ +/* $NetBSD: genfb.c,v 1.78 2020/10/19 01:08:06 rin Exp $ */ /*- * Copyright (c) 2007 Michael Lorenz @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: genfb.c,v 1.77 2020/10/18 12:47:37 rin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: genfb.c,v 1.78 2020/10/19 01:08:06 rin Exp $"); #include #include @@ -539,7 +539,7 @@ genfb_init_screen(void *cookie, struct v struct genfb_softc *sc = cookie; struct rasops_info *ri = &scr->scr_ri; int wantcols; - bool is_bgr; + bool is_bgr, is_swapped; ri->ri_depth = sc->sc_depth; ri->ri_width = sc->sc_width; @@ -565,24 +565,30 @@ genfb_init_screen(void *cookie, struct v switch (ri->ri_depth) { case 32: case 24: + ri->ri_rnum = ri->ri_gnum = ri->ri_bnum = 8; ri->ri_flg |= RI_ENABLE_ALPHA; is_bgr = false; prop_dictionary_get_bool(device_properties(sc->sc_dev), "is_bgr", &is_bgr); + + is_swapped = false; + prop_dictionary_get_bool(device_properties(sc->sc_dev), + "is_swapped", &is_swapped); + if (is_bgr) { /* someone requested BGR */ - ri->ri_rnum = 8; - ri->ri_gnum = 8; - ri->ri_bnum = 8; ri->ri_rpos = 0; ri->ri_gpos = 8; ri->ri_bpos = 16; + } else if (is_swapped) { + /* byte-swapped, must be 32 bpp */ + KASSERT(ri->ri_depth == 32); + ri->ri_rpos = 8; + ri->ri_gpos = 16; + ri->ri_bpos = 24; } else { /* assume RGB */ - ri->ri_rnum = 8; - ri->ri_gnum = 8; - ri->ri_bnum = 8; ri->ri_rpos = 16; ri->ri_gpos = 8; ri->ri_bpos = 0;
CVS commit: src/usr.bin/make/unit-tests
Module Name:src Committed By: sjg Date: Sun Oct 18 22:55:52 UTC 2020 Modified Files: src/usr.bin/make/unit-tests: Makefile Log Message: In meta mode we do not have to re-run all tests when Makefile is touched To generate a diff of this commit: cvs rdiff -u -r1.167 -r1.168 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/unit-tests/Makefile diff -u src/usr.bin/make/unit-tests/Makefile:1.167 src/usr.bin/make/unit-tests/Makefile:1.168 --- src/usr.bin/make/unit-tests/Makefile:1.167 Sun Oct 18 16:33:18 2020 +++ src/usr.bin/make/unit-tests/Makefile Sun Oct 18 22:55:52 2020 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.167 2020/10/18 16:33:18 rillig Exp $ +# $NetBSD: Makefile,v 1.168 2020/10/18 22:55:52 sjg Exp $ # # Unit tests for make(1) # @@ -546,7 +546,12 @@ sync-mi: cvs diff "$$mi" || true .if exists(${TEST_MAKE}) -${TESTS:=.rawout}: ${TEST_MAKE} ${.PARSEDIR}/Makefile +${TESTS:=.rawout}: ${TEST_MAKE} +# in meta mode, we *know* if a target script is impacted +# by a makefile change. +.if ${.MAKE.MODE:Unormal:Mmeta} == "" +${TESTS:=.rawout}: ${.PARSEDIR}/Makefile +.endif .endif .-include
CVS commit: src/usr.bin/cdplay
Module Name:src Committed By: rillig Date: Sun Oct 18 21:58:32 UTC 2020 Modified Files: src/usr.bin/cdplay: cdplay.c Log Message: cdplay: remove redundant parentheses around return value Purely cosmetic change. The generated code stays exactly the same. To generate a diff of this commit: cvs rdiff -u -r1.49 -r1.50 src/usr.bin/cdplay/cdplay.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/cdplay/cdplay.c diff -u src/usr.bin/cdplay/cdplay.c:1.49 src/usr.bin/cdplay/cdplay.c:1.50 --- src/usr.bin/cdplay/cdplay.c:1.49 Wed Jun 17 00:01:59 2015 +++ src/usr.bin/cdplay/cdplay.c Sun Oct 18 21:58:32 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: cdplay.c,v 1.49 2015/06/17 00:01:59 christos Exp $ */ +/* $NetBSD: cdplay.c,v 1.50 2020/10/18 21:58:32 rillig Exp $ */ /* * Copyright (c) 1999, 2000, 2001 Andrew Doran. @@ -40,7 +40,7 @@ #include #ifndef lint -__RCSID("$NetBSD: cdplay.c,v 1.49 2015/06/17 00:01:59 christos Exp $"); +__RCSID("$NetBSD: cdplay.c,v 1.50 2020/10/18 21:58:32 rillig Exp $"); #endif /* not lint */ #include @@ -277,7 +277,7 @@ main(int argc, char **argv) } *p = '\0'; arg = parse(buf, &cmd); - return (run(cmd, arg)); + return run(cmd, arg); } setbuf(stdout, NULL); @@ -372,7 +372,7 @@ start_digital(const char *arg) intv_usecs = 1 * da.fpw; /* * interrupt earlier for safety, by a value which - * doesn't hurt interactice response if we block + * doesn't hurt interactive response if we block * in the signal handler */ intv_usecs -= 5; @@ -387,20 +387,20 @@ start_digital(const char *arg) da.aubuf = malloc(da.fpw * CDDA_SIZE); if (da.aubuf == NULL) { warn("Not enough memory for audio buffers"); - return (1); + return 1; } if (da.afd == -1 && !openaudio()) { warn("Cannot open audio device"); - return (1); + return 1; } itv_timer.it_interval.tv_sec = itv_timer.it_value.tv_sec = intv_usecs / 100; itv_timer.it_interval.tv_usec = itv_timer.it_value.tv_usec = intv_usecs % 100; rv = setitimer(ITIMER_REAL, &itv_timer, NULL); - if (rv == 0) { + if (rv == 0) digital = 1; - } else + else warn("setitimer in CMD_DIGITAL"); msf = 0; tbvalid = 0; @@ -437,7 +437,7 @@ run(int cmd, const char *arg) } if (fd < 0 && !opencd()) - return (0); + return 0; switch (cmd) { case CMD_INFO: @@ -451,7 +451,7 @@ run(int cmd, const char *arg) case CMD_PAUSE: if (digital) { da.playing = 0; - return (0); + return 0; } else if ((rv = ioctl(fd, CDIOCPAUSE)) < 0) warn("ioctl(CDIOCPAUSE)"); break; @@ -459,7 +459,7 @@ run(int cmd, const char *arg) case CMD_RESUME: if (digital) { da.playing = 1; - return (0); + return 0; } else if ((rv = ioctl(fd, CDIOCRESUME)) < 0) warn("ioctl(CDIOCRESUME)"); break; @@ -467,7 +467,7 @@ run(int cmd, const char *arg) case CMD_STOP: if (digital) { da.playing = 0; - return (0); + return 0; } else { if ((rv = ioctl(fd, CDIOCSTOP)) < 0) warn("ioctl(CDIOCSTOP)"); @@ -479,7 +479,7 @@ run(int cmd, const char *arg) case CMD_RESET: tbvalid = 0; IOCTL_SIMPLE(fd, CDIOCRESET); - return (0); + return 0; case CMD_EJECT: tbvalid = 0; @@ -634,7 +634,7 @@ run(int cmd, const char *arg) break; } - return (rv); + return rv; } static int @@ -647,12 +647,12 @@ play(const char *arg, int fromuser) if (shuffle && fromuser) { warnx("`play' not valid in shuffle mode"); - return (0); + return 0; } if ((rv = ioctl(fd, CDIOREADTOCHEADER, &h)) < 0) { warn("ioctl(CDIOREADTOCHEADER)"); - return (int)(rv); + return (int)rv; } end = 0; @@ -660,11 +660,11 @@ play(const char *arg, int fromuser) n = h.ending_track - h.starting_track + 1; rv = read_toc_entries((n + 1) * sizeof(struct cd_toc_entry)); if (rv < 0) - return (int)(rv); + return (int)rv; if (arg == NULL || *arg == '\0') { /* Play the whole disc */ - return (play_track(h.starting_track, 1, h.ending_track, 99)); + return play_track(h.starting_track, 1, h.ending_track, 99); } if (strchr(arg, '#') != NULL) { @@ -678,14 +678,14 @@ play(const char *arg, int fromuser) if (len == 0) { len = toc2lba(n); } - return (play_blocks(blk, len)); + return play_blocks(blk, len); } if (strchr(arg, ':') != NULL) { /* * Play MSF m1:s1 [ .f1 ] [ m2:s2 [ .f2 ] ] * - * Will now also undestand timed addresses relative + * Will now also understand timed addresses relative * to the beginning of a track in the form... * * tr1 m1:s1[.f1] [[tr2] [m2:s2[.f2]]] @@ -776,7 +776,7 @@ Play_Relative_Addresses: if ((m1 > tm) || ((m1 == tm) && ((s1 > ts) || ((s1 == ts) && (f1 > tf) { warnx("Track %d is not that long.", tr1); - return (0); + return 0; } tr1--; /* X */ @@ -809,10 +809,10 @@ Play_Relative_Addresses: if ((tr2 < n) && ((m2 > tm) || ((m2 == tm) &&
CVS commit: src/usr.bin/make/unit-tests
Module Name:src Committed By: rillig Date: Sun Oct 18 21:37:24 UTC 2020 Modified Files: src/usr.bin/make/unit-tests: varmod-assign.mk Log Message: make(1): add test for the ::+= modifier expanding its right-hand side To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/usr.bin/make/unit-tests/varmod-assign.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-assign.mk diff -u src/usr.bin/make/unit-tests/varmod-assign.mk:1.7 src/usr.bin/make/unit-tests/varmod-assign.mk:1.8 --- src/usr.bin/make/unit-tests/varmod-assign.mk:1.7 Sun Oct 18 21:36:22 2020 +++ src/usr.bin/make/unit-tests/varmod-assign.mk Sun Oct 18 21:37:24 2020 @@ -1,4 +1,4 @@ -# $NetBSD: varmod-assign.mk,v 1.7 2020/10/18 21:36:22 rillig Exp $ +# $NetBSD: varmod-assign.mk,v 1.8 2020/10/18 21:37:24 rillig Exp $ # # Tests for the obscure ::= variable modifiers, which perform variable # assignments during evaluation, just like the = operator in C. @@ -91,3 +91,17 @@ mod-assign-shell-error: # FIXME: the error message says: "previous" returned non-zero status @${SH_ERR::=previous} @${SH_ERR::!= echo word; false } echo err=${SH_ERR} + +# XXX: The ::= modifier expands its right-hand side, exactly once. +# This differs subtly from normal assignments such as '+=' or '=', which copy +# their right-hand side literally. +APPEND.prev= previous +APPEND.var= ${APPEND.prev} +APPEND.indirect= indirect $${:Unot expanded} +APPEND.dollar= $${APPEND.indirect} +.if ${APPEND.var::+=${APPEND.dollar}} != "" +. error +.endif +.if ${APPEND.var} != "previous indirect \${:Unot expanded}" +. error +.endif
CVS commit: src/usr.bin/make/unit-tests
Module Name:src Committed By: rillig Date: Sun Oct 18 21:36:22 UTC 2020 Modified Files: src/usr.bin/make/unit-tests: varmod-assign.exp varmod-assign.mk Log Message: make(1): explain existing tests for the ::= assignment modifiers To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/usr.bin/make/unit-tests/varmod-assign.exp cvs rdiff -u -r1.6 -r1.7 src/usr.bin/make/unit-tests/varmod-assign.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-assign.exp diff -u src/usr.bin/make/unit-tests/varmod-assign.exp:1.5 src/usr.bin/make/unit-tests/varmod-assign.exp:1.6 --- src/usr.bin/make/unit-tests/varmod-assign.exp:1.5 Tue Aug 25 21:16:53 2020 +++ src/usr.bin/make/unit-tests/varmod-assign.exp Sun Oct 18 21:36:22 2020 @@ -11,7 +11,7 @@ mod-assign-nested: else2e2 mod-assign-nested: then3t3 mod-assign-nested: else4e4 make: Bad modifier `:' for -value} +mod-assign-empty: value} make: Bad modifier `:' for mod-assign-empty: overwritten} mod-assign-empty: VAR=overwritten Index: src/usr.bin/make/unit-tests/varmod-assign.mk diff -u src/usr.bin/make/unit-tests/varmod-assign.mk:1.6 src/usr.bin/make/unit-tests/varmod-assign.mk:1.7 --- src/usr.bin/make/unit-tests/varmod-assign.mk:1.6 Tue Aug 25 21:16:53 2020 +++ src/usr.bin/make/unit-tests/varmod-assign.mk Sun Oct 18 21:36:22 2020 @@ -1,4 +1,4 @@ -# $NetBSD: varmod-assign.mk,v 1.6 2020/08/25 21:16:53 rillig Exp $ +# $NetBSD: varmod-assign.mk,v 1.7 2020/10/18 21:36:22 rillig Exp $ # # Tests for the obscure ::= variable modifiers, which perform variable # assignments during evaluation, just like the = operator in C. @@ -51,13 +51,25 @@ SINK3:= ${1:?${THEN3::=then3${IT3::=t3}} SINK4:= ${0:?${THEN4::=then4${IT4::=t4}}:${ELSE4::=else4${IE4::=e4}}}${THEN4}${ELSE4}${IT4}${IE4} mod-assign-empty: - # Assigning to the empty variable would obviously not work since that variable - # is write-protected. Therefore it is rejected early as a "bad modifier". - @echo ${::=value} + # Assigning to the empty variable would obviously not work since that + # variable is write-protected. Therefore it is rejected early with a + # "Bad modifier" message. + # + # XXX: The error message is hard to read since the variable name is + # empty. This leads to a trailing space in the error message. + @echo $@: ${::=value} + + # In this variant, it is not as obvious that the name of the + # expression is empty. Assigning to it is rejected as well, with the + # same "Bad modifier" message. + # + # XXX: The error message is hard to read since the variable name is + # empty. This leads to a trailing space in the error message. @echo $@: ${:Uvalue::=overwritten} - # The :L modifier sets the variable's value to its name. - # Since the name is still "VAR", assigning to that variable works. + # The :L modifier sets the value of the expression to its variable + # name. The name of the expression is "VAR", therefore assigning to + # that variable works. @echo $@: ${VAR:L::=overwritten} VAR=${VAR} mod-assign-parse:
CVS commit: src/usr.bin/make/unit-tests
Module Name:src Committed By: rillig Date: Sun Oct 18 21:12:13 UTC 2020 Modified Files: src/usr.bin/make/unit-tests: varmod-loop.mk Log Message: make(1): add test for nested :@ modifiers using the same variable name To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/varmod-loop.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-loop.mk diff -u src/usr.bin/make/unit-tests/varmod-loop.mk:1.3 src/usr.bin/make/unit-tests/varmod-loop.mk:1.4 --- src/usr.bin/make/unit-tests/varmod-loop.mk:1.3 Sun Sep 13 07:32:32 2020 +++ src/usr.bin/make/unit-tests/varmod-loop.mk Sun Oct 18 21:12:13 2020 @@ -1,4 +1,4 @@ -# $NetBSD: varmod-loop.mk,v 1.3 2020/09/13 07:32:32 rillig Exp $ +# $NetBSD: varmod-loop.mk,v 1.4 2020/10/18 21:12:13 rillig Exp $ # # Tests for the :@var@...${var}...@ variable modifier. @@ -66,3 +66,18 @@ mod-loop-dollar: @echo $@:${:U4:@word@{word}@:Q}: @echo $@:${:U5:@word@${word}$@:Q}: @echo $@:${:U6:@word@$${word}$$@:Q}: + +# It may happen that there are nested :@ modifiers that use the same name for +# for the loop variable. These modifiers influence each other. +# +# As of 2020-10-18, the :@ modifier is implemented by actually setting an +# variable in the context of the expression and deleting it again after the +# loop. This is different from the .for loops, which substitute the variable +# expression with ${:Uvalue}, leading to different unwanted side effects. +# +# To make the behavior more predictable, the :@ modifier should restore the +# loop variable to the value it had before the loop. This would result in +# the string "1a b c1 2a b c2 3a b c3", making the two loops independent. +.if ${:U1 2 3:@i@$i${:Ua b c:@i@$i@}${i:Uu}@} != "1a b cu 2a b cu 3a b cu" +. error +.endif
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sun Oct 18 20:46:42 UTC 2020 Modified Files: src/usr.bin/make: parse.c Log Message: make(1): clean up and document VarAssign_Eval In the previous commit, out_avalue_freeIt had been passed to VarAssign_EvalSubst, which created a memory leak. Other than that, the code changes are purely cosmetic. To generate a diff of this commit: cvs rdiff -u -r1.390 -r1.391 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.390 src/usr.bin/make/parse.c:1.391 --- src/usr.bin/make/parse.c:1.390 Sun Oct 18 20:29:50 2020 +++ src/usr.bin/make/parse.c Sun Oct 18 20:46:42 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: parse.c,v 1.390 2020/10/18 20:29:50 rillig Exp $ */ +/* $NetBSD: parse.c,v 1.391 2020/10/18 20:46:42 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -131,7 +131,7 @@ #include "pathnames.h" /* "@(#)parse.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: parse.c,v 1.390 2020/10/18 20:29:50 rillig Exp $"); +MAKE_RCSID("$NetBSD: parse.c,v 1.391 2020/10/18 20:46:42 rillig Exp $"); /* types and constants */ @@ -1898,11 +1898,9 @@ VarCheckSyntax(VarAssignOp type, const c } static void -VarAssign_EvalSubst(const VarAssign *var, GNode *ctxt, +VarAssign_EvalSubst(const char *name, const char *uvalue, GNode *ctxt, const char **out_avalue, void **out_avalue_freeIt) { -const char *name = var->varname; -const char *uvalue = var->value; const char *avalue = uvalue; char *evalue; /* @@ -1938,10 +1936,9 @@ VarAssign_EvalSubst(const VarAssign *var } static void -VarAssign_EvalShell(const VarAssign *var, GNode *ctxt, +VarAssign_EvalShell(const char *name, const char *uvalue, GNode *ctxt, const char **out_avalue, void **out_avalue_freeIt) { -const char *uvalue = var->value; const char *cmd, *errfmt; char *cmdOut; void *cmd_freeIt = NULL; @@ -1955,7 +1952,7 @@ VarAssign_EvalShell(const VarAssign *var } cmdOut = Cmd_Exec(cmd, &errfmt); -Var_Set(var->varname, cmdOut, ctxt); +Var_Set(name, cmdOut, ctxt); *out_avalue = *out_avalue_freeIt = cmdOut; if (errfmt) @@ -1964,24 +1961,29 @@ VarAssign_EvalShell(const VarAssign *var free(cmd_freeIt); } +/* Perform a variable assignment. + * + * The actual value of the variable is returned in *out_avalue and + * *out_avalue_freeIt. Especially for VAR_SUBST and VAR_SHELL this can differ + * from the literal value. + * + * Return whether the assignment was actually done. The assignment is only + * skipped if the operator is '?=' and the variable already exists. */ static Boolean -VarAssign_Eval(VarAssign *var, GNode *ctxt, - const char **out_avalue, void **out_avalue_freeIt) +VarAssign_Eval(const char *name, VarAssignOp op, const char *uvalue, + GNode *ctxt, const char **out_avalue, void **out_avalue_freeIt) { -const char *uvalue = var->value; -const char *name = var->varname; -const VarAssignOp type = var->op; const char *avalue = uvalue; void *avalue_freeIt = NULL; -if (type == VAR_APPEND) { +if (op == VAR_APPEND) { Var_Append(name, uvalue, ctxt); -} else if (type == VAR_SUBST) { -VarAssign_EvalSubst(var, ctxt, &avalue, out_avalue_freeIt); -} else if (type == VAR_SHELL) { -VarAssign_EvalShell(var, ctxt, &avalue, &avalue_freeIt); +} else if (op == VAR_SUBST) { +VarAssign_EvalSubst(name, uvalue, ctxt, &avalue, &avalue_freeIt); +} else if (op == VAR_SHELL) { +VarAssign_EvalShell(name, uvalue, ctxt, &avalue, &avalue_freeIt); } else { - if (type == VAR_DEFAULT && Var_Exists(name, ctxt)) { + if (op == VAR_DEFAULT && Var_Exists(name, ctxt)) { *out_avalue_freeIt = NULL; return FALSE; } @@ -2035,7 +2037,8 @@ Parse_DoVar(VarAssign *var, GNode *ctxt) void *avalue_freeIt; VarCheckSyntax(var->op, var->value, ctxt); -if (VarAssign_Eval(var, ctxt, &avalue, &avalue_freeIt)) +if (VarAssign_Eval(var->varname, var->op, var->value, ctxt, + &avalue, &avalue_freeIt)) VarAssignSpecial(var->varname, avalue); free(avalue_freeIt);
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sun Oct 18 20:29:50 UTC 2020 Modified Files: src/usr.bin/make: parse.c Log Message: make(1): split VarAssign_Eval into smaller functions To generate a diff of this commit: cvs rdiff -u -r1.389 -r1.390 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.389 src/usr.bin/make/parse.c:1.390 --- src/usr.bin/make/parse.c:1.389 Sun Oct 18 20:14:27 2020 +++ src/usr.bin/make/parse.c Sun Oct 18 20:29:50 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: parse.c,v 1.389 2020/10/18 20:14:27 rillig Exp $ */ +/* $NetBSD: parse.c,v 1.390 2020/10/18 20:29:50 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -131,7 +131,7 @@ #include "pathnames.h" /* "@(#)parse.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: parse.c,v 1.389 2020/10/18 20:14:27 rillig Exp $"); +MAKE_RCSID("$NetBSD: parse.c,v 1.390 2020/10/18 20:29:50 rillig Exp $"); /* types and constants */ @@ -1897,6 +1897,73 @@ VarCheckSyntax(VarAssignOp type, const c } } +static void +VarAssign_EvalSubst(const VarAssign *var, GNode *ctxt, + const char **out_avalue, void **out_avalue_freeIt) +{ +const char *name = var->varname; +const char *uvalue = var->value; +const char *avalue = uvalue; +char *evalue; +/* + * Allow variables in the old value to be undefined, but leave their + * expressions alone -- this is done by forcing oldVars to be false. + * XXX: This can cause recursive variables, but that's not hard to do, + * and this allows someone to do something like + * + * CFLAGS = $(.INCLUDES) + * CFLAGS := -I.. $(CFLAGS) + * + * And not get an error. + */ +Boolean oldOldVars = oldVars; + +oldVars = FALSE; + +/* + * make sure that we set the variable the first time to nothing + * so that it gets substituted! + */ +if (!Var_Exists(name, ctxt)) + Var_Set(name, "", ctxt); + +(void)Var_Subst(uvalue, ctxt, VARE_WANTRES|VARE_ASSIGN, &evalue); +/* TODO: handle errors */ +oldVars = oldOldVars; +avalue = evalue; +Var_Set(name, avalue, ctxt); + +*out_avalue = avalue; +*out_avalue_freeIt = evalue; +} + +static void +VarAssign_EvalShell(const VarAssign *var, GNode *ctxt, + const char **out_avalue, void **out_avalue_freeIt) +{ +const char *uvalue = var->value; +const char *cmd, *errfmt; +char *cmdOut; +void *cmd_freeIt = NULL; + +cmd = uvalue; +if (strchr(cmd, '$') != NULL) { + char *ecmd; + (void)Var_Subst(cmd, VAR_CMD, VARE_UNDEFERR|VARE_WANTRES, &ecmd); + /* TODO: handle errors */ + cmd = cmd_freeIt = ecmd; +} + +cmdOut = Cmd_Exec(cmd, &errfmt); +Var_Set(var->varname, cmdOut, ctxt); +*out_avalue = *out_avalue_freeIt = cmdOut; + +if (errfmt) + Parse_Error(PARSE_WARNING, errfmt, cmd); + +free(cmd_freeIt); +} + static Boolean VarAssign_Eval(VarAssign *var, GNode *ctxt, const char **out_avalue, void **out_avalue_freeIt) @@ -1910,59 +1977,11 @@ VarAssign_Eval(VarAssign *var, GNode *ct if (type == VAR_APPEND) { Var_Append(name, uvalue, ctxt); } else if (type == VAR_SUBST) { - char *evalue; - /* - * Allow variables in the old value to be undefined, but leave their - * expressions alone -- this is done by forcing oldVars to be false. - * XXX: This can cause recursive variables, but that's not hard to do, - * and this allows someone to do something like - * - * CFLAGS = $(.INCLUDES) - * CFLAGS := -I.. $(CFLAGS) - * - * And not get an error. - */ - Boolean oldOldVars = oldVars; - - oldVars = FALSE; - - /* - * make sure that we set the variable the first time to nothing - * so that it gets substituted! - */ - if (!Var_Exists(name, ctxt)) - Var_Set(name, "", ctxt); - - (void)Var_Subst(uvalue, ctxt, VARE_WANTRES|VARE_ASSIGN, &evalue); - /* TODO: handle errors */ - oldVars = oldOldVars; - avalue = evalue; - avalue_freeIt = evalue; - - Var_Set(name, avalue, ctxt); +VarAssign_EvalSubst(var, ctxt, &avalue, out_avalue_freeIt); } else if (type == VAR_SHELL) { - const char *cmd, *errfmt; - char *cmdOut; - void *cmd_freeIt = NULL; - - cmd = uvalue; - if (strchr(cmd, '$') != NULL) { - char *ecmd; - (void)Var_Subst(cmd, VAR_CMD, VARE_UNDEFERR|VARE_WANTRES, &ecmd); - /* TODO: handle errors */ - cmd = cmd_freeIt = ecmd; - } - - cmdOut = Cmd_Exec(cmd, &errfmt); - Var_Set(name, cmdOut, ctxt); - avalue = avalue_freeIt = cmdOut; - - if (errfmt) - Parse_Error(PARSE_WARNING, errfmt, cmd); - - free(cmd_freeIt); +VarAssign_EvalShell(var, ctxt, &avalue, &avalue_freeIt); } else { - if (type == VAR_DEFAULT && Var_Exists(var->varname, ctxt)) { + if (type == VAR_DEFAULT && Var_Exists(name, ctxt)) { *out_avalue_freeIt = NULL; return FALSE; }
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sun Oct 18 20:14:27 UTC 2020 Modified Files: src/usr.bin/make: nonints.h parse.c Log Message: make(1): remove redundant code for determining the assignment operator To generate a diff of this commit: cvs rdiff -u -r1.143 -r1.144 src/usr.bin/make/nonints.h cvs rdiff -u -r1.388 -r1.389 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/nonints.h diff -u src/usr.bin/make/nonints.h:1.143 src/usr.bin/make/nonints.h:1.144 --- src/usr.bin/make/nonints.h:1.143 Sun Oct 18 17:19:54 2020 +++ src/usr.bin/make/nonints.h Sun Oct 18 20:14:27 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: nonints.h,v 1.143 2020/10/18 17:19:54 rillig Exp $ */ +/* $NetBSD: nonints.h,v 1.144 2020/10/18 20:14:27 rillig Exp $ */ /*- * Copyright (c) 1988, 1989, 1990, 1993 @@ -133,10 +133,7 @@ typedef enum VarAssignOp { } VarAssignOp; typedef struct VarAssign { -const char *nameStart; /* unexpanded */ -const char *nameEndDraft; /* before operator adjustment */ -char *varname; -const char *eq; /* the '=' of the assignment operator */ +char *varname; /* unexpanded */ VarAssignOp op; const char *value; /* unexpanded */ } VarAssign; Index: src/usr.bin/make/parse.c diff -u src/usr.bin/make/parse.c:1.388 src/usr.bin/make/parse.c:1.389 --- src/usr.bin/make/parse.c:1.388 Sun Oct 18 20:07:26 2020 +++ src/usr.bin/make/parse.c Sun Oct 18 20:14:27 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: parse.c,v 1.388 2020/10/18 20:07:26 rillig Exp $ */ +/* $NetBSD: parse.c,v 1.389 2020/10/18 20:14:27 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -131,7 +131,7 @@ #include "pathnames.h" /* "@(#)parse.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: parse.c,v 1.388 2020/10/18 20:07:26 rillig Exp $"); +MAKE_RCSID("$NetBSD: parse.c,v 1.389 2020/10/18 20:14:27 rillig Exp $"); /* types and constants */ @@ -1753,13 +1753,20 @@ out: Lst_Free(curTargs); } +typedef struct VarAssignParsed { +const char *nameStart; /* unexpanded */ +const char *nameEnd; /* before operator adjustment */ +const char *eq; /* the '=' of the assignment operator */ +} VarAssignParsed; + /* Determine the assignment operator and adjust the end of the variable * name accordingly. */ static void -ParseVarassignOp(VarAssign *var) +AdjustVarassignOp(const VarAssignParsed *pvar, const char *value, + VarAssign *out_var) { -const char *op = var->eq; -const char * const name = var->nameStart; +const char *op = pvar->eq; +const char * const name = pvar->nameStart; VarAssignOp type; if (op > name && op[-1] == '+') { @@ -1792,9 +1799,10 @@ ParseVarassignOp(VarAssign *var) } { - const char *nameEnd = var->nameEndDraft < op ? var->nameEndDraft : op; - var->varname = bmake_strsedup(var->nameStart, nameEnd); - var->op = type; + const char *nameEnd = pvar->nameEnd < op ? pvar->nameEnd : op; + out_var->varname = bmake_strsedup(pvar->nameStart, nameEnd); + out_var->op = type; + out_var->value = value; } } @@ -1806,6 +1814,7 @@ ParseVarassignOp(VarAssign *var) Boolean Parse_IsVar(const char *p, VarAssign *out_var) { +VarAssignParsed pvar; const char *firstSpace = NULL; char ch; int level = 0; @@ -1818,13 +1827,10 @@ Parse_IsVar(const char *p, VarAssign *ou * as part of the variable name. It is later corrected, as is the ':sh' * modifier. Of these two (nameEnd and op), the earlier one determines the * actual end of the variable name. */ -out_var->nameStart = p; +pvar.nameStart = p; #ifdef CLEANUP -out_var->nameEndDraft = NULL; -out_var->varname = NULL; -out_var->eq = NULL; -out_var->op = VAR_NORMAL; -out_var->value = NULL; +pvar.nameEnd = NULL; +pvar.eq = NULL; #endif /* Scan for one of the assignment operators outside a variable expansion */ @@ -1854,22 +1860,18 @@ Parse_IsVar(const char *p, VarAssign *ou } #endif if (ch == '=') { - out_var->eq = p - 1; - out_var->nameEndDraft = firstSpace != NULL ? firstSpace : p - 1; - out_var->op = VAR_NORMAL; + pvar.eq = p - 1; + pvar.nameEnd = firstSpace != NULL ? firstSpace : p - 1; cpp_skip_whitespace(&p); - out_var->value = p; + AdjustVarassignOp(&pvar, p, out_var); return TRUE; } if (*p == '=' && (ch == '+' || ch == ':' || ch == '?' || ch == '!')) { - out_var->eq = p; - out_var->nameEndDraft = firstSpace != NULL ? firstSpace : p; - out_var->op = ch == '+' ? VAR_APPEND : - ch == ':' ? VAR_SUBST : - ch == '?' ? VAR_DEFAULT : VAR_SHELL; + pvar.eq = p; + pvar.nameEnd = firstSpace != NULL ? firstSpace : p; p++; cpp_skip_whitespace(&p); - out_var->value = p; + AdjustVarassignOp(&pvar, p, out_var); return TRUE; } if (firstSpace != NULL) @@ -2013,8 +2015,6 @@ Parse_DoVar(VarAssign
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sun Oct 18 20:07:26 UTC 2020 Modified Files: src/usr.bin/make: parse.c Log Message: make(1): move ParseVarassignOp further up To generate a diff of this commit: cvs rdiff -u -r1.387 -r1.388 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.387 src/usr.bin/make/parse.c:1.388 --- src/usr.bin/make/parse.c:1.387 Sun Oct 18 19:11:35 2020 +++ src/usr.bin/make/parse.c Sun Oct 18 20:07:26 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: parse.c,v 1.387 2020/10/18 19:11:35 rillig Exp $ */ +/* $NetBSD: parse.c,v 1.388 2020/10/18 20:07:26 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -131,7 +131,7 @@ #include "pathnames.h" /* "@(#)parse.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: parse.c,v 1.387 2020/10/18 19:11:35 rillig Exp $"); +MAKE_RCSID("$NetBSD: parse.c,v 1.388 2020/10/18 20:07:26 rillig Exp $"); /* types and constants */ @@ -1753,6 +1753,51 @@ out: Lst_Free(curTargs); } +/* Determine the assignment operator and adjust the end of the variable + * name accordingly. */ +static void +ParseVarassignOp(VarAssign *var) +{ +const char *op = var->eq; +const char * const name = var->nameStart; +VarAssignOp type; + +if (op > name && op[-1] == '+') { + type = VAR_APPEND; + op--; + +} else if (op > name && op[-1] == '?') { + op--; + type = VAR_DEFAULT; + +} else if (op > name && op[-1] == ':') { + op--; + type = VAR_SUBST; + +} else if (op > name && op[-1] == '!') { + op--; + type = VAR_SHELL; + +} else { + type = VAR_NORMAL; +#ifdef SUNSHCMD + while (op > name && ch_isspace(op[-1])) + op--; + + if (op >= name + 3 && op[-3] == ':' && op[-2] == 's' && op[-1] == 'h') { + type = VAR_SHELL; + op -= 3; + } +#endif +} + +{ + const char *nameEnd = var->nameEndDraft < op ? var->nameEndDraft : op; + var->varname = bmake_strsedup(var->nameStart, nameEnd); + var->op = type; +} +} + /* Parse a variable assignment, consisting of a single-word variable name, * optional whitespace, an assignment operator, optional whitespace and the * variable value. @@ -1834,51 +1879,6 @@ Parse_IsVar(const char *p, VarAssign *ou return FALSE; } -/* Determine the assignment operator and adjust the end of the variable - * name accordingly. */ -static void -ParseVarassignOp(VarAssign *var) -{ -const char *op = var->eq; -const char * const name = var->nameStart; -VarAssignOp type; - -if (op > name && op[-1] == '+') { - type = VAR_APPEND; - op--; - -} else if (op > name && op[-1] == '?') { - op--; - type = VAR_DEFAULT; - -} else if (op > name && op[-1] == ':') { - op--; - type = VAR_SUBST; - -} else if (op > name && op[-1] == '!') { - op--; - type = VAR_SHELL; - -} else { - type = VAR_NORMAL; -#ifdef SUNSHCMD - while (op > name && ch_isspace(op[-1])) - op--; - - if (op >= name + 3 && op[-3] == ':' && op[-2] == 's' && op[-1] == 'h') { - type = VAR_SHELL; - op -= 3; - } -#endif -} - -{ - const char *nameEnd = var->nameEndDraft < op ? var->nameEndDraft : op; - var->varname = bmake_strsedup(var->nameStart, nameEnd); - var->op = type; -} -} - static void VarCheckSyntax(VarAssignOp type, const char *uvalue, GNode *ctxt) {
CVS commit: src/share/mk
Module Name:src Committed By: christos Date: Sun Oct 18 19:58:02 UTC 2020 Modified Files: src/share/mk: bsd.own.mk Log Message: provide a no-addr-of-packed-member for both clang and gcc To generate a diff of this commit: cvs rdiff -u -r1.1227 -r1.1228 src/share/mk/bsd.own.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/share/mk/bsd.own.mk diff -u src/share/mk/bsd.own.mk:1.1227 src/share/mk/bsd.own.mk:1.1228 --- src/share/mk/bsd.own.mk:1.1227 Sat Oct 17 03:40:21 2020 +++ src/share/mk/bsd.own.mk Sun Oct 18 15:58:02 2020 @@ -1,4 +1,4 @@ -# $NetBSD: bsd.own.mk,v 1.1227 2020/10/17 07:40:21 mrg Exp $ +# $NetBSD: bsd.own.mk,v 1.1228 2020/10/18 19:58:02 christos Exp $ # This needs to be before bsd.init.mk .if defined(BSD_MK_COMPAT_FILE) @@ -872,6 +872,13 @@ GCC_NO_CAST_FUNCTION_TYPE= ${${ACTIVE_CC GCC_NO_ADDR_OF_PACKED_MEMBER= ${${ACTIVE_CC} == "gcc" && ${HAVE_GCC:U0} >= 9:? -Wno-error=address-of-packed-member :} # +# Clang warnings +# +CLANG_NO_ADDR_OF_PACKED_MEMBER= ${${ACTIVE_CC} == "clang" :? -Wno-error=address-of-packed-member :} + +NO_ADDR_OF_PACKED_MEMBER= ${CLANG_NO_ADDR_OF_PACKED_MEMBER} ${GCC_NO_ADDR_OF_PACKED_MEMBER} + +# # The ia64 port is incomplete. # MKGDB.ia64= no
CVS commit: src/sys/modules
Module Name:src Committed By: christos Date: Sun Oct 18 19:56:42 UTC 2020 Modified Files: src/sys/modules/ffs: Makefile src/sys/modules/i915drmkms: Makefile src/sys/modules/ipl: Makefile src/sys/modules/npf: Makefile src/sys/modules/pf: Makefile src/sys/modules/slcompress: Makefile src/sys/modules/udf: Makefile src/sys/modules/v7fs: Makefile Log Message: Provide a global no-packed-address for both gcc and clang To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/sys/modules/ffs/Makefile cvs rdiff -u -r1.15 -r1.16 src/sys/modules/i915drmkms/Makefile cvs rdiff -u -r1.5 -r1.6 src/sys/modules/ipl/Makefile cvs rdiff -u -r1.27 -r1.28 src/sys/modules/npf/Makefile cvs rdiff -u -r1.14 -r1.15 src/sys/modules/pf/Makefile cvs rdiff -u -r1.3 -r1.4 src/sys/modules/slcompress/Makefile cvs rdiff -u -r1.5 -r1.6 src/sys/modules/udf/Makefile cvs rdiff -u -r1.2 -r1.3 src/sys/modules/v7fs/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/modules/ffs/Makefile diff -u src/sys/modules/ffs/Makefile:1.17 src/sys/modules/ffs/Makefile:1.18 --- src/sys/modules/ffs/Makefile:1.17 Sun Oct 18 11:02:12 2020 +++ src/sys/modules/ffs/Makefile Sun Oct 18 15:56:41 2020 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.17 2020/10/18 15:02:12 christos Exp $ +# $NetBSD: Makefile,v 1.18 2020/10/18 19:56:41 christos Exp $ .include "../Makefile.inc" @@ -9,7 +9,7 @@ CPPFLAGS+= -DUFS_DIRHASH -DFFS_EI - CPPFLAGS+= -DUFS_EXTATTR -DUFS_ACL CWARNFLAGS.clang= -Wno-conversion -CWARNFLAGS.ffs_appleufs.c+= ${GCC_NO_ADDR_OF_PACKED_MEMBER} +COPTS.ffs_appleufs.c+= ${NO_ADDR_OF_PACKED_MEMBER} SRCS+= ffs_alloc.c ffs_balloc.c ffs_inode.c ffs_subr.c ffs_tables.c \ Index: src/sys/modules/i915drmkms/Makefile diff -u src/sys/modules/i915drmkms/Makefile:1.15 src/sys/modules/i915drmkms/Makefile:1.16 --- src/sys/modules/i915drmkms/Makefile:1.15 Fri Feb 14 04:35:52 2020 +++ src/sys/modules/i915drmkms/Makefile Sun Oct 18 15:56:41 2020 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.15 2020/02/14 09:35:52 riastradh Exp $ +# $NetBSD: Makefile,v 1.16 2020/10/18 19:56:41 christos Exp $ .include "../Makefile.inc" .include "../drmkms/Makefile.inc" @@ -120,5 +120,6 @@ COPTS.intel_display.c+= -Wno-error=impli COPTS.intel_ddi.c+= -Wno-error=implicit-fallthrough COPTS.intel_sdvo.c+= -Wno-error=implicit-fallthrough .endif +COPTS.i915_guc_submission.c += ${NO_ADDR_OF_PACKED_MEMBER} .include Index: src/sys/modules/ipl/Makefile diff -u src/sys/modules/ipl/Makefile:1.5 src/sys/modules/ipl/Makefile:1.6 --- src/sys/modules/ipl/Makefile:1.5 Sun Oct 18 11:02:12 2020 +++ src/sys/modules/ipl/Makefile Sun Oct 18 15:56:42 2020 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.5 2020/10/18 15:02:12 christos Exp $ +# $NetBSD: Makefile,v 1.6 2020/10/18 19:56:42 christos Exp $ # .include "../Makefile.inc" @@ -57,12 +57,12 @@ SRCS+= radix_ipf.c WARNS= 3 CWARNFLAGS.clang+= -Wno-self-assign -CWARNFLAGS.fil.c+= ${GCC_NO_ADDR_OF_PACKED_MEMBER} -CWARNFLAGS.ip_fil_netbsd.c+= ${GCC_NO_ADDR_OF_PACKED_MEMBER} -CWARNFLAGS.ip_htable.c+= ${GCC_NO_ADDR_OF_PACKED_MEMBER} -CWARNFLAGS.ip_nat.c+= ${GCC_NO_ADDR_OF_PACKED_MEMBER} -CWARNFLAGS.ip_nat6.c+= ${GCC_NO_ADDR_OF_PACKED_MEMBER} -CWARNFLAGS.ip_proxy.c+= ${GCC_NO_ADDR_OF_PACKED_MEMBER} -CWARNFLAGS.ip_state.c+= ${GCC_NO_ADDR_OF_PACKED_MEMBER} +COPTS.fil.c+= ${NO_ADDR_OF_PACKED_MEMBER} +COPTS.ip_fil_netbsd.c+= ${NO_ADDR_OF_PACKED_MEMBER} +COPTS.ip_htable.c+= ${NO_ADDR_OF_PACKED_MEMBER} +COPTS.ip_nat.c+= ${NO_ADDR_OF_PACKED_MEMBER} +COPTS.ip_nat6.c+= ${NO_ADDR_OF_PACKED_MEMBER} +COPTS.ip_proxy.c+= ${NO_ADDR_OF_PACKED_MEMBER} +COPTS.ip_state.c+= ${NO_ADDR_OF_PACKED_MEMBER} .include Index: src/sys/modules/npf/Makefile diff -u src/sys/modules/npf/Makefile:1.27 src/sys/modules/npf/Makefile:1.28 --- src/sys/modules/npf/Makefile:1.27 Sun Oct 18 11:02:12 2020 +++ src/sys/modules/npf/Makefile Sun Oct 18 15:56:42 2020 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.27 2020/10/18 15:02:12 christos Exp $ +# $NetBSD: Makefile,v 1.28 2020/10/18 19:56:42 christos Exp $ # # Public Domain. # @@ -21,7 +21,7 @@ SRCS+= nvlist.c nvpair.c nv_kern_netbsd CPPFLAGS+= -DINET6 CPPFLAGS+= -I${S}/external/bsd/libnv/dist -CWARNFLAGS.npf_inet.c+= ${GCC_NO_ADDR_OF_PACKED_MEMBER} +COPTS.npf_inet.c+= ${NO_ADDR_OF_PACKED_MEMBER} .include Index: src/sys/modules/pf/Makefile diff -u src/sys/modules/pf/Makefile:1.14 src/sys/modules/pf/Makefile:1.15 --- src/sys/modules/pf/Makefile:1.14 Sun Oct 18 11:02:12 2020 +++ src/sys/modules/pf/Makefile Sun Oct 18 15:56:42 2020 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.14 2020/10/18 15:02:12 christos Exp $ +# $NetBSD: Makefile,v 1.15 2020/10/18 19:56:42 christos Exp $ .include "../Makefile.inc" @@ -25,8 +25,8 @@ WARNS= 3 .if defined(HAVE_GCC) && ${HAVE_GCC} >= 7 && ${ACTIVE_CC} == "gcc" COPTS.pf.c+= -W
CVS commit: src/share/mk
Module Name:src Committed By: christos Date: Sun Oct 18 19:57:44 UTC 2020 Modified Files: src/share/mk: bsd.kmodule.mk Log Message: Handle the no-addr-of-packed-member only for the files that need it, not globally. To generate a diff of this commit: cvs rdiff -u -r1.71 -r1.72 src/share/mk/bsd.kmodule.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/share/mk/bsd.kmodule.mk diff -u src/share/mk/bsd.kmodule.mk:1.71 src/share/mk/bsd.kmodule.mk:1.72 --- src/share/mk/bsd.kmodule.mk:1.71 Wed Sep 9 22:34:13 2020 +++ src/share/mk/bsd.kmodule.mk Sun Oct 18 15:57:44 2020 @@ -1,4 +1,4 @@ -# $NetBSD: bsd.kmodule.mk,v 1.71 2020/09/10 02:34:13 rin Exp $ +# $NetBSD: bsd.kmodule.mk,v 1.72 2020/10/18 19:57:44 christos Exp $ # We are not building this with PIE MKPIE=no @@ -31,8 +31,7 @@ CPPFLAGS+= -nostdinc -I. -I${.CURDIR} -i CPPFLAGS+= -isystem ${S}/../common/include CPPFLAGS+= -D_KERNEL -D_MODULE -DSYSCTL_INCLUDE_DESCR -CWARNFLAGS.clang+= -Wno-error=address-of-packed-member -Wno-error=constant-conversion -CWARNFLAGS.gcc+= ${GCC_NO_ADDR_OF_PACKED_MEMBER} +CWARNFLAGS.clang+= -Wno-error=constant-conversion # XXX until the kernel is fixed again... CFLAGS+= -fno-strict-aliasing -Wno-pointer-sign
CVS commit: [netbsd-9] src/doc
Module Name:src Committed By: martin Date: Sun Oct 18 19:24:30 UTC 2020 Modified Files: src/doc [netbsd-9]: CHANGES-9.1 Log Message: Tickets #1115 - #1117 Move 9.1 release tag and document this. Now for real: welcome to 9.1! To generate a diff of this commit: cvs rdiff -u -r1.1.2.125 -r1.1.2.126 src/doc/CHANGES-9.1 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.1 diff -u src/doc/CHANGES-9.1:1.1.2.125 src/doc/CHANGES-9.1:1.1.2.126 --- src/doc/CHANGES-9.1:1.1.2.125 Fri Oct 16 08:17:09 2020 +++ src/doc/CHANGES-9.1 Sun Oct 18 19:24:30 2020 @@ -1,4 +1,4 @@ -# $NetBSD: CHANGES-9.1,v 1.1.2.125 2020/10/16 08:17:09 martin Exp $ +# $NetBSD: CHANGES-9.1,v 1.1.2.126 2020/10/18 19:24:30 martin Exp $ A complete list of changes from the NetBSD 9.0 release to the NetBSD 9.1 release: @@ -5301,6 +5301,57 @@ sys/dev/pci/if_wm.c1.691 external/gpl2/groff/tmac/mdoc.local patched by hand sys/sys/param.h patched by hand - Welcome to 9.1! + Original 9.1 tag - later moved for the files below [martin] +external/mit/xorg/bin/xinit/Makefile 1.8,1.9 + + Define CTWM when building xinit. + Allow uxterm to be used in the default xinitrc. + [nia, ticket #1115] + +external/public-domain/tz/dist/Makefile up to 1.1.1.28 +external/public-domain/tz/dist/NEWS up to 1.1.1.31 +external/public-domain/tz/dist/TZDATA_VERSION up to 1.21 +external/public-domain/tz/dist/australasia up to 1.1.1.20 +external/public-domain/tz/dist/europe up to 1.1.1.28 +external/public-domain/tz/dist/version up to 1.1.1.18 +external/public-domain/tz/dist/ziguard.awk up to 1.1.1.5 +doc/3RDPARTY (apply patch) + + Update tzdata to 2020c. + +sys/arch/amd64/amd64/process_machdep.c 1.48 (via patch, adapted) +sys/arch/i386/i386/process_machdep.c 1.95 (via patch, adapted) +sys/arch/powerpc/powerpc/process_machdep.c 1.40,1.41 (via patch, adapted) +sys/arch/sh3/include/ptrace.h 1.19 (via patch, adapted) +sys/arch/sh3/sh3/process_machdep.c 1.23,1.24 (via patch, adapted) +sys/arch/x86/x86/fpu.c(apply patch) +sys/kern/sys_ptrace_common.c 1.84 (via patch, adapted) +sys/sys/ptrace.h1.71 (via patch, adapted) + + Fix s87_tw reconstruction to correctly indicate register states. + Fix the machine-dependent ptrace requests to respect LWP number. + [kamil, ticket #1117] + +external/mit/xorg/bin/xinit/Makefile +external/public-domain/tz/dist/Makefile +external/public-domain/tz/dist/NEWS +external/public-domain/tz/dist/TZDATA_VERSION +external/public-domain/tz/dist/australasia +external/public-domain/tz/dist/europe +external/public-domain/tz/dist/version +external/public-domain/tz/dist/ziguard.awk +doc/3RDPARTY +sys/arch/amd64/amd64/process_machdep.c +sys/arch/i386/i386/process_machdep.c +sys/arch/powerpc/powerpc/process_machdep.c +sys/arch/sh3/include/ptrace.h +sys/arch/sh3/sh3/process_machdep.c +sys/arch/x86/x86/fpu.c +sys/kern/sys_ptrace_common.c +sys/sys/ptrace.h +doc/CHANGES-9.1 + + Move 9.1 release tag. Welcome to 9.1! + [martin]
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sun Oct 18 19:11:35 UTC 2020 Modified Files: src/usr.bin/make: Makefile parse.c Log Message: make(1): fix GCC warning about small buffer for cohort_num Since unmade_cohorts is a signed number (the code contains an underflow check), the result of the '%' operator could be negative and result in "#-99", which would overflow the buffer, truncating the last digit. To generate a diff of this commit: cvs rdiff -u -r1.103 -r1.104 src/usr.bin/make/Makefile cvs rdiff -u -r1.386 -r1.387 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/Makefile diff -u src/usr.bin/make/Makefile:1.103 src/usr.bin/make/Makefile:1.104 --- src/usr.bin/make/Makefile:1.103 Mon Oct 5 22:15:45 2020 +++ src/usr.bin/make/Makefile Sun Oct 18 19:11:35 2020 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.103 2020/10/05 22:15:45 rillig Exp $ +# $NetBSD: Makefile,v 1.104 2020/10/18 19:11:35 rillig Exp $ # @(#)Makefile 5.2 (Berkeley) 12/28/90 PROG= make @@ -65,7 +65,6 @@ COPTS.arch.c+= -Wno-error=format-truncat COPTS.dir.c+= -Wno-error=format-truncation COPTS.main.c+= -Wno-error=format-truncation COPTS.meta.c+= -Wno-error=format-truncation -COPTS.parse.c+= -Wno-error=format-truncation .endif # Whether to compile with GCC 9 from pkgsrc, during development. @@ -88,7 +87,6 @@ COPTS.arch.c+= -Wno-error=format-truncat COPTS.dir.c+= -Wno-error=format-truncation COPTS.main.c+= -Wno-error=format-truncation COPTS.meta.c+= -Wno-error=format-truncation -COPTS.parse.c+= -Wno-error=format-truncation .endif USE_META?= yes @@ -160,7 +158,6 @@ COPTS.arch.c+= ${GCC_NO_FORMAT_TRUNCATIO COPTS.dir.c+= ${GCC_NO_FORMAT_TRUNCATION} COPTS.main.c+= ${GCC_NO_FORMAT_TRUNCATION} ${GCC_NO_STRINGOP_TRUNCATION} COPTS.meta.c+= ${GCC_NO_FORMAT_TRUNCATION} -COPTS.parse.c+= ${GCC_NO_FORMAT_TRUNCATION} COPTS+= -Wdeclaration-after-statement Index: src/usr.bin/make/parse.c diff -u src/usr.bin/make/parse.c:1.386 src/usr.bin/make/parse.c:1.387 --- src/usr.bin/make/parse.c:1.386 Sun Oct 18 17:19:54 2020 +++ src/usr.bin/make/parse.c Sun Oct 18 19:11:35 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: parse.c,v 1.386 2020/10/18 17:19:54 rillig Exp $ */ +/* $NetBSD: parse.c,v 1.387 2020/10/18 19:11:35 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -131,7 +131,7 @@ #include "pathnames.h" /* "@(#)parse.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: parse.c,v 1.386 2020/10/18 17:19:54 rillig Exp $"); +MAKE_RCSID("$NetBSD: parse.c,v 1.387 2020/10/18 19:11:35 rillig Exp $"); /* types and constants */ @@ -834,7 +834,7 @@ TryApplyDependencyOperator(GNode *gn, GN cohort->centurion = gn; gn->unmade_cohorts++; snprintf(cohort->cohort_num, sizeof cohort->cohort_num, "#%d", - gn->unmade_cohorts % 100); + (unsigned int)gn->unmade_cohorts % 100); } else { /* * We don't want to nuke any previous flags (whatever they were) so we
CVS commit: [netbsd-9] src/sys
Module Name:src Committed By: martin Date: Sun Oct 18 18:42:11 UTC 2020 Modified Files: src/sys/arch/amd64/amd64 [netbsd-9]: process_machdep.c src/sys/arch/i386/i386 [netbsd-9]: process_machdep.c src/sys/arch/powerpc/powerpc [netbsd-9]: process_machdep.c src/sys/arch/sh3/include [netbsd-9]: ptrace.h src/sys/arch/sh3/sh3 [netbsd-9]: process_machdep.c src/sys/arch/x86/x86 [netbsd-9]: fpu.c src/sys/kern [netbsd-9]: sys_ptrace_common.c src/sys/sys [netbsd-9]: ptrace.h Log Message: Pull up following revision(s) (requested by kamil in ticket #1117): sys/arch/sh3/include/ptrace.h: revision 1.19 sys/arch/amd64/amd64/process_machdep.c: revision 1.48 sys/arch/sh3/sh3/process_machdep.c: revision 1.23 sys/arch/sh3/sh3/process_machdep.c: revision 1.24 sys/arch/i386/i386/process_machdep.c: revision 1.95 sys/arch/x86/x86/fpu.c (apply patch) sys/kern/sys_ptrace_common.c: revision 1.84 sys/arch/powerpc/powerpc/process_machdep.c: revision 1.40 sys/sys/ptrace.h: revision 1.71 sys/arch/powerpc/powerpc/process_machdep.c: revision 1.41 (all via patch, adapted) Fix s87_tw reconstruction to correctly indicate register states Fix the code reconstructing s87_tw (full tag word) from fx_sw (abridged tag word) to correctly represent all register states. The previous code only distinguished between empty/non-empty registers, and assigned 'regular value' to all non-empty registers. The new code explicitly distinguishes the two other tag word values: empty and special. Fix the machine-dependent ptrace register-related requests (e.g. PT_GETXMMREGS, PT_GETXSTATE on x86) to correctly respect the LWP number passed as the data argument. Before this change, these requests did not operate on the requested LWP of a multithreaded program. This change required moving ptrace_update_lwp() out of unit scope, and changing ptrace_machdep_dorequest() function to take a pointer to pointer as the second argument, consistently with ptrace_regs(). I am planning to extend the ATF ptrace() register tests in the future to check for regressions in multithreaded programs, as time permits. Reviewed by kamil. Add missing 'error' declaration To generate a diff of this commit: cvs rdiff -u -r1.43.2.1 -r1.43.2.2 src/sys/arch/amd64/amd64/process_machdep.c cvs rdiff -u -r1.93.2.1 -r1.93.2.2 src/sys/arch/i386/i386/process_machdep.c cvs rdiff -u -r1.38 -r1.38.18.1 \ src/sys/arch/powerpc/powerpc/process_machdep.c cvs rdiff -u -r1.15 -r1.15.2.1 src/sys/arch/sh3/include/ptrace.h cvs rdiff -u -r1.21 -r1.21.20.1 src/sys/arch/sh3/sh3/process_machdep.c cvs rdiff -u -r1.55 -r1.55.2.1 src/sys/arch/x86/x86/fpu.c cvs rdiff -u -r1.58.2.12 -r1.58.2.13 src/sys/kern/sys_ptrace_common.c cvs rdiff -u -r1.65.2.1 -r1.65.2.2 src/sys/sys/ptrace.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/arch/amd64/amd64/process_machdep.c diff -u src/sys/arch/amd64/amd64/process_machdep.c:1.43.2.1 src/sys/arch/amd64/amd64/process_machdep.c:1.43.2.2 --- src/sys/arch/amd64/amd64/process_machdep.c:1.43.2.1 Tue Aug 6 16:14:33 2019 +++ src/sys/arch/amd64/amd64/process_machdep.c Sun Oct 18 18:42:10 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: process_machdep.c,v 1.43.2.1 2019/08/06 16:14:33 martin Exp $ */ +/* $NetBSD: process_machdep.c,v 1.43.2.2 2020/10/18 18:42:10 martin Exp $ */ /* * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc. @@ -74,7 +74,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: process_machdep.c,v 1.43.2.1 2019/08/06 16:14:33 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: process_machdep.c,v 1.43.2.2 2020/10/18 18:42:10 martin Exp $"); #include "opt_xen.h" #include @@ -367,6 +367,100 @@ ptrace_machdep_dorequest( return 0; } +static int +ptrace_update_lwp2(struct proc *t, struct lwp **lt, lwpid_t lid) +{ + if (lid == 0 || lid == (*lt)->l_lid || t->p_nlwps == 1) + return 0; + + mutex_enter(t->p_lock); + lwp_delref2(*lt); + + *lt = lwp_find(t, lid); + if (*lt == NULL) { + mutex_exit(t->p_lock); + return ESRCH; + } + + if ((*lt)->l_flag & LW_SYSTEM) { + mutex_exit(t->p_lock); + *lt = NULL; + return EINVAL; + } + + lwp_addref(*lt); + mutex_exit(t->p_lock); + + return 0; +} + +int +ptrace_machdep_dorequest2( +struct lwp *l, +struct lwp **lt, +int req, +void *addr, +int data +) +{ + struct uio uio; + struct iovec iov; + struct vmspace *vm; + int error; + int write = 0; + + switch (req) { + case PT_SETXSTATE: + write = 1; + + /* FALLTHROUGH */ + case PT_GETXSTATE: + /* write = 0 done above. */ + if ((error = ptrace_update_lwp2((*lt)->l_proc, lt, data)) != 0) + return error; + if (!process_machdep_validxstate((*lt)->l_proc)) + return EINVAL; + if (__predict_false(l->l_proc->p_flag & PK_32)) { + struct netbsd32_iovec user_iov; + if ((error = copyin(addr, &user_iov, sizeof(
CVS commit: src/sys/uvm
Module Name:src Committed By: chs Date: Sun Oct 18 18:31:31 UTC 2020 Modified Files: src/sys/uvm: uvm_page.c uvm_pgflcache.c Log Message: In the current code, CPU_COUNT_FREEPAGES counts pages in the global freelists AND the per-CPU pgflcache free pages caches, and that is the number of pages that the pagedaemon considers to be available. However, most pages in the pgflcache per-CPU free page caches are NOT actually available for any particular allocation, and thus allocating a page can fail even though the pagedaemon thinks enough pages are available. This change makes CPU_COUNT_FREEPAGES only count pages in the global freelists and not pages in the pgflcache per-CPU free page caches, thus better aligning the pagedaemon's view of how many pages are available with the number of pages that can actually be allocated by any particular request. This fixes a hang that Christos was hitting. To generate a diff of this commit: cvs rdiff -u -r1.248 -r1.249 src/sys/uvm/uvm_page.c cvs rdiff -u -r1.5 -r1.6 src/sys/uvm/uvm_pgflcache.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/uvm/uvm_page.c diff -u src/sys/uvm/uvm_page.c:1.248 src/sys/uvm/uvm_page.c:1.249 --- src/sys/uvm/uvm_page.c:1.248 Sun Oct 18 18:22:29 2020 +++ src/sys/uvm/uvm_page.c Sun Oct 18 18:31:31 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: uvm_page.c,v 1.248 2020/10/18 18:22:29 chs Exp $ */ +/* $NetBSD: uvm_page.c,v 1.249 2020/10/18 18:31:31 chs Exp $ */ /*- * Copyright (c) 2019, 2020 The NetBSD Foundation, Inc. @@ -95,7 +95,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: uvm_page.c,v 1.248 2020/10/18 18:22:29 chs Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uvm_page.c,v 1.249 2020/10/18 18:31:31 chs Exp $"); #include "opt_ddb.h" #include "opt_uvm.h" @@ -1069,6 +1069,7 @@ uvm_pagealloc_pgb(struct uvm_cpu *ucpu, KASSERT(pg->flags == PG_FREE); pg->flags = PG_BUSY | PG_CLEAN | PG_FAKE; pgb->pgb_nfree--; + CPU_COUNT(CPU_COUNT_FREEPAGES, -1); /* * While we have the bucket locked and our data @@ -1270,7 +1271,6 @@ uvm_pagealloc_strat(struct uvm_object *o * while still at IPL_VM, update allocation statistics. */ - CPU_COUNT(CPU_COUNT_FREEPAGES, -1); if (anon) { CPU_COUNT(CPU_COUNT_ANONCLEAN, 1); } @@ -1567,7 +1567,6 @@ uvm_pagefree(struct vm_page *pg) /* Try to send the page to the per-CPU cache. */ s = splvm(); - CPU_COUNT(CPU_COUNT_FREEPAGES, 1); ucpu = curcpu()->ci_data.cpu_uvm; bucket = uvm_page_get_bucket(pg); if (bucket == ucpu->pgflbucket && uvm_pgflcache_free(ucpu, pg)) { @@ -1585,6 +1584,7 @@ uvm_pagefree(struct vm_page *pg) pg->flags = PG_FREE; LIST_INSERT_HEAD(&pgb->pgb_colors[VM_PGCOLOR(pg)], pg, pageq.list); pgb->pgb_nfree++; + CPU_COUNT(CPU_COUNT_FREEPAGES, 1); mutex_spin_exit(lock); splx(s); } Index: src/sys/uvm/uvm_pgflcache.c diff -u src/sys/uvm/uvm_pgflcache.c:1.5 src/sys/uvm/uvm_pgflcache.c:1.6 --- src/sys/uvm/uvm_pgflcache.c:1.5 Sun Jun 14 21:41:42 2020 +++ src/sys/uvm/uvm_pgflcache.c Sun Oct 18 18:31:31 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: uvm_pgflcache.c,v 1.5 2020/06/14 21:41:42 ad Exp $ */ +/* $NetBSD: uvm_pgflcache.c,v 1.6 2020/10/18 18:31:31 chs Exp $ */ /*- * Copyright (c) 2019 The NetBSD Foundation, Inc. @@ -43,7 +43,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: uvm_pgflcache.c,v 1.5 2020/06/14 21:41:42 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uvm_pgflcache.c,v 1.6 2020/10/18 18:31:31 chs Exp $"); #include "opt_uvm.h" #include "opt_multiprocessor.h" @@ -151,6 +151,7 @@ uvm_pgflcache_fill(struct uvm_cpu *ucpu, pg->pageq.list.le_prev = &head->lh_first; } pgb->pgb_nfree -= (count - pcc->count); + CPU_COUNT(CPU_COUNT_FREEPAGES, -(count - pcc->count)); pcc->count = count; } @@ -188,6 +189,7 @@ uvm_pgflcache_spill(struct uvm_cpu *ucpu LIST_INSERT_HEAD(head, pcc->pages[pcc->count], pageq.list); } pgb->pgb_nfree += adj; + CPU_COUNT(CPU_COUNT_FREEPAGES, adj); mutex_spin_exit(lock); }
CVS commit: src/sys
Module Name:src Committed By: chs Date: Sun Oct 18 18:22:29 UTC 2020 Modified Files: src/sys/rump/librump/rumpvfs: vm_vfs.c src/sys/uvm: uvm_page.c uvm_pager.c Log Message: 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.38 -r1.39 src/sys/rump/librump/rumpvfs/vm_vfs.c cvs rdiff -u -r1.247 -r1.248 src/sys/uvm/uvm_page.c cvs rdiff -u -r1.129 -r1.130 src/sys/uvm/uvm_pager.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/rump/librump/rumpvfs/vm_vfs.c diff -u src/sys/rump/librump/rumpvfs/vm_vfs.c:1.38 src/sys/rump/librump/rumpvfs/vm_vfs.c:1.39 --- src/sys/rump/librump/rumpvfs/vm_vfs.c:1.38 Sun Feb 23 15:46:42 2020 +++ src/sys/rump/librump/rumpvfs/vm_vfs.c Sun Oct 18 18:22:29 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: vm_vfs.c,v 1.38 2020/02/23 15:46:42 ad Exp $ */ +/* $NetBSD: vm_vfs.c,v 1.39 2020/10/18 18:22:29 chs Exp $ */ /* * Copyright (c) 2008-2011 Antti Kantee. All Rights Reserved. @@ -26,7 +26,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vm_vfs.c,v 1.38 2020/02/23 15:46:42 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vm_vfs.c,v 1.39 2020/10/18 18:22:29 chs Exp $"); #include @@ -36,19 +36,37 @@ __KERNEL_RCSID(0, "$NetBSD: vm_vfs.c,v 1 #include #include +void +uvm_aio_aiodone_pages(struct vm_page **pgs, int npages, bool write, int error) +{ + struct uvm_object *uobj = pgs[0]->uobject; + struct vm_page *pg; + int i; + + rw_enter(uobj->vmobjlock, RW_WRITER); + for (i = 0; i < npages; i++) { + pg = pgs[i]; + KASSERT((pg->flags & PG_FAKE) == 0); + } + uvm_page_unbusy(pgs, npages); + rw_exit(uobj->vmobjlock); +} + /* - * release resources held during async io. this is almost the - * same as uvm_aio_aiodone() from uvm_pager.c and only lacks the - * call to uvm_aio_aiodone_pages(): unbusies pages directly here. + * Release resources held during async io. */ void uvm_aio_aiodone(struct buf *bp) { struct uvm_object *uobj = NULL; - int i, npages = bp->b_bufsize >> PAGE_SHIFT; + int npages = bp->b_bufsize >> PAGE_SHIFT; struct vm_page **pgs; vaddr_t va; - int pageout = 0; + int i, error; + bool write; + + error = bp->b_error; + write = BUF_ISWRITE(bp); KASSERT(npages > 0); pgs = kmem_alloc(npages * sizeof(*pgs), KM_SLEEP); @@ -59,27 +77,15 @@ uvm_aio_aiodone(struct buf *bp) if (uobj == NULL) { uobj = pgs[i]->uobject; KASSERT(uobj != NULL); - rw_enter(uobj->vmobjlock, RW_WRITER); } else { KASSERT(uobj == pgs[i]->uobject); } - - if (pgs[i]->flags & PG_PAGEOUT) { - KASSERT((pgs[i]->flags & PG_FAKE) == 0); - pageout++; - pgs[i]->flags &= ~PG_PAGEOUT; - pgs[i]->flags |= PG_RELEASED; - } } - KASSERT(rw_write_held(uobj->vmobjlock)); - - uvm_page_unbusy(pgs, npages); - rw_exit(uobj->vmobjlock); - uvm_pagermapout((vaddr_t)bp->b_data, npages); - uvm_pageout_done(pageout); - if (BUF_ISWRITE(bp) && (bp->b_cflags & BC_AGE) != 0) { + uvm_aio_aiodone_pages(pgs, npages, write, error); + + if (write && (bp->b_cflags & BC_AGE) != 0) { mutex_enter(bp->b_objlock); vwakeup(bp); mutex_exit(bp->b_objlock); Index: src/sys/uvm/uvm_page.c diff -u src/sys/uvm/uvm_page.c:1.247 src/sys/uvm/uvm_page.c:1.248 --- src/sys/uvm/uvm_page.c:1.247 Sun Sep 20 10:30:05 2020 +++ src/sys/uvm/uvm_page.c Sun Oct 18 18:22:29 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: uvm_page.c,v 1.247 2020/09/20 10:30:05 skrll Exp $ */ +/* $NetBSD: uvm_page.c,v 1.248 2020/10/18 18:22:29 chs Exp $ */ /*- * Copyright (c) 2019, 2020 The NetBSD Foundation, Inc. @@ -95,7 +95,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: uvm_page.c,v 1.247 2020/09/20 10:30:05 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uvm_page.c,v 1.248 2020/10/18 18:22:29 chs Exp $"); #include "opt_ddb.h" #include "opt_uvm.h" @@ -1602,9 +1602,10 @@ void uvm_page_unbusy(struct vm_page **pgs, int npgs) { struct vm_page *pg; - int i; + int i, pageout_done; UVMHIST_FUNC(__func__); UVMHIST_CALLED(ubchist); + pageout_done = 0; for (i = 0; i < npgs; i++) { pg = pgs[i]; if (pg == NULL || pg == PGO_DONTCARE) { @@ -1613,7 +1614,13 @@ uvm_page_unbusy(struct vm_page **pgs, in KASSERT(uvm_page_owner_locked_p(pg, true)); KASSERT(pg->flags & PG_BUSY); - KASSERT((pg->flags & PG_PAGEOUT) == 0); + + if (pg->flags & PG_PAGEOUT) { + pg->flags &= ~PG_PAGEOUT; + pg->flags |= PG_RELEASED; + pageout_done++; + atomic_inc_uint(&uvmexp.pdfreed); + } if (pg->flags & PG_RELEASED) { UVMHIST_LOG(ubchist, "releasing pg %
CVS commit: [netbsd-9] src
Module Name:src Committed By: martin Date: Sun Oct 18 18:18:45 UTC 2020 Modified Files: src/doc [netbsd-9]: 3RDPARTY src/external/public-domain/tz/dist [netbsd-9]: Makefile NEWS TZDATA_VERSION australasia europe version ziguard.awk Log Message: Pull up the following, requested by kre in ticket #1116: external/public-domain/tz/dist/Makefile up to 1.1.1.28 external/public-domain/tz/dist/NEWS up to 1.1.1.31 external/public-domain/tz/dist/TZDATA_VERSION up to 1.21 external/public-domain/tz/dist/australasia up to 1.1.1.20 external/public-domain/tz/dist/europe up to 1.1.1.28 external/public-domain/tz/dist/version up to 1.1.1.18 external/public-domain/tz/dist/ziguard.awk up to 1.1.1.5 doc/3RDPARTY(apply patch) Import tzdata2020c: Release 2020c - 2020-10-16 11:15:53 -0700 Fiji starts DST later than usual, on 2020-12-20. To generate a diff of this commit: cvs rdiff -u -r1.1640.2.18 -r1.1640.2.19 src/doc/3RDPARTY cvs rdiff -u -r1.1.1.24.2.3 -r1.1.1.24.2.4 \ src/external/public-domain/tz/dist/Makefile \ src/external/public-domain/tz/dist/europe cvs rdiff -u -r1.1.1.27.2.3 -r1.1.1.27.2.4 \ src/external/public-domain/tz/dist/NEWS cvs rdiff -u -r1.17.2.3 -r1.17.2.4 \ src/external/public-domain/tz/dist/TZDATA_VERSION cvs rdiff -u -r1.1.1.17.2.2 -r1.1.1.17.2.3 \ src/external/public-domain/tz/dist/australasia cvs rdiff -u -r1.1.1.14.2.3 -r1.1.1.14.2.4 \ src/external/public-domain/tz/dist/version cvs rdiff -u -r1.1.1.4 -r1.1.1.4.2.1 \ src/external/public-domain/tz/dist/ziguard.awk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/doc/3RDPARTY diff -u src/doc/3RDPARTY:1.1640.2.18 src/doc/3RDPARTY:1.1640.2.19 --- src/doc/3RDPARTY:1.1640.2.18 Sun Oct 11 11:26:24 2020 +++ src/doc/3RDPARTY Sun Oct 18 18:18:44 2020 @@ -1,4 +1,4 @@ -# $NetBSD: 3RDPARTY,v 1.1640.2.18 2020/10/11 11:26:24 martin Exp $ +# $NetBSD: 3RDPARTY,v 1.1640.2.19 2020/10/18 18:18:44 martin Exp $ # # This file contains a list of the software that has been integrated into # NetBSD where we are not the primary maintainer. @@ -1398,8 +1398,8 @@ Notes: Added changes from a5 -> a12 manually. Package: tz -Version: tzcode2019b / tzdata2020b -Current Vers: tzcode2020b / tzdata2020b +Version: tzcode2019b / tzdata2020c +Current Vers: tzcode2020c / tzdata2020c Maintainer: Paul Eggert Archive Site: ftp://ftp.iana.org/tz/releases/ Archive Site: ftp://munnari.oz.au/pub/oldtz/ Index: src/external/public-domain/tz/dist/Makefile diff -u src/external/public-domain/tz/dist/Makefile:1.1.1.24.2.3 src/external/public-domain/tz/dist/Makefile:1.1.1.24.2.4 --- src/external/public-domain/tz/dist/Makefile:1.1.1.24.2.3 Sun Oct 11 11:26:25 2020 +++ src/external/public-domain/tz/dist/Makefile Sun Oct 18 18:18:44 2020 @@ -1022,10 +1022,14 @@ tzdata$(VERSION)-rearguard.tar.gz: rearg done sed '1s/$$/-rearguard/' \ tzdata$(VERSION)-rearguard.dir/version + : The dummy pacificnew pacifies TZUpdater 2.3.1 and earlier. + touch -md 2020-10-12T22:53:00Z \ + tzdata$(VERSION)-rearguard.dir/pacificnew touch -cmr version tzdata$(VERSION)-rearguard.dir/version LC_ALL=C && export LC_ALL && \ (cd tzdata$(VERSION)-rearguard.dir && \ - tar $(TARFLAGS) -cf - $(COMMON) $(DATA) $(MISC) | \ + tar $(TARFLAGS) -cf - \ + $(COMMON) $(DATA) $(MISC) pacificnew | \ gzip $(GZIPFLAGS)) >$@.out mv $@.out $@ Index: src/external/public-domain/tz/dist/europe diff -u src/external/public-domain/tz/dist/europe:1.1.1.24.2.3 src/external/public-domain/tz/dist/europe:1.1.1.24.2.4 --- src/external/public-domain/tz/dist/europe:1.1.1.24.2.3 Sun Oct 11 11:26:25 2020 +++ src/external/public-domain/tz/dist/europe Sun Oct 18 18:18:44 2020 @@ -1589,6 +1589,8 @@ Rule Hungary 1946 only - Oct 7 2:00 0 # https://library.hungaricana.hu/hu/view/Zala_1948_09/?pg=64 # https://library.hungaricana.hu/hu/view/SatoraljaujhelyiLeveltar_ZempleniNepujsag_1948/?pg=53 # https://library.hungaricana.hu/hu/view/SatoraljaujhelyiLeveltar_ZempleniNepujsag_1948/?pg=160 +# https://library.hungaricana.hu/hu/view/UjSzo_1949_01-04/?pg=102 +# https://library.hungaricana.hu/hu/view/KeletMagyarorszag_1949_03/?pg=96 # https://library.hungaricana.hu/hu/view/Delmagyarorszag_1949_09/?pg=94 Rule Hungary 1947 1949 - Apr Sun>=4 2:00s 1:00 S Rule Hungary 1947 1949 - Oct Sun>=1 2:00s 0 - @@ -1604,9 +1606,10 @@ Rule Hungary 1955 only - Oct 2 3:00 0 # https://library.hungaricana.hu/hu/view/PestMegyeiHirlap_1957_09/?pg=143 Rule Hungary 1956 1957 - Jun Sun>=1 2:00 1:00 S Rule Hungary 1956 1957 - Sep lastSun 3:00 0 - -# https://library.hungaricana.hu/hu/view/DTT_KOZL_TanacsokKozlonye_1980/?pg=1227 +# https://library.hungaricana.hu/hu/view/DTT_KOZL_TanacsokKozlonye_1980/?pg=189 Rule Hu
CVS commit: src/usr.bin/make/unit-tests
Module Name:src Committed By: rillig Date: Sun Oct 18 18:12:42 UTC 2020 Modified Files: src/usr.bin/make/unit-tests: opt-ignore.exp opt-ignore.mk opt-keep-going.exp opt-keep-going.mk sh-dots.exp sh-dots.mk Log Message: make(1): switch some tests to line-buffered stdout On Alpine Linux, the output was not in the same order as on NetBSD, at least since bmake-20200902. The mixture of block-buffered output from child processes and make itself was hard to predict anyway. Switching to line-buffered stdout improves the stability of the tests. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/opt-ignore.exp \ src/usr.bin/make/unit-tests/opt-keep-going.exp \ src/usr.bin/make/unit-tests/sh-dots.exp cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/opt-ignore.mk \ src/usr.bin/make/unit-tests/opt-keep-going.mk cvs rdiff -u -r1.1 -r1.2 src/usr.bin/make/unit-tests/sh-dots.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-ignore.exp diff -u src/usr.bin/make/unit-tests/opt-ignore.exp:1.2 src/usr.bin/make/unit-tests/opt-ignore.exp:1.3 --- src/usr.bin/make/unit-tests/opt-ignore.exp:1.2 Sun Aug 23 14:28:04 2020 +++ src/usr.bin/make/unit-tests/opt-ignore.exp Sun Oct 18 18:12:42 2020 @@ -1,12 +1,12 @@ dependency 1 +*** Error code 1 (ignored) dependency 2 +*** Error code 7 (ignored) dependency 3 other 1 +*** Error code 1 (ignored) other 2 main 1 -main 2 -*** Error code 1 (ignored) -*** Error code 7 (ignored) -*** Error code 1 (ignored) *** Error code 1 (ignored) +main 2 exit status 0 Index: src/usr.bin/make/unit-tests/opt-keep-going.exp diff -u src/usr.bin/make/unit-tests/opt-keep-going.exp:1.2 src/usr.bin/make/unit-tests/opt-keep-going.exp:1.3 --- src/usr.bin/make/unit-tests/opt-keep-going.exp:1.2 Sun Aug 23 14:28:04 2020 +++ src/usr.bin/make/unit-tests/opt-keep-going.exp Sun Oct 18 18:12:42 2020 @@ -1,6 +1,6 @@ dependency 1 -other 1 *** Error code 1 (continuing) +other 1 *** Error code 1 (continuing) `all' not remade because of errors. exit status 0 Index: src/usr.bin/make/unit-tests/sh-dots.exp diff -u src/usr.bin/make/unit-tests/sh-dots.exp:1.2 src/usr.bin/make/unit-tests/sh-dots.exp:1.3 --- src/usr.bin/make/unit-tests/sh-dots.exp:1.2 Sat Aug 29 19:35:38 2020 +++ src/usr.bin/make/unit-tests/sh-dots.exp Sun Oct 18 18:12:42 2020 @@ -1,15 +1,15 @@ first first hidden hidden make: exec(...) failed (No such file or directory) +*** Error code 1 (ignored) hidden delayed hidden repeated repeated commented commented -*** Error code 1 (ignored) ... # Run the below commands later +*** Error code 127 (ignored) commented delayed commented first delayed first repeated delayed repeated repeated delayed twice repeated -*** Error code 127 (ignored) exit status 0 Index: src/usr.bin/make/unit-tests/opt-ignore.mk diff -u src/usr.bin/make/unit-tests/opt-ignore.mk:1.3 src/usr.bin/make/unit-tests/opt-ignore.mk:1.4 --- src/usr.bin/make/unit-tests/opt-ignore.mk:1.3 Sun Aug 23 14:28:04 2020 +++ src/usr.bin/make/unit-tests/opt-ignore.mk Sun Oct 18 18:12:42 2020 @@ -1,4 +1,4 @@ -# $NetBSD: opt-ignore.mk,v 1.3 2020/08/23 14:28:04 rillig Exp $ +# $NetBSD: opt-ignore.mk,v 1.4 2020/10/18 18:12:42 rillig Exp $ # # Tests for the -i command line option, which ignores the exit status of the # shell commands, and just continues with the next command, even from the same @@ -10,6 +10,8 @@ # file, where they cannot be related to the individual shell commands that # failed? +.MAKEFLAGS: -d0 # switch stdout to being line-buffered + all: dependency other dependency: Index: src/usr.bin/make/unit-tests/opt-keep-going.mk diff -u src/usr.bin/make/unit-tests/opt-keep-going.mk:1.3 src/usr.bin/make/unit-tests/opt-keep-going.mk:1.4 --- src/usr.bin/make/unit-tests/opt-keep-going.mk:1.3 Sun Aug 23 14:28:04 2020 +++ src/usr.bin/make/unit-tests/opt-keep-going.mk Sun Oct 18 18:12:42 2020 @@ -1,9 +1,11 @@ -# $NetBSD: opt-keep-going.mk,v 1.3 2020/08/23 14:28:04 rillig Exp $ +# $NetBSD: opt-keep-going.mk,v 1.4 2020/10/18 18:12:42 rillig Exp $ # # Tests for the -k command line option, which stops building a target as soon # as an error is detected, but continues building the other, independent # targets, as far as possible. +.MAKEFLAGS: -d0 # switch stdout to being line-buffered + all: dependency other dependency: Index: src/usr.bin/make/unit-tests/sh-dots.mk diff -u src/usr.bin/make/unit-tests/sh-dots.mk:1.1 src/usr.bin/make/unit-tests/sh-dots.mk:1.2 --- src/usr.bin/make/unit-tests/sh-dots.mk:1.1 Sat Aug 22 11:27:02 2020 +++ src/usr.bin/make/unit-tests/sh-dots.mk Sun Oct 18 18:12:42 2020 @@ -1,9 +1,11 @@ -# $NetBSD: sh-dots.mk,v 1.1 2020/08/22 11:27:02 rillig Exp $ +# $NetBSD: sh-dots.mk,v 1.2 2020/10/18 18:12:42 rillig Exp $ # # Tests for the special shell command line "...", which does not run the # commands be
CVS commit: src/sys/stand/efiboot
Module Name:src Committed By: tnn Date: Sun Oct 18 18:09:32 UTC 2020 Modified Files: src/sys/stand/efiboot: version Log Message: efiboot: bump version To generate a diff of this commit: cvs rdiff -u -r1.21 -r1.22 src/sys/stand/efiboot/version Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/stand/efiboot/version diff -u src/sys/stand/efiboot/version:1.21 src/sys/stand/efiboot/version:1.22 --- src/sys/stand/efiboot/version:1.21 Sun Oct 11 14:03:33 2020 +++ src/sys/stand/efiboot/version Sun Oct 18 18:09:32 2020 @@ -1,4 +1,4 @@ -$NetBSD: version,v 1.21 2020/10/11 14:03:33 jmcneill Exp $ +$NetBSD: version,v 1.22 2020/10/18 18:09:32 tnn Exp $ NOTE ANY CHANGES YOU MAKE TO THE EFI BOOTLOADER HERE. The format of this file is important - make sure the entries are appended on end, last item @@ -25,3 +25,4 @@ is taken as the current. 2.2: Remove support for storing settings in EFI env vars. 2.3: EFI RT and GOP support for devicetree mode. 2.4: Add ISO9660 support. +2.5: Recognize the EFI system partion as fstype MSDOS.
CVS commit: [netbsd-9] src/external/mit/xorg/bin/xinit
Module Name:src Committed By: martin Date: Sun Oct 18 18:08:46 UTC 2020 Modified Files: src/external/mit/xorg/bin/xinit [netbsd-9]: Makefile Log Message: Pull up following revision(s) (requested by nia in ticket #1115): external/mit/xorg/bin/xinit/Makefile: revision 1.8 external/mit/xorg/bin/xinit/Makefile: revision 1.9 Define CTWM when building xinit This will allow ctwm to eventually be used in the default xinitrc. also allow uxterm to be used in the default xinitrc To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.7.2.1 src/external/mit/xorg/bin/xinit/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/mit/xorg/bin/xinit/Makefile diff -u src/external/mit/xorg/bin/xinit/Makefile:1.7 src/external/mit/xorg/bin/xinit/Makefile:1.7.2.1 --- src/external/mit/xorg/bin/xinit/Makefile:1.7 Mon Mar 11 06:25:55 2019 +++ src/external/mit/xorg/bin/xinit/Makefile Sun Oct 18 18:08:46 2020 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.7 2019/03/11 06:25:55 mrg Exp $ +# $NetBSD: Makefile,v 1.7.2.1 2020/10/18 18:08:46 martin Exp $ .include @@ -13,10 +13,14 @@ CPPFLAGS+= ${X11FLAGS.CONNECTION} -DBIND CPPSCRIPTS= startx xinitrc CPPSCRIPTFLAGS_xinitrc= -DXINITDIR=${XINITDIR} -DBINDIR=${X11BINDIR} \ -DSHELL_CMD=/bin/sh -DXRDB=xrdb -DXMODMAP=xmodmap \ - -DTWM=twm -DXCLOCK=xclock -DXTERM=${X11BINDIR}/xterm + -DTWM=twm -DXCLOCK=xclock -DXTERM=${X11BINDIR}/xterm \ + -DUXTERM=${X11BINDIR}/uxterm \ + -DCTWM=${X11BINDIR}/ctwm CPPSCRIPTFLAGS_startx= -DXINITDIR=${XINITDIR} -DBINDIR=${X11BINDIR} \ -DSHELL_CMD=/bin/sh -DXAUTH=xauth -DXINIT=xinit \ -DXSERVER=${X11BINDIR}/X -DXTERM=${X11BINDIR}/xterm \ + -DUXTERM=${X11BINDIR}/uxterm \ + -DCTWM=${X11BINDIR}/ctwm \ -DHAS_COOKIE_MAKER \ -DMK_COOKIE='dd if=/dev/urandom bs=16 count=1 2>/dev/null | hexdump -e \\"%08x\\"'
CVS commit: src/sys/stand/efiboot
Module Name:src Committed By: tnn Date: Sun Oct 18 18:05:48 UTC 2020 Modified Files: src/sys/stand/efiboot: efiblock.c Log Message: efiboot: recognize the EFI system partition as fstype MSDOS To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/sys/stand/efiboot/efiblock.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/stand/efiboot/efiblock.c diff -u src/sys/stand/efiboot/efiblock.c:1.8 src/sys/stand/efiboot/efiblock.c:1.9 --- src/sys/stand/efiboot/efiblock.c:1.8 Sun Oct 11 14:03:33 2020 +++ src/sys/stand/efiboot/efiblock.c Sun Oct 18 18:05:48 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: efiblock.c,v 1.8 2020/10/11 14:03:33 jmcneill Exp $ */ +/* $NetBSD: efiblock.c,v 1.9 2020/10/18 18:05:48 tnn Exp $ */ /*- * Copyright (c) 2016 Kimihiro Nonaka @@ -269,6 +269,7 @@ static const struct { { GPT_ENT_TYPE_NETBSD_CCD, FS_CCD }, { GPT_ENT_TYPE_NETBSD_CGD, FS_CGD }, { GPT_ENT_TYPE_MS_BASIC_DATA, FS_MSDOS }, /* or NTFS? ambiguous */ + { GPT_ENT_TYPE_EFI, FS_MSDOS }, }; static int
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sun Oct 18 17:41:07 UTC 2020 Modified Files: src/usr.bin/make: suff.c Log Message: make(1): extract duplicate code from SuffAddSrc into separate function To generate a diff of this commit: cvs rdiff -u -r1.189 -r1.190 src/usr.bin/make/suff.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/suff.c diff -u src/usr.bin/make/suff.c:1.189 src/usr.bin/make/suff.c:1.190 --- src/usr.bin/make/suff.c:1.189 Sun Oct 18 17:19:54 2020 +++ src/usr.bin/make/suff.c Sun Oct 18 17:41:06 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: suff.c,v 1.189 2020/10/18 17:19:54 rillig Exp $ */ +/* $NetBSD: suff.c,v 1.190 2020/10/18 17:41:06 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -129,7 +129,7 @@ #include "dir.h" /* "@(#)suff.c 8.4 (Berkeley) 3/21/94" */ -MAKE_RCSID("$NetBSD: suff.c,v 1.189 2020/10/18 17:19:54 rillig Exp $"); +MAKE_RCSID("$NetBSD: suff.c,v 1.190 2020/10/18 17:41:06 rillig Exp $"); #define SUFF_DEBUG0(text) DEBUG0(SUFF, text) #define SUFF_DEBUG1(fmt, arg1) DEBUG1(SUFF, fmt, arg1) @@ -880,6 +880,29 @@ PrintAddr(void *a, void *b MAKE_ATTR_UNU } #endif +static void +SuffAddSrc(Suff *suff, SrcList *srcList, Src *targ, char *srcName, + const char *debug_tag) +{ +Src *s2 = bmake_malloc(sizeof(Src)); +s2->file = srcName; +s2->pref = targ->pref; +s2->parent = targ; +s2->node = NULL; +s2->suff = suff; +suff->refCount++; +s2->children = 0; +targ->children++; +Lst_Append(srcList, s2); +#ifdef DEBUG_SRC +s2->cp = Lst_New(); +Lst_Append(targ->cp, s2); +debug_printf("%s add %p %p to %p:", debug_tag, targ, s2, srcList); +Lst_ForEach(srcList, PrintAddr, NULL); +debug_printf("\n"); +#endif +} + /* Add a suffix as a Src structure to the given list with its parent * being the given Src structure. If the suffix is the null suffix, * the prefix is used unaltered as the file name in the Src structure. @@ -890,51 +913,17 @@ PrintAddr(void *a, void *b MAKE_ATTR_UNU * targ parent for the new Src */ static void -SuffAddSrc(Suff *suff, SrcList *srcList, Src *targ) +SuffAddSources(Suff *suff, SrcList *srcList, Src *targ) { -Src *s2; /* new Src structure */ - if ((suff->flags & SUFF_NULL) && suff->name[0] != '\0') { /* * If the suffix has been marked as the NULL suffix, also create a Src * structure for a file with no suffix attached. Two birds, and all * that... */ - s2 = bmake_malloc(sizeof(Src)); - s2->file = bmake_strdup(targ->pref); - s2->pref = targ->pref; - s2->parent = targ; - s2->node = NULL; - s2->suff = suff; - suff->refCount++; - s2->children = 0; - targ->children++; - Lst_Append(srcList, s2); -#ifdef DEBUG_SRC - s2->cp = Lst_New(); - Lst_Append(targ->cp, s2); - debug_printf("1 add %p %p to %p:", targ, s2, srcList); - Lst_ForEach(srcList, PrintAddr, NULL); - debug_printf("\n"); -#endif + SuffAddSrc(suff, srcList, targ, bmake_strdup(targ->pref), "1"); } -s2 = bmake_malloc(sizeof(Src)); -s2->file = str_concat2(targ->pref, suff->name); -s2->pref = targ->pref; -s2->parent = targ; -s2->node = NULL; -s2->suff = suff; -suff->refCount++; -s2->children = 0; -targ->children++; -Lst_Append(srcList, s2); -#ifdef DEBUG_SRC -s2->cp = Lst_New(); -Lst_Append(targ->cp, s2); -debug_printf("2 add %p %p to %p:", targ, s2, srcList); -Lst_ForEach(srcList, PrintAddr, NULL); -debug_printf("\n"); -#endif +SuffAddSrc(suff, srcList, targ, str_concat2(targ->pref, suff->name), "2"); } /* Add all the children of targ as Src structures to the given list. @@ -949,7 +938,7 @@ SuffAddLevel(SrcList *l, Src *targ) SrcListNode *ln; for (ln = targ->suff->children->first; ln != NULL; ln = ln->next) { Suff *childSuff = ln->datum; - SuffAddSrc(childSuff, l, targ); + SuffAddSources(childSuff, l, targ); } }
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sun Oct 18 17:19:54 UTC 2020 Modified Files: src/usr.bin/make: cond.c dir.c for.c lst.h make.h nonints.h parse.c suff.c trace.h var.c Log Message: make(1): add tags to enum types This allows IDEs to offer better type information than "anonymous enum". To generate a diff of this commit: cvs rdiff -u -r1.163 -r1.164 src/usr.bin/make/cond.c cvs rdiff -u -r1.169 -r1.170 src/usr.bin/make/dir.c cvs rdiff -u -r1.93 -r1.94 src/usr.bin/make/for.c cvs rdiff -u -r1.71 -r1.72 src/usr.bin/make/lst.h cvs rdiff -u -r1.158 -r1.159 src/usr.bin/make/make.h cvs rdiff -u -r1.142 -r1.143 src/usr.bin/make/nonints.h cvs rdiff -u -r1.385 -r1.386 src/usr.bin/make/parse.c cvs rdiff -u -r1.188 -r1.189 src/usr.bin/make/suff.c cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/trace.h cvs rdiff -u -r1.577 -r1.578 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/cond.c diff -u src/usr.bin/make/cond.c:1.163 src/usr.bin/make/cond.c:1.164 --- src/usr.bin/make/cond.c:1.163 Sat Oct 17 17:47:14 2020 +++ src/usr.bin/make/cond.c Sun Oct 18 17:19:54 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: cond.c,v 1.163 2020/10/17 17:47:14 rillig Exp $ */ +/* $NetBSD: cond.c,v 1.164 2020/10/18 17:19:54 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -93,7 +93,7 @@ #include "dir.h" /* "@(#)cond.c 8.2 (Berkeley) 1/2/94" */ -MAKE_RCSID("$NetBSD: cond.c,v 1.163 2020/10/17 17:47:14 rillig Exp $"); +MAKE_RCSID("$NetBSD: cond.c,v 1.164 2020/10/18 17:19:54 rillig Exp $"); /* * The parsing of conditional expressions is based on this grammar: @@ -133,7 +133,7 @@ MAKE_RCSID("$NetBSD: cond.c,v 1.163 2020 * All non-terminal functions (CondParser_Expr, CondParser_Factor and * CondParser_Term) return either TOK_FALSE, TOK_TRUE, or TOK_ERROR on error. */ -typedef enum { +typedef enum Token { TOK_FALSE = 0, TOK_TRUE = 1, TOK_AND, TOK_OR, TOK_NOT, TOK_LPAREN, TOK_RPAREN, TOK_EOF, TOK_NONE, TOK_ERROR } Token; Index: src/usr.bin/make/dir.c diff -u src/usr.bin/make/dir.c:1.169 src/usr.bin/make/dir.c:1.170 --- src/usr.bin/make/dir.c:1.169 Sun Oct 18 14:36:09 2020 +++ src/usr.bin/make/dir.c Sun Oct 18 17:19:54 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: dir.c,v 1.169 2020/10/18 14:36:09 rillig Exp $ */ +/* $NetBSD: dir.c,v 1.170 2020/10/18 17:19:54 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -135,7 +135,7 @@ #include "job.h" /* "@(#)dir.c 8.2 (Berkeley) 1/2/94" */ -MAKE_RCSID("$NetBSD: dir.c,v 1.169 2020/10/18 14:36:09 rillig Exp $"); +MAKE_RCSID("$NetBSD: dir.c,v 1.170 2020/10/18 17:19:54 rillig Exp $"); #define DIR_DEBUG0(text) DEBUG0(DIR, text) #define DIR_DEBUG1(fmt, arg1) DEBUG1(DIR, fmt, arg1) @@ -313,7 +313,7 @@ struct cache_st { }; /* minimize changes below */ -typedef enum { +typedef enum CachedStatsFlags { CST_LSTAT = 0x01, /* call lstat(2) instead of stat(2) */ CST_UPDATE = 0x02 /* ignore existing cached entry */ } CachedStatsFlags; Index: src/usr.bin/make/for.c diff -u src/usr.bin/make/for.c:1.93 src/usr.bin/make/for.c:1.94 --- src/usr.bin/make/for.c:1.93 Mon Oct 5 20:21:30 2020 +++ src/usr.bin/make/for.c Sun Oct 18 17:19:54 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: for.c,v 1.93 2020/10/05 20:21:30 rillig Exp $ */ +/* $NetBSD: for.c,v 1.94 2020/10/18 17:19:54 rillig Exp $ */ /* * Copyright (c) 1992, The Regents of the University of California. @@ -61,9 +61,9 @@ #include"strlist.h" /* "@(#)for.c 8.1 (Berkeley) 6/6/93" */ -MAKE_RCSID("$NetBSD: for.c,v 1.93 2020/10/05 20:21:30 rillig Exp $"); +MAKE_RCSID("$NetBSD: for.c,v 1.94 2020/10/18 17:19:54 rillig Exp $"); -typedef enum { +typedef enum ForEscapes { FOR_SUB_ESCAPE_CHAR = 0x0001, FOR_SUB_ESCAPE_BRACE = 0x0002, FOR_SUB_ESCAPE_PAREN = 0x0004 Index: src/usr.bin/make/lst.h diff -u src/usr.bin/make/lst.h:1.71 src/usr.bin/make/lst.h:1.72 --- src/usr.bin/make/lst.h:1.71 Sun Oct 18 13:02:10 2020 +++ src/usr.bin/make/lst.h Sun Oct 18 17:19:54 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: lst.h,v 1.71 2020/10/18 13:02:10 rillig Exp $ */ +/* $NetBSD: lst.h,v 1.72 2020/10/18 17:19:54 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -101,7 +101,7 @@ struct ListNode { }; }; -typedef enum { +typedef enum ListForEachUntilWhere { Head, Middle, Tail, Unknown } ListForEachUntilWhere; Index: src/usr.bin/make/make.h diff -u src/usr.bin/make/make.h:1.158 src/usr.bin/make/make.h:1.159 --- src/usr.bin/make/make.h:1.158 Sun Oct 18 12:36:43 2020 +++ src/usr.bin/make/make.h Sun Oct 18 17:19:54 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: make.h,v 1.158 2020/10/18 12:36:43 rillig Exp $ */ +/* $NetBSD: make.h,v 1.159 2020/10/18 17:19:54 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -145,7 +145,7 @@ typedef
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sun Oct 18 17:12:43 UTC 2020 Modified Files: src/usr.bin/make: suff.c Log Message: make(1): improve parameter names for suffix functions Both gs_gnp and gnp were terrible variable names that didn't give the slightest clue about the variable's purpose. To generate a diff of this commit: cvs rdiff -u -r1.187 -r1.188 src/usr.bin/make/suff.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/suff.c diff -u src/usr.bin/make/suff.c:1.187 src/usr.bin/make/suff.c:1.188 --- src/usr.bin/make/suff.c:1.187 Sun Oct 18 17:06:14 2020 +++ src/usr.bin/make/suff.c Sun Oct 18 17:12:43 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: suff.c,v 1.187 2020/10/18 17:06:14 rillig Exp $ */ +/* $NetBSD: suff.c,v 1.188 2020/10/18 17:12:43 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -129,7 +129,7 @@ #include "dir.h" /* "@(#)suff.c 8.4 (Berkeley) 3/21/94" */ -MAKE_RCSID("$NetBSD: suff.c,v 1.187 2020/10/18 17:06:14 rillig Exp $"); +MAKE_RCSID("$NetBSD: suff.c,v 1.188 2020/10/18 17:12:43 rillig Exp $"); #define SUFF_DEBUG0(text) DEBUG0(SUFF, text) #define SUFF_DEBUG1(fmt, arg1) DEBUG1(SUFF, fmt, arg1) @@ -696,13 +696,13 @@ SuffRebuildGraph(void *transformp, void * TRUE iff a new main target has been selected. */ static Boolean -SuffScanTargets(GNode *target, GNode **gs_gnp, Suff *gs_s, Boolean *gs_r) +SuffScanTargets(GNode *target, GNode **inout_main, Suff *gs_s, Boolean *gs_r) { Suff *s, *t; char *ptr; -if (*gs_gnp == NULL && *gs_r && (target->type & OP_NOTARGET) == 0) { - *gs_gnp = target; +if (*inout_main == NULL && *gs_r && !(target->type & OP_NOTARGET)) { + *inout_main = target; Targ_SetMain(target); return TRUE; } @@ -715,9 +715,9 @@ SuffScanTargets(GNode *target, GNode **g return FALSE; if (SuffParseTransform(target->name, &s, &t)) { - if (*gs_gnp == target) { + if (*inout_main == target) { *gs_r = TRUE; - *gs_gnp = NULL; + *inout_main = NULL; Targ_SetMain(NULL); } Lst_Free(target->children); @@ -740,13 +740,13 @@ SuffScanTargets(GNode *target, GNode **g * This is ugly, but other makes treat all targets that start with a '.' as * suffix rules. */ static void -UpdateTargets(GNode **gnp, Suff *s) +UpdateTargets(GNode **inout_main, Suff *s) { Boolean r = FALSE; GNodeListNode *ln; for (ln = Targ_List()->first; ln != NULL; ln = ln->next) { GNode *gn = ln->datum; - if (SuffScanTargets(gn, gnp, s, &r)) + if (SuffScanTargets(gn, inout_main, s, &r)) break; } } @@ -763,7 +763,7 @@ UpdateTargets(GNode **gnp, Suff *s) * name the name of the suffix to add */ void -Suff_AddSuffix(const char *name, GNode **gnp) +Suff_AddSuffix(const char *name, GNode **inout_main) { Suff *s = FindSuffByName(name); if (s != NULL) @@ -772,7 +772,7 @@ Suff_AddSuffix(const char *name, GNode * s = SuffNew(name); Lst_Append(sufflist, s); -UpdateTargets(gnp, s); +UpdateTargets(inout_main, s); /* * Look for any existing transformations from or to this suffix.
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sun Oct 18 17:06:14 UTC 2020 Modified Files: src/usr.bin/make: suff.c Log Message: make(1): extract UpdateTargets from Suff_AddSuffix To generate a diff of this commit: cvs rdiff -u -r1.186 -r1.187 src/usr.bin/make/suff.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/suff.c diff -u src/usr.bin/make/suff.c:1.186 src/usr.bin/make/suff.c:1.187 --- src/usr.bin/make/suff.c:1.186 Sun Oct 18 17:00:22 2020 +++ src/usr.bin/make/suff.c Sun Oct 18 17:06:14 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: suff.c,v 1.186 2020/10/18 17:00:22 rillig Exp $ */ +/* $NetBSD: suff.c,v 1.187 2020/10/18 17:06:14 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -129,7 +129,7 @@ #include "dir.h" /* "@(#)suff.c 8.4 (Berkeley) 3/21/94" */ -MAKE_RCSID("$NetBSD: suff.c,v 1.186 2020/10/18 17:00:22 rillig Exp $"); +MAKE_RCSID("$NetBSD: suff.c,v 1.187 2020/10/18 17:06:14 rillig Exp $"); #define SUFF_DEBUG0(text) DEBUG0(SUFF, text) #define SUFF_DEBUG1(fmt, arg1) DEBUG1(SUFF, fmt, arg1) @@ -734,6 +734,23 @@ SuffScanTargets(GNode *target, GNode **g return FALSE; } +/* Look at all existing targets to see if adding this suffix will make one + * of the current targets mutate into a suffix rule. + * + * This is ugly, but other makes treat all targets that start with a '.' as + * suffix rules. */ +static void +UpdateTargets(GNode **gnp, Suff *s) +{ +Boolean r = FALSE; +GNodeListNode *ln; +for (ln = Targ_List()->first; ln != NULL; ln = ln->next) { + GNode *gn = ln->datum; + if (SuffScanTargets(gn, gnp, s, &r)) + break; +} +} + /* Add the suffix to the end of the list of known suffixes. * Should we restructure the suffix graph? Make doesn't... * @@ -755,21 +772,7 @@ Suff_AddSuffix(const char *name, GNode * s = SuffNew(name); Lst_Append(sufflist, s); -/* - * We also look at our existing targets list to see if adding - * this suffix will make one of our current targets mutate into - * a suffix rule. This is ugly, but other makes treat all targets - * that start with a . as suffix rules. - */ -{ -Boolean r = FALSE; - GNodeListNode *ln; - for (ln = Targ_List()->first; ln != NULL; ln = ln->next) { - GNode *gn = ln->datum; - if (SuffScanTargets(gn, gnp, s, &r)) - break; - } -} +UpdateTargets(gnp, s); /* * Look for any existing transformations from or to this suffix.
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sun Oct 18 17:00:22 UTC 2020 Modified Files: src/usr.bin/make: suff.c Log Message: make(1): inline struct SuffScanTargetsArgs into SuffScanTargets To generate a diff of this commit: cvs rdiff -u -r1.185 -r1.186 src/usr.bin/make/suff.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/suff.c diff -u src/usr.bin/make/suff.c:1.185 src/usr.bin/make/suff.c:1.186 --- src/usr.bin/make/suff.c:1.185 Sun Oct 18 16:01:44 2020 +++ src/usr.bin/make/suff.c Sun Oct 18 17:00:22 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: suff.c,v 1.185 2020/10/18 16:01:44 rillig Exp $ */ +/* $NetBSD: suff.c,v 1.186 2020/10/18 17:00:22 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -129,7 +129,7 @@ #include "dir.h" /* "@(#)suff.c 8.4 (Berkeley) 3/21/94" */ -MAKE_RCSID("$NetBSD: suff.c,v 1.185 2020/10/18 16:01:44 rillig Exp $"); +MAKE_RCSID("$NetBSD: suff.c,v 1.186 2020/10/18 17:00:22 rillig Exp $"); #define SUFF_DEBUG0(text) DEBUG0(SUFF, text) #define SUFF_DEBUG1(fmt, arg1) DEBUG1(SUFF, fmt, arg1) @@ -685,48 +685,39 @@ SuffRebuildGraph(void *transformp, void } } -struct SuffScanTargetsArgs { -GNode **const gnp; -Suff *const s; -Boolean r; -}; - -/* Called from Suff_AddSuffix via Lst_ForEachUntil to search through the list of - * existing targets and find if any of the existing targets can be turned - * into a transformation rule. +/* During Suff_AddSuffix, search through the list of existing targets and find + * if any of the existing targets can be turned into a transformation rule. * * If such a target is found and the target is the current main target, the * main target is set to NULL and the next target examined (if that exists) * becomes the main target. * * Results: - * 1 if a new main target has been selected, 0 otherwise. + * TRUE iff a new main target has been selected. */ -static int -SuffScanTargets(void *targetp, void *gsp) +static Boolean +SuffScanTargets(GNode *target, GNode **gs_gnp, Suff *gs_s, Boolean *gs_r) { -GNode *target = targetp; -struct SuffScanTargetsArgs *gs = gsp; Suff *s, *t; char *ptr; -if (*gs->gnp == NULL && gs->r && (target->type & OP_NOTARGET) == 0) { - *gs->gnp = target; +if (*gs_gnp == NULL && *gs_r && (target->type & OP_NOTARGET) == 0) { + *gs_gnp = target; Targ_SetMain(target); - return 1; + return TRUE; } if (target->type == OP_TRANSFORM) - return 0; + return FALSE; -if ((ptr = strstr(target->name, gs->s->name)) == NULL || +if ((ptr = strstr(target->name, gs_s->name)) == NULL || ptr == target->name) - return 0; + return FALSE; if (SuffParseTransform(target->name, &s, &t)) { - if (*gs->gnp == target) { - gs->r = TRUE; - *gs->gnp = NULL; + if (*gs_gnp == target) { + *gs_r = TRUE; + *gs_gnp = NULL; Targ_SetMain(NULL); } Lst_Free(target->children); @@ -740,7 +731,7 @@ SuffScanTargets(void *targetp, void *gsp SuffInsert(t->children, s); SuffInsert(s->parents, t); } -return 0; +return FALSE; } /* Add the suffix to the end of the list of known suffixes. @@ -771,8 +762,13 @@ Suff_AddSuffix(const char *name, GNode * * that start with a . as suffix rules. */ { - struct SuffScanTargetsArgs args = { gnp, s, FALSE }; - Lst_ForEachUntil(Targ_List(), SuffScanTargets, &args); +Boolean r = FALSE; + GNodeListNode *ln; + for (ln = Targ_List()->first; ln != NULL; ln = ln->next) { + GNode *gn = ln->datum; + if (SuffScanTargets(gn, gnp, s, &r)) + break; + } } /*
CVS commit: src
Module Name:src Committed By: rillig Date: Sun Oct 18 16:33:18 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: suff-main.exp suff-main.mk Log Message: make(1): add test for turning a target into a transformation To generate a diff of this commit: cvs rdiff -u -r1.942 -r1.943 src/distrib/sets/lists/tests/mi cvs rdiff -u -r1.166 -r1.167 src/usr.bin/make/unit-tests/Makefile cvs rdiff -u -r0 -r1.1 src/usr.bin/make/unit-tests/suff-main.exp \ src/usr.bin/make/unit-tests/suff-main.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.942 src/distrib/sets/lists/tests/mi:1.943 --- src/distrib/sets/lists/tests/mi:1.942 Fri Oct 16 07:12:26 2020 +++ src/distrib/sets/lists/tests/mi Sun Oct 18 16:33:18 2020 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.942 2020/10/16 07:12:26 mgorny Exp $ +# $NetBSD: mi,v 1.943 2020/10/18 16:33:18 rillig Exp $ # # Note: don't delete entries from here - mark them as "obsolete" instead. # @@ -4987,6 +4987,8 @@ ./usr/tests/usr.bin/make/unit-tests/shell-ksh.mktests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/make/unit-tests/shell-sh.exptests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/make/unit-tests/shell-sh.mk tests-usr.bin-tests compattestfile,atf +./usr/tests/usr.bin/make/unit-tests/suff-main.exptests-usr.bin-tests compattestfile,atf +./usr/tests/usr.bin/make/unit-tests/suff-main.mktests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/make/unit-tests/suff-rebuild.exptests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/make/unit-tests/suff-rebuild.mktests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/make/unit-tests/suffixes.exptests-usr.bin-tests compattestfile,atf Index: src/usr.bin/make/unit-tests/Makefile diff -u src/usr.bin/make/unit-tests/Makefile:1.166 src/usr.bin/make/unit-tests/Makefile:1.167 --- src/usr.bin/make/unit-tests/Makefile:1.166 Sat Oct 17 16:53:26 2020 +++ src/usr.bin/make/unit-tests/Makefile Sun Oct 18 16:33:18 2020 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.166 2020/10/17 16:53:26 rillig Exp $ +# $NetBSD: Makefile,v 1.167 2020/10/18 16:33:18 rillig Exp $ # # Unit tests for make(1) # @@ -250,6 +250,7 @@ TESTS+= shell-custom TESTS+= shell-ksh TESTS+= shell-sh TESTS+= # suffixes # runs into an endless loop (try -dA) +TESTS+= suff-main TESTS+= suff-rebuild TESTS+= sunshcmd TESTS+= sysv Added files: Index: src/usr.bin/make/unit-tests/suff-main.exp diff -u /dev/null src/usr.bin/make/unit-tests/suff-main.exp:1.1 --- /dev/null Sun Oct 18 16:33:18 2020 +++ src/usr.bin/make/unit-tests/suff-main.exp Sun Oct 18 16:33:18 2020 @@ -0,0 +1,2 @@ +: Making next-main +exit status 0 Index: src/usr.bin/make/unit-tests/suff-main.mk diff -u /dev/null src/usr.bin/make/unit-tests/suff-main.mk:1.1 --- /dev/null Sun Oct 18 16:33:18 2020 +++ src/usr.bin/make/unit-tests/suff-main.mk Sun Oct 18 16:33:18 2020 @@ -0,0 +1,22 @@ +# $NetBSD: suff-main.mk,v 1.1 2020/10/18 16:33:18 rillig Exp $ +# +# Demonstrate that an inference rule is considered the main target if its +# suffixes are not known at the point of declaration. + +.1.2: + : Making ${.TARGET} from ${.IMPSRC}. + +# At this point, the target '.1.2' is a normal target. +# Since it is the first target in the first dependency declaration, +# it becomes the main target. + +next-main: + : Making ${.TARGET} + +# At this point, 'next-main' is effectively ignored. + +# Declaring both '.1' and '.2' as suffixes turns the '.1.2' target into an +# inference rule (OP_TRANSFORM). As a side effect, this target is no longer +# a candidate for the main target. Therefore the next target is selected as +# the main target, which in this case is 'next-main'. +.SUFFIXES: .1 .2
CVS commit: src/sys/arch/arm
Module Name:src Committed By: skrll Date: Sun Oct 18 16:28:57 UTC 2020 Modified Files: src/sys/arch/arm/arm: bootconfig.c src/sys/arch/arm/include: bootconfig.h Log Message: Trailing whitespace To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/sys/arch/arm/arm/bootconfig.c cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/include/bootconfig.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/arch/arm/arm/bootconfig.c diff -u src/sys/arch/arm/arm/bootconfig.c:1.12 src/sys/arch/arm/arm/bootconfig.c:1.13 --- src/sys/arch/arm/arm/bootconfig.c:1.12 Fri Jul 10 12:25:08 2020 +++ src/sys/arch/arm/arm/bootconfig.c Sun Oct 18 16:28:57 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: bootconfig.c,v 1.12 2020/07/10 12:25:08 skrll Exp $ */ +/* $NetBSD: bootconfig.c,v 1.13 2020/10/18 16:28:57 skrll Exp $ */ /* * Copyright (c) 1994-1998 Mark Brinicombe. @@ -40,7 +40,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: bootconfig.c,v 1.12 2020/07/10 12:25:08 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: bootconfig.c,v 1.13 2020/10/18 16:28:57 skrll Exp $"); #include #include @@ -51,7 +51,7 @@ __KERNEL_RCSID(0, "$NetBSD: bootconfig.c #include #endif -/* +/* * Function to identify and process different types of boot argument * Note, results may contain trailing data, eg: * get_bootconf_option("cow=moo milk=1", "moo", BOOTOPT_TYPE_STRING, &ptr) @@ -109,7 +109,7 @@ get_bootconf_option(char *opts, const ch break; case BOOTOPT_TYPE_STRING : *((char **)result) = ptr; - break; + break; case BOOTOPT_TYPE_INT : *((int *)result) = (u_int)strtoul(ptr, NULL, 10); Index: src/sys/arch/arm/include/bootconfig.h diff -u src/sys/arch/arm/include/bootconfig.h:1.9 src/sys/arch/arm/include/bootconfig.h:1.10 --- src/sys/arch/arm/include/bootconfig.h:1.9 Sat Mar 3 16:11:22 2018 +++ src/sys/arch/arm/include/bootconfig.h Sun Oct 18 16:28:57 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: bootconfig.h,v 1.9 2018/03/03 16:11:22 skrll Exp $ */ +/* $NetBSD: bootconfig.h,v 1.10 2020/10/18 16:28:57 skrll Exp $ */ /* * Copyright (c) 1994 Mark Brinicombe. @@ -49,7 +49,7 @@ #define BOOTOPT_TYPE_MASK 7 struct boot_physmem { - paddr_t bp_start; /* starting PFN (not address) */ + paddr_t bp_start; /* starting PFN (not address) */ psize_t bp_pages; /* # of pages */ u_int bp_freelist; /* VM_FREELIST_ * */ u_int bp_flags;
CVS commit: src/usr.bin/make/unit-tests
Module Name:src Committed By: rillig Date: Sun Oct 18 16:12:39 UTC 2020 Modified Files: src/usr.bin/make/unit-tests: suff-rebuild.mk Log Message: make(1): fix typo in test suff-rebuild.mk To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/usr.bin/make/unit-tests/suff-rebuild.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/suff-rebuild.mk diff -u src/usr.bin/make/unit-tests/suff-rebuild.mk:1.1 src/usr.bin/make/unit-tests/suff-rebuild.mk:1.2 --- src/usr.bin/make/unit-tests/suff-rebuild.mk:1.1 Fri Sep 25 18:18:25 2020 +++ src/usr.bin/make/unit-tests/suff-rebuild.mk Sun Oct 18 16:12:39 2020 @@ -1,4 +1,4 @@ -# $NetBSD: suff-rebuild.mk,v 1.1 2020/09/25 18:18:25 rillig Exp $ +# $NetBSD: suff-rebuild.mk,v 1.2 2020/10/18 16:12:39 rillig Exp $ # # Demonstrates what happens to transformation rules (called inference rules # by POSIX) when all suffixes are deleted. @@ -19,7 +19,7 @@ suff-rebuild-example.a: .c: : from c to nothing -# XXX: At a quick glance, the code in SuffScanTargets looks at if it were +# XXX: At a quick glance, the code in SuffScanTargets looks as if it were # possible to delete the suffixes in the middle of the makefile, add back # the suffixes from before, and have the transformation rules preserved. #
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sun Oct 18 16:01:44 UTC 2020 Modified Files: src/usr.bin/make: suff.c Log Message: make(1): rename struct GNodeSuff to SuffScanTargetsArgs To generate a diff of this commit: cvs rdiff -u -r1.184 -r1.185 src/usr.bin/make/suff.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/suff.c diff -u src/usr.bin/make/suff.c:1.184 src/usr.bin/make/suff.c:1.185 --- src/usr.bin/make/suff.c:1.184 Sun Oct 18 15:53:47 2020 +++ src/usr.bin/make/suff.c Sun Oct 18 16:01:44 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: suff.c,v 1.184 2020/10/18 15:53:47 rillig Exp $ */ +/* $NetBSD: suff.c,v 1.185 2020/10/18 16:01:44 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -129,7 +129,7 @@ #include "dir.h" /* "@(#)suff.c 8.4 (Berkeley) 3/21/94" */ -MAKE_RCSID("$NetBSD: suff.c,v 1.184 2020/10/18 15:53:47 rillig Exp $"); +MAKE_RCSID("$NetBSD: suff.c,v 1.185 2020/10/18 16:01:44 rillig Exp $"); #define SUFF_DEBUG0(text) DEBUG0(SUFF, text) #define SUFF_DEBUG1(fmt, arg1) DEBUG1(SUFF, fmt, arg1) @@ -195,13 +195,6 @@ typedef struct Src { #endif } Src; -/* XXX: Name doesn't match content */ -typedef struct GNodeSuff { -GNode **gnp; -Suff *s; -Boolean r; -} GNodeSuff; - static Suff *suffNull; /* The NULL suffix for this run */ static Suff *emptySuff; /* The empty suffix required for POSIX * single-suffix transformation rules */ @@ -692,6 +685,12 @@ SuffRebuildGraph(void *transformp, void } } +struct SuffScanTargetsArgs { +GNode **const gnp; +Suff *const s; +Boolean r; +}; + /* Called from Suff_AddSuffix via Lst_ForEachUntil to search through the list of * existing targets and find if any of the existing targets can be turned * into a transformation rule. @@ -706,8 +705,8 @@ SuffRebuildGraph(void *transformp, void static int SuffScanTargets(void *targetp, void *gsp) { -GNode *target = (GNode *)targetp; -GNodeSuff *gs = (GNodeSuff *)gsp; +GNode *target = targetp; +struct SuffScanTargetsArgs *gs = gsp; Suff *s, *t; char *ptr; @@ -758,8 +757,6 @@ SuffScanTargets(void *targetp, void *gsp void Suff_AddSuffix(const char *name, GNode **gnp) { -GNodeSuff gs; - Suff *s = FindSuffByName(name); if (s != NULL) return; @@ -773,10 +770,10 @@ Suff_AddSuffix(const char *name, GNode * * a suffix rule. This is ugly, but other makes treat all targets * that start with a . as suffix rules. */ -gs.gnp = gnp; -gs.s = s; -gs.r = FALSE; -Lst_ForEachUntil(Targ_List(), SuffScanTargets, &gs); +{ + struct SuffScanTargetsArgs args = { gnp, s, FALSE }; + Lst_ForEachUntil(Targ_List(), SuffScanTargets, &args); +} /* * Look for any existing transformations from or to this suffix.
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sun Oct 18 15:53:47 UTC 2020 Modified Files: src/usr.bin/make: suff.c Log Message: make(1): inline struct LstSrc into SuffAddSrc The variable names are still confusing. There was no useful documentation on the struct, and the code in SuffAddSrc is highly redundant. Maybe the next few refactorings will shed light on this part of the code. To generate a diff of this commit: cvs rdiff -u -r1.183 -r1.184 src/usr.bin/make/suff.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/suff.c diff -u src/usr.bin/make/suff.c:1.183 src/usr.bin/make/suff.c:1.184 --- src/usr.bin/make/suff.c:1.183 Sun Oct 18 15:40:54 2020 +++ src/usr.bin/make/suff.c Sun Oct 18 15:53:47 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: suff.c,v 1.183 2020/10/18 15:40:54 rillig Exp $ */ +/* $NetBSD: suff.c,v 1.184 2020/10/18 15:53:47 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -129,7 +129,7 @@ #include "dir.h" /* "@(#)suff.c 8.4 (Berkeley) 3/21/94" */ -MAKE_RCSID("$NetBSD: suff.c,v 1.183 2020/10/18 15:40:54 rillig Exp $"); +MAKE_RCSID("$NetBSD: suff.c,v 1.184 2020/10/18 15:53:47 rillig Exp $"); #define SUFF_DEBUG0(text) DEBUG0(SUFF, text) #define SUFF_DEBUG1(fmt, arg1) DEBUG1(SUFF, fmt, arg1) @@ -195,15 +195,6 @@ typedef struct Src { #endif } Src; -/* - * A structure for passing more than one argument to the Lst-library-invoked - * function... - */ -typedef struct LstSrc { -SrcList *l; -Src *s; -} LstSrc; - /* XXX: Name doesn't match content */ typedef struct GNodeSuff { GNode **gnp; @@ -898,18 +889,16 @@ PrintAddr(void *a, void *b MAKE_ATTR_UNU * the prefix is used unaltered as the file name in the Src structure. * * Input: - * sp suffix for which to create a Src structure - * lsp list and parent for the new Src + * suff suffix for which to create a Src structure + * srcList list for the new Src + * targ parent for the new Src */ static void -SuffAddSrc(Suff *s, LstSrc *ls) +SuffAddSrc(Suff *suff, SrcList *srcList, Src *targ) { Src *s2; /* new Src structure */ -Src *targ; /* Target structure */ -targ = ls->s; - -if ((s->flags & SUFF_NULL) && s->name[0] != '\0') { +if ((suff->flags & SUFF_NULL) && suff->name[0] != '\0') { /* * If the suffix has been marked as the NULL suffix, also create a Src * structure for a file with no suffix attached. Two birds, and all @@ -920,34 +909,34 @@ SuffAddSrc(Suff *s, LstSrc *ls) s2->pref = targ->pref; s2->parent = targ; s2->node = NULL; - s2->suff = s; - s->refCount++; + s2->suff = suff; + suff->refCount++; s2->children = 0; targ->children++; - Lst_Append(ls->l, s2); + Lst_Append(srcList, s2); #ifdef DEBUG_SRC s2->cp = Lst_New(); Lst_Append(targ->cp, s2); - debug_printf("1 add %p %p to %p:", targ, s2, ls->l); - Lst_ForEach(ls->l, PrintAddr, NULL); + debug_printf("1 add %p %p to %p:", targ, s2, srcList); + Lst_ForEach(srcList, PrintAddr, NULL); debug_printf("\n"); #endif } s2 = bmake_malloc(sizeof(Src)); -s2->file = str_concat2(targ->pref, s->name); +s2->file = str_concat2(targ->pref, suff->name); s2->pref = targ->pref; s2->parent = targ; s2->node = NULL; -s2->suff = s; -s->refCount++; +s2->suff = suff; +suff->refCount++; s2->children = 0; targ->children++; -Lst_Append(ls->l, s2); +Lst_Append(srcList, s2); #ifdef DEBUG_SRC s2->cp = Lst_New(); Lst_Append(targ->cp, s2); -debug_printf("2 add %p %p to %p:", targ, s2, ls->l); -Lst_ForEach(ls->l, PrintAddr, NULL); +debug_printf("2 add %p %p to %p:", targ, s2, srcList); +Lst_ForEach(srcList, PrintAddr, NULL); debug_printf("\n"); #endif } @@ -964,8 +953,7 @@ SuffAddLevel(SrcList *l, Src *targ) SrcListNode *ln; for (ln = targ->suff->children->first; ln != NULL; ln = ln->next) { Suff *childSuff = ln->datum; - LstSrc ls = { l, targ }; - SuffAddSrc(childSuff, &ls); + SuffAddSrc(childSuff, l, targ); } }
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sun Oct 18 15:40:55 UTC 2020 Modified Files: src/usr.bin/make: suff.c Log Message: make(1): remove void pointers from SuffAddSrc To generate a diff of this commit: cvs rdiff -u -r1.182 -r1.183 src/usr.bin/make/suff.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/suff.c diff -u src/usr.bin/make/suff.c:1.182 src/usr.bin/make/suff.c:1.183 --- src/usr.bin/make/suff.c:1.182 Sun Oct 18 15:31:43 2020 +++ src/usr.bin/make/suff.c Sun Oct 18 15:40:54 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: suff.c,v 1.182 2020/10/18 15:31:43 rillig Exp $ */ +/* $NetBSD: suff.c,v 1.183 2020/10/18 15:40:54 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -129,7 +129,7 @@ #include "dir.h" /* "@(#)suff.c 8.4 (Berkeley) 3/21/94" */ -MAKE_RCSID("$NetBSD: suff.c,v 1.182 2020/10/18 15:31:43 rillig Exp $"); +MAKE_RCSID("$NetBSD: suff.c,v 1.183 2020/10/18 15:40:54 rillig Exp $"); #define SUFF_DEBUG0(text) DEBUG0(SUFF, text) #define SUFF_DEBUG1(fmt, arg1) DEBUG1(SUFF, fmt, arg1) @@ -902,10 +902,8 @@ PrintAddr(void *a, void *b MAKE_ATTR_UNU * lsp list and parent for the new Src */ static void -SuffAddSrc(void *sp, void *lsp) +SuffAddSrc(Suff *s, LstSrc *ls) { -Suff *s = (Suff *)sp; -LstSrc *ls = (LstSrc *)lsp; Src *s2; /* new Src structure */ Src *targ; /* Target structure */ @@ -963,12 +961,12 @@ SuffAddSrc(void *sp, void *lsp) static void SuffAddLevel(SrcList *l, Src *targ) { -LstSrc ls; - -ls.s = targ; -ls.l = l; - -Lst_ForEach(targ->suff->children, SuffAddSrc, &ls); +SrcListNode *ln; +for (ln = targ->suff->children->first; ln != NULL; ln = ln->next) { + Suff *childSuff = ln->datum; + LstSrc ls = { l, targ }; + SuffAddSrc(childSuff, &ls); +} } /* Free the first Src in the list that doesn't have a reference count. @@ -977,7 +975,6 @@ static Boolean SuffRemoveSrc(SrcList *l) { SrcListNode *ln; -Src *s; Lst_Open(l); @@ -988,7 +985,7 @@ SuffRemoveSrc(SrcList *l) #endif while ((ln = Lst_Next(l)) != NULL) { - s = LstNode_Datum(ln); + Src *s = LstNode_Datum(ln); if (s->children == 0) { free(s->file); if (!s->parent)
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sun Oct 18 15:31:43 UTC 2020 Modified Files: src/usr.bin/make: suff.c Log Message: make(1): replace Lst_Open with simple iteration in SuffInsert To generate a diff of this commit: cvs rdiff -u -r1.181 -r1.182 src/usr.bin/make/suff.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/suff.c diff -u src/usr.bin/make/suff.c:1.181 src/usr.bin/make/suff.c:1.182 --- src/usr.bin/make/suff.c:1.181 Sun Oct 18 14:09:39 2020 +++ src/usr.bin/make/suff.c Sun Oct 18 15:31:43 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: suff.c,v 1.181 2020/10/18 14:09:39 rillig Exp $ */ +/* $NetBSD: suff.c,v 1.182 2020/10/18 15:31:43 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -129,7 +129,7 @@ #include "dir.h" /* "@(#)suff.c 8.4 (Berkeley) 3/21/94" */ -MAKE_RCSID("$NetBSD: suff.c,v 1.181 2020/10/18 14:09:39 rillig Exp $"); +MAKE_RCSID("$NetBSD: suff.c,v 1.182 2020/10/18 15:31:43 rillig Exp $"); #define SUFF_DEBUG0(text) DEBUG0(SUFF, text) #define SUFF_DEBUG1(fmt, arg1) DEBUG1(SUFF, fmt, arg1) @@ -384,14 +384,12 @@ SuffInsert(SuffList *l, Suff *s) SuffListNode *ln; /* current element in l we're examining */ Suff *s2 = NULL; /* the suffix descriptor in this element */ -Lst_Open(l); -while ((ln = Lst_Next(l)) != NULL) { +for (ln = l->first; ln != NULL; ln = ln->next) { s2 = LstNode_Datum(ln); if (s2->sNum >= s->sNum) { break; } } -Lst_Close(l); SUFF_DEBUG2("inserting %s(%d)...", s->name, s->sNum);
CVS commit: src/external/bsd/ntp
Module Name:src Committed By: christos Date: Sun Oct 18 15:20:13 UTC 2020 Modified Files: src/external/bsd/ntp/bin: Makefile src/external/bsd/ntp/bin/ntptrace: Makefile src/external/bsd/ntp/lib: Makefile Log Message: include where missing. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/external/bsd/ntp/bin/Makefile cvs rdiff -u -r1.1 -r1.2 src/external/bsd/ntp/bin/ntptrace/Makefile cvs rdiff -u -r1.1 -r1.2 src/external/bsd/ntp/lib/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/bsd/ntp/bin/Makefile diff -u src/external/bsd/ntp/bin/Makefile:1.4 src/external/bsd/ntp/bin/Makefile:1.5 --- src/external/bsd/ntp/bin/Makefile:1.4 Sun May 21 11:28:39 2017 +++ src/external/bsd/ntp/bin/Makefile Sun Oct 18 11:20:13 2020 @@ -1,9 +1,9 @@ -# $NetBSD: Makefile,v 1.4 2017/05/21 15:28:39 riastradh Exp $ +# $NetBSD: Makefile,v 1.5 2020/10/18 15:20:13 christos Exp $ + +.include SUBDIR= ntp-keygen ntpd ntpdate ntpdc ntpq ntptime ntptrace sntp CPPFLAGS+=-DOPENSSL -.include "Makefile.inc" - .include Index: src/external/bsd/ntp/bin/ntptrace/Makefile diff -u src/external/bsd/ntp/bin/ntptrace/Makefile:1.1 src/external/bsd/ntp/bin/ntptrace/Makefile:1.2 --- src/external/bsd/ntp/bin/ntptrace/Makefile:1.1 Sat Aug 28 11:42:45 2010 +++ src/external/bsd/ntp/bin/ntptrace/Makefile Sun Oct 18 11:20:13 2020 @@ -1,4 +1,6 @@ -# $NetBSD: Makefile,v 1.1 2010/08/28 15:42:45 kardel Exp $ +# $NetBSD: Makefile,v 1.2 2020/10/18 15:20:13 christos Exp $ + +.include MAN= ntptrace.8 BINDIR= /usr/sbin Index: src/external/bsd/ntp/lib/Makefile diff -u src/external/bsd/ntp/lib/Makefile:1.1 src/external/bsd/ntp/lib/Makefile:1.2 --- src/external/bsd/ntp/lib/Makefile:1.1 Sun Dec 13 12:13:48 2009 +++ src/external/bsd/ntp/lib/Makefile Sun Oct 18 11:20:13 2020 @@ -1,4 +1,6 @@ -# $NetBSD: Makefile,v 1.1 2009/12/13 17:13:48 kardel Exp $ +# $NetBSD: Makefile,v 1.2 2020/10/18 15:20:13 christos Exp $ + +.include SUBDIR+= libntp libiscntp libopts libparse
CVS commit: src/sys/modules
Module Name:src Committed By: christos Date: Sun Oct 18 15:02:12 UTC 2020 Modified Files: src/sys/modules/ffs: Makefile src/sys/modules/ipl: Makefile src/sys/modules/npf: Makefile src/sys/modules/pf: Makefile src/sys/modules/slcompress: Makefile Log Message: use the GCC_ warning variable To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 src/sys/modules/ffs/Makefile cvs rdiff -u -r1.4 -r1.5 src/sys/modules/ipl/Makefile cvs rdiff -u -r1.26 -r1.27 src/sys/modules/npf/Makefile cvs rdiff -u -r1.13 -r1.14 src/sys/modules/pf/Makefile cvs rdiff -u -r1.2 -r1.3 src/sys/modules/slcompress/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/modules/ffs/Makefile diff -u src/sys/modules/ffs/Makefile:1.16 src/sys/modules/ffs/Makefile:1.17 --- src/sys/modules/ffs/Makefile:1.16 Sun Oct 18 10:33:28 2020 +++ src/sys/modules/ffs/Makefile Sun Oct 18 11:02:12 2020 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.16 2020/10/18 14:33:28 christos Exp $ +# $NetBSD: Makefile,v 1.17 2020/10/18 15:02:12 christos Exp $ .include "../Makefile.inc" @@ -9,7 +9,8 @@ CPPFLAGS+= -DUFS_DIRHASH -DFFS_EI - CPPFLAGS+= -DUFS_EXTATTR -DUFS_ACL CWARNFLAGS.clang= -Wno-conversion -COPTS.ffs_appleufs.c += -Wno-error=address-of-packed-member +CWARNFLAGS.ffs_appleufs.c+= ${GCC_NO_ADDR_OF_PACKED_MEMBER} + SRCS+= ffs_alloc.c ffs_balloc.c ffs_inode.c ffs_subr.c ffs_tables.c \ ffs_vfsops.c ffs_vnops.c ffs_snapshot.c ffs_extattr.c \ Index: src/sys/modules/ipl/Makefile diff -u src/sys/modules/ipl/Makefile:1.4 src/sys/modules/ipl/Makefile:1.5 --- src/sys/modules/ipl/Makefile:1.4 Sun Oct 18 10:33:40 2020 +++ src/sys/modules/ipl/Makefile Sun Oct 18 11:02:12 2020 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.4 2020/10/18 14:33:40 christos Exp $ +# $NetBSD: Makefile,v 1.5 2020/10/18 15:02:12 christos Exp $ # .include "../Makefile.inc" @@ -57,12 +57,12 @@ SRCS+= radix_ipf.c WARNS= 3 CWARNFLAGS.clang+= -Wno-self-assign -COPTS.fil.c += -Wno-error=address-of-packed-member -COPTS.ip_fil_netbsd.c += -Wno-error=address-of-packed-member -COPTS.ip_htable.c += -Wno-error=address-of-packed-member -COPTS.ip_nat.c += -Wno-error=address-of-packed-member -COPTS.ip_nat6.c += -Wno-error=address-of-packed-member -COPTS.ip_proxy.c += -Wno-error=address-of-packed-member -COPTS.ip_state.c += -Wno-error=address-of-packed-member +CWARNFLAGS.fil.c+= ${GCC_NO_ADDR_OF_PACKED_MEMBER} +CWARNFLAGS.ip_fil_netbsd.c+= ${GCC_NO_ADDR_OF_PACKED_MEMBER} +CWARNFLAGS.ip_htable.c+= ${GCC_NO_ADDR_OF_PACKED_MEMBER} +CWARNFLAGS.ip_nat.c+= ${GCC_NO_ADDR_OF_PACKED_MEMBER} +CWARNFLAGS.ip_nat6.c+= ${GCC_NO_ADDR_OF_PACKED_MEMBER} +CWARNFLAGS.ip_proxy.c+= ${GCC_NO_ADDR_OF_PACKED_MEMBER} +CWARNFLAGS.ip_state.c+= ${GCC_NO_ADDR_OF_PACKED_MEMBER} .include Index: src/sys/modules/npf/Makefile diff -u src/sys/modules/npf/Makefile:1.26 src/sys/modules/npf/Makefile:1.27 --- src/sys/modules/npf/Makefile:1.26 Sun Oct 18 10:34:39 2020 +++ src/sys/modules/npf/Makefile Sun Oct 18 11:02:12 2020 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.26 2020/10/18 14:34:39 christos Exp $ +# $NetBSD: Makefile,v 1.27 2020/10/18 15:02:12 christos Exp $ # # Public Domain. # @@ -21,6 +21,7 @@ SRCS+= nvlist.c nvpair.c nv_kern_netbsd CPPFLAGS+= -DINET6 CPPFLAGS+= -I${S}/external/bsd/libnv/dist -COPTS.npf_inet.c += -Wno-error=address-of-packed-member +CWARNFLAGS.npf_inet.c+= ${GCC_NO_ADDR_OF_PACKED_MEMBER} + .include Index: src/sys/modules/pf/Makefile diff -u src/sys/modules/pf/Makefile:1.13 src/sys/modules/pf/Makefile:1.14 --- src/sys/modules/pf/Makefile:1.13 Sun Oct 18 10:36:43 2020 +++ src/sys/modules/pf/Makefile Sun Oct 18 11:02:12 2020 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.13 2020/10/18 14:36:43 christos Exp $ +# $NetBSD: Makefile,v 1.14 2020/10/18 15:02:12 christos Exp $ .include "../Makefile.inc" @@ -25,8 +25,8 @@ WARNS= 3 .if defined(HAVE_GCC) && ${HAVE_GCC} >= 7 && ${ACTIVE_CC} == "gcc" COPTS.pf.c+= -Wno-error=implicit-fallthrough .endif -COPTS.pf.c += -Wno-error=address-of-packed-member -COPTS.pf_norm.c += -Wno-error=address-of-packed-member -COPTS.pf_table.c += -Wno-error=address-of-packed-member +CWARNFLAGS.pf.c+= ${GCC_NO_ADDR_OF_PACKED_MEMBER} +CWARNFLAGS.pf_norm.c+= ${GCC_NO_ADDR_OF_PACKED_MEMBER} +CWARNFLAGS.pf_table.c+= ${GCC_NO_ADDR_OF_PACKED_MEMBER} .include Index: src/sys/modules/slcompress/Makefile diff -u src/sys/modules/slcompress/Makefile:1.2 src/sys/modules/slcompress/Makefile:1.3 --- src/sys/modules/slcompress/Makefile:1.2 Sat Feb 16 23:05:57 2019 +++ src/sys/modules/slcompress/Makefile Sun Oct 18 11:02:12 2020 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.2 2019/02/17 04:05:57 rin Exp $ +# $NetBSD: Makefile,v 1.3 2020/10/18 15:02:12 christos Exp $ .include "../Makefile.inc" @@ -9,6 +9,9 @@ SRCS= slcompress.c CPPFLAGS+= -DINET +CWARNFLAGS.slcompress.c+= ${GCC_NO_ADDR_OF_PACKE
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sun Oct 18 14:58:46 UTC 2020 Modified Files: src/usr.bin/make: make.c Log Message: make(1): replace Lst_Open with simple iteration in Make_HandleUse To generate a diff of this commit: cvs rdiff -u -r1.160 -r1.161 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.160 src/usr.bin/make/make.c:1.161 --- src/usr.bin/make/make.c:1.160 Sun Oct 18 13:02:10 2020 +++ src/usr.bin/make/make.c Sun Oct 18 14:58:45 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: make.c,v 1.160 2020/10/18 13:02:10 rillig Exp $ */ +/* $NetBSD: make.c,v 1.161 2020/10/18 14:58:45 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -107,7 +107,7 @@ #include"job.h" /* "@(#)make.c 8.1 (Berkeley) 6/6/93" */ -MAKE_RCSID("$NetBSD: make.c,v 1.160 2020/10/18 13:02:10 rillig Exp $"); +MAKE_RCSID("$NetBSD: make.c,v 1.161 2020/10/18 14:58:45 rillig Exp $"); /* Sequence # to detect recursion. */ static unsigned int checked = 1; @@ -386,8 +386,9 @@ MakeFindChild(void *gnp, void *pgnp) * has commands. * * Input: - * cgn The .USE node - * pgn The target of the .USE node + * cgn The source node, which is either a .USE/.USEBEFORE + * node or a transformation node (OP_TRANSFORM). + * pgn The target node */ void Make_HandleUse(GNode *cgn, GNode *pgn) @@ -411,9 +412,8 @@ Make_HandleUse(GNode *cgn, GNode *pgn) } } -Lst_Open(cgn->children); -while ((ln = Lst_Next(cgn->children)) != NULL) { - GNode *gn = LstNode_Datum(ln); +for (ln = cgn->children->first; ln != NULL; ln = ln->next) { + GNode *gn = ln->datum; /* * Expand variables in the .USE node's name @@ -439,7 +439,6 @@ Make_HandleUse(GNode *cgn, GNode *pgn) Lst_Append(gn->parents, pgn); pgn->unmade++; } -Lst_Close(cgn->children); pgn->type |= cgn->type & ~(OP_OPMASK|OP_USE|OP_USEBEFORE|OP_TRANSFORM); }
CVS commit: src/sys/modules/pf
Module Name:src Committed By: christos Date: Sun Oct 18 14:36:43 UTC 2020 Modified Files: src/sys/modules/pf: Makefile Log Message: Avoid alignment of packed member To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/sys/modules/pf/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/modules/pf/Makefile diff -u src/sys/modules/pf/Makefile:1.12 src/sys/modules/pf/Makefile:1.13 --- src/sys/modules/pf/Makefile:1.12 Sun Sep 29 19:45:00 2019 +++ src/sys/modules/pf/Makefile Sun Oct 18 10:36:43 2020 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.12 2019/09/29 23:45:00 mrg Exp $ +# $NetBSD: Makefile,v 1.13 2020/10/18 14:36:43 christos Exp $ .include "../Makefile.inc" @@ -25,5 +25,8 @@ WARNS= 3 .if defined(HAVE_GCC) && ${HAVE_GCC} >= 7 && ${ACTIVE_CC} == "gcc" COPTS.pf.c+= -Wno-error=implicit-fallthrough .endif +COPTS.pf.c += -Wno-error=address-of-packed-member +COPTS.pf_norm.c += -Wno-error=address-of-packed-member +COPTS.pf_table.c += -Wno-error=address-of-packed-member .include
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sun Oct 18 14:36:09 UTC 2020 Modified Files: src/usr.bin/make: dir.c Log Message: make(1): replace Lst_Open with simple iteration in Dir_SetPATH To generate a diff of this commit: cvs rdiff -u -r1.168 -r1.169 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.168 src/usr.bin/make/dir.c:1.169 --- src/usr.bin/make/dir.c:1.168 Sun Oct 18 14:32:04 2020 +++ src/usr.bin/make/dir.c Sun Oct 18 14:36:09 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: dir.c,v 1.168 2020/10/18 14:32:04 rillig Exp $ */ +/* $NetBSD: dir.c,v 1.169 2020/10/18 14:36:09 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -135,7 +135,7 @@ #include "job.h" /* "@(#)dir.c 8.2 (Berkeley) 1/2/94" */ -MAKE_RCSID("$NetBSD: dir.c,v 1.168 2020/10/18 14:32:04 rillig Exp $"); +MAKE_RCSID("$NetBSD: dir.c,v 1.169 2020/10/18 14:36:09 rillig Exp $"); #define DIR_DEBUG0(text) DEBUG0(DIR, text) #define DIR_DEBUG1(fmt, arg1) DEBUG1(DIR, fmt, arg1) @@ -495,9 +495,8 @@ Dir_SetPATH(void) Var_Delete(".PATH", VAR_GLOBAL); -Lst_Open(dirSearchPath); -if ((ln = Lst_First(dirSearchPath)) != NULL) { - CachedDir *dir = LstNode_Datum(ln); +if ((ln = dirSearchPath->first) != NULL) { + CachedDir *dir = ln->datum; if (dir == dotLast) { hasLastDot = TRUE; Var_Append(".PATH", dotLast->name, VAR_GLOBAL); @@ -511,8 +510,8 @@ Dir_SetPATH(void) Var_Append(".PATH", cur->name, VAR_GLOBAL); } -while ((ln = Lst_Next(dirSearchPath)) != NULL) { - CachedDir *dir = LstNode_Datum(ln); +for (ln = dirSearchPath->first; ln != NULL; ln = ln->next) { + CachedDir *dir = ln->datum; if (dir == dotLast) continue; if (dir == dot && hasLastDot) @@ -526,7 +525,6 @@ Dir_SetPATH(void) if (cur) Var_Append(".PATH", cur->name, VAR_GLOBAL); } -Lst_Close(dirSearchPath); } /* See if the CachedDir structure describes the same directory as the
CVS commit: src/sys/modules/npf
Module Name:src Committed By: christos Date: Sun Oct 18 14:34:39 UTC 2020 Modified Files: src/sys/modules/npf: Makefile Log Message: Avoid alignment of packed member To generate a diff of this commit: cvs rdiff -u -r1.25 -r1.26 src/sys/modules/npf/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/modules/npf/Makefile diff -u src/sys/modules/npf/Makefile:1.25 src/sys/modules/npf/Makefile:1.26 --- src/sys/modules/npf/Makefile:1.25 Thu Sep 26 14:45:00 2019 +++ src/sys/modules/npf/Makefile Sun Oct 18 10:34:39 2020 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.25 2019/09/26 18:45:00 christos Exp $ +# $NetBSD: Makefile,v 1.26 2020/10/18 14:34:39 christos Exp $ # # Public Domain. # @@ -21,4 +21,6 @@ SRCS+= nvlist.c nvpair.c nv_kern_netbsd CPPFLAGS+= -DINET6 CPPFLAGS+= -I${S}/external/bsd/libnv/dist +COPTS.npf_inet.c += -Wno-error=address-of-packed-member + .include
CVS commit: src/sys/modules/ipl
Module Name:src Committed By: christos Date: Sun Oct 18 14:33:40 UTC 2020 Modified Files: src/sys/modules/ipl: Makefile Log Message: Avoid alignment of packed member To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/modules/ipl/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/modules/ipl/Makefile diff -u src/sys/modules/ipl/Makefile:1.3 src/sys/modules/ipl/Makefile:1.4 --- src/sys/modules/ipl/Makefile:1.3 Sat Feb 16 23:05:53 2019 +++ src/sys/modules/ipl/Makefile Sun Oct 18 10:33:40 2020 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.3 2019/02/17 04:05:53 rin Exp $ +# $NetBSD: Makefile,v 1.4 2020/10/18 14:33:40 christos Exp $ # .include "../Makefile.inc" @@ -57,5 +57,12 @@ SRCS+= radix_ipf.c WARNS= 3 CWARNFLAGS.clang+= -Wno-self-assign +COPTS.fil.c += -Wno-error=address-of-packed-member +COPTS.ip_fil_netbsd.c += -Wno-error=address-of-packed-member +COPTS.ip_htable.c += -Wno-error=address-of-packed-member +COPTS.ip_nat.c += -Wno-error=address-of-packed-member +COPTS.ip_nat6.c += -Wno-error=address-of-packed-member +COPTS.ip_proxy.c += -Wno-error=address-of-packed-member +COPTS.ip_state.c += -Wno-error=address-of-packed-member .include
CVS commit: src/sys/modules/ffs
Module Name:src Committed By: christos Date: Sun Oct 18 14:33:28 UTC 2020 Modified Files: src/sys/modules/ffs: Makefile Log Message: Avoid alignment of packed member To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/sys/modules/ffs/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/modules/ffs/Makefile diff -u src/sys/modules/ffs/Makefile:1.15 src/sys/modules/ffs/Makefile:1.16 --- src/sys/modules/ffs/Makefile:1.15 Sat May 16 14:31:52 2020 +++ src/sys/modules/ffs/Makefile Sun Oct 18 10:33:28 2020 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.15 2020/05/16 18:31:52 christos Exp $ +# $NetBSD: Makefile,v 1.16 2020/10/18 14:33:28 christos Exp $ .include "../Makefile.inc" @@ -9,6 +9,7 @@ CPPFLAGS+= -DUFS_DIRHASH -DFFS_EI - CPPFLAGS+= -DUFS_EXTATTR -DUFS_ACL CWARNFLAGS.clang= -Wno-conversion +COPTS.ffs_appleufs.c += -Wno-error=address-of-packed-member SRCS+= ffs_alloc.c ffs_balloc.c ffs_inode.c ffs_subr.c ffs_tables.c \ ffs_vfsops.c ffs_vnops.c ffs_snapshot.c ffs_extattr.c \
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sun Oct 18 14:32:04 UTC 2020 Modified Files: src/usr.bin/make: dir.c Log Message: make(1): replace Lst_Open with simple iteration in Dir_FindFile To generate a diff of this commit: cvs rdiff -u -r1.167 -r1.168 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.167 src/usr.bin/make/dir.c:1.168 --- src/usr.bin/make/dir.c:1.167 Sun Oct 18 13:02:10 2020 +++ src/usr.bin/make/dir.c Sun Oct 18 14:32:04 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: dir.c,v 1.167 2020/10/18 13:02:10 rillig Exp $ */ +/* $NetBSD: dir.c,v 1.168 2020/10/18 14:32:04 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -135,7 +135,7 @@ #include "job.h" /* "@(#)dir.c 8.2 (Berkeley) 1/2/94" */ -MAKE_RCSID("$NetBSD: dir.c,v 1.167 2020/10/18 13:02:10 rillig Exp $"); +MAKE_RCSID("$NetBSD: dir.c,v 1.168 2020/10/18 14:32:04 rillig Exp $"); #define DIR_DEBUG0(text) DEBUG0(DIR, text) #define DIR_DEBUG1(fmt, arg1) DEBUG1(DIR, fmt, arg1) @@ -1095,7 +1095,6 @@ Dir_FindFile(const char *name, SearchPat { SearchPathNode *ln; char *file; /* the current filename to check */ -CachedDir *dir; const char *base; /* Terminal name of file */ Boolean hasLastDot = FALSE; /* true if we should search dot last */ Boolean hasSlash; /* true if 'name' contains a / */ @@ -1123,9 +1122,8 @@ Dir_FindFile(const char *name, SearchPat return NULL; } -Lst_Open(path); -if ((ln = Lst_First(path)) != NULL) { - dir = LstNode_Datum(ln); +if ((ln = path->first) != NULL) { + CachedDir *dir = ln->datum; if (dir == dotLast) { hasLastDot = TRUE; DIR_DEBUG0("[dot last]..."); @@ -1153,27 +1151,20 @@ Dir_FindFile(const char *name, SearchPat * This is so there are no conflicts between what the user * specifies (fish.c) and what pmake finds (./fish.c). */ - if (!hasLastDot && (file = DirFindDot(hasSlash, name, base)) != NULL) { - Lst_Close(path); + if (!hasLastDot && (file = DirFindDot(hasSlash, name, base)) != NULL) return file; - } - while ((ln = Lst_Next(path)) != NULL) { - dir = LstNode_Datum(ln); + for (; ln != NULL; ln = ln->next) { + CachedDir *dir = ln->datum; if (dir == dotLast) continue; - if ((file = DirLookup(dir, name, base, hasSlash)) != NULL) { - Lst_Close(path); + if ((file = DirLookup(dir, name, base, hasSlash)) != NULL) return file; - } } - if (hasLastDot && (file = DirFindDot(hasSlash, name, base)) != NULL) { - Lst_Close(path); + if (hasLastDot && (file = DirFindDot(hasSlash, name, base)) != NULL) return file; - } } -Lst_Close(path); /* * We didn't find the file on any directory in the search path. @@ -1215,9 +1206,8 @@ Dir_FindFile(const char *name, SearchPat return file; } - Lst_Open(path); - while ((ln = Lst_Next(path)) != NULL) { - dir = LstNode_Datum(ln); + for (ln = path->first; ln != NULL; ln = ln->next) { + CachedDir *dir = ln->datum; if (dir == dotLast) continue; if (dir == dot) { @@ -1225,12 +1215,9 @@ Dir_FindFile(const char *name, SearchPat continue; checkedDot = TRUE; } - if ((file = DirLookupSubdir(dir, name)) != NULL) { - Lst_Close(path); + if ((file = DirLookupSubdir(dir, name)) != NULL) return file; - } } - Lst_Close(path); if (hasLastDot) { if (dot && !checkedDot) { @@ -1273,13 +1260,11 @@ Dir_FindFile(const char *name, SearchPat return file; } - Lst_Open(path); - while ((ln = Lst_Next(path)) != NULL) { - dir = LstNode_Datum(ln); + for (ln = path->first; ln != NULL; ln = ln->next) { + CachedDir *dir = ln->datum; if (dir == dotLast) continue; if ((file = DirLookupAbs(dir, name, base)) != NULL) { - Lst_Close(path); if (file[0] == '\0') { free(file); return NULL; @@ -1287,7 +1272,6 @@ Dir_FindFile(const char *name, SearchPat return file; } } - Lst_Close(path); if (hasLastDot && cur && ((file = DirLookupAbs(cur, name, base)) != NULL)) {
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sun Oct 18 14:09:39 UTC 2020 Modified Files: src/usr.bin/make: suff.c Log Message: make(1): replace Lst_Open in Suff_DoPaths with simple iteration Since sufflist is not modified during iteration, there is no need for the extra complexity of Lst_Open. To generate a diff of this commit: cvs rdiff -u -r1.180 -r1.181 src/usr.bin/make/suff.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/suff.c diff -u src/usr.bin/make/suff.c:1.180 src/usr.bin/make/suff.c:1.181 --- src/usr.bin/make/suff.c:1.180 Sun Oct 18 13:02:10 2020 +++ src/usr.bin/make/suff.c Sun Oct 18 14:09:39 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: suff.c,v 1.180 2020/10/18 13:02:10 rillig Exp $ */ +/* $NetBSD: suff.c,v 1.181 2020/10/18 14:09:39 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -129,7 +129,7 @@ #include "dir.h" /* "@(#)suff.c 8.4 (Berkeley) 3/21/94" */ -MAKE_RCSID("$NetBSD: suff.c,v 1.180 2020/10/18 13:02:10 rillig Exp $"); +MAKE_RCSID("$NetBSD: suff.c,v 1.181 2020/10/18 14:09:39 rillig Exp $"); #define SUFF_DEBUG0(text) DEBUG0(SUFF, text) #define SUFF_DEBUG1(fmt, arg1) DEBUG1(SUFF, fmt, arg1) @@ -816,19 +816,16 @@ Suff_GetPath(const char *sname) void Suff_DoPaths(void) { -Suff *s; SuffListNode *ln; char *ptr; SearchPath *inIncludes; /* Cumulative .INCLUDES path */ SearchPath *inLibs; /* Cumulative .LIBS path */ - inIncludes = Lst_New(); inLibs = Lst_New(); -Lst_Open(sufflist); -while ((ln = Lst_Next(sufflist)) != NULL) { - s = LstNode_Datum(ln); +for (ln = sufflist->first; ln != NULL; ln = ln->next) { + Suff *s = LstNode_Datum(ln); if (!Lst_IsEmpty(s->searchPath)) { #ifdef INCLUDES if (s->flags & SUFF_INCLUDE) { @@ -846,7 +843,6 @@ Suff_DoPaths(void) s->searchPath = Lst_Copy(dirSearchPath, Dir_CopyDir); } } -Lst_Close(sufflist); Var_Set(".INCLUDES", ptr = Dir_MakeFlags("-I", inIncludes), VAR_GLOBAL); free(ptr);
CVS commit: src/sys/arch/arm/sunxi
Module Name:src Committed By: jmcneill Date: Sun Oct 18 14:00:08 UTC 2020 Modified Files: src/sys/arch/arm/sunxi: sunxi_mixer.c Log Message: Treat ARGB/XRGB as BGRA/BGRX on big endian kernels. To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/sys/arch/arm/sunxi/sunxi_mixer.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/arm/sunxi/sunxi_mixer.c diff -u src/sys/arch/arm/sunxi/sunxi_mixer.c:1.11 src/sys/arch/arm/sunxi/sunxi_mixer.c:1.12 --- src/sys/arch/arm/sunxi/sunxi_mixer.c:1.11 Sun Feb 9 15:22:25 2020 +++ src/sys/arch/arm/sunxi/sunxi_mixer.c Sun Oct 18 14:00:08 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: sunxi_mixer.c,v 1.11 2020/02/09 15:22:25 jakllsch Exp $ */ +/* $NetBSD: sunxi_mixer.c,v 1.12 2020/10/18 14:00:08 jmcneill Exp $ */ /*- * Copyright (c) 2019 Jared D. McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sunxi_mixer.c,v 1.11 2020/02/09 15:22:25 jakllsch Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sunxi_mixer.c,v 1.12 2020/10/18 14:00:08 jmcneill Exp $"); #include #include @@ -99,8 +99,13 @@ __KERNEL_RCSID(0, "$NetBSD: sunxi_mixer. #define OVL_V_ATTCTL_LAY_FBFMT_YUV422 0x06 #define OVL_V_ATTCTL_LAY_FBFMT_YUV420 0x0a #define OVL_V_ATTCTL_LAY_FBFMT_YUV411 0x0e +#if BYTE_ORDER == BIG_ENDIAN +#define OVL_V_ATTCTL_LAY_FBFMT_ARGB_ 0x03 +#define OVL_V_ATTCTL_LAY_FBFMT_XRGB_ 0x07 +#else #define OVL_V_ATTCTL_LAY_FBFMT_ARGB_ 0x00 #define OVL_V_ATTCTL_LAY_FBFMT_XRGB_ 0x04 +#endif #define OVL_V_ATTCTL_LAY0_EN __BIT(0) #define OVL_V_MBSIZE(n) (0x004 + (n) * 0x30) #define OVL_V_COOR(n) (0x008 + (n) * 0x30) @@ -124,8 +129,13 @@ __KERNEL_RCSID(0, "$NetBSD: sunxi_mixer. /* OVL_UI registers */ #define OVL_UI_ATTR_CTL(n) (0x000 + (n) * 0x20) #define OVL_UI_ATTR_CTL_LAY_FBFMT __BITS(12,8) +#if BYTE_ORDER == BIG_ENDIAN +#define OVL_UI_ATTR_CTL_LAY_FBFMT_ARGB_ 0x03 +#define OVL_UI_ATTR_CTL_LAY_FBFMT_XRGB_ 0x07 +#else #define OVL_UI_ATTR_CTL_LAY_FBFMT_ARGB_ 0x00 #define OVL_UI_ATTR_CTL_LAY_FBFMT_XRGB_ 0x04 +#endif #define OVL_UI_ATTR_CTL_LAY_EN __BIT(0) #define OVL_UI_MBSIZE(n) (0x004 + (n) * 0x20) #define OVL_UI_COOR(n) (0x008 + (n) * 0x20)
CVS commit: src/sys/net
Module Name:src Committed By: gson Date: Sun Oct 18 13:07:31 UTC 2020 Modified Files: src/sys/net: radix.c Log Message: Suppress the "rn_init: radix functions require max_keylen be set" message when _KERNEL is defined, to avoid spurious messages from kernels that have no routable network domains. Fixes PR kern/55691. To generate a diff of this commit: cvs rdiff -u -r1.48 -r1.49 src/sys/net/radix.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/net/radix.c diff -u src/sys/net/radix.c:1.48 src/sys/net/radix.c:1.49 --- src/sys/net/radix.c:1.48 Mon Sep 3 16:29:35 2018 +++ src/sys/net/radix.c Sun Oct 18 13:07:31 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: radix.c,v 1.48 2018/09/03 16:29:35 riastradh Exp $ */ +/* $NetBSD: radix.c,v 1.49 2020/10/18 13:07:31 gson Exp $ */ /* * Copyright (c) 1988, 1989, 1993 @@ -36,7 +36,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: radix.c,v 1.48 2018/09/03 16:29:35 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: radix.c,v 1.49 2020/10/18 13:07:31 gson Exp $"); #ifndef _NET_RADIX_H_ #include @@ -1119,8 +1119,10 @@ rn_init(void) } #endif if (max_keylen == 0) { +#ifndef _KERNEL log(LOG_ERR, "rn_init: radix functions require max_keylen be set\n"); +#endif return; }
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sun Oct 18 13:02:10 UTC 2020 Modified Files: src/usr.bin/make: arch.c dir.c job.c lst.c lst.h main.c make.c meta.c parse.c suff.c targ.c src/usr.bin/make/unit-tests: deptgt.mk Log Message: make(1): rename Lst_Init to Lst_New For the other types such as HashTable and Buffer, the Init function does not allocate the memory for the structure itself, it only fills it. To generate a diff of this commit: cvs rdiff -u -r1.135 -r1.136 src/usr.bin/make/arch.c cvs rdiff -u -r1.166 -r1.167 src/usr.bin/make/dir.c cvs rdiff -u -r1.264 -r1.265 src/usr.bin/make/job.c cvs rdiff -u -r1.76 -r1.77 src/usr.bin/make/lst.c cvs rdiff -u -r1.70 -r1.71 src/usr.bin/make/lst.h cvs rdiff -u -r1.377 -r1.378 src/usr.bin/make/main.c cvs rdiff -u -r1.159 -r1.160 src/usr.bin/make/make.c cvs rdiff -u -r1.124 -r1.125 src/usr.bin/make/meta.c cvs rdiff -u -r1.384 -r1.385 src/usr.bin/make/parse.c cvs rdiff -u -r1.179 -r1.180 src/usr.bin/make/suff.c cvs rdiff -u -r1.115 -r1.116 src/usr.bin/make/targ.c cvs rdiff -u -r1.7 -r1.8 src/usr.bin/make/unit-tests/deptgt.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/arch.c diff -u src/usr.bin/make/arch.c:1.135 src/usr.bin/make/arch.c:1.136 --- src/usr.bin/make/arch.c:1.135 Sun Oct 18 12:36:43 2020 +++ src/usr.bin/make/arch.c Sun Oct 18 13:02:10 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: arch.c,v 1.135 2020/10/18 12:36:43 rillig Exp $ */ +/* $NetBSD: arch.c,v 1.136 2020/10/18 13:02:10 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -130,7 +130,7 @@ #include"config.h" /* "@(#)arch.c 8.2 (Berkeley) 1/2/94" */ -MAKE_RCSID("$NetBSD: arch.c,v 1.135 2020/10/18 12:36:43 rillig Exp $"); +MAKE_RCSID("$NetBSD: arch.c,v 1.136 2020/10/18 13:02:10 rillig Exp $"); #ifdef TARGET_MACHINE #undef MAKE_MACHINE @@ -357,7 +357,7 @@ Arch_ParseArchive(char **linePtr, GNodeL */ free(buf); } else if (Dir_HasWildcards(memName)) { - StringList *members = Lst_Init(); + StringList *members = Lst_New(); Dir_Expand(memName, dirSearchPath, members); while (!Lst_IsEmpty(members)) { @@ -1126,7 +1126,7 @@ Arch_LibOODate(GNode *gn) void Arch_Init(void) { -archives = Lst_Init(); +archives = Lst_New(); } /* Clean up the archives module. */ Index: src/usr.bin/make/dir.c diff -u src/usr.bin/make/dir.c:1.166 src/usr.bin/make/dir.c:1.167 --- src/usr.bin/make/dir.c:1.166 Sun Oct 18 12:47:43 2020 +++ src/usr.bin/make/dir.c Sun Oct 18 13:02:10 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: dir.c,v 1.166 2020/10/18 12:47:43 rillig Exp $ */ +/* $NetBSD: dir.c,v 1.167 2020/10/18 13:02:10 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -135,7 +135,7 @@ #include "job.h" /* "@(#)dir.c 8.2 (Berkeley) 1/2/94" */ -MAKE_RCSID("$NetBSD: dir.c,v 1.166 2020/10/18 12:47:43 rillig Exp $"); +MAKE_RCSID("$NetBSD: dir.c,v 1.167 2020/10/18 13:02:10 rillig Exp $"); #define DIR_DEBUG0(text) DEBUG0(DIR, text) #define DIR_DEBUG1(fmt, arg1) DEBUG1(DIR, fmt, arg1) @@ -227,7 +227,7 @@ typedef struct OpenDirs { static void OpenDirs_Init(OpenDirs *odirs) { -odirs->list = Lst_Init(); +odirs->list = Lst_New(); Hash_InitTable(&odirs->table); } @@ -392,7 +392,7 @@ cached_lstat(const char *pathname, struc void Dir_Init(void) { -dirSearchPath = Lst_Init(); +dirSearchPath = Lst_New(); OpenDirs_Init(&openDirs); Hash_InitTable(&mtimes); Hash_InitTable(&lmtimes); @@ -883,7 +883,7 @@ Dir_Expand(const char *word, SearchPath char *dp = &dirpath[strlen(dirpath) - 1]; if (*dp == '/') *dp = '\0'; - path = Lst_Init(); + path = Lst_New(); (void)Dir_AddDir(path, dirpath); DirExpandInt(cp + 1, path, expansions); Lst_Free(path); Index: src/usr.bin/make/job.c diff -u src/usr.bin/make/job.c:1.264 src/usr.bin/make/job.c:1.265 --- src/usr.bin/make/job.c:1.264 Sun Oct 18 07:46:04 2020 +++ src/usr.bin/make/job.c Sun Oct 18 13:02:10 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: job.c,v 1.264 2020/10/18 07:46:04 rillig Exp $ */ +/* $NetBSD: job.c,v 1.265 2020/10/18 13:02:10 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.264 2020/10/18 07:46:04 rillig Exp $"); +MAKE_RCSID("$NetBSD: job.c,v 1.265 2020/10/18 13:02:10 rillig Exp $"); # define STATIC static @@ -1764,7 +1764,7 @@ JobRun(GNode *targ) * Running these jobs in compat mode also guarantees that these * jobs do not overlap with other unrelated jobs. */ -List *lst = Lst_Init(); +List *lst = Lst_New(); Lst_Append(lst, targ); (void)Make_Run(lst); Lst_Destroy(lst, NULL); Index: src/usr.bin/make/lst.c diff -u src/usr.bin/make/lst.c:1.76 src/usr.bin/make/ls
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sun Oct 18 12:47:43 UTC 2020 Modified Files: src/usr.bin/make: dir.c hash.c hash.h main.c var.c Log Message: make(1): rename HashEntry.name to key To generate a diff of this commit: cvs rdiff -u -r1.165 -r1.166 src/usr.bin/make/dir.c cvs rdiff -u -r1.46 -r1.47 src/usr.bin/make/hash.c cvs rdiff -u -r1.28 -r1.29 src/usr.bin/make/hash.h cvs rdiff -u -r1.376 -r1.377 src/usr.bin/make/main.c cvs rdiff -u -r1.576 -r1.577 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/dir.c diff -u src/usr.bin/make/dir.c:1.165 src/usr.bin/make/dir.c:1.166 --- src/usr.bin/make/dir.c:1.165 Sun Oct 18 12:36:43 2020 +++ src/usr.bin/make/dir.c Sun Oct 18 12:47:43 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: dir.c,v 1.165 2020/10/18 12:36:43 rillig Exp $ */ +/* $NetBSD: dir.c,v 1.166 2020/10/18 12:47:43 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -135,7 +135,7 @@ #include "job.h" /* "@(#)dir.c 8.2 (Berkeley) 1/2/94" */ -MAKE_RCSID("$NetBSD: dir.c,v 1.165 2020/10/18 12:36:43 rillig Exp $"); +MAKE_RCSID("$NetBSD: dir.c,v 1.166 2020/10/18 12:47:43 rillig Exp $"); #define DIR_DEBUG0(text) DEBUG0(DIR, text) #define DIR_DEBUG1(fmt, arg1) DEBUG1(DIR, fmt, arg1) @@ -622,13 +622,12 @@ DirMatchFiles(const char *pattern, Cache * begins with a dot (note also that as a side effect of the hashing * scheme, .* won't match . or .. since they aren't hashed). */ - if (Str_Match(entry->name, pattern) && - ((entry->name[0] != '.') || - (pattern[0] == '.'))) + if (Str_Match(entry->key, pattern) && + (entry->key[0] != '.' || pattern[0] == '.')) { Lst_Append(expansions, - (isDot ? bmake_strdup(entry->name) : - str_concat3(dir->name, "/", entry->name))); + (isDot ? bmake_strdup(entry->key) : + str_concat3(dir->name, "/", entry->key))); } } } Index: src/usr.bin/make/hash.c diff -u src/usr.bin/make/hash.c:1.46 src/usr.bin/make/hash.c:1.47 --- src/usr.bin/make/hash.c:1.46 Sun Oct 18 12:36:43 2020 +++ src/usr.bin/make/hash.c Sun Oct 18 12:47:43 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: hash.c,v 1.46 2020/10/18 12:36:43 rillig Exp $ */ +/* $NetBSD: hash.c,v 1.47 2020/10/18 12:47:43 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -79,7 +79,7 @@ #include "make.h" /* "@(#)hash.c 8.1 (Berkeley) 6/6/93" */ -MAKE_RCSID("$NetBSD: hash.c,v 1.46 2020/10/18 12:36:43 rillig Exp $"); +MAKE_RCSID("$NetBSD: hash.c,v 1.47 2020/10/18 12:47:43 rillig Exp $"); /* * The ratio of # entries to # buckets at which we rebuild the table to @@ -112,7 +112,7 @@ HashTable_Find(HashTable *t, unsigned in for (e = t->buckets[h & t->bucketsMask]; e != NULL; e = e->next) { chainlen++; - if (e->namehash == h && strcmp(e->name, key) == 0) + if (e->key_hash == h && strcmp(e->key, key) == 0) break; } @@ -207,7 +207,7 @@ RebuildTable(HashTable *t) for (hp = oldhp, i = (int)oldsize; --i >= 0;) { for (e = *hp++; e != NULL; e = next) { next = e->next; - xp = &t->buckets[e->namehash & mask]; + xp = &t->buckets[e->key_hash & mask]; e->next = *xp; *xp = e; } @@ -256,8 +256,8 @@ Hash_CreateEntry(HashTable *t, const cha e->next = *hp; *hp = e; Hash_SetValue(e, NULL); - e->namehash = h; - memcpy(e->name, key, keylen + 1); + e->key_hash = h; + memcpy(e->key, key, keylen + 1); t->numEntries++; if (newPtr != NULL) @@ -271,7 +271,7 @@ Hash_DeleteEntry(HashTable *t, HashEntry { HashEntry **hp, *p; - for (hp = &t->buckets[e->namehash & t->bucketsMask]; + for (hp = &t->buckets[e->key_hash & t->bucketsMask]; (p = *hp) != NULL; hp = &p->next) { if (p == e) { *hp = p->next; Index: src/usr.bin/make/hash.h diff -u src/usr.bin/make/hash.h:1.28 src/usr.bin/make/hash.h:1.29 --- src/usr.bin/make/hash.h:1.28 Sun Oct 18 12:36:43 2020 +++ src/usr.bin/make/hash.h Sun Oct 18 12:47:43 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: hash.h,v 1.28 2020/10/18 12:36:43 rillig Exp $ */ +/* $NetBSD: hash.h,v 1.29 2020/10/18 12:47:43 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -82,8 +82,8 @@ typedef struct HashEntry { struct HashEntry *next; /* Used to link together all the entries * associated with the same bucket. */ void *value; -unsigned namehash; /* hash value of key */ -char name[1]; /* key string, variable length */ +unsigned key_hash; /* hash value of the key */ +char key[1]; /* key string, variable length */ } HashEntry; /* The hash table containing the entries. */ Index: src/usr.bin/make/main.c diff -u src/usr.bin/make/main.c:1.376 src/usr.bin/make/main.c:1.377 --- src/usr.bin/make/main.c:1.376 Sun Oct 18 12:36:43 2020 +++ src/usr.bin/make/main.c Sun Oct 18 12:47:43 2020 @@ -1,
CVS commit: src/sys/dev/wsfb
Module Name:src Committed By: rin Date: Sun Oct 18 12:47:37 UTC 2020 Modified Files: src/sys/dev/wsfb: genfb.c Log Message: Revert rev 1.75; do not set WSFB_VRAM_IS_RAM flag bit. It indicates memory type obtained by mmap. I just misunderstood its intention. Thanks to jmcneill for pointing it out! To generate a diff of this commit: cvs rdiff -u -r1.76 -r1.77 src/sys/dev/wsfb/genfb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wsfb/genfb.c diff -u src/sys/dev/wsfb/genfb.c:1.76 src/sys/dev/wsfb/genfb.c:1.77 --- src/sys/dev/wsfb/genfb.c:1.76 Sun Oct 18 12:00:12 2020 +++ src/sys/dev/wsfb/genfb.c Sun Oct 18 12:47:37 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: genfb.c,v 1.76 2020/10/18 12:00:12 rin Exp $ */ +/* $NetBSD: genfb.c,v 1.77 2020/10/18 12:47:37 rin Exp $ */ /*- * Copyright (c) 2007 Michael Lorenz @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: genfb.c,v 1.76 2020/10/18 12:00:12 rin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: genfb.c,v 1.77 2020/10/18 12:47:37 rin Exp $"); #include #include @@ -499,12 +499,7 @@ genfb_ioctl(void *v, void *vs, u_long cm case WSDISPLAYIO_GET_FBINFO: { struct wsdisplayio_fbinfo *fbi = data; - ret = wsdisplayio_get_fbinfo(&ms->scr_ri, fbi); - if (ret == 0) { -if (sc->sc_enable_shadowfb) - fbi->fbi_flags |= WSFB_VRAM_IS_RAM; - } - return ret; + return wsdisplayio_get_fbinfo(&ms->scr_ri, fbi); } } return EPASSTHROUGH;
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sun Oct 18 12:36:43 UTC 2020 Modified Files: src/usr.bin/make: arch.c dir.c dir.h hash.c hash.h main.c make.h targ.c var.c Log Message: make(1): remove underscore from Hash_Table and Hash_Entry For consistency with the other type names, such as GNodeListNode. To generate a diff of this commit: cvs rdiff -u -r1.134 -r1.135 src/usr.bin/make/arch.c cvs rdiff -u -r1.164 -r1.165 src/usr.bin/make/dir.c cvs rdiff -u -r1.29 -r1.30 src/usr.bin/make/dir.h cvs rdiff -u -r1.45 -r1.46 src/usr.bin/make/hash.c cvs rdiff -u -r1.27 -r1.28 src/usr.bin/make/hash.h cvs rdiff -u -r1.375 -r1.376 src/usr.bin/make/main.c cvs rdiff -u -r1.157 -r1.158 src/usr.bin/make/make.h cvs rdiff -u -r1.114 -r1.115 src/usr.bin/make/targ.c cvs rdiff -u -r1.575 -r1.576 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.134 src/usr.bin/make/arch.c:1.135 --- src/usr.bin/make/arch.c:1.134 Sun Oct 18 12:00:16 2020 +++ src/usr.bin/make/arch.c Sun Oct 18 12:36:43 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: arch.c,v 1.134 2020/10/18 12:00:16 rillig Exp $ */ +/* $NetBSD: arch.c,v 1.135 2020/10/18 12:36:43 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -130,7 +130,7 @@ #include"config.h" /* "@(#)arch.c 8.2 (Berkeley) 1/2/94" */ -MAKE_RCSID("$NetBSD: arch.c,v 1.134 2020/10/18 12:00:16 rillig Exp $"); +MAKE_RCSID("$NetBSD: arch.c,v 1.135 2020/10/18 12:36:43 rillig Exp $"); #ifdef TARGET_MACHINE #undef MAKE_MACHINE @@ -148,7 +148,7 @@ static ArchList *archives; /* The archiv typedef struct Arch { char *name; /* Name of archive */ -Hash_Table members; /* All the members of the archive described +HashTable members; /* All the members of the archive described * by key/value pairs */ char *fnametab; /* Extended name table strings */ size_t fnamesize; /* Size of the string table */ @@ -167,7 +167,7 @@ ArchFree(void *ap) { Arch *a = (Arch *)ap; HashIter hi; -Hash_Entry *he; +HashEntry *he; /* Free memory from hash entries */ HashIter_Init(&hi, &a->members); @@ -606,7 +606,7 @@ ArchStatMember(const char *archive, cons #endif { - Hash_Entry *he; + HashEntry *he; he = Hash_CreateEntry(&ar->members, memName, NULL); Hash_SetValue(he, bmake_malloc(sizeof(struct ar_hdr))); memcpy(Hash_GetValue(he), &arh, sizeof(struct ar_hdr)); Index: src/usr.bin/make/dir.c diff -u src/usr.bin/make/dir.c:1.164 src/usr.bin/make/dir.c:1.165 --- src/usr.bin/make/dir.c:1.164 Sun Oct 18 10:44:25 2020 +++ src/usr.bin/make/dir.c Sun Oct 18 12:36:43 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: dir.c,v 1.164 2020/10/18 10:44:25 rillig Exp $ */ +/* $NetBSD: dir.c,v 1.165 2020/10/18 12:36:43 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -135,7 +135,7 @@ #include "job.h" /* "@(#)dir.c 8.2 (Berkeley) 1/2/94" */ -MAKE_RCSID("$NetBSD: dir.c,v 1.164 2020/10/18 10:44:25 rillig Exp $"); +MAKE_RCSID("$NetBSD: dir.c,v 1.165 2020/10/18 12:36:43 rillig Exp $"); #define DIR_DEBUG0(text) DEBUG0(DIR, text) #define DIR_DEBUG1(fmt, arg1) DEBUG1(DIR, fmt, arg1) @@ -221,7 +221,7 @@ SearchPath *dirSearchPath; /* main sear /* A list of cached directories, with fast lookup by directory name. */ typedef struct OpenDirs { CachedDirList *list; -Hash_Table /* of CachedDirListNode */ table; +HashTable /* of CachedDirListNode */ table; } OpenDirs; static void @@ -255,7 +255,7 @@ OpenDirs_Find(OpenDirs *odirs, const cha static void OpenDirs_Add(OpenDirs *odirs, CachedDir *cdir) { -Hash_Entry *he = Hash_FindEntry(&odirs->table, cdir->name); +HashEntry *he = Hash_FindEntry(&odirs->table, cdir->name); if (he != NULL) return; he = Hash_CreateEntry(&odirs->table, cdir->name, NULL); @@ -266,7 +266,7 @@ OpenDirs_Add(OpenDirs *odirs, CachedDir static void OpenDirs_Remove(OpenDirs *odirs, const char *name) { -Hash_Entry *he = Hash_FindEntry(&odirs->table, name); +HashEntry *he = Hash_FindEntry(&odirs->table, name); CachedDirListNode *ln; if (he == NULL) return; @@ -298,9 +298,9 @@ static CachedDir *dotLast; /* a fake pat * already updated the file, in which case we'll update it again. Generally, * there won't be two rules to update a single file, so this should be ok, * but... */ -static Hash_Table mtimes; +static HashTable mtimes; -static Hash_Table lmtimes; /* same as mtimes but for lstat */ +static HashTable lmtimes; /* same as mtimes but for lstat */ /* * We use stat(2) a lot, cache the results. @@ -320,10 +320,10 @@ typedef enum { /* Returns 0 and the result of stat(2) or lstat(2) in *mst, or -1 on error. */ static int -cached_stats(Hash_Table *htp, const char *pathname, struct make_stat *mst, +cached_stats(HashTable *htp, const char *
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sun Oct 18 12:00:17 UTC 2020 Modified Files: src/usr.bin/make: arch.c Log Message: make(1): migrate ArchFree from Hash_Search to HashIter To generate a diff of this commit: cvs rdiff -u -r1.133 -r1.134 src/usr.bin/make/arch.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.133 src/usr.bin/make/arch.c:1.134 --- src/usr.bin/make/arch.c:1.133 Sat Oct 17 21:32:30 2020 +++ src/usr.bin/make/arch.c Sun Oct 18 12:00:16 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: arch.c,v 1.133 2020/10/17 21:32:30 rillig Exp $ */ +/* $NetBSD: arch.c,v 1.134 2020/10/18 12:00:16 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -130,7 +130,7 @@ #include"config.h" /* "@(#)arch.c 8.2 (Berkeley) 1/2/94" */ -MAKE_RCSID("$NetBSD: arch.c,v 1.133 2020/10/17 21:32:30 rillig Exp $"); +MAKE_RCSID("$NetBSD: arch.c,v 1.134 2020/10/18 12:00:16 rillig Exp $"); #ifdef TARGET_MACHINE #undef MAKE_MACHINE @@ -166,14 +166,13 @@ static void ArchFree(void *ap) { Arch *a = (Arch *)ap; -Hash_Search search; -Hash_Entry *entry; +HashIter hi; +Hash_Entry *he; /* Free memory from hash entries */ -for (entry = Hash_EnumFirst(&a->members, &search); - entry != NULL; - entry = Hash_EnumNext(&search)) - free(Hash_GetValue(entry)); +HashIter_Init(&hi, &a->members); +while ((he = HashIter_Next(&hi)) != NULL) + free(Hash_GetValue(he)); free(a->name); free(a->fnametab);
CVS commit: src/sys/dev/wsfb
Module Name:src Committed By: rin Date: Sun Oct 18 12:00:12 UTC 2020 Modified Files: src/sys/dev/wsfb: genfb.c Log Message: Remove stray TABs. No binary changes. To generate a diff of this commit: cvs rdiff -u -r1.75 -r1.76 src/sys/dev/wsfb/genfb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wsfb/genfb.c diff -u src/sys/dev/wsfb/genfb.c:1.75 src/sys/dev/wsfb/genfb.c:1.76 --- src/sys/dev/wsfb/genfb.c:1.75 Sun Oct 18 11:54:20 2020 +++ src/sys/dev/wsfb/genfb.c Sun Oct 18 12:00:12 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: genfb.c,v 1.75 2020/10/18 11:54:20 rin Exp $ */ +/* $NetBSD: genfb.c,v 1.76 2020/10/18 12:00:12 rin Exp $ */ /*- * Copyright (c) 2007 Michael Lorenz @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: genfb.c,v 1.75 2020/10/18 11:54:20 rin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: genfb.c,v 1.76 2020/10/18 12:00:12 rin Exp $"); #include #include @@ -493,7 +493,6 @@ genfb_ioctl(void *v, void *vs, u_long cm */ switch (cmd) { case WSDISPLAYIO_GET_EDID: { - struct wsdisplayio_edid_info *d = data; return wsdisplayio_get_edid(sc->sc_dev, d); }
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sun Oct 18 11:54:43 UTC 2020 Modified Files: src/usr.bin/make: main.c meta.c src/usr.bin/make/filemon: filemon_ktrace.c Log Message: make(1): prepare for WARNS=6 The FD_* macros from sys/sys/fd_set.h use signed integers on NetBSD 8 and thus produce conversion errors. On NetBSD 9, these macros are fixed to use 1U instead of 1. To generate a diff of this commit: cvs rdiff -u -r1.374 -r1.375 src/usr.bin/make/main.c cvs rdiff -u -r1.123 -r1.124 src/usr.bin/make/meta.c cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/filemon/filemon_ktrace.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.374 src/usr.bin/make/main.c:1.375 --- src/usr.bin/make/main.c:1.374 Sun Oct 18 10:44:25 2020 +++ src/usr.bin/make/main.c Sun Oct 18 11:54:43 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.374 2020/10/18 10:44:25 rillig Exp $ */ +/* $NetBSD: main.c,v 1.375 2020/10/18 11:54:43 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -118,7 +118,7 @@ #include "trace.h" /* "@(#)main.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: main.c,v 1.374 2020/10/18 10:44:25 rillig Exp $"); +MAKE_RCSID("$NetBSD: main.c,v 1.375 2020/10/18 11:54:43 rillig Exp $"); #if defined(MAKE_NATIVE) && !defined(lint) __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 " "The Regents of the University of California. " @@ -1884,7 +1884,7 @@ write_all(int fd, const void *data, size if (written == -1) break; mem += written; - n -= written; + n -= (size_t)written; } } Index: src/usr.bin/make/meta.c diff -u src/usr.bin/make/meta.c:1.123 src/usr.bin/make/meta.c:1.124 --- src/usr.bin/make/meta.c:1.123 Sun Oct 18 07:46:04 2020 +++ src/usr.bin/make/meta.c Sun Oct 18 11:54:43 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: meta.c,v 1.123 2020/10/18 07:46:04 rillig Exp $ */ +/* $NetBSD: meta.c,v 1.124 2020/10/18 11:54:43 rillig Exp $ */ /* * Implement 'meta' mode. @@ -161,7 +161,6 @@ static int filemon_read(FILE *mfp, int fd) { char buf[BUFSIZ]; -int n; int error; /* Check if we're not writing to a meta data file.*/ @@ -176,11 +175,13 @@ filemon_read(FILE *mfp, int fd) warn("Could not rewind filemon"); fprintf(mfp, "\n"); } else { +ssize_t n; + error = 0; fprintf(mfp, "\n-- filemon acquired metadata --\n"); while ((n = read(fd, buf, sizeof(buf))) > 0) { - if ((int)fwrite(buf, 1, n, mfp) < n) + if ((ssize_t)fwrite(buf, 1, (size_t)n, mfp) < n) error = EIO; } } @@ -226,7 +227,7 @@ eat_dots(char *buf, size_t bufsz, int do } while (cp > buf && *cp != '/'); } if (*cp == '/') { - strlcpy(cp, cp2, bufsz - (cp - buf)); + strlcpy(cp, cp2, bufsz - (size_t)(cp - buf)); } else { return; /* can't happen? */ } @@ -260,7 +261,7 @@ meta_name(struct GNode *gn, char *mname, rp++; cp++; if (strcmp(cp, rp) != 0) - strlcpy(rp, cp, sizeof(buf) - (rp - buf)); + strlcpy(rp, cp, sizeof buf - (size_t)(rp - buf)); } tname = buf; } else { @@ -316,7 +317,7 @@ static int is_submake(void *cmdp, void *gnp) { static const char *p_make = NULL; -static int p_len; +static size_t p_len; char *cmd = cmdp; GNode *gn = gnp; char *mp = NULL; @@ -809,7 +810,7 @@ meta_job_output(Job *job, char *cp, cons if (pbm->mfp != NULL) { if (metaVerbose) { static char *meta_prefix = NULL; - static int meta_prefix_len; + static size_t meta_prefix_len; if (!meta_prefix) { char *cp2; @@ -818,7 +819,7 @@ meta_job_output(Job *job, char *cp, cons VAR_GLOBAL, VARE_WANTRES, &meta_prefix); /* TODO: handle errors */ if ((cp2 = strchr(meta_prefix, '$'))) - meta_prefix_len = cp2 - meta_prefix; + meta_prefix_len = (size_t)(cp2 - meta_prefix); else meta_prefix_len = strlen(meta_prefix); } @@ -907,9 +908,9 @@ fgetLine(char **bufp, size_t *szp, int o struct stat fs; int x; -if (fgets(&buf[o], bufsz - o, fp) != NULL) { +if (fgets(&buf[o], (int)bufsz - o, fp) != NULL) { check_newline: - x = o + strlen(&buf[o]); + x = o + (int)strlen(&buf[o]); if (buf[x - 1] == '\n') return x; /* @@ -920,9 +921,9 @@ fgetLine(char **bufp, size_t *szp, int o size_t newsz; char *p; - newsz = ROUNDUP((fs.st_size / 2), BUFSIZ); + newsz = ROUNDUP(((size_t)fs.st_size / 2), BUFSIZ); if (newsz <= bufsz) - newsz = ROUNDUP(fs.st_size, BUFSIZ); + newsz = ROUNDUP((size_t)fs.st_size, BUFSIZ); if (newsz <= bufsz) return x; /* truncated */ DEBUG2(META, "growing buffer %zu -> %zu\n", bufsz, newsz); @@ -931,7 +932,7 @@ fgetLine(char **bufp, size_t *szp, int o *bufp = buf = p; *szp = bufsz = newsz; /* fetch the rest */ - if (!fgets(&buf[x], bufsz - x, fp)) + if (!fgets(&buf[x], (int)bufsz - x,
CVS commit: src/sys/dev/wsfb
Module Name:src Committed By: rin Date: Sun Oct 18 11:54:21 UTC 2020 Modified Files: src/sys/dev/wsfb: genfb.c Log Message: For WSDISPLAYIO_GET_FBINFO ioctl, set WSFB_VRAM_IS_RAM to fbi_flags when shadow FB is used. To generate a diff of this commit: cvs rdiff -u -r1.74 -r1.75 src/sys/dev/wsfb/genfb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wsfb/genfb.c diff -u src/sys/dev/wsfb/genfb.c:1.74 src/sys/dev/wsfb/genfb.c:1.75 --- src/sys/dev/wsfb/genfb.c:1.74 Thu Jun 11 02:39:31 2020 +++ src/sys/dev/wsfb/genfb.c Sun Oct 18 11:54:20 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: genfb.c,v 1.74 2020/06/11 02:39:31 thorpej Exp $ */ +/* $NetBSD: genfb.c,v 1.75 2020/10/18 11:54:20 rin Exp $ */ /*- * Copyright (c) 2007 Michael Lorenz @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: genfb.c,v 1.74 2020/06/11 02:39:31 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: genfb.c,v 1.75 2020/10/18 11:54:20 rin Exp $"); #include #include @@ -500,7 +500,12 @@ genfb_ioctl(void *v, void *vs, u_long cm case WSDISPLAYIO_GET_FBINFO: { struct wsdisplayio_fbinfo *fbi = data; - return wsdisplayio_get_fbinfo(&ms->scr_ri, fbi); + ret = wsdisplayio_get_fbinfo(&ms->scr_ri, fbi); + if (ret == 0) { +if (sc->sc_enable_shadowfb) + fbi->fbi_flags |= WSFB_VRAM_IS_RAM; + } + return ret; } } return EPASSTHROUGH;
CVS commit: src/sys/dev/ic
Module Name:src Committed By: rin Date: Sun Oct 18 11:51:09 UTC 2020 Modified Files: src/sys/dev/ic: ac97.c Log Message: Fix undefined behaviors found by kUBSan. Tested on VirtualBox with amd64 kernel. To generate a diff of this commit: cvs rdiff -u -r1.99 -r1.100 src/sys/dev/ic/ac97.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ic/ac97.c diff -u src/sys/dev/ic/ac97.c:1.99 src/sys/dev/ic/ac97.c:1.100 --- src/sys/dev/ic/ac97.c:1.99 Thu Nov 28 05:07:27 2019 +++ src/sys/dev/ic/ac97.c Sun Oct 18 11:51:08 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: ac97.c,v 1.99 2019/11/28 05:07:27 isaki Exp $ */ +/* $NetBSD: ac97.c,v 1.100 2020/10/18 11:51:08 rin Exp $ */ /* $OpenBSD: ac97.c,v 1.8 2000/07/19 09:01:35 csapuntz Exp $ */ /* @@ -63,7 +63,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ac97.c,v 1.99 2019/11/28 05:07:27 isaki Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ac97.c,v 1.100 2020/10/18 11:51:08 rin Exp $"); #include #include @@ -1315,7 +1315,7 @@ ac97_attach_type(struct ac97_host_if *ho mutex_exit(as->lock); - id = (id1 << 16) | id2; + id = ((uint32_t)id1 << 16) | id2; aprint_normal_dev(sc_dev, "ac97: "); for (i = 0; ; i++) { @@ -1696,7 +1696,8 @@ ac97_query_devinfo(struct ac97_codec_if if (name) strcpy(dip->label.name, name); - memcpy(&dip->un, si->info, si->info_size); + if (si->info) + memcpy(&dip->un, si->info, si->info_size); /* Set the delta for volume sources */ if (dip->type == AUDIO_MIXER_VALUE)
CVS commit: src/usr.bin/make/filemon
Module Name:src Committed By: rillig Date: Sun Oct 18 11:49:47 UTC 2020 Modified Files: src/usr.bin/make/filemon: filemon.h Log Message: make(1): use consistent include guard for headers To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/filemon/filemon.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/filemon/filemon.h diff -u src/usr.bin/make/filemon/filemon.h:1.2 src/usr.bin/make/filemon/filemon.h:1.3 --- src/usr.bin/make/filemon/filemon.h:1.2 Wed Jan 22 22:10:36 2020 +++ src/usr.bin/make/filemon/filemon.h Sun Oct 18 11:49:47 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: filemon.h,v 1.2 2020/01/22 22:10:36 sjg Exp $ */ +/* $NetBSD: filemon.h,v 1.3 2020/10/18 11:49:47 rillig Exp $ */ /*- * Copyright (c) 2019 The NetBSD Foundation, Inc. @@ -29,8 +29,8 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#ifndef FILEMON_H_ -#define FILEMON_H_ +#ifndef MAKE_FILEMON_H +#define MAKE_FILEMON_H #include @@ -50,4 +50,4 @@ int filemon_setpid_child(const struct fi int filemon_readfd(const struct filemon *); int filemon_process(struct filemon *); -#endif /* FILEMON_H_ */ +#endif /* MAKE_FILEMON_H */
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sun Oct 18 11:09:08 UTC 2020 Modified Files: src/usr.bin/make: make.c make.h Log Message: make(1): convert NoExecute to non-inline The header make.h is not only used by usr.bin/make but also by usr.bin/xinstall, to get the needshell function. That program does not declare the variables noRecursiveExecute and noExecute, leading to an "unresolved reference" at link time. To fix this, move the inline functions away from make.h. It's a quirk that make.h gets included by other programs since it contains a whole lot of definitions that are only useful in make itself. If any, there should be a separate header that defines the public library API of make, and only that. To generate a diff of this commit: cvs rdiff -u -r1.158 -r1.159 src/usr.bin/make/make.c cvs rdiff -u -r1.156 -r1.157 src/usr.bin/make/make.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/make.c diff -u src/usr.bin/make/make.c:1.158 src/usr.bin/make/make.c:1.159 --- src/usr.bin/make/make.c:1.158 Sat Oct 17 17:47:14 2020 +++ src/usr.bin/make/make.c Sun Oct 18 11:09:08 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: make.c,v 1.158 2020/10/17 17:47:14 rillig Exp $ */ +/* $NetBSD: make.c,v 1.159 2020/10/18 11:09:08 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -107,7 +107,7 @@ #include"job.h" /* "@(#)make.c 8.1 (Berkeley) 6/6/93" */ -MAKE_RCSID("$NetBSD: make.c,v 1.158 2020/10/17 17:47:14 rillig Exp $"); +MAKE_RCSID("$NetBSD: make.c,v 1.159 2020/10/18 11:09:08 rillig Exp $"); /* Sequence # to detect recursion. */ static unsigned int checked = 1; @@ -177,6 +177,12 @@ GNode_FprintDetails(FILE *f, const char suffix); } +Boolean +NoExecute(GNode *gn) +{ +return (gn->type & OP_MAKE) ? noRecursiveExecute : noExecute; +} + /* Update the youngest child of the node, according to the given child. */ void Make_TimeStamp(GNode *pgn, GNode *cgn) Index: src/usr.bin/make/make.h diff -u src/usr.bin/make/make.h:1.156 src/usr.bin/make/make.h:1.157 --- src/usr.bin/make/make.h:1.156 Mon Oct 5 22:15:45 2020 +++ src/usr.bin/make/make.h Sun Oct 18 11:09:08 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: make.h,v 1.156 2020/10/05 22:15:45 rillig Exp $ */ +/* $NetBSD: make.h,v 1.157 2020/10/18 11:09:08 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -560,12 +560,7 @@ Boolean Main_SetObjdir(const char *, ... int mkTempFile(const char *, char **); int str2Lst_Append(StringList *, char *, const char *); void GNode_FprintDetails(FILE *, const char *, const GNode *, const char *); - -static Boolean MAKE_ATTR_UNUSED -NoExecute(GNode *gn) -{ -return (gn->type & OP_MAKE) ? noRecursiveExecute : noExecute; -} +Boolean NoExecute(GNode *gn); /* * See if the node with the given type was not the object of a dependency
CVS commit: src/sbin/mount
Module Name:src Committed By: mlelstv Date: Sun Oct 18 10:57:30 UTC 2020 Modified Files: src/sbin/mount: mount.c Log Message: Make command line arguments -r and -w actually override defaults from fstab, previously -w would only cancel a preceeding -r. No longer strip -o rw. To generate a diff of this commit: cvs rdiff -u -r1.102 -r1.103 src/sbin/mount/mount.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/mount/mount.c diff -u src/sbin/mount/mount.c:1.102 src/sbin/mount/mount.c:1.103 --- src/sbin/mount/mount.c:1.102 Sun Oct 9 21:03:43 2016 +++ src/sbin/mount/mount.c Sun Oct 18 10:57:30 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: mount.c,v 1.102 2016/10/09 21:03:43 christos Exp $ */ +/* $NetBSD: mount.c,v 1.103 2020/10/18 10:57:30 mlelstv Exp $ */ /* * Copyright (c) 1980, 1989, 1993, 1994 @@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 19 #if 0 static char sccsid[] = "@(#)mount.c 8.25 (Berkeley) 5/8/95"; #else -__RCSID("$NetBSD: mount.c,v 1.102 2016/10/09 21:03:43 christos Exp $"); +__RCSID("$NetBSD: mount.c,v 1.103 2020/10/18 10:57:30 mlelstv Exp $"); #endif #endif /* not lint */ @@ -94,6 +94,11 @@ static const struct opt { __MNT_FLAGS }; +#define FLG_UPDATE 1 +#define FLG_RDONLY 2 +#define FLG_RDWRITE 4 +#define FLG_FORCE 8 + static const char ffs_fstype[] = "ffs"; int @@ -128,14 +133,14 @@ main(int argc, char *argv[]) debug = 1; break; case 'f': - init_flags |= MNT_FORCE; + init_flags |= FLG_FORCE; break; case 'o': if (*optarg) catopt(&options, optarg); break; case 'r': - init_flags |= MNT_RDONLY; + init_flags |= FLG_RDONLY; break; case 't': if (vfslist != NULL) @@ -145,13 +150,13 @@ main(int argc, char *argv[]) vfstype = optarg; break; case 'u': - init_flags |= MNT_UPDATE; + init_flags |= FLG_UPDATE; break; case 'v': verbose++; break; case 'w': - init_flags &= ~MNT_RDONLY; + init_flags |= FLG_RDWRITE; break; case '?': default: @@ -218,7 +223,7 @@ main(int argc, char *argv[]) */ canonical_path = realpath(*argv, canonical_path_buf); - if (init_flags & MNT_UPDATE) { + if (init_flags & FLG_UPDATE) { /* * Try looking up the canonical path first, * then try exactly what the user entered. @@ -395,7 +400,7 @@ mountfs(const char *vfstype, const char catopt(&optbuf, "rw"); if (getargs == 0 && strcmp(name, "/") == 0 && !hasopt(optbuf, "union")) - flags |= MNT_UPDATE; + flags |= FLG_UPDATE; else if (skipmounted) { if ((numfs = getmntinfo(&sfp, MNT_WAIT)) == 0) { warn("getmntinfo"); @@ -431,12 +436,15 @@ mountfs(const char *vfstype, const char } } } - if (flags & MNT_FORCE) + if (flags & FLG_FORCE) catopt(&optbuf, "force"); - if (flags & MNT_RDONLY) + if (flags & FLG_RDONLY) catopt(&optbuf, "ro"); + /* make -w override -r */ + if (flags & FLG_RDWRITE) + catopt(&optbuf, "rw"); - if (flags & MNT_UPDATE) { + if (flags & FLG_UPDATE) { catopt(&optbuf, "update"); /* Figure out the fstype only if we defaulted to ffs */ if (vfstype == ffs_fstype && statvfs(name, &sf) != -1) @@ -690,7 +698,7 @@ mangle(char *options, int *argcp, const *p = '\0'; argv[argc++] = p+1; } - } else if (strcmp(p, "rw") != 0) { + } else { argv[argc++] = "-o"; argv[argc++] = p; }
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sun Oct 18 10:44:25 UTC 2020 Modified Files: src/usr.bin/make: dir.c hash.c hash.h main.c var.c Log Message: make(1): make API for iterating over hash tables simpler To generate a diff of this commit: cvs rdiff -u -r1.163 -r1.164 src/usr.bin/make/dir.c cvs rdiff -u -r1.44 -r1.45 src/usr.bin/make/hash.c cvs rdiff -u -r1.26 -r1.27 src/usr.bin/make/hash.h cvs rdiff -u -r1.373 -r1.374 src/usr.bin/make/main.c cvs rdiff -u -r1.574 -r1.575 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/dir.c diff -u src/usr.bin/make/dir.c:1.163 src/usr.bin/make/dir.c:1.164 --- src/usr.bin/make/dir.c:1.163 Sat Oct 17 21:32:30 2020 +++ src/usr.bin/make/dir.c Sun Oct 18 10:44:25 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: dir.c,v 1.163 2020/10/17 21:32:30 rillig Exp $ */ +/* $NetBSD: dir.c,v 1.164 2020/10/18 10:44:25 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -135,7 +135,7 @@ #include "job.h" /* "@(#)dir.c 8.2 (Berkeley) 1/2/94" */ -MAKE_RCSID("$NetBSD: dir.c,v 1.163 2020/10/17 21:32:30 rillig Exp $"); +MAKE_RCSID("$NetBSD: dir.c,v 1.164 2020/10/18 10:44:25 rillig Exp $"); #define DIR_DEBUG0(text) DEBUG0(DIR, text) #define DIR_DEBUG1(fmt, arg1) DEBUG1(DIR, fmt, arg1) @@ -608,16 +608,14 @@ Dir_HasWildcards(const char *name) static void DirMatchFiles(const char *pattern, CachedDir *dir, StringList *expansions) { -Hash_Search search; /* Index into the directory's table */ +HashIter hi; Hash_Entry *entry; /* Current entry in the table */ Boolean isDot; /* TRUE if the directory being searched is . */ isDot = (dir->name[0] == '.' && dir->name[1] == '\0'); -for (entry = Hash_EnumFirst(&dir->files, &search); - entry != NULL; - entry = Hash_EnumNext(&search)) -{ +HashIter_Init(&hi, &dir->files); +while ((entry = HashIter_Next(&hi)) != NULL) { /* * See if the file matches the given pattern. Note we follow the UNIX * convention that dot files will only be found if the pattern Index: src/usr.bin/make/hash.c diff -u src/usr.bin/make/hash.c:1.44 src/usr.bin/make/hash.c:1.45 --- src/usr.bin/make/hash.c:1.44 Mon Oct 5 20:21:30 2020 +++ src/usr.bin/make/hash.c Sun Oct 18 10:44:25 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: hash.c,v 1.44 2020/10/05 20:21:30 rillig Exp $ */ +/* $NetBSD: hash.c,v 1.45 2020/10/18 10:44:25 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -79,7 +79,7 @@ #include "make.h" /* "@(#)hash.c 8.1 (Berkeley) 6/6/93" */ -MAKE_RCSID("$NetBSD: hash.c,v 1.44 2020/10/05 20:21:30 rillig Exp $"); +MAKE_RCSID("$NetBSD: hash.c,v 1.45 2020/10/18 10:44:25 rillig Exp $"); /* * The ratio of # entries to # buckets at which we rebuild the table to @@ -283,43 +283,29 @@ Hash_DeleteEntry(Hash_Table *t, Hash_Ent abort(); } -/* Sets things up for enumerating all entries in the hash table. - * - * Input: - * t Table to be searched. - * searchPtr Area in which to keep state about search. - * - * Results: - * The return value is the address of the first entry in - * the hash table, or NULL if the table is empty. - */ -Hash_Entry * -Hash_EnumFirst(Hash_Table *t, Hash_Search *searchPtr) +/* Set things up for iterating over all entries in the hash table. */ +void +HashIter_Init(HashIter *hi, Hash_Table *t) { - searchPtr->table = t; - searchPtr->nextBucket = 0; - searchPtr->entry = NULL; - return Hash_EnumNext(searchPtr); + hi->table = t; + hi->nextBucket = 0; + hi->entry = NULL; } -/* Returns the next entry in the hash table, or NULL if the end of the table - * is reached. - * - * Input: - * searchPtr Area used to keep state about search. - */ +/* Return the next entry in the hash table, or NULL if the end of the table + * is reached. */ Hash_Entry * -Hash_EnumNext(Hash_Search *searchPtr) +HashIter_Next(HashIter *hi) { Hash_Entry *e; - Hash_Table *t = searchPtr->table; + Hash_Table *t = hi->table; /* * The entry field points to the most recently returned * entry, or is NULL if we are starting up. If not NULL, we have * to start at the next one in the chain. */ - e = searchPtr->entry; + e = hi->entry; if (e != NULL) e = e->next; /* @@ -327,27 +313,15 @@ Hash_EnumNext(Hash_Search *searchPtr) * find the next nonempty chain. */ while (e == NULL) { - if (searchPtr->nextBucket >= t->bucketsSize) + if (hi->nextBucket >= t->bucketsSize) return NULL; - e = t->buckets[searchPtr->nextBucket++]; + e = t->buckets[hi->nextBucket++]; } - searchPtr->entry = e; + hi->entry = e; return e; } void -Hash_ForEach(Hash_Table *t, void (*action)(void *, void *), void *data) -{ - Hash_Search search; - Hash_Entry *e; - - for (e = Hash_EnumFirst(t, &search); - e != NULL; - e = Hash_EnumNext(&search)) - action(Hash_GetValue(e), data); -} - -
CVS commit: src/share/misc
Module Name:src Committed By: leot Date: Sun Oct 18 10:17:09 UTC 2020 Modified Files: src/share/misc: acronyms.comp Log Message: Add PBR and VBR >From Rocky Hotas, thanks! To generate a diff of this commit: cvs rdiff -u -r1.313 -r1.314 src/share/misc/acronyms.comp Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/share/misc/acronyms.comp diff -u src/share/misc/acronyms.comp:1.313 src/share/misc/acronyms.comp:1.314 --- src/share/misc/acronyms.comp:1.313 Sun Oct 4 19:04:48 2020 +++ src/share/misc/acronyms.comp Sun Oct 18 10:17:09 2020 @@ -1,4 +1,4 @@ -$NetBSD: acronyms.comp,v 1.313 2020/10/04 19:04:48 nia Exp $ +$NetBSD: acronyms.comp,v 1.314 2020/10/18 10:17:09 leot Exp $ 3WHS three-way handshake 8VSB 8-state vestigial side band modulation AA anti-aliasing @@ -1154,6 +1154,7 @@ PATA parallel ATA PAX portable archive exchange PBE pending break encoding PBE programming by example +PBR partition boot record PC personal computer PC program counter PCB printed circuit board @@ -1714,6 +1715,7 @@ VA virtual address VA volt-ampere VAX virtual address extension VB Visual Basic +VBR volume boot record VCA variable-gain amplifier VCC common collector voltage VCCP virtual chassis control protocol
CVS commit: src/distrib/sets/lists/debug
Module Name:src Committed By: rin Date: Sun Oct 18 10:10:18 UTC 2020 Modified Files: src/distrib/sets/lists/debug: mi module.mi Log Message: Fix build for mips; move from mi to module.mi debug symbols for test cases only available when MKKMOD=yes. To generate a diff of this commit: cvs rdiff -u -r1.341 -r1.342 src/distrib/sets/lists/debug/mi cvs rdiff -u -r1.6 -r1.7 src/distrib/sets/lists/debug/module.mi 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/debug/mi diff -u src/distrib/sets/lists/debug/mi:1.341 src/distrib/sets/lists/debug/mi:1.342 --- src/distrib/sets/lists/debug/mi:1.341 Thu Oct 1 02:00:04 2020 +++ src/distrib/sets/lists/debug/mi Sun Oct 18 10:10:18 2020 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.341 2020/10/01 02:00:04 pgoyette Exp $ +# $NetBSD: mi,v 1.342 2020/10/18 10:10:18 rin Exp $ ./etc/mtree/set.debug comp-sys-root ./usr/lib comp-sys-usr compatdir ./usr/lib/i18n/libBIG5_g.a comp-c-debuglib debuglib,compatfile @@ -2364,11 +2364,6 @@ ./usr/libdata/debug/usr/tests/libexec/ld.elf_so/t_dlvsym.debug tests-libexec-debug debug,atf,pic,compattestfile ./usr/libdata/debug/usr/tests/libexec/ld.elf_so/t_rtld_r_debug.debug tests-libexec-debug debug,atf,pic,compattestfile ./usr/libdata/debug/usr/tests/libexec/ld.elf_so/t_ifunc.debug tests-libexec-debug debug,atf,pic,compattestfile -./usr/libdata/debug/usr/tests/modules/k_helper3.debug tests-sys-debug debug,atf,rump -./usr/libdata/debug/usr/tests/modules/t_builtin.debug tests-sys-debug debug,atf,rump -./usr/libdata/debug/usr/tests/modules/t_kcov.debug tests-sys-debug debug,atf,rump -./usr/libdata/debug/usr/tests/modules/t_modctl.debug tests-sys-debug debug,atf,rump -./usr/libdata/debug/usr/tests/modules/t_ufetchstore.debug tests-sys-debug debug,atf,rump ./usr/libdata/debug/usr/tests/net/bpf/t_bpf.debug tests-net-debug debug,atf,rump ./usr/libdata/debug/usr/tests/net/bpf/t_div-by-zero.debug tests-net-debug debug,atf,rump ./usr/libdata/debug/usr/tests/net/bpf/t_mbuf.debug tests-net-debug debug,atf,rump Index: src/distrib/sets/lists/debug/module.mi diff -u src/distrib/sets/lists/debug/module.mi:1.6 src/distrib/sets/lists/debug/module.mi:1.7 --- src/distrib/sets/lists/debug/module.mi:1.6 Sat Sep 26 17:49:50 2020 +++ src/distrib/sets/lists/debug/module.mi Sun Oct 18 10:10:18 2020 @@ -1,4 +1,4 @@ -# $NetBSD: module.mi,v 1.6 2020/09/26 17:49:50 jmcneill Exp $ +# $NetBSD: module.mi,v 1.7 2020/10/18 10:10:18 rin Exp $ ./usr/libdata/debug/@MODULEDIR@ modules-base-kernel kmod,debug ./usr/libdata/debug/@MODULEDIR@/accf_dataready modules-base-kernel kmod,debug ./usr/libdata/debug/@MODULEDIR@/accf_dataready/accf_dataready.kmod.debug modules-base-kernel kmod,debug @@ -407,6 +407,10 @@ ./usr/libdata/debug/usr/tests/modules/k_helper3.debug tests-sys-debug debug,atf,rump ./usr/libdata/debug/usr/tests/modules/k_uvmtests-sys-debug atf,debug,rump ./usr/libdata/debug/usr/tests/modules/k_uvm/k_uvm.kmod.debug tests-sys-debug atf,debug,rump +./usr/libdata/debug/usr/tests/modules/t_builtin.debug tests-sys-debug debug,atf,rump +./usr/libdata/debug/usr/tests/modules/t_kcov.debug tests-sys-debug debug,atf,rump +./usr/libdata/debug/usr/tests/modules/t_modctl.debug tests-sys-debug debug,atf,rump +./usr/libdata/debug/usr/tests/modules/t_ufetchstore.debug tests-sys-debug debug,atf,rump ./usr/libdata/debug/usr/tests/modules/threadpool_tester tests-sys-debug atf,debug,rump ./usr/libdata/debug/usr/tests/modules/threadpool_tester/threadpool_tester.kmod.debug tests-sys-debug atf,debug,rump ./usr/libdata/debug/usr/tests/modules/ufetchstore_tester tests-sys-debug atf,debug,rump
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sun Oct 18 08:58:29 UTC 2020 Modified Files: src/usr.bin/make: lst.c lst.h parse.c var.c src/usr.bin/make/unit-tests: include-sub.mk Log Message: make(1): rename Stack to Vector Both Var_Dump and GetActuallyIncludingFile access more than only the top item of the stack, therefore it is more honest to rename the data type. To generate a diff of this commit: cvs rdiff -u -r1.75 -r1.76 src/usr.bin/make/lst.c cvs rdiff -u -r1.69 -r1.70 src/usr.bin/make/lst.h cvs rdiff -u -r1.383 -r1.384 src/usr.bin/make/parse.c cvs rdiff -u -r1.573 -r1.574 src/usr.bin/make/var.c cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/unit-tests/include-sub.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/lst.c diff -u src/usr.bin/make/lst.c:1.75 src/usr.bin/make/lst.c:1.76 --- src/usr.bin/make/lst.c:1.75 Sat Oct 17 17:47:14 2020 +++ src/usr.bin/make/lst.c Sun Oct 18 08:58:29 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: lst.c,v 1.75 2020/10/17 17:47:14 rillig Exp $ */ +/* $NetBSD: lst.c,v 1.76 2020/10/18 08:58:29 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -34,7 +34,7 @@ #include "make.h" -MAKE_RCSID("$NetBSD: lst.c,v 1.75 2020/10/17 17:47:14 rillig Exp $"); +MAKE_RCSID("$NetBSD: lst.c,v 1.76 2020/10/18 08:58:29 rillig Exp $"); /* Allocate and initialize a list node. * @@ -499,43 +499,43 @@ Lst_Dequeue(List *list) } void -Stack_Init(Stack *stack) +Vector_Init(Vector *v) { -stack->len = 0; -stack->cap = 10; -stack->items = bmake_malloc(stack->cap * sizeof stack->items[0]); +v->len = 0; +v->cap = 10; +v->items = bmake_malloc(v->cap * sizeof v->items[0]); } -Boolean Stack_IsEmpty(Stack *stack) +Boolean Vector_IsEmpty(Vector *v) { -return stack->len == 0; +return v->len == 0; } -void Stack_Push(Stack *stack, void *datum) +void Vector_Push(Vector *v, void *datum) { -if (stack->len >= stack->cap) { - stack->cap *= 2; - stack->items = bmake_realloc(stack->items, - stack->cap * sizeof stack->items[0]); +if (v->len >= v->cap) { + v->cap *= 2; + v->items = bmake_realloc(v->items, + v->cap * sizeof v->items[0]); } -stack->items[stack->len] = datum; -stack->len++; +v->items[v->len] = datum; +v->len++; } -void *Stack_Pop(Stack *stack) +void *Vector_Pop(Vector *v) { void *datum; -assert(stack->len > 0); -stack->len--; -datum = stack->items[stack->len]; +assert(v->len > 0); +v->len--; +datum = v->items[v->len]; #ifdef CLEANUP -stack->items[stack->len] = NULL; +v->items[v->len] = NULL; #endif return datum; } -void Stack_Done(Stack *stack) +void Vector_Done(Vector *v) { -free(stack->items); +free(v->items); } Index: src/usr.bin/make/lst.h diff -u src/usr.bin/make/lst.h:1.69 src/usr.bin/make/lst.h:1.70 --- src/usr.bin/make/lst.h:1.69 Sat Sep 26 17:15:20 2020 +++ src/usr.bin/make/lst.h Sun Oct 18 08:58:29 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: lst.h,v 1.69 2020/09/26 17:15:20 rillig Exp $ */ +/* $NetBSD: lst.h,v 1.70 2020/10/18 08:58:29 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -210,18 +210,17 @@ void Lst_Enqueue(List *, void *); /* Remove the head node of the queue and return its datum. */ void *Lst_Dequeue(List *); -/* A stack is a very simple collection of items that only allows access to the - * top-most item. */ -typedef struct Stack { +/* A vector is an ordered collection of items, allowing fast indexed access. */ +typedef struct Vector { void **items; size_t len; size_t cap; -} Stack; +} Vector; -void Stack_Init(Stack *); -Boolean Stack_IsEmpty(Stack *); -void Stack_Push(Stack *, void *); -void *Stack_Pop(Stack *); -void Stack_Done(Stack *); +void Vector_Init(Vector *); +Boolean Vector_IsEmpty(Vector *); +void Vector_Push(Vector *, void *); +void *Vector_Pop(Vector *); +void Vector_Done(Vector *); #endif /* MAKE_LST_H */ Index: src/usr.bin/make/parse.c diff -u src/usr.bin/make/parse.c:1.383 src/usr.bin/make/parse.c:1.384 --- src/usr.bin/make/parse.c:1.383 Sat Oct 17 21:32:30 2020 +++ src/usr.bin/make/parse.c Sun Oct 18 08:58:29 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: parse.c,v 1.383 2020/10/17 21:32:30 rillig Exp $ */ +/* $NetBSD: parse.c,v 1.384 2020/10/18 08:58:29 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -131,7 +131,7 @@ #include "pathnames.h" /* "@(#)parse.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: parse.c,v 1.383 2020/10/17 21:32:30 rillig Exp $"); +MAKE_RCSID("$NetBSD: parse.c,v 1.384 2020/10/18 08:58:29 rillig Exp $"); /* types and constants */ @@ -280,7 +280,7 @@ static IFile *curFile; * (not printed since it is below a .for loop) * includes[0]: include-main.mk:27 */ -static Stack /* of *IFile */ includes; +static Vector /* of IFile pointer */ includes; /* include pat
CVS commit: src/sys/uvm
Module Name:src Committed By: rin Date: Sun Oct 18 08:52:15 UTC 2020 Modified Files: src/sys/uvm: uvm_bio.c Log Message: PR kern/55658 Revert rev 1.122: http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/uvm/uvm_bio.c#rev1.122 If this commit is applied to NFS client, changes to files in client side are sometimes invisible in server side, which results in file corruption. Demonstrated by test code provided by Anthony Mallet: https://mail-index.netbsd.org/current-users/2020/10/17/msg039708.html Whether the test case above passes or not depends on architectures and size of NFS I/O specified by -r and -w options of mount_nfs(8) (the default size is 32KB for x86 and 8KB for other archs). Whereas it fails on amd64 and i386 with the default size, it passes on other archs (aarch64, arm, alpha, m68k, and powerpc at least) with their default. On most ports, it fails with some I/O sizes. However, the condition for failure is still unclear; whereas it fails with 2KB I/O size on amiga (m68k, 8KB page), it passes with same I/O size on alpha (8KB page). It may depends on some VM parameters or details in pmap implementation, or some race conditions are involved. Great thanks to Anthony Mallet for providing the test code, and sorry everyone for breakage. To generate a diff of this commit: cvs rdiff -u -r1.122 -r1.123 src/sys/uvm/uvm_bio.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/uvm/uvm_bio.c diff -u src/sys/uvm/uvm_bio.c:1.122 src/sys/uvm/uvm_bio.c:1.123 --- src/sys/uvm/uvm_bio.c:1.122 Mon Oct 5 04:48:23 2020 +++ src/sys/uvm/uvm_bio.c Sun Oct 18 08:52:15 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: uvm_bio.c,v 1.122 2020/10/05 04:48:23 rin Exp $ */ +/* $NetBSD: uvm_bio.c,v 1.123 2020/10/18 08:52:15 rin Exp $ */ /* * Copyright (c) 1998 Chuck Silvers. @@ -34,7 +34,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: uvm_bio.c,v 1.122 2020/10/05 04:48:23 rin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uvm_bio.c,v 1.123 2020/10/18 08:52:15 rin Exp $"); #include "opt_uvmhist.h" #include "opt_ubc.h" @@ -235,7 +235,9 @@ static inline int ubc_fault_page(const struct uvm_faultinfo *ufi, const struct ubc_map *umap, struct vm_page *pg, vm_prot_t prot, vm_prot_t access_type, vaddr_t va) { + vm_prot_t mask; int error; + bool rdonly; KASSERT(rw_write_held(pg->uobject->vmobjlock)); @@ -278,11 +280,11 @@ ubc_fault_page(const struct uvm_faultinf pg->offset < umap->writeoff || pg->offset + PAGE_SIZE > umap->writeoff + umap->writelen); - KASSERT((access_type & VM_PROT_WRITE) == 0 || - uvm_pagegetdirty(pg) != UVM_PAGE_STATUS_CLEAN); + rdonly = uvm_pagereadonly_p(pg); + mask = rdonly ? ~VM_PROT_WRITE : VM_PROT_ALL; error = pmap_enter(ufi->orig_map->pmap, va, VM_PAGE_TO_PHYS(pg), - prot, PMAP_CANFAIL | access_type); + prot & mask, PMAP_CANFAIL | (access_type & mask)); uvm_pagelock(pg); uvm_pageactivate(pg);
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sun Oct 18 08:47:54 UTC 2020 Modified Files: src/usr.bin/make: var.c src/usr.bin/make/unit-tests: varname.exp varname.mk Log Message: make(1): sort variables in debug output This way it's easier to see whether an expected variable is missing, or to compare the values of related variables, since they usually share a common prefix. Any sorting criterion is better than the hash code. Sorting the variables by name changed the order of the output in varname.mk. That test didn't test anything meaningful, it was just a playground to understand and demonstrate the current implementation of how the variables are stored, therefore it has been removed. To generate a diff of this commit: cvs rdiff -u -r1.572 -r1.573 src/usr.bin/make/var.c cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/varname.exp cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/varname.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/var.c diff -u src/usr.bin/make/var.c:1.572 src/usr.bin/make/var.c:1.573 --- src/usr.bin/make/var.c:1.572 Sat Oct 17 21:32:30 2020 +++ src/usr.bin/make/var.c Sun Oct 18 08:47:54 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: var.c,v 1.572 2020/10/17 21:32:30 rillig Exp $ */ +/* $NetBSD: var.c,v 1.573 2020/10/18 08:47:54 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -121,7 +121,7 @@ #include"metachar.h" /* "@(#)var.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: var.c,v 1.572 2020/10/17 21:32:30 rillig Exp $"); +MAKE_RCSID("$NetBSD: var.c,v 1.573 2020/10/18 08:47:54 rillig Exp $"); #define VAR_DEBUG1(fmt, arg1) DEBUG1(VAR, fmt, arg1) #define VAR_DEBUG2(fmt, arg1, arg2) DEBUG2(VAR, fmt, arg1, arg2) @@ -3852,18 +3852,28 @@ Var_Stats(void) Hash_DebugStats(&VAR_GLOBAL->context, "VAR_GLOBAL"); } - -/** PRINT DEBUGGING INFO */ -static void -VarPrintVar(void *vp, void *data MAKE_ATTR_UNUSED) -{ -Var *v = (Var *)vp; -debug_printf("%-16s = %s\n", v->name, Buf_GetAll(&v->val, NULL)); -} - -/* Print all variables in a context, unordered. */ +/* Print all variables in a context, sorted by name. */ void Var_Dump(GNode *ctxt) { -Hash_ForEach(&ctxt->context, VarPrintVar, NULL); +Stack varnames; +Hash_Search iter; +Hash_Entry *he; +size_t i; + +Stack_Init(&varnames); +for (he = Hash_EnumFirst(&ctxt->context, &iter); + he != NULL; + he = Hash_EnumNext(&iter)) +Stack_Push(&varnames, he->name); + +qsort(varnames.items, varnames.len, sizeof varnames.items[0], str_cmp_asc); + +for (i = 0; i < varnames.len; i++) { +const char *varname = varnames.items[i]; +Var *var = Hash_FindValue(&ctxt->context, varname); + debug_printf("%-16s = %s\n", varname, Buf_GetAll(&var->val, NULL)); +} + +Stack_Done(&varnames); } Index: src/usr.bin/make/unit-tests/varname.exp diff -u src/usr.bin/make/unit-tests/varname.exp:1.2 src/usr.bin/make/unit-tests/varname.exp:1.3 --- src/usr.bin/make/unit-tests/varname.exp:1.2 Sat Sep 5 13:34:19 2020 +++ src/usr.bin/make/unit-tests/varname.exp Sun Oct 18 08:47:54 2020 @@ -1,19 +1 @@ -MAGIC1B1B1B = 1 -MAGIC1B1B0a = 2 -MAGIC1B0a1B = 3 -MAGIC1B0a0a = 4 -MAGIC0a1B1B = 5 -MAGIC0a1B0a = 6 -MAGIC0a0a1B = 7 -MAGIC0a0a0a = 8 -ORDER_01 = yes -MAGIC0a0a0a = 1 -MAGIC0a0a1B = 2 -MAGIC0a1B0a = 3 -MAGIC0a1B1B = 4 -MAGIC1B0a0a = 5 -MAGIC1B0a1B = 6 -MAGIC1B1B0a = 7 -MAGIC1B1B1B = 8 -ORDER_10 = yes exit status 0 Index: src/usr.bin/make/unit-tests/varname.mk diff -u src/usr.bin/make/unit-tests/varname.mk:1.3 src/usr.bin/make/unit-tests/varname.mk:1.4 --- src/usr.bin/make/unit-tests/varname.mk:1.3 Sat Sep 5 12:59:07 2020 +++ src/usr.bin/make/unit-tests/varname.mk Sun Oct 18 08:47:54 2020 @@ -1,43 +1,8 @@ -# $NetBSD: varname.mk,v 1.3 2020/09/05 12:59:07 rillig Exp $ +# $NetBSD: varname.mk,v 1.4 2020/10/18 08:47:54 rillig Exp $ # # Tests for special variables, such as .MAKE or .PARSEDIR. -# These following MAGIC variables have the same hash code, at least with -# the default hashing algorithm, which is the same as in Java. The order -# in which these variables are defined determines the order in which they -# appear in the Hash_Table. New entries are prepended to the bucket lists, -# therefore this test numbers the values in descending order. - -.if defined(ORDER_01) - -MAGIC0a0a0a= 8 -MAGIC0a0a1B= 7 -MAGIC0a1B0a= 6 -MAGIC0a1B1B= 5 -MAGIC1B0a0a= 4 -MAGIC1B0a1B= 3 -MAGIC1B1B0a= 2 -MAGIC1B1B1B= 1 - -all: # nothing - -.elif defined(ORDER_10) - -MAGIC1B1B1B= 8 -MAGIC1B1B0a= 7 -MAGIC1B0a1B= 6 -MAGIC1B0a0a= 5 -MAGIC0a1B1B= 4 -MAGIC0a1B0a= 3 -MAGIC0a0a1B= 2 -MAGIC0a0a0a= 1 - -all: # nothing - -.else +# TODO: Implementation all: - @${.MAKE} -f ${MAKEFILE} -dg1 ORDER_01=yes - @${.MAKE} -f ${MAKEFILE} -dg1 ORDER_1
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sun Oct 18 08:24:01 UTC 2020 Modified Files: src/usr.bin/make: targ.c Log Message: make(1): extract GNode_OpName from Targ_PrintNode To generate a diff of this commit: cvs rdiff -u -r1.113 -r1.114 src/usr.bin/make/targ.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/targ.c diff -u src/usr.bin/make/targ.c:1.113 src/usr.bin/make/targ.c:1.114 --- src/usr.bin/make/targ.c:1.113 Sat Oct 17 21:32:30 2020 +++ src/usr.bin/make/targ.c Sun Oct 18 08:24:01 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: targ.c,v 1.113 2020/10/17 21:32:30 rillig Exp $ */ +/* $NetBSD: targ.c,v 1.114 2020/10/18 08:24:01 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -121,7 +121,7 @@ #include "dir.h" /* "@(#)targ.c 8.2 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: targ.c,v 1.113 2020/10/17 21:32:30 rillig Exp $"); +MAKE_RCSID("$NetBSD: targ.c,v 1.114 2020/10/18 08:24:01 rillig Exp $"); static GNodeList *allTargets; /* the list of all targets found so far */ #ifdef CLEANUP @@ -430,6 +430,20 @@ made_name(GNodeMade made) } } +static const char * +GNode_OpName(const GNode *gn) +{ +switch (gn->type & OP_OPMASK) { +case OP_DEPENDS: + return ":"; +case OP_FORCE: + return "!"; +case OP_DOUBLEDEP: + return "::"; +} +return ""; +} + /* Print the contents of a node. */ void Targ_PrintNode(GNode *gn, int pass) @@ -471,15 +485,7 @@ Targ_PrintNode(GNode *gn, int pass) PrintNodeNamesLine("order_pred", gn->order_pred); PrintNodeNamesLine("order_succ", gn->order_succ); - debug_printf("%-16s", gn->name); - switch (gn->type & OP_OPMASK) { - case OP_DEPENDS: - debug_printf(":"); break; - case OP_FORCE: - debug_printf("!"); break; - case OP_DOUBLEDEP: - debug_printf("::"); break; - } + debug_printf("%-16s%s", gn->name, GNode_OpName(gn)); Targ_PrintType(gn->type); PrintNodeNames(gn->children); debug_printf("\n");
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sun Oct 18 08:01:23 UTC 2020 Modified Files: src/usr.bin/make: config.h main.c Log Message: make(1): remove USE_IOVEC When a system call in a child process failed, there was no guarantee that the error message would be written completely. Using writev correctly is harder than building the string in a buffer and then writing it in the traditional way. According to POSIX 2004, using memory allocation or even calling write(2) from the child process invokes undefined behavior. The remaining code from make has done all this for several years now, successfully, therefore adding one more of that won't hurt. Make still tries to write the error message atomically by passing the whole buffer at once to write(2), just as in the previous writev(2) implementation. To generate a diff of this commit: cvs rdiff -u -r1.23 -r1.24 src/usr.bin/make/config.h cvs rdiff -u -r1.372 -r1.373 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/config.h diff -u src/usr.bin/make/config.h:1.23 src/usr.bin/make/config.h:1.24 --- src/usr.bin/make/config.h:1.23 Sun Sep 27 17:17:01 2020 +++ src/usr.bin/make/config.h Sun Oct 18 08:01:23 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: config.h,v 1.23 2020/09/27 17:17:01 rillig Exp $ */ +/* $NetBSD: config.h,v 1.24 2020/10/18 08:01:23 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -154,12 +154,6 @@ */ #define SUNSHCMD -/* - * USE_IOVEC - * We have writev(2) - */ -#define USE_IOVEC - #if defined(MAKE_NATIVE) && !defined(__ELF__) # ifndef RANLIBMAG # define RANLIBMAG "__.SYMDEF" Index: src/usr.bin/make/main.c diff -u src/usr.bin/make/main.c:1.372 src/usr.bin/make/main.c:1.373 --- src/usr.bin/make/main.c:1.372 Sun Oct 18 07:46:04 2020 +++ src/usr.bin/make/main.c Sun Oct 18 08:01:23 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.372 2020/10/18 07:46:04 rillig Exp $ */ +/* $NetBSD: main.c,v 1.373 2020/10/18 08:01:23 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -117,12 +117,8 @@ #include "pathnames.h" #include "trace.h" -#ifdef USE_IOVEC -#include -#endif - /* "@(#)main.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: main.c,v 1.372 2020/10/18 07:46:04 rillig Exp $"); +MAKE_RCSID("$NetBSD: main.c,v 1.373 2020/10/18 08:01:23 rillig Exp $"); #if defined(MAKE_NATIVE) && !defined(lint) __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 " "The Regents of the University of California. " @@ -1876,6 +1872,22 @@ eunlink(const char *file) return unlink(file); } +static void +write_all(int fd, const void *data, size_t n) +{ + const char *mem = data; + + while (n > 0) { + ssize_t written = write(fd, mem, n); + if (written == -1 && errno == EAGAIN) + continue; + if (written == -1) + break; + mem += written; + n -= written; + } +} + /* * execDie -- * Print why exec failed, avoiding stdio. @@ -1883,30 +1895,21 @@ eunlink(const char *file) void MAKE_ATTR_DEAD execDie(const char *af, const char *av) { -#ifdef USE_IOVEC - int i = 0; - struct iovec iov[8]; -#define IOADD(s) \ - (void)(iov[i].iov_base = UNCONST(s), \ - iov[i].iov_len = strlen(iov[i].iov_base), \ - i++) -#else -#define IOADD(void)write(2, s, strlen(s)) -#endif + Buffer buf; - IOADD(progname); - IOADD(": "); - IOADD(af); - IOADD("("); - IOADD(av); - IOADD(") failed ("); - IOADD(strerror(errno)); - IOADD(")\n"); + Buf_Init(&buf, 0); + Buf_AddStr(&buf, progname); + Buf_AddStr(&buf, ": "); + Buf_AddStr(&buf, af); + Buf_AddStr(&buf, "("); + Buf_AddStr(&buf, av); + Buf_AddStr(&buf, ") failed ("); + Buf_AddStr(&buf, strerror(errno)); + Buf_AddStr(&buf, ")\n"); -#ifdef USE_IOVEC - while (writev(2, iov, 8) == -1 && errno == EAGAIN) - continue; -#endif + write_all(STDERR_FILENO, Buf_GetAll(&buf, NULL), Buf_Len(&buf)); + + Buf_Destroy(&buf, TRUE); _exit(1); }
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sun Oct 18 07:46:04 UTC 2020 Modified Files: src/usr.bin/make: compat.c job.c main.c meta.c nonints.h Log Message: make(1): replace execError with execDie All calls to this function were followed by _exit(1). To generate a diff of this commit: cvs rdiff -u -r1.165 -r1.166 src/usr.bin/make/compat.c cvs rdiff -u -r1.263 -r1.264 src/usr.bin/make/job.c cvs rdiff -u -r1.371 -r1.372 src/usr.bin/make/main.c cvs rdiff -u -r1.122 -r1.123 src/usr.bin/make/meta.c cvs rdiff -u -r1.141 -r1.142 src/usr.bin/make/nonints.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/compat.c diff -u src/usr.bin/make/compat.c:1.165 src/usr.bin/make/compat.c:1.166 --- src/usr.bin/make/compat.c:1.165 Mon Oct 5 19:27:47 2020 +++ src/usr.bin/make/compat.c Sun Oct 18 07:46:04 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: compat.c,v 1.165 2020/10/05 19:27:47 rillig Exp $ */ +/* $NetBSD: compat.c,v 1.166 2020/10/18 07:46:04 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.165 2020/10/05 19:27:47 rillig Exp $"); +MAKE_RCSID("$NetBSD: compat.c,v 1.166 2020/10/18 07:46:04 rillig Exp $"); static GNode *curTarg = NULL; static pid_t compatChild; @@ -348,8 +348,7 @@ Compat_RunCommand(const char *cmdp, stru } #endif (void)execvp(av[0], (char *const *)UNCONST(av)); - execError("exec", av[0]); - _exit(1); + execDie("exec", av[0]); } free(mav); Index: src/usr.bin/make/job.c diff -u src/usr.bin/make/job.c:1.263 src/usr.bin/make/job.c:1.264 --- src/usr.bin/make/job.c:1.263 Sat Oct 17 21:32:30 2020 +++ src/usr.bin/make/job.c Sun Oct 18 07:46:04 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: job.c,v 1.263 2020/10/17 21:32:30 rillig Exp $ */ +/* $NetBSD: job.c,v 1.264 2020/10/18 07:46: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.263 2020/10/17 21:32:30 rillig Exp $"); +MAKE_RCSID("$NetBSD: job.c,v 1.264 2020/10/18 07:46:04 rillig Exp $"); # define STATIC static @@ -1203,55 +1203,40 @@ JobExec(Job *job, char **argv) * reset it to the beginning (again). Since the stream was marked * close-on-exec, we must clear that bit in the new input. */ - if (dup2(fileno(job->cmdFILE), 0) == -1) { - execError("dup2", "job->cmdFILE"); - _exit(1); - } - if (fcntl(0, F_SETFD, 0) == -1) { - execError("fcntl clear close-on-exec", "stdin"); - _exit(1); - } - if (lseek(0, (off_t)0, SEEK_SET) == -1) { - execError("lseek to 0", "stdin"); - _exit(1); - } + if (dup2(fileno(job->cmdFILE), 0) == -1) + execDie("dup2", "job->cmdFILE"); + if (fcntl(0, F_SETFD, 0) == -1) + execDie("fcntl clear close-on-exec", "stdin"); + if (lseek(0, (off_t)0, SEEK_SET) == -1) + execDie("lseek to 0", "stdin"); if (job->node->type & (OP_MAKE | OP_SUBMAKE)) { /* * Pass job token pipe to submakes. */ - if (fcntl(tokenWaitJob.inPipe, F_SETFD, 0) == -1) { - execError("clear close-on-exec", "tokenWaitJob.inPipe"); - _exit(1); - } - if (fcntl(tokenWaitJob.outPipe, F_SETFD, 0) == -1) { - execError("clear close-on-exec", "tokenWaitJob.outPipe"); - _exit(1); - } + if (fcntl(tokenWaitJob.inPipe, F_SETFD, 0) == -1) + execDie("clear close-on-exec", "tokenWaitJob.inPipe"); + if (fcntl(tokenWaitJob.outPipe, F_SETFD, 0) == -1) + execDie("clear close-on-exec", "tokenWaitJob.outPipe"); } /* * Set up the child's output to be routed through the pipe * we've created for it. */ - if (dup2(job->outPipe, 1) == -1) { - execError("dup2", "job->outPipe"); - _exit(1); - } + if (dup2(job->outPipe, 1) == -1) + execDie("dup2", "job->outPipe"); + /* * The output channels are marked close on exec. This bit was * duplicated by the dup2(on some systems), so we have to clear * it before routing the shell's error output to the same place as * its standard output. */ - if (fcntl(1, F_SETFD, 0) == -1) { - execError("clear close-on-exec", "stdout"); - _exit(1); - } - if (dup2(1, 2) == -1) { - execError("dup2", "1, 2"); - _exit(1); - } + if (fcntl(1, F_SETFD, 0) == -1) + execDie("clear close-on-exec", "stdout"); + if (dup2(1, 2) == -1) + execDie("dup2", "1, 2"); /* * We want to switch the child into a different process family so @@ -1270,8 +1255,7 @@ JobExec(Job *job, char **argv) Var_ExportVars(); (void)execv(shellPath, argv); - execError("exec", shellPath); - _exit(1); + execDie("exec", shellPath); } /* Parent, continuing after the child exec */ Index: src/usr.bin/make/main.c diff -u src/usr.bin/make/main.c:1.371 src/usr.bin/make/main