CVS commit: src/sys/dev/pci
Module Name:src Committed By: skrll Date: Sat Jul 2 06:10:29 UTC 2022 Modified Files: src/sys/dev/pci: if_wm.c Log Message: Use PRIxBIT instead of casts To generate a diff of this commit: cvs rdiff -u -r1.734 -r1.735 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.734 src/sys/dev/pci/if_wm.c:1.735 --- src/sys/dev/pci/if_wm.c:1.734 Sat Jul 2 06:09:37 2022 +++ src/sys/dev/pci/if_wm.c Sat Jul 2 06:10:29 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: if_wm.c,v 1.734 2022/07/02 06:09:37 skrll Exp $ */ +/* $NetBSD: if_wm.c,v 1.735 2022/07/02 06:10:29 skrll Exp $ */ /* * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc. @@ -82,7 +82,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.734 2022/07/02 06:09:37 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.735 2022/07/02 06:10:29 skrll Exp $"); #ifdef _KERNEL_OPT #include "opt_net_mpsafe.h" @@ -9955,9 +9955,9 @@ wm_intr_legacy(void *arg) #if defined(WM_DEBUG) || defined(WM_EVENT_COUNTERS) if (icr & (ICR_RXDMT0 | ICR_RXT0)) { DPRINTF(sc, WM_DEBUG_RX, - ("%s: RX: got Rx intr 0x%08x\n", + ("%s: RX: got Rx intr 0x" PRIxBIT "\n", device_xname(sc->sc_dev), - icr & (uint32_t)(ICR_RXDMT0 | ICR_RXT0))); + icr & (ICR_RXDMT0 | ICR_RXT0))); WM_Q_EVCNT_INCR(rxq, intr); } #endif @@ -12555,8 +12555,8 @@ wm_tbi_mediachange(struct ifnet *ifp) status = CSR_READ(sc, WMREG_STATUS); DPRINTF(sc, WM_DEBUG_LINK, - ("%s: status after final read = 0x%x, STATUS_LU = 0x%x\n", - device_xname(sc->sc_dev), status, (uint32_t)STATUS_LU)); + ("%s: status after final read = 0x%x, STATUS_LU = 0x" PRIxBIT "\n", + device_xname(sc->sc_dev), status, STATUS_LU)); if (status & STATUS_LU) { /* Link is up. */ DPRINTF(sc, WM_DEBUG_LINK,
CVS commit: src/sys/dev/pci
Module Name:src Committed By: skrll Date: Sat Jul 2 06:10:29 UTC 2022 Modified Files: src/sys/dev/pci: if_wm.c Log Message: Use PRIxBIT instead of casts To generate a diff of this commit: cvs rdiff -u -r1.734 -r1.735 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: skrll Date: Sat Jul 2 06:09:37 UTC 2022 Modified Files: src/sys/dev/pci: if_wm.c Log Message: wm_tick: Add missing splx(s) when not WM_MPSAFE To generate a diff of this commit: cvs rdiff -u -r1.733 -r1.734 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.733 src/sys/dev/pci/if_wm.c:1.734 --- src/sys/dev/pci/if_wm.c:1.733 Thu May 19 02:23:59 2022 +++ src/sys/dev/pci/if_wm.c Sat Jul 2 06:09:37 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: if_wm.c,v 1.733 2022/05/19 02:23:59 msaitoh Exp $ */ +/* $NetBSD: if_wm.c,v 1.734 2022/07/02 06:09:37 skrll Exp $ */ /* * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc. @@ -82,7 +82,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.733 2022/05/19 02:23:59 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.734 2022/07/02 06:09:37 skrll Exp $"); #ifdef _KERNEL_OPT #include "opt_net_mpsafe.h" @@ -3490,6 +3490,9 @@ wm_tick(void *arg) wm_tbi_tick(sc); WM_CORE_UNLOCK(sc); +#ifndef WM_MPSAFE + splx(s); +#endif wm_watchdog(ifp);
CVS commit: src/sys/dev/pci
Module Name:src Committed By: skrll Date: Sat Jul 2 06:09:37 UTC 2022 Modified Files: src/sys/dev/pci: if_wm.c Log Message: wm_tick: Add missing splx(s) when not WM_MPSAFE To generate a diff of this commit: cvs rdiff -u -r1.733 -r1.734 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/arch/arm/ti
Module Name:src Committed By: skrll Date: Sat Jul 2 05:04:36 UTC 2022 Modified Files: src/sys/arch/arm/ti: ti_lcdc.c Log Message: sort previous To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/sys/arch/arm/ti/ti_lcdc.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/arm/ti
Module Name:src Committed By: skrll Date: Sat Jul 2 05:04:36 UTC 2022 Modified Files: src/sys/arch/arm/ti: ti_lcdc.c Log Message: sort previous To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/sys/arch/arm/ti/ti_lcdc.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/ti/ti_lcdc.c diff -u src/sys/arch/arm/ti/ti_lcdc.c:1.12 src/sys/arch/arm/ti/ti_lcdc.c:1.13 --- src/sys/arch/arm/ti/ti_lcdc.c:1.12 Sat Jul 2 05:03:36 2022 +++ src/sys/arch/arm/ti/ti_lcdc.c Sat Jul 2 05:04:36 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: ti_lcdc.c,v 1.12 2022/07/02 05:03:36 skrll Exp $ */ +/* $NetBSD: ti_lcdc.c,v 1.13 2022/07/02 05:04:36 skrll Exp $ */ /*- * Copyright (c) 2019 Jared D. McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ti_lcdc.c,v 1.12 2022/07/02 05:03:36 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ti_lcdc.c,v 1.13 2022/07/02 05:04:36 skrll Exp $"); #include #include @@ -44,8 +44,8 @@ __KERNEL_RCSID(0, "$NetBSD: ti_lcdc.c,v #include #include #include -#include #include +#include #include #include
CVS commit: src/sys/arch/arm/ti
Module Name:src Committed By: skrll Date: Sat Jul 2 05:03:37 UTC 2022 Modified Files: src/sys/arch/arm/ti: ti_lcdc.c Log Message: Make this compile again. To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/sys/arch/arm/ti/ti_lcdc.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/arm/ti
Module Name:src Committed By: skrll Date: Sat Jul 2 05:03:37 UTC 2022 Modified Files: src/sys/arch/arm/ti: ti_lcdc.c Log Message: Make this compile again. To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/sys/arch/arm/ti/ti_lcdc.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/ti/ti_lcdc.c diff -u src/sys/arch/arm/ti/ti_lcdc.c:1.11 src/sys/arch/arm/ti/ti_lcdc.c:1.12 --- src/sys/arch/arm/ti/ti_lcdc.c:1.11 Thu Apr 21 21:22:25 2022 +++ src/sys/arch/arm/ti/ti_lcdc.c Sat Jul 2 05:03:36 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: ti_lcdc.c,v 1.11 2022/04/21 21:22:25 andvar Exp $ */ +/* $NetBSD: ti_lcdc.c,v 1.12 2022/07/02 05:03:36 skrll Exp $ */ /*- * Copyright (c) 2019 Jared D. McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ti_lcdc.c,v 1.11 2022/04/21 21:22:25 andvar Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ti_lcdc.c,v 1.12 2022/07/02 05:03:36 skrll Exp $"); #include #include @@ -44,6 +44,7 @@ __KERNEL_RCSID(0, "$NetBSD: ti_lcdc.c,v #include #include #include +#include #include #include #include
CVS commit: src/sys/external/bsd/drm2/include/drm
Module Name:src Committed By: skrll Date: Sat Jul 2 04:37:15 UTC 2022 Modified Files: src/sys/external/bsd/drm2/include/drm: drm_gem_cma_helper.h Log Message: Add a missing ';' To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 \ src/sys/external/bsd/drm2/include/drm/drm_gem_cma_helper.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/external/bsd/drm2/include/drm/drm_gem_cma_helper.h diff -u src/sys/external/bsd/drm2/include/drm/drm_gem_cma_helper.h:1.3 src/sys/external/bsd/drm2/include/drm/drm_gem_cma_helper.h:1.4 --- src/sys/external/bsd/drm2/include/drm/drm_gem_cma_helper.h:1.3 Sat Jul 2 00:26:07 2022 +++ src/sys/external/bsd/drm2/include/drm/drm_gem_cma_helper.h Sat Jul 2 04:37:15 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: drm_gem_cma_helper.h,v 1.3 2022/07/02 00:26:07 riastradh Exp $ */ +/* $NetBSD: drm_gem_cma_helper.h,v 1.4 2022/07/02 04:37:15 skrll Exp $ */ /*- * Copyright (c) 2022 The NetBSD Foundation, Inc. @@ -38,7 +38,7 @@ #include -struct dma_buf_attachment +struct dma_buf_attachment; struct drm_device; struct drm_file; struct drm_gem_cma_object;
CVS commit: src/sys/external/bsd/drm2/include/drm
Module Name:src Committed By: skrll Date: Sat Jul 2 04:37:15 UTC 2022 Modified Files: src/sys/external/bsd/drm2/include/drm: drm_gem_cma_helper.h Log Message: Add a missing ';' To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 \ src/sys/external/bsd/drm2/include/drm/drm_gem_cma_helper.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/external/bsd/drm2
Module Name:src Committed By: riastradh Date: Sat Jul 2 00:26:07 UTC 2022 Modified Files: src/sys/external/bsd/drm2/drm: drm_gem_cma_helper.c src/sys/external/bsd/drm2/include/drm: drm_gem_cma_helper.h Log Message: drm: Rewrite drm_gem_cma_helper.h from scratch. The header file was originally part of drm with no licence text, which I took to mean BSD-licensed like the rest of the Linux drm code base is by default -- everything in Linux under include/drm and drivers/gpu/drm not otherwise marked. In 2017, a tree-wide automated change was applied to Linux which caused an SPDX GPL header to appear in drm_gem_cma_helper.h. When I asked the drm developers about this in drm files, they explained that it was an automated process and many of the SPDX headers were wrong, so when excluding GPL files in drm updates, I heeded the actual GPL vs BSD/MIT licence text and revision history rather than the SPDX headers. I excluded drm_gem_cma_helper.c because it was clearly originally GPL as an exception to the default BSD licence under Linux's drivers/gpu/drm, and Jared reimplemented the API for ues by some (NetBSD, BSD-licensed) Arm display drivers. During an update after that, the header file was lost in the merge shuffle and I copied it back in without noticing the SPDX header file. In retrospect, I see now that it's not clear what the intent was: the .c file was obviously GPL, and maybe the .h file was supposed to be too but it wasn't carved out as an exception among the drm code. To keep our story simpler, I just drafted a new .h file that provides a compatible subset of the interface we use, derived from the .c file Jared wrote, written according to several deterministic rules based on KNF that yield a non-creative specification of the compatible interface: 1. $NetBSD$ RCS id 2. standard TNF copyright statement 3. header guard derived from #include file name 4. minimal #includes, grouped and sorted according to KNF 5. forward declaration of structs, sorted lexicographically 6. definitions of structs, members sorted lexicographically by name 7. downcasting macros, written in KNF and sorted lexicographically 8. minimal extern variable declarations, sorted lexicographically 9. minimal, function prototypes, written in KNF and sorted lexicographically `Minimal' means added one by one, according to the errors issued by the compiler (and in the case of #includes, according to the correct header file for the missing types or function prototypes being used), until the compiler is formally satisfied. Any changes to this will, unless otherwise marked, be covered by the standard TNF licence now on the file. To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/sys/external/bsd/drm2/drm/drm_gem_cma_helper.c cvs rdiff -u -r1.2 -r1.3 \ src/sys/external/bsd/drm2/include/drm/drm_gem_cma_helper.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/external/bsd/drm2
Module Name:src Committed By: riastradh Date: Sat Jul 2 00:26:07 UTC 2022 Modified Files: src/sys/external/bsd/drm2/drm: drm_gem_cma_helper.c src/sys/external/bsd/drm2/include/drm: drm_gem_cma_helper.h Log Message: drm: Rewrite drm_gem_cma_helper.h from scratch. The header file was originally part of drm with no licence text, which I took to mean BSD-licensed like the rest of the Linux drm code base is by default -- everything in Linux under include/drm and drivers/gpu/drm not otherwise marked. In 2017, a tree-wide automated change was applied to Linux which caused an SPDX GPL header to appear in drm_gem_cma_helper.h. When I asked the drm developers about this in drm files, they explained that it was an automated process and many of the SPDX headers were wrong, so when excluding GPL files in drm updates, I heeded the actual GPL vs BSD/MIT licence text and revision history rather than the SPDX headers. I excluded drm_gem_cma_helper.c because it was clearly originally GPL as an exception to the default BSD licence under Linux's drivers/gpu/drm, and Jared reimplemented the API for ues by some (NetBSD, BSD-licensed) Arm display drivers. During an update after that, the header file was lost in the merge shuffle and I copied it back in without noticing the SPDX header file. In retrospect, I see now that it's not clear what the intent was: the .c file was obviously GPL, and maybe the .h file was supposed to be too but it wasn't carved out as an exception among the drm code. To keep our story simpler, I just drafted a new .h file that provides a compatible subset of the interface we use, derived from the .c file Jared wrote, written according to several deterministic rules based on KNF that yield a non-creative specification of the compatible interface: 1. $NetBSD$ RCS id 2. standard TNF copyright statement 3. header guard derived from #include file name 4. minimal #includes, grouped and sorted according to KNF 5. forward declaration of structs, sorted lexicographically 6. definitions of structs, members sorted lexicographically by name 7. downcasting macros, written in KNF and sorted lexicographically 8. minimal extern variable declarations, sorted lexicographically 9. minimal, function prototypes, written in KNF and sorted lexicographically `Minimal' means added one by one, according to the errors issued by the compiler (and in the case of #includes, according to the correct header file for the missing types or function prototypes being used), until the compiler is formally satisfied. Any changes to this will, unless otherwise marked, be covered by the standard TNF licence now on the file. To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/sys/external/bsd/drm2/drm/drm_gem_cma_helper.c cvs rdiff -u -r1.2 -r1.3 \ src/sys/external/bsd/drm2/include/drm/drm_gem_cma_helper.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/external/bsd/drm2/drm/drm_gem_cma_helper.c diff -u src/sys/external/bsd/drm2/drm/drm_gem_cma_helper.c:1.13 src/sys/external/bsd/drm2/drm/drm_gem_cma_helper.c:1.14 --- src/sys/external/bsd/drm2/drm/drm_gem_cma_helper.c:1.13 Sun Dec 19 09:52:00 2021 +++ src/sys/external/bsd/drm2/drm/drm_gem_cma_helper.c Sat Jul 2 00:26:07 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: drm_gem_cma_helper.c,v 1.13 2021/12/19 09:52:00 riastradh Exp $ */ +/* $NetBSD: drm_gem_cma_helper.c,v 1.14 2022/07/02 00:26:07 riastradh Exp $ */ /*- * Copyright (c) 2015-2017 Jared McNeill @@ -27,16 +27,17 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: drm_gem_cma_helper.c,v 1.13 2021/12/19 09:52:00 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: drm_gem_cma_helper.c,v 1.14 2022/07/02 00:26:07 riastradh Exp $"); #include +#include #include -#include #include -#include +#include +#include -#include +#include static struct drm_gem_cma_object * drm_gem_cma_create_internal(struct drm_device *ddev, size_t size, Index: src/sys/external/bsd/drm2/include/drm/drm_gem_cma_helper.h diff -u src/sys/external/bsd/drm2/include/drm/drm_gem_cma_helper.h:1.2 src/sys/external/bsd/drm2/include/drm/drm_gem_cma_helper.h:1.3 --- src/sys/external/bsd/drm2/include/drm/drm_gem_cma_helper.h:1.2 Sun Dec 19 10:29:16 2021 +++ src/sys/external/bsd/drm2/include/drm/drm_gem_cma_helper.h Sat Jul 2 00:26:07 2022 @@ -1,157 +1,77 @@ -/* $NetBSD: drm_gem_cma_helper.h,v 1.2 2021/12/19 10:29:16 riastradh Exp $ */ +/* $NetBSD: drm_gem_cma_helper.h,v 1.3 2022/07/02 00:26:07 riastradh Exp $ */ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef __DRM_GEM_CMA_HELPER_H__ -#define __DRM_GEM_CMA_HELPER_H__ +/*- + * Copyright (c) 2022 The NetBSD Foundation, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the abo
CVS commit: src/sys/kern
Module Name:src Committed By: riastradh Date: Fri Jul 1 22:30:51 UTC 2022 Modified Files: src/sys/kern: uipc_syscalls.c Log Message: sendto(2), recvfrom(2): Scrub internal struct msghdr on stack. Otherwise this is kernel stack disclosure via ktrace. Reported-by: syzbot+1d40303b310063778...@syzkaller.appspotmail.com To generate a diff of this commit: cvs rdiff -u -r1.205 -r1.206 src/sys/kern/uipc_syscalls.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/kern/uipc_syscalls.c diff -u src/sys/kern/uipc_syscalls.c:1.205 src/sys/kern/uipc_syscalls.c:1.206 --- src/sys/kern/uipc_syscalls.c:1.205 Wed Jun 29 22:27:12 2022 +++ src/sys/kern/uipc_syscalls.c Fri Jul 1 22:30:51 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: uipc_syscalls.c,v 1.205 2022/06/29 22:27:12 riastradh Exp $ */ +/* $NetBSD: uipc_syscalls.c,v 1.206 2022/07/01 22:30:51 riastradh Exp $ */ /*- * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc. @@ -61,7 +61,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: uipc_syscalls.c,v 1.205 2022/06/29 22:27:12 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uipc_syscalls.c,v 1.206 2022/07/01 22:30:51 riastradh Exp $"); #ifdef _KERNEL_OPT #include "opt_pipe.h" @@ -498,7 +498,7 @@ sys_sendto(struct lwp *l, const struct s syscallarg(const struct sockaddr *) to; syscallarg(unsigned int) tolen; } */ - struct msghdr msg; + struct msghdr msg = {0}; struct iovec aiov; msg.msg_name = __UNCONST(SCARG(uap, to)); /* XXXUNCONST kills const */ @@ -694,7 +694,7 @@ sys_recvfrom(struct lwp *l, const struct syscallarg(struct sockaddr *) from; syscallarg(unsigned int *) fromlenaddr; } */ - struct msghdr msg; + struct msghdr msg = {0}; struct iovec aiov; int error; struct mbuf *from;
CVS commit: src/sys/kern
Module Name:src Committed By: riastradh Date: Fri Jul 1 22:30:51 UTC 2022 Modified Files: src/sys/kern: uipc_syscalls.c Log Message: sendto(2), recvfrom(2): Scrub internal struct msghdr on stack. Otherwise this is kernel stack disclosure via ktrace. Reported-by: syzbot+1d40303b310063778...@syzkaller.appspotmail.com To generate a diff of this commit: cvs rdiff -u -r1.205 -r1.206 src/sys/kern/uipc_syscalls.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/xlint/lint1
Module Name:src Committed By: rillig Date: Fri Jul 1 21:48:05 UTC 2022 Modified Files: src/usr.bin/xlint/lint1: err.c Log Message: lint: clean up suppression of warnings and errors Since lint1.h 1.11 from 2001-12-13, lint1 had been a memory hog. While it used a bit set for keeping track of the message IDs of the suppressed messages, it only used the lower 4 bits of each 32-bit word, due to a missing CHAR_BIT in __NERRBITS. As a quick hack, the bit set had 1024 entries, much more than the number of actual messages, which is currently at 350. This meant 674 bytes of wasted memory, plus the code size for the bit manipulations. The only functional change is that the option '-X' now only accepts actually valid message IDs. Previously it had accepted all numbers from 0 to 1023. To generate a diff of this commit: cvs rdiff -u -r1.178 -r1.179 src/usr.bin/xlint/lint1/err.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/xlint/lint1/err.c diff -u src/usr.bin/xlint/lint1/err.c:1.178 src/usr.bin/xlint/lint1/err.c:1.179 --- src/usr.bin/xlint/lint1/err.c:1.178 Fri Jul 1 21:25:39 2022 +++ src/usr.bin/xlint/lint1/err.c Fri Jul 1 21:48:05 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: err.c,v 1.178 2022/07/01 21:25:39 rillig Exp $ */ +/* $NetBSD: err.c,v 1.179 2022/07/01 21:48:05 rillig Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -37,7 +37,7 @@ #include #if defined(__RCSID) -__RCSID("$NetBSD: err.c,v 1.178 2022/07/01 21:25:39 rillig Exp $"); +__RCSID("$NetBSD: err.c,v 1.179 2022/07/01 21:48:05 rillig Exp $"); #endif #include @@ -408,22 +408,7 @@ static const char *const msgs[] = { "non type argument to alignof is a GCC extension", /* 349 */ }; -#define ERR_SETSIZE 1024 -#define __NERRBITS (sizeof(unsigned int)) - -typedef struct err_set { - unsigned int errs_bits[(ERR_SETSIZE + __NERRBITS-1) / __NERRBITS]; -} err_set; - -#define ERR_SET(n, p) \ - ((p)->errs_bits[(n)/__NERRBITS] |= (1 << ((n) % __NERRBITS))) -#define ERR_CLR(n, p) \ - ((p)->errs_bits[(n)/__NERRBITS] &= ~(1 << ((n) % __NERRBITS))) -#define ERR_ISSET(n, p) \ - (((p)->errs_bits[(n)/__NERRBITS] & (1 << ((n) % __NERRBITS))) != 0) -#define ERR_ZERO(p) (void)memset((p), 0, sizeof(*(p))) - -static err_set msgset; +static bool is_suppressed[sizeof(msgs) / sizeof(msgs[0])]; static struct include_level { const char *filename; @@ -435,17 +420,15 @@ void suppress_messages(char *ids) { char *ptr, *end; - long id; + unsigned long id; for (ptr = strtok(ids, ","); ptr != NULL; ptr = strtok(NULL, ",")) { errno = 0; - id = strtol(ptr, &end, 0); - if ((id == TARG_LONG_MIN || id == TARG_LONG_MAX) && - errno == ERANGE) - err(1, "invalid error message id '%s'", ptr); - if (*end != '\0' || ptr == end || id < 0 || id >= ERR_SETSIZE) + id = strtoul(ptr, &end, 0); + if (*end != '\0' || ptr == end || + id >= sizeof(msgs) / sizeof(msgs[0])) errx(1, "invalid error message id '%s'", ptr); - ERR_SET(id, &msgset); + is_suppressed[id] = true; } } @@ -536,7 +519,7 @@ verror_at(int msgid, const pos_t *pos, v { const char *fn; - if (ERR_ISSET(msgid, &msgset)) + if (is_suppressed[msgid]) return; fn = lbasename(pos->p_file); @@ -552,7 +535,7 @@ vwarning_at(int msgid, const pos_t *pos, { const char *fn; - if (ERR_ISSET(msgid, &msgset)) + if (is_suppressed[msgid]) return; debug_step("%s: lwarn=%d msgid=%d", __func__, lwarn, msgid); @@ -574,7 +557,7 @@ vmessage_at(int msgid, const pos_t *pos, { const char *fn; - if (ERR_ISSET(msgid, &msgset)) + if (is_suppressed[msgid]) return; fn = lbasename(pos->p_file);
CVS commit: src/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Fri Jul 1 21:48:05 UTC 2022 Modified Files: src/usr.bin/xlint/lint1: err.c Log Message: lint: clean up suppression of warnings and errors Since lint1.h 1.11 from 2001-12-13, lint1 had been a memory hog. While it used a bit set for keeping track of the message IDs of the suppressed messages, it only used the lower 4 bits of each 32-bit word, due to a missing CHAR_BIT in __NERRBITS. As a quick hack, the bit set had 1024 entries, much more than the number of actual messages, which is currently at 350. This meant 674 bytes of wasted memory, plus the code size for the bit manipulations. The only functional change is that the option '-X' now only accepts actually valid message IDs. Previously it had accepted all numbers from 0 to 1023. To generate a diff of this commit: cvs rdiff -u -r1.178 -r1.179 src/usr.bin/xlint/lint1/err.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/xlint/lint1
Module Name:src Committed By: rillig Date: Fri Jul 1 21:25:39 UTC 2022 Modified Files: src/usr.bin/xlint/lint1: err.c externs1.h lint1.h main1.c Log Message: lint: move error handling code from main1.c to err.c No functional change. To generate a diff of this commit: cvs rdiff -u -r1.177 -r1.178 src/usr.bin/xlint/lint1/err.c cvs rdiff -u -r1.162 -r1.163 src/usr.bin/xlint/lint1/externs1.h cvs rdiff -u -r1.154 -r1.155 src/usr.bin/xlint/lint1/lint1.h cvs rdiff -u -r1.63 -r1.64 src/usr.bin/xlint/lint1/main1.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/xlint/lint1
Module Name:src Committed By: rillig Date: Fri Jul 1 21:25:39 UTC 2022 Modified Files: src/usr.bin/xlint/lint1: err.c externs1.h lint1.h main1.c Log Message: lint: move error handling code from main1.c to err.c No functional change. To generate a diff of this commit: cvs rdiff -u -r1.177 -r1.178 src/usr.bin/xlint/lint1/err.c cvs rdiff -u -r1.162 -r1.163 src/usr.bin/xlint/lint1/externs1.h cvs rdiff -u -r1.154 -r1.155 src/usr.bin/xlint/lint1/lint1.h cvs rdiff -u -r1.63 -r1.64 src/usr.bin/xlint/lint1/main1.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/xlint/lint1/err.c diff -u src/usr.bin/xlint/lint1/err.c:1.177 src/usr.bin/xlint/lint1/err.c:1.178 --- src/usr.bin/xlint/lint1/err.c:1.177 Fri Jul 1 20:53:13 2022 +++ src/usr.bin/xlint/lint1/err.c Fri Jul 1 21:25:39 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: err.c,v 1.177 2022/07/01 20:53:13 rillig Exp $ */ +/* $NetBSD: err.c,v 1.178 2022/07/01 21:25:39 rillig Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -37,11 +37,14 @@ #include #if defined(__RCSID) -__RCSID("$NetBSD: err.c,v 1.177 2022/07/01 20:53:13 rillig Exp $"); +__RCSID("$NetBSD: err.c,v 1.178 2022/07/01 21:25:39 rillig Exp $"); #endif +#include +#include #include #include +#include #include "lint1.h" @@ -264,7 +267,7 @@ static const char *const msgs[] = { "break outside loop or switch", /* 208 */ "continue outside loop", /* 209 */ "enum type mismatch between '%s' and '%s' in initialization", /* 210 */ - "function has return type '%s' but returns '%s'", /* 211 */ + "function has return type '%s' but returns '%s'", /* 211 */ "cannot return incomplete type", /* 212 */ "void function '%s' cannot return value", /* 213 */ "function '%s' expects to return value", /* 214 */ @@ -405,12 +408,46 @@ static const char *const msgs[] = { "non type argument to alignof is a GCC extension", /* 349 */ }; +#define ERR_SETSIZE 1024 +#define __NERRBITS (sizeof(unsigned int)) + +typedef struct err_set { + unsigned int errs_bits[(ERR_SETSIZE + __NERRBITS-1) / __NERRBITS]; +} err_set; + +#define ERR_SET(n, p) \ + ((p)->errs_bits[(n)/__NERRBITS] |= (1 << ((n) % __NERRBITS))) +#define ERR_CLR(n, p) \ + ((p)->errs_bits[(n)/__NERRBITS] &= ~(1 << ((n) % __NERRBITS))) +#define ERR_ISSET(n, p) \ + (((p)->errs_bits[(n)/__NERRBITS] & (1 << ((n) % __NERRBITS))) != 0) +#define ERR_ZERO(p) (void)memset((p), 0, sizeof(*(p))) + +static err_set msgset; + static struct include_level { const char *filename; int lineno; struct include_level *by; } *includes; +void +suppress_messages(char *ids) +{ + char *ptr, *end; + long id; + + for (ptr = strtok(ids, ","); ptr != NULL; ptr = strtok(NULL, ",")) { + errno = 0; + id = strtol(ptr, &end, 0); + if ((id == TARG_LONG_MIN || id == TARG_LONG_MAX) && + errno == ERANGE) + err(1, "invalid error message id '%s'", ptr); + if (*end != '\0' || ptr == end || id < 0 || id >= ERR_SETSIZE) + errx(1, "invalid error message id '%s'", ptr); + ERR_SET(id, &msgset); + } +} void update_location(const char *filename, int lineno, bool is_begin, bool is_end) Index: src/usr.bin/xlint/lint1/externs1.h diff -u src/usr.bin/xlint/lint1/externs1.h:1.162 src/usr.bin/xlint/lint1/externs1.h:1.163 --- src/usr.bin/xlint/lint1/externs1.h:1.162 Wed Jun 15 18:29:21 2022 +++ src/usr.bin/xlint/lint1/externs1.h Fri Jul 1 21:25:39 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: externs1.h,v 1.162 2022/06/15 18:29:21 rillig Exp $ */ +/* $NetBSD: externs1.h,v 1.163 2022/07/01 21:25:39 rillig Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -168,6 +168,7 @@ extern void internal_error(const char *, extern void assert_failed(const char *, int, const char *, const char *) __attribute__((__noreturn__)); extern void update_location(const char *, int, bool, bool); +extern void suppress_messages(char *); /* * decl.c Index: src/usr.bin/xlint/lint1/lint1.h diff -u src/usr.bin/xlint/lint1/lint1.h:1.154 src/usr.bin/xlint/lint1/lint1.h:1.155 --- src/usr.bin/xlint/lint1/lint1.h:1.154 Thu May 26 13:40:49 2022 +++ src/usr.bin/xlint/lint1/lint1.h Fri Jul 1 21:25:39 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: lint1.h,v 1.154 2022/05/26 13:40:49 rillig Exp $ */ +/* $NetBSD: lint1.h,v 1.155 2022/07/01 21:25:39 rillig Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. @@ -442,21 +442,6 @@ typedef struct { #include "externs1.h" -#define ERR_SETSIZE 1024 -#define __NERRBITS (sizeof(unsigned int)) - -typedef struct err_set { - unsigned int errs_bits[(ERR_SETSIZE + __NERRBITS-1) / __NERRBITS]; -} err_set; - -#define ERR_SET(n, p) \ - ((p)->errs_bits[(n)/__NERRBITS] |= (1 << ((n) % __NERRBITS))) -#define ERR_CLR(n, p) \ - ((p)->errs_bits[(n)/__NERRBITS] &= ~(1 << ((n) % __NERRBITS))) -#define ERR_ISSET(n, p) \ - (((p)->errs_bits[(n)/__NERRBITS] & (1 << ((n) % __NERRBITS
CVS commit: src/sys/kern
Module Name:src Committed By: riastradh Date: Fri Jul 1 21:22:44 UTC 2022 Modified Files: src/sys/kern: kern_time.c Log Message: kern: KNF in kern_time.c: Omit needless return parentheses. Also nix trailing whitespace while here. No functional change intended. To generate a diff of this commit: cvs rdiff -u -r1.216 -r1.217 src/sys/kern/kern_time.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/kern
Module Name:src Committed By: riastradh Date: Fri Jul 1 21:22:44 UTC 2022 Modified Files: src/sys/kern: kern_time.c Log Message: kern: KNF in kern_time.c: Omit needless return parentheses. Also nix trailing whitespace while here. No functional change intended. To generate a diff of this commit: cvs rdiff -u -r1.216 -r1.217 src/sys/kern/kern_time.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/kern/kern_time.c diff -u src/sys/kern/kern_time.c:1.216 src/sys/kern/kern_time.c:1.217 --- src/sys/kern/kern_time.c:1.216 Mon Jun 27 00:34:24 2022 +++ src/sys/kern/kern_time.c Fri Jul 1 21:22:44 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: kern_time.c,v 1.216 2022/06/27 00:34:24 riastradh Exp $ */ +/* $NetBSD: kern_time.c,v 1.217 2022/07/01 21:22:44 riastradh Exp $ */ /*- * Copyright (c) 2000, 2004, 2005, 2007, 2008, 2009, 2020 @@ -62,7 +62,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: kern_time.c,v 1.216 2022/06/27 00:34:24 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kern_time.c,v 1.217 2022/07/01 21:22:44 riastradh Exp $"); #include #include @@ -192,7 +192,7 @@ settime1(struct proc *p, const struct ti * unreasonable system behaviour. */ if (ts->tv_sec < 0 || ts->tv_sec > (1LL << 36)) - return (EINVAL); + return EINVAL; nanotime(&now); timespecsub(ts, &now, &delta); @@ -200,12 +200,12 @@ settime1(struct proc *p, const struct ti if (check_kauth && kauth_authorize_system(kauth_cred_get(), KAUTH_SYSTEM_TIME, KAUTH_REQ_SYSTEM_TIME_SYSTEM, __UNCONST(ts), &delta, KAUTH_ARG(check_kauth ? false : true)) != 0) { - return (EPERM); + return EPERM; } #ifdef notyet if ((delta.tv_sec < 86400) && securelevel > 0) { /* XXX elad - notyet */ - return (EPERM); + return EPERM; } #endif @@ -230,13 +230,13 @@ settime1(struct proc *p, const struct ti } itimer_unlock(); - return (0); + return 0; } int settime(struct proc *p, struct timespec *ts) { - return (settime1(p, ts, true)); + return settime1(p, ts, true); } /* ARGSUSED */ @@ -289,12 +289,12 @@ clock_settime1(struct proc *p, clockid_t switch (clock_id) { case CLOCK_REALTIME: if ((error = settime1(p, tp, check_kauth)) != 0) - return (error); + return error; break; case CLOCK_MONOTONIC: - return (EINVAL); /* read-only clock */ + return EINVAL; /* read-only clock */ default: - return (EINVAL); + return EINVAL; } return 0; @@ -354,7 +354,7 @@ sys___nanosleep50(struct lwp *l, const s error = copyin(SCARG(uap, rqtp), &rqt, sizeof(struct timespec)); if (error) - return (error); + return error; error = nanosleep1(l, CLOCK_MONOTONIC, 0, &rqt, SCARG(uap, rmtp) ? &rmt : NULL); @@ -507,7 +507,7 @@ sys___gettimeofday50(struct lwp *l, cons microtime(&atv); error = copyout(&atv, SCARG(uap, tp), sizeof(atv)); if (error) - return (error); + return error; } if (SCARG(uap, tzp)) { /* @@ -518,7 +518,7 @@ sys___gettimeofday50(struct lwp *l, cons tzfake.tz_dsttime = 0; error = copyout(&tzfake, SCARG(uap, tzp), sizeof(tzfake)); } - return (error); + return error; } /* ARGSUSED */ @@ -552,7 +552,7 @@ settimeofday1(const struct timeval *utv, log(LOG_WARNING, "pid %d attempted to set the " "(obsolete) kernel time zone\n", l->l_proc->p_pid); - if (utv == NULL) + if (utv == NULL) return 0; if (userspace) { @@ -590,7 +590,7 @@ sys___adjtime50(struct lwp *l, const str error = copyin(SCARG(uap, delta), &atv, sizeof(*SCARG(uap, delta))); if (error) - return (error); + return error; } adjtime1(SCARG(uap, delta) ? &atv : NULL, SCARG(uap, olddelta) ? &oldatv : NULL, l->l_proc); @@ -1222,7 +1222,7 @@ timer_create1(timer_t *tid, clockid_t id p = l->l_proc; if ((u_int)id > CLOCK_MONOTONIC) - return (EINVAL); + return EINVAL; if ((pts = p->p_timers) == NULL) pts = ptimers_alloc(p); @@ -1310,14 +1310,14 @@ sys_timer_delete(struct lwp *l, const st timerid = SCARG(uap, timerid); pts = p->p_timers; - + if (pts == NULL || timerid < 2 || timerid >= TIMER_MAX) - return (EINVAL); + return EINVAL; itimer_lock(); if ((it = pts->pts_timers[timerid]) == NULL) { itimer_unlock(); - return (EINVAL); + return EINVAL; } if (CLOCK_VIRTUAL_P(it->it_clockid)) { @@ -1335,7 +1335,7 @@ sys_timer_delete(struct lwp *l, const st /* Free the timer and release the lock. */ ptimer_free(pts, timerid); - return (0); + return 0; } /* @@ -1359,7 +1359,7 @@ sys___timer_settime50(struct lwp *l, if ((error = copyin(SCARG(uap, value), &value, sizeof(struct itimerspec))) != 0) - return (error); + return error; if (SCARG(uap, ovalue)) ovp = &ovalue; @@ -1446,7 +1446,7 @@ dotimer_settime(int timerid, struct itim if (ovalue) *ovalue = oval; - return (0); + return 0; } /* @@ -1480,11 +1480,11 @@ dotimer_gettime(int timerid, struct proc pts = p->p_timers;
CVS commit: src/sys/net
Module Name:src Committed By: riastradh Date: Fri Jul 1 21:22:23 UTC 2022 Modified Files: src/sys/net: rtsock_shared.c Log Message: route(4): Use m_copydata, not misaligned mtod struct access. XXX Maybe this should check rtm_len too like route_output does. Reported-by: syzbot+d37eaf0a26097572b...@syzkaller.appspotmail.com https://syzkaller.appspot.com/bug?id=3cdfefd8b7938c9606ed68b4191e97fabdbd7b08 To generate a diff of this commit: cvs rdiff -u -r1.21 -r1.22 src/sys/net/rtsock_shared.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/net/rtsock_shared.c diff -u src/sys/net/rtsock_shared.c:1.21 src/sys/net/rtsock_shared.c:1.22 --- src/sys/net/rtsock_shared.c:1.21 Wed Jun 29 23:15:08 2022 +++ src/sys/net/rtsock_shared.c Fri Jul 1 21:22:23 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: rtsock_shared.c,v 1.21 2022/06/29 23:15:08 riastradh Exp $ */ +/* $NetBSD: rtsock_shared.c,v 1.22 2022/07/01 21:22:23 riastradh Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -61,7 +61,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rtsock_shared.c,v 1.21 2022/06/29 23:15:08 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rtsock_shared.c,v 1.22 2022/07/01 21:22:23 riastradh Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -213,7 +213,7 @@ COMPATNAME(route_filter)(struct mbuf *m, struct rawcb *rp) { struct routecb *rop = (struct routecb *)rp; - struct rt_xmsghdr *rtm; + struct rt_xmsghdr rtm; KASSERT(m != NULL); KASSERT(proto != NULL); @@ -229,18 +229,19 @@ COMPATNAME(route_filter)(struct mbuf *m, /* Ensure we can access rtm_type */ if (m->m_len < - offsetof(struct rt_xmsghdr, rtm_type) + sizeof(rtm->rtm_type)) + offsetof(struct rt_xmsghdr, rtm_type) + sizeof(rtm.rtm_type)) return EINVAL; - rtm = mtod(m, struct rt_xmsghdr *); - if (rtm->rtm_type >= sizeof(rop->rocb_msgfilter) * CHAR_BIT) + m_copydata(m, offsetof(struct rt_xmsghdr, rtm_type), + sizeof(rtm.rtm_type), &rtm.rtm_type); + if (rtm.rtm_type >= sizeof(rop->rocb_msgfilter) * CHAR_BIT) return EINVAL; /* If the rtm type is filtered out, return a positive. */ if (rop->rocb_msgfilter != 0 && - !(rop->rocb_msgfilter & RTMSGFILTER(rtm->rtm_type))) + !(rop->rocb_msgfilter & RTMSGFILTER(rtm.rtm_type))) return EEXIST; - if (rop->rocb_missfilterlen != 0 && rtm->rtm_type == RTM_MISS) { + if (rop->rocb_missfilterlen != 0 && rtm.rtm_type == RTM_MISS) { __CTASSERT(RTAX_DST == 0); struct sockaddr_storage ss; struct sockaddr *dst = (struct sockaddr *)&ss, *sa; @@ -248,16 +249,16 @@ COMPATNAME(route_filter)(struct mbuf *m, char *ep = cp + rop->rocb_missfilterlen; /* Ensure we can access sa_len */ - if (m->m_pkthdr.len < sizeof(*rtm) + _SA_MINSIZE) + if (m->m_pkthdr.len < sizeof(rtm) + _SA_MINSIZE) return EINVAL; - m_copydata(m, sizeof(*rtm) + offsetof(struct sockaddr, sa_len), + m_copydata(m, sizeof(rtm) + offsetof(struct sockaddr, sa_len), sizeof(ss.ss_len), &ss.ss_len); if (ss.ss_len < _SA_MINSIZE || ss.ss_len > sizeof(ss) || - m->m_pkthdr.len < sizeof(*rtm) + ss.ss_len) + m->m_pkthdr.len < sizeof(rtm) + ss.ss_len) return EINVAL; /* Copy out the destination sockaddr */ - m_copydata(m, sizeof(*rtm), ss.ss_len, &ss); + m_copydata(m, sizeof(rtm), ss.ss_len, &ss); /* Find a matching sockaddr in the filter */ while (cp < ep) {
CVS commit: src/sys/net
Module Name:src Committed By: riastradh Date: Fri Jul 1 21:22:23 UTC 2022 Modified Files: src/sys/net: rtsock_shared.c Log Message: route(4): Use m_copydata, not misaligned mtod struct access. XXX Maybe this should check rtm_len too like route_output does. Reported-by: syzbot+d37eaf0a26097572b...@syzkaller.appspotmail.com https://syzkaller.appspot.com/bug?id=3cdfefd8b7938c9606ed68b4191e97fabdbd7b08 To generate a diff of this commit: cvs rdiff -u -r1.21 -r1.22 src/sys/net/rtsock_shared.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: Fri Jul 1 20:53:14 UTC 2022 Modified Files: src/tests/usr.bin/xlint/lint1: msg_138.c msg_240.c src/usr.bin/xlint/lint1: err.c tree.c Log Message: lint: add quotes around operator in message 138, remove message 240 Message 138 doesn't occur in practice, it was the last one that was missing the quotes around the placeholder. Message 240 was also missing the quotes, but it was not reachable. There was also no apparent benefit in warning about 'assignment of different structures' when the message about 'assignment type mismatch' serves the same purpose. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/tests/usr.bin/xlint/lint1/msg_138.c cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/xlint/lint1/msg_240.c cvs rdiff -u -r1.176 -r1.177 src/usr.bin/xlint/lint1/err.c cvs rdiff -u -r1.465 -r1.466 src/usr.bin/xlint/lint1/tree.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_138.c diff -u src/tests/usr.bin/xlint/lint1/msg_138.c:1.4 src/tests/usr.bin/xlint/lint1/msg_138.c:1.5 --- src/tests/usr.bin/xlint/lint1/msg_138.c:1.4 Fri Jul 1 20:35:18 2022 +++ src/tests/usr.bin/xlint/lint1/msg_138.c Fri Jul 1 20:53:13 2022 @@ -1,7 +1,7 @@ -/* $NetBSD: msg_138.c,v 1.4 2022/07/01 20:35:18 rillig Exp $ */ +/* $NetBSD: msg_138.c,v 1.5 2022/07/01 20:53:13 rillig Exp $ */ # 3 "msg_138.c" -// Test for message: unknown operand size, op %s [138] +// Test for message: unknown operand size, op '%s' [138] /* lint1-extra-flags: -z */ @@ -18,10 +18,10 @@ function(_Bool cond, struct incomplete * /* expect+1: error: cannot initialize 'incomplete struct incomplete' from 'pointer to incomplete struct incomplete' [185] */ struct incomplete local = i1; - /* expect+1: error: unknown operand size, op = [138] */ + /* expect+1: error: unknown operand size, op '=' [138] */ *i1 = *i2; - /* expect+1: error: unknown operand size, op : [138] */ + /* expect+1: error: unknown operand size, op ':' [138] */ return cond ? *i1 : *i2; } Index: src/tests/usr.bin/xlint/lint1/msg_240.c diff -u src/tests/usr.bin/xlint/lint1/msg_240.c:1.3 src/tests/usr.bin/xlint/lint1/msg_240.c:1.4 --- src/tests/usr.bin/xlint/lint1/msg_240.c:1.3 Thu Jun 16 21:24:41 2022 +++ src/tests/usr.bin/xlint/lint1/msg_240.c Fri Jul 1 20:53:13 2022 @@ -1,9 +1,8 @@ -/* $NetBSD: msg_240.c,v 1.3 2022/06/16 21:24:41 rillig Exp $ */ +/* $NetBSD: msg_240.c,v 1.4 2022/07/01 20:53:13 rillig Exp $ */ # 3 "msg_240.c" // Test for message: assignment of different structures (%s != %s) [240] // This message is not used. -// TODO: Remove the code, as the message is unreachable. struct s_arg { int member; Index: src/usr.bin/xlint/lint1/err.c diff -u src/usr.bin/xlint/lint1/err.c:1.176 src/usr.bin/xlint/lint1/err.c:1.177 --- src/usr.bin/xlint/lint1/err.c:1.176 Wed Jun 22 19:23:17 2022 +++ src/usr.bin/xlint/lint1/err.c Fri Jul 1 20:53:13 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: err.c,v 1.176 2022/06/22 19:23:17 rillig Exp $ */ +/* $NetBSD: err.c,v 1.177 2022/07/01 20:53:13 rillig Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -37,7 +37,7 @@ #include #if defined(__RCSID) -__RCSID("$NetBSD: err.c,v 1.176 2022/06/22 19:23:17 rillig Exp $"); +__RCSID("$NetBSD: err.c,v 1.177 2022/07/01 20:53:13 rillig Exp $"); #endif #include @@ -191,7 +191,7 @@ static const char *const msgs[] = { "converting '%s' to '%s' may cause alignment problem", /* 135 */ "cannot do pointer arithmetic on operand of unknown size",/* 136 */ "", /* unused */ /* 137 */ - "unknown operand size, op %s", /* 138 */ + "unknown operand size, op '%s'", /* 138 */ "division by 0", /* 139 */ "modulus by 0", /* 140 */ "integer overflow detected, op '%s'", /* 141 */ @@ -293,7 +293,7 @@ static const char *const msgs[] = { "redeclaration of formal parameter '%s'", /* 237 */ "initialization of union is illegal in traditional C", /* 238 */ "constant argument to '!'", /* 239 */ - "assignment of different structures (%s != %s)", /* 240 */ + "", /* unused */ /* 240 */ "dubious operation on enum, op '%s'", /* 241 */ "combination of '%s' and '%s', op '%s'", /* 242 */ "dubious comparison of enums, op '%s'", /* 243 */ Index: src/usr.bin/xlint/lint1/tree.c diff -u src/usr.bin/xlint/lint1/tree.c:1.465 src/usr.bin/xlint/lint1/tree.c:1.466 --- src/usr.bin/xlint/lint1/tree.c:1.465 Fri Jul 1 19:52:41 2022 +++ src/usr.bin/xlint/lint1/tree.c Fri Jul 1 20:53:13 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: tree.c,v 1.465 2022/07/01 19:52:41 rillig Exp $ */ +/* $NetBSD: tree.c,v 1.466 2022/07/01 20:53:13 rillig Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -37,7 +37,7 @@ #include #if defined(__RCSID) -__RCSID("$NetBSD: tree.c,v 1.465 2022/07/01 19:52:41 rillig
CVS commit: src
Module Name:src Committed By: rillig Date: Fri Jul 1 20:53:14 UTC 2022 Modified Files: src/tests/usr.bin/xlint/lint1: msg_138.c msg_240.c src/usr.bin/xlint/lint1: err.c tree.c Log Message: lint: add quotes around operator in message 138, remove message 240 Message 138 doesn't occur in practice, it was the last one that was missing the quotes around the placeholder. Message 240 was also missing the quotes, but it was not reachable. There was also no apparent benefit in warning about 'assignment of different structures' when the message about 'assignment type mismatch' serves the same purpose. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/tests/usr.bin/xlint/lint1/msg_138.c cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/xlint/lint1/msg_240.c cvs rdiff -u -r1.176 -r1.177 src/usr.bin/xlint/lint1/err.c cvs rdiff -u -r1.465 -r1.466 src/usr.bin/xlint/lint1/tree.c 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: Fri Jul 1 20:35:18 UTC 2022 Modified Files: src/tests/usr.bin/xlint/lint1: msg_138.c Log Message: tests/lint: add tests for accessing incomplete types To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/xlint/lint1/msg_138.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_138.c diff -u src/tests/usr.bin/xlint/lint1/msg_138.c:1.3 src/tests/usr.bin/xlint/lint1/msg_138.c:1.4 --- src/tests/usr.bin/xlint/lint1/msg_138.c:1.3 Thu Jun 16 16:58:36 2022 +++ src/tests/usr.bin/xlint/lint1/msg_138.c Fri Jul 1 20:35:18 2022 @@ -1,8 +1,35 @@ -/* $NetBSD: msg_138.c,v 1.3 2022/06/16 16:58:36 rillig Exp $ */ +/* $NetBSD: msg_138.c,v 1.4 2022/07/01 20:35:18 rillig Exp $ */ # 3 "msg_138.c" // Test for message: unknown operand size, op %s [138] -/* expect+1: error: syntax error ':' [249] */ -TODO: "Add example code that triggers the above message." -TODO: "Add example code that almost triggers the above message." +/* lint1-extra-flags: -z */ + +struct incomplete; + +/* + * This code doesn't make sense at all, at least not in C99. + */ +/* ARGSUSED */ +void +function(_Bool cond, struct incomplete *i1, struct incomplete *i2) +{ + /* expect+2: error: 'local' has incomplete type 'incomplete struct incomplete' [31] */ + /* expect+1: error: cannot initialize 'incomplete struct incomplete' from 'pointer to incomplete struct incomplete' [185] */ + struct incomplete local = i1; + + /* expect+1: error: unknown operand size, op = [138] */ + *i1 = *i2; + + /* expect+1: error: unknown operand size, op : [138] */ + return cond ? *i1 : *i2; +} + +/* ARGSUSED */ +struct incomplete +return_incomplete(struct incomplete *ptr) +/* expect+1: error: cannot return incomplete type [67] */ +{ + /* expect+1: error: cannot return incomplete type [212] */ + return *ptr; +}
CVS commit: src/tests/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Fri Jul 1 20:35:18 UTC 2022 Modified Files: src/tests/usr.bin/xlint/lint1: msg_138.c Log Message: tests/lint: add tests for accessing incomplete types To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/xlint/lint1/msg_138.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/xlint/lint1
Module Name:src Committed By: rillig Date: Fri Jul 1 19:52:41 UTC 2022 Modified Files: src/usr.bin/xlint/lint1: tree.c Log Message: lint: restructure 'convert' The conditions are now grouped by target type, highlighting that conversions between integer and floating point types are not checked by this function, in fact, they are not checked at all. No functional change. To generate a diff of this commit: cvs rdiff -u -r1.464 -r1.465 src/usr.bin/xlint/lint1/tree.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/xlint/lint1/tree.c diff -u src/usr.bin/xlint/lint1/tree.c:1.464 src/usr.bin/xlint/lint1/tree.c:1.465 --- src/usr.bin/xlint/lint1/tree.c:1.464 Fri Jul 1 17:48:49 2022 +++ src/usr.bin/xlint/lint1/tree.c Fri Jul 1 19:52:41 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: tree.c,v 1.464 2022/07/01 17:48:49 rillig Exp $ */ +/* $NetBSD: tree.c,v 1.465 2022/07/01 19:52:41 rillig Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -37,7 +37,7 @@ #include #if defined(__RCSID) -__RCSID("$NetBSD: tree.c,v 1.464 2022/07/01 17:48:49 rillig Exp $"); +__RCSID("$NetBSD: tree.c,v 1.465 2022/07/01 19:52:41 rillig Exp $"); #endif #include @@ -2286,14 +2286,29 @@ convert(op_t op, int arg, type_t *tp, tn if (allow_trad && allow_c90 && op == FARG) check_prototype_conversion(arg, nt, ot, tp, tn); - if (is_integer(nt) && is_integer(ot)) { - convert_integer_from_integer(op, arg, nt, ot, tp, tn); - } else if (nt == PTR && is_null_pointer(tn)) { - /* a null pointer may be assigned to any pointer. */ - } else if (is_integer(nt) && nt != BOOL && ot == PTR) { - convert_integer_from_pointer(op, nt, tp, tn); - } else if (nt == PTR && ot == PTR && op == CVT) { - convert_pointer_from_pointer(tp, tn); + if (nt == BOOL) { + /* No further checks. */ + + } else if (is_integer(nt)) { + if (ot == BOOL) { + /* No further checks. */ + } else if (is_integer(ot)) { + convert_integer_from_integer(op, arg, nt, ot, tp, tn); + } else if (is_floating(ot)) { + /* No further checks. */ + } else if (ot == PTR) { + convert_integer_from_pointer(op, nt, tp, tn); + } + + } else if (is_floating(nt)) { + /* No further checks. */ + + } else if (nt == PTR) { + if (is_null_pointer(tn)) { + /* a null pointer may be assigned to any pointer. */ + } else if (ot == PTR && op == CVT) { + convert_pointer_from_pointer(tp, tn); + } } ntn = expr_alloc_tnode(); @@ -2424,9 +2439,6 @@ convert_integer_from_integer(op_t op, in if (op == CVT) return; - if (allow_c99 && nt == BOOL) - return; /* See C99 6.3.1.2 */ - if (Pflag && pflag && aflag > 0 && portable_size_in_bits(nt) > portable_size_in_bits(ot) && is_uinteger(nt) != is_uinteger(ot)) {
CVS commit: src/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Fri Jul 1 19:52:41 UTC 2022 Modified Files: src/usr.bin/xlint/lint1: tree.c Log Message: lint: restructure 'convert' The conditions are now grouped by target type, highlighting that conversions between integer and floating point types are not checked by this function, in fact, they are not checked at all. No functional change. To generate a diff of this commit: cvs rdiff -u -r1.464 -r1.465 src/usr.bin/xlint/lint1/tree.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/xlint/lint1
Module Name:src Committed By: rillig Date: Fri Jul 1 17:48:50 UTC 2022 Modified Files: src/usr.bin/xlint/lint1: tree.c Log Message: lint: rename functions for value conversion No functional change. To generate a diff of this commit: cvs rdiff -u -r1.463 -r1.464 src/usr.bin/xlint/lint1/tree.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/xlint/lint1
Module Name:src Committed By: rillig Date: Fri Jul 1 17:48:50 UTC 2022 Modified Files: src/usr.bin/xlint/lint1: tree.c Log Message: lint: rename functions for value conversion No functional change. To generate a diff of this commit: cvs rdiff -u -r1.463 -r1.464 src/usr.bin/xlint/lint1/tree.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/xlint/lint1/tree.c diff -u src/usr.bin/xlint/lint1/tree.c:1.463 src/usr.bin/xlint/lint1/tree.c:1.464 --- src/usr.bin/xlint/lint1/tree.c:1.463 Fri Jun 24 21:22:11 2022 +++ src/usr.bin/xlint/lint1/tree.c Fri Jul 1 17:48:49 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: tree.c,v 1.463 2022/06/24 21:22:11 rillig Exp $ */ +/* $NetBSD: tree.c,v 1.464 2022/07/01 17:48:49 rillig Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -37,7 +37,7 @@ #include #if defined(__RCSID) -__RCSID("$NetBSD: tree.c,v 1.463 2022/06/24 21:22:11 rillig Exp $"); +__RCSID("$NetBSD: tree.c,v 1.464 2022/07/01 17:48:49 rillig Exp $"); #endif #include @@ -78,11 +78,11 @@ static void warn_incompatible_pointers(c static bool has_constant_member(const type_t *); static void check_prototype_conversion(int, tspec_t, tspec_t, type_t *, tnode_t *); -static void check_integer_conversion(op_t, int, tspec_t, tspec_t, type_t *, - tnode_t *); -static void check_pointer_integer_conversion(op_t, tspec_t, type_t *, - tnode_t *); -static void check_pointer_conversion(tnode_t *, type_t *); +static void convert_integer_from_integer(op_t, int, tspec_t, tspec_t, + type_t *, tnode_t *); +static void convert_integer_from_pointer(op_t, tspec_t, type_t *, + tnode_t *); +static void convert_pointer_from_pointer(type_t *, tnode_t *); static tnode_t *build_struct_access(op_t, bool, tnode_t *, tnode_t *); static tnode_t *build_prepost_incdec(op_t, bool, tnode_t *); static tnode_t *build_real_imag(op_t, bool, tnode_t *); @@ -2287,13 +2287,13 @@ convert(op_t op, int arg, type_t *tp, tn check_prototype_conversion(arg, nt, ot, tp, tn); if (is_integer(nt) && is_integer(ot)) { - check_integer_conversion(op, arg, nt, ot, tp, tn); + convert_integer_from_integer(op, arg, nt, ot, tp, tn); } else if (nt == PTR && is_null_pointer(tn)) { /* a null pointer may be assigned to any pointer. */ } else if (is_integer(nt) && nt != BOOL && ot == PTR) { - check_pointer_integer_conversion(op, nt, tp, tn); + convert_integer_from_pointer(op, nt, tp, tn); } else if (nt == PTR && ot == PTR && op == CVT) { - check_pointer_conversion(tn, tp); + convert_pointer_from_pointer(tp, tn); } ntn = expr_alloc_tnode(); @@ -2413,12 +2413,9 @@ can_represent(const type_t *tp, const tn return false; } -/* - * Print warnings for conversions of integer types which may cause problems. - */ static void -check_integer_conversion(op_t op, int arg, tspec_t nt, tspec_t ot, type_t *tp, - tnode_t *tn) +convert_integer_from_integer(op_t op, int arg, tspec_t nt, tspec_t ot, + type_t *tp, tnode_t *tn) { if (tn->tn_op == CON) @@ -2467,11 +2464,8 @@ check_integer_conversion(op_t op, int ar } } -/* - * Print warnings for dubious conversions of pointer to integer. - */ static void -check_pointer_integer_conversion(op_t op, tspec_t nt, type_t *tp, tnode_t *tn) +convert_integer_from_pointer(op_t op, tspec_t nt, type_t *tp, tnode_t *tn) { if (tn->tn_op == CON) @@ -2551,11 +2545,8 @@ should_warn_about_pointer_cast(const typ return portable_size_in_bits(nst) != portable_size_in_bits(ost); } -/* - * Warn about questionable pointer conversions. - */ static void -check_pointer_conversion(tnode_t *tn, type_t *ntp) +convert_pointer_from_pointer(type_t *ntp, tnode_t *tn) { const type_t *nstp, *otp, *ostp; tspec_t nst, ost;
CVS commit: src/sbin/shutdown
Module Name:src Committed By: wiz Date: Fri Jul 1 16:58:02 UTC 2022 Modified Files: src/sbin/shutdown: shutdown.8 Log Message: Fix At argument and remove superfluous Pp. To generate a diff of this commit: cvs rdiff -u -r1.34 -r1.35 src/sbin/shutdown/shutdown.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/shutdown/shutdown.8 diff -u src/sbin/shutdown/shutdown.8:1.34 src/sbin/shutdown/shutdown.8:1.35 --- src/sbin/shutdown/shutdown.8:1.34 Fri Jul 1 16:45:12 2022 +++ src/sbin/shutdown/shutdown.8 Fri Jul 1 16:58:02 2022 @@ -1,4 +1,4 @@ -.\" $NetBSD: shutdown.8,v 1.34 2022/07/01 16:45:12 kre Exp $ +.\" $NetBSD: shutdown.8,v 1.35 2022/07/01 16:58:02 wiz Exp $ .\" .\" Copyright (c) 1988, 1991, 1993 .\" The Regents of the University of California. All rights reserved. @@ -176,7 +176,6 @@ is supplied as the only argument after t from the standard input. .El .Sh BEHAVIOR -.Pp At intervals, becoming more frequent as apocalypse approaches and starting at ten hours before shutdown, warning messages are displayed on the terminals of all users logged in. @@ -245,6 +244,6 @@ a colon (``:'') for backward compatibili A .Nm command was originally written by Ian Johnstone for UNSW's modified -.At "6th Edn" , +.At v6 , modified, and then incorporated in .Bx 4.1 .
CVS commit: src/sbin/shutdown
Module Name:src Committed By: wiz Date: Fri Jul 1 16:58:02 UTC 2022 Modified Files: src/sbin/shutdown: shutdown.8 Log Message: Fix At argument and remove superfluous Pp. To generate a diff of this commit: cvs rdiff -u -r1.34 -r1.35 src/sbin/shutdown/shutdown.8 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sbin/shutdown
Module Name:src Committed By: kre Date: Fri Jul 1 16:45:13 UTC 2022 Modified Files: src/sbin/shutdown: shutdown.8 shutdown.c Log Message: Bring shutdown(8) into the 21st century. I found this juxtaposition in the shutdown man page kind of interesting: time Time is the time at which shutdown will bring the system down and may be the word now or a future time in one of two formats: ... [2nd format:] [cc]yy]mm]dd]hh]mm, ... If the century [cc] is not specified, it defaults to 1900 for years [yy] between 69 and 99, ... In that, all the "[text]" except the one "["(etc) sequence are my interjections, The ellipses ("...") represent where I omitted irrelevant (for here) text. Interesting yes, bizarre also. Requiring a future time, and then defaulting to the (long gone) 20th century (for any random year) makes no sense at all.So I fixed it. In another hundred years or so, anytime from 2100 onwards, but best left at least a decade into the new century, it will need altering again. [One could write the code to automate this adjustment, but the man page would still need updating.] More significant changes will be needed as the 101st century approaches (years 1 and beyond), as then a 2 digit century will no longer be adequate. Call me then, and if I'm able, I'll fix it. If someone really has a need to schedule a shutdown for sometime between 1969 and 1999 that can still be done by explicitly giving the "19" cc value. It is just no longer ever the default. Otherwise, now, years 20..90 mean the 21st century (2020..2099) (the first 2 of those are already unusable, but, IMO, that's OK) and years 00..19 mean the 22nd century (2100..2119) (except that 00, 2100, is still technically the final year of the 21st century). This is advance planning for near the end of the 21st century when someone wants to schedule a shutdown for early in the following century, and can't be bothered typing the 2 century digits. To generate a diff of this commit: cvs rdiff -u -r1.33 -r1.34 src/sbin/shutdown/shutdown.8 cvs rdiff -u -r1.57 -r1.58 src/sbin/shutdown/shutdown.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/shutdown/shutdown.8 diff -u src/sbin/shutdown/shutdown.8:1.33 src/sbin/shutdown/shutdown.8:1.34 --- src/sbin/shutdown/shutdown.8:1.33 Wed Sep 14 00:16:31 2016 +++ src/sbin/shutdown/shutdown.8 Fri Jul 1 16:45:12 2022 @@ -1,4 +1,4 @@ -.\" $NetBSD: shutdown.8,v 1.33 2016/09/14 00:16:31 kre Exp $ +.\" $NetBSD: shutdown.8,v 1.34 2022/07/01 16:45:12 kre Exp $ .\" .\" Copyright (c) 1988, 1991, 1993 .\" The Regents of the University of California. All rights reserved. @@ -29,7 +29,7 @@ .\" .\" @(#)shutdown.8 8.2 (Berkeley) 4/27/95 .\" -.Dd September 12, 2016 +.Dd July 1, 2022 .Dt SHUTDOWN 8 .Os .Sh NAME @@ -148,17 +148,22 @@ or a future time in one of two formats: .Ar +number , or .Ar [cc]yy]mm]dd]hh]mm , -where the century, year, month, day, and hour may be defaulted +where the century, year, month, day, and hour are two digit decimal +values, which may be defaulted to the current system values. +The two digit (decimal, even with a leading zero) minute field is +required in this form. The first form brings the system down .Ar number minutes from the current time; the second brings the system down at the absolute time specified. -If the century is not specified, it defaults to 1900 for years between 69 -and 99, or 2000 for years between 0 and 68. +If the century is not specified, but the year is, +the century defaults to 2000 (cc==20, the 21st century) +for years between 20 and 99, +or 2100 for years between 0 and 19. A leading zero in the .Dq yy -value is +value (as with all the others) is .Em not optional. .It Ar message ... Index: src/sbin/shutdown/shutdown.c diff -u src/sbin/shutdown/shutdown.c:1.57 src/sbin/shutdown/shutdown.c:1.58 --- src/sbin/shutdown/shutdown.c:1.57 Mon Aug 7 22:08:12 2017 +++ src/sbin/shutdown/shutdown.c Fri Jul 1 16:45:12 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: shutdown.c,v 1.57 2017/08/07 22:08:12 uwe Exp $ */ +/* $NetBSD: shutdown.c,v 1.58 2022/07/01 16:45:12 kre Exp $ */ /* * Copyright (c) 1988, 1990, 1993 @@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 19 #if 0 static char sccsid[] = "@(#)shutdown.c 8.4 (Berkeley) 4/28/95"; #else -__RCSID("$NetBSD: shutdown.c,v 1.57 2017/08/07 22:08:12 uwe Exp $"); +__RCSID("$NetBSD: shutdown.c,v 1.58 2022/07/01 16:45:12 kre Exp $"); #endif #endif /* not lint */ @@ -486,10 +486,10 @@ getoffset(char *timearg) lt->tm_year += ATOI2(timearg); } else { yearset = ATOI2(timearg); - if (yearset < 69) -lt->tm_year = yearset + 2000 - TM_YEAR_BASE; + if (yearset < 20) +lt->tm_year = yearset + 2100 - TM_YEAR_BASE; else -lt->tm_year = yearset + 1900 - TM_YEAR_BASE; +lt->tm_year = yearset + 2000 - TM_YE
CVS commit: src/sbin/shutdown
Module Name:src Committed By: kre Date: Fri Jul 1 16:45:13 UTC 2022 Modified Files: src/sbin/shutdown: shutdown.8 shutdown.c Log Message: Bring shutdown(8) into the 21st century. I found this juxtaposition in the shutdown man page kind of interesting: time Time is the time at which shutdown will bring the system down and may be the word now or a future time in one of two formats: ... [2nd format:] [cc]yy]mm]dd]hh]mm, ... If the century [cc] is not specified, it defaults to 1900 for years [yy] between 69 and 99, ... In that, all the "[text]" except the one "["(etc) sequence are my interjections, The ellipses ("...") represent where I omitted irrelevant (for here) text. Interesting yes, bizarre also. Requiring a future time, and then defaulting to the (long gone) 20th century (for any random year) makes no sense at all.So I fixed it. In another hundred years or so, anytime from 2100 onwards, but best left at least a decade into the new century, it will need altering again. [One could write the code to automate this adjustment, but the man page would still need updating.] More significant changes will be needed as the 101st century approaches (years 1 and beyond), as then a 2 digit century will no longer be adequate. Call me then, and if I'm able, I'll fix it. If someone really has a need to schedule a shutdown for sometime between 1969 and 1999 that can still be done by explicitly giving the "19" cc value. It is just no longer ever the default. Otherwise, now, years 20..90 mean the 21st century (2020..2099) (the first 2 of those are already unusable, but, IMO, that's OK) and years 00..19 mean the 22nd century (2100..2119) (except that 00, 2100, is still technically the final year of the 21st century). This is advance planning for near the end of the 21st century when someone wants to schedule a shutdown for early in the following century, and can't be bothered typing the 2 century digits. To generate a diff of this commit: cvs rdiff -u -r1.33 -r1.34 src/sbin/shutdown/shutdown.8 cvs rdiff -u -r1.57 -r1.58 src/sbin/shutdown/shutdown.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/kern
Module Name:src Committed By: prlw1 Date: Fri Jul 1 09:54:36 UTC 2022 Modified Files: src/sys/kern: kern_fork.c Log Message: Uglify code to fix build. To generate a diff of this commit: cvs rdiff -u -r1.228 -r1.229 src/sys/kern/kern_fork.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/kern
Module Name:src Committed By: prlw1 Date: Fri Jul 1 09:54:36 UTC 2022 Modified Files: src/sys/kern: kern_fork.c Log Message: Uglify code to fix build. To generate a diff of this commit: cvs rdiff -u -r1.228 -r1.229 src/sys/kern/kern_fork.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/kern/kern_fork.c diff -u src/sys/kern/kern_fork.c:1.228 src/sys/kern/kern_fork.c:1.229 --- src/sys/kern/kern_fork.c:1.228 Fri Jul 1 01:05:21 2022 +++ src/sys/kern/kern_fork.c Fri Jul 1 09:54:36 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: kern_fork.c,v 1.228 2022/07/01 01:05:21 riastradh Exp $ */ +/* $NetBSD: kern_fork.c,v 1.229 2022/07/01 09:54:36 prlw1 Exp $ */ /*- * Copyright (c) 1999, 2001, 2004, 2006, 2007, 2008, 2019 @@ -68,7 +68,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: kern_fork.c,v 1.228 2022/07/01 01:05:21 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kern_fork.c,v 1.229 2022/07/01 09:54:36 prlw1 Exp $"); #include "opt_ktrace.h" #include "opt_dtrace.h" @@ -311,8 +311,7 @@ fork1(struct lwp *l1, int flags, int exi /* We were unable to allocate a process ID. */ uvm_uarea_free(uaddr); mutex_enter(p1->p_lock); - cred = p1->p_cred; - uid = kauth_cred_getuid(cred); + uid = kauth_cred_getuid(p1->p_cred); (void)chgproccnt(uid, -1); mutex_exit(p1->p_lock); atomic_dec_uint(&nprocs);