CVS commit: src
Module Name:src Committed By: wiz Date: Wed Mar 10 07:23:42 UTC 2021 Modified Files: src/share/man/man4: drm.4 src/sys/arch/amd64/conf: GENERIC src/sys/external/bsd/drm2/dist/drm: drm_modes.c Log Message: drm(4): allow limiting maximum X/Y resolution With some drivers (at least radeon(4)), in some cases the driver does not choose the resolution correctly. The options DRM_MAX_RESOLUTION_HORIZONTAL and DRM_MAX_RESOLUTION_VERTICAL allow limiting the maximum resolution in X and Y direction. To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/share/man/man4/drm.4 cvs rdiff -u -r1.587 -r1.588 src/sys/arch/amd64/conf/GENERIC cvs rdiff -u -r1.8 -r1.9 src/sys/external/bsd/drm2/dist/drm/drm_modes.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/share/man/man4/drm.4 diff -u src/share/man/man4/drm.4:1.17 src/share/man/man4/drm.4:1.18 --- src/share/man/man4/drm.4:1.17 Wed Jul 18 16:41:53 2018 +++ src/share/man/man4/drm.4 Wed Mar 10 07:23:42 2021 @@ -1,4 +1,4 @@ -.\" $NetBSD: drm.4,v 1.17 2018/07/18 16:41:53 wiz Exp $ +.\" $NetBSD: drm.4,v 1.18 2021/03/10 07:23:42 wiz Exp $ .\" .\" Copyright (c) 2007, 2013 Thomas Klausner .\" All rights reserved. @@ -23,7 +23,7 @@ .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.Dd July 10, 2018 +.Dd March 10, 2021 .Dt DRM 4 .Os .Sh NAME @@ -41,6 +41,8 @@ .Pp .Cd optionsDRM_DEBUG .Cd optionsDRM_NO_AGP +.Cd optionsDRM_MAX_RESOLUTION_HORIZONTAL=integer +.Cd optionsDRM_MAX_RESOLUTION_VERTICAL=integer .Sh DESCRIPTION The Direct Rendering Manager is part of the Direct Rendering Infrastructure for supporting video acceleration (3d acceleration, @@ -88,6 +90,15 @@ and compiled from .Xr pkgsrc 7 do so automatically where supported. .Pp +With some drivers (at least +.Xr radeon 4 ) , +in some cases the driver does not choose the resolution correctly. +The options +.Dv DRM_MAX_RESOLUTION_HORIZONTAL +and +.Dv DRM_MAX_RESOLUTION_VERTICAL +allow limiting the maximum resolution in X and Y direction. +.Pp .Xr X 7 will attempt to create the device node automatically. To create the device node manually: Index: src/sys/arch/amd64/conf/GENERIC diff -u src/sys/arch/amd64/conf/GENERIC:1.587 src/sys/arch/amd64/conf/GENERIC:1.588 --- src/sys/arch/amd64/conf/GENERIC:1.587 Wed Mar 10 06:38:44 2021 +++ src/sys/arch/amd64/conf/GENERIC Wed Mar 10 07:23:42 2021 @@ -1,4 +1,4 @@ -# $NetBSD: GENERIC,v 1.587 2021/03/10 06:38:44 msaitoh Exp $ +# $NetBSD: GENERIC,v 1.588 2021/03/10 07:23:42 wiz Exp $ # # GENERIC machine description file # @@ -22,7 +22,7 @@ include "arch/amd64/conf/std.amd64" options INCLUDE_CONFIG_FILE # embed config file in kernel binary -#ident "GENERIC-$Revision: 1.587 $" +#ident "GENERIC-$Revision: 1.588 $" maxusers 64 # estimated number of users @@ -456,6 +456,9 @@ nouveaufb* at nouveaufbbus? # DRMUMS drivers #viadrmums* at drm? +#options DRM_MAX_RESOLUTION_HORIZONTAL=1920 # Limit DRM size in horizontal dimension +#options DRM_MAX_RESOLUTION_VERTICAL=1080 # Limit DRM size in vertical dimension + # Cryptographic Devices # PCI cryptographic devices Index: src/sys/external/bsd/drm2/dist/drm/drm_modes.c diff -u src/sys/external/bsd/drm2/dist/drm/drm_modes.c:1.8 src/sys/external/bsd/drm2/dist/drm/drm_modes.c:1.9 --- src/sys/external/bsd/drm2/dist/drm/drm_modes.c:1.8 Fri Feb 14 04:38:36 2020 +++ src/sys/external/bsd/drm2/dist/drm/drm_modes.c Wed Mar 10 07:23:42 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: drm_modes.c,v 1.8 2020/02/14 04:38:36 riastradh Exp $ */ +/* $NetBSD: drm_modes.c,v 1.9 2021/03/10 07:23:42 wiz Exp $ */ /* * Copyright © 1997-2003 by The XFree86 Project, Inc. @@ -33,7 +33,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: drm_modes.c,v 1.8 2020/02/14 04:38:36 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: drm_modes.c,v 1.9 2021/03/10 07:23:42 wiz Exp $"); #include #include @@ -1019,9 +1019,19 @@ drm_mode_validate_size(const struct drm_ if (maxX > 0 && mode->hdisplay > maxX) return MODE_VIRTUAL_X; +#if defined(DRM_MAX_RESOLUTION_HORIZONTAL) + if (mode->hdisplay > DRM_MAX_RESOLUTION_HORIZONTAL) + return MODE_VIRTUAL_X; +#endif + if (maxY > 0 && mode->vdisplay > maxY) return MODE_VIRTUAL_Y; +#if defined(DRM_MAX_RESOLUTION_VERTICAL) + if (mode->vdisplay > DRM_MAX_RESOLUTION_VERTICAL) + return MODE_VIRTUAL_Y; +#endif + return MODE_OK; } EXPORT_SYMBOL(drm_mode_validate_size);
CVS commit: src
Module Name:src Committed By: wiz Date: Wed Mar 10 07:23:42 UTC 2021 Modified Files: src/share/man/man4: drm.4 src/sys/arch/amd64/conf: GENERIC src/sys/external/bsd/drm2/dist/drm: drm_modes.c Log Message: drm(4): allow limiting maximum X/Y resolution With some drivers (at least radeon(4)), in some cases the driver does not choose the resolution correctly. The options DRM_MAX_RESOLUTION_HORIZONTAL and DRM_MAX_RESOLUTION_VERTICAL allow limiting the maximum resolution in X and Y direction. To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/share/man/man4/drm.4 cvs rdiff -u -r1.587 -r1.588 src/sys/arch/amd64/conf/GENERIC cvs rdiff -u -r1.8 -r1.9 src/sys/external/bsd/drm2/dist/drm/drm_modes.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch
Module Name:src Committed By: msaitoh Date: Wed Mar 10 06:38:44 UTC 2021 Modified Files: src/sys/arch/amd64/conf: GENERIC src/sys/arch/i386/conf: GENERIC Log Message: Add micphy(4). To generate a diff of this commit: cvs rdiff -u -r1.586 -r1.587 src/sys/arch/amd64/conf/GENERIC cvs rdiff -u -r1.1235 -r1.1236 src/sys/arch/i386/conf/GENERIC 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/conf/GENERIC diff -u src/sys/arch/amd64/conf/GENERIC:1.586 src/sys/arch/amd64/conf/GENERIC:1.587 --- src/sys/arch/amd64/conf/GENERIC:1.586 Fri Mar 5 20:18:39 2021 +++ src/sys/arch/amd64/conf/GENERIC Wed Mar 10 06:38:44 2021 @@ -1,4 +1,4 @@ -# $NetBSD: GENERIC,v 1.586 2021/03/05 20:18:39 gdt Exp $ +# $NetBSD: GENERIC,v 1.587 2021/03/10 06:38:44 msaitoh Exp $ # # GENERIC machine description file # @@ -22,7 +22,7 @@ include "arch/amd64/conf/std.amd64" options INCLUDE_CONFIG_FILE # embed config file in kernel binary -#ident "GENERIC-$Revision: 1.586 $" +#ident "GENERIC-$Revision: 1.587 $" maxusers 64 # estimated number of users @@ -911,6 +911,7 @@ ipgphy* at mii? phy ? # IC PLUS IP1000 jmphy* at mii? phy ? # Jmicron JMP202/211 PHYs lxtphy* at mii? phy ? # Level One LXT-970 PHYs makphy* at mii? phy ? # Marvell Semiconductor 88E1000 PHYs +micphy* at mii? phy ? # Micrel KSZ[89]xxx PHYs nsphy* at mii? phy ? # NS83840 PHYs nsphyter* at mii? phy ? # NS83843 PHYs pnaphy* at mii? phy ? # generic HomePNA PHYs Index: src/sys/arch/i386/conf/GENERIC diff -u src/sys/arch/i386/conf/GENERIC:1.1235 src/sys/arch/i386/conf/GENERIC:1.1236 --- src/sys/arch/i386/conf/GENERIC:1.1235 Mon Mar 1 18:12:58 2021 +++ src/sys/arch/i386/conf/GENERIC Wed Mar 10 06:38:44 2021 @@ -1,4 +1,4 @@ -# $NetBSD: GENERIC,v 1.1235 2021/03/01 18:12:58 jakllsch Exp $ +# $NetBSD: GENERIC,v 1.1236 2021/03/10 06:38:44 msaitoh Exp $ # # GENERIC machine description file # @@ -22,7 +22,7 @@ include "arch/i386/conf/std.i386" options INCLUDE_CONFIG_FILE # embed config file in kernel binary -#ident "GENERIC-$Revision: 1.1235 $" +#ident "GENERIC-$Revision: 1.1236 $" maxusers 64 # estimated number of users @@ -1126,6 +1126,7 @@ ipgphy* at mii? phy ? # IC PLUS IP1000 jmphy* at mii? phy ? # Jmicron JMP202/211 PHYs lxtphy* at mii? phy ? # Level One LXT-970 PHYs makphy* at mii? phy ? # Marvell Semiconductor 88E1000 PHYs +micphy* at mii? phy ? # Micrel KSZ[89]xxx PHYs nsphy* at mii? phy ? # NS83840 PHYs nsphyter* at mii? phy ? # NS83843 PHYs pnaphy* at mii? phy ? # generic HomePNA PHYs
CVS commit: src/sys/arch
Module Name:src Committed By: msaitoh Date: Wed Mar 10 06:38:44 UTC 2021 Modified Files: src/sys/arch/amd64/conf: GENERIC src/sys/arch/i386/conf: GENERIC Log Message: Add micphy(4). To generate a diff of this commit: cvs rdiff -u -r1.586 -r1.587 src/sys/arch/amd64/conf/GENERIC cvs rdiff -u -r1.1235 -r1.1236 src/sys/arch/i386/conf/GENERIC Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/netstat
Module Name:src Committed By: simonb Date: Wed Mar 10 00:32:16 UTC 2021 Modified Files: src/usr.bin/netstat: main.c Log Message: Remove Network ATM soft intr queue reporting, we don't have that in the kernel anymore. To generate a diff of this commit: cvs rdiff -u -r1.100 -r1.101 src/usr.bin/netstat/main.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/netstat
Module Name:src Committed By: simonb Date: Wed Mar 10 00:32:16 UTC 2021 Modified Files: src/usr.bin/netstat: main.c Log Message: Remove Network ATM soft intr queue reporting, we don't have that in the kernel anymore. To generate a diff of this commit: cvs rdiff -u -r1.100 -r1.101 src/usr.bin/netstat/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/netstat/main.c diff -u src/usr.bin/netstat/main.c:1.100 src/usr.bin/netstat/main.c:1.101 --- src/usr.bin/netstat/main.c:1.100 Thu Apr 23 00:24:50 2020 +++ src/usr.bin/netstat/main.c Wed Mar 10 00:32:15 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.100 2020/04/23 00:24:50 joerg Exp $ */ +/* $NetBSD: main.c,v 1.101 2021/03/10 00:32:15 simonb Exp $ */ /* * Copyright (c) 1983, 1988, 1993 @@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 19 #if 0 static char sccsid[] = "from: @(#)main.c 8.4 (Berkeley) 3/1/94"; #else -__RCSID("$NetBSD: main.c,v 1.100 2020/04/23 00:24:50 joerg Exp $"); +__RCSID("$NetBSD: main.c,v 1.101 2021/03/10 00:32:15 simonb Exp $"); #endif #endif /* not lint */ @@ -182,19 +182,17 @@ struct nlist nl[] = { { "_atintrq1", 0, 0, 0, 0 }, #define N_ATINTRQ2 40 { "_atintrq2", 0, 0, 0, 0 }, -#define N_NATMINTRQ 41 - { "_natmintrq", 0, 0, 0, 0 }, -#define N_PPPOEDISCINQ 42 +#define N_PPPOEDISCINQ 41 { "_ppoediscinq", 0, 0, 0, 0 }, -#define N_PPPOEINQ 43 +#define N_PPPOEINQ 42 { "_ppoeinq", 0, 0, 0, 0 }, -#define N_HARDCLOCK_TICKS 44 +#define N_HARDCLOCK_TICKS 43 { "_hardclock_ticks", 0, 0, 0, 0 }, -#define N_PIMSTAT 45 +#define N_PIMSTAT 44 { "_pimstat", 0, 0, 0, 0 }, -#define N_CARPSTAT 46 +#define N_CARPSTAT 45 { "_carpstats", 0, 0, 0, 0 }, /* not available via kvm */ -#define N_PFSYNCSTAT 47 +#define N_PFSYNCSTAT 46 { "_pfsyncstats", 0, 0, 0, 0}, /* not available via kvm */ { "", 0, 0, 0, 0 }, }; @@ -310,7 +308,6 @@ const struct softintrq { { "arpintrq", N_ARPINTRQ }, { "atintrq1", N_ATINTRQ1 }, { "atintrq2", N_ATINTRQ2 }, - { "natmintrq", N_NATMINTRQ }, { "ppoediscinq", N_PPPOEDISCINQ }, { "ppoeinq", N_PPPOEINQ }, { NULL, -1 },
CVS commit: src
Module Name:src Committed By: rillig Date: Wed Mar 10 00:02:00 UTC 2021 Modified Files: src/tests/usr.bin/xlint/lint1: msg_130.c msg_130.exp src/usr.bin/xlint/lint1: func.c Log Message: lint: disable check for enum type mismatch in switch statement This check has been too quick and broke the lint build. Among others, lib/libpuffs has -w included in LINTFLAGS, which means that the build can fail even for new warnings, not only for errors. libpuffs compares a uint16_t with constants from an unnamed enum type. Since the enum type is completely unnamed (neither a tag nor a typedef), there is no way to define a struct member having this type. This was a scenario that I just didn't consider when I added the check to lint. For now, disable the new check completely. The previously existing lint checks stay enabled, including the one that warns about mismatched anonymous enum types in the '==' operator, which is very similar to the now disabled check. To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/tests/usr.bin/xlint/lint1/msg_130.c cvs rdiff -u -r1.8 -r1.9 src/tests/usr.bin/xlint/lint1/msg_130.exp cvs rdiff -u -r1.75 -r1.76 src/usr.bin/xlint/lint1/func.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src
Module Name:src Committed By: rillig Date: Wed Mar 10 00:02:00 UTC 2021 Modified Files: src/tests/usr.bin/xlint/lint1: msg_130.c msg_130.exp src/usr.bin/xlint/lint1: func.c Log Message: lint: disable check for enum type mismatch in switch statement This check has been too quick and broke the lint build. Among others, lib/libpuffs has -w included in LINTFLAGS, which means that the build can fail even for new warnings, not only for errors. libpuffs compares a uint16_t with constants from an unnamed enum type. Since the enum type is completely unnamed (neither a tag nor a typedef), there is no way to define a struct member having this type. This was a scenario that I just didn't consider when I added the check to lint. For now, disable the new check completely. The previously existing lint checks stay enabled, including the one that warns about mismatched anonymous enum types in the '==' operator, which is very similar to the now disabled check. To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/tests/usr.bin/xlint/lint1/msg_130.c cvs rdiff -u -r1.8 -r1.9 src/tests/usr.bin/xlint/lint1/msg_130.exp cvs rdiff -u -r1.75 -r1.76 src/usr.bin/xlint/lint1/func.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/usr.bin/xlint/lint1/msg_130.c diff -u src/tests/usr.bin/xlint/lint1/msg_130.c:1.10 src/tests/usr.bin/xlint/lint1/msg_130.c:1.11 --- src/tests/usr.bin/xlint/lint1/msg_130.c:1.10 Tue Mar 9 23:40:43 2021 +++ src/tests/usr.bin/xlint/lint1/msg_130.c Wed Mar 10 00:02:00 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: msg_130.c,v 1.10 2021/03/09 23:40:43 rillig Exp $ */ +/* $NetBSD: msg_130.c,v 1.11 2021/03/10 00:02:00 rillig Exp $ */ # 3 "msg_130.c" // Test for message: enum type mismatch: '%s' '%s' '%s' [130] @@ -44,9 +44,9 @@ void switch_example(enum color c) { switch (c) { - case EVENING: /* expect: 130 */ - case LARGE: /* expect: 130 */ - case 0:/* expect: 130 */ + case EVENING: /* maybe someday expect: 130 */ + case LARGE: /* maybe someday expect: 130 */ + case 0:/* maybe someday expect: 130 */ sink(1 == 1); break; default: @@ -71,10 +71,11 @@ enum { int enum_constant_from_unnamed_type(int x) { + /* using an enum constant as constant-expression */ switch (x) { - case sizeof_int: /* expect: 130 *//* FIXME */ + case sizeof_int: return 1; - case sizeof_long: /* expect: 130 *//* FIXME */ + case sizeof_long: return 2; default: break; Index: src/tests/usr.bin/xlint/lint1/msg_130.exp diff -u src/tests/usr.bin/xlint/lint1/msg_130.exp:1.8 src/tests/usr.bin/xlint/lint1/msg_130.exp:1.9 --- src/tests/usr.bin/xlint/lint1/msg_130.exp:1.8 Tue Mar 9 23:40:43 2021 +++ src/tests/usr.bin/xlint/lint1/msg_130.exp Wed Mar 10 00:02:00 2021 @@ -1,10 +1,5 @@ msg_130.c(29): warning: enum type mismatch: 'enum color' ':' 'enum daytime' [130] msg_130.c(31): warning: enum type mismatch: 'enum color' '!=' 'enum size' [130] msg_130.c(32): warning: enum type mismatch: 'enum color' '==' 'enum size' [130] -msg_130.c(47): warning: enum type mismatch: 'enum color' '==' 'enum daytime' [130] -msg_130.c(48): warning: enum type mismatch: 'enum color' '==' 'enum size' [130] -msg_130.c(49): warning: enum type mismatch: 'enum color' '==' 'int' [130] -msg_130.c(75): warning: enum type mismatch: 'int' '==' 'enum ' [130] -msg_130.c(77): warning: enum type mismatch: 'int' '==' 'enum ' [130] -msg_130.c(88): warning: enum type mismatch: 'enum ' '==' 'enum ' [130] -msg_130.c(126): warning: enum type mismatch: 'enum ' '==' 'enum ' [130] +msg_130.c(89): warning: enum type mismatch: 'enum ' '==' 'enum ' [130] +msg_130.c(127): warning: enum type mismatch: 'enum ' '==' 'enum ' [130] Index: src/usr.bin/xlint/lint1/func.c diff -u src/usr.bin/xlint/lint1/func.c:1.75 src/usr.bin/xlint/lint1/func.c:1.76 --- src/usr.bin/xlint/lint1/func.c:1.75 Fri Mar 5 17:10:05 2021 +++ src/usr.bin/xlint/lint1/func.c Wed Mar 10 00:02:00 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: func.c,v 1.75 2021/03/05 17:10:05 rillig Exp $ */ +/* $NetBSD: func.c,v 1.76 2021/03/10 00:02:00 rillig Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -37,7 +37,7 @@ #include #if defined(__RCSID) && !defined(lint) -__RCSID("$NetBSD: func.c,v 1.75 2021/03/05 17:10:05 rillig Exp $"); +__RCSID("$NetBSD: func.c,v 1.76 2021/03/10 00:02:00 rillig Exp $"); #endif #include @@ -437,9 +437,11 @@ check_case_label_enum(const tnode_t *tn, tn->tn_type->t_enum == ci->c_swtype->t_enum) return; +#if 0 /* not yet ready, see msg_130.c */ /* enum type mismatch: '%s' '%s' '%s' */ warning(130, type_name(ci->c_swtype), getopname(EQ), type_name(tn->tn_type)); +#endif } static void
CVS commit: src/tests/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Tue Mar 9 23:40:43 UTC 2021 Modified Files: src/tests/usr.bin/xlint/lint1: msg_130.c msg_130.exp Log Message: tests/lint: add example for anonymous enum type in switch expression To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/tests/usr.bin/xlint/lint1/msg_130.c cvs rdiff -u -r1.7 -r1.8 src/tests/usr.bin/xlint/lint1/msg_130.exp Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tests/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Tue Mar 9 23:40:43 UTC 2021 Modified Files: src/tests/usr.bin/xlint/lint1: msg_130.c msg_130.exp Log Message: tests/lint: add example for anonymous enum type in switch expression To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/tests/usr.bin/xlint/lint1/msg_130.c cvs rdiff -u -r1.7 -r1.8 src/tests/usr.bin/xlint/lint1/msg_130.exp Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/usr.bin/xlint/lint1/msg_130.c diff -u src/tests/usr.bin/xlint/lint1/msg_130.c:1.9 src/tests/usr.bin/xlint/lint1/msg_130.c:1.10 --- src/tests/usr.bin/xlint/lint1/msg_130.c:1.9 Tue Mar 9 23:09:48 2021 +++ src/tests/usr.bin/xlint/lint1/msg_130.c Tue Mar 9 23:40:43 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: msg_130.c,v 1.9 2021/03/09 23:09:48 rillig Exp $ */ +/* $NetBSD: msg_130.c,v 1.10 2021/03/09 23:40:43 rillig Exp $ */ # 3 "msg_130.c" // Test for message: enum type mismatch: '%s' '%s' '%s' [130] @@ -90,3 +90,39 @@ enum_constant_from_unnamed_type(int x) return 0; } + +/* + * A typical legitimate use case for an anonymous enum type that should not + * be mixed with other types is a state machine. + * + * This example demonstrates that the type of the 'switch' expression can be + * an anonymous enum. + */ +void +state_machine(const char *str) +{ + enum { + begin, + seen_letter, + seen_letter_digit, + error + } state = begin; + + for (const char *p = str; *p != '\0'; p++) { + switch (state) { + case begin: + state = *p == 'A' ? seen_letter : error; + break; + case seen_letter: + state = *p == '1' ? seen_letter_digit : error; + break; + default: + state = error; + } + } + + if (state == 2) /* might be worth a warning */ + return; + if (state == sizeof_int) /* expect: 130 */ + return; +} Index: src/tests/usr.bin/xlint/lint1/msg_130.exp diff -u src/tests/usr.bin/xlint/lint1/msg_130.exp:1.7 src/tests/usr.bin/xlint/lint1/msg_130.exp:1.8 --- src/tests/usr.bin/xlint/lint1/msg_130.exp:1.7 Tue Mar 9 23:09:48 2021 +++ src/tests/usr.bin/xlint/lint1/msg_130.exp Tue Mar 9 23:40:43 2021 @@ -7,3 +7,4 @@ msg_130.c(49): warning: enum type mismat msg_130.c(75): warning: enum type mismatch: 'int' '==' 'enum ' [130] msg_130.c(77): warning: enum type mismatch: 'int' '==' 'enum ' [130] msg_130.c(88): warning: enum type mismatch: 'enum ' '==' 'enum ' [130] +msg_130.c(126): warning: enum type mismatch: 'enum ' '==' 'enum ' [130]
CVS commit: src/tests/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Tue Mar 9 23:09:48 UTC 2021 Modified Files: src/tests/usr.bin/xlint/lint1: msg_130.c msg_130.exp Log Message: tests/lint: add tests for comparison between unnamed enums Since unnamed enum types cannot be used in type casts, there is no sensible way that this type mismatch could be resolved, without changing the definition of the enum type itself, but that may be in a non-modifiable header. Therefore, comparisons with enum constants of unnamed types cannot be sensibly warned about. To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/tests/usr.bin/xlint/lint1/msg_130.c cvs rdiff -u -r1.6 -r1.7 src/tests/usr.bin/xlint/lint1/msg_130.exp Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/usr.bin/xlint/lint1/msg_130.c diff -u src/tests/usr.bin/xlint/lint1/msg_130.c:1.8 src/tests/usr.bin/xlint/lint1/msg_130.c:1.9 --- src/tests/usr.bin/xlint/lint1/msg_130.c:1.8 Fri Mar 5 17:10:06 2021 +++ src/tests/usr.bin/xlint/lint1/msg_130.c Tue Mar 9 23:09:48 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: msg_130.c,v 1.8 2021/03/05 17:10:06 rillig Exp $ */ +/* $NetBSD: msg_130.c,v 1.9 2021/03/09 23:09:48 rillig Exp $ */ # 3 "msg_130.c" // Test for message: enum type mismatch: '%s' '%s' '%s' [130] @@ -53,3 +53,40 @@ switch_example(enum color c) break; } } + +/* + * Unnamed enum types can be used as a container for constants, especially + * since in C90 and C99, even after the declaration 'static const int x = 3', + * 'x' is not a constant expression. + */ +enum { + sizeof_int = sizeof(int), + sizeof_long = sizeof(long) +}; + +enum { + sizeof_uint = sizeof(unsigned int) +}; + +int +enum_constant_from_unnamed_type(int x) +{ + switch (x) { + case sizeof_int: /* expect: 130 *//* FIXME */ + return 1; + case sizeof_long: /* expect: 130 *//* FIXME */ + return 2; + default: + break; + } + + if (x == sizeof_int) + return 4; + if (x > sizeof_int) + return 5; + + if (sizeof_int == sizeof_uint) /* expect: 130 *//* FIXME */ + return 6; + + return 0; +} Index: src/tests/usr.bin/xlint/lint1/msg_130.exp diff -u src/tests/usr.bin/xlint/lint1/msg_130.exp:1.6 src/tests/usr.bin/xlint/lint1/msg_130.exp:1.7 --- src/tests/usr.bin/xlint/lint1/msg_130.exp:1.6 Fri Mar 5 17:10:06 2021 +++ src/tests/usr.bin/xlint/lint1/msg_130.exp Tue Mar 9 23:09:48 2021 @@ -4,3 +4,6 @@ msg_130.c(32): warning: enum type mismat msg_130.c(47): warning: enum type mismatch: 'enum color' '==' 'enum daytime' [130] msg_130.c(48): warning: enum type mismatch: 'enum color' '==' 'enum size' [130] msg_130.c(49): warning: enum type mismatch: 'enum color' '==' 'int' [130] +msg_130.c(75): warning: enum type mismatch: 'int' '==' 'enum ' [130] +msg_130.c(77): warning: enum type mismatch: 'int' '==' 'enum ' [130] +msg_130.c(88): warning: enum type mismatch: 'enum ' '==' 'enum ' [130]
CVS commit: src/tests/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Tue Mar 9 23:09:48 UTC 2021 Modified Files: src/tests/usr.bin/xlint/lint1: msg_130.c msg_130.exp Log Message: tests/lint: add tests for comparison between unnamed enums Since unnamed enum types cannot be used in type casts, there is no sensible way that this type mismatch could be resolved, without changing the definition of the enum type itself, but that may be in a non-modifiable header. Therefore, comparisons with enum constants of unnamed types cannot be sensibly warned about. To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/tests/usr.bin/xlint/lint1/msg_130.c cvs rdiff -u -r1.6 -r1.7 src/tests/usr.bin/xlint/lint1/msg_130.exp Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src
Module Name:src Committed By: rillig Date: Tue Mar 9 20:43:20 UTC 2021 Modified Files: src/distrib/sets/lists/tests: mi src/tests/usr.bin/indent: Makefile Added Files: src/tests/usr.bin/indent: indent_variables.0 indent_variables.0.pro indent_variables.0.stdout Log Message: tests/indent: demonstrate strange alignment for global variables To generate a diff of this commit: cvs rdiff -u -r1.1029 -r1.1030 src/distrib/sets/lists/tests/mi cvs rdiff -u -r1.6 -r1.7 src/tests/usr.bin/indent/Makefile cvs rdiff -u -r0 -r1.1 src/tests/usr.bin/indent/indent_variables.0 \ src/tests/usr.bin/indent/indent_variables.0.pro \ src/tests/usr.bin/indent/indent_variables.0.stdout 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.1029 src/distrib/sets/lists/tests/mi:1.1030 --- src/distrib/sets/lists/tests/mi:1.1029 Mon Mar 8 22:13:05 2021 +++ src/distrib/sets/lists/tests/mi Tue Mar 9 20:43:19 2021 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.1029 2021/03/08 22:13:05 rillig Exp $ +# $NetBSD: mi,v 1.1030 2021/03/09 20:43:19 rillig Exp $ # # Note: don't delete entries from here - mark them as "obsolete" instead. # @@ -4727,6 +4727,9 @@ ./usr/tests/usr.bin/indent/f_decls.0.stdout tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/indent/float.0 tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/indent/float.0.stdout tests-usr.bin-tests compattestfile,atf +./usr/tests/usr.bin/indent/indent_variables.0 tests-usr.bin-tests compattestfile,atf +./usr/tests/usr.bin/indent/indent_variables.0.pro tests-usr.bin-tests compattestfile,atf +./usr/tests/usr.bin/indent/indent_variables.0.stdout tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/indent/label.0 tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/indent/label.0.pro tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/indent/label.0.stdout tests-usr.bin-tests compattestfile,atf Index: src/tests/usr.bin/indent/Makefile diff -u src/tests/usr.bin/indent/Makefile:1.6 src/tests/usr.bin/indent/Makefile:1.7 --- src/tests/usr.bin/indent/Makefile:1.6 Mon Mar 8 22:13:05 2021 +++ src/tests/usr.bin/indent/Makefile Tue Mar 9 20:43:20 2021 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.6 2021/03/08 22:13:05 rillig Exp $ +# $NetBSD: Makefile,v 1.7 2021/03/09 20:43:20 rillig Exp $ .include @@ -24,6 +24,9 @@ FILES+= f_decls.0 FILES+= f_decls.0.stdout FILES+= float.0 FILES+= float.0.stdout +FILES+= indent_variables.0 +FILES+= indent_variables.0.pro +FILES+= indent_variables.0.stdout FILES+= label.0 FILES+= label.0.stdout FILES+= label.0.pro @@ -269,4 +272,63 @@ FILES+= types_from_file.0.pro FILES+= wchar.0 FILES+= wchar.0.stdout +add-test: .PHONY + @set -eu; \ + test=${NAME:Q}; \ + [ "$$test" ] || { \ + echo "usage: ${MAKE} add-test NAME="; \ + exit; \ + }; \ + \ + if [ -f "$$test" ]; then \ + echo "error: test $$test already exists." 1>&2; \ + exit 1; \ + fi; \ + \ + echo "=> Adding test $$test"; \ + printf '%s\n' \ + '/* $$''NetBSD$$ */' \ + '/* $$''FreeBSD$$ */' \ + '' \ + '/*' \ + ' * TODO: Explain the purpose of the test.' \ + '*/' \ + '' \ + '// TODO: Add some code that passes.' \ + > "$$test"; \ + printf '%s\n' \ + '/* $$''NetBSD$$ */' \ + '/* $$''FreeBSD$$ */' \ + '' \ + '/*' \ + ' * TODO: Explain the command line options of the test.' \ + ' */' \ + '' \ + '/* TODO: Add some command line options */' \ + > "$$test.pro"; \ + cat < "$$test" > "$$test.stdout"; \ + cvs add "$$test" "$$test.pro" "$$test.stdout"; \ + printf '%s\n' \ + '/^FILES+=/i' \ + "FILES+= $$test" \ + "FILES+= $$test.pro" \ + "FILES+= $$test.stdout" \ + '.' 'w' 'q' \ + | ed Makefile; \ + ${MAKE} sync-mi + +# Note: only works for adding tests. +# To remove a test, the $$mi file must be edited manually. +sync-mi: .PHONY + @set -eu; \ + cd "${MAKEFILE:tA:H}/../../.."; \ + mi="distrib/sets/lists/tests/mi";\ + cvs update "$$mi"; \ + fmt="./usr/tests/usr.bin/indent/%s\ttests-usr.bin-tests\tcompattestfile,atf\n"; \ + cat "$$mi" > "$$mi.tmp"; \ + printf "$$fmt" ${FILES:M${NAME}*} >> "$$mi.tmp"; \ + distrib/sets/fmt-list "$$mi.tmp";\ + mv "$$mi.tmp" "$$mi"; \ + cvs diff "$$mi" || true + .include Added files: Index: src/tests/usr.bin/indent/indent_variables.0 diff -u /dev/null src/tests/usr.bin/indent/indent_variables.0:1.1 --- /dev/null Tue Mar 9 20:43:20 2021 +++ src/tests/usr.bin/indent/indent_variables.0 Tue Mar 9 20:43:20 2021 @@ -0,0 +1,22 @@ +/* $NetBSD: indent_variables.0,v 1.1 2021/03/09 20:43:20 rillig Exp $ */ +/* $FreeBSD$ */ + +/*- + * Demonstrate how variable declarations are broken into several lines when + * the line length limit is set quite low. + */ + +struct s0 a,b; +struct s01 a,b; +struct s012 a,b; +struct s0123 a,b; +struct s01234 a,b; +struct s012345 a,b;
CVS commit: src
Module Name:src Committed By: rillig Date: Tue Mar 9 20:43:20 UTC 2021 Modified Files: src/distrib/sets/lists/tests: mi src/tests/usr.bin/indent: Makefile Added Files: src/tests/usr.bin/indent: indent_variables.0 indent_variables.0.pro indent_variables.0.stdout Log Message: tests/indent: demonstrate strange alignment for global variables To generate a diff of this commit: cvs rdiff -u -r1.1029 -r1.1030 src/distrib/sets/lists/tests/mi cvs rdiff -u -r1.6 -r1.7 src/tests/usr.bin/indent/Makefile cvs rdiff -u -r0 -r1.1 src/tests/usr.bin/indent/indent_variables.0 \ src/tests/usr.bin/indent/indent_variables.0.pro \ src/tests/usr.bin/indent/indent_variables.0.stdout Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/indent
Module Name:src Committed By: rillig Date: Tue Mar 9 19:46:28 UTC 2021 Modified Files: src/usr.bin/indent: indent.c Log Message: indent: extract search_brace from main No functional change. To generate a diff of this commit: cvs rdiff -u -r1.40 -r1.41 src/usr.bin/indent/indent.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/indent/indent.c diff -u src/usr.bin/indent/indent.c:1.40 src/usr.bin/indent/indent.c:1.41 --- src/usr.bin/indent/indent.c:1.40 Tue Mar 9 19:32:41 2021 +++ src/usr.bin/indent/indent.c Tue Mar 9 19:46:28 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: indent.c,v 1.40 2021/03/09 19:32:41 rillig Exp $ */ +/* $NetBSD: indent.c,v 1.41 2021/03/09 19:46:28 rillig Exp $ */ /*- * SPDX-License-Identifier: BSD-4-Clause @@ -46,7 +46,7 @@ static char sccsid[] = "@(#)indent.c 5.1 #include #ifndef lint #if defined(__NetBSD__) -__RCSID("$NetBSD: indent.c,v 1.40 2021/03/09 19:32:41 rillig Exp $"); +__RCSID("$NetBSD: indent.c,v 1.41 2021/03/09 19:46:28 rillig Exp $"); #elif defined(__FreeBSD__) __FBSDID("$FreeBSD: head/usr.bin/indent/indent.c 340138 2018-11-04 19:24:49Z oshogbo $"); #endif @@ -179,9 +179,191 @@ init_capsicum(void) if (caph_enter() < 0) err(EXIT_FAILURE, "unable to enter capability mode"); } - #endif +static void +search_brace(token_type *inout_type_code, int *inout_force_nl, + int *inout_comment_buffered, int *inout_last_else) +{ +while (ps.search_brace) { + switch (*inout_type_code) { + case newline: + if (sc_end == NULL) { + save_com = sc_buf; + save_com[0] = save_com[1] = ' '; + sc_end = _com[2]; + } + *sc_end++ = '\n'; + /* + * We may have inherited a force_nl == true from the previous + * token (like a semicolon). But once we know that a newline + * has been scanned in this loop, force_nl should be false. + * + * However, the force_nl == true must be preserved if newline + * is never scanned in this loop, so this assignment cannot be + * done earlier. + */ + *inout_force_nl = false; + case form_feed: + break; + case comment: + if (sc_end == NULL) { + /* + * Copy everything from the start of the line, because + * pr_comment() will use that to calculate original + * indentation of a boxed comment. + */ + memcpy(sc_buf, in_buffer, buf_ptr - in_buffer - 4); + save_com = sc_buf + (buf_ptr - in_buffer - 4); + save_com[0] = save_com[1] = ' '; + sc_end = _com[2]; + } + *inout_comment_buffered = true; + *sc_end++ = '/'; /* copy in start of comment */ + *sc_end++ = '*'; + for (;;) { /* loop until the end of the comment */ + *sc_end = *buf_ptr++; + if (buf_ptr >= buf_end) + fill_buffer(); + if (*sc_end++ == '*' && *buf_ptr == '/') + break; /* we are at end of comment */ + if (sc_end >= _com[sc_size]) { /* check for temp buffer + * overflow */ + diag(1, "Internal buffer overflow - Move big comment from right after if, while, or whatever"); + fflush(output); + exit(1); + } + } + *sc_end++ = '/'; /* add ending slash */ + if (++buf_ptr >= buf_end) /* get past / in buffer */ + fill_buffer(); + break; + case lbrace: + /* + * Put KNF-style lbraces before the buffered up tokens and + * jump out of this loop in order to avoid copying the token + * again under the default case of the switch below. + */ + if (sc_end != NULL && opt.btype_2) { + save_com[0] = '{'; + /* + * Originally the lbrace may have been alone on its own + * line, but it will be moved into "the else's line", so + * if there was a newline resulting from the "{" before, + * it must be scanned now and ignored. + */ + while (isspace((unsigned char)*buf_ptr)) { + if (++buf_ptr >= buf_end) + fill_buffer(); + if (*buf_ptr == '\n') + break; + } + goto sw_buffer; + } + /* FALLTHROUGH */ + default: /* it is the start of a normal statement */ + { + int remove_newlines; + + remove_newlines = + /* "} else" */ + (*inout_type_code == keyword_do_else && *token == 'e' && + e_code != s_code && e_code[-1] == '}') + /* "else if" */ + || (*inout_type_code == keyword_for_if_while && + *token == 'i' && *inout_last_else && opt.else_if); + if (remove_newlines) + *inout_force_nl = false; + if (sc_end == NULL) { /* ignore buffering if + * comment wasn't saved up */ + ps.search_brace = false; + return; + } + while (sc_end > save_com && isblank((unsigned char)sc_end[-1])) { + sc_end--; + } + if (opt.swallow_optional_blanklines || + (!*inout_comment_buffered && remove_newlines)) { + *inout_force_nl = !remove_newlines; + while (sc_end > save_com && sc_end[-1] == '\n') { + sc_end--; + } + } + if (*inout_force_nl) { /* if we should insert a nl here, put + * it into the buffer */ + *inout_force_nl = false; +
CVS commit: src/usr.bin/indent
Module Name:src Committed By: rillig Date: Tue Mar 9 19:46:28 UTC 2021 Modified Files: src/usr.bin/indent: indent.c Log Message: indent: extract search_brace from main No functional change. To generate a diff of this commit: cvs rdiff -u -r1.40 -r1.41 src/usr.bin/indent/indent.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/indent
Module Name:src Committed By: rillig Date: Tue Mar 9 19:32:41 UTC 2021 Modified Files: src/usr.bin/indent: indent.c Log Message: indent: extract capsicum code out of the main function No functional change. To generate a diff of this commit: cvs rdiff -u -r1.39 -r1.40 src/usr.bin/indent/indent.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/indent
Module Name:src Committed By: rillig Date: Tue Mar 9 19:32:41 UTC 2021 Modified Files: src/usr.bin/indent: indent.c Log Message: indent: extract capsicum code out of the main function No functional change. To generate a diff of this commit: cvs rdiff -u -r1.39 -r1.40 src/usr.bin/indent/indent.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/indent/indent.c diff -u src/usr.bin/indent/indent.c:1.39 src/usr.bin/indent/indent.c:1.40 --- src/usr.bin/indent/indent.c:1.39 Tue Mar 9 19:23:08 2021 +++ src/usr.bin/indent/indent.c Tue Mar 9 19:32:41 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: indent.c,v 1.39 2021/03/09 19:23:08 rillig Exp $ */ +/* $NetBSD: indent.c,v 1.40 2021/03/09 19:32:41 rillig Exp $ */ /*- * SPDX-License-Identifier: BSD-4-Clause @@ -46,7 +46,7 @@ static char sccsid[] = "@(#)indent.c 5.1 #include #ifndef lint #if defined(__NetBSD__) -__RCSID("$NetBSD: indent.c,v 1.39 2021/03/09 19:23:08 rillig Exp $"); +__RCSID("$NetBSD: indent.c,v 1.40 2021/03/09 19:32:41 rillig Exp $"); #elif defined(__FreeBSD__) __FBSDID("$FreeBSD: head/usr.bin/indent/indent.c 340138 2018-11-04 19:24:49Z oshogbo $"); #endif @@ -163,13 +163,28 @@ check_size_label(size_t desired_size) } } -int -main(int argc, char **argv) -{ #if HAVE_CAPSICUM +static void +init_capsicum(void) +{ cap_rights_t rights; + +/* Restrict input/output descriptors and enter Capsicum sandbox. */ +cap_rights_init(, CAP_FSTAT, CAP_WRITE); +if (caph_rights_limit(fileno(output), ) < 0) + err(EXIT_FAILURE, "unable to limit rights for %s", out_name); +cap_rights_init(, CAP_FSTAT, CAP_READ); +if (caph_rights_limit(fileno(input), ) < 0) + err(EXIT_FAILURE, "unable to limit rights for %s", in_name); +if (caph_enter() < 0) + err(EXIT_FAILURE, "unable to enter capability mode"); +} + #endif +int +main(int argc, char **argv) +{ int dec_ind; /* current indentation for declarations */ int di_stack[20]; /* a stack of structure indentation levels */ int force_nl; /* when true, code must be broken */ @@ -339,15 +354,7 @@ main(int argc, char **argv) } #if HAVE_CAPSICUM -/* Restrict input/output descriptors and enter Capsicum sandbox. */ -cap_rights_init(, CAP_FSTAT, CAP_WRITE); -if (caph_rights_limit(fileno(output), ) < 0) - err(EXIT_FAILURE, "unable to limit rights for %s", out_name); -cap_rights_init(, CAP_FSTAT, CAP_READ); -if (caph_rights_limit(fileno(input), ) < 0) - err(EXIT_FAILURE, "unable to limit rights for %s", in_name); -if (caph_enter() < 0) - err(EXIT_FAILURE, "unable to enter capability mode"); +init_capsicum(); #endif if (opt.com_ind <= 1)
CVS commit: src/usr.bin/indent
Module Name:src Committed By: rillig Date: Tue Mar 9 19:23:08 UTC 2021 Modified Files: src/usr.bin/indent: indent.c indent_codes.h lexi.c Log Message: indent: rename a few more token types The previous names were either too short or ambiguous. No functional change. To generate a diff of this commit: cvs rdiff -u -r1.38 -r1.39 src/usr.bin/indent/indent.c cvs rdiff -u -r1.10 -r1.11 src/usr.bin/indent/indent_codes.h cvs rdiff -u -r1.30 -r1.31 src/usr.bin/indent/lexi.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/indent/indent.c diff -u src/usr.bin/indent/indent.c:1.38 src/usr.bin/indent/indent.c:1.39 --- src/usr.bin/indent/indent.c:1.38 Tue Mar 9 19:14:39 2021 +++ src/usr.bin/indent/indent.c Tue Mar 9 19:23:08 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: indent.c,v 1.38 2021/03/09 19:14:39 rillig Exp $ */ +/* $NetBSD: indent.c,v 1.39 2021/03/09 19:23:08 rillig Exp $ */ /*- * SPDX-License-Identifier: BSD-4-Clause @@ -46,7 +46,7 @@ static char sccsid[] = "@(#)indent.c 5.1 #include #ifndef lint #if defined(__NetBSD__) -__RCSID("$NetBSD: indent.c,v 1.38 2021/03/09 19:14:39 rillig Exp $"); +__RCSID("$NetBSD: indent.c,v 1.39 2021/03/09 19:23:08 rillig Exp $"); #elif defined(__FreeBSD__) __FBSDID("$FreeBSD: head/usr.bin/indent/indent.c 340138 2018-11-04 19:24:49Z oshogbo $"); #endif @@ -595,7 +595,7 @@ check_type: if ( (type_code != comment) && (type_code != newline) && - (type_code != preesc) && + (type_code != preprocessing) && (type_code != form_feed)) { if (force_nl && (type_code != semicolon) && @@ -770,7 +770,7 @@ check_type: ps.want_blank = true; break; - case postop: /* got a trailing ++ or -- */ + case postfix_op: /* got a trailing ++ or -- */ *e_code++ = token[0]; *e_code++ = token[1]; ps.want_blank = true; @@ -1032,11 +1032,11 @@ check_type: goto copy_id; /* move the token into line */ case type_def: - case storage: + case storage_class: prefix_blankline_requested = 0; goto copy_id; - case structure: + case keyword_struct_union_enum: if (ps.p_l_follow > 0) goto copy_id; /* FALLTHROUGH */ @@ -1114,7 +1114,7 @@ check_type: ps.want_blank = true; break; - case strpfx: + case string_prefix: { int len = e_token - s_token; @@ -1154,7 +1154,7 @@ check_type: } break; - case preesc: /* got the character '#' */ + case preprocessing: /* '#' */ if ((s_com != e_com) || (s_lab != e_lab) || (s_code != e_code)) @@ -1308,7 +1308,9 @@ check_type: } /* end of big switch stmt */ *e_code = '\0'; /* make sure code section is null terminated */ - if (type_code != comment && type_code != newline && type_code != preesc) + if (type_code != comment && + type_code != newline && + type_code != preprocessing) ps.last_token = type_code; }/* end of main while (1) loop */ } Index: src/usr.bin/indent/indent_codes.h diff -u src/usr.bin/indent/indent_codes.h:1.10 src/usr.bin/indent/indent_codes.h:1.11 --- src/usr.bin/indent/indent_codes.h:1.10 Tue Mar 9 19:14:39 2021 +++ src/usr.bin/indent/indent_codes.h Tue Mar 9 19:23:08 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: indent_codes.h,v 1.10 2021/03/09 19:14:39 rillig Exp $ */ +/* $NetBSD: indent_codes.h,v 1.11 2021/03/09 19:23:08 rillig Exp $ */ /*- * SPDX-License-Identifier: BSD-4-Clause @@ -47,7 +47,7 @@ typedef enum token_type { rparen, /* ')' or ']' */ unary_op, /* e.g. '+' or '&' */ binary_op, /* e.g. '<<' or '+' or '&&' or '/=' */ -postop, /* trailing '++' or '--' */ +postfix_op, /* trailing '++' or '--' */ question, /* the '?' from a '?:' expression */ case_label, colon, @@ -58,7 +58,7 @@ typedef enum token_type { comma, comment, switch_expr, /* 'switch' '(' ')' */ -preesc, +preprocessing, /* '#' */ form_feed, decl, keyword_for_if_while, /* 'for', 'if' or 'while' */ @@ -74,9 +74,9 @@ typedef enum token_type { if_expr_stmt, /* 'if' '(' ')' */ if_expr_stmt_else, /* 'if' '(' ')' 'else' */ period, -strpfx, -storage, +string_prefix, /* 'L' */ +storage_class, funcname, type_def, -structure +keyword_struct_union_enum } token_type; Index: src/usr.bin/indent/lexi.c diff -u src/usr.bin/indent/lexi.c:1.30 src/usr.bin/indent/lexi.c:1.31 --- src/usr.bin/indent/lexi.c:1.30 Tue Mar 9 19:14:39 2021 +++ src/usr.bin/indent/lexi.c Tue Mar 9 19:23:08 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: lexi.c,v 1.30 2021/03/09 19:14:39 rillig Exp $ */ +/* $NetBSD: lexi.c,v 1.31 2021/03/09 19:23:08 rillig Exp $ */ /*- * SPDX-License-Identifier: BSD-4-Clause @@ -46,7 +46,7 @@ static char sccsid[] = "@(#)lexi.c 8.1 ( #include #ifndef lint #if defined(__NetBSD__) -__RCSID("$NetBSD: lexi.c,v 1.30 2021/03/09 19:14:39 rillig Exp $"); +__RCSID("$NetBSD:
CVS commit: src/usr.bin/indent
Module Name:src Committed By: rillig Date: Tue Mar 9 19:23:08 UTC 2021 Modified Files: src/usr.bin/indent: indent.c indent_codes.h lexi.c Log Message: indent: rename a few more token types The previous names were either too short or ambiguous. No functional change. To generate a diff of this commit: cvs rdiff -u -r1.38 -r1.39 src/usr.bin/indent/indent.c cvs rdiff -u -r1.10 -r1.11 src/usr.bin/indent/indent_codes.h cvs rdiff -u -r1.30 -r1.31 src/usr.bin/indent/lexi.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/indent
Module Name:src Committed By: rillig Date: Tue Mar 9 19:14:39 UTC 2021 Modified Files: src/usr.bin/indent: indent.c indent_codes.h lexi.c parse.c Log Message: indent: make token names more precise The previous 'casestmt' was wrong since a case label is not a statement at all. The previous 'swstmt' was overly short, and wrong as well, since it represents only the 'switch (expr)' part, which is not a complete switch statement. Same for 'ifstmt', 'whilestmt', 'forstmt'. The previous word 'head' was not precise enough since it didn't specify exactly where the head ends and the body starts. Especially for handling the dangling else, this distinction is important. No functional change. To generate a diff of this commit: cvs rdiff -u -r1.37 -r1.38 src/usr.bin/indent/indent.c cvs rdiff -u -r1.9 -r1.10 src/usr.bin/indent/indent_codes.h cvs rdiff -u -r1.29 -r1.30 src/usr.bin/indent/lexi.c cvs rdiff -u -r1.16 -r1.17 src/usr.bin/indent/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/indent/indent.c diff -u src/usr.bin/indent/indent.c:1.37 src/usr.bin/indent/indent.c:1.38 --- src/usr.bin/indent/indent.c:1.37 Tue Mar 9 18:28:10 2021 +++ src/usr.bin/indent/indent.c Tue Mar 9 19:14:39 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: indent.c,v 1.37 2021/03/09 18:28:10 rillig Exp $ */ +/* $NetBSD: indent.c,v 1.38 2021/03/09 19:14:39 rillig Exp $ */ /*- * SPDX-License-Identifier: BSD-4-Clause @@ -46,7 +46,7 @@ static char sccsid[] = "@(#)indent.c 5.1 #include #ifndef lint #if defined(__NetBSD__) -__RCSID("$NetBSD: indent.c,v 1.37 2021/03/09 18:28:10 rillig Exp $"); +__RCSID("$NetBSD: indent.c,v 1.38 2021/03/09 19:14:39 rillig Exp $"); #elif defined(__FreeBSD__) __FBSDID("$FreeBSD: head/usr.bin/indent/indent.c 340138 2018-11-04 19:24:49Z oshogbo $"); #endif @@ -786,7 +786,7 @@ check_type: ps.want_blank = true; break; - case casestmt: /* got word 'case' or 'default' */ + case case_label: /* got word 'case' or 'default' */ scase = true; /* so we can process the later colon properly */ goto copy_id; @@ -853,7 +853,7 @@ check_type: * structure declaration, we * arent any more */ - if ((!sp_sw || hd_type != forstmt) && ps.p_l_follow > 0) { + if ((!sp_sw || hd_type != for_exprs) && ps.p_l_follow > 0) { /* * This should be true iff there were unbalanced parens in the @@ -981,23 +981,24 @@ check_type: } prefix_blankline_requested = 0; parse(rbrace); /* let parser know about this */ - ps.search_brace = opt.cuddle_else && ps.p_stack[ps.tos] == ifhead + ps.search_brace = opt.cuddle_else + && ps.p_stack[ps.tos] == if_expr_stmt && ps.il[ps.tos] >= ps.ind_level; if (ps.tos <= 1 && opt.blanklines_after_procs && ps.dec_nest <= 0) postfix_blankline_requested = 1; break; - case swstmt: /* got keyword "switch" */ + case switch_expr: /* got keyword "switch" */ sp_sw = true; - hd_type = swstmt; /* keep this for when we have seen the + hd_type = switch_expr; /* keep this for when we have seen the * expression */ goto copy_id; /* go move the token into buffer */ case keyword_for_if_while: sp_sw = true; /* the interesting stuff is done after the * expression is scanned */ - hd_type = (*token == 'i' ? ifstmt : - (*token == 'w' ? whilestmt : forstmt)); + hd_type = (*token == 'i' ? if_expr : + (*token == 'w' ? while_expr : for_exprs)); /* * remember the type of header for later use by parser @@ -1015,7 +1016,7 @@ check_type: } force_nl = true;/* also, following stuff must go onto new line */ last_else = 1; - parse(elselit); + parse(keyword_else); } else { if (e_code != s_code) { /* make sure this starts a line */ @@ -1026,7 +1027,7 @@ check_type: } force_nl = true;/* also, following stuff must go onto new line */ last_else = 0; - parse(dolit); + parse(keyword_do); } goto copy_id; /* move the token into line */ Index: src/usr.bin/indent/indent_codes.h diff -u src/usr.bin/indent/indent_codes.h:1.9 src/usr.bin/indent/indent_codes.h:1.10 --- src/usr.bin/indent/indent_codes.h:1.9 Tue Mar 9 18:28:10 2021 +++ src/usr.bin/indent/indent_codes.h Tue Mar 9 19:14:39 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: indent_codes.h,v 1.9 2021/03/09 18:28:10 rillig Exp $ */ +/* $NetBSD: indent_codes.h,v 1.10 2021/03/09 19:14:39 rillig Exp $ */ /*- * SPDX-License-Identifier: BSD-4-Clause @@ -49,7 +49,7 @@ typedef enum token_type { binary_op, /* e.g. '<<' or '+' or '&&' or '/=' */ postop, /* trailing '++' or '--' */ question, /* the '?' from a '?:' expression */ -casestmt, +case_label, colon, semicolon, lbrace, @@ -57,22 +57,22 @@ typedef enum token_type { ident, comma, comment, -swstmt, +switch_expr, /* 'switch' '(' ')' */
CVS commit: src/usr.bin/indent
Module Name:src Committed By: rillig Date: Tue Mar 9 19:14:39 UTC 2021 Modified Files: src/usr.bin/indent: indent.c indent_codes.h lexi.c parse.c Log Message: indent: make token names more precise The previous 'casestmt' was wrong since a case label is not a statement at all. The previous 'swstmt' was overly short, and wrong as well, since it represents only the 'switch (expr)' part, which is not a complete switch statement. Same for 'ifstmt', 'whilestmt', 'forstmt'. The previous word 'head' was not precise enough since it didn't specify exactly where the head ends and the body starts. Especially for handling the dangling else, this distinction is important. No functional change. To generate a diff of this commit: cvs rdiff -u -r1.37 -r1.38 src/usr.bin/indent/indent.c cvs rdiff -u -r1.9 -r1.10 src/usr.bin/indent/indent_codes.h cvs rdiff -u -r1.29 -r1.30 src/usr.bin/indent/lexi.c cvs rdiff -u -r1.16 -r1.17 src/usr.bin/indent/parse.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/indent
Module Name:src Committed By: rillig Date: Tue Mar 9 18:28:10 UTC 2021 Modified Files: src/usr.bin/indent: indent.c indent_codes.h lexi.c Log Message: indent: rename a few tokens to be more obvious For casual readers it is not obvious whether the 'sp' meant 'special' or 'space' or something entirely different. To generate a diff of this commit: cvs rdiff -u -r1.36 -r1.37 src/usr.bin/indent/indent.c cvs rdiff -u -r1.8 -r1.9 src/usr.bin/indent/indent_codes.h cvs rdiff -u -r1.28 -r1.29 src/usr.bin/indent/lexi.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/indent
Module Name:src Committed By: rillig Date: Tue Mar 9 18:28:10 UTC 2021 Modified Files: src/usr.bin/indent: indent.c indent_codes.h lexi.c Log Message: indent: rename a few tokens to be more obvious For casual readers it is not obvious whether the 'sp' meant 'special' or 'space' or something entirely different. To generate a diff of this commit: cvs rdiff -u -r1.36 -r1.37 src/usr.bin/indent/indent.c cvs rdiff -u -r1.8 -r1.9 src/usr.bin/indent/indent_codes.h cvs rdiff -u -r1.28 -r1.29 src/usr.bin/indent/lexi.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/indent/indent.c diff -u src/usr.bin/indent/indent.c:1.36 src/usr.bin/indent/indent.c:1.37 --- src/usr.bin/indent/indent.c:1.36 Tue Mar 9 16:48:28 2021 +++ src/usr.bin/indent/indent.c Tue Mar 9 18:28:10 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: indent.c,v 1.36 2021/03/09 16:48:28 rillig Exp $ */ +/* $NetBSD: indent.c,v 1.37 2021/03/09 18:28:10 rillig Exp $ */ /*- * SPDX-License-Identifier: BSD-4-Clause @@ -46,7 +46,7 @@ static char sccsid[] = "@(#)indent.c 5.1 #include #ifndef lint #if defined(__NetBSD__) -__RCSID("$NetBSD: indent.c,v 1.36 2021/03/09 16:48:28 rillig Exp $"); +__RCSID("$NetBSD: indent.c,v 1.37 2021/03/09 18:28:10 rillig Exp $"); #elif defined(__FreeBSD__) __FBSDID("$FreeBSD: head/usr.bin/indent/indent.c 340138 2018-11-04 19:24:49Z oshogbo $"); #endif @@ -481,11 +481,11 @@ main(int argc, char **argv) remove_newlines = /* "} else" */ - (type_code == sp_nparen && *token == 'e' && + (type_code == keyword_do_else && *token == 'e' && e_code != s_code && e_code[-1] == '}') /* "else if" */ - || (type_code == sp_paren && *token == 'i' && - last_else && opt.else_if); + || (type_code == keyword_for_if_while && + *token == 'i' && last_else && opt.else_if); if (remove_newlines) force_nl = false; if (sc_end == NULL) { /* ignore buffering if @@ -993,7 +993,7 @@ check_type: * expression */ goto copy_id; /* go move the token into buffer */ - case sp_paren: /* token is if, while, for */ + case keyword_for_if_while: sp_sw = true; /* the interesting stuff is done after the * expression is scanned */ hd_type = (*token == 'i' ? ifstmt : @@ -1004,7 +1004,7 @@ check_type: */ goto copy_id; /* copy the token into line */ - case sp_nparen: /* got else, do */ + case keyword_do_else: ps.in_stmt = false; if (*token == 'e') { if (e_code != s_code && (!opt.cuddle_else || e_code[-1] != '}')) { Index: src/usr.bin/indent/indent_codes.h diff -u src/usr.bin/indent/indent_codes.h:1.8 src/usr.bin/indent/indent_codes.h:1.9 --- src/usr.bin/indent/indent_codes.h:1.8 Sun Mar 7 20:30:48 2021 +++ src/usr.bin/indent/indent_codes.h Tue Mar 9 18:28:10 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: indent_codes.h,v 1.8 2021/03/07 20:30:48 rillig Exp $ */ +/* $NetBSD: indent_codes.h,v 1.9 2021/03/09 18:28:10 rillig Exp $ */ /*- * SPDX-License-Identifier: BSD-4-Clause @@ -61,8 +61,8 @@ typedef enum token_type { preesc, form_feed, decl, -sp_paren, -sp_nparen, +keyword_for_if_while, +keyword_do_else, ifstmt, whilestmt, forstmt, Index: src/usr.bin/indent/lexi.c diff -u src/usr.bin/indent/lexi.c:1.28 src/usr.bin/indent/lexi.c:1.29 --- src/usr.bin/indent/lexi.c:1.28 Tue Mar 9 16:48:28 2021 +++ src/usr.bin/indent/lexi.c Tue Mar 9 18:28:10 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: lexi.c,v 1.28 2021/03/09 16:48:28 rillig Exp $ */ +/* $NetBSD: lexi.c,v 1.29 2021/03/09 18:28:10 rillig Exp $ */ /*- * SPDX-License-Identifier: BSD-4-Clause @@ -46,7 +46,7 @@ static char sccsid[] = "@(#)lexi.c 8.1 ( #include #ifndef lint #if defined(__NetBSD__) -__RCSID("$NetBSD: lexi.c,v 1.28 2021/03/09 16:48:28 rillig Exp $"); +__RCSID("$NetBSD: lexi.c,v 1.29 2021/03/09 18:28:10 rillig Exp $"); #elif defined(__FreeBSD__) __FBSDID("$FreeBSD: head/usr.bin/indent/lexi.c 337862 2018-08-15 18:19:45Z pstef $"); #endif @@ -207,7 +207,8 @@ token_type_name(token_type tk) "binary_op", "postop", "question", "casestmt", "colon", "semicolon", "lbrace", "rbrace", "ident", "comma", "comment", "swstmt", "preesc", "form_feed", "decl", - "sp_paren", "sp_nparen", "ifstmt", "whilestmt", "forstmt", + "keyword_for_if_while", "keyword_do_else", + "ifstmt", "whilestmt", "forstmt", "stmt", "stmtl", "elselit", "dolit", "dohead", "ifhead", "elsehead", "period", "strpfx", "storage", "funcname", "type_def", "structure" @@ -387,10 +388,10 @@ lexi(struct parser_state *state) return lexi_end(decl); case rw_for_or_if_or_while: - return lexi_end(sp_paren); + return lexi_end(keyword_for_if_while); case rw_do_or_else: - return lexi_end(sp_nparen); + return lexi_end(keyword_do_else); case rw_storage_class: return lexi_end(storage);
CVS commit: src/usr.bin/indent
Module Name:src Committed By: rillig Date: Tue Mar 9 18:21:01 UTC 2021 Modified Files: src/usr.bin/indent: parse.c Log Message: indent: extract reduce_stmt from reduce This refactoring reduces the indentation of the code, as well as removing any ambiguity as to which 'switch' statement a 'break' belongs, as there are no more nested 'switch' statements. No functional change. To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/usr.bin/indent/parse.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/indent
Module Name:src Committed By: rillig Date: Tue Mar 9 18:21:01 UTC 2021 Modified Files: src/usr.bin/indent: parse.c Log Message: indent: extract reduce_stmt from reduce This refactoring reduces the indentation of the code, as well as removing any ambiguity as to which 'switch' statement a 'break' belongs, as there are no more nested 'switch' statements. No functional change. To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/usr.bin/indent/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/indent/parse.c diff -u src/usr.bin/indent/parse.c:1.15 src/usr.bin/indent/parse.c:1.16 --- src/usr.bin/indent/parse.c:1.15 Tue Mar 9 16:48:28 2021 +++ src/usr.bin/indent/parse.c Tue Mar 9 18:21:01 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: parse.c,v 1.15 2021/03/09 16:48:28 rillig Exp $ */ +/* $NetBSD: parse.c,v 1.16 2021/03/09 18:21:01 rillig Exp $ */ /*- * SPDX-License-Identifier: BSD-4-Clause @@ -232,116 +232,78 @@ parse(token_type tk) /* tk: the code fo #endif } -/* - * NAME: reduce - * - * FUNCTION: Implements the reduce part of the parsing algorithm - * - * ALGORITHM: The following reductions are done. Reductions are repeated - * until no more are possible. - * - * Old TOS New TOS - * - * - * do "dostmt" - * if "ifstmt" - * switch - * decl - * "ifelse" - * for - * while - * "dostmt" while - * - * On each reduction, ps.i_l_follow (the indentation for the following line) - * is set to the indentation level associated with the old TOS. - * - * PARAMETERS: None - * - * RETURNS: Nothing - * - * GLOBALS: ps.cstk ps.i_l_follow = ps.il ps.p_stack = ps.tos = - * - * CALLS: None - * - * CALLED BY: parse - * - * HISTORY: initial coding November 1976 D A Willcox of CAC - * - */ /*--*\ | REDUCTION PHASE | \*--*/ -static void -reduce(void) -{ -int i; -for (;;) { /* keep looping until there is nothing left to - * reduce */ +/* + * Try to combine the statement on the top of the parse stack with the symbol + * directly below it, replacing these two symbols with a single symbol. + */ +static int +reduce_stmt(void) +{ +switch (ps.p_stack[ps.tos - 1]) { - switch (ps.p_stack[ps.tos]) { +case stmt: /* stmt stmt */ +case stmtl: /* stmtl stmt */ + ps.p_stack[--ps.tos] = stmtl; + return true; + +case dolit: /* do */ + ps.p_stack[--ps.tos] = dohead; + ps.i_l_follow = ps.il[ps.tos]; + return true; + +case ifstmt: /* if () */ + ps.p_stack[--ps.tos] = ifhead; + int i = ps.tos - 1; + while (ps.p_stack[i] != stmt && + ps.p_stack[i] != stmtl && + ps.p_stack[i] != lbrace) + --i; + ps.i_l_follow = ps.il[i]; + /* + * for the time being, we will assume that there is no else on + * this if, and set the indentation level accordingly. If an + * else is scanned, it will be fixed up later + */ + return true; - case stmt: - switch (ps.p_stack[ps.tos - 1]) { - - case stmt: /* stmt stmt */ - case stmtl: /* stmtl stmt */ - ps.p_stack[--ps.tos] = stmtl; - break; - - case dolit: /* */ - ps.p_stack[--ps.tos] = dohead; - ps.i_l_follow = ps.il[ps.tos]; - break; - - case ifstmt: /* */ - ps.p_stack[--ps.tos] = ifhead; - for (i = ps.tos - 1; - ( - ps.p_stack[i] != stmt - && - ps.p_stack[i] != stmtl - && - ps.p_stack[i] != lbrace - ); - --i); - ps.i_l_follow = ps.il[i]; - /* - * for the time being, we will assume that there is no else on - * this if, and set the indentation level accordingly. If an - * else is scanned, it will be fixed up later - */ - break; - - case swstmt: /* */ - case_ind = ps.cstk[ps.tos - 1]; - /* FALLTHROUGH */ - case decl: /* finish of a declaration */ - case elsehead: /* else> */ - case forstmt: /* */ - case whilestmt: /* */ - ps.p_stack[--ps.tos] = stmt; - ps.i_l_follow = ps.il[ps.tos]; - break; - - default: /* */ - return; - - } /* end of section for on top of stack */ - break; - - case whilestmt: /* while (...) on top */ - if (ps.p_stack[ps.tos - 1] == dohead) { - /* it is termination of a do while */ - ps.tos -= 2; - break; - } - else - return; +case swstmt: /* switch () */ + case_ind = ps.cstk[ps.tos - 1]; + /* FALLTHROUGH */ +case decl: /* finish of a declaration */ +case elsehead: /* if () else */ +case forstmt: /* for (<...>) */ +case whilestmt: /* while () */ + ps.p_stack[--ps.tos] = stmt; + ps.i_l_follow = ps.il[ps.tos]; + return true; - default: /* anything else on top */ - return; +default: /* */ + return false; +} +} +/* + * Repeatedly try to reduce the top two symbols on the parse stack to a + * single symbol, until no more reductions are possible. + * + * On each reduction, ps.i_l_follow (the indentation for
CVS commit: src/usr.bin/indent
Module Name:src Committed By: rillig Date: Tue Mar 9 16:48:28 UTC 2021 Modified Files: src/usr.bin/indent: args.c indent.c lexi.c parse.c pr_comment.c Log Message: indent: manually indent comments It's strange that indent's own code is not formatted by indent itself, which would be a good demonstration of its capabilities. In its current state, I don't trust indent to get even the tokenization correct, therefore the only safe way is to format the code manually. To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/usr.bin/indent/args.c cvs rdiff -u -r1.35 -r1.36 src/usr.bin/indent/indent.c cvs rdiff -u -r1.27 -r1.28 src/usr.bin/indent/lexi.c cvs rdiff -u -r1.14 -r1.15 src/usr.bin/indent/parse.c \ src/usr.bin/indent/pr_comment.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/indent/args.c diff -u src/usr.bin/indent/args.c:1.17 src/usr.bin/indent/args.c:1.18 --- src/usr.bin/indent/args.c:1.17 Sun Mar 7 20:52:11 2021 +++ src/usr.bin/indent/args.c Tue Mar 9 16:48:28 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: args.c,v 1.17 2021/03/07 20:52:11 rillig Exp $ */ +/* $NetBSD: args.c,v 1.18 2021/03/09 16:48:28 rillig Exp $ */ /*- * SPDX-License-Identifier: BSD-4-Clause @@ -46,7 +46,7 @@ static char sccsid[] = "@(#)args.c 8.1 ( #include #ifndef lint #if defined(__NetBSD__) -__RCSID("$NetBSD: args.c,v 1.17 2021/03/07 20:52:11 rillig Exp $"); +__RCSID("$NetBSD: args.c,v 1.18 2021/03/09 16:48:28 rillig Exp $"); #elif defined(__FreeBSD__) __FBSDID("$FreeBSD: head/usr.bin/indent/args.c 336318 2018-07-15 21:04:21Z pstef $"); #endif @@ -85,8 +85,8 @@ __FBSDID("$FreeBSD: head/usr.bin/indent/ static void scan_profile(FILE *); -#define KEY_FILE 5 /* only used for args */ -#define VERSION 6 /* only used for args */ +#define KEY_FILE 5 /* only used for args */ +#define VERSION 6 /* only used for args */ const char *option_source = "?"; Index: src/usr.bin/indent/indent.c diff -u src/usr.bin/indent/indent.c:1.35 src/usr.bin/indent/indent.c:1.36 --- src/usr.bin/indent/indent.c:1.35 Mon Mar 8 20:20:11 2021 +++ src/usr.bin/indent/indent.c Tue Mar 9 16:48:28 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: indent.c,v 1.35 2021/03/08 20:20:11 rillig Exp $ */ +/* $NetBSD: indent.c,v 1.36 2021/03/09 16:48:28 rillig Exp $ */ /*- * SPDX-License-Identifier: BSD-4-Clause @@ -46,7 +46,7 @@ static char sccsid[] = "@(#)indent.c 5.1 #include #ifndef lint #if defined(__NetBSD__) -__RCSID("$NetBSD: indent.c,v 1.35 2021/03/08 20:20:11 rillig Exp $"); +__RCSID("$NetBSD: indent.c,v 1.36 2021/03/09 16:48:28 rillig Exp $"); #elif defined(__FreeBSD__) __FBSDID("$FreeBSD: head/usr.bin/indent/indent.c 340138 2018-11-04 19:24:49Z oshogbo $"); #endif @@ -435,7 +435,7 @@ main(int argc, char **argv) comment_buffered = true; *sc_end++ = '/'; /* copy in start of comment */ *sc_end++ = '*'; - for (;;) { /* loop until we get to the end of the comment */ + for (;;) { /* loop until the end of the comment */ *sc_end = *buf_ptr++; if (buf_ptr >= buf_end) fill_buffer(); @@ -525,7 +525,7 @@ main(int argc, char **argv) buf_ptr = save_com; /* fix so that subsequent calls to * lexi will take tokens out of * save_com */ - *sc_end++ = ' ';/* add trailing blank, just in case */ + *sc_end++ = ' '; /* add trailing blank, just in case */ buf_end = sc_end; sc_end = NULL; break; @@ -639,7 +639,7 @@ check_type: * final increment for the null character. */ switch (type_code) { /* now, decide what to do with the token */ - case form_feed: /* found a form feed in line */ + case form_feed: /* found a form feed in line */ ps.use_ff = true; /* a form feed is treated much like a newline */ dump_line(); ps.want_blank = false; @@ -716,7 +716,7 @@ check_type: if (sp_sw && (ps.p_l_follow == 0)) { /* check for end of if * (...), or some such */ sp_sw = false; - force_nl = true;/* must force newline after if */ + force_nl = true; /* must force newline after if */ ps.last_u_d = true; /* inform lexi that a following * operator is unary */ ps.in_stmt = false; /* dont use stmt continuation @@ -757,7 +757,7 @@ check_type: ps.want_blank = false; break; - case binary_op: /* any binary operation */ + case binary_op: /* any binary operation */ { int len = e_token - s_token; @@ -830,8 +830,8 @@ check_type: case semicolon: /* got a ';' */ if (ps.dec_nest == 0) - ps.in_or_st = false;/* we are not in an initialization or - * structure declaration */ + ps.in_or_st = false; /* we are not in an initialization or + * structure declaration */ scase = false; /* these will only need resetting in an error */ squest = 0; if (ps.last_token == rparen) @@ -1004,7 +1004,7 @@ check_type: */ goto copy_id; /* copy the token into line */
CVS commit: src/usr.bin/indent
Module Name:src Committed By: rillig Date: Tue Mar 9 16:48:28 UTC 2021 Modified Files: src/usr.bin/indent: args.c indent.c lexi.c parse.c pr_comment.c Log Message: indent: manually indent comments It's strange that indent's own code is not formatted by indent itself, which would be a good demonstration of its capabilities. In its current state, I don't trust indent to get even the tokenization correct, therefore the only safe way is to format the code manually. To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/usr.bin/indent/args.c cvs rdiff -u -r1.35 -r1.36 src/usr.bin/indent/indent.c cvs rdiff -u -r1.27 -r1.28 src/usr.bin/indent/lexi.c cvs rdiff -u -r1.14 -r1.15 src/usr.bin/indent/parse.c \ src/usr.bin/indent/pr_comment.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/aarch64
Module Name:src Committed By: ryo Date: Tue Mar 9 16:44:27 UTC 2021 Modified Files: src/sys/arch/aarch64/aarch64: cpu.c cpuswitch.S db_machdep.c trap.c vectors.S src/sys/arch/aarch64/include: db_machdep.h Log Message: Add support hardware breakpoint and watchpoint again. Limited support for hardware watchpoint has been available for some time, but it has not been working properly. In addition, it stopped working at the time of the PTRACE support commit on 2018-12-13. This has been fixed to work correctly, and also fixed to be practical by sharing hardware watchpoints and breakpoints between CPUs on MULTIPROCESSOR. Also fixed a bug that causes a malfunction when switching CPUs with "machine cpu N" when entering ddb mode from other than cpu_Debugger(). I have confirmed that the CPU can be switched by "machine cpu N" and return from ddb properly in each case where ddb is called triggered by ddb break/watchpoint, hardware break/watchpoint, and cpu_Debugger(). To generate a diff of this commit: cvs rdiff -u -r1.58 -r1.59 src/sys/arch/aarch64/aarch64/cpu.c cvs rdiff -u -r1.32 -r1.33 src/sys/arch/aarch64/aarch64/cpuswitch.S cvs rdiff -u -r1.36 -r1.37 src/sys/arch/aarch64/aarch64/db_machdep.c cvs rdiff -u -r1.44 -r1.45 src/sys/arch/aarch64/aarch64/trap.c cvs rdiff -u -r1.21 -r1.22 src/sys/arch/aarch64/aarch64/vectors.S cvs rdiff -u -r1.11 -r1.12 src/sys/arch/aarch64/include/db_machdep.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/aarch64/aarch64/cpu.c diff -u src/sys/arch/aarch64/aarch64/cpu.c:1.58 src/sys/arch/aarch64/aarch64/cpu.c:1.59 --- src/sys/arch/aarch64/aarch64/cpu.c:1.58 Mon Jan 11 21:58:31 2021 +++ src/sys/arch/aarch64/aarch64/cpu.c Tue Mar 9 16:44:27 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.c,v 1.58 2021/01/11 21:58:31 skrll Exp $ */ +/* $NetBSD: cpu.c,v 1.59 2021/03/09 16:44:27 ryo Exp $ */ /* * Copyright (c) 2017 Ryo Shimizu @@ -27,10 +27,11 @@ */ #include -__KERNEL_RCSID(1, "$NetBSD: cpu.c,v 1.58 2021/01/11 21:58:31 skrll Exp $"); +__KERNEL_RCSID(1, "$NetBSD: cpu.c,v 1.59 2021/03/09 16:44:27 ryo Exp $"); #include "locators.h" #include "opt_arm_debug.h" +#include "opt_ddb.h" #include "opt_fdt.h" #include "opt_multiprocessor.h" @@ -53,6 +54,9 @@ __KERNEL_RCSID(1, "$NetBSD: cpu.c,v 1.58 #include #include #include +#ifdef DDB +#include +#endif #include #include @@ -681,7 +685,9 @@ cpu_hatch(struct cpu_info *ci) aarch64_getcacheinfo(device_unit(ci->ci_dev)); aarch64_printcacheinfo(ci->ci_dev); cpu_identify2(ci->ci_dev, ci); - +#ifdef DDB + db_machdep_init(); +#endif mutex_exit(_hatch_lock); cpu_init_counter(ci); Index: src/sys/arch/aarch64/aarch64/cpuswitch.S diff -u src/sys/arch/aarch64/aarch64/cpuswitch.S:1.32 src/sys/arch/aarch64/aarch64/cpuswitch.S:1.33 --- src/sys/arch/aarch64/aarch64/cpuswitch.S:1.32 Sat Dec 26 00:55:26 2020 +++ src/sys/arch/aarch64/aarch64/cpuswitch.S Tue Mar 9 16:44:27 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: cpuswitch.S,v 1.32 2020/12/26 00:55:26 jmcneill Exp $ */ +/* $NetBSD: cpuswitch.S,v 1.33 2021/03/09 16:44:27 ryo Exp $ */ /*- * Copyright (c) 2014, 2020 The NetBSD Foundation, Inc. @@ -38,7 +38,7 @@ #include "opt_ddb.h" #include "opt_kasan.h" -RCSID("$NetBSD: cpuswitch.S,v 1.32 2020/12/26 00:55:26 jmcneill Exp $") +RCSID("$NetBSD: cpuswitch.S,v 1.33 2021/03/09 16:44:27 ryo Exp $") ARMV8_DEFINE_OPTIONS @@ -310,7 +310,7 @@ END(lwp_trampoline) #ifdef DDB ENTRY_NP(cpu_Debugger) - brk #0 + brk #0x ret END(cpu_Debugger) #endif /* DDB */ Index: src/sys/arch/aarch64/aarch64/db_machdep.c diff -u src/sys/arch/aarch64/aarch64/db_machdep.c:1.36 src/sys/arch/aarch64/aarch64/db_machdep.c:1.37 --- src/sys/arch/aarch64/aarch64/db_machdep.c:1.36 Tue Mar 9 16:43:13 2021 +++ src/sys/arch/aarch64/aarch64/db_machdep.c Tue Mar 9 16:44:27 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: db_machdep.c,v 1.36 2021/03/09 16:43:13 ryo Exp $ */ +/* $NetBSD: db_machdep.c,v 1.37 2021/03/09 16:44:27 ryo Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: db_machdep.c,v 1.36 2021/03/09 16:43:13 ryo Exp $"); +__KERNEL_RCSID(0, "$NetBSD: db_machdep.c,v 1.37 2021/03/09 16:44:27 ryo Exp $"); #ifdef _KERNEL_OPT #include "opt_compat_netbsd32.h" @@ -75,6 +75,7 @@ void db_md_reset_cmd(db_expr_t, bool, db void db_md_tlbi_cmd(db_expr_t, bool, db_expr_t, const char *); void db_md_ttbr_cmd(db_expr_t, bool, db_expr_t, const char *); void db_md_sysreg_cmd(db_expr_t, bool, db_expr_t, const char *); +void db_md_break_cmd(db_expr_t, bool, db_expr_t, const char *); void db_md_watch_cmd(db_expr_t, bool, db_expr_t, const char *); #if defined(_KERNEL) && defined(MULTIPROCESSOR) void db_md_switch_cpu_cmd(db_expr_t, bool, db_expr_t, const char *); @@ -83,6 +84,26 @@ void db_md_switch_cpu_cmd(db_expr_t, boo static void
CVS commit: src/sys/arch/aarch64
Module Name:src Committed By: ryo Date: Tue Mar 9 16:44:27 UTC 2021 Modified Files: src/sys/arch/aarch64/aarch64: cpu.c cpuswitch.S db_machdep.c trap.c vectors.S src/sys/arch/aarch64/include: db_machdep.h Log Message: Add support hardware breakpoint and watchpoint again. Limited support for hardware watchpoint has been available for some time, but it has not been working properly. In addition, it stopped working at the time of the PTRACE support commit on 2018-12-13. This has been fixed to work correctly, and also fixed to be practical by sharing hardware watchpoints and breakpoints between CPUs on MULTIPROCESSOR. Also fixed a bug that causes a malfunction when switching CPUs with "machine cpu N" when entering ddb mode from other than cpu_Debugger(). I have confirmed that the CPU can be switched by "machine cpu N" and return from ddb properly in each case where ddb is called triggered by ddb break/watchpoint, hardware break/watchpoint, and cpu_Debugger(). To generate a diff of this commit: cvs rdiff -u -r1.58 -r1.59 src/sys/arch/aarch64/aarch64/cpu.c cvs rdiff -u -r1.32 -r1.33 src/sys/arch/aarch64/aarch64/cpuswitch.S cvs rdiff -u -r1.36 -r1.37 src/sys/arch/aarch64/aarch64/db_machdep.c cvs rdiff -u -r1.44 -r1.45 src/sys/arch/aarch64/aarch64/trap.c cvs rdiff -u -r1.21 -r1.22 src/sys/arch/aarch64/aarch64/vectors.S cvs rdiff -u -r1.11 -r1.12 src/sys/arch/aarch64/include/db_machdep.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/aarch64/aarch64
Module Name:src Committed By: ryo Date: Tue Mar 9 16:43:13 UTC 2021 Modified Files: src/sys/arch/aarch64/aarch64: db_machdep.c Log Message: "machine cpu" command shows pc of trapframe and the symbol To generate a diff of this commit: cvs rdiff -u -r1.35 -r1.36 src/sys/arch/aarch64/aarch64/db_machdep.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/aarch64/aarch64/db_machdep.c diff -u src/sys/arch/aarch64/aarch64/db_machdep.c:1.35 src/sys/arch/aarch64/aarch64/db_machdep.c:1.36 --- src/sys/arch/aarch64/aarch64/db_machdep.c:1.35 Tue Mar 9 16:42:36 2021 +++ src/sys/arch/aarch64/aarch64/db_machdep.c Tue Mar 9 16:43:13 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: db_machdep.c,v 1.35 2021/03/09 16:42:36 ryo Exp $ */ +/* $NetBSD: db_machdep.c,v 1.36 2021/03/09 16:43:13 ryo Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: db_machdep.c,v 1.35 2021/03/09 16:42:36 ryo Exp $"); +__KERNEL_RCSID(0, "$NetBSD: db_machdep.c,v 1.36 2021/03/09 16:43:13 ryo Exp $"); #ifdef _KERNEL_OPT #include "opt_compat_netbsd32.h" @@ -944,11 +944,16 @@ db_md_switch_cpu_cmd(db_expr_t addr, boo if (!have_addr) { for (i = 0; i < ncpu; i++) { - if (db_readytoswitch[i] != NULL) -db_printf("cpu%d: ready. tf=%p\n", i, -db_readytoswitch[i]); - else + if (db_readytoswitch[i] != NULL) { +db_printf("cpu%d: ready. tf=%p, pc=%016lx ", i, + db_readytoswitch[i], + db_readytoswitch[i]->tf_pc); +db_printsym(db_readytoswitch[i]->tf_pc, + DB_STGY_ANY, db_printf); +db_printf("\n"); + } else { db_printf("cpu%d: not responding\n", i); + } } return; }
CVS commit: src/sys/arch/aarch64/aarch64
Module Name:src Committed By: ryo Date: Tue Mar 9 16:43:13 UTC 2021 Modified Files: src/sys/arch/aarch64/aarch64: db_machdep.c Log Message: "machine cpu" command shows pc of trapframe and the symbol To generate a diff of this commit: cvs rdiff -u -r1.35 -r1.36 src/sys/arch/aarch64/aarch64/db_machdep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/aarch64/aarch64
Module Name:src Committed By: ryo Date: Tue Mar 9 16:42:36 UTC 2021 Modified Files: src/sys/arch/aarch64/aarch64: db_machdep.c Log Message: match the macro name to the order of the arguments. NFC. To generate a diff of this commit: cvs rdiff -u -r1.34 -r1.35 src/sys/arch/aarch64/aarch64/db_machdep.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/aarch64/aarch64/db_machdep.c diff -u src/sys/arch/aarch64/aarch64/db_machdep.c:1.34 src/sys/arch/aarch64/aarch64/db_machdep.c:1.35 --- src/sys/arch/aarch64/aarch64/db_machdep.c:1.34 Tue Feb 23 07:13:51 2021 +++ src/sys/arch/aarch64/aarch64/db_machdep.c Tue Mar 9 16:42:36 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: db_machdep.c,v 1.34 2021/02/23 07:13:51 mrg Exp $ */ +/* $NetBSD: db_machdep.c,v 1.35 2021/03/09 16:42:36 ryo Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: db_machdep.c,v 1.34 2021/02/23 07:13:51 mrg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: db_machdep.c,v 1.35 2021/03/09 16:42:36 ryo Exp $"); #ifdef _KERNEL_OPT #include "opt_compat_netbsd32.h" @@ -606,58 +606,58 @@ db_md_sysreg_cmd(db_expr_t addr, bool ha static void aarch64_set_bcr_bvr(int n, uint64_t bcr, uint64_t bvr) { -#define DBG_BVR_BCR_SET(regno, bcr, bvr) \ +#define DBG_BCR_BVR_SET(regno, bcr, bvr) \ do { \ reg_dbgbcr ## regno ## _el1_write(bcr); \ reg_dbgbvr ## regno ## _el1_write(bvr); \ } while (0 /* CONSTCOND */) switch (n) { - case 0: DBG_BVR_BCR_SET(0, bcr, bvr); break; - case 1: DBG_BVR_BCR_SET(1, bcr, bvr); break; - case 2: DBG_BVR_BCR_SET(2, bcr, bvr); break; - case 3: DBG_BVR_BCR_SET(3, bcr, bvr); break; - case 4: DBG_BVR_BCR_SET(4, bcr, bvr); break; - case 5: DBG_BVR_BCR_SET(5, bcr, bvr); break; - case 6: DBG_BVR_BCR_SET(6, bcr, bvr); break; - case 7: DBG_BVR_BCR_SET(7, bcr, bvr); break; - case 8: DBG_BVR_BCR_SET(8, bcr, bvr); break; - case 9: DBG_BVR_BCR_SET(9, bcr, bvr); break; - case 10: DBG_BVR_BCR_SET(10, bcr, bvr); break; - case 11: DBG_BVR_BCR_SET(11, bcr, bvr); break; - case 12: DBG_BVR_BCR_SET(12, bcr, bvr); break; - case 13: DBG_BVR_BCR_SET(13, bcr, bvr); break; - case 14: DBG_BVR_BCR_SET(14, bcr, bvr); break; - case 15: DBG_BVR_BCR_SET(15, bcr, bvr); break; + case 0: DBG_BCR_BVR_SET(0, bcr, bvr); break; + case 1: DBG_BCR_BVR_SET(1, bcr, bvr); break; + case 2: DBG_BCR_BVR_SET(2, bcr, bvr); break; + case 3: DBG_BCR_BVR_SET(3, bcr, bvr); break; + case 4: DBG_BCR_BVR_SET(4, bcr, bvr); break; + case 5: DBG_BCR_BVR_SET(5, bcr, bvr); break; + case 6: DBG_BCR_BVR_SET(6, bcr, bvr); break; + case 7: DBG_BCR_BVR_SET(7, bcr, bvr); break; + case 8: DBG_BCR_BVR_SET(8, bcr, bvr); break; + case 9: DBG_BCR_BVR_SET(9, bcr, bvr); break; + case 10: DBG_BCR_BVR_SET(10, bcr, bvr); break; + case 11: DBG_BCR_BVR_SET(11, bcr, bvr); break; + case 12: DBG_BCR_BVR_SET(12, bcr, bvr); break; + case 13: DBG_BCR_BVR_SET(13, bcr, bvr); break; + case 14: DBG_BCR_BVR_SET(14, bcr, bvr); break; + case 15: DBG_BCR_BVR_SET(15, bcr, bvr); break; } } static void aarch64_set_wcr_wvr(int n, uint64_t wcr, uint64_t wvr) { -#define DBG_WVR_WCR_SET(regno, wcr, wvr) \ +#define DBG_WCR_WVR_SET(regno, wcr, wvr) \ do { \ reg_dbgwcr ## regno ## _el1_write(wcr); \ reg_dbgwvr ## regno ## _el1_write(wvr); \ } while (0 /* CONSTCOND */) switch (n) { - case 0: DBG_WVR_WCR_SET(0, wcr, wvr); break; - case 1: DBG_WVR_WCR_SET(1, wcr, wvr); break; - case 2: DBG_WVR_WCR_SET(2, wcr, wvr); break; - case 3: DBG_WVR_WCR_SET(3, wcr, wvr); break; - case 4: DBG_WVR_WCR_SET(4, wcr, wvr); break; - case 5: DBG_WVR_WCR_SET(5, wcr, wvr); break; - case 6: DBG_WVR_WCR_SET(6, wcr, wvr); break; - case 7: DBG_WVR_WCR_SET(7, wcr, wvr); break; - case 8: DBG_WVR_WCR_SET(8, wcr, wvr); break; - case 9: DBG_WVR_WCR_SET(9, wcr, wvr); break; - case 10: DBG_WVR_WCR_SET(10, wcr, wvr); break; - case 11: DBG_WVR_WCR_SET(11, wcr, wvr); break; - case 12: DBG_WVR_WCR_SET(12, wcr, wvr); break; - case 13: DBG_WVR_WCR_SET(13, wcr, wvr); break; - case 14: DBG_WVR_WCR_SET(14, wcr, wvr); break; - case 15: DBG_WVR_WCR_SET(15, wcr, wvr); break; + case 0: DBG_WCR_WVR_SET(0, wcr, wvr); break; + case 1: DBG_WCR_WVR_SET(1, wcr, wvr); break; + case 2: DBG_WCR_WVR_SET(2, wcr, wvr); break; + case 3: DBG_WCR_WVR_SET(3, wcr, wvr); break; + case 4: DBG_WCR_WVR_SET(4, wcr, wvr); break; + case 5: DBG_WCR_WVR_SET(5, wcr, wvr); break; + case 6: DBG_WCR_WVR_SET(6, wcr, wvr); break; + case 7: DBG_WCR_WVR_SET(7, wcr, wvr); break; + case 8: DBG_WCR_WVR_SET(8, wcr, wvr); break; + case 9: DBG_WCR_WVR_SET(9, wcr, wvr); break; + case 10: DBG_WCR_WVR_SET(10, wcr, wvr); break; + case 11: DBG_WCR_WVR_SET(11, wcr, wvr); break; + case 12: DBG_WCR_WVR_SET(12, wcr, wvr); break; + case 13: DBG_WCR_WVR_SET(13, wcr, wvr); break; + case 14: DBG_WCR_WVR_SET(14,
CVS commit: src/sys/arch/aarch64/aarch64
Module Name:src Committed By: ryo Date: Tue Mar 9 16:42:36 UTC 2021 Modified Files: src/sys/arch/aarch64/aarch64: db_machdep.c Log Message: match the macro name to the order of the arguments. NFC. To generate a diff of this commit: cvs rdiff -u -r1.34 -r1.35 src/sys/arch/aarch64/aarch64/db_machdep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/aarch64/include
Module Name:src Committed By: ryo Date: Tue Mar 9 16:41:43 UTC 2021 Modified Files: src/sys/arch/aarch64/include: armreg.h Log Message: fixed mask width of DBGWVR_MASK, and added definition of DBGBVR_MASK To generate a diff of this commit: cvs rdiff -u -r1.54 -r1.55 src/sys/arch/aarch64/include/armreg.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/aarch64/include/armreg.h diff -u src/sys/arch/aarch64/include/armreg.h:1.54 src/sys/arch/aarch64/include/armreg.h:1.55 --- src/sys/arch/aarch64/include/armreg.h:1.54 Wed Sep 30 08:40:49 2020 +++ src/sys/arch/aarch64/include/armreg.h Tue Mar 9 16:41:43 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: armreg.h,v 1.54 2020/09/30 08:40:49 ryo Exp $ */ +/* $NetBSD: armreg.h,v 1.55 2021/03/09 16:41:43 ryo Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -1087,6 +1087,8 @@ AARCH64REG_WRITE_INLINE(dbgbvr14_el1) AARCH64REG_READ_INLINE(dbgbvr15_el1) // Debug Breakpoint Value Register 15 AARCH64REG_WRITE_INLINE(dbgbvr15_el1) +#define DBGBVR_MASK __BITS(63,2) + AARCH64REG_READ_INLINE(dbgwcr0_el1) // Debug Watchpoint Control Register 0 AARCH64REG_WRITE_INLINE(dbgwcr0_el1) AARCH64REG_READ_INLINE(dbgwcr1_el1) // Debug Watchpoint Control Register 1 @@ -1163,7 +1165,7 @@ AARCH64REG_WRITE_INLINE(dbgwvr14_el1) AARCH64REG_READ_INLINE(dbgwvr15_el1) // Debug Watchpoint Value Register 15 AARCH64REG_WRITE_INLINE(dbgwvr15_el1) -#define DBGWVR_MASK __BITS(64,3) +#define DBGWVR_MASK __BITS(63,2) AARCH64REG_READ_INLINE(mdscr_el1) // Monitor Debug System Control Register
CVS commit: src/sys/arch/aarch64/aarch64
Module Name:src Committed By: ryo Date: Tue Mar 9 16:40:59 UTC 2021 Modified Files: src/sys/arch/aarch64/aarch64: pmap.c Log Message: fix build error without options DDB. kvtopte() is referenced from arm/acpi/acpi_machdep.c To generate a diff of this commit: cvs rdiff -u -r1.102 -r1.103 src/sys/arch/aarch64/aarch64/pmap.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/aarch64/aarch64/pmap.c diff -u src/sys/arch/aarch64/aarch64/pmap.c:1.102 src/sys/arch/aarch64/aarch64/pmap.c:1.103 --- src/sys/arch/aarch64/aarch64/pmap.c:1.102 Sat Feb 13 18:13:53 2021 +++ src/sys/arch/aarch64/aarch64/pmap.c Tue Mar 9 16:40:59 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.102 2021/02/13 18:13:53 ryo Exp $ */ +/* $NetBSD: pmap.c,v 1.103 2021/03/09 16:40:59 ryo Exp $ */ /* * Copyright (c) 2017 Ryo Shimizu @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.102 2021/02/13 18:13:53 ryo Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.103 2021/03/09 16:40:59 ryo Exp $"); #include "opt_arm_debug.h" #include "opt_ddb.h" @@ -2632,8 +2632,6 @@ pmap_is_referenced(struct vm_page *pg) return (pp->pp_pv.pv_va & VM_PROT_READ); } -#ifdef DDB - /* get pointer to kernel segment L2 or L3 table entry */ pt_entry_t * kvtopte(vaddr_t va) @@ -2643,6 +2641,8 @@ kvtopte(vaddr_t va) return _pmap_pte_lookup_bs(pmap_kernel(), va, NULL); } +#ifdef DDB + /* change attribute of kernel segment */ pt_entry_t pmap_kvattr(vaddr_t va, vm_prot_t prot)
CVS commit: src/sys/arch/aarch64/include
Module Name:src Committed By: ryo Date: Tue Mar 9 16:41:43 UTC 2021 Modified Files: src/sys/arch/aarch64/include: armreg.h Log Message: fixed mask width of DBGWVR_MASK, and added definition of DBGBVR_MASK To generate a diff of this commit: cvs rdiff -u -r1.54 -r1.55 src/sys/arch/aarch64/include/armreg.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/aarch64/aarch64
Module Name:src Committed By: ryo Date: Tue Mar 9 16:40:59 UTC 2021 Modified Files: src/sys/arch/aarch64/aarch64: pmap.c Log Message: fix build error without options DDB. kvtopte() is referenced from arm/acpi/acpi_machdep.c To generate a diff of this commit: cvs rdiff -u -r1.102 -r1.103 src/sys/arch/aarch64/aarch64/pmap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/usb
Module Name:src Committed By: ryo Date: Tue Mar 9 16:39:18 UTC 2021 Modified Files: src/sys/dev/usb: usbdevs.h usbdevs_data.h Log Message: regen To generate a diff of this commit: cvs rdiff -u -r1.780 -r1.781 src/sys/dev/usb/usbdevs.h \ src/sys/dev/usb/usbdevs_data.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/usb
Module Name:src Committed By: ryo Date: Tue Mar 9 16:38:49 UTC 2021 Modified Files: src/sys/dev/usb: usbdevs Log Message: Add ASUSTEK AURALED To generate a diff of this commit: cvs rdiff -u -r1.791 -r1.792 src/sys/dev/usb/usbdevs 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/usb/usbdevs diff -u src/sys/dev/usb/usbdevs:1.791 src/sys/dev/usb/usbdevs:1.792 --- src/sys/dev/usb/usbdevs:1.791 Tue Mar 9 16:37:23 2021 +++ src/sys/dev/usb/usbdevs Tue Mar 9 16:38:49 2021 @@ -1,4 +1,4 @@ -$NetBSD: usbdevs,v 1.791 2021/03/09 16:37:23 ryo Exp $ +$NetBSD: usbdevs,v 1.792 2021/03/09 16:38:49 ryo Exp $ /*- * Copyright (c) 1998-2004 The NetBSD Foundation, Inc. @@ -961,6 +961,7 @@ product ASUSTEK RTL8192CU 0x17ab RTL8192 product ASUSTEK USBN66 0x17ad USB-N66 product ASUSTEK USBN10NANO 0x17ba USB-N10 Nano product ASUSTEK RTL8192CU_3 0x17c0 RTL8192CU_3 +product ASUSTEK AURALED 0x18f3 AURA LED product ASUSTEK MYPAL_A730 0x4202 MyPal A730 product ASUSTEK2 USBN11 0x0b05 USB-N11
CVS commit: src/sys/dev/usb
Module Name:src Committed By: ryo Date: Tue Mar 9 16:38:49 UTC 2021 Modified Files: src/sys/dev/usb: usbdevs Log Message: Add ASUSTEK AURALED To generate a diff of this commit: cvs rdiff -u -r1.791 -r1.792 src/sys/dev/usb/usbdevs Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/usb
Module Name:src Committed By: ryo Date: Tue Mar 9 16:37:24 UTC 2021 Modified Files: src/sys/dev/usb: usbdevs Log Message: Add CoolerMaster, and AMD SR4 lamplight Control device (Wraith Prism RGB CPU Cooler) To generate a diff of this commit: cvs rdiff -u -r1.790 -r1.791 src/sys/dev/usb/usbdevs Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/usb
Module Name:src Committed By: ryo Date: Tue Mar 9 16:37:24 UTC 2021 Modified Files: src/sys/dev/usb: usbdevs Log Message: Add CoolerMaster, and AMD SR4 lamplight Control device (Wraith Prism RGB CPU Cooler) To generate a diff of this commit: cvs rdiff -u -r1.790 -r1.791 src/sys/dev/usb/usbdevs 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/usb/usbdevs diff -u src/sys/dev/usb/usbdevs:1.790 src/sys/dev/usb/usbdevs:1.791 --- src/sys/dev/usb/usbdevs:1.790 Wed Feb 3 23:23:42 2021 +++ src/sys/dev/usb/usbdevs Tue Mar 9 16:37:23 2021 @@ -1,4 +1,4 @@ -$NetBSD: usbdevs,v 1.790 2021/02/03 23:23:42 thorpej Exp $ +$NetBSD: usbdevs,v 1.791 2021/03/09 16:37:23 ryo Exp $ /*- * Copyright (c) 1998-2004 The NetBSD Foundation, Inc. @@ -580,6 +580,7 @@ vendor ARDUINO 0x2341 Arduino SA vendor TPLINK 0x2357 TP-Link vendor WMR 0x2405 West Mountain Radio vendor TRIPPLITE 0x2478 Tripp-Lite +vendor COOLERMASTER 0x2516 Cooler Master Technology Inc. vendor HAILUCK 0x258a HAILUCK Co., Ltd vendor HIROSE 0x2631 Hirose Electric vendor NHJ 0x2770 NHJ @@ -1253,6 +1254,9 @@ product CONCORDCAMERA EYE_Q_3X 0x0100 Ey /* Connectix products */ product CONNECTIX QUICKCAM 0x0001 QuickCam +/* Cooler Master Technology Inc. */ +product COOLERMASTER AMD_SR4_LAMPLIGHT 0x0051 AMD SR4 lamplight Control + /* Corega products */ product COREGA ETHER_USB_T 0x0001 Ether USB-T product COREGA FETHER_USB_TX 0x0004 FEther USB-TX
CVS commit: [netbsd-9] src/doc
Module Name:src Committed By: martin Date: Tue Mar 9 16:02:45 UTC 2021 Modified Files: src/doc [netbsd-9]: CHANGES-9.2 Log Message: Tickets #1227 - #1230 To generate a diff of this commit: cvs rdiff -u -r1.1.2.56 -r1.1.2.57 src/doc/CHANGES-9.2 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/doc/CHANGES-9.2 diff -u src/doc/CHANGES-9.2:1.1.2.56 src/doc/CHANGES-9.2:1.1.2.57 --- src/doc/CHANGES-9.2:1.1.2.56 Sun Mar 7 19:06:20 2021 +++ src/doc/CHANGES-9.2 Tue Mar 9 16:02:45 2021 @@ -1,4 +1,4 @@ -# $NetBSD: CHANGES-9.2,v 1.1.2.56 2021/03/07 19:06:20 martin Exp $ +# $NetBSD: CHANGES-9.2,v 1.1.2.57 2021/03/09 16:02:45 martin Exp $ A complete list of changes from the NetBSD 9.1 release to the NetBSD 9.2 release: @@ -1803,3 +1803,34 @@ sys/netinet6/ip6_var.h1.88 - replace randomid() by cprng_fast32() [christos, ticket #1226] +external/mit/ctwm/etc/system.ctwmrc 1.2-1.5,1.7,1.9-1.12 + + system.ctwmrc: acccessibility improvements based on user feedback + - improve contrast of focused windows. + - set xeyes and xclock to AlwaysOnTop. + - remove mute key binding. + - it conflicts with hardware mute on some laptops. + - slightly lower default workspace manager size. + - set default cursor styles. + - prevent multiple windows from having focus at once. + - allow programs like xev to obtain keyboard focus. + [nia, ticket #1227] + +sys/dev/ic/mb89352.c1.58 + + Fix a possible race condition in spc_msgin() in NO_MANUAL_XFER case. + [tsutsui, ticket #1228] + +sys/netinet/in_var.h1.99,1.102 +sys/netinet/tcp_subr.c1.286 +sys/netinet/tcp_timer.c1.96 + + Avoid information disclosure. + [christos, ticket #1229] + +etc/rc.d/mountall1.15 + + Need to explicitly load value of zfs variable as zfs=YES may be set in + /etc/rc.conf.d/zfs, not /etc/rc.conf. + [sborrill, ticket #1230] +
CVS commit: [netbsd-9] src/doc
Module Name:src Committed By: martin Date: Tue Mar 9 16:02:45 UTC 2021 Modified Files: src/doc [netbsd-9]: CHANGES-9.2 Log Message: Tickets #1227 - #1230 To generate a diff of this commit: cvs rdiff -u -r1.1.2.56 -r1.1.2.57 src/doc/CHANGES-9.2 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [netbsd-9] src/etc/rc.d
Module Name:src Committed By: martin Date: Tue Mar 9 16:01:24 UTC 2021 Modified Files: src/etc/rc.d [netbsd-9]: mountall Log Message: Pull up following revision(s) (requested by sborrill in ticket #1230): etc/rc.d/mountall: revision 1.15 Need to explicitly load value of zfs variable as zfs=YES may be set in /etc/rc.conf.d/zfs, not /etc/rc.conf. To generate a diff of this commit: cvs rdiff -u -r1.10.4.2 -r1.10.4.3 src/etc/rc.d/mountall Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/etc/rc.d/mountall diff -u src/etc/rc.d/mountall:1.10.4.2 src/etc/rc.d/mountall:1.10.4.3 --- src/etc/rc.d/mountall:1.10.4.2 Tue Feb 25 20:03:12 2020 +++ src/etc/rc.d/mountall Tue Mar 9 16:01:24 2021 @@ -1,6 +1,6 @@ #!/bin/sh # -# $NetBSD: mountall,v 1.10.4.2 2020/02/25 20:03:12 martin Exp $ +# $NetBSD: mountall,v 1.10.4.3 2021/03/09 16:01:24 martin Exp $ # # REQUIRE: mountcritremote named ypbind @@ -35,4 +35,5 @@ mountall_stop() } load_rc_config $name +load_rc_config_var zfs zfs run_rc_command "$1"
CVS commit: [netbsd-9] src/etc/rc.d
Module Name:src Committed By: martin Date: Tue Mar 9 16:01:24 UTC 2021 Modified Files: src/etc/rc.d [netbsd-9]: mountall Log Message: Pull up following revision(s) (requested by sborrill in ticket #1230): etc/rc.d/mountall: revision 1.15 Need to explicitly load value of zfs variable as zfs=YES may be set in /etc/rc.conf.d/zfs, not /etc/rc.conf. To generate a diff of this commit: cvs rdiff -u -r1.10.4.2 -r1.10.4.3 src/etc/rc.d/mountall Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [netbsd-8] src/doc
Module Name:src Committed By: martin Date: Tue Mar 9 16:00:14 UTC 2021 Modified Files: src/doc [netbsd-8]: CHANGES-8.3 Log Message: Ticket #1662 To generate a diff of this commit: cvs rdiff -u -r1.1.2.77 -r1.1.2.78 src/doc/CHANGES-8.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/doc/CHANGES-8.3 diff -u src/doc/CHANGES-8.3:1.1.2.77 src/doc/CHANGES-8.3:1.1.2.78 --- src/doc/CHANGES-8.3:1.1.2.77 Sun Mar 7 19:14:54 2021 +++ src/doc/CHANGES-8.3 Tue Mar 9 16:00:14 2021 @@ -1,4 +1,4 @@ -# $NetBSD: CHANGES-8.3,v 1.1.2.77 2021/03/07 19:14:54 martin Exp $ +# $NetBSD: CHANGES-8.3,v 1.1.2.78 2021/03/09 16:00:14 martin Exp $ A complete list of changes from the NetBSD 8.2 release to the NetBSD 8.3 release: @@ -1764,3 +1764,10 @@ sys/netinet6/ip6_var.h1.88 - replace randomid() by cprng_fast32() [christos, ticket #1661] +sys/netinet/in_var.h1.99,1.102 +sys/netinet/tcp_subr.c1.286 +sys/netinet/tcp_timer.c1.96 + + Avoid information disclosure. + [christos, ticket #1662] +
CVS commit: [netbsd-8] src/doc
Module Name:src Committed By: martin Date: Tue Mar 9 16:00:14 UTC 2021 Modified Files: src/doc [netbsd-8]: CHANGES-8.3 Log Message: Ticket #1662 To generate a diff of this commit: cvs rdiff -u -r1.1.2.77 -r1.1.2.78 src/doc/CHANGES-8.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [netbsd-8] src/sys/netinet
Module Name:src Committed By: martin Date: Tue Mar 9 15:56:51 UTC 2021 Modified Files: src/sys/netinet [netbsd-8]: in_var.h tcp_subr.c tcp_timer.c Log Message: Pull up following revision(s) (requested by christos in ticket #1662): sys/netinet/tcp_subr.c: revision 1.286 sys/netinet/tcp_timer.c: revision 1.96 sys/netinet/in_var.h: revision 1.102 sys/netinet/in_var.h: revision 1.99 Don't increment the iss sequence on each connection because it exposes information (Amit Klein) Add some randomness to the iss offset Use a random IPv4 ID because the shuffling algorithm used before could expose information (Amit Klein) mv include to the kernel portion To generate a diff of this commit: cvs rdiff -u -r1.95 -r1.95.2.1 src/sys/netinet/in_var.h cvs rdiff -u -r1.270.6.2 -r1.270.6.3 src/sys/netinet/tcp_subr.c cvs rdiff -u -r1.91.8.1 -r1.91.8.2 src/sys/netinet/tcp_timer.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/netinet/in_var.h diff -u src/sys/netinet/in_var.h:1.95 src/sys/netinet/in_var.h:1.95.2.1 --- src/sys/netinet/in_var.h:1.95 Fri May 12 17:53:54 2017 +++ src/sys/netinet/in_var.h Tue Mar 9 15:56:51 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: in_var.h,v 1.95 2017/05/12 17:53:54 ryo Exp $ */ +/* $NetBSD: in_var.h,v 1.95.2.1 2021/03/09 15:56:51 martin Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -374,6 +374,7 @@ struct in_multi { #ifdef _KERNEL #include +#include extern pktqueue_t *ip_pktq; @@ -450,7 +451,8 @@ ip_newid_range(const struct in_ifaddr *i if (ip_do_randomid) { /* XXX ignore num */ - return ip_randomid(ip_ids, ia ? ia->ia_idsalt : 0); + id = (uint16_t)cprng_fast32(); + return id ? id : 1; } /* Never allow an IP ID of 0 (detect wrap). */ Index: src/sys/netinet/tcp_subr.c diff -u src/sys/netinet/tcp_subr.c:1.270.6.2 src/sys/netinet/tcp_subr.c:1.270.6.3 --- src/sys/netinet/tcp_subr.c:1.270.6.2 Sun Mar 7 19:13:24 2021 +++ src/sys/netinet/tcp_subr.c Tue Mar 9 15:56:51 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: tcp_subr.c,v 1.270.6.2 2021/03/07 19:13:24 martin Exp $ */ +/* $NetBSD: tcp_subr.c,v 1.270.6.3 2021/03/09 15:56:51 martin Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -91,7 +91,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: tcp_subr.c,v 1.270.6.2 2021/03/07 19:13:24 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tcp_subr.c,v 1.270.6.3 2021/03/09 15:56:51 martin Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -2301,7 +2301,6 @@ tcp_new_iss1(void *laddr, void *faddr, u * XXX Use `addin'? * XXX TCP_ISSINCR too large to use? */ - tcp_iss_seq += TCP_ISSINCR; #ifdef TCPISS_DEBUG printf("ISS hash 0x%08x, ", tcp_iss); #endif @@ -2337,7 +2336,6 @@ tcp_new_iss1(void *laddr, void *faddr, u } else { tcp_iss &= TCP_ISS_RANDOM_MASK; tcp_iss += tcp_iss_seq; - tcp_iss_seq += TCP_ISSINCR; #ifdef TCPISS_DEBUG printf("ISS %08x\n", tcp_iss); #endif Index: src/sys/netinet/tcp_timer.c diff -u src/sys/netinet/tcp_timer.c:1.91.8.1 src/sys/netinet/tcp_timer.c:1.91.8.2 --- src/sys/netinet/tcp_timer.c:1.91.8.1 Sat Feb 3 22:07:26 2018 +++ src/sys/netinet/tcp_timer.c Tue Mar 9 15:56:51 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: tcp_timer.c,v 1.91.8.1 2018/02/03 22:07:26 snj Exp $ */ +/* $NetBSD: tcp_timer.c,v 1.91.8.2 2021/03/09 15:56:51 martin Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -93,7 +93,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: tcp_timer.c,v 1.91.8.1 2018/02/03 22:07:26 snj Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tcp_timer.c,v 1.91.8.2 2021/03/09 15:56:51 martin Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -111,6 +111,7 @@ __KERNEL_RCSID(0, "$NetBSD: tcp_timer.c, #include #include #include +#include #include @@ -261,7 +262,7 @@ tcp_slowtimo_work(struct work *wk, void { mutex_enter(softnet_lock); - tcp_iss_seq += TCP_ISSINCR; /* increment iss */ + tcp_iss_seq += TCP_ISSINCR + (TCP_ISS_RANDOM_MASK & cprng_fast32()); tcp_now++; /* for timestamps */ mutex_exit(softnet_lock);
CVS commit: [netbsd-8] src/sys/netinet
Module Name:src Committed By: martin Date: Tue Mar 9 15:56:51 UTC 2021 Modified Files: src/sys/netinet [netbsd-8]: in_var.h tcp_subr.c tcp_timer.c Log Message: Pull up following revision(s) (requested by christos in ticket #1662): sys/netinet/tcp_subr.c: revision 1.286 sys/netinet/tcp_timer.c: revision 1.96 sys/netinet/in_var.h: revision 1.102 sys/netinet/in_var.h: revision 1.99 Don't increment the iss sequence on each connection because it exposes information (Amit Klein) Add some randomness to the iss offset Use a random IPv4 ID because the shuffling algorithm used before could expose information (Amit Klein) mv include to the kernel portion To generate a diff of this commit: cvs rdiff -u -r1.95 -r1.95.2.1 src/sys/netinet/in_var.h cvs rdiff -u -r1.270.6.2 -r1.270.6.3 src/sys/netinet/tcp_subr.c cvs rdiff -u -r1.91.8.1 -r1.91.8.2 src/sys/netinet/tcp_timer.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [netbsd-9] src/sys/netinet
Module Name:src Committed By: martin Date: Tue Mar 9 15:54:32 UTC 2021 Modified Files: src/sys/netinet [netbsd-9]: in_var.h tcp_subr.c tcp_timer.c Log Message: Pull up following revision(s) (requested by christos in ticket #1229): sys/netinet/tcp_subr.c: revision 1.286 sys/netinet/tcp_timer.c: revision 1.96 sys/netinet/in_var.h: revision 1.102 sys/netinet/in_var.h: revision 1.99 Don't increment the iss sequence on each connection because it exposes information (Amit Klein) Add some randomness to the iss offset Use a random IPv4 ID because the shuffling algorithm used before could expose information (Amit Klein) mv include to the kernel portion To generate a diff of this commit: cvs rdiff -u -r1.97 -r1.97.4.1 src/sys/netinet/in_var.h cvs rdiff -u -r1.282.4.2 -r1.282.4.3 src/sys/netinet/tcp_subr.c cvs rdiff -u -r1.95 -r1.95.6.1 src/sys/netinet/tcp_timer.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/netinet/in_var.h diff -u src/sys/netinet/in_var.h:1.97 src/sys/netinet/in_var.h:1.97.4.1 --- src/sys/netinet/in_var.h:1.97 Thu Nov 29 09:51:20 2018 +++ src/sys/netinet/in_var.h Tue Mar 9 15:54:32 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: in_var.h,v 1.97 2018/11/29 09:51:20 ozaki-r Exp $ */ +/* $NetBSD: in_var.h,v 1.97.4.1 2021/03/09 15:54:32 martin Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -374,6 +374,7 @@ struct in_multi { #ifdef _KERNEL #include +#include extern pktqueue_t *ip_pktq; @@ -461,7 +462,8 @@ ip_newid_range(const struct in_ifaddr *i if (ip_do_randomid) { /* XXX ignore num */ - return ip_randomid(ip_ids, ia ? ia->ia_idsalt : 0); + id = (uint16_t)cprng_fast32(); + return id ? id : 1; } /* Never allow an IP ID of 0 (detect wrap). */ Index: src/sys/netinet/tcp_subr.c diff -u src/sys/netinet/tcp_subr.c:1.282.4.2 src/sys/netinet/tcp_subr.c:1.282.4.3 --- src/sys/netinet/tcp_subr.c:1.282.4.2 Sun Mar 7 19:04:31 2021 +++ src/sys/netinet/tcp_subr.c Tue Mar 9 15:54:32 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: tcp_subr.c,v 1.282.4.2 2021/03/07 19:04:31 martin Exp $ */ +/* $NetBSD: tcp_subr.c,v 1.282.4.3 2021/03/09 15:54:32 martin Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -91,7 +91,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: tcp_subr.c,v 1.282.4.2 2021/03/07 19:04:31 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tcp_subr.c,v 1.282.4.3 2021/03/09 15:54:32 martin Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -2220,7 +2220,6 @@ tcp_new_iss1(void *laddr, void *faddr, u * XXX Use `addin'? * XXX TCP_ISSINCR too large to use? */ - tcp_iss_seq += TCP_ISSINCR; #ifdef TCPISS_DEBUG printf("ISS hash 0x%08x, ", tcp_iss); #endif @@ -2256,7 +2255,6 @@ tcp_new_iss1(void *laddr, void *faddr, u } else { tcp_iss &= TCP_ISS_RANDOM_MASK; tcp_iss += tcp_iss_seq; - tcp_iss_seq += TCP_ISSINCR; #ifdef TCPISS_DEBUG printf("ISS %08x\n", tcp_iss); #endif Index: src/sys/netinet/tcp_timer.c diff -u src/sys/netinet/tcp_timer.c:1.95 src/sys/netinet/tcp_timer.c:1.95.6.1 --- src/sys/netinet/tcp_timer.c:1.95 Thu May 3 07:13:48 2018 +++ src/sys/netinet/tcp_timer.c Tue Mar 9 15:54:32 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: tcp_timer.c,v 1.95 2018/05/03 07:13:48 maxv Exp $ */ +/* $NetBSD: tcp_timer.c,v 1.95.6.1 2021/03/09 15:54:32 martin Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -93,7 +93,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: tcp_timer.c,v 1.95 2018/05/03 07:13:48 maxv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tcp_timer.c,v 1.95.6.1 2021/03/09 15:54:32 martin Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -111,6 +111,7 @@ __KERNEL_RCSID(0, "$NetBSD: tcp_timer.c, #include #include #include +#include #include @@ -257,7 +258,7 @@ tcp_slowtimo_work(struct work *wk, void { mutex_enter(softnet_lock); - tcp_iss_seq += TCP_ISSINCR; /* increment iss */ + tcp_iss_seq += TCP_ISSINCR + (TCP_ISS_RANDOM_MASK & cprng_fast32()); tcp_now++; /* for timestamps */ mutex_exit(softnet_lock);
CVS commit: [netbsd-9] src/sys/netinet
Module Name:src Committed By: martin Date: Tue Mar 9 15:54:32 UTC 2021 Modified Files: src/sys/netinet [netbsd-9]: in_var.h tcp_subr.c tcp_timer.c Log Message: Pull up following revision(s) (requested by christos in ticket #1229): sys/netinet/tcp_subr.c: revision 1.286 sys/netinet/tcp_timer.c: revision 1.96 sys/netinet/in_var.h: revision 1.102 sys/netinet/in_var.h: revision 1.99 Don't increment the iss sequence on each connection because it exposes information (Amit Klein) Add some randomness to the iss offset Use a random IPv4 ID because the shuffling algorithm used before could expose information (Amit Klein) mv include to the kernel portion To generate a diff of this commit: cvs rdiff -u -r1.97 -r1.97.4.1 src/sys/netinet/in_var.h cvs rdiff -u -r1.282.4.2 -r1.282.4.3 src/sys/netinet/tcp_subr.c cvs rdiff -u -r1.95 -r1.95.6.1 src/sys/netinet/tcp_timer.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [netbsd-9] src/sys/dev/ic
Module Name:src Committed By: martin Date: Tue Mar 9 15:47:07 UTC 2021 Modified Files: src/sys/dev/ic [netbsd-9]: mb89352.c Log Message: Pull up following revision(s) (requested by tsutsui in ticket #1228): sys/dev/ic/mb89352.c: revision 1.58 Fix a possible race condition in spc_msgin() in NO_MANUAL_XFER case. To avoid the race, check SSTS and INTS after XFR command as spc_pio_datain() does. Reported from isaki@, observed on nono emulator. To generate a diff of this commit: cvs rdiff -u -r1.57 -r1.57.4.1 src/sys/dev/ic/mb89352.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [netbsd-9] src/sys/dev/ic
Module Name:src Committed By: martin Date: Tue Mar 9 15:47:07 UTC 2021 Modified Files: src/sys/dev/ic [netbsd-9]: mb89352.c Log Message: Pull up following revision(s) (requested by tsutsui in ticket #1228): sys/dev/ic/mb89352.c: revision 1.58 Fix a possible race condition in spc_msgin() in NO_MANUAL_XFER case. To avoid the race, check SSTS and INTS after XFR command as spc_pio_datain() does. Reported from isaki@, observed on nono emulator. To generate a diff of this commit: cvs rdiff -u -r1.57 -r1.57.4.1 src/sys/dev/ic/mb89352.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/mb89352.c diff -u src/sys/dev/ic/mb89352.c:1.57 src/sys/dev/ic/mb89352.c:1.57.4.1 --- src/sys/dev/ic/mb89352.c:1.57 Mon Sep 3 16:29:31 2018 +++ src/sys/dev/ic/mb89352.c Tue Mar 9 15:47:07 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: mb89352.c,v 1.57 2018/09/03 16:29:31 riastradh Exp $ */ +/* $NetBSD: mb89352.c,v 1.57.4.1 2021/03/09 15:47:07 martin Exp $ */ /* NecBSD: mb89352.c,v 1.4 1998/03/14 07:31:20 kmatsuda Exp */ /*- @@ -77,7 +77,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: mb89352.c,v 1.57 2018/09/03 16:29:31 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mb89352.c,v 1.57.4.1 2021/03/09 15:47:07 martin Exp $"); #ifdef DDB #define integrate @@ -932,6 +932,7 @@ nextbyte: */ for (;;) { #ifdef NO_MANUAL_XFER /* XXX */ + uint8_t intstat; if (bus_space_read_1(iot, ioh, INTS) != 0) { /* * Target left MESSAGE IN, probably because it @@ -960,12 +961,18 @@ nextbyte: #else bus_space_write_1(iot, ioh, SCMD, SCMD_XFR | SCMD_PROG_XFR); #endif + intstat = 0; for (;;) { if ((bus_space_read_1(iot, ioh, SSTS) & SSTS_DREG_EMPTY) == 0) break; - if (bus_space_read_1(iot, ioh, INTS) != 0) + /* + * We have to read INTS before checking SSTS to avoid + * race between SSTS_DREG_EMPTY and INTS_CMD_DONE. + */ + if (intstat != 0) goto out; + intstat = bus_space_read_1(iot, ioh, INTS); } msg = bus_space_read_1(iot, ioh, DREG); #else
CVS commit: [netbsd-9] src/external/mit/ctwm/etc
Module Name:src Committed By: martin Date: Tue Mar 9 15:44:50 UTC 2021 Modified Files: src/external/mit/ctwm/etc [netbsd-9]: system.ctwmrc Log Message: Pull up following revision(s) (requested by 1227 in ticket #nia): external/mit/ctwm/etc/system.ctwmrc: revision 1.2 external/mit/ctwm/etc/system.ctwmrc: revision 1.3 external/mit/ctwm/etc/system.ctwmrc: revision 1.4 external/mit/ctwm/etc/system.ctwmrc: revision 1.5 external/mit/ctwm/etc/system.ctwmrc: revision 1.7 external/mit/ctwm/etc/system.ctwmrc: revision 1.9 external/mit/ctwm/etc/system.ctwmrc: revision 1.10 external/mit/ctwm/etc/system.ctwmrc: revision 1.11 external/mit/ctwm/etc/system.ctwmrc: revision 1.12 Make it easier to identify the current active window (red border highlight) Bump up the dark contrast a bit xeyes should be AlwaysOnTop - requested by a user mute binding is annoying when there's hardware mute slightly lower workspace manager size this works nicely on a 12.5" FHD screen xclock also gets AlwaysOnTop system.ctwmrc: Set Cursors to avoid strange default fallbacks ctwmrc: remove SloppyFocus keyword, which breaks xev the default still seems to be sloppy focus. is this a bug? does ctwm use a different definition of sloppy focus to the rest of the world? we may never know ctwmrc: disable NoTitleFocus to prevent multiple windows having focus some investigation help from Rhialto To generate a diff of this commit: cvs rdiff -u -r1.1.2.2 -r1.1.2.3 src/external/mit/ctwm/etc/system.ctwmrc Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [netbsd-9] src/external/mit/ctwm/etc
Module Name:src Committed By: martin Date: Tue Mar 9 15:44:50 UTC 2021 Modified Files: src/external/mit/ctwm/etc [netbsd-9]: system.ctwmrc Log Message: Pull up following revision(s) (requested by 1227 in ticket #nia): external/mit/ctwm/etc/system.ctwmrc: revision 1.2 external/mit/ctwm/etc/system.ctwmrc: revision 1.3 external/mit/ctwm/etc/system.ctwmrc: revision 1.4 external/mit/ctwm/etc/system.ctwmrc: revision 1.5 external/mit/ctwm/etc/system.ctwmrc: revision 1.7 external/mit/ctwm/etc/system.ctwmrc: revision 1.9 external/mit/ctwm/etc/system.ctwmrc: revision 1.10 external/mit/ctwm/etc/system.ctwmrc: revision 1.11 external/mit/ctwm/etc/system.ctwmrc: revision 1.12 Make it easier to identify the current active window (red border highlight) Bump up the dark contrast a bit xeyes should be AlwaysOnTop - requested by a user mute binding is annoying when there's hardware mute slightly lower workspace manager size this works nicely on a 12.5" FHD screen xclock also gets AlwaysOnTop system.ctwmrc: Set Cursors to avoid strange default fallbacks ctwmrc: remove SloppyFocus keyword, which breaks xev the default still seems to be sloppy focus. is this a bug? does ctwm use a different definition of sloppy focus to the rest of the world? we may never know ctwmrc: disable NoTitleFocus to prevent multiple windows having focus some investigation help from Rhialto To generate a diff of this commit: cvs rdiff -u -r1.1.2.2 -r1.1.2.3 src/external/mit/ctwm/etc/system.ctwmrc 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/ctwm/etc/system.ctwmrc diff -u src/external/mit/ctwm/etc/system.ctwmrc:1.1.2.2 src/external/mit/ctwm/etc/system.ctwmrc:1.1.2.3 --- src/external/mit/ctwm/etc/system.ctwmrc:1.1.2.2 Thu Oct 8 16:04:07 2020 +++ src/external/mit/ctwm/etc/system.ctwmrc Tue Mar 9 15:44:50 2021 @@ -1,5 +1,5 @@ # -# $NetBSD: system.ctwmrc,v 1.1.2.2 2020/10/08 16:04:07 martin Exp $ +# $NetBSD: system.ctwmrc,v 1.1.2.3 2021/03/09 15:44:50 martin Exp $ # # ctwmrc by nia # @@ -48,8 +48,6 @@ DecorateTransients NoOpaqueMove NoOpaqueResize -SloppyFocus - AutoOccupy AutoRelativeResize @@ -72,8 +70,8 @@ IgnoreLockModifier RandomPlacement "on" MoveDelta 3 -ClearShadowContrast 50 -DarkShadowContrast50 +ClearShadowContrast 40 +DarkShadowContrast60 MovePackResistance100 RaiseWhenAutoUnSqueeze @@ -87,7 +85,7 @@ StayUpMenus WarpToDefaultMenuEntry MenuShadowDepth 1 -NoTitleFocus +TitleFocus # warp through all windows in the current workspace WindowRing @@ -126,7 +124,7 @@ ReverseCurrentWorkspace StartInMapState WMgrHorizButtonIndent 0 WMgrVertButtonIndent 0 -WorkSpaceManagerGeometry "70x270-4-4" 1 +WorkSpaceManagerGeometry "60x240-4-4" 1 WorkSpaces { @@ -137,12 +135,27 @@ WorkSpaces "5"{ "lavender" "black" "darkslateblue" "white" } } +Cursors +{ + Frame"left_ptr" + Title"left_ptr" + Icon "left_ptr" + IconMgr "left_ptr" + Move "fleur" + Resize "fleur" + Menu "left_ptr" + Button "hand2" + Wait "watch" + Select "dot" + Destroy "pirate" +} + Color { - BorderColor "steelblue" + BorderColor "firebrick" - BorderTileBackground "lavender" - BorderTileForeground "lavender" + BorderTileBackground "steelblue" + BorderTileForeground "steelblue" DefaultBackground "grey70" DefaultForeground "black" @@ -240,6 +253,8 @@ OccupyAll AlwaysOnTop { + "xclock" + "XEyes" "XVidCap" } @@ -328,7 +343,7 @@ Button3 = mod4 : window : f.resize "XF86AudioRaiseVolume" = : all : !"mixerctl -w outputs.master+=5" "XF86AudioLowerVolume" = : all : !"mixerctl -w outputs.master-=5" -"XF86AudioMute"= : all : !"mixerctl -w outputs.master=0" +#"XF86AudioMute"= : all : !"mixerctl -w outputs.master=0" # # "Windows" style keyboard shortcuts
CVS commit: src/sbin/ifconfig
Module Name:src Committed By: christos Date: Tue Mar 9 14:39:43 UTC 2021 Modified Files: src/sbin/ifconfig: ifconfig.8 Log Message: PR/50933: Uwe Toenjes: Document hardware limitations To generate a diff of this commit: cvs rdiff -u -r1.121 -r1.122 src/sbin/ifconfig/ifconfig.8 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/ifconfig/ifconfig.8 diff -u src/sbin/ifconfig/ifconfig.8:1.121 src/sbin/ifconfig/ifconfig.8:1.122 --- src/sbin/ifconfig/ifconfig.8:1.121 Tue Sep 29 04:52:11 2020 +++ src/sbin/ifconfig/ifconfig.8 Tue Mar 9 09:39:43 2021 @@ -1,4 +1,4 @@ -.\" $NetBSD: ifconfig.8,v 1.121 2020/09/29 08:52:11 msaitoh Exp $ +.\" $NetBSD: ifconfig.8,v 1.122 2021/03/09 14:39:43 christos Exp $ .\" .\" Copyright (c) 1983, 1991, 1993 .\" The Regents of the University of California. All rights reserved. @@ -29,7 +29,7 @@ .\" .\" @(#)ifconfig.8 8.4 (Berkeley) 6/1/94 .\" -.Dd September 29, 2020 +.Dd March 9, 2021 .Dt IFCONFIG 8 .Os .Sh NAME @@ -904,6 +904,14 @@ tried to alter an interface's configurat .\" .Xr eon 5 , .Xr rc 8 , .Xr routed 8 +.Sh BUGS +Due to hardware limitations some of the capabilities cannot be turned on +and off individually and need to be specified together. +For example the +.Xr ixg 4 +driver can't enable separately tcp and udp, or the transmit and receive +checksumming capabilities. +Unfortunately the diagnostic messages in this case are lacking. .Sh HISTORY The .Nm
CVS commit: src/sbin/ifconfig
Module Name:src Committed By: christos Date: Tue Mar 9 14:39:43 UTC 2021 Modified Files: src/sbin/ifconfig: ifconfig.8 Log Message: PR/50933: Uwe Toenjes: Document hardware limitations To generate a diff of this commit: cvs rdiff -u -r1.121 -r1.122 src/sbin/ifconfig/ifconfig.8 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/netinet
Module Name:src Committed By: christos Date: Tue Mar 9 13:48:16 UTC 2021 Modified Files: src/sys/netinet: tcp_subr.c Log Message: Move the offset addition in one place and mask the random generated value to make sure that the isn is monotonic. To generate a diff of this commit: cvs rdiff -u -r1.287 -r1.288 src/sys/netinet/tcp_subr.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/netinet/tcp_subr.c diff -u src/sys/netinet/tcp_subr.c:1.287 src/sys/netinet/tcp_subr.c:1.288 --- src/sys/netinet/tcp_subr.c:1.287 Mon Mar 8 13:17:27 2021 +++ src/sys/netinet/tcp_subr.c Tue Mar 9 08:48:16 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: tcp_subr.c,v 1.287 2021/03/08 18:17:27 christos Exp $ */ +/* $NetBSD: tcp_subr.c,v 1.288 2021/03/09 13:48:16 christos Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -91,7 +91,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: tcp_subr.c,v 1.287 2021/03/08 18:17:27 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tcp_subr.c,v 1.288 2021/03/09 13:48:16 christos Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -2210,23 +2210,23 @@ tcp_new_iss1(void *laddr, void *faddr, u #ifdef TCPISS_DEBUG printf("ISS hash 0x%08x, ", tcp_iss); #endif - /* - * Add the offset in to the computed value. - */ - tcp_iss += tcp_iss_seq; -#ifdef TCPISS_DEBUG - printf("ISS %08x\n", tcp_iss); -#endif } else { /* * Randomize. */ - tcp_iss = cprng_fast32(); + tcp_iss = cprng_fast32() & TCP_ISS_RANDOM_MASK; #ifdef TCPISS_DEBUG printf("ISS random 0x%08x, ", tcp_iss); #endif } + /* + * Add the offset in to the computed value. + */ + tcp_iss += tcp_iss_seq; +#ifdef TCPISS_DEBUG + printf("ISS %08x\n", tcp_iss); +#endif return tcp_iss; }
CVS commit: src/sys/netinet
Module Name:src Committed By: christos Date: Tue Mar 9 13:48:16 UTC 2021 Modified Files: src/sys/netinet: tcp_subr.c Log Message: Move the offset addition in one place and mask the random generated value to make sure that the isn is monotonic. To generate a diff of this commit: cvs rdiff -u -r1.287 -r1.288 src/sys/netinet/tcp_subr.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/etc/rc.d
Module Name:src Committed By: sborrill Date: Tue Mar 9 12:42:46 UTC 2021 Modified Files: src/etc/rc.d: mountall Log Message: Need to explicitly load value of zfs variable as zfs=YES may be set in /etc/rc.conf.d/zfs, not /etc/rc.conf. To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 src/etc/rc.d/mountall Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/etc/rc.d/mountall diff -u src/etc/rc.d/mountall:1.14 src/etc/rc.d/mountall:1.15 --- src/etc/rc.d/mountall:1.14 Tue Feb 16 10:02:42 2021 +++ src/etc/rc.d/mountall Tue Mar 9 12:42:46 2021 @@ -1,6 +1,6 @@ #!/bin/sh # -# $NetBSD: mountall,v 1.14 2021/02/16 10:02:42 hannken Exp $ +# $NetBSD: mountall,v 1.15 2021/03/09 12:42:46 sborrill Exp $ # # REQUIRE: mountcritremote named ypbind @@ -41,4 +41,5 @@ mountall_stop() } load_rc_config $name +load_rc_config_var zfs zfs run_rc_command "$1"
CVS commit: src/etc/rc.d
Module Name:src Committed By: sborrill Date: Tue Mar 9 12:42:46 UTC 2021 Modified Files: src/etc/rc.d: mountall Log Message: Need to explicitly load value of zfs variable as zfs=YES may be set in /etc/rc.conf.d/zfs, not /etc/rc.conf. To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 src/etc/rc.d/mountall Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/share/man/man4
Module Name:src Committed By: wiz Date: Tue Mar 9 12:02:24 UTC 2021 Modified Files: src/share/man/man4: ixg.4 ixv.4 Log Message: Improve wording, use more macros. To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/share/man/man4/ixg.4 cvs rdiff -u -r1.6 -r1.7 src/share/man/man4/ixv.4 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/share/man/man4/ixg.4 diff -u src/share/man/man4/ixg.4:1.13 src/share/man/man4/ixg.4:1.14 --- src/share/man/man4/ixg.4:1.13 Tue Mar 9 10:03:18 2021 +++ src/share/man/man4/ixg.4 Tue Mar 9 12:02:24 2021 @@ -1,4 +1,4 @@ -.\" $NetBSD: ixg.4,v 1.13 2021/03/09 10:03:18 msaitoh Exp $ +.\" $NetBSD: ixg.4,v 1.14 2021/03/09 12:02:24 wiz Exp $ .\" .\" Copyright (c) 2001-2008, Intel Corporation .\" All rights reserved. @@ -89,17 +89,19 @@ The driver doesn't use the common .Xr MCLGET 9 interface and use the driver specific cluster allocation mechanism. -If it's exhausted, +If it's exhausted, the .Xr evcnt 9 -counter "ixgX qY Rx no jumbo mbuf" is incremented. If it's observed, -The number can be changed by the following config parameter: +counter "ixgX qY Rx no jumbo mbuf" is incremented. +If this is observed, +the number can be changed by the following config parameter: .Bl -tag -width IXGBE_JCLNUM_MULTI -offset 3n .It Dv IXGBE_JCLNUM_MULTI -The number of RX jumbo buffer (cluster) per queue is calculated by +The number of RX jumbo buffers (clusters) per queue is calculated by .Dv IXGBE_JCLNUM_MULTI -* (number of rx descriptor). -The total number of clusters per queue is available with -hw.ixgN.num_jcl_per_queue sysctl. +* (number of rx descriptors). +The total number of clusters per queue is available via the +.Li hw.ixgN.num_jcl_per_queue +.Xr sysctl 7 . .El .Sh SEE ALSO .Xr arp 4 , Index: src/share/man/man4/ixv.4 diff -u src/share/man/man4/ixv.4:1.6 src/share/man/man4/ixv.4:1.7 --- src/share/man/man4/ixv.4:1.6 Tue Mar 9 10:03:18 2021 +++ src/share/man/man4/ixv.4 Tue Mar 9 12:02:24 2021 @@ -1,4 +1,4 @@ -.\" $NetBSD: ixv.4,v 1.6 2021/03/09 10:03:18 msaitoh Exp $ +.\" $NetBSD: ixv.4,v 1.7 2021/03/09 12:02:24 wiz Exp $ .\" .\" Copyright (c) 2018 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -49,17 +49,19 @@ The driver doesn't use the common .Xr MCLGET 9 interface and use the driver specific cluster allocation mechanism. -If it's exhausted, +If it's exhausted, the .Xr evcnt 9 -counter "ixgX qY Rx no jumbo mbuf" is incremented. If it's observed, -The number can be changed by the following config parameter: +counter "ixgX qY Rx no jumbo mbuf" is incremented. +If this is observed, +the number can be changed by the following config parameter: .Bl -tag -width IXGBE_JCLNUM_MULTI -offset 3n .It Dv IXGBE_JCLNUM_MULTI -The number of RX jumbo buffer (cluster) per queue is calculated by +The number of RX jumbo buffers (clusters) per queue is calculated by .Dv IXGBE_JCLNUM_MULTI -* (number of rx descriptor). -The total number of clusters per queue is available with -hw.ixgN.num_jcl_per_queue sysctl. +* (number of rx descriptors). +The total number of clusters per queue is available with the +.Li hw.ixgN.num_jcl_per_queue +.Xr sysctl 7 . .El .Sh SEE ALSO .Xr arp 4 ,
CVS commit: src/share/man/man4
Module Name:src Committed By: wiz Date: Tue Mar 9 12:02:24 UTC 2021 Modified Files: src/share/man/man4: ixg.4 ixv.4 Log Message: Improve wording, use more macros. To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/share/man/man4/ixg.4 cvs rdiff -u -r1.6 -r1.7 src/share/man/man4/ixv.4 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src
Module Name:src Committed By: msaitoh Date: Tue Mar 9 10:03:18 UTC 2021 Modified Files: src/share/man/man4: ixg.4 ixv.4 src/sys/dev/pci: files.pci src/sys/dev/pci/ixgbe: ix_txrx.c ixgbe.c ixgbe.h ixgbe_netbsd.h ixv.c Log Message: Modify some parameters to reduce packet dropping. - Background: ixgbe doesn't use common MCLGET() interface and use the driver specific cluster allocation mechanism (jcl). The cluster is pre-allocated with a fixed number and the current number per queue is num_rx_desc * 2 (2048*2=4096). It's too small. It also has a problem that the max length of the pcq which is used in the TX path is big (4096). Example: 100M <- [ixg0 ixg1] <- 1G 2048 TX descs <--- 4096 pcqs < 2048 RX descs If a machine forwards a traffic from 1G interface to 100M interface, It would require 2048+4096+2048=8192 descriptors, but the current number is 2048*2=4096. It's too small. Even if the both interface's link speed is the same and only small number of packet is queued in the pcq, 4096 jcl is small because 2048(RX)+TX(2048)=4096. If jcl is exhausted, not only forwarding from ixg1 to ixg0 is dropped, but also another forwarding path from ixg1 to another interface(e.g. wm0) is also dropped. Sockets also queue packets, so if a lot of sockets are used and/or a socket buffer size is changed to bigger one, it'll also become a problem. If the jcl is exhausted, evcnt(9) counter "ixgX qY Rx no jumbo mbuf" is incremented. Example: vmstat -ev | grep ixg1 | grep "no jumbo" ixg1 q0 Rx no jumbo mbuf 0 0 misc ixg1 q1 Rx no jumbo mbuf 0 0 misc ixg1 q2 Rx no jumbo mbuf 141326 0 misc ixg1 q3 Rx no jumbo mbuf 0 0 misc - To solve this problem: - Add new config parameter IXGBE_JCLNUM_MULTI and set the default to 3 (2048 * 3). The minimum number is 2. The total number of jcl per queue is available with hw.ixgN.num_jcl_per_queue sysctl. - Reduce the max length of the pcq() which is used in the TX path from 4096 to 2048. - Reviewed by knakahara@ and ozaki-r@. - TODO: Use MCLGET(). To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/share/man/man4/ixg.4 cvs rdiff -u -r1.5 -r1.6 src/share/man/man4/ixv.4 cvs rdiff -u -r1.435 -r1.436 src/sys/dev/pci/files.pci cvs rdiff -u -r1.66 -r1.67 src/sys/dev/pci/ixgbe/ix_txrx.c cvs rdiff -u -r1.278 -r1.279 src/sys/dev/pci/ixgbe/ixgbe.c cvs rdiff -u -r1.74 -r1.75 src/sys/dev/pci/ixgbe/ixgbe.h cvs rdiff -u -r1.11 -r1.12 src/sys/dev/pci/ixgbe/ixgbe_netbsd.h cvs rdiff -u -r1.154 -r1.155 src/sys/dev/pci/ixgbe/ixv.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src
Module Name:src Committed By: msaitoh Date: Tue Mar 9 10:03:18 UTC 2021 Modified Files: src/share/man/man4: ixg.4 ixv.4 src/sys/dev/pci: files.pci src/sys/dev/pci/ixgbe: ix_txrx.c ixgbe.c ixgbe.h ixgbe_netbsd.h ixv.c Log Message: Modify some parameters to reduce packet dropping. - Background: ixgbe doesn't use common MCLGET() interface and use the driver specific cluster allocation mechanism (jcl). The cluster is pre-allocated with a fixed number and the current number per queue is num_rx_desc * 2 (2048*2=4096). It's too small. It also has a problem that the max length of the pcq which is used in the TX path is big (4096). Example: 100M <- [ixg0 ixg1] <- 1G 2048 TX descs <--- 4096 pcqs < 2048 RX descs If a machine forwards a traffic from 1G interface to 100M interface, It would require 2048+4096+2048=8192 descriptors, but the current number is 2048*2=4096. It's too small. Even if the both interface's link speed is the same and only small number of packet is queued in the pcq, 4096 jcl is small because 2048(RX)+TX(2048)=4096. If jcl is exhausted, not only forwarding from ixg1 to ixg0 is dropped, but also another forwarding path from ixg1 to another interface(e.g. wm0) is also dropped. Sockets also queue packets, so if a lot of sockets are used and/or a socket buffer size is changed to bigger one, it'll also become a problem. If the jcl is exhausted, evcnt(9) counter "ixgX qY Rx no jumbo mbuf" is incremented. Example: vmstat -ev | grep ixg1 | grep "no jumbo" ixg1 q0 Rx no jumbo mbuf 0 0 misc ixg1 q1 Rx no jumbo mbuf 0 0 misc ixg1 q2 Rx no jumbo mbuf 141326 0 misc ixg1 q3 Rx no jumbo mbuf 0 0 misc - To solve this problem: - Add new config parameter IXGBE_JCLNUM_MULTI and set the default to 3 (2048 * 3). The minimum number is 2. The total number of jcl per queue is available with hw.ixgN.num_jcl_per_queue sysctl. - Reduce the max length of the pcq() which is used in the TX path from 4096 to 2048. - Reviewed by knakahara@ and ozaki-r@. - TODO: Use MCLGET(). To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/share/man/man4/ixg.4 cvs rdiff -u -r1.5 -r1.6 src/share/man/man4/ixv.4 cvs rdiff -u -r1.435 -r1.436 src/sys/dev/pci/files.pci cvs rdiff -u -r1.66 -r1.67 src/sys/dev/pci/ixgbe/ix_txrx.c cvs rdiff -u -r1.278 -r1.279 src/sys/dev/pci/ixgbe/ixgbe.c cvs rdiff -u -r1.74 -r1.75 src/sys/dev/pci/ixgbe/ixgbe.h cvs rdiff -u -r1.11 -r1.12 src/sys/dev/pci/ixgbe/ixgbe_netbsd.h cvs rdiff -u -r1.154 -r1.155 src/sys/dev/pci/ixgbe/ixv.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/share/man/man4/ixg.4 diff -u src/share/man/man4/ixg.4:1.12 src/share/man/man4/ixg.4:1.13 --- src/share/man/man4/ixg.4:1.12 Wed May 9 08:01:16 2018 +++ src/share/man/man4/ixg.4 Tue Mar 9 10:03:18 2021 @@ -1,4 +1,4 @@ -.\" $NetBSD: ixg.4,v 1.12 2018/05/09 08:01:16 wiz Exp $ +.\" $NetBSD: ixg.4,v 1.13 2021/03/09 10:03:18 msaitoh Exp $ .\" .\" Copyright (c) 2001-2008, Intel Corporation .\" All rights reserved. @@ -33,7 +33,7 @@ .\" .\" $FreeBSD: src/share/man/man4/ixgbe.4,v 1.3 2010/12/19 23:54:31 yongari Exp $ .\" -.Dd May 9, 2018 +.Dd March 9, 2021 .Dt IXG 4 .Os .Sh NAME @@ -83,6 +83,24 @@ go to the Intel support website at: .\" with a supported adapter, email the specific information related to the .\" issue to .\" .Aq freebsd...@mailbox.intel.com . +.Sh OPTIONS +The +.Nm +driver doesn't use the common +.Xr MCLGET 9 +interface and use the driver specific cluster allocation mechanism. +If it's exhausted, +.Xr evcnt 9 +counter "ixgX qY Rx no jumbo mbuf" is incremented. If it's observed, +The number can be changed by the following config parameter: +.Bl -tag -width IXGBE_JCLNUM_MULTI -offset 3n +.It Dv IXGBE_JCLNUM_MULTI +The number of RX jumbo buffer (cluster) per queue is calculated by +.Dv IXGBE_JCLNUM_MULTI +* (number of rx descriptor). +The total number of clusters per queue is available with +hw.ixgN.num_jcl_per_queue sysctl. +.El .Sh SEE ALSO .Xr arp 4 , .Xr ixv 4 , Index: src/share/man/man4/ixv.4 diff -u src/share/man/man4/ixv.4:1.5 src/share/man/man4/ixv.4:1.6 --- src/share/man/man4/ixv.4:1.5 Thu Sep 5 10:01:30 2019 +++ src/share/man/man4/ixv.4 Tue Mar 9 10:03:18 2021 @@ -1,4 +1,4 @@ -.\" $NetBSD: ixv.4,v 1.5 2019/09/05 10:01:30 msaitoh Exp $ +.\" $NetBSD: ixv.4,v 1.6 2021/03/09 10:03:18 msaitoh Exp $ .\" .\" Copyright (c) 2018 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -27,7 +27,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.Dd September 5, 2019 +.Dd March 9, 2021 .Dt IXV 4 .Os .Sh NAME @@