CVS commit: src
Module Name:src Committed By: andvar Date: Tue May 17 05:05:20 UTC 2022 Modified Files: src/sys/arch/powerpc/pci: pcib.c src/sys/dev/spi: spi.c src/sys/dev/usb: udl.c src/tests/dev/audio: audiotest.c Log Message: fix few typos in comments. To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/sys/arch/powerpc/pci/pcib.c cvs rdiff -u -r1.25 -r1.26 src/sys/dev/spi/spi.c cvs rdiff -u -r1.27 -r1.28 src/sys/dev/usb/udl.c cvs rdiff -u -r1.19 -r1.20 src/tests/dev/audio/audiotest.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/powerpc/pci/pcib.c diff -u src/sys/arch/powerpc/pci/pcib.c:1.10 src/sys/arch/powerpc/pci/pcib.c:1.11 --- src/sys/arch/powerpc/pci/pcib.c:1.10 Sat Aug 7 16:19:03 2021 +++ src/sys/arch/powerpc/pci/pcib.c Tue May 17 05:05:20 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: pcib.c,v 1.10 2021/08/07 16:19:03 thorpej Exp $ */ +/* $NetBSD: pcib.c,v 1.11 2022/05/17 05:05:20 andvar Exp $ */ /*- * Copyright (c) 1996, 1998 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pcib.c,v 1.10 2021/08/07 16:19:03 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pcib.c,v 1.11 2022/05/17 05:05:20 andvar Exp $"); #include "isa.h" #include "isadma.h" @@ -151,7 +151,7 @@ pcibattach(device_t parent, device_t sel * us that the interrupt is MPIC 0, which is the bridge intr for * the 8259. * Additionally, sometimes the PCI Interrupt Routing Control Register - * is improperly initialized, causing all sorts of wierd interrupt + * is improperly initialized, causing all sorts of weird interrupt * issues on the machine. The manual says it should default to * h (index 45-44h) however it would appear that PPCBUG is * setting it up differently. Reset it to h. Index: src/sys/dev/spi/spi.c diff -u src/sys/dev/spi/spi.c:1.25 src/sys/dev/spi/spi.c:1.26 --- src/sys/dev/spi/spi.c:1.25 Sun May 8 06:38:58 2022 +++ src/sys/dev/spi/spi.c Tue May 17 05:05:20 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: spi.c,v 1.25 2022/05/08 06:38:58 skrll Exp $ */ +/* $NetBSD: spi.c,v 1.26 2022/05/17 05:05:20 andvar Exp $ */ /*- * Copyright (c) 2006 Urbana-Champaign Independent Media Center. @@ -42,7 +42,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: spi.c,v 1.25 2022/05/08 06:38:58 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: spi.c,v 1.26 2022/05/17 05:05:20 andvar Exp $"); #include "locators.h" @@ -615,7 +615,7 @@ spi_done(struct spi_transfer *st, int er * * spi_send_recv - sends data to the bus, and then receives. Note that this is * done synchronously, i.e. send a command and get the response. This is - * not full duplex. If you wnat full duplex, you can't use these convenience + * not full duplex. If you want full duplex, you can't use these convenience * wrappers. */ int Index: src/sys/dev/usb/udl.c diff -u src/sys/dev/usb/udl.c:1.27 src/sys/dev/usb/udl.c:1.28 --- src/sys/dev/usb/udl.c:1.27 Sat Aug 7 16:19:17 2021 +++ src/sys/dev/usb/udl.c Tue May 17 05:05:20 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: udl.c,v 1.27 2021/08/07 16:19:17 thorpej Exp $ */ +/* $NetBSD: udl.c,v 1.28 2022/05/17 05:05:20 andvar Exp $ */ /*- * Copyright (c) 2009 FUKAUMI Naoki. @@ -53,7 +53,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: udl.c,v 1.27 2021/08/07 16:19:17 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: udl.c,v 1.28 2022/05/17 05:05:20 andvar Exp $"); #ifdef _KERNEL_OPT #include "opt_usb.h" @@ -1020,7 +1020,7 @@ udl_putchar(void *cookie, int row, int c if (uc == ' ') { /* - * Writting a block for the space character instead rendering + * Writing a block for the space character instead rendering * it from font bits is more slim. */ udl_fill_rect(sc, rgb16[0], x, y, width, height); Index: src/tests/dev/audio/audiotest.c diff -u src/tests/dev/audio/audiotest.c:1.19 src/tests/dev/audio/audiotest.c:1.20 --- src/tests/dev/audio/audiotest.c:1.19 Sat Apr 23 07:47:42 2022 +++ src/tests/dev/audio/audiotest.c Tue May 17 05:05:20 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: audiotest.c,v 1.19 2022/04/23 07:47:42 isaki Exp $ */ +/* $NetBSD: audiotest.c,v 1.20 2022/05/17 05:05:20 andvar Exp $ */ /* * Copyright (C) 2019 Tetsuya Isaki. All rights reserved. @@ -26,7 +26,7 @@ */ #include -__RCSID("$NetBSD: audiotest.c,v 1.19 2022/04/23 07:47:42 isaki Exp $"); +__RCSID("$NetBSD: audiotest.c,v 1.20 2022/05/17 05:05:20 andvar Exp $"); #include #include @@ -3121,7 +3121,7 @@ DEF(poll_out_hiwat) /* * Unpause from buffer full, POLLOUT should raise. - * XXX poll(2) on NetBSD7 is really incomplete and wierd. I don't test it. + * XXX poll(2) on NetBSD7 is really incomplete and weird. I don't test it. */ DEF(poll_out_unpause) {
CVS commit: src
Module Name:src Committed By: andvar Date: Tue May 17 05:05:20 UTC 2022 Modified Files: src/sys/arch/powerpc/pci: pcib.c src/sys/dev/spi: spi.c src/sys/dev/usb: udl.c src/tests/dev/audio: audiotest.c Log Message: fix few typos in comments. To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/sys/arch/powerpc/pci/pcib.c cvs rdiff -u -r1.25 -r1.26 src/sys/dev/spi/spi.c cvs rdiff -u -r1.27 -r1.28 src/sys/dev/usb/udl.c cvs rdiff -u -r1.19 -r1.20 src/tests/dev/audio/audiotest.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/share/man/man9
Module Name:src Committed By: riastradh Date: Tue May 17 01:39:57 UTC 2022 Modified Files: src/share/man/man9: rnd.9 Log Message: rnd(9): Note that rndsource callbacks are never run in hardint. But they may be run in softint at IPL_SOFTSERIAL. To generate a diff of this commit: cvs rdiff -u -r1.30 -r1.31 src/share/man/man9/rnd.9 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/share/man/man9
Module Name:src Committed By: riastradh Date: Tue May 17 01:39:57 UTC 2022 Modified Files: src/share/man/man9: rnd.9 Log Message: rnd(9): Note that rndsource callbacks are never run in hardint. But they may be run in softint at IPL_SOFTSERIAL. To generate a diff of this commit: cvs rdiff -u -r1.30 -r1.31 src/share/man/man9/rnd.9 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/man9/rnd.9 diff -u src/share/man/man9/rnd.9:1.30 src/share/man/man9/rnd.9:1.31 --- src/share/man/man9/rnd.9:1.30 Sat Mar 19 11:54:53 2022 +++ src/share/man/man9/rnd.9 Tue May 17 01:39:57 2022 @@ -1,4 +1,4 @@ -.\" $NetBSD: rnd.9,v 1.30 2022/03/19 11:54:53 riastradh Exp $ +.\" $NetBSD: rnd.9,v 1.31 2022/05/17 01:39:57 riastradh Exp $ .\" .\" Copyright (c) 1997 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -171,6 +171,17 @@ issues calls to each source's .Fa callback in serial \(em it never issues two calls to the same source's callback at the same time in two differen threads or on two different CPUs. +.Pp +The callback may be invoked in thread context or soft interrupt +context, up to +.Dv SOFTINT_SERIAL , +and as such must follow the rules of soft interrupt handlers in +.Xr softint 9 +\(em that is, the callback must never sleep, except on adaptive +.Xr mutex 9 +locks at +.Dv IPL_SOFTSERIAL . +The callback will never be called in hard interrupt context. .It Fn rnd_attach_source "rnd_source" "devname" "type" "flags" Makes .Fa rnd_source
CVS commit: src/usr.sbin/makemandb
Module Name:src Committed By: gutteridge Date: Tue May 17 01:22:14 UTC 2022 Modified Files: src/usr.sbin/makemandb: apropos.1 Log Message: apropos.1: document the PAGER environment variable To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.19 src/usr.sbin/makemandb/apropos.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/makemandb/apropos.1 diff -u src/usr.sbin/makemandb/apropos.1:1.18 src/usr.sbin/makemandb/apropos.1:1.19 --- src/usr.sbin/makemandb/apropos.1:1.18 Fri Jun 17 18:48:07 2016 +++ src/usr.sbin/makemandb/apropos.1 Tue May 17 01:22:14 2022 @@ -1,4 +1,4 @@ -.\" $NetBSD: apropos.1,v 1.18 2016/06/17 18:48:07 abhinav Exp $ +.\" $NetBSD: apropos.1,v 1.19 2022/05/17 01:22:14 gutteridge Exp $ .\" .\" Copyright (c) 2011 Abhinav Upadhyay .\" All rights reserved. @@ -29,7 +29,7 @@ .\" OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd June 16, 2016 +.Dd May 17, 2022 .Dt APROPOS 1 .Os .Sh NAME @@ -110,11 +110,19 @@ The location of the Sqlite FTS database tag. .El .Sh ENVIRONMENT VARIABLES -The -.Ev APROPOS -environment variable is white-space tokenized as an argument vector +.Bl -tag -width APROPOSX +.It Ev APROPOS +This environment variable is white-space tokenized as an argument vector and the options in it are parsed and set. Command line options override the environment options. +.It Ev PAGER +The pagination command used for writing the output, should this be requested. +If the +.Ev PAGER +environment variable is null or not set, the standard pagination program +.Xr more 1 +will be used. +.El .Sh SEE ALSO .Xr man 1 , .Xr whatis 1 ,
CVS commit: src/usr.sbin/makemandb
Module Name:src Committed By: gutteridge Date: Tue May 17 01:22:14 UTC 2022 Modified Files: src/usr.sbin/makemandb: apropos.1 Log Message: apropos.1: document the PAGER environment variable To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.19 src/usr.sbin/makemandb/apropos.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.sbin/makemandb
Module Name:src Committed By: gutteridge Date: Tue May 17 00:21:22 UTC 2022 Modified Files: src/usr.sbin/makemandb: apropos.c Log Message: apropos.c: fix pager functionality Issue reported by Rocky Hotas on NetBSD-Users, patch input from RVP on same, adjustments by me. To generate a diff of this commit: cvs rdiff -u -r1.24 -r1.25 src/usr.sbin/makemandb/apropos.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/makemandb/apropos.c diff -u src/usr.sbin/makemandb/apropos.c:1.24 src/usr.sbin/makemandb/apropos.c:1.25 --- src/usr.sbin/makemandb/apropos.c:1.24 Sat Nov 25 14:29:38 2017 +++ src/usr.sbin/makemandb/apropos.c Tue May 17 00:21:22 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: apropos.c,v 1.24 2017/11/25 14:29:38 abhinav Exp $ */ +/* $NetBSD: apropos.c,v 1.25 2022/05/17 00:21:22 gutteridge Exp $ */ /*- * Copyright (c) 2011 Abhinav Upadhyay * All rights reserved. @@ -31,7 +31,7 @@ */ #include -__RCSID("$NetBSD: apropos.c,v 1.24 2017/11/25 14:29:38 abhinav Exp $"); +__RCSID("$NetBSD: apropos.c,v 1.25 2022/05/17 00:21:22 gutteridge Exp $"); #include #include @@ -157,6 +157,7 @@ main(int argc, char *argv[]) char *query = NULL; // the user query char *errmsg = NULL; char *str; + int pc = 0; int rc = 0; size_t i; int s; @@ -249,6 +250,8 @@ main(int argc, char *argv[]) if (aflags.format == APROPOS_HTML) fprintf(cbdata.out, "\n\n\n"); + if (aflags.pager) + pc = pclose(cbdata.out); free(query); if (aflags.sections) { @@ -264,6 +267,9 @@ main(int argc, char *argv[]) exit(EXIT_FAILURE); } + if (pc == -1) + err(EXIT_FAILURE, "pclose error"); + if (rc < 0) { /* Something wrong with the database. Exit */ exit(EXIT_FAILURE);
CVS commit: src/usr.sbin/makemandb
Module Name:src Committed By: gutteridge Date: Tue May 17 00:21:22 UTC 2022 Modified Files: src/usr.sbin/makemandb: apropos.c Log Message: apropos.c: fix pager functionality Issue reported by Rocky Hotas on NetBSD-Users, patch input from RVP on same, adjustments by me. To generate a diff of this commit: cvs rdiff -u -r1.24 -r1.25 src/usr.sbin/makemandb/apropos.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/pci
Module Name:src Committed By: msaitoh Date: Tue May 17 00:02:57 UTC 2022 Modified Files: src/sys/dev/pci: if_wm.c Log Message: Call m_freem(m) only if m0 == NULL. To generate a diff of this commit: cvs rdiff -u -r1.730 -r1.731 src/sys/dev/pci/if_wm.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/pci
Module Name:src Committed By: msaitoh Date: Tue May 17 00:02:57 UTC 2022 Modified Files: src/sys/dev/pci: if_wm.c Log Message: Call m_freem(m) only if m0 == NULL. To generate a diff of this commit: cvs rdiff -u -r1.730 -r1.731 src/sys/dev/pci/if_wm.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/pci/if_wm.c diff -u src/sys/dev/pci/if_wm.c:1.730 src/sys/dev/pci/if_wm.c:1.731 --- src/sys/dev/pci/if_wm.c:1.730 Tue May 3 00:23:33 2022 +++ src/sys/dev/pci/if_wm.c Tue May 17 00:02:57 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: if_wm.c,v 1.730 2022/05/03 00:23:33 gutteridge Exp $ */ +/* $NetBSD: if_wm.c,v 1.731 2022/05/17 00:02:57 msaitoh Exp $ */ /* * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc. @@ -82,7 +82,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.730 2022/05/03 00:23:33 gutteridge Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.731 2022/05/17 00:02:57 msaitoh Exp $"); #ifdef _KERNEL_OPT #include "opt_net_mpsafe.h" @@ -8016,9 +8016,10 @@ wm_send_common_locked(struct ifnet *ifp, * increment successed packet counter as in the case * which the packet is discarded by link down PHY. */ - if (m0 != NULL) + if (m0 != NULL) { if_statinc(ifp, if_opackets); - m_freem(m0); +m_freem(m0); + } } while (m0 != NULL); return; } @@ -8633,9 +8634,10 @@ wm_nq_send_common_locked(struct ifnet *i * increment successed packet counter as in the case * which the packet is discarded by link down PHY. */ - if (m0 != NULL) + if (m0 != NULL) { if_statinc(ifp, if_opackets); - m_freem(m0); +m_freem(m0); + } } while (m0 != NULL); return; }
CVS commit: src/games/gomoku
Module Name:src Committed By: rillig Date: Mon May 16 22:03:16 UTC 2022 Modified Files: src/games/gomoku: bdisp.c Log Message: gomoku: highlight the last played move To generate a diff of this commit: cvs rdiff -u -r1.26 -r1.27 src/games/gomoku/bdisp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/games/gomoku/bdisp.c diff -u src/games/gomoku/bdisp.c:1.26 src/games/gomoku/bdisp.c:1.27 --- src/games/gomoku/bdisp.c:1.26 Mon May 16 21:48:45 2022 +++ src/games/gomoku/bdisp.c Mon May 16 22:03:16 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: bdisp.c,v 1.26 2022/05/16 21:48:45 rillig Exp $ */ +/* $NetBSD: bdisp.c,v 1.27 2022/05/16 22:03:16 rillig Exp $ */ /* * Copyright (c) 1994 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)bdisp.c 8.2 (Berkeley) 5/3/95"; #else -__RCSID("$NetBSD: bdisp.c,v 1.26 2022/05/16 21:48:45 rillig Exp $"); +__RCSID("$NetBSD: bdisp.c,v 1.27 2022/05/16 22:03:16 rillig Exp $"); #endif #endif /* not lint */ @@ -178,7 +178,12 @@ bdisp(void) c = '.'; } else c = pcolor[sp->s_occ]; - addch(c); + if (movenum > 1 && movelog[movenum - 2] == PT(i, j)) { +attron(A_BOLD); +addch(c); +attroff(A_BOLD); + } else +addch(c); } } refresh();
CVS commit: src/games/gomoku
Module Name:src Committed By: rillig Date: Mon May 16 22:03:16 UTC 2022 Modified Files: src/games/gomoku: bdisp.c Log Message: gomoku: highlight the last played move To generate a diff of this commit: cvs rdiff -u -r1.26 -r1.27 src/games/gomoku/bdisp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/games/gomoku
Module Name:src Committed By: rillig Date: Mon May 16 21:53:41 UTC 2022 Modified Files: src/games/gomoku: main.c Log Message: gomoku: add usage To generate a diff of this commit: cvs rdiff -u -r1.37 -r1.38 src/games/gomoku/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/games/gomoku/main.c diff -u src/games/gomoku/main.c:1.37 src/games/gomoku/main.c:1.38 --- src/games/gomoku/main.c:1.37 Mon May 16 21:48:45 2022 +++ src/games/gomoku/main.c Mon May 16 21:53:41 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.37 2022/05/16 21:48:45 rillig Exp $ */ +/* $NetBSD: main.c,v 1.38 2022/05/16 21:53:41 rillig Exp $ */ /* * Copyright (c) 1994 @@ -42,7 +42,7 @@ __COPYRIGHT("@(#) Copyright (c) 1994\ #if 0 static char sccsid[] = "@(#)main.c 8.4 (Berkeley) 5/4/95"; #else -__RCSID("$NetBSD: main.c,v 1.37 2022/05/16 21:48:45 rillig Exp $"); +__RCSID("$NetBSD: main.c,v 1.38 2022/05/16 21:53:41 rillig Exp $"); #endif #endif /* not lint */ @@ -133,6 +133,10 @@ main(int argc, char **argv) case 'c': /* testing: computer versus computer */ test = 2; break; + default: + fprintf(stderr, "usage: %s [-bcdu] [-Dfile] [file]\n", + getprogname()); + return EXIT_FAILURE; } } argc -= optind;
CVS commit: src/games/gomoku
Module Name:src Committed By: rillig Date: Mon May 16 21:53:41 UTC 2022 Modified Files: src/games/gomoku: main.c Log Message: gomoku: add usage To generate a diff of this commit: cvs rdiff -u -r1.37 -r1.38 src/games/gomoku/main.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/games/gomoku
Module Name:src Committed By: rillig Date: Mon May 16 21:48:46 UTC 2022 Modified Files: src/games/gomoku: Makefile bdisp.c gomoku.h main.c makemove.c pickmove.c Log Message: gomoku: enable lint's strict bool mode No functional change. To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/games/gomoku/Makefile cvs rdiff -u -r1.25 -r1.26 src/games/gomoku/bdisp.c cvs rdiff -u -r1.27 -r1.28 src/games/gomoku/gomoku.h cvs rdiff -u -r1.36 -r1.37 src/games/gomoku/main.c cvs rdiff -u -r1.15 -r1.16 src/games/gomoku/makemove.c cvs rdiff -u -r1.32 -r1.33 src/games/gomoku/pickmove.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/games/gomoku/Makefile diff -u src/games/gomoku/Makefile:1.8 src/games/gomoku/Makefile:1.9 --- src/games/gomoku/Makefile:1.8 Mon May 16 21:02:18 2022 +++ src/games/gomoku/Makefile Mon May 16 21:48:45 2022 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.8 2022/05/16 21:02:18 rillig Exp $ +# $NetBSD: Makefile,v 1.9 2022/05/16 21:48:45 rillig Exp $ # @(#)Makefile 8.1 (Berkeley) 7/24/94 PROG= gomoku @@ -10,6 +10,6 @@ HIDEGAME=hidegame CPPFLAGS+= ${DEBUG:D-DDEBUG} LINTFLAGS+= -w # treat warnings as errors -#LINTFLAGS+= -T # strict bool mode +LINTFLAGS+= -T # strict bool mode .include Index: src/games/gomoku/bdisp.c diff -u src/games/gomoku/bdisp.c:1.25 src/games/gomoku/bdisp.c:1.26 --- src/games/gomoku/bdisp.c:1.25 Mon May 16 21:35:39 2022 +++ src/games/gomoku/bdisp.c Mon May 16 21:48:45 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: bdisp.c,v 1.25 2022/05/16 21:35:39 rillig Exp $ */ +/* $NetBSD: bdisp.c,v 1.26 2022/05/16 21:48:45 rillig Exp $ */ /* * Copyright (c) 1994 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)bdisp.c 8.2 (Berkeley) 5/3/95"; #else -__RCSID("$NetBSD: bdisp.c,v 1.25 2022/05/16 21:35:39 rillig Exp $"); +__RCSID("$NetBSD: bdisp.c,v 1.26 2022/05/16 21:48:45 rillig Exp $"); #endif #endif /* not lint */ @@ -128,7 +128,7 @@ bdisp_init(void) * Update who is playing whom. */ void -bdwho(int update) +bdwho(bool update) { int i, j; @@ -275,7 +275,7 @@ get_key(const char *allowed) return ch; } -int +bool get_line(char *buf, int size) { char *cp, *end; Index: src/games/gomoku/gomoku.h diff -u src/games/gomoku/gomoku.h:1.27 src/games/gomoku/gomoku.h:1.28 --- src/games/gomoku/gomoku.h:1.27 Mon May 16 21:02:18 2022 +++ src/games/gomoku/gomoku.h Mon May 16 21:48:45 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: gomoku.h,v 1.27 2022/05/16 21:02:18 rillig Exp $ */ +/* $NetBSD: gomoku.h,v 1.28 2022/05/16 21:48:45 rillig Exp $ */ /* * Copyright (c) 1994 @@ -230,13 +230,13 @@ extern int movelog[BSZ * BSZ]; /* histo extern int movenum; extern int debug; -extern int interactive; +extern bool interactive; extern const char *plyr[]; void bdinit(struct spotstr *); int get_coord(void); -int get_key(const char *allowedkeys); -int get_line(char *, int); +int get_key(const char *); +bool get_line(char *, int); void ask(const char *); void dislog(const char *); void bdump(FILE *); @@ -244,7 +244,7 @@ void bdisp(void); void bdisp_init(void); void cursfini(void); void cursinit(void); -void bdwho(int); +void bdwho(bool); void panic(const char *, ...) __printflike(1, 2) __dead; void debuglog(const char *, ...) __printflike(1, 2); void whatsup(int); Index: src/games/gomoku/main.c diff -u src/games/gomoku/main.c:1.36 src/games/gomoku/main.c:1.37 --- src/games/gomoku/main.c:1.36 Mon May 16 21:38:46 2022 +++ src/games/gomoku/main.c Mon May 16 21:48:45 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.36 2022/05/16 21:38:46 rillig Exp $ */ +/* $NetBSD: main.c,v 1.37 2022/05/16 21:48:45 rillig Exp $ */ /* * Copyright (c) 1994 @@ -42,7 +42,7 @@ __COPYRIGHT("@(#) Copyright (c) 1994\ #if 0 static char sccsid[] = "@(#)main.c 8.4 (Berkeley) 5/4/95"; #else -__RCSID("$NetBSD: main.c,v 1.36 2022/05/16 21:38:46 rillig Exp $"); +__RCSID("$NetBSD: main.c,v 1.37 2022/05/16 21:48:45 rillig Exp $"); #endif #endif /* not lint */ @@ -62,7 +62,7 @@ __RCSID("$NetBSD: main.c,v 1.36 2022/05/ #define PROGRAM 1 /* get input from program */ #define INPUTF 2 /* get input from a file */ -int interactive = true; /* true if interactive */ +bool interactive = true; /* true if interactive */ int debug; /* > 0 if debugging */ static int test; /* both moves come from 1: input, 2: computer */ static char *prog; /* name of program */ Index: src/games/gomoku/makemove.c diff -u src/games/gomoku/makemove.c:1.15 src/games/gomoku/makemove.c:1.16 --- src/games/gomoku/makemove.c:1.15 Mon May 16 20:57:01 2022 +++ src/games/gomoku/makemove.c Mon May 16 21:48:45 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: makemove.c,v 1.15 2022/05/16 20:57:01 rillig Exp $ */ +/* $NetBSD: makemove.c,v 1.16 2022/05/16 21:48:45 rillig Exp $ */ /* * Copyright (c) 1994 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)makemove.c 8.2 (Berkeley) 5/3/95"; #else -__RCSID("$NetBSD: ma
CVS commit: src/games/gomoku
Module Name:src Committed By: rillig Date: Mon May 16 21:48:46 UTC 2022 Modified Files: src/games/gomoku: Makefile bdisp.c gomoku.h main.c makemove.c pickmove.c Log Message: gomoku: enable lint's strict bool mode No functional change. To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/games/gomoku/Makefile cvs rdiff -u -r1.25 -r1.26 src/games/gomoku/bdisp.c cvs rdiff -u -r1.27 -r1.28 src/games/gomoku/gomoku.h cvs rdiff -u -r1.36 -r1.37 src/games/gomoku/main.c cvs rdiff -u -r1.15 -r1.16 src/games/gomoku/makemove.c cvs rdiff -u -r1.32 -r1.33 src/games/gomoku/pickmove.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/games/gomoku
Module Name:src Committed By: rillig Date: Mon May 16 21:38:46 UTC 2022 Modified Files: src/games/gomoku: main.c Log Message: gomoku: fix remaining lint warnings in -DDEBUG mode The generated code changes since the calculations are now performed with int precision. No functional change since no overflow occurs. To generate a diff of this commit: cvs rdiff -u -r1.35 -r1.36 src/games/gomoku/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/games/gomoku/main.c diff -u src/games/gomoku/main.c:1.35 src/games/gomoku/main.c:1.36 --- src/games/gomoku/main.c:1.35 Mon May 16 21:35:39 2022 +++ src/games/gomoku/main.c Mon May 16 21:38:46 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.35 2022/05/16 21:35:39 rillig Exp $ */ +/* $NetBSD: main.c,v 1.36 2022/05/16 21:38:46 rillig Exp $ */ /* * Copyright (c) 1994 @@ -42,7 +42,7 @@ __COPYRIGHT("@(#) Copyright (c) 1994\ #if 0 static char sccsid[] = "@(#)main.c 8.4 (Berkeley) 5/4/95"; #else -__RCSID("$NetBSD: main.c,v 1.35 2022/05/16 21:35:39 rillig Exp $"); +__RCSID("$NetBSD: main.c,v 1.36 2022/05/16 21:38:46 rillig Exp $"); #endif #endif /* not lint */ @@ -449,7 +449,7 @@ top: break; str[-1] = '\0'; sp = &board[s1 = ctos(input + 1)]; -n = (int)((sp->s_frame[d1] - frames) * FAREA); +n = (int)(sp->s_frame[d1] - frames) * FAREA; *str++ = '\0'; break; } @@ -459,7 +459,7 @@ top: for (d2 = 0; d2 < 4; d2++) if (str[-1] == pdir[d2]) break; - n += sp->s_frame[d2] - frames; + n += (int)(sp->s_frame[d2] - frames); debuglog("overlap %s%c,%s%c = %x", stoc(s1), pdir[d1], stoc(s2), pdir[d2], overlap[n]); goto top;
CVS commit: src/games/gomoku
Module Name:src Committed By: rillig Date: Mon May 16 21:38:46 UTC 2022 Modified Files: src/games/gomoku: main.c Log Message: gomoku: fix remaining lint warnings in -DDEBUG mode The generated code changes since the calculations are now performed with int precision. No functional change since no overflow occurs. To generate a diff of this commit: cvs rdiff -u -r1.35 -r1.36 src/games/gomoku/main.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/games/gomoku
Module Name:src Committed By: rillig Date: Mon May 16 21:35:39 UTC 2022 Modified Files: src/games/gomoku: bdisp.c main.c pickmove.c Log Message: gomoku: fix most lint warnings in -DDEBUG mode No binary change. To generate a diff of this commit: cvs rdiff -u -r1.24 -r1.25 src/games/gomoku/bdisp.c cvs rdiff -u -r1.34 -r1.35 src/games/gomoku/main.c cvs rdiff -u -r1.31 -r1.32 src/games/gomoku/pickmove.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/games/gomoku/bdisp.c diff -u src/games/gomoku/bdisp.c:1.24 src/games/gomoku/bdisp.c:1.25 --- src/games/gomoku/bdisp.c:1.24 Mon May 16 20:57:01 2022 +++ src/games/gomoku/bdisp.c Mon May 16 21:35:39 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: bdisp.c,v 1.24 2022/05/16 20:57:01 rillig Exp $ */ +/* $NetBSD: bdisp.c,v 1.25 2022/05/16 21:35:39 rillig Exp $ */ /* * Copyright (c) 1994 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)bdisp.c 8.2 (Berkeley) 5/3/95"; #else -__RCSID("$NetBSD: bdisp.c,v 1.24 2022/05/16 20:57:01 rillig Exp $"); +__RCSID("$NetBSD: bdisp.c,v 1.25 2022/05/16 21:35:39 rillig Exp $"); #endif #endif /* not lint */ @@ -203,9 +203,9 @@ bdump(FILE *fp) for (i = 1; i < BSZ + 1; i++) { sp = &board[i + j * (BSZ + 1)]; if (debug > 1 && sp->s_occ == EMPTY) { -if (sp->s_flags & IFLAGALL) +if ((sp->s_flags & IFLAGALL) != 0) c = '+'; -else if (sp->s_flags & CFLAGALL) +else if ((sp->s_flags & CFLAGALL) != 0) c = '-'; else c = '.'; Index: src/games/gomoku/main.c diff -u src/games/gomoku/main.c:1.34 src/games/gomoku/main.c:1.35 --- src/games/gomoku/main.c:1.34 Mon May 16 21:02:18 2022 +++ src/games/gomoku/main.c Mon May 16 21:35:39 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.34 2022/05/16 21:02:18 rillig Exp $ */ +/* $NetBSD: main.c,v 1.35 2022/05/16 21:35:39 rillig Exp $ */ /* * Copyright (c) 1994 @@ -42,7 +42,7 @@ __COPYRIGHT("@(#) Copyright (c) 1994\ #if 0 static char sccsid[] = "@(#)main.c 8.4 (Berkeley) 5/4/95"; #else -__RCSID("$NetBSD: main.c,v 1.34 2022/05/16 21:02:18 rillig Exp $"); +__RCSID("$NetBSD: main.c,v 1.35 2022/05/16 21:35:39 rillig Exp $"); #endif #endif /* not lint */ @@ -84,7 +84,9 @@ const char *plyr[2]; /* who's who */ static int readinput(FILE *); static void misclog(const char *, ...) __printflike(1, 2); static void quit(void) __dead; -static void quitsig(int) __dead __unused; +#if !defined(DEBUG) +static void quitsig(int) __dead; +#endif int main(int argc, char **argv) @@ -367,6 +369,7 @@ readinput(FILE *fp) /* * Handle strange situations. */ +/* ARGSUSED */ void whatsup(int signum) { @@ -390,10 +393,12 @@ top: goto top; case 'q': /* conservative quit */ quit(); + /* NOTREACHED */ case 'd': /* set debug level */ debug = input[1] - '0'; debuglog("Debug set to %d", debug); sleep(1); + break; case 'c': break; case 'b': /* back up a move */ @@ -409,7 +414,8 @@ top: stoc(pickmove(i))); goto top; case 'f': /* go forward a move */ - board[movelog[movenum - 1]].s_occ = movenum & 1 ? BLACK : WHITE; + board[movelog[movenum - 1]].s_occ = + (movenum & 1) != 0 ? BLACK : WHITE; movenum++; bdisp(); goto top; @@ -436,19 +442,19 @@ top: d1 = s1 = 0; n = 0; - for (str = input + 1; *str; str++) + for (str = input + 1; *str != '\0'; str++) if (*str == ',') { for (d1 = 0; d1 < 4; d1++) if (str[-1] == pdir[d1]) break; str[-1] = '\0'; sp = &board[s1 = ctos(input + 1)]; -n = (sp->s_frame[d1] - frames) * FAREA; +n = (int)((sp->s_frame[d1] - frames) * FAREA); *str++ = '\0'; break; } sp = &board[s2 = ctos(str)]; - while (*str) + while (*str != '\0') str++; for (d2 = 0; d2 < 4; d2++) if (str[-1] == pdir[d2]) @@ -478,9 +484,9 @@ top: else n = 0; sp = &board[i = ctos(str)]; - for (ep = sp->s_empty; ep; ep = ep->e_next) { + for (ep = sp->s_empty; ep != NULL; ep = ep->e_next) { cbp = ep->e_combo; - if (n) { + if (n != 0) { if (cbp->c_nframes > n) continue; if (cbp->c_nframes != n) @@ -550,11 +556,13 @@ quit(void) exit(0); } +#if !defined(DEBUG) static void quitsig(int dummy __unused) { quit(); } +#endif /* * Die gracefully. Index: src/games/gomoku/pickmove.c diff -u src/games/gomoku/pickmove.c:1.31 src/games/gomoku/pickmove.c:1.32 --- src/games/gomoku/pickmove.c:1.31 Mon May 16 21:02:18 2022 +++ src/games/gomoku/pickmove.c Mon May 16 21:35:39 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: pickmove.c,v 1.31 2022/05/16 21:02:18 rillig Exp $ */ +/* $NetBSD: pickmove.c,v 1.32 2022/05/16 21:35:39 rillig Exp $ */ /* * Copyright (c) 1994 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)pickmove.c 8.2 (Berkeley) 5/3/95"; #else -__RCSID("$NetBSD: pickmove.c,v 1.31 2022/05/16 21:02:18 rillig Exp $"); +__RCSID("$NetBSD: pickmove.c,v 1.32 2022/05/16 21:35:39 rillig Exp $"); #endif #endif /* no
CVS commit: src/games/gomoku
Module Name:src Committed By: rillig Date: Mon May 16 21:35:39 UTC 2022 Modified Files: src/games/gomoku: bdisp.c main.c pickmove.c Log Message: gomoku: fix most lint warnings in -DDEBUG mode No binary change. To generate a diff of this commit: cvs rdiff -u -r1.24 -r1.25 src/games/gomoku/bdisp.c cvs rdiff -u -r1.34 -r1.35 src/games/gomoku/main.c cvs rdiff -u -r1.31 -r1.32 src/games/gomoku/pickmove.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/sparc64/sparc64
Module Name:src Committed By: mrg Date: Mon May 16 21:28:06 UTC 2022 Modified Files: src/sys/arch/sparc64/sparc64: cache.h locore.s trap.c Log Message: try to handle ultrasparc III* "fast ecc error" traps. i had a sunblade 2500 reset with this trap recently, and the manual says it should have been recoverable. in particular, the US IIIv2 manual says in section 12.4.4.2 that the i-cache won't see this data ever (so nothing needed there), and that the d-cache needs to be disabled, and all the entries flushed, and then re-enabled. tested with a "trap 0x70" from kernel space, that trap.c converted the "0x170" back to "0x70" (with an ADVANCE). this code not commited. To generate a diff of this commit: cvs rdiff -u -r1.30 -r1.31 src/sys/arch/sparc64/sparc64/cache.h cvs rdiff -u -r1.427 -r1.428 src/sys/arch/sparc64/sparc64/locore.s cvs rdiff -u -r1.193 -r1.194 src/sys/arch/sparc64/sparc64/trap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/sparc64/sparc64/cache.h diff -u src/sys/arch/sparc64/sparc64/cache.h:1.30 src/sys/arch/sparc64/sparc64/cache.h:1.31 --- src/sys/arch/sparc64/sparc64/cache.h:1.30 Sat Dec 11 19:24:21 2021 +++ src/sys/arch/sparc64/sparc64/cache.h Mon May 16 21:28:05 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: cache.h,v 1.30 2021/12/11 19:24:21 mrg Exp $ */ +/* $NetBSD: cache.h,v 1.31 2022/05/16 21:28:05 mrg Exp $ */ /* * Copyright (c) 2011 Matthew R. Green @@ -93,6 +93,7 @@ extern int icache_size; void dcache_flush_page_us(paddr_t); /* flush page from D$ */ void dcache_flush_page_usiii(paddr_t); /* flush page from D$ */ void sp_blast_dcache(int, int); /* Clear entire D$ */ +void sp_blast_dcache_disabled(int, int); /* Above with D$ disable. */ void blast_icache_us(void); /* Clear entire I$ */ void blast_icache_usiii(void); /* Clear entire I$ */ Index: src/sys/arch/sparc64/sparc64/locore.s diff -u src/sys/arch/sparc64/sparc64/locore.s:1.427 src/sys/arch/sparc64/sparc64/locore.s:1.428 --- src/sys/arch/sparc64/sparc64/locore.s:1.427 Sat Apr 3 17:01:24 2021 +++ src/sys/arch/sparc64/sparc64/locore.s Mon May 16 21:28:05 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: locore.s,v 1.427 2021/04/03 17:01:24 palle Exp $ */ +/* $NetBSD: locore.s,v 1.428 2022/05/16 21:28:05 mrg Exp $ */ /* * Copyright (c) 2006-2010 Matthew R. Green @@ -6193,8 +6193,10 @@ ENTRY(sp_tlb_flush_all_usiii) /* * sp_blast_dcache(int dcache_size, int dcache_line_size) + * sp_blast_dcache_disabled(int dcache_size, int dcache_line_size) * - * Clear out all of D$ regardless of contents + * Clear out all of D$ regardless of contents. The latter one also + * disables the D$ while doing so. */ .align 8 ENTRY(sp_blast_dcache) @@ -6227,6 +6229,46 @@ ENTRY(sp_blast_dcache) wrpr %o3, %pstate #endif + .align 8 +ENTRY(sp_blast_dcache_disabled) +/* + * We turn off interrupts for the duration to prevent RED exceptions. + */ +#ifdef PROF + save %sp, -CC64FSZ, %sp +#endif + + rdpr %pstate, %o3 + sub %o0, %o1, %o0 + andn %o3, PSTATE_IE, %o4 ! Turn off PSTATE_IE bit + wrpr %o4, 0, %pstate + + ldxa[%g0] ASI_MCCR, %o5 + andn %o5, MCCR_DCACHE_EN, %o4 ! Turn off the D$ + stxa %o4, [%g0] ASI_MCCR + flush %g0 + +1: + stxa %g0, [%o0] ASI_DCACHE_TAG + membar #Sync + brnz,pt %o0, 1b + sub %o0, %o1, %o0 + + sethi %hi(KERNBASE), %o2 + flush %o2 + membar #Sync + + stxa %o5, [%g0] ASI_MCCR ! Restore the D$ + flush %g0 +#ifdef PROF + wrpr %o3, %pstate + ret + restore +#else + retl + wrpr %o3, %pstate +#endif + #ifdef MULTIPROCESSOR /* * void sparc64_ipi_blast_dcache(int dcache_size, int dcache_line_size) Index: src/sys/arch/sparc64/sparc64/trap.c diff -u src/sys/arch/sparc64/sparc64/trap.c:1.193 src/sys/arch/sparc64/sparc64/trap.c:1.194 --- src/sys/arch/sparc64/sparc64/trap.c:1.193 Tue Feb 2 08:18:42 2021 +++ src/sys/arch/sparc64/sparc64/trap.c Mon May 16 21:28:05 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: trap.c,v 1.193 2021/02/02 08:18:42 martin Exp $ */ +/* $NetBSD: trap.c,v 1.194 2022/05/16 21:28:05 mrg Exp $ */ /* * Copyright (c) 1996-2002 Eduardo Horvath. All rights reserved. @@ -50,7 +50,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.193 2021/02/02 08:18:42 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.194 2022/05/16 21:28:05 mrg Exp $"); #include "opt_ddb.h" #include "opt_multiprocessor.h" @@ -561,6 +561,11 @@ trap(struct trapframe64 *tf, unsigned in } else if (type == T_ECCERR) { ecc_corrected_error(type, pc); return; + } else if (type == T_FAST_ECC_ERROR) { + /* Disable D$, clear error, enable D$, continue. */ + membar_Sync(); + sp_blast_dcache_disabled(dcache_size, dcache_line_size); + return; } goto dopanic; }
CVS commit: src/sys/arch/sparc64/sparc64
Module Name:src Committed By: mrg Date: Mon May 16 21:28:06 UTC 2022 Modified Files: src/sys/arch/sparc64/sparc64: cache.h locore.s trap.c Log Message: try to handle ultrasparc III* "fast ecc error" traps. i had a sunblade 2500 reset with this trap recently, and the manual says it should have been recoverable. in particular, the US IIIv2 manual says in section 12.4.4.2 that the i-cache won't see this data ever (so nothing needed there), and that the d-cache needs to be disabled, and all the entries flushed, and then re-enabled. tested with a "trap 0x70" from kernel space, that trap.c converted the "0x170" back to "0x70" (with an ADVANCE). this code not commited. To generate a diff of this commit: cvs rdiff -u -r1.30 -r1.31 src/sys/arch/sparc64/sparc64/cache.h cvs rdiff -u -r1.427 -r1.428 src/sys/arch/sparc64/sparc64/locore.s cvs rdiff -u -r1.193 -r1.194 src/sys/arch/sparc64/sparc64/trap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/games/gomoku
Module Name:src Committed By: rillig Date: Mon May 16 21:02:18 UTC 2022 Modified Files: src/games/gomoku: Makefile gomoku.h main.c pickmove.c Log Message: gomoku: allow combination of WARNS=6 and -DDEBUG To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/games/gomoku/Makefile cvs rdiff -u -r1.26 -r1.27 src/games/gomoku/gomoku.h cvs rdiff -u -r1.33 -r1.34 src/games/gomoku/main.c cvs rdiff -u -r1.30 -r1.31 src/games/gomoku/pickmove.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/games/gomoku/Makefile diff -u src/games/gomoku/Makefile:1.7 src/games/gomoku/Makefile:1.8 --- src/games/gomoku/Makefile:1.7 Mon May 16 20:57:01 2022 +++ src/games/gomoku/Makefile Mon May 16 21:02:18 2022 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.7 2022/05/16 20:57:01 rillig Exp $ +# $NetBSD: Makefile,v 1.8 2022/05/16 21:02:18 rillig Exp $ # @(#)Makefile 8.1 (Berkeley) 7/24/94 PROG= gomoku @@ -7,6 +7,7 @@ MAN= gomoku.6 DPADD= ${LIBCURSES} ${LIBTERMINFO} LDADD= -lcurses -lterminfo HIDEGAME=hidegame +CPPFLAGS+= ${DEBUG:D-DDEBUG} LINTFLAGS+= -w # treat warnings as errors #LINTFLAGS+= -T # strict bool mode Index: src/games/gomoku/gomoku.h diff -u src/games/gomoku/gomoku.h:1.26 src/games/gomoku/gomoku.h:1.27 --- src/games/gomoku/gomoku.h:1.26 Mon May 16 20:57:01 2022 +++ src/games/gomoku/gomoku.h Mon May 16 21:02:18 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: gomoku.h,v 1.26 2022/05/16 20:57:01 rillig Exp $ */ +/* $NetBSD: gomoku.h,v 1.27 2022/05/16 21:02:18 rillig Exp $ */ /* * Copyright (c) 1994 @@ -255,3 +255,6 @@ int list_eq(struct combostr **, struct c void clearcombo(struct combostr *, int); void markcombo(struct combostr *); int pickmove(int); +#if defined(DEBUG) +void printcombo(struct combostr *, char *, size_t); +#endif Index: src/games/gomoku/main.c diff -u src/games/gomoku/main.c:1.33 src/games/gomoku/main.c:1.34 --- src/games/gomoku/main.c:1.33 Mon May 16 20:57:01 2022 +++ src/games/gomoku/main.c Mon May 16 21:02:18 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.33 2022/05/16 20:57:01 rillig Exp $ */ +/* $NetBSD: main.c,v 1.34 2022/05/16 21:02:18 rillig Exp $ */ /* * Copyright (c) 1994 @@ -42,7 +42,7 @@ __COPYRIGHT("@(#) Copyright (c) 1994\ #if 0 static char sccsid[] = "@(#)main.c 8.4 (Berkeley) 5/4/95"; #else -__RCSID("$NetBSD: main.c,v 1.33 2022/05/16 20:57:01 rillig Exp $"); +__RCSID("$NetBSD: main.c,v 1.34 2022/05/16 21:02:18 rillig Exp $"); #endif #endif /* not lint */ @@ -84,7 +84,7 @@ const char *plyr[2]; /* who's who */ static int readinput(FILE *); static void misclog(const char *, ...) __printflike(1, 2); static void quit(void) __dead; -static void quitsig(int) __dead; +static void quitsig(int) __dead __unused; int main(int argc, char **argv) Index: src/games/gomoku/pickmove.c diff -u src/games/gomoku/pickmove.c:1.30 src/games/gomoku/pickmove.c:1.31 --- src/games/gomoku/pickmove.c:1.30 Mon May 16 20:57:01 2022 +++ src/games/gomoku/pickmove.c Mon May 16 21:02:18 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: pickmove.c,v 1.30 2022/05/16 20:57:01 rillig Exp $ */ +/* $NetBSD: pickmove.c,v 1.31 2022/05/16 21:02:18 rillig Exp $ */ /* * Copyright (c) 1994 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)pickmove.c 8.2 (Berkeley) 5/3/95"; #else -__RCSID("$NetBSD: pickmove.c,v 1.30 2022/05/16 20:57:01 rillig Exp $"); +__RCSID("$NetBSD: pickmove.c,v 1.31 2022/05/16 21:02:18 rillig Exp $"); #endif #endif /* not lint */ @@ -85,7 +85,9 @@ static void makeempty(struct combostr *) static int checkframes(struct combostr *, struct combostr *, struct spotstr *, int, struct overlap_info *); static bool sortcombo(struct combostr **, struct combostr **, struct combostr *); +#if !defined(DEBUG) static void printcombo(struct combostr *, char *, size_t); +#endif int pickmove(int us) @@ -1321,7 +1323,10 @@ inserted: /* * Print the combo into string buffer 'buf'. */ -static void +#if !defined(DEBUG) +static +#endif +void printcombo(struct combostr *cbp, char *buf, size_t max) { struct combostr *tcbp;
CVS commit: src/games/gomoku
Module Name:src Committed By: rillig Date: Mon May 16 21:02:18 UTC 2022 Modified Files: src/games/gomoku: Makefile gomoku.h main.c pickmove.c Log Message: gomoku: allow combination of WARNS=6 and -DDEBUG To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/games/gomoku/Makefile cvs rdiff -u -r1.26 -r1.27 src/games/gomoku/gomoku.h cvs rdiff -u -r1.33 -r1.34 src/games/gomoku/main.c cvs rdiff -u -r1.30 -r1.31 src/games/gomoku/pickmove.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/games/gomoku
Module Name:src Committed By: rillig Date: Mon May 16 20:57:01 UTC 2022 Modified Files: src/games/gomoku: Makefile bdinit.c bdisp.c gomoku.h main.c makemove.c pickmove.c Log Message: gomoku: prepare lint's strict bool mode No binary change. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/games/gomoku/Makefile cvs rdiff -u -r1.12 -r1.13 src/games/gomoku/bdinit.c cvs rdiff -u -r1.23 -r1.24 src/games/gomoku/bdisp.c cvs rdiff -u -r1.25 -r1.26 src/games/gomoku/gomoku.h cvs rdiff -u -r1.32 -r1.33 src/games/gomoku/main.c cvs rdiff -u -r1.14 -r1.15 src/games/gomoku/makemove.c cvs rdiff -u -r1.29 -r1.30 src/games/gomoku/pickmove.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/games/gomoku
Module Name:src Committed By: rillig Date: Mon May 16 20:57:01 UTC 2022 Modified Files: src/games/gomoku: Makefile bdinit.c bdisp.c gomoku.h main.c makemove.c pickmove.c Log Message: gomoku: prepare lint's strict bool mode No binary change. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/games/gomoku/Makefile cvs rdiff -u -r1.12 -r1.13 src/games/gomoku/bdinit.c cvs rdiff -u -r1.23 -r1.24 src/games/gomoku/bdisp.c cvs rdiff -u -r1.25 -r1.26 src/games/gomoku/gomoku.h cvs rdiff -u -r1.32 -r1.33 src/games/gomoku/main.c cvs rdiff -u -r1.14 -r1.15 src/games/gomoku/makemove.c cvs rdiff -u -r1.29 -r1.30 src/games/gomoku/pickmove.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/games/gomoku/Makefile diff -u src/games/gomoku/Makefile:1.6 src/games/gomoku/Makefile:1.7 --- src/games/gomoku/Makefile:1.6 Mon May 16 19:55:58 2022 +++ src/games/gomoku/Makefile Mon May 16 20:57:01 2022 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.6 2022/05/16 19:55:58 rillig Exp $ +# $NetBSD: Makefile,v 1.7 2022/05/16 20:57:01 rillig Exp $ # @(#)Makefile 8.1 (Berkeley) 7/24/94 PROG= gomoku @@ -9,5 +9,6 @@ LDADD= -lcurses -lterminfo HIDEGAME=hidegame LINTFLAGS+= -w # treat warnings as errors +#LINTFLAGS+= -T # strict bool mode .include Index: src/games/gomoku/bdinit.c diff -u src/games/gomoku/bdinit.c:1.12 src/games/gomoku/bdinit.c:1.13 --- src/games/gomoku/bdinit.c:1.12 Mon May 16 19:55:58 2022 +++ src/games/gomoku/bdinit.c Mon May 16 20:57:01 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: bdinit.c,v 1.12 2022/05/16 19:55:58 rillig Exp $ */ +/* $NetBSD: bdinit.c,v 1.13 2022/05/16 20:57:01 rillig Exp $ */ /* * Copyright (c) 1994 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "from: @(#)bdinit.c 8.2 (Berkeley) 5/3/95"; #else -__RCSID("$NetBSD: bdinit.c,v 1.12 2022/05/16 19:55:58 rillig Exp $"); +__RCSID("$NetBSD: bdinit.c,v 1.13 2022/05/16 20:57:01 rillig Exp $"); #endif #endif /* not lint */ @@ -108,7 +108,7 @@ bdinit(struct spotstr *bp) sp->s_fval[BLACK][0].s = 0x500; sp->s_fval[WHITE][0].s = 0x500; /* if direction 1 is not blocked */ -if (!(sp->s_flags & (BFLAG << 1))) { +if ((sp->s_flags & (BFLAG << 1)) == 0) { sp->s_fval[BLACK][1].s = 0x500; sp->s_fval[WHITE][1].s = 0x500; } @@ -121,7 +121,7 @@ bdinit(struct spotstr *bp) sp->s_fval[BLACK][3].s = MAXCOMBO; sp->s_fval[WHITE][3].s = MAXCOMBO; } else if (i == 5 && -!(sp->s_flags & (BFLAG << 3))) { +(sp->s_flags & (BFLAG << 3)) == 0) { sp->s_fval[BLACK][3].s = 0x500; sp->s_fval[WHITE][3].s = 0x500; } @@ -130,7 +130,7 @@ bdinit(struct spotstr *bp) * Allocate a frame structure for non blocked frames. */ for (r = 4; --r >= 0; ) { -if (sp->s_flags & (BFLAG << r)) +if ((sp->s_flags & (BFLAG << r)) != 0) continue; cbp->c_combo.s = sp->s_fval[BLACK][r].s; cbp->c_vertex = (u_short)(sp - board); @@ -211,7 +211,7 @@ init_overlap(void) for (f = 0; f < 6; f++, sp2 -= d2) { if (sp2->s_occ == BORDER) break; - if (sp2->s_flags & bmask) + if ((sp2->s_flags & bmask) != 0) continue; n = (int)(sp2->s_frame[r] - frames); ip[n] = vertex; Index: src/games/gomoku/bdisp.c diff -u src/games/gomoku/bdisp.c:1.23 src/games/gomoku/bdisp.c:1.24 --- src/games/gomoku/bdisp.c:1.23 Mon May 16 19:55:58 2022 +++ src/games/gomoku/bdisp.c Mon May 16 20:57:01 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: bdisp.c,v 1.23 2022/05/16 19:55:58 rillig Exp $ */ +/* $NetBSD: bdisp.c,v 1.24 2022/05/16 20:57:01 rillig Exp $ */ /* * Copyright (c) 1994 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)bdisp.c 8.2 (Berkeley) 5/3/95"; #else -__RCSID("$NetBSD: bdisp.c,v 1.23 2022/05/16 19:55:58 rillig Exp $"); +__RCSID("$NetBSD: bdisp.c,v 1.24 2022/05/16 20:57:01 rillig Exp $"); #endif #endif /* not lint */ @@ -60,14 +60,14 @@ void cursinit(void) { - if (!initscr()) { + if (initscr() == NULL) { errx(EXIT_FAILURE, "Couldn't initialize screen"); } if ((LINES < SCRNH) || (COLS < SCRNW)) { errx(EXIT_FAILURE, "Screen too small (need %d%xd)", SCRNW, SCRNH); } - keypad(stdscr, TRUE); + keypad(stdscr, true); nonl(); noecho(); cbreak(); @@ -117,7 +117,7 @@ bdisp_init(void) move(20, 2 * i + 1); addch(letters[i]); } - bdwho(0); + bdwho(false); move(0, 47); addstr("# black white"); lastline = 0; @@ -170,9 +170,9 @@ bdisp(void) move(BSZ + 1 - j, 2 * i + 1); sp = &board[i + j * (BSZ + 1)]; if (debug > 1 && sp->s_occ == EMPTY) { -if (sp->s_flags & IFLAGALL) +if ((sp->s_flags & IFLAGALL) != 0) c = '+'; -else if (sp->s_flags & CFLAGALL) +else if ((sp->s_flags & CFLAGALL) != 0) c = '-'; else c = '.'; @@ -425,7 +425,7 @@ get_coord(void) case '\f': nx = curx; ny = cury; - (void)clearok(stdscr, TRUE); + (void)clearok(stdscr, true);
CVS commit: src/lib/libcurses
Module Name:src Committed By: rillig Date: Mon May 16 20:09:13 UTC 2022 Modified Files: src/lib/libcurses: curses_input.3 Log Message: curses_input.3: fix argument type for keypad, notimeout, nodelay There is no type named 'boolf', there's only 'bool'. To generate a diff of this commit: cvs rdiff -u -r1.27 -r1.28 src/lib/libcurses/curses_input.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/lib/libcurses
Module Name:src Committed By: rillig Date: Mon May 16 20:09:13 UTC 2022 Modified Files: src/lib/libcurses: curses_input.3 Log Message: curses_input.3: fix argument type for keypad, notimeout, nodelay There is no type named 'boolf', there's only 'bool'. To generate a diff of this commit: cvs rdiff -u -r1.27 -r1.28 src/lib/libcurses/curses_input.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libcurses/curses_input.3 diff -u src/lib/libcurses/curses_input.3:1.27 src/lib/libcurses/curses_input.3:1.28 --- src/lib/libcurses/curses_input.3:1.27 Mon Jul 3 21:32:50 2017 +++ src/lib/libcurses/curses_input.3 Mon May 16 20:09:13 2022 @@ -1,4 +1,4 @@ -.\" $NetBSD: curses_input.3,v 1.27 2017/07/03 21:32:50 wiz Exp $ +.\" $NetBSD: curses_input.3,v 1.28 2022/05/16 20:09:13 rillig Exp $ .\" .\" Copyright (c) 2002 .\" Brett Lymn (bl...@netbsd.org, brett_l...@yahoo.com.au) @@ -30,7 +30,7 @@ .\" SUCH DAMAGE. .\" .\" -.Dd January 5, 2017 +.Dd May 16, 2022 .Dt CURSES_INPUT 3 .Os .Sh NAME @@ -94,17 +94,17 @@ .Ft int .Fn mvwgetstr "WINDOW *win" "int y" "int x" "char *str" .Ft int -.Fn keypad "WINDOW *win" "boolf flag" +.Fn keypad "WINDOW *win" "bool flag" .Ft bool .Fn is_keypad "const WINDOW *win" .Ft int -.Fn notimeout "WINDOW *win" "boolf flag" +.Fn notimeout "WINDOW *win" "bool flag" .Ft int .Fn timeout "int delay" .Ft int .Fn wtimeout "WINDOW *win" "int delay" .Ft int -.Fn nodelay "WINDOW *win" "boolf flag" +.Fn nodelay "WINDOW *win" "bool flag" .Ft int .Fn ungetch "int c" .Ft int
CVS commit: src/games/gomoku
Module Name:src Committed By: rillig Date: Mon May 16 19:55:58 UTC 2022 Modified Files: src/games/gomoku: Makefile bdinit.c bdisp.c main.c makemove.c pickmove.c Log Message: gomoku: fix lint warnings Most warnings were about implicit conversions from ptrdiff_t to int; add explicit cast for them, as they are far from overflowing int. The casts from one pointer type to 'struct combostr **' were indeed suspicious. In these cases, a single region of memory is allocated to store two objects of different type, without declaring a struct type for their combination. The second object is an array of variable size. No binary change. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/games/gomoku/Makefile cvs rdiff -u -r1.11 -r1.12 src/games/gomoku/bdinit.c cvs rdiff -u -r1.22 -r1.23 src/games/gomoku/bdisp.c cvs rdiff -u -r1.31 -r1.32 src/games/gomoku/main.c cvs rdiff -u -r1.13 -r1.14 src/games/gomoku/makemove.c cvs rdiff -u -r1.28 -r1.29 src/games/gomoku/pickmove.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/games/gomoku/Makefile diff -u src/games/gomoku/Makefile:1.5 src/games/gomoku/Makefile:1.6 --- src/games/gomoku/Makefile:1.5 Sat Feb 6 23:45:25 2010 +++ src/games/gomoku/Makefile Mon May 16 19:55:58 2022 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.5 2010/02/06 23:45:25 he Exp $ +# $NetBSD: Makefile,v 1.6 2022/05/16 19:55:58 rillig Exp $ # @(#)Makefile 8.1 (Berkeley) 7/24/94 PROG= gomoku @@ -8,4 +8,6 @@ DPADD= ${LIBCURSES} ${LIBTERMINFO} LDADD= -lcurses -lterminfo HIDEGAME=hidegame +LINTFLAGS+= -w # treat warnings as errors + .include Index: src/games/gomoku/bdinit.c diff -u src/games/gomoku/bdinit.c:1.11 src/games/gomoku/bdinit.c:1.12 --- src/games/gomoku/bdinit.c:1.11 Sun May 15 22:56:20 2022 +++ src/games/gomoku/bdinit.c Mon May 16 19:55:58 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: bdinit.c,v 1.11 2022/05/15 22:56:20 rillig Exp $ */ +/* $NetBSD: bdinit.c,v 1.12 2022/05/16 19:55:58 rillig Exp $ */ /* * Copyright (c) 1994 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "from: @(#)bdinit.c 8.2 (Berkeley) 5/3/95"; #else -__RCSID("$NetBSD: bdinit.c,v 1.11 2022/05/15 22:56:20 rillig Exp $"); +__RCSID("$NetBSD: bdinit.c,v 1.12 2022/05/16 19:55:58 rillig Exp $"); #endif #endif /* not lint */ @@ -133,7 +133,7 @@ bdinit(struct spotstr *bp) if (sp->s_flags & (BFLAG << r)) continue; cbp->c_combo.s = sp->s_fval[BLACK][r].s; -cbp->c_vertex = sp - board; +cbp->c_vertex = (u_short)(sp - board); cbp->c_nframes = 1; cbp->c_dir = r; sp->s_frame[r] = cbp; @@ -213,7 +213,7 @@ init_overlap(void) break; if (sp2->s_flags & bmask) continue; - n = sp2->s_frame[r] - frames; + n = (int)(sp2->s_frame[r] - frames); ip[n] = vertex; str[n] |= (f == 5) ? mask & 0xA : mask; if (r == cbp->c_dir) { Index: src/games/gomoku/bdisp.c diff -u src/games/gomoku/bdisp.c:1.22 src/games/gomoku/bdisp.c:1.23 --- src/games/gomoku/bdisp.c:1.22 Sun May 15 22:56:20 2022 +++ src/games/gomoku/bdisp.c Mon May 16 19:55:58 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: bdisp.c,v 1.22 2022/05/15 22:56:20 rillig Exp $ */ +/* $NetBSD: bdisp.c,v 1.23 2022/05/16 19:55:58 rillig Exp $ */ /* * Copyright (c) 1994 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)bdisp.c 8.2 (Berkeley) 5/3/95"; #else -__RCSID("$NetBSD: bdisp.c,v 1.22 2022/05/15 22:56:20 rillig Exp $"); +__RCSID("$NetBSD: bdisp.c,v 1.23 2022/05/16 19:55:58 rillig Exp $"); #endif #endif /* not lint */ @@ -134,8 +134,8 @@ bdwho(int update) move(21, 0); printw(" "); - i = strlen(plyr[BLACK]); - j = strlen(plyr[WHITE]); + i = (int)strlen(plyr[BLACK]); + j = (int)strlen(plyr[WHITE]); if (i + j <= 20) { move(21, 10 - (i + j) / 2); printw("BLACK/%s (*) vs. WHITE/%s (O)", @@ -248,7 +248,7 @@ dislog(const char *str) void ask(const char *str) { - int len = strlen(str); + int len = (int)strlen(str); move(BSZ + 4, 0); addstr(str); Index: src/games/gomoku/main.c diff -u src/games/gomoku/main.c:1.31 src/games/gomoku/main.c:1.32 --- src/games/gomoku/main.c:1.31 Sun May 15 22:56:20 2022 +++ src/games/gomoku/main.c Mon May 16 19:55:58 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.31 2022/05/15 22:56:20 rillig Exp $ */ +/* $NetBSD: main.c,v 1.32 2022/05/16 19:55:58 rillig Exp $ */ /* * Copyright (c) 1994 @@ -42,7 +42,7 @@ __COPYRIGHT("@(#) Copyright (c) 1994\ #if 0 static char sccsid[] = "@(#)main.c 8.4 (Berkeley) 5/4/95"; #else -__RCSID("$NetBSD: main.c,v 1.31 2022/05/15 22:56:20 rillig Exp $"); +__RCSID("$NetBSD: main.c,v 1.32 2022/05/16 19:55:58 rillig Exp $"); #endif #endif /* not lint */ @@ -141,7 +141,7 @@ main(int argc, char **argv) } if (!debug) - srandom(time(0)); + srandom((unsigned int)time(0)); if (interactive) cursinit(); /* initialize curses */ again: Index: src/games/gomoku/makem
CVS commit: src/games/gomoku
Module Name:src Committed By: rillig Date: Mon May 16 19:55:58 UTC 2022 Modified Files: src/games/gomoku: Makefile bdinit.c bdisp.c main.c makemove.c pickmove.c Log Message: gomoku: fix lint warnings Most warnings were about implicit conversions from ptrdiff_t to int; add explicit cast for them, as they are far from overflowing int. The casts from one pointer type to 'struct combostr **' were indeed suspicious. In these cases, a single region of memory is allocated to store two objects of different type, without declaring a struct type for their combination. The second object is an array of variable size. No binary change. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/games/gomoku/Makefile cvs rdiff -u -r1.11 -r1.12 src/games/gomoku/bdinit.c cvs rdiff -u -r1.22 -r1.23 src/games/gomoku/bdisp.c cvs rdiff -u -r1.31 -r1.32 src/games/gomoku/main.c cvs rdiff -u -r1.13 -r1.14 src/games/gomoku/makemove.c cvs rdiff -u -r1.28 -r1.29 src/games/gomoku/pickmove.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/games/gomoku
Module Name:src Committed By: rillig Date: Mon May 16 19:20:25 UTC 2022 Modified Files: src/games/gomoku: pickmove.c Log Message: gomoku: condense code to decide which spot is better The comments in the conditions only serve to align the expressions, to allow humans to check that they correspond. No functional change. To generate a diff of this commit: cvs rdiff -u -r1.27 -r1.28 src/games/gomoku/pickmove.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/games/gomoku/pickmove.c diff -u src/games/gomoku/pickmove.c:1.27 src/games/gomoku/pickmove.c:1.28 --- src/games/gomoku/pickmove.c:1.27 Sun May 15 22:41:51 2022 +++ src/games/gomoku/pickmove.c Mon May 16 19:20:25 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: pickmove.c,v 1.27 2022/05/15 22:41:51 rillig Exp $ */ +/* $NetBSD: pickmove.c,v 1.28 2022/05/16 19:20:25 rillig Exp $ */ /* * Copyright (c) 1994 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)pickmove.c 8.2 (Berkeley) 5/3/95"; #else -__RCSID("$NetBSD: pickmove.c,v 1.27 2022/05/15 22:41:51 rillig Exp $"); +__RCSID("$NetBSD: pickmove.c,v 1.28 2022/05/16 19:20:25 rillig Exp $"); #endif #endif /* not lint */ @@ -194,43 +194,28 @@ better(const struct spotstr *sp, const s { int them, s, s1; - if (sp->s_combo[us].s < sp1->s_combo[us].s) - return 1; - if (sp->s_combo[us].s != sp1->s_combo[us].s) - return 0; - if (sp->s_level[us] < sp1->s_level[us]) - return 1; - if (sp->s_level[us] != sp1->s_level[us]) - return 0; - if (sp->s_nforce[us] > sp1->s_nforce[us]) - return 1; - if (sp->s_nforce[us] != sp1->s_nforce[us]) - return 0; + if (/* */ sp->s_combo[us].s != sp1->s_combo[us].s) + return sp->s_combo[us].s < sp1->s_combo[us].s; + if (/* */ sp->s_level[us] != sp1->s_level[us]) + return sp->s_level[us] < sp1->s_level[us]; + if (/* */ sp->s_nforce[us] != sp1->s_nforce[us]) + return sp->s_nforce[us] > sp1->s_nforce[us]; them = !us; s = sp - board; s1 = sp1 - board; - if (BIT_TEST(forcemap, s) && !BIT_TEST(forcemap, s1)) - return 1; - if (!BIT_TEST(forcemap, s) && BIT_TEST(forcemap, s1)) - return 0; - if (sp->s_combo[them].s < sp1->s_combo[them].s) - return 1; - if (sp->s_combo[them].s != sp1->s_combo[them].s) - return 0; - if (sp->s_level[them] < sp1->s_level[them]) - return 1; - if (sp->s_level[them] != sp1->s_level[them]) - return 0; - if (sp->s_nforce[them] > sp1->s_nforce[them]) - return 1; - if (sp->s_nforce[them] != sp1->s_nforce[them]) - return 0; + if ((BIT_TEST(forcemap, s) != 0) != (BIT_TEST(forcemap, s1) != 0)) + return BIT_TEST(forcemap, s) != 0; - if (sp->s_wval > sp1->s_wval) - return 1; - if (sp->s_wval != sp1->s_wval) - return 0; + if (/* */ sp->s_combo[them].s != sp1->s_combo[them].s) + return sp->s_combo[them].s < sp1->s_combo[them].s; + if (/* */ sp->s_level[them] != sp1->s_level[them]) + return sp->s_level[them] < sp1->s_level[them]; + if (/* */ sp->s_nforce[them] != sp1->s_nforce[them]) + return sp->s_nforce[them] > sp1->s_nforce[them]; + + if (/* */ sp->s_wval != sp1->s_wval) + return sp->s_wval > sp1->s_wval; return random() & 1; }
CVS commit: src/games/gomoku
Module Name:src Committed By: rillig Date: Mon May 16 19:20:25 UTC 2022 Modified Files: src/games/gomoku: pickmove.c Log Message: gomoku: condense code to decide which spot is better The comments in the conditions only serve to align the expressions, to allow humans to check that they correspond. No functional change. To generate a diff of this commit: cvs rdiff -u -r1.27 -r1.28 src/games/gomoku/pickmove.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.sbin/sysinst
Module Name:src Committed By: martin Date: Mon May 16 18:44:39 UTC 2022 Modified Files: src/usr.sbin/sysinst: disks.c msg.mi.de msg.mi.en msg.mi.es msg.mi.fr msg.mi.pl Log Message: Split the available disks (that may be partitioned) from the preconfigured wedges (that can be install target, but can not be partitioned). The latter are only usefull in special setups and clobber the list of available disks for the usual setup cases. To generate a diff of this commit: cvs rdiff -u -r1.79 -r1.80 src/usr.sbin/sysinst/disks.c cvs rdiff -u -r1.36 -r1.37 src/usr.sbin/sysinst/msg.mi.de cvs rdiff -u -r1.39 -r1.40 src/usr.sbin/sysinst/msg.mi.en cvs rdiff -u -r1.32 -r1.33 src/usr.sbin/sysinst/msg.mi.es cvs rdiff -u -r1.37 -r1.38 src/usr.sbin/sysinst/msg.mi.fr cvs rdiff -u -r1.38 -r1.39 src/usr.sbin/sysinst/msg.mi.pl Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/sysinst/disks.c diff -u src/usr.sbin/sysinst/disks.c:1.79 src/usr.sbin/sysinst/disks.c:1.80 --- src/usr.sbin/sysinst/disks.c:1.79 Sun May 15 18:27:35 2022 +++ src/usr.sbin/sysinst/disks.c Mon May 16 18:44:38 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: disks.c,v 1.79 2022/05/15 18:27:35 jmcneill Exp $ */ +/* $NetBSD: disks.c,v 1.80 2022/05/16 18:44:38 martin Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -874,14 +874,18 @@ find_disks(const char *doingwhat, bool a { struct disk_desc disks[MAX_DISKS]; /* need two more menu entries: current system + extended partitioning */ - menu_ent dsk_menu[__arraycount(disks) + 2]; + menu_ent dsk_menu[__arraycount(disks) + 2], + wedge_menu[__arraycount(dsk_menu)]; + int disk_no[__arraycount(dsk_menu)], wedge_no[__arraycount(dsk_menu)]; struct disk_desc *disk; - int i = 0, skipped = 0; + int i = 0, dno, wno, skipped = 0; int already_found, numdisks, selected_disk = -1; - int menu_no; + int menu_no, w_menu_no; struct pm_devs *pm_i, *pm_last = NULL; + bool any_wedges = false; memset(dsk_menu, 0, sizeof(dsk_menu)); + memset(wedge_menu, 0, sizeof(wedge_menu)); /* Find disks. */ numdisks = get_disks(disks, partman_go <= 0); @@ -906,49 +910,98 @@ find_disks(const char *doingwhat, bool a return -1; } else { /* One or more disks found or current system allowed */ - i = 0; + dno = wno = 0; if (allow_cur_system) { -dsk_menu[i].opt_name = MSG_running_system; -dsk_menu[i].opt_flags = OPT_EXIT; -dsk_menu[i].opt_action = set_menu_select; -i++; +dsk_menu[dno].opt_name = MSG_running_system; +dsk_menu[dno].opt_flags = OPT_EXIT; +dsk_menu[dno].opt_action = set_menu_select; +disk_no[dno] = -1; +i++; dno++; } - for (; i < numdisks+allow_cur_system; i++) { -dsk_menu[i].opt_name = -disks[i-allow_cur_system].dd_descr; -dsk_menu[i].opt_flags = OPT_EXIT; -dsk_menu[i].opt_action = set_menu_select; + for (i = 0; i < numdisks; i++) { +if (disks[i].dd_no_part) { + any_wedges = true; + wedge_menu[wno].opt_name = + disks[i].dd_descr; + wedge_menu[wno].opt_flags = OPT_EXIT; + wedge_menu[wno].opt_action = + set_menu_select; + wedge_no[wno] = i; + wno++; +} else { + dsk_menu[dno].opt_name = + disks[i].dd_descr; + dsk_menu[dno].opt_flags = OPT_EXIT; + dsk_menu[dno].opt_action = + set_menu_select; + disk_no[dno] = i; + dno++; +} + } + if (any_wedges) { +dsk_menu[dno].opt_name = MSG_selectwedge; +dsk_menu[dno].opt_flags = OPT_EXIT; +dsk_menu[dno].opt_action = set_menu_select; +disk_no[dno] = -2; +dno++; } if (partman_go < 0) { -dsk_menu[i].opt_name = MSG_partman; -dsk_menu[i].opt_flags = OPT_EXIT; -dsk_menu[i].opt_action = set_menu_select; -i++; +dsk_menu[dno].opt_name = MSG_partman; +dsk_menu[dno].opt_flags = OPT_EXIT; +dsk_menu[dno].opt_action = set_menu_select; +disk_no[dno] = -3; +dno++; } + w_menu_no = -1; menu_no = new_menu(MSG_Available_disks, -dsk_menu, i, -1, +dsk_menu, dno, -1, 4, 0, 0, MC_SCROLL, NULL, NULL, NULL, NULL, MSG_exit_menu_generic); if (menu_no == -1) return -1; - msg_fmt_display(MSG_ask_disk, "%s", doingwhat); - process_menu(menu_no, &selected_disk); - free_menu(menu_no); - if (allow_cur_system) { -if (selected_disk == 0) { - pm = dummy_whole_system_pm(); - return 1; -} else { - selected_disk--; + for (;;) { +msg_fmt_display(MSG_ask_disk, "%s", doingwhat); +i = -1; +process_menu(menu_no, &i); +if (disk_no[i] == -2) { + /* do wedges menu */ + if (w_menu_no == -1) { + w_menu_no = new_menu( + MSG_Available_wedges, + wedge_menu, wno, -1, + 4, 0, 0, MC_SCROLL, + NULL, NULL, NULL, NULL, + MSG_exit_menu_generic); + if (w_menu_no == -1) { + selected_disk = -1; + break; + } +
CVS commit: src/usr.sbin/sysinst
Module Name:src Committed By: martin Date: Mon May 16 18:44:39 UTC 2022 Modified Files: src/usr.sbin/sysinst: disks.c msg.mi.de msg.mi.en msg.mi.es msg.mi.fr msg.mi.pl Log Message: Split the available disks (that may be partitioned) from the preconfigured wedges (that can be install target, but can not be partitioned). The latter are only usefull in special setups and clobber the list of available disks for the usual setup cases. To generate a diff of this commit: cvs rdiff -u -r1.79 -r1.80 src/usr.sbin/sysinst/disks.c cvs rdiff -u -r1.36 -r1.37 src/usr.sbin/sysinst/msg.mi.de cvs rdiff -u -r1.39 -r1.40 src/usr.sbin/sysinst/msg.mi.en cvs rdiff -u -r1.32 -r1.33 src/usr.sbin/sysinst/msg.mi.es cvs rdiff -u -r1.37 -r1.38 src/usr.sbin/sysinst/msg.mi.fr cvs rdiff -u -r1.38 -r1.39 src/usr.sbin/sysinst/msg.mi.pl Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/sparc64/dev
Module Name:src Committed By: palle Date: Mon May 16 17:13:28 UTC 2022 Modified Files: src/sys/arch/sparc64/dev: vdsk.c Log Message: sun4v/vdsk: add handling of SCSI_REPORT_LUNS To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sys/arch/sparc64/dev/vdsk.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/sparc64/dev/vdsk.c diff -u src/sys/arch/sparc64/dev/vdsk.c:1.9 src/sys/arch/sparc64/dev/vdsk.c:1.10 --- src/sys/arch/sparc64/dev/vdsk.c:1.9 Sat Dec 4 13:23:03 2021 +++ src/sys/arch/sparc64/dev/vdsk.c Mon May 16 17:13:28 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: vdsk.c,v 1.9 2021/12/04 13:23:03 andvar Exp $ */ +/* $NetBSD: vdsk.c,v 1.10 2022/05/16 17:13:28 palle Exp $ */ /* $OpenBSD: vdsk.c,v 1.46 2015/01/25 21:42:13 kettenis Exp $ */ /* * Copyright (c) 2009, 2011 Mark Kettenis @@ -218,6 +218,7 @@ void vdsk_scsi_inq(struct vdsk_softc *sc void vdsk_scsi_inquiry(struct vdsk_softc *sc, struct scsipi_xfer *); void vdsk_scsi_capacity(struct vdsk_softc *sc, struct scsipi_xfer *); void vdsk_scsi_capacity16(struct vdsk_softc *sc, struct scsipi_xfer *); +void vdsk_scsi_report_luns(struct vdsk_softc *sc, struct scsipi_xfer *); void vdsk_scsi_done(struct scsipi_xfer *, int); int @@ -1048,6 +1049,10 @@ vdsk_scsi_cmd(struct vdsk_softc *sc, str vdsk_scsi_capacity16(sc, xs); return; + case SCSI_REPORT_LUNS: + vdsk_scsi_report_luns(sc, xs); + return; + case SCSI_TEST_UNIT_READY: case START_STOP: case SCSI_PREVENT_ALLOW_MEDIUM_REMOVAL: @@ -1333,6 +1338,12 @@ vdsk_scsi_capacity16(struct vdsk_softc * } void +vdsk_scsi_report_luns(struct vdsk_softc *sc, struct scsipi_xfer *xs) +{ + vdsk_scsi_done(xs, XS_NOERROR); +} + +void vdsk_scsi_done(struct scsipi_xfer *xs, int error) {
CVS commit: src/sys/arch/sparc64/dev
Module Name:src Committed By: palle Date: Mon May 16 17:13:28 UTC 2022 Modified Files: src/sys/arch/sparc64/dev: vdsk.c Log Message: sun4v/vdsk: add handling of SCSI_REPORT_LUNS To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sys/arch/sparc64/dev/vdsk.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sbin/cgdconfig
Module Name:src Committed By: christos Date: Mon May 16 14:57:44 UTC 2022 Modified Files: src/sbin/cgdconfig: Makefile Log Message: make things behave just like before the libcrypt symbol renaming: The normal cgdconfig binary is built with threads and the crunched one in rescue without. To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/sbin/cgdconfig/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/cgdconfig/Makefile diff -u src/sbin/cgdconfig/Makefile:1.19 src/sbin/cgdconfig/Makefile:1.20 --- src/sbin/cgdconfig/Makefile:1.19 Mon May 16 06:44:06 2022 +++ src/sbin/cgdconfig/Makefile Mon May 16 10:57:44 2022 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.19 2022/05/16 10:44:06 christos Exp $ +# $NetBSD: Makefile,v 1.20 2022/05/16 14:57:44 christos Exp $ RUMPPRG=cgdconfig MAN= cgdconfig.8 @@ -24,9 +24,14 @@ ARGON2DIR= ${NETBSDSRCDIR}/external/apac CPPFLAGS+= -I${ARGON2DIR}/include -I${ARGON2DIR}/src/blake2 CPPFLAGS+= -DHAVE_ARGON2 .PATH.c: ${ARGON2DIR}/src ${ARGON2DIR}/src/blake2 -SRCS+= argon2_utils.c argon2.c core.c encoding.c ref.c blake2b.c thread.c -DPADD+= ${LIBPTHREAD} -LDADD+= -lpthread +SRCS+= argon2_utils.c argon2.c core.c encoding.c ref.c blake2b.c +. if defined(CRUNCHEDPROG) +CPPFLAGS+= -DARGON2_NO_THREADS +. else +SRCS+= thread.c +DPADD+= ${LIBPTHREAD} +LDADD+= -lpthread +. endif .endif .include
CVS commit: src/sbin/cgdconfig
Module Name:src Committed By: christos Date: Mon May 16 14:57:44 UTC 2022 Modified Files: src/sbin/cgdconfig: Makefile Log Message: make things behave just like before the libcrypt symbol renaming: The normal cgdconfig binary is built with threads and the crunched one in rescue without. To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/sbin/cgdconfig/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/rescue
Module Name:src Committed By: christos Date: Mon May 16 14:55:56 UTC 2022 Modified Files: src/rescue: list Log Message: remove threads; size constraints and behavioral change To generate a diff of this commit: cvs rdiff -u -r1.54 -r1.55 src/rescue/list Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/rescue/list diff -u src/rescue/list:1.54 src/rescue/list:1.55 --- src/rescue/list:1.54 Mon May 16 06:52:09 2022 +++ src/rescue/list Mon May 16 10:55:56 2022 @@ -1,4 +1,4 @@ -# $NetBSD: list,v 1.54 2022/05/16 10:52:09 christos Exp $ +# $NetBSD: list,v 1.55 2022/05/16 14:55:56 christos Exp $ SRCDIRS bin @@ -153,4 +153,4 @@ SRCDIRS libexec PROG lfs_cleanerd LIBS liboverride.o -LIBS -lbz2 -llzma -lcrypt -ledit -lipsec -lkvm -ll -lm -lrmt -lcurses -lterminfo -lutil -lz -levent -lprop -lpthread +LIBS -lbz2 -llzma -lcrypt -ledit -lipsec -lkvm -ll -lm -lrmt -lcurses -lterminfo -lutil -lz -levent -lprop
CVS commit: src/rescue
Module Name:src Committed By: christos Date: Mon May 16 14:55:56 UTC 2022 Modified Files: src/rescue: list Log Message: remove threads; size constraints and behavioral change To generate a diff of this commit: cvs rdiff -u -r1.54 -r1.55 src/rescue/list Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Re: CVS commit: src/sbin/cgdconfig
Date:Mon, 16 May 2022 09:10:40 + From:Taylor R Campbell Message-ID: <20220516090946.a3c4660...@jupiter.mumble.net> | > Please re-enable threads. They influence the output hash | > so by disabling threads you stop people from being able | > to decrypt their disks. | | Surely `disabling threads' just means cgdconfig can't take advantage | of parallelism to compute the same function in less time, not that | cgdconfig computes a different function or fails to compute the same | function, no? I agree, the issue, whatever it was that nia saw, is far more likely caused by the namespace changes influencing just what functions are getting called, in an unintended way, than by anything related to threading. Can we have threads back the way they were last week? That is not race around adding -lpthread to every static link that exists, most likely breaking some size limits along the way. Then, once things build again, if there is a problem, we can debug it, rather than just guessing. kre
Re: CVS commit: src/sbin/cgdconfig
> On May 16, 2022, at 5:10 AM, Taylor R Campbell wrote: > >> Date: Mon, 16 May 2022 04:49:22 + >> From: nia >> >> On Sun, May 15, 2022 at 03:53:27PM -0400, Christos Zoulas wrote: >>> Log Message: >>> Build argon2 inline so that crunched programs work. I also disabled threads >>> for now; we can put them back if needed. >> >> Please re-enable threads. They influence the output hash >> so by disabling threads you stop people from being able >> to decrypt their disks. > > Surely `disabling threads' just means cgdconfig can't take advantage > of parallelism to compute the same function in less time, not that > cgdconfig computes a different function or fails to compute the same > function, no? > > I agree threads should be re-enabled, but maybe it would be reasonable > to find a way to conditionalize this on crunchgen/rescue/whatever if > that gets in the way. > > Christos, can you write down the problems that led to making this > commit? The commit message doesn't explain any of what went wrong so > I don't even know what to look for when putting threads back. It is simple. You just take out the cpp define to disable and add thread.c to the list of files to be built and -lpthread. The reason I changed the build in cgdconfig from reaching out to libargon2 and using the pre-built library to explicitly building the necessary objects locally was that I did not want to teach rescue about libargon2. I just disabled threads in the process because it was the same way done in libcrypt. I didn't expect that this would produce different results. Rescue was not threaded before but now I had to add -lpthread for it to link. The whole thing is very weird. It all started with me protecting all the extra symbols that libargon2 exposed to libcrypt. This in turn made cgdconfig not link in rescue because it was missing argon2_hash which before it was resolving from libcrypt. Which means that the cgdconfig in rescue was built without threads before... What a mess. christos signature.asc Description: Message signed with OpenPGP
CVS commit: src/bin/kill
Module Name:src Committed By: kre Date: Mon May 16 10:53:14 UTC 2022 Modified Files: src/bin/kill: kill.c Log Message: Alter error messages so they no longer claim that bad input is illegal. To generate a diff of this commit: cvs rdiff -u -r1.32 -r1.33 src/bin/kill/kill.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/bin/kill/kill.c diff -u src/bin/kill/kill.c:1.32 src/bin/kill/kill.c:1.33 --- src/bin/kill/kill.c:1.32 Sun Aug 30 19:35:09 2020 +++ src/bin/kill/kill.c Mon May 16 10:53:14 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: kill.c,v 1.32 2020/08/30 19:35:09 kre Exp $ */ +/* $NetBSD: kill.c,v 1.33 2022/05/16 10:53:14 kre Exp $ */ /* * Copyright (c) 1988, 1993, 1994 @@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 19 #if 0 static char sccsid[] = "@(#)kill.c 8.4 (Berkeley) 4/28/95"; #else -__RCSID("$NetBSD: kill.c,v 1.32 2020/08/30 19:35:09 kre Exp $"); +__RCSID("$NetBSD: kill.c,v 1.33 2022/05/16 10:53:14 kre Exp $"); #endif #endif /* not lint */ @@ -181,7 +181,7 @@ main(int argc, char *argv[]) if (*argv[0] == '%') { pid = getjobpgrp(*argv); if (pid == 0) { -warnx("illegal job id: %s", *argv); +warnx("bad job id: %s", *argv); errors = 1; continue; } @@ -221,7 +221,7 @@ signum(const char *sn) /* check for correctly parsed number */ if (*ep || n <= INT_MIN || n >= INT_MAX ) - errx(EXIT_FAILURE, "illegal signal number: %s", sn); + errx(EXIT_FAILURE, "bad signal number: %s", sn); /* NOTREACHED */ return (int)n; @@ -239,7 +239,7 @@ processnum(const char *s, pid_t *pid) /* check for correctly parsed number */ if (ep == s || *ep || n == INTMAX_MIN || n == INTMAX_MAX || (pid_t)n != n || errno != 0) { - warnx("illegal process%s id: '%s'", (n < 0 ? " group" : ""), s); + warnx("bad process%s id: '%s'", (n < 0 ? " group" : ""), s); return -1; }
CVS commit: src/bin/kill
Module Name:src Committed By: kre Date: Mon May 16 10:53:14 UTC 2022 Modified Files: src/bin/kill: kill.c Log Message: Alter error messages so they no longer claim that bad input is illegal. To generate a diff of this commit: cvs rdiff -u -r1.32 -r1.33 src/bin/kill/kill.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/rescue
Module Name:src Committed By: christos Date: Mon May 16 10:52:09 UTC 2022 Modified Files: src/rescue: list Log Message: Add -lpthread for the benefit or argon2 in cgdconfig To generate a diff of this commit: cvs rdiff -u -r1.53 -r1.54 src/rescue/list Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/rescue
Module Name:src Committed By: christos Date: Mon May 16 10:52:09 UTC 2022 Modified Files: src/rescue: list Log Message: Add -lpthread for the benefit or argon2 in cgdconfig To generate a diff of this commit: cvs rdiff -u -r1.53 -r1.54 src/rescue/list Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/rescue/list diff -u src/rescue/list:1.53 src/rescue/list:1.54 --- src/rescue/list:1.53 Sat Apr 4 11:39:16 2020 +++ src/rescue/list Mon May 16 06:52:09 2022 @@ -1,4 +1,4 @@ -# $NetBSD: list,v 1.53 2020/04/04 15:39:16 jdolecek Exp $ +# $NetBSD: list,v 1.54 2022/05/16 10:52:09 christos Exp $ SRCDIRS bin @@ -153,4 +153,4 @@ SRCDIRS libexec PROG lfs_cleanerd LIBS liboverride.o -LIBS -lbz2 -llzma -lcrypt -ledit -lipsec -lkvm -ll -lm -lrmt -lcurses -lterminfo -lutil -lz -levent -lprop +LIBS -lbz2 -llzma -lcrypt -ledit -lipsec -lkvm -ll -lm -lrmt -lcurses -lterminfo -lutil -lz -levent -lprop -lpthread
CVS commit: src/sbin/cgdconfig
Module Name:src Committed By: christos Date: Mon May 16 10:44:06 UTC 2022 Modified Files: src/sbin/cgdconfig: Makefile Log Message: Re-enable threads; apparently we get different results depending if we are threaded or not... This tastes like a bug. To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.19 src/sbin/cgdconfig/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/cgdconfig/Makefile diff -u src/sbin/cgdconfig/Makefile:1.18 src/sbin/cgdconfig/Makefile:1.19 --- src/sbin/cgdconfig/Makefile:1.18 Sun May 15 15:53:27 2022 +++ src/sbin/cgdconfig/Makefile Mon May 16 06:44:06 2022 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.18 2022/05/15 19:53:27 christos Exp $ +# $NetBSD: Makefile,v 1.19 2022/05/16 10:44:06 christos Exp $ RUMPPRG=cgdconfig MAN= cgdconfig.8 @@ -22,9 +22,11 @@ LDADD= -lutil -lcrypt -ly -ll .if ${MKARGON2} != "no" ARGON2DIR= ${NETBSDSRCDIR}/external/apache2/argon2/dist/phc-winner-argon2 CPPFLAGS+= -I${ARGON2DIR}/include -I${ARGON2DIR}/src/blake2 -CPPFLAGS+= -DHAVE_ARGON2 -DARGON2_NO_THREADS +CPPFLAGS+= -DHAVE_ARGON2 .PATH.c: ${ARGON2DIR}/src ${ARGON2DIR}/src/blake2 -SRCS+= argon2_utils.c argon2.c core.c encoding.c ref.c blake2b.c +SRCS+= argon2_utils.c argon2.c core.c encoding.c ref.c blake2b.c thread.c +DPADD+= ${LIBPTHREAD} +LDADD+= -lpthread .endif .include
CVS commit: src/sbin/cgdconfig
Module Name:src Committed By: christos Date: Mon May 16 10:44:06 UTC 2022 Modified Files: src/sbin/cgdconfig: Makefile Log Message: Re-enable threads; apparently we get different results depending if we are threaded or not... This tastes like a bug. To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.19 src/sbin/cgdconfig/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/sdmmc
Module Name:src Committed By: jmcneill Date: Mon May 16 10:03:23 UTC 2022 Modified Files: src/sys/dev/sdmmc: ld_sdmmc.c Log Message: sdmmc: ld: Include the card type (SD card, MMC) in the disk description. To generate a diff of this commit: cvs rdiff -u -r1.41 -r1.42 src/sys/dev/sdmmc/ld_sdmmc.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/sdmmc/ld_sdmmc.c diff -u src/sys/dev/sdmmc/ld_sdmmc.c:1.41 src/sys/dev/sdmmc/ld_sdmmc.c:1.42 --- src/sys/dev/sdmmc/ld_sdmmc.c:1.41 Sun Aug 2 01:17:56 2020 +++ src/sys/dev/sdmmc/ld_sdmmc.c Mon May 16 10:03:23 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: ld_sdmmc.c,v 1.41 2020/08/02 01:17:56 riastradh Exp $ */ +/* $NetBSD: ld_sdmmc.c,v 1.42 2022/05/16 10:03:23 jmcneill Exp $ */ /* * Copyright (c) 2008 KIYOHARA Takashi @@ -28,7 +28,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ld_sdmmc.c,v 1.41 2020/08/02 01:17:56 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ld_sdmmc.c,v 1.42 2022/05/16 10:03:23 jmcneill Exp $"); #ifdef _KERNEL_OPT #include "opt_sdmmc.h" @@ -247,6 +247,7 @@ ld_sdmmc_attach(device_t parent, device_ struct ld_softc *ld = &sc->sc_ld; struct ld_sdmmc_task *task; struct lwp *lwp; + const char *cardtype; int i; ld->sc_dv = self; @@ -256,8 +257,13 @@ ld_sdmmc_attach(device_t parent, device_ sa->sf->cid.rev, sa->sf->cid.psn, sa->sf->cid.mdt); aprint_naive("\n"); - sc->sc_typename = kmem_asprintf("0x%02x:0x%04x:%s", - sa->sf->cid.mid, sa->sf->cid.oid, sa->sf->cid.pnm); + if (ISSET(sa->sf->sc->sc_flags, SMF_SD_MODE)) { + cardtype = "SD card"; + } else { + cardtype = "MMC"; + } + sc->sc_typename = kmem_asprintf("%s 0x%02x:0x%04x:%s", + cardtype, sa->sf->cid.mid, sa->sf->cid.oid, sa->sf->cid.pnm); evcnt_attach_dynamic(&sc->sc_ev_discard, EVCNT_TYPE_MISC, NULL, device_xname(self), "sdmmc discard count");
CVS commit: src/sys/dev/sdmmc
Module Name:src Committed By: jmcneill Date: Mon May 16 10:03:23 UTC 2022 Modified Files: src/sys/dev/sdmmc: ld_sdmmc.c Log Message: sdmmc: ld: Include the card type (SD card, MMC) in the disk description. To generate a diff of this commit: cvs rdiff -u -r1.41 -r1.42 src/sys/dev/sdmmc/ld_sdmmc.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys
Module Name:src Committed By: jmcneill Date: Mon May 16 09:42:32 UTC 2022 Modified Files: src/sys/arch/arm/acpi: cpu_acpi.c src/sys/dev/tprof: tprof_armv8.c tprof_armv8.h Log Message: tprof: armv8: Only attach to known PMU types. To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/sys/arch/arm/acpi/cpu_acpi.c cvs rdiff -u -r1.13 -r1.14 src/sys/dev/tprof/tprof_armv8.c cvs rdiff -u -r1.1 -r1.2 src/sys/dev/tprof/tprof_armv8.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/arm/acpi/cpu_acpi.c diff -u src/sys/arch/arm/acpi/cpu_acpi.c:1.13 src/sys/arch/arm/acpi/cpu_acpi.c:1.14 --- src/sys/arch/arm/acpi/cpu_acpi.c:1.13 Thu Nov 25 09:36:20 2021 +++ src/sys/arch/arm/acpi/cpu_acpi.c Mon May 16 09:42:32 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: cpu_acpi.c,v 1.13 2021/11/25 09:36:20 skrll Exp $ */ +/* $NetBSD: cpu_acpi.c,v 1.14 2022/05/16 09:42:32 jmcneill Exp $ */ /*- * Copyright (c) 2018 The NetBSD Foundation, Inc. @@ -33,7 +33,7 @@ #include "opt_multiprocessor.h" #include -__KERNEL_RCSID(0, "$NetBSD: cpu_acpi.c,v 1.13 2021/11/25 09:36:20 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cpu_acpi.c,v 1.14 2022/05/16 09:42:32 jmcneill Exp $"); #include #include @@ -135,7 +135,7 @@ cpu_acpi_attach(device_t parent, device_ cpu_attach(self, mpidr); #if NTPROF > 0 - if (cpu_mpidr_aff_read() == mpidr) + if (cpu_mpidr_aff_read() == mpidr && armv8_pmu_detect()) config_interrupts(self, cpu_acpi_tprof_init); #endif } Index: src/sys/dev/tprof/tprof_armv8.c diff -u src/sys/dev/tprof/tprof_armv8.c:1.13 src/sys/dev/tprof/tprof_armv8.c:1.14 --- src/sys/dev/tprof/tprof_armv8.c:1.13 Fri Dec 3 10:54:19 2021 +++ src/sys/dev/tprof/tprof_armv8.c Mon May 16 09:42:32 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: tprof_armv8.c,v 1.13 2021/12/03 10:54:19 skrll Exp $ */ +/* $NetBSD: tprof_armv8.c,v 1.14 2022/05/16 09:42:32 jmcneill Exp $ */ /*- * Copyright (c) 2018 Jared McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: tprof_armv8.c,v 1.13 2021/12/03 10:54:19 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tprof_armv8.c,v 1.14 2022/05/16 09:42:32 jmcneill Exp $"); #include #include @@ -220,9 +220,21 @@ armv8_pmu_init_cpu(void *arg1, void *arg reg_pmcntenclr_el0_write(PMCNTEN_P); } +bool +armv8_pmu_detect(void) +{ + const uint64_t dfr0 = reg_id_aa64dfr0_el1_read(); + const u_int pmuver = __SHIFTOUT(dfr0, ID_AA64DFR0_EL1_PMUVER); + + return pmuver != ID_AA64DFR0_EL1_PMUVER_NONE && + pmuver != ID_AA64DFR0_EL1_PMUVER_IMPL; +} + int armv8_pmu_init(void) { + KASSERT(armv8_pmu_detect()); + uint64_t xc = xc_broadcast(0, armv8_pmu_init_cpu, NULL, NULL); xc_wait(xc); Index: src/sys/dev/tprof/tprof_armv8.h diff -u src/sys/dev/tprof/tprof_armv8.h:1.1 src/sys/dev/tprof/tprof_armv8.h:1.2 --- src/sys/dev/tprof/tprof_armv8.h:1.1 Sun Jul 15 16:05:24 2018 +++ src/sys/dev/tprof/tprof_armv8.h Mon May 16 09:42:32 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: tprof_armv8.h,v 1.1 2018/07/15 16:05:24 jmcneill Exp $ */ +/* $NetBSD: tprof_armv8.h,v 1.2 2022/05/16 09:42:32 jmcneill Exp $ */ /*- * Copyright (c) 2018 Jared McNeill @@ -29,6 +29,7 @@ #ifndef _DEV_TPROF_TPROF_ARMV8_H #define _DEV_TPROF_TPROF_ARMV8_H +bool armv8_pmu_detect(void); int armv8_pmu_intr(void *); int armv8_pmu_init(void);
CVS commit: src/sys
Module Name:src Committed By: jmcneill Date: Mon May 16 09:42:32 UTC 2022 Modified Files: src/sys/arch/arm/acpi: cpu_acpi.c src/sys/dev/tprof: tprof_armv8.c tprof_armv8.h Log Message: tprof: armv8: Only attach to known PMU types. To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/sys/arch/arm/acpi/cpu_acpi.c cvs rdiff -u -r1.13 -r1.14 src/sys/dev/tprof/tprof_armv8.c cvs rdiff -u -r1.1 -r1.2 src/sys/dev/tprof/tprof_armv8.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Re: CVS commit: src/sbin/cgdconfig
> Date: Mon, 16 May 2022 04:49:22 + > From: nia > > On Sun, May 15, 2022 at 03:53:27PM -0400, Christos Zoulas wrote: > > Log Message: > > Build argon2 inline so that crunched programs work. I also disabled threads > > for now; we can put them back if needed. > > Please re-enable threads. They influence the output hash > so by disabling threads you stop people from being able > to decrypt their disks. Surely `disabling threads' just means cgdconfig can't take advantage of parallelism to compute the same function in less time, not that cgdconfig computes a different function or fails to compute the same function, no? I agree threads should be re-enabled, but maybe it would be reasonable to find a way to conditionalize this on crunchgen/rescue/whatever if that gets in the way. Christos, can you write down the problems that led to making this commit? The commit message doesn't explain any of what went wrong so I don't even know what to look for when putting threads back.
CVS commit: src/sys/arch/arm/arm
Module Name:src Committed By: skrll Date: Mon May 16 07:07:17 UTC 2022 Modified Files: src/sys/arch/arm/arm: cpufunc.c Log Message: port-arm/50635: arm11_setup() cpuctrlmask value causes CPU_CONTROL_VECRELOC bit to toggle Fix slightly differently to as suggested in the PR. Annotate arm10_setup while I'm here. To generate a diff of this commit: cvs rdiff -u -r1.183 -r1.184 src/sys/arch/arm/arm/cpufunc.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/arm/arm/cpufunc.c diff -u src/sys/arch/arm/arm/cpufunc.c:1.183 src/sys/arch/arm/arm/cpufunc.c:1.184 --- src/sys/arch/arm/arm/cpufunc.c:1.183 Sat Nov 27 08:51:01 2021 +++ src/sys/arch/arm/arm/cpufunc.c Mon May 16 07:07:17 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: cpufunc.c,v 1.183 2021/11/27 08:51:01 skrll Exp $ */ +/* $NetBSD: cpufunc.c,v 1.184 2022/05/16 07:07:17 skrll Exp $ */ /* * arm7tdmi support code Copyright (c) 2001 John Fremlin @@ -49,7 +49,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: cpufunc.c,v 1.183 2021/11/27 08:51:01 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cpufunc.c,v 1.184 2022/05/16 07:07:17 skrll Exp $"); #include "opt_arm_start.h" #include "opt_compat_netbsd.h" @@ -2713,7 +2713,7 @@ arm10_setup(char *args) | CPU_CONTROL_IC_ENABLE | CPU_CONTROL_DC_ENABLE | CPU_CONTROL_WBUF_ENABLE | CPU_CONTROL_ROM_ENABLE | CPU_CONTROL_BEND_ENABLE | CPU_CONTROL_AFLT_ENABLE - | CPU_CONTROL_BPRD_ENABLE + | CPU_CONTROL_BPRD_ENABLE | CPU_CONTROL_VECRELOC | CPU_CONTROL_ROUNDROBIN | CPU_CONTROL_CPCLK; #endif @@ -2776,7 +2776,8 @@ arm11_setup(char *args) int cpuctrlmask = cpuctrl | CPU_CONTROL_ROM_ENABLE | CPU_CONTROL_BPRD_ENABLE | CPU_CONTROL_BEND_ENABLE | CPU_CONTROL_AFLT_ENABLE - | CPU_CONTROL_ROUNDROBIN | CPU_CONTROL_CPCLK; + | CPU_CONTROL_ROUNDROBIN | CPU_CONTROL_CPCLK + | CPU_CONTROL_VECRELOC; #ifndef ARM32_DISABLE_ALIGNMENT_FAULTS cpuctrl |= CPU_CONTROL_AFLT_ENABLE;
CVS commit: src/sys/arch/arm/arm
Module Name:src Committed By: skrll Date: Mon May 16 07:07:17 UTC 2022 Modified Files: src/sys/arch/arm/arm: cpufunc.c Log Message: port-arm/50635: arm11_setup() cpuctrlmask value causes CPU_CONTROL_VECRELOC bit to toggle Fix slightly differently to as suggested in the PR. Annotate arm10_setup while I'm here. To generate a diff of this commit: cvs rdiff -u -r1.183 -r1.184 src/sys/arch/arm/arm/cpufunc.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.