CVS commit: src/common/lib/libc/stdlib
Module Name:src Committed By: kre Date: Wed Jul 24 09:11:28 UTC 2024 Modified Files: src/common/lib/libc/stdlib: _strtoi.h Log Message: PR lib/58461 PR lib/58453 portability fixes Revert previous (1.4) and make the changes properly. If base is invalid, what gets left in *endptr by strtoimax() is unspecified (it is not guaranteed to be either nptr or unaltered) and so cannot (in that case) be used in any way at all. Since it is hard to determine from some implementations of strtoimax() whether this happened or not, simply duplicate the validity test for base here, so we know that error (EINVAL because base is invalid) cannot occur from strtoimax(). In that case, if we get an EINVAL from strtoimax we can simply ignore it, as all it can mean is the (optional in POSIX) case where no conversion occurred (where strtoi() sets the status to ECANCELED). Since NetBSD never did that, this all changes nothing here, but makes strtoi() portable to other environments using a different version of strtoimax(). NFCI. No pullups required, nothing has really changed, there never was a NetBSD bug to fix. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/common/lib/libc/stdlib/_strtoi.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/common/lib/libc/stdlib/_strtoi.h diff -u src/common/lib/libc/stdlib/_strtoi.h:1.4 src/common/lib/libc/stdlib/_strtoi.h:1.5 --- src/common/lib/libc/stdlib/_strtoi.h:1.4 Sun Jul 21 17:40:42 2024 +++ src/common/lib/libc/stdlib/_strtoi.h Wed Jul 24 09:11:27 2024 @@ -1,9 +1,8 @@ -/* $NetBSD: _strtoi.h,v 1.4 2024/07/21 17:40:42 christos Exp $ */ +/* $NetBSD: _strtoi.h,v 1.5 2024/07/24 09:11:27 kre Exp $ */ /*- * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. - * Copyright (c) 2024, Alejandro Colomar * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -70,7 +69,7 @@ INT_FUNCNAME(_int_, _FUNCNAME, _l)(const int serrno; #endif __TYPE im; - char *e; + char *ep; int rep; _DIAGASSERT(hi >= lo); @@ -78,11 +77,26 @@ INT_FUNCNAME(_int_, _FUNCNAME, _l)(const _DIAGASSERT(nptr != NULL); /* endptr may be NULL */ - e = NULL; + if (endptr == NULL) + endptr = if (rstatus == NULL) rstatus = + *rstatus = 0; /* assume there will be no errors */ + + if (base != 0 && (base < 2 || base > 36)) { +#if !defined(_KERNEL) && !defined(_STANDALONE) + *rstatus = EINVAL; + if (endptr != NULL) + /* LINTED interface specification */ + *endptr = __UNCONST(nptr); + return 0; +#else + panic("%s: invalid base %d", __func__, base); +#endif + } + #if !defined(_KERNEL) && !defined(_STANDALONE) serrno = errno; errno = 0; @@ -90,21 +104,20 @@ INT_FUNCNAME(_int_, _FUNCNAME, _l)(const #if defined(_KERNEL) || defined(_STANDALONE) || \ defined(HAVE_NBTOOL_CONFIG_H) || defined(BCS_ONLY) - im = __WRAPPED(nptr, , base); + im = __WRAPPED(nptr, endptr, base); #else - im = __WRAPPED_L(nptr, , base, loc); + im = __WRAPPED_L(nptr, endptr, base, loc); #endif #if !defined(_KERNEL) && !defined(_STANDALONE) - *rstatus = errno; + /* EINVAL here can only mean "nothing converted" */ + if (errno != EINVAL) + *rstatus = errno; errno = serrno; #endif - if (endptr != NULL && e != NULL) - *endptr = e; - /* No digits were found */ - if (nptr == e && (*rstatus == 0 || *rstatus == EINVAL)) + if (*rstatus == 0 && nptr == *endptr) *rstatus = ECANCELED; if (im < lo) { @@ -120,7 +133,7 @@ INT_FUNCNAME(_int_, _FUNCNAME, _l)(const } /* There are further characters after number */ - if (*rstatus == 0 && *e != '\0') + if (*rstatus == 0 && **endptr != '\0') *rstatus = ENOTSUP; return im;
CVS commit: src/common/lib/libc/stdlib
Module Name:src Committed By: kre Date: Wed Jul 24 09:11:28 UTC 2024 Modified Files: src/common/lib/libc/stdlib: _strtoi.h Log Message: PR lib/58461 PR lib/58453 portability fixes Revert previous (1.4) and make the changes properly. If base is invalid, what gets left in *endptr by strtoimax() is unspecified (it is not guaranteed to be either nptr or unaltered) and so cannot (in that case) be used in any way at all. Since it is hard to determine from some implementations of strtoimax() whether this happened or not, simply duplicate the validity test for base here, so we know that error (EINVAL because base is invalid) cannot occur from strtoimax(). In that case, if we get an EINVAL from strtoimax we can simply ignore it, as all it can mean is the (optional in POSIX) case where no conversion occurred (where strtoi() sets the status to ECANCELED). Since NetBSD never did that, this all changes nothing here, but makes strtoi() portable to other environments using a different version of strtoimax(). NFCI. No pullups required, nothing has really changed, there never was a NetBSD bug to fix. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/common/lib/libc/stdlib/_strtoi.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/common/lib/libc/stdlib
Module Name:src Committed By: christos Date: Sun Jul 21 17:40:42 UTC 2024 Modified Files: src/common/lib/libc/stdlib: _strtoi.h Log Message: POSIX allows systems that report EINVAL when no digits are found. On such systems the only way to differentiate EINVAL and ECANCELED is to initialized the end pointer to NULL before the call. On EINVAL cases, strto*max(3) will leave the pointer unmodified, so we'll read back the original NULL. On ECANCELED cases, strto*max(3) will set it to nptr. This also prevents UB read of endptr on an unsupported base argument. (Alejandro Colomar) To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/common/lib/libc/stdlib/_strtoi.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/common/lib/libc/stdlib/_strtoi.h diff -u src/common/lib/libc/stdlib/_strtoi.h:1.3 src/common/lib/libc/stdlib/_strtoi.h:1.4 --- src/common/lib/libc/stdlib/_strtoi.h:1.3 Sat Jan 20 11:13:39 2024 +++ src/common/lib/libc/stdlib/_strtoi.h Sun Jul 21 13:40:42 2024 @@ -1,8 +1,9 @@ -/* $NetBSD: _strtoi.h,v 1.3 2024/01/20 16:13:39 christos Exp $ */ +/* $NetBSD: _strtoi.h,v 1.4 2024/07/21 17:40:42 christos Exp $ */ /*- * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. + * Copyright (c) 2024, Alejandro Colomar * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -69,7 +70,7 @@ INT_FUNCNAME(_int_, _FUNCNAME, _l)(const int serrno; #endif __TYPE im; - char *ep; + char *e; int rep; _DIAGASSERT(hi >= lo); @@ -77,8 +78,7 @@ INT_FUNCNAME(_int_, _FUNCNAME, _l)(const _DIAGASSERT(nptr != NULL); /* endptr may be NULL */ - if (endptr == NULL) - endptr = + e = NULL; if (rstatus == NULL) rstatus = @@ -90,9 +90,9 @@ INT_FUNCNAME(_int_, _FUNCNAME, _l)(const #if defined(_KERNEL) || defined(_STANDALONE) || \ defined(HAVE_NBTOOL_CONFIG_H) || defined(BCS_ONLY) - im = __WRAPPED(nptr, endptr, base); + im = __WRAPPED(nptr, , base); #else - im = __WRAPPED_L(nptr, endptr, base, loc); + im = __WRAPPED_L(nptr, , base, loc); #endif #if !defined(_KERNEL) && !defined(_STANDALONE) @@ -100,8 +100,11 @@ INT_FUNCNAME(_int_, _FUNCNAME, _l)(const errno = serrno; #endif + if (endptr != NULL && e != NULL) + *endptr = e; + /* No digits were found */ - if (*rstatus == 0 && nptr == *endptr) + if (nptr == e && (*rstatus == 0 || *rstatus == EINVAL)) *rstatus = ECANCELED; if (im < lo) { @@ -117,7 +120,7 @@ INT_FUNCNAME(_int_, _FUNCNAME, _l)(const } /* There are further characters after number */ - if (*rstatus == 0 && **endptr != '\0') + if (*rstatus == 0 && *e != '\0') *rstatus = ENOTSUP; return im;
CVS commit: src/common/lib/libc/stdlib
Module Name:src Committed By: christos Date: Sun Jul 21 17:40:42 UTC 2024 Modified Files: src/common/lib/libc/stdlib: _strtoi.h Log Message: POSIX allows systems that report EINVAL when no digits are found. On such systems the only way to differentiate EINVAL and ECANCELED is to initialized the end pointer to NULL before the call. On EINVAL cases, strto*max(3) will leave the pointer unmodified, so we'll read back the original NULL. On ECANCELED cases, strto*max(3) will set it to nptr. This also prevents UB read of endptr on an unsupported base argument. (Alejandro Colomar) To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/common/lib/libc/stdlib/_strtoi.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/common/lib/libc/arch/x86_64/atomic
Module Name:src Committed By: riastradh Date: Tue Jul 16 22:45:10 UTC 2024 Modified Files: src/common/lib/libc/arch/x86_64/atomic: atomic.S Log Message: amd64: Fix performance regression in uniprocessor atomics/membars. Back in 2022, I eliminated the MFENCE hotpatch in membar_sync because it's essentially always more expensive than LOCK ADD with no benefit for CPU/CPU store-before-load ordering. (It is relevant only for non-temporal stores or write-combining memory.) https://mail-index.netbsd.org/source-changes/2022/07/30/msg140047.html But in that change, I made a mistake and _also_ eliminated the LOCK hotpatch on uniprocessor amd64. And our assembler gas helpfully interprets uppercase LOCK just like lowercase lock and assembles them the same way, so I didn't notice. This change restores the LOCK hotpatch, so that when booting on a uniprocessor system (or a uniprocessor guest on a multicore host), the LOCK prefix is replaced by NOP for a cheaper instruction. Found by puzzling over how my explanation for PR kern/57199 could possibly be correct when (on an amd64 guest) ddb x/i membar_sync kept showing the lock prefix even in uniprocessor boots. To generate a diff of this commit: cvs rdiff -u -r1.30 -r1.31 src/common/lib/libc/arch/x86_64/atomic/atomic.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/common/lib/libc/arch/x86_64/atomic
Module Name:src Committed By: riastradh Date: Tue Jul 16 22:45:10 UTC 2024 Modified Files: src/common/lib/libc/arch/x86_64/atomic: atomic.S Log Message: amd64: Fix performance regression in uniprocessor atomics/membars. Back in 2022, I eliminated the MFENCE hotpatch in membar_sync because it's essentially always more expensive than LOCK ADD with no benefit for CPU/CPU store-before-load ordering. (It is relevant only for non-temporal stores or write-combining memory.) https://mail-index.netbsd.org/source-changes/2022/07/30/msg140047.html But in that change, I made a mistake and _also_ eliminated the LOCK hotpatch on uniprocessor amd64. And our assembler gas helpfully interprets uppercase LOCK just like lowercase lock and assembles them the same way, so I didn't notice. This change restores the LOCK hotpatch, so that when booting on a uniprocessor system (or a uniprocessor guest on a multicore host), the LOCK prefix is replaced by NOP for a cheaper instruction. Found by puzzling over how my explanation for PR kern/57199 could possibly be correct when (on an amd64 guest) ddb x/i membar_sync kept showing the lock prefix even in uniprocessor boots. To generate a diff of this commit: cvs rdiff -u -r1.30 -r1.31 src/common/lib/libc/arch/x86_64/atomic/atomic.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/common/lib/libc/arch/x86_64/atomic/atomic.S diff -u src/common/lib/libc/arch/x86_64/atomic/atomic.S:1.30 src/common/lib/libc/arch/x86_64/atomic/atomic.S:1.31 --- src/common/lib/libc/arch/x86_64/atomic/atomic.S:1.30 Tue Jul 16 22:44:38 2024 +++ src/common/lib/libc/arch/x86_64/atomic/atomic.S Tue Jul 16 22:45:10 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: atomic.S,v 1.30 2024/07/16 22:44:38 riastradh Exp $ */ +/* $NetBSD: atomic.S,v 1.31 2024/07/16 22:45:10 riastradh Exp $ */ /*- * Copyright (c) 2007 The NetBSD Foundation, Inc. @@ -38,6 +38,13 @@ #define ALIAS(f, t) WEAK_ALIAS(f,t) #endif +#ifdef _HARDKERNEL +#include +#define LOCK HOTPATCH(HP_NAME_NOLOCK, 1); lock +#else +#define LOCK lock +#endif + .text /* 32-bit */
CVS commit: src/common/lib/libc/stdlib
Module Name:src Committed By: rin Date: Sat Jun 29 07:56:57 UTC 2024 Modified Files: src/common/lib/libc/stdlib: getopt.c Log Message: getopt(): Make this built for _KERNEL || _STANDALONE NFC as a libc routine. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/common/lib/libc/stdlib/getopt.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/common/lib/libc/stdlib/getopt.c diff -u src/common/lib/libc/stdlib/getopt.c:1.1 src/common/lib/libc/stdlib/getopt.c:1.2 --- src/common/lib/libc/stdlib/getopt.c:1.1 Sat Jun 29 07:55:05 2024 +++ src/common/lib/libc/stdlib/getopt.c Sat Jun 29 07:56:56 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: getopt.c,v 1.1 2024/06/29 07:55:05 rin Exp $ */ +/* $NetBSD: getopt.c,v 1.2 2024/06/29 07:56:56 rin Exp $ */ /* * Copyright (c) 1987, 1993, 1994 @@ -30,7 +30,16 @@ */ #include -__RCSID("$NetBSD: getopt.c,v 1.1 2024/06/29 07:55:05 rin Exp $"); +__RCSID("$NetBSD: getopt.c,v 1.2 2024/06/29 07:56:56 rin Exp $"); + +#if defined(_KERNEL) || defined(_STANDALONE) + +#include +#include + +#define EPRINTF(fmt, args...) printf(fmt, ##args) + +#else #include "namespace.h" @@ -45,6 +54,11 @@ __RCSID("$NetBSD: getopt.c,v 1.1 2024/06 __weak_alias(getopt,_getopt) #endif +#define EPRINTF(fmt, args...) \ +fprintf(stderr, "%s: " fmt, getprogname(), ##args) + +#endif /* !_KERNEL && !_STANDALONE */ + int opterr = 1, /* if error message should be printed */ optind = 1, /* index into parent argv vector */ optopt, /* character checked for validity */ @@ -99,9 +113,7 @@ getopt(int nargc, char * const nargv[], if (*place == 0) ++optind; if (opterr && *ostr != ':') - (void)fprintf(stderr, - "%s: unknown option -- %c\n", getprogname(), - optopt); + (void)EPRINTF("unknown option -- %c\n", optopt); return (BADCH); } @@ -130,9 +142,9 @@ getopt(int nargc, char * const nargv[], if (*ostr == ':') return (BADARG); if (opterr) -(void)fprintf(stderr, -"%s: option requires an argument -- %c\n", -getprogname(), optopt); +(void)EPRINTF( +"option requires an argument -- %c\n", +optopt); return (BADCH); } place = EMSG;
CVS commit: src/common/lib/libc/stdlib
Module Name:src Committed By: rin Date: Sat Jun 29 07:56:57 UTC 2024 Modified Files: src/common/lib/libc/stdlib: getopt.c Log Message: getopt(): Make this built for _KERNEL || _STANDALONE NFC as a libc routine. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/common/lib/libc/stdlib/getopt.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/common/lib/libutil
Module Name:src Committed By: rillig Date: Sun Jun 16 19:41:39 UTC 2024 Modified Files: src/common/lib/libutil: snprintb.c Log Message: libutil/snprintb: factor out common subexpression GCC 10 was not able to optimize the code size on its own, so offer a little help. To generate a diff of this commit: cvs rdiff -u -r1.48 -r1.49 src/common/lib/libutil/snprintb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/common/lib/libutil/snprintb.c diff -u src/common/lib/libutil/snprintb.c:1.48 src/common/lib/libutil/snprintb.c:1.49 --- src/common/lib/libutil/snprintb.c:1.48 Sun Apr 7 15:20:16 2024 +++ src/common/lib/libutil/snprintb.c Sun Jun 16 19:41:39 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: snprintb.c,v 1.48 2024/04/07 15:20:16 rillig Exp $ */ +/* $NetBSD: snprintb.c,v 1.49 2024/06/16 19:41:39 rillig Exp $ */ /*- * Copyright (c) 2002, 2024 The NetBSD Foundation, Inc. @@ -35,7 +35,7 @@ # include # if defined(LIBC_SCCS) -__RCSID("$NetBSD: snprintb.c,v 1.48 2024/04/07 15:20:16 rillig Exp $"); +__RCSID("$NetBSD: snprintb.c,v 1.49 2024/06/16 19:41:39 rillig Exp $"); # endif # include @@ -46,7 +46,7 @@ __RCSID("$NetBSD: snprintb.c,v 1.48 2024 # include # else /* ! _KERNEL */ # include -__KERNEL_RCSID(0, "$NetBSD: snprintb.c,v 1.48 2024/04/07 15:20:16 rillig Exp $"); +__KERNEL_RCSID(0, "$NetBSD: snprintb.c,v 1.49 2024/06/16 19:41:39 rillig Exp $"); # include # include # include @@ -252,17 +252,21 @@ finish_buffer(state *s) if (s->line_max > 0) { store_eol(s); store(s, '\0'); - if (s->bufsize >= 3 && s->total_len > s->bufsize) + if (s->total_len <= s->bufsize) + return; + if (s->bufsize >= 3) s->buf[s->bufsize - 3] = '#'; - if (s->bufsize >= 2 && s->total_len > s->bufsize) + if (s->bufsize >= 2) s->buf[s->bufsize - 2] = '\0'; - if (s->bufsize >= 1 && s->total_len > s->bufsize) + if (s->bufsize >= 1) s->buf[s->bufsize - 1] = '\0'; } else { store(s, '\0'); - if (s->bufsize >= 2 && s->total_len > s->bufsize) + if (s->total_len <= s->bufsize) + return; + if (s->bufsize >= 2) s->buf[s->bufsize - 2] = '#'; - if (s->bufsize >= 1 && s->total_len > s->bufsize) + if (s->bufsize >= 1) s->buf[s->bufsize - 1] = '\0'; } }
CVS commit: src/common/lib/libutil
Module Name:src Committed By: rillig Date: Sun Jun 16 19:41:39 UTC 2024 Modified Files: src/common/lib/libutil: snprintb.c Log Message: libutil/snprintb: factor out common subexpression GCC 10 was not able to optimize the code size on its own, so offer a little help. To generate a diff of this commit: cvs rdiff -u -r1.48 -r1.49 src/common/lib/libutil/snprintb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/common/lib/libc/rpc
Module Name:src Committed By: msaitoh Date: Sun May 12 23:52:58 UTC 2024 Modified Files: src/common/lib/libc/rpc: xdr.c Log Message: s/descriminated/discriminated/ in comment. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/common/lib/libc/rpc/xdr.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/common/lib/libc/rpc/xdr.c diff -u src/common/lib/libc/rpc/xdr.c:1.3 src/common/lib/libc/rpc/xdr.c:1.4 --- src/common/lib/libc/rpc/xdr.c:1.3 Sun Jun 16 16:01:44 2019 +++ src/common/lib/libc/rpc/xdr.c Sun May 12 23:52:57 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: xdr.c,v 1.3 2019/06/16 16:01:44 christos Exp $ */ +/* $NetBSD: xdr.c,v 1.4 2024/05/12 23:52:57 msaitoh Exp $ */ /* * Copyright (c) 2010, Oracle America, Inc. @@ -37,7 +37,7 @@ static char *sccsid = "@(#)xdr.c 1.35 87/08/12"; static char *sccsid = "@(#)xdr.c 2.1 88/07/29 4.0 RPCSRC"; #else -__RCSID("$NetBSD: xdr.c,v 1.3 2019/06/16 16:01:44 christos Exp $"); +__RCSID("$NetBSD: xdr.c,v 1.4 2024/05/12 23:52:57 msaitoh Exp $"); #endif #endif @@ -674,7 +674,7 @@ xdr_netobj(XDR *xdrs, struct netobj *np) } /* - * XDR a descriminated union + * XDR a discriminated union * Support routine for discriminated unions. * You create an array of xdrdiscrim structures, terminated with * an entry with a null procedure pointer. The routine gets
CVS commit: src/common/lib/libc/rpc
Module Name:src Committed By: msaitoh Date: Sun May 12 23:52:58 UTC 2024 Modified Files: src/common/lib/libc/rpc: xdr.c Log Message: s/descriminated/discriminated/ in comment. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/common/lib/libc/rpc/xdr.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/common/lib/libc/gen
Module Name:src Committed By: chs Date: Sat May 4 17:58:24 UTC 2024 Modified Files: src/common/lib/libc/gen: radixtree.c Log Message: radixtree: allocate memory with KM_NOSLEEP to prevent pagedaemon hangs Revert the part of rev 1.32 (reapplying "Do away with separate pool_cache for some kernel objects") that changed the memory allocation for radixtree nodes from PR_NOWAIT to KM_SLEEP as part of changing from a pool to kmem. uvm_pageinsert_tree() calls into the radixtree code while holding the object's vmobjlock, but that same lock is taken by the pagedaemon in the process of reclaiming pages, and if the pagedaemon happens to choose the same object to reclaim from that uvm_pageinsert_tree() is being called on, then these two threads will deadlock. The previous code already handled memory allocation failures in uvm_pageinsert_tree() so we can simply change it back to nosleep. Fixes a hang reported by simonb@, and the fix was also tested by him. To generate a diff of this commit: cvs rdiff -u -r1.33 -r1.34 src/common/lib/libc/gen/radixtree.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/common/lib/libc/gen/radixtree.c diff -u src/common/lib/libc/gen/radixtree.c:1.33 src/common/lib/libc/gen/radixtree.c:1.34 --- src/common/lib/libc/gen/radixtree.c:1.33 Sat Sep 23 19:17:38 2023 +++ src/common/lib/libc/gen/radixtree.c Sat May 4 17:58:24 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: radixtree.c,v 1.33 2023/09/23 19:17:38 ad Exp $ */ +/* $NetBSD: radixtree.c,v 1.34 2024/05/04 17:58:24 chs Exp $ */ /*- * Copyright (c)2011,2012,2013 YAMAMOTO Takashi, @@ -112,7 +112,7 @@ #include #if defined(_KERNEL) || defined(_STANDALONE) -__KERNEL_RCSID(0, "$NetBSD: radixtree.c,v 1.33 2023/09/23 19:17:38 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: radixtree.c,v 1.34 2024/05/04 17:58:24 chs Exp $"); #include #include #include @@ -122,7 +122,7 @@ __KERNEL_RCSID(0, "$NetBSD: radixtree.c, #include #endif /* defined(_STANDALONE) */ #else /* defined(_KERNEL) || defined(_STANDALONE) */ -__RCSID("$NetBSD: radixtree.c,v 1.33 2023/09/23 19:17:38 ad Exp $"); +__RCSID("$NetBSD: radixtree.c,v 1.34 2024/05/04 17:58:24 chs Exp $"); #include #include #include @@ -410,9 +410,10 @@ radix_tree_alloc_node(void) #if defined(_KERNEL) /* - * note that kmem_alloc can block. + * We must not block waiting for memory because this function + * can be called in contexts where waiting for memory is illegal. */ - n = kmem_intr_alloc(sizeof(struct radix_tree_node), KM_SLEEP); + n = kmem_intr_alloc(sizeof(struct radix_tree_node), KM_NOSLEEP); #elif defined(_STANDALONE) n = alloc(sizeof(*n)); #else /* defined(_STANDALONE) */
CVS commit: src/common/lib/libc/gen
Module Name:src Committed By: chs Date: Sat May 4 17:58:24 UTC 2024 Modified Files: src/common/lib/libc/gen: radixtree.c Log Message: radixtree: allocate memory with KM_NOSLEEP to prevent pagedaemon hangs Revert the part of rev 1.32 (reapplying "Do away with separate pool_cache for some kernel objects") that changed the memory allocation for radixtree nodes from PR_NOWAIT to KM_SLEEP as part of changing from a pool to kmem. uvm_pageinsert_tree() calls into the radixtree code while holding the object's vmobjlock, but that same lock is taken by the pagedaemon in the process of reclaiming pages, and if the pagedaemon happens to choose the same object to reclaim from that uvm_pageinsert_tree() is being called on, then these two threads will deadlock. The previous code already handled memory allocation failures in uvm_pageinsert_tree() so we can simply change it back to nosleep. Fixes a hang reported by simonb@, and the fix was also tested by him. To generate a diff of this commit: cvs rdiff -u -r1.33 -r1.34 src/common/lib/libc/gen/radixtree.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/common/lib/libutil
Module Name:src Committed By: rillig Date: Mon Apr 1 08:53:42 UTC 2024 Modified Files: src/common/lib/libutil: snprintb.c Log Message: snprintb: remove redundant memset in kernel mode The provided buffer is already null-terminated by finish_buffer, even in error cases, there is no need to repeat the same work. To generate a diff of this commit: cvs rdiff -u -r1.44 -r1.45 src/common/lib/libutil/snprintb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/common/lib/libutil/snprintb.c diff -u src/common/lib/libutil/snprintb.c:1.44 src/common/lib/libutil/snprintb.c:1.45 --- src/common/lib/libutil/snprintb.c:1.44 Mon Mar 25 20:39:26 2024 +++ src/common/lib/libutil/snprintb.c Mon Apr 1 08:53:42 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: snprintb.c,v 1.44 2024/03/25 20:39:26 rillig Exp $ */ +/* $NetBSD: snprintb.c,v 1.45 2024/04/01 08:53:42 rillig Exp $ */ /*- * Copyright (c) 2002, 2024 The NetBSD Foundation, Inc. @@ -35,7 +35,7 @@ # include # if defined(LIBC_SCCS) -__RCSID("$NetBSD: snprintb.c,v 1.44 2024/03/25 20:39:26 rillig Exp $"); +__RCSID("$NetBSD: snprintb.c,v 1.45 2024/04/01 08:53:42 rillig Exp $"); # endif # include @@ -46,7 +46,7 @@ __RCSID("$NetBSD: snprintb.c,v 1.44 2024 # include # else /* ! _KERNEL */ # include -__KERNEL_RCSID(0, "$NetBSD: snprintb.c,v 1.44 2024/03/25 20:39:26 rillig Exp $"); +__KERNEL_RCSID(0, "$NetBSD: snprintb.c,v 1.45 2024/04/01 08:53:42 rillig Exp $"); # include # include # include @@ -251,15 +251,6 @@ int snprintb_m(char *buf, size_t bufsize, const char *bitfmt, uint64_t val, size_t line_max) { -#ifdef _KERNEL - /* - * For safety; no other *s*printf() do this, but in the kernel - * we don't usually check the return value. - */ - if (bufsize > 0) - (void)memset(buf, 0, bufsize); -#endif /* _KERNEL */ - int old = *bitfmt != '\177'; if (!old) bitfmt++;
CVS commit: src/common/lib/libutil
Module Name:src Committed By: rillig Date: Mon Apr 1 08:53:42 UTC 2024 Modified Files: src/common/lib/libutil: snprintb.c Log Message: snprintb: remove redundant memset in kernel mode The provided buffer is already null-terminated by finish_buffer, even in error cases, there is no need to repeat the same work. To generate a diff of this commit: cvs rdiff -u -r1.44 -r1.45 src/common/lib/libutil/snprintb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/common/lib/libc/arch
Module Name:src Committed By: andvar Date: Sat Mar 30 22:03:39 UTC 2024 Modified Files: src/common/lib/libc/arch/i386/string: strlen.S src/common/lib/libc/arch/x86_64/string: strlen.S Log Message: s/Westley/Wesley/ in a book reference (in comments). To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/common/lib/libc/arch/i386/string/strlen.S cvs rdiff -u -r1.7 -r1.8 src/common/lib/libc/arch/x86_64/string/strlen.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/common/lib/libc/arch/i386/string/strlen.S diff -u src/common/lib/libc/arch/i386/string/strlen.S:1.4 src/common/lib/libc/arch/i386/string/strlen.S:1.5 --- src/common/lib/libc/arch/i386/string/strlen.S:1.4 Wed Dec 8 20:11:54 2021 +++ src/common/lib/libc/arch/i386/string/strlen.S Sat Mar 30 22:03:39 2024 @@ -6,7 +6,7 @@ #include #if defined(LIBC_SCCS) - RCSID("$NetBSD: strlen.S,v 1.4 2021/12/08 20:11:54 andvar Exp $") + RCSID("$NetBSD: strlen.S,v 1.5 2024/03/30 22:03:39 andvar Exp $") #endif ENTRY(strlen) @@ -89,7 +89,7 @@ ENTRY(strlen) * to load constants. * * - * [1] Henry S. Warren Jr., "Hacker's Delight", Addison-Westley 2003 + * [1] Henry S. Warren Jr., "Hacker's Delight", Addison-Wesley 2003 * * [2] International Business Machines, "The PowerPC Compiler Writer's * Guide", Warthman Associates, 1996 Index: src/common/lib/libc/arch/x86_64/string/strlen.S diff -u src/common/lib/libc/arch/x86_64/string/strlen.S:1.7 src/common/lib/libc/arch/x86_64/string/strlen.S:1.8 --- src/common/lib/libc/arch/x86_64/string/strlen.S:1.7 Wed Dec 8 20:11:54 2021 +++ src/common/lib/libc/arch/x86_64/string/strlen.S Sat Mar 30 22:03:39 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: strlen.S,v 1.7 2021/12/08 20:11:54 andvar Exp $ */ +/* $NetBSD: strlen.S,v 1.8 2024/03/30 22:03:39 andvar Exp $ */ /*- * Copyright (c) 2009 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ #include #if defined(LIBC_SCCS) - RCSID("$NetBSD: strlen.S,v 1.7 2021/12/08 20:11:54 andvar Exp $") + RCSID("$NetBSD: strlen.S,v 1.8 2024/03/30 22:03:39 andvar Exp $") #endif /* @@ -108,7 +108,7 @@ * to load constants. * * - * [1] Henry S. Warren Jr., "Hacker's Delight", Addison-Westley 2003 + * [1] Henry S. Warren Jr., "Hacker's Delight", Addison-Wesley 2003 * * [2] International Business Machines, "The PowerPC Compiler Writer's * Guide", Warthman Associates, 1996
CVS commit: src/common/lib/libc/arch
Module Name:src Committed By: andvar Date: Sat Mar 30 22:03:39 UTC 2024 Modified Files: src/common/lib/libc/arch/i386/string: strlen.S src/common/lib/libc/arch/x86_64/string: strlen.S Log Message: s/Westley/Wesley/ in a book reference (in comments). To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/common/lib/libc/arch/i386/string/strlen.S cvs rdiff -u -r1.7 -r1.8 src/common/lib/libc/arch/x86_64/string/strlen.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/common/lib/libutil
Module Name:src Committed By: rillig Date: Tue Mar 5 07:37:08 UTC 2024 Modified Files: src/common/lib/libutil: snprintb.c Log Message: snprintb: shrink code size, both in source and binary To generate a diff of this commit: cvs rdiff -u -r1.42 -r1.43 src/common/lib/libutil/snprintb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/common/lib/libutil
Module Name:src Committed By: rillig Date: Tue Mar 5 07:37:08 UTC 2024 Modified Files: src/common/lib/libutil: snprintb.c Log Message: snprintb: shrink code size, both in source and binary To generate a diff of this commit: cvs rdiff -u -r1.42 -r1.43 src/common/lib/libutil/snprintb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/common/lib/libutil/snprintb.c diff -u src/common/lib/libutil/snprintb.c:1.42 src/common/lib/libutil/snprintb.c:1.43 --- src/common/lib/libutil/snprintb.c:1.42 Mon Mar 4 21:35:28 2024 +++ src/common/lib/libutil/snprintb.c Tue Mar 5 07:37:08 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: snprintb.c,v 1.42 2024/03/04 21:35:28 rillig Exp $ */ +/* $NetBSD: snprintb.c,v 1.43 2024/03/05 07:37:08 rillig Exp $ */ /*- * Copyright (c) 2002, 2024 The NetBSD Foundation, Inc. @@ -35,17 +35,18 @@ # include # if defined(LIBC_SCCS) -__RCSID("$NetBSD: snprintb.c,v 1.42 2024/03/04 21:35:28 rillig Exp $"); +__RCSID("$NetBSD: snprintb.c,v 1.43 2024/03/05 07:37:08 rillig Exp $"); # endif # include # include # include +# include # include # include # else /* ! _KERNEL */ # include -__KERNEL_RCSID(0, "$NetBSD: snprintb.c,v 1.42 2024/03/04 21:35:28 rillig Exp $"); +__KERNEL_RCSID(0, "$NetBSD: snprintb.c,v 1.43 2024/03/05 07:37:08 rillig Exp $"); # include # include # include @@ -60,7 +61,7 @@ typedef struct { uint64_t const val; size_t const line_max; - const char *const num_fmt; + char num_fmt[5]; size_t total_len; size_t line_pos; size_t comma_pos; @@ -255,48 +256,42 @@ snprintb_m(char *buf, size_t bufsize, co if (!old) bitfmt++; - const char *num_fmt; - switch (*bitfmt++) { - case 8: - num_fmt = "%#jo"; - break; - case 10: - num_fmt = "%ju"; - break; - case 16: - num_fmt = "%#jx"; - break; - default: - num_fmt = NULL; - } - state s = { .buf = buf, .bufsize = bufsize, .bitfmt = bitfmt, .val = val, .line_max = line_max, - .num_fmt = num_fmt, }; - if (num_fmt == NULL) - goto internal; + int had_error = 0; - store_num(, num_fmt, val); + switch (*s.bitfmt++) { + case 8: + memcpy(s.num_fmt, "%#jo", 4); + break; + case 10: + memcpy(s.num_fmt, "%ju", 4); + break; + case 16: + memcpy(s.num_fmt, "%#jx", 4); + break; + default: + goto had_error; + } - if ((old ? old_style() : new_style()) < 0) - goto internal; + store_num(, s.num_fmt, val); - if (s.in_angle_brackets) - store(, '>'); - finish_buffer(); - return (int)(s.total_len - 1); -internal: + if ((old ? old_style() : new_style()) < 0) { +had_error: #ifndef _KERNEL - errno = EINVAL; + errno = EINVAL; #endif - store(, '#'); + had_error = 1; + store(, '#'); + } else if (s.in_angle_brackets) + store(, '>'); finish_buffer(); - return -1; + return had_error ? -1 : (int)(s.total_len - 1); } int
CVS commit: src/common/lib/libutil
Module Name:src Committed By: rillig Date: Sat Feb 24 12:44:11 UTC 2024 Modified Files: src/common/lib/libutil: snprintb.c Log Message: snprintb: clean up Use consistent data types for buffer positions and lengths, to avoid type casts. To generate a diff of this commit: cvs rdiff -u -r1.40 -r1.41 src/common/lib/libutil/snprintb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/common/lib/libutil
Module Name:src Committed By: rillig Date: Sat Feb 24 12:44:11 UTC 2024 Modified Files: src/common/lib/libutil: snprintb.c Log Message: snprintb: clean up Use consistent data types for buffer positions and lengths, to avoid type casts. To generate a diff of this commit: cvs rdiff -u -r1.40 -r1.41 src/common/lib/libutil/snprintb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/common/lib/libutil/snprintb.c diff -u src/common/lib/libutil/snprintb.c:1.40 src/common/lib/libutil/snprintb.c:1.41 --- src/common/lib/libutil/snprintb.c:1.40 Sat Feb 24 12:40:00 2024 +++ src/common/lib/libutil/snprintb.c Sat Feb 24 12:44:11 2024 @@ -1,7 +1,7 @@ -/* $NetBSD: snprintb.c,v 1.40 2024/02/24 12:40:00 rillig Exp $ */ +/* $NetBSD: snprintb.c,v 1.41 2024/02/24 12:44:11 rillig Exp $ */ /*- - * Copyright (c) 2002 The NetBSD Foundation, Inc. + * Copyright (c) 2002, 2024 The NetBSD Foundation, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -26,12 +26,6 @@ * POSSIBILITY OF SUCH DAMAGE. */ -/* - * snprintb: print an interpreted bitmask to a buffer - * - * => returns the length of the buffer that would be required to print the - *string minus the terminating NUL. - */ #ifndef _STANDALONE # ifndef _KERNEL @@ -40,8 +34,8 @@ # endif # include -# if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: snprintb.c,v 1.40 2024/02/24 12:40:00 rillig Exp $"); +# if defined(LIBC_SCCS) +__RCSID("$NetBSD: snprintb.c,v 1.41 2024/02/24 12:44:11 rillig Exp $"); # endif # include @@ -51,7 +45,7 @@ __RCSID("$NetBSD: snprintb.c,v 1.40 2024 # include # else /* ! _KERNEL */ # include -__KERNEL_RCSID(0, "$NetBSD: snprintb.c,v 1.40 2024/02/24 12:40:00 rillig Exp $"); +__KERNEL_RCSID(0, "$NetBSD: snprintb.c,v 1.41 2024/02/24 12:44:11 rillig Exp $"); # include # include # include @@ -67,10 +61,10 @@ typedef struct { size_t const line_max; const char *const num_fmt; - unsigned total_len; - unsigned line_pos; - unsigned comma_pos; - char sep; + size_t total_len; + size_t line_pos; + size_t comma_pos; + int in_angle_brackets; } state; static void @@ -94,39 +88,39 @@ store_num(state *s, const char *fmt, uin } static void -put_eol(state *s) +store_eol(state *s) { if (s->total_len - s->line_pos > s->line_max) { - s->total_len = (unsigned)(s->line_pos + s->line_max - 1); + s->total_len = s->line_pos + s->line_max - 1; store(s, '#'); } store(s, '\0'); s->line_pos = s->total_len; s->comma_pos = 0; - s->sep = '<'; + s->in_angle_brackets = 0; } static void -put_sep(state *s) +store_delimiter(state *s) { - if (s->sep == ',') { + if (s->in_angle_brackets) { s->comma_pos = s->total_len; store(s, ','); } else { store(s, '<'); - s->sep = ','; + s->in_angle_brackets = 1; } } static void -wrap_if_necessary(state *s, const char *bitfmt) +maybe_wrap_line(state *s, const char *bitfmt) { if (s->line_max > 0 && s->comma_pos > 0 && s->total_len - s->line_pos >= s->line_max) { s->total_len = s->comma_pos; store(s, '>'); - put_eol(s); + store_eol(s); store_num(s, s->num_fmt, s->val); s->bitfmt = bitfmt; } @@ -141,10 +135,10 @@ old_style(state *s) if (bit > ' ') return -1; if (s->val & (1U << (bit - 1))) { - put_sep(s); + store_delimiter(s); while ((uint8_t)*++s->bitfmt > ' ') store(s, *s->bitfmt); - wrap_if_necessary(s, cur_bitfmt); + maybe_wrap_line(s, cur_bitfmt); } else while ((uint8_t)*++s->bitfmt > ' ') continue; @@ -170,10 +164,10 @@ new_style(state *s) s->bitfmt += 2; if (((s->val >> b_bit) & 1) == 0) goto skip_description; - put_sep(s); + store_delimiter(s); while (*s->bitfmt++ != '\0') store(s, s->bitfmt[-1]); - wrap_if_necessary(s, cur_bitfmt); + maybe_wrap_line(s, cur_bitfmt); break; case 'f': case 'F': @@ -189,14 +183,14 @@ new_style(state *s) if (f_width < 64) field &= ((uint64_t) 1 << f_width) - 1; s->bitfmt += 3; - put_sep(s); + store_delimiter(s); if (kind == 'F') goto skip_description; while (*s->bitfmt++ != '\0') store(s, s->bitfmt[-1]); store(s, '='); store_num(s, s->num_fmt, field); - wrap_if_necessary(s, cur_bitfmt); + maybe_wrap_line(s, cur_bitfmt); break; case '=': case ':': @@ -209,7 +203,7 @@ new_style(state *s) store(s, '='); while (*s->bitfmt++ != '\0') store(s, s->bitfmt[-1]); - wrap_if_necessary(s, prev_bitfmt); + maybe_wrap_line(s, prev_bitfmt); break; case '*': s->bitfmt++; @@ -218,7 +212,7 @@ new_style(state *s) matched = 1; if (store_num(s, s->bitfmt, field) < 0) return -1; - wrap_if_necessary(s, prev_bitfmt); + maybe_wrap_line(s, prev_bitfmt); goto skip_description; default: s->bitfmt += 2; @@ -235,7 +229,7 @@ static void finish_buffer(state
CVS commit: src/common/lib/libc/gmon
Module Name:src Committed By: christos Date: Fri Feb 23 13:32:28 UTC 2024 Modified Files: src/common/lib/libc/gmon: mcount.c Log Message: fix static unused issue until lint understands attributes better. To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/common/lib/libc/gmon/mcount.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/common/lib/libc/gmon/mcount.c diff -u src/common/lib/libc/gmon/mcount.c:1.17 src/common/lib/libc/gmon/mcount.c:1.18 --- src/common/lib/libc/gmon/mcount.c:1.17 Mon Aug 30 08:52:32 2021 +++ src/common/lib/libc/gmon/mcount.c Fri Feb 23 08:32:28 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: mcount.c,v 1.17 2021/08/30 12:52:32 christos Exp $ */ +/* $NetBSD: mcount.c,v 1.18 2024/02/23 13:32:28 christos Exp $ */ /* * Copyright (c) 2003, 2004 Wasabi Systems, Inc. @@ -76,7 +76,7 @@ #if 0 static char sccsid[] = "@(#)mcount.c 8.1 (Berkeley) 6/4/93"; #else -__RCSID("$NetBSD: mcount.c,v 1.17 2021/08/30 12:52:32 christos Exp $"); +__RCSID("$NetBSD: mcount.c,v 1.18 2024/02/23 13:32:28 christos Exp $"); #endif #endif @@ -127,6 +127,7 @@ _MCOUNT_DECL(u_long, u_long) * perform this optimization. */ /* _mcount; may be static, inline, etc */ +/*LINTED unused*/ _MCOUNT_DECL(u_long frompc, u_long selfpc) { u_short *frompcindex;
CVS commit: src/common/lib/libc/gmon
Module Name:src Committed By: christos Date: Fri Feb 23 13:32:28 UTC 2024 Modified Files: src/common/lib/libc/gmon: mcount.c Log Message: fix static unused issue until lint understands attributes better. To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/common/lib/libc/gmon/mcount.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/common/lib/libutil
Module Name:src Committed By: rillig Date: Sat Feb 17 10:23:30 UTC 2024 Modified Files: src/common/lib/libutil: snprintb.c Log Message: snprintb: convert macros to local functions Let the compiler decide whether to inline the functions; allow stepping through the code in a debugger. To generate a diff of this commit: cvs rdiff -u -r1.34 -r1.35 src/common/lib/libutil/snprintb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/common/lib/libutil/snprintb.c diff -u src/common/lib/libutil/snprintb.c:1.34 src/common/lib/libutil/snprintb.c:1.35 --- src/common/lib/libutil/snprintb.c:1.34 Fri Feb 16 21:25:46 2024 +++ src/common/lib/libutil/snprintb.c Sat Feb 17 10:23:30 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: snprintb.c,v 1.34 2024/02/16 21:25:46 rillig Exp $ */ +/* $NetBSD: snprintb.c,v 1.35 2024/02/17 10:23:30 rillig Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -41,7 +41,7 @@ # include # if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: snprintb.c,v 1.34 2024/02/16 21:25:46 rillig Exp $"); +__RCSID("$NetBSD: snprintb.c,v 1.35 2024/02/17 10:23:30 rillig Exp $"); # endif # include @@ -51,7 +51,7 @@ __RCSID("$NetBSD: snprintb.c,v 1.34 2024 # include # else /* ! _KERNEL */ # include -__KERNEL_RCSID(0, "$NetBSD: snprintb.c,v 1.34 2024/02/16 21:25:46 rillig Exp $"); +__KERNEL_RCSID(0, "$NetBSD: snprintb.c,v 1.35 2024/02/17 10:23:30 rillig Exp $"); # include # include # include @@ -59,14 +59,204 @@ __KERNEL_RCSID(0, "$NetBSD: snprintb.c,v # endif /* ! _KERNEL */ # ifndef HAVE_SNPRINTB_M +typedef struct { + char *const buf; + size_t const bufsize; + const char *bitfmt; + uint64_t const val; + size_t const line_max; + + const char *const num_fmt; + unsigned const val_len; + unsigned total_len; + unsigned line_len; + + const char *cur_bitfmt; + int restart; + + const char *sep_bitfmt; + unsigned sep_line_len; + char sep; +} state; + +static void +store(state *s, char c) +{ + if (s->total_len < s->bufsize) + s->buf[s->total_len] = c; + s->total_len++; + s->line_len++; +} + +static void +backup(state *s) +{ + if (s->sep_line_len > 0) { + s->total_len -= s->line_len - s->sep_line_len; + s->sep_line_len = 0; + s->restart = 1; + s->bitfmt = s->sep_bitfmt; + } + store(s, '>'); + store(s, '\0'); + if (s->total_len < s->bufsize) + snprintf(s->buf + s->total_len, s->bufsize - s->total_len, + s->num_fmt, (uintmax_t)s->val); + s->total_len += s->val_len; + s->line_len = s->val_len; +} + +static void +put_sep(state *s) +{ + if (s->line_max > 0 && s->line_len >= s->line_max) { + backup(s); + store(s, '<'); + } else { + if (s->line_max > 0 && s->sep != '<') { + s->sep_line_len = s->line_len; + s->sep_bitfmt = s->cur_bitfmt; + } + store(s, s->sep); + s->restart = 0; + } +} + +static void +put_chr(state *s, char c) +{ + if (s->line_max > 0 && s->line_len >= s->line_max - 1) { + backup(s); + if (s->restart == 0) + store(s, c); + else + s->sep = '<'; + } else { + store(s, c); + s->restart = 0; + } +} + +static void +put_bitfmt(state *s) +{ + while (*s->bitfmt++ != 0) { + put_chr(s, s->bitfmt[-1]); + if (s->restart) + break; + } +} + +static int +put_num(state *s, const char *fmt, uintmax_t v) +{ + char *bp = s->total_len < s->bufsize ? s->buf + s->total_len : NULL; + size_t n = s->total_len < s->bufsize ? s->bufsize - s->total_len : 0; + int fmt_len = snprintf(bp, n, fmt, v); + if (fmt_len >= 0) { + s->total_len += fmt_len; + s->line_len += fmt_len; + } + return fmt_len; +} + +static void +old_style(state *s) +{ + for (uint8_t bit; (bit = *s->bitfmt) != 0;) { + s->cur_bitfmt = s->bitfmt++; + if (s->val & (1U << (bit - 1))) { + put_sep(s); + if (s->restart) +continue; + s->sep = ','; + for (; *s->bitfmt > ' '; ++s->bitfmt) { +put_chr(s, *s->bitfmt); +if (s->restart) + break; + } + } else + for (; *s->bitfmt > ' '; ++s->bitfmt) +continue; + } +} + +static int +new_style(state *s) +{ + uint64_t field = s->val; + int matched = 1; + while (*s->bitfmt != '\0') { + uint8_t kind = *s->bitfmt++; + uint8_t bit = *s->bitfmt++; + switch (kind) { + case 'b': + if (((s->val >> bit) & 1) == 0) +goto skip; + s->cur_bitfmt = s->bitfmt - 2; + put_sep(s); + if (s->restart) +break; + put_bitfmt(s); + if (s->restart == 0) +s->sep = ','; + break; + case 'f': + case 'F': + matched = 0; + s->cur_bitfmt = s->bitfmt - 2; + uint8_t field_width = *s->bitfmt++; + field = (s->val >> bit) & + (((uint64_t)1 << field_width) - 1); + put_sep(s); + if (s->restart == 0) +s->sep = ','; + if (kind == 'F') +goto skip; + if (s->restart == 0) +put_bitfmt(s); + if (s->restart == 0) +put_chr(s, '='); + if (s->restart == 0) { +if (put_num(s, s->num_fmt, field) < 0) + return -1; +if (s->line_max > 0 +&& s->line_len > s->line_max) +
CVS commit: src/common/lib/libutil
Module Name:src Committed By: rillig Date: Sat Feb 17 10:23:30 UTC 2024 Modified Files: src/common/lib/libutil: snprintb.c Log Message: snprintb: convert macros to local functions Let the compiler decide whether to inline the functions; allow stepping through the code in a debugger. To generate a diff of this commit: cvs rdiff -u -r1.34 -r1.35 src/common/lib/libutil/snprintb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/common/lib/libutil
Module Name:src Committed By: rillig Date: Fri Feb 16 21:25:46 UTC 2024 Modified Files: src/common/lib/libutil: snprintb.c Log Message: snprintb: do not modify bufsize when producing multiple lines To generate a diff of this commit: cvs rdiff -u -r1.33 -r1.34 src/common/lib/libutil/snprintb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/common/lib/libutil/snprintb.c diff -u src/common/lib/libutil/snprintb.c:1.33 src/common/lib/libutil/snprintb.c:1.34 --- src/common/lib/libutil/snprintb.c:1.33 Fri Feb 16 19:53:40 2024 +++ src/common/lib/libutil/snprintb.c Fri Feb 16 21:25:46 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: snprintb.c,v 1.33 2024/02/16 19:53:40 rillig Exp $ */ +/* $NetBSD: snprintb.c,v 1.34 2024/02/16 21:25:46 rillig Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -41,7 +41,7 @@ # include # if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: snprintb.c,v 1.33 2024/02/16 19:53:40 rillig Exp $"); +__RCSID("$NetBSD: snprintb.c,v 1.34 2024/02/16 21:25:46 rillig Exp $"); # endif # include @@ -51,7 +51,7 @@ __RCSID("$NetBSD: snprintb.c,v 1.33 2024 # include # else /* ! _KERNEL */ # include -__KERNEL_RCSID(0, "$NetBSD: snprintb.c,v 1.33 2024/02/16 19:53:40 rillig Exp $"); +__KERNEL_RCSID(0, "$NetBSD: snprintb.c,v 1.34 2024/02/16 21:25:46 rillig Exp $"); # include # include # include @@ -92,10 +92,6 @@ snprintb_m(char *buf, size_t bufsize, co goto internal; } - /* Reserve space for trailing blank line if needed */ - if (line_max > 0) - bufsize--; - int val_len = snprintf(buf, bufsize, num_fmt, (uintmax_t)val); if (val_len < 0) goto internal; @@ -268,13 +264,12 @@ snprintb_m(char *buf, size_t bufsize, co if (sep != '<') STORE('>'); if (line_max > 0) { - bufsize++; STORE('\0'); - if (total_len >= bufsize && bufsize > 1) + if (bufsize >= 2 && total_len > bufsize - 2) buf[bufsize - 2] = '\0'; } STORE('\0'); - if (total_len >= bufsize && bufsize > 0) + if (bufsize >= 1 && total_len > bufsize - 1) buf[bufsize - 1] = '\0'; return (int)(total_len - 1); internal:
CVS commit: src/common/lib/libutil
Module Name:src Committed By: rillig Date: Fri Feb 16 21:25:46 UTC 2024 Modified Files: src/common/lib/libutil: snprintb.c Log Message: snprintb: do not modify bufsize when producing multiple lines To generate a diff of this commit: cvs rdiff -u -r1.33 -r1.34 src/common/lib/libutil/snprintb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/common/lib/libutil
Module Name:src Committed By: rillig Date: Fri Feb 16 19:31:25 UTC 2024 Modified Files: src/common/lib/libutil: snprintb.c Log Message: snprintb: use size_t for buffer sizes and positions To generate a diff of this commit: cvs rdiff -u -r1.31 -r1.32 src/common/lib/libutil/snprintb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/common/lib/libutil/snprintb.c diff -u src/common/lib/libutil/snprintb.c:1.31 src/common/lib/libutil/snprintb.c:1.32 --- src/common/lib/libutil/snprintb.c:1.31 Fri Feb 16 19:20:38 2024 +++ src/common/lib/libutil/snprintb.c Fri Feb 16 19:31:25 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: snprintb.c,v 1.31 2024/02/16 19:20:38 rillig Exp $ */ +/* $NetBSD: snprintb.c,v 1.32 2024/02/16 19:31:25 rillig Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -41,7 +41,7 @@ # include # if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: snprintb.c,v 1.31 2024/02/16 19:20:38 rillig Exp $"); +__RCSID("$NetBSD: snprintb.c,v 1.32 2024/02/16 19:31:25 rillig Exp $"); # endif # include @@ -51,7 +51,7 @@ __RCSID("$NetBSD: snprintb.c,v 1.31 2024 # include # else /* ! _KERNEL */ # include -__KERNEL_RCSID(0, "$NetBSD: snprintb.c,v 1.31 2024/02/16 19:20:38 rillig Exp $"); +__KERNEL_RCSID(0, "$NetBSD: snprintb.c,v 1.32 2024/02/16 19:31:25 rillig Exp $"); # include # include # include @@ -65,7 +65,6 @@ snprintb_m(char *buf, size_t bufsize, co { char *bp = buf, *sep_bp = NULL; const char *num_fmt, *cur_bitfmt, *sep_bitfmt = NULL; - int total_len, val_len, line_len, sep_line_len = 0; char sep; int restart = 0; @@ -98,20 +97,20 @@ snprintb_m(char *buf, size_t bufsize, co if (line_max > 0) bufsize--; - total_len = snprintf(bp, bufsize, num_fmt, (uintmax_t)val); - if (total_len < 0) + int val_len = snprintf(bp, bufsize, num_fmt, (uintmax_t)val); + if (val_len < 0) goto internal; - val_len = line_len = total_len; + size_t total_len = val_len, line_len = val_len, sep_line_len = 0; - if ((size_t)total_len < bufsize) + if (total_len < bufsize) bp += total_len; else bp += bufsize - 1; #define STORE(c) do { \ line_len++; \ - if ((size_t)(++total_len) < bufsize) \ + if (++total_len < bufsize)\ *bp++ = (c); \ } while (0) @@ -125,7 +124,7 @@ snprintb_m(char *buf, size_t bufsize, co } \ STORE('>'); \ STORE('\0'); \ - if ((size_t)total_len < bufsize) \ + if (total_len < bufsize)\ snprintf(bp, bufsize - total_len, num_fmt, \ (uintmax_t)val);\ total_len += val_len; \ @@ -134,7 +133,7 @@ snprintb_m(char *buf, size_t bufsize, co } while (0) #define PUTSEP() do { \ - if (line_max > 0 && (size_t)line_len >= line_max) { \ + if (line_max > 0 && line_len >= line_max) { \ BACKUP(); \ STORE('<'); \ } else { \ @@ -150,7 +149,7 @@ snprintb_m(char *buf, size_t bufsize, co } while (0) #define PUTCHR(c) do { \ - if (line_max > 0 && (size_t)line_len >= line_max - 1) { \ + if (line_max > 0 && line_len >= line_max - 1) { \ BACKUP(); \ if (restart == 0)\ STORE(c);\ @@ -171,14 +170,14 @@ snprintb_m(char *buf, size_t bufsize, co } while (0) #define FMTSTR(sb, f) do { \ - size_t n = (size_t)total_len < bufsize \ + size_t n = total_len < bufsize\ ? bufsize - total_len : 0;\ int fmt_len = snprintf(bp, n, sb, (uintmax_t)f); \ if (fmt_len < 0) \ goto internal; \ total_len += fmt_len; \ line_len += fmt_len; \ - if ((size_t)total_len < bufsize) \ + if (total_len < bufsize)\ bp += fmt_len; \ } while (0) @@ -243,7 +242,7 @@ snprintb_m(char *buf, size_t bufsize, co if (restart == 0) { FMTSTR(num_fmt, field); if (line_max > 0 - && (size_t)line_len > line_max) + && line_len > line_max) PUTCHR('#'); } break; @@ -282,13 +281,13 @@ snprintb_m(char *buf, size_t bufsize, co if (line_max > 0) { bufsize++; STORE('\0'); - if ((size_t)total_len >= bufsize && bufsize > 1) + if (total_len >= bufsize && bufsize > 1) buf[bufsize - 2] = '\0'; } STORE('\0'); - if ((size_t)total_len >= bufsize && bufsize > 0) + if (total_len >= bufsize && bufsize > 0) buf[bufsize - 1] = '\0'; - return total_len - 1; + return (int)(total_len - 1); internal: #ifndef _KERNEL errno = EINVAL;
CVS commit: src/common/lib/libutil
Module Name:src Committed By: rillig Date: Fri Feb 16 19:31:25 UTC 2024 Modified Files: src/common/lib/libutil: snprintb.c Log Message: snprintb: use size_t for buffer sizes and positions To generate a diff of this commit: cvs rdiff -u -r1.31 -r1.32 src/common/lib/libutil/snprintb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/common/lib/libutil
Module Name:src Committed By: rillig Date: Fri Feb 16 18:17:10 UTC 2024 Modified Files: src/common/lib/libutil: snprintb.c Log Message: snprintb: use unsigned integers for parsing the bitfmt To generate a diff of this commit: cvs rdiff -u -r1.29 -r1.30 src/common/lib/libutil/snprintb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/common/lib/libutil/snprintb.c diff -u src/common/lib/libutil/snprintb.c:1.29 src/common/lib/libutil/snprintb.c:1.30 --- src/common/lib/libutil/snprintb.c:1.29 Fri Feb 16 18:09:15 2024 +++ src/common/lib/libutil/snprintb.c Fri Feb 16 18:17:10 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: snprintb.c,v 1.29 2024/02/16 18:09:15 rillig Exp $ */ +/* $NetBSD: snprintb.c,v 1.30 2024/02/16 18:17:10 rillig Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -41,7 +41,7 @@ # include # if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: snprintb.c,v 1.29 2024/02/16 18:09:15 rillig Exp $"); +__RCSID("$NetBSD: snprintb.c,v 1.30 2024/02/16 18:17:10 rillig Exp $"); # endif # include @@ -51,7 +51,7 @@ __RCSID("$NetBSD: snprintb.c,v 1.29 2024 # include # else /* ! _KERNEL */ # include -__KERNEL_RCSID(0, "$NetBSD: snprintb.c,v 1.29 2024/02/16 18:09:15 rillig Exp $"); +__KERNEL_RCSID(0, "$NetBSD: snprintb.c,v 1.30 2024/02/16 18:17:10 rillig Exp $"); # include # include # include @@ -184,7 +184,7 @@ snprintb_m(char *buf, size_t bufsize, co sep = '<'; if (old_style) { /* old-style format, 32-bit, 1-origin. */ - for (int bit; (bit = *bitfmt) != 0;) { + for (uint8_t bit; (bit = *bitfmt) != 0;) { cur_bitfmt = bitfmt++; if (val & (1U << (bit - 1))) { PUTSEP(); @@ -205,7 +205,7 @@ snprintb_m(char *buf, size_t bufsize, co uint64_t field = val; int matched = 1; while (*bitfmt != '\0') { - char kind = *bitfmt++; + uint8_t kind = *bitfmt++; uint8_t bit = *bitfmt++; switch (kind) { case 'b': @@ -223,7 +223,7 @@ snprintb_m(char *buf, size_t bufsize, co case 'F': matched = 0; cur_bitfmt = bitfmt - 2; -int field_width = *bitfmt++; +uint8_t field_width = *bitfmt++; field = (val >> bit) & (((uint64_t)1 << field_width) - 1); PUTSEP();
CVS commit: src/common/lib/libutil
Module Name:src Committed By: rillig Date: Fri Feb 16 18:17:10 UTC 2024 Modified Files: src/common/lib/libutil: snprintb.c Log Message: snprintb: use unsigned integers for parsing the bitfmt To generate a diff of this commit: cvs rdiff -u -r1.29 -r1.30 src/common/lib/libutil/snprintb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/common/lib/libutil
Module Name:src Committed By: rillig Date: Fri Feb 16 18:03:16 UTC 2024 Modified Files: src/common/lib/libutil: snprintb.c Log Message: snprintb: eliminate a few local variables To generate a diff of this commit: cvs rdiff -u -r1.27 -r1.28 src/common/lib/libutil/snprintb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/common/lib/libutil/snprintb.c diff -u src/common/lib/libutil/snprintb.c:1.27 src/common/lib/libutil/snprintb.c:1.28 --- src/common/lib/libutil/snprintb.c:1.27 Fri Feb 16 17:42:49 2024 +++ src/common/lib/libutil/snprintb.c Fri Feb 16 18:03:16 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: snprintb.c,v 1.27 2024/02/16 17:42:49 rillig Exp $ */ +/* $NetBSD: snprintb.c,v 1.28 2024/02/16 18:03:16 rillig Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -41,7 +41,7 @@ # include # if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: snprintb.c,v 1.27 2024/02/16 17:42:49 rillig Exp $"); +__RCSID("$NetBSD: snprintb.c,v 1.28 2024/02/16 18:03:16 rillig Exp $"); # endif # include @@ -51,7 +51,7 @@ __RCSID("$NetBSD: snprintb.c,v 1.27 2024 # include # else /* ! _KERNEL */ # include -__KERNEL_RCSID(0, "$NetBSD: snprintb.c,v 1.27 2024/02/16 17:42:49 rillig Exp $"); +__KERNEL_RCSID(0, "$NetBSD: snprintb.c,v 1.28 2024/02/16 18:03:16 rillig Exp $"); # include # include # include @@ -64,9 +64,9 @@ snprintb_m(char *buf, size_t bufsize, co size_t line_max) { char *bp = buf, *sep_bp = NULL; - const char *c_fmt, *sep_fmt = NULL, *cur_fmt; - const char *num_fmt; - int ch, total_len, sep_line_len = 0, line_len, val_len, sep; + const char *num_fmt, *cur_bitfmt, *sep_bitfmt = NULL; + int total_len, val_len, line_len, sep_line_len = 0; + char sep; int restart = 0; #ifdef _KERNEL @@ -77,8 +77,10 @@ snprintb_m(char *buf, size_t bufsize, co (void)memset(buf, 0, bufsize); #endif /* _KERNEL */ - ch = *bitfmt++; - switch (ch != '\177' ? ch : *bitfmt++) { + int old_style = *bitfmt != '\177'; + if (!old_style) + bitfmt++; + switch (*bitfmt++) { case 8: num_fmt = "%#jo"; break; @@ -107,9 +109,6 @@ snprintb_m(char *buf, size_t bufsize, co else bp += bufsize - 1; - if (val == 0 && ch != '\177') - goto done; - #define STORE(c) do { \ line_len++; \ if ((size_t)(++total_len) < bufsize) \ @@ -122,7 +121,7 @@ snprintb_m(char *buf, size_t bufsize, co sep_bp = NULL; \ total_len -= line_len - sep_line_len; \ restart = 1; \ - bitfmt = sep_fmt;\ + bitfmt = sep_bitfmt;\ } \ STORE('>'); \ STORE('\0'); \ @@ -143,7 +142,7 @@ snprintb_m(char *buf, size_t bufsize, co if (line_max > 0 && sep != '<') { \ sep_line_len = line_len; \ sep_bp = bp;\ -sep_fmt = cur_fmt; \ +sep_bitfmt = cur_bitfmt; \ } \ STORE(sep); \ restart = 0; \ @@ -164,8 +163,8 @@ snprintb_m(char *buf, size_t bufsize, co } while (0) #define PUTS(s) do { \ - while ((ch = *(s)++) != 0) {\ - PUTCHR(ch); \ + while ((*(s)++) != 0) { \ + PUTCHR((s)[-1]);\ if (restart) \ break; \ } \ @@ -183,17 +182,17 @@ snprintb_m(char *buf, size_t bufsize, co } while (0) sep = '<'; - if (ch != '\177') { + if (old_style) { /* old-style format, 32-bit, 1-origin. */ for (int bit; (bit = *bitfmt) != 0;) { - cur_fmt = bitfmt++; + cur_bitfmt = bitfmt++; if (val & (1U << (bit - 1))) { PUTSEP(); if (restart) continue; sep = ','; -for (; (ch = *bitfmt) > ' '; ++bitfmt) { - PUTCHR(ch); +for (; *bitfmt > ' '; ++bitfmt) { + PUTCHR(*bitfmt); if (restart) break; } @@ -205,13 +204,14 @@ snprintb_m(char *buf, size_t bufsize, co /* new-style format, 64-bit, 0-origin; also does fields. */ uint64_t field = val; int matched = 1; - while (c_fmt = bitfmt, (ch = *bitfmt++) != '\0') { + while (*bitfmt != '\0') { + char kind = *bitfmt++; int bit = *bitfmt++; - switch (ch) { + switch (kind) { case 'b': if (((val >> bit) & 1) == 0) goto skip; -cur_fmt = c_fmt; +cur_bitfmt = bitfmt - 2; PUTSEP(); if (restart) break; @@ -222,14 +222,14 @@ snprintb_m(char *buf, size_t bufsize, co case 'f': case 'F': matched = 0; -cur_fmt = c_fmt; +cur_bitfmt = bitfmt - 2; int field_width = *bitfmt++; field = (val >> bit) & (((uint64_t)1 << field_width) - 1); PUTSEP(); if (restart == 0) sep = ','; -if (ch == 'F') { /* just extract */ +if (kind == 'F') { /* just extract */ /* duplicate PUTS() effect on bitfmt */ while (*bitfmt++ != '\0') continue; @@ -257,7 +257,7 @@ snprintb_m(char *buf, size_t bufsize, co if ((int)field != bit) goto skip; matched = 1; -if (ch == '=') +if (kind == '=') PUTCHR('='); PUTS(bitfmt);
CVS commit: src/common/lib/libutil
Module Name:src Committed By: rillig Date: Fri Feb 16 18:03:16 UTC 2024 Modified Files: src/common/lib/libutil: snprintb.c Log Message: snprintb: eliminate a few local variables To generate a diff of this commit: cvs rdiff -u -r1.27 -r1.28 src/common/lib/libutil/snprintb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/common/lib/libutil
Module Name:src Committed By: rillig Date: Fri Feb 16 17:42:50 UTC 2024 Modified Files: src/common/lib/libutil: snprintb.c Log Message: snprintb: rename local variables The single-letter variables 't', 's', 'l' and 'c' were too hard to decipher. The variable 'f_len' was used for two independent purposes. Use a narrow scope for some variables, to avoid having to keep track of 22 individual variables at the same time. No binary change. To generate a diff of this commit: cvs rdiff -u -r1.26 -r1.27 src/common/lib/libutil/snprintb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/common/lib/libutil/snprintb.c diff -u src/common/lib/libutil/snprintb.c:1.26 src/common/lib/libutil/snprintb.c:1.27 --- src/common/lib/libutil/snprintb.c:1.26 Fri Feb 16 01:57:50 2024 +++ src/common/lib/libutil/snprintb.c Fri Feb 16 17:42:49 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: snprintb.c,v 1.26 2024/02/16 01:57:50 rillig Exp $ */ +/* $NetBSD: snprintb.c,v 1.27 2024/02/16 17:42:49 rillig Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -41,7 +41,7 @@ # include # if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: snprintb.c,v 1.26 2024/02/16 01:57:50 rillig Exp $"); +__RCSID("$NetBSD: snprintb.c,v 1.27 2024/02/16 17:42:49 rillig Exp $"); # endif # include @@ -51,7 +51,7 @@ __RCSID("$NetBSD: snprintb.c,v 1.26 2024 # include # else /* ! _KERNEL */ # include -__KERNEL_RCSID(0, "$NetBSD: snprintb.c,v 1.26 2024/02/16 01:57:50 rillig Exp $"); +__KERNEL_RCSID(0, "$NetBSD: snprintb.c,v 1.27 2024/02/16 17:42:49 rillig Exp $"); # include # include # include @@ -61,14 +61,13 @@ __KERNEL_RCSID(0, "$NetBSD: snprintb.c,v # ifndef HAVE_SNPRINTB_M int snprintb_m(char *buf, size_t bufsize, const char *bitfmt, uint64_t val, - size_t l_max) + size_t line_max) { - char *bp = buf, *s_bp = NULL; - const char *c_fmt, *s_fmt = NULL, *cur_fmt; - const char *sbase; - int bit, ch, t_len, s_len = 0, l_len, f_len, v_len, sep; - int restart = 0, matched = 1; - uint64_t field; + char *bp = buf, *sep_bp = NULL; + const char *c_fmt, *sep_fmt = NULL, *cur_fmt; + const char *num_fmt; + int ch, total_len, sep_line_len = 0, line_len, val_len, sep; + int restart = 0; #ifdef _KERNEL /* @@ -81,73 +80,70 @@ snprintb_m(char *buf, size_t bufsize, co ch = *bitfmt++; switch (ch != '\177' ? ch : *bitfmt++) { case 8: - sbase = "%#jo"; + num_fmt = "%#jo"; break; case 10: - sbase = "%ju"; + num_fmt = "%ju"; break; case 16: - sbase = "%#jx"; + num_fmt = "%#jx"; break; default: goto internal; } /* Reserve space for trailing blank line if needed */ - if (l_max > 0) + if (line_max > 0) bufsize--; - t_len = snprintf(bp, bufsize, sbase, (uintmax_t)val); - if (t_len < 0) + total_len = snprintf(bp, bufsize, num_fmt, (uintmax_t)val); + if (total_len < 0) goto internal; - v_len = l_len = t_len; + val_len = line_len = total_len; - if ((size_t)t_len < bufsize) - bp += t_len; + if ((size_t)total_len < bufsize) + bp += total_len; else bp += bufsize - 1; - /* - * If the value we printed was 0 and we're using the old-style format, - * we're done. - */ if (val == 0 && ch != '\177') - goto terminate; + goto done; #define STORE(c) do { \ - l_len++; \ - if ((size_t)(++t_len) < bufsize) \ + line_len++; \ + if ((size_t)(++total_len) < bufsize) \ *bp++ = (c); \ } while (0) #define BACKUP() do { \ - if (s_bp != NULL) { \ - bp = s_bp; \ - s_bp = NULL; \ - t_len -= l_len - s_len;\ + if (sep_bp != NULL) { \ + bp = sep_bp; \ + sep_bp = NULL; \ + total_len -= line_len - sep_line_len; \ restart = 1; \ - bitfmt = s_fmt; \ + bitfmt = sep_fmt;\ } \ STORE('>'); \ STORE('\0'); \ - if ((size_t)t_len < bufsize)\ - snprintf(bp, bufsize - t_len, sbase, (uintmax_t)val);\ - t_len += v_len; \ - l_len = v_len; \ - bp += v_len; \ + if ((size_t)total_len < bufsize) \ + snprintf(bp, bufsize - total_len, num_fmt, \ + (uintmax_t)val);\ + total_len += val_len; \ + line_len = val_len; \ + bp += val_len; \ } while (0) #define PUTSEP() do { \ - if (l_max > 0 && (size_t)l_len >= l_max) { \ + if (line_max > 0 && (size_t)line_len >= line_max) { \ BACKUP(); \ STORE('<'); \ } else { \ /* Remember separator location */ \ - if (l_max > 0 && sep != '<') { \ -s_len = l_len;\ -s_bp = bp;\ -s_fmt = cur_fmt; \ + if (line_max > 0 && sep != '<') { \ +sep_line_len = line_len; \ +sep_bp = bp;\ +sep_fmt = cur_fmt; \ } \ STORE(sep); \ restart = 0; \ @@ -155,7 +151,7 @@ snprintb_m(char *buf, size_t bufsize, co } while (0) #define PUTCHR(c) do { \ - if (l_max > 0 && (size_t)l_len >=
CVS commit: src/common/lib/libutil
Module Name:src Committed By: rillig Date: Fri Feb 16 17:42:50 UTC 2024 Modified Files: src/common/lib/libutil: snprintb.c Log Message: snprintb: rename local variables The single-letter variables 't', 's', 'l' and 'c' were too hard to decipher. The variable 'f_len' was used for two independent purposes. Use a narrow scope for some variables, to avoid having to keep track of 22 individual variables at the same time. No binary change. To generate a diff of this commit: cvs rdiff -u -r1.26 -r1.27 src/common/lib/libutil/snprintb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/common/lib/libutil
Module Name:src Committed By: rillig Date: Fri Feb 16 01:57:51 UTC 2024 Modified Files: src/common/lib/libutil: snprintb.c Log Message: snprintb: clean up Remove redundant parentheses and casts. Indent statement-like macros consistently, use separate lines for each statement, add parentheses to macro definitions. Remove CONSTCOND comments as lint doesn't need them anymore. No binary change. To generate a diff of this commit: cvs rdiff -u -r1.25 -r1.26 src/common/lib/libutil/snprintb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/common/lib/libutil/snprintb.c diff -u src/common/lib/libutil/snprintb.c:1.25 src/common/lib/libutil/snprintb.c:1.26 --- src/common/lib/libutil/snprintb.c:1.25 Thu Feb 15 23:48:51 2024 +++ src/common/lib/libutil/snprintb.c Fri Feb 16 01:57:50 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: snprintb.c,v 1.25 2024/02/15 23:48:51 rillig Exp $ */ +/* $NetBSD: snprintb.c,v 1.26 2024/02/16 01:57:50 rillig Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -41,7 +41,7 @@ # include # if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: snprintb.c,v 1.25 2024/02/15 23:48:51 rillig Exp $"); +__RCSID("$NetBSD: snprintb.c,v 1.26 2024/02/16 01:57:50 rillig Exp $"); # endif # include @@ -51,7 +51,7 @@ __RCSID("$NetBSD: snprintb.c,v 1.25 2024 # include # else /* ! _KERNEL */ # include -__KERNEL_RCSID(0, "$NetBSD: snprintb.c,v 1.25 2024/02/15 23:48:51 rillig Exp $"); +__KERNEL_RCSID(0, "$NetBSD: snprintb.c,v 1.26 2024/02/16 01:57:50 rillig Exp $"); # include # include # include @@ -112,70 +112,78 @@ snprintb_m(char *buf, size_t bufsize, co * If the value we printed was 0 and we're using the old-style format, * we're done. */ - if ((val == 0) && (ch != '\177')) + if (val == 0 && ch != '\177') goto terminate; -#define STORE(c) do { l_len++; \ - if ((size_t)(++t_len) < bufsize) \ - *bp++ = (c); \ - } while ( /* CONSTCOND */ 0) - -#define BACKUP do { if (s_bp != NULL) {\ - bp = s_bp; s_bp = NULL;\ +#define STORE(c) do { \ + l_len++; \ + if ((size_t)(++t_len) < bufsize) \ + *bp++ = (c); \ + } while (0) + +#define BACKUP() do { \ + if (s_bp != NULL) { \ + bp = s_bp; \ + s_bp = NULL; \ t_len -= l_len - s_len;\ restart = 1; \ bitfmt = s_fmt; \ - } \ - STORE('>'); STORE('\0');\ - if ((size_t)t_len < bufsize)\ + } \ + STORE('>'); \ + STORE('\0'); \ + if ((size_t)t_len < bufsize)\ snprintf(bp, bufsize - t_len, sbase, (uintmax_t)val);\ - t_len += v_len; l_len = v_len; bp += v_len; \ - } while ( /* CONSTCOND */ 0) - -#define PUTSEP do { \ - if (l_max > 0 && (size_t)l_len >= l_max) { \ -BACKUP; \ -STORE('<');\ - } else { \ -/* Remember separator location */ \ -if (l_max > 0 && sep != '<') { \ - s_len = l_len; \ - s_bp = bp; \ - s_fmt = cur_fmt; \ -} \ -STORE(sep);\ -restart = 0;\ + t_len += v_len; \ + l_len = v_len; \ + bp += v_len; \ + } while (0) + +#define PUTSEP() do { \ + if (l_max > 0 && (size_t)l_len >= l_max) { \ + BACKUP(); \ + STORE('<'); \ + } else { \ + /* Remember separator location */ \ + if (l_max > 0 && sep != '<') { \ +s_len = l_len;\ +s_bp = bp;\ +s_fmt = cur_fmt; \ } \ - } while ( /* CONSTCOND */ 0) + STORE(sep); \ + restart = 0; \ + } \ + } while (0) #define PUTCHR(c) do { \ - if (l_max > 0 && (size_t)l_len >= (l_max - 1)) {\ -BACKUP; \ -if (restart == 0) \ - STORE(c); \ -else \ - sep = '<'; \ - } else { \ + if (l_max > 0 && (size_t)l_len >= l_max - 1) { \ + BACKUP(); \ + if (restart == 0)\ STORE(c);\ -restart = 0;\ - } \ - } while ( /* CONSTCOND */ 0) + else \ +sep = '<';\ + } else { \ + STORE(c); \ + restart = 0; \ + } \ + } while (0) -#define PUTS(s) while ((ch = *(s)++) != 0) {\ +#define PUTS(s) do { \ + while ((ch = *(s)++) != 0) {\ PUTCHR(ch); \ if (restart) \ break; \ - } -#define FMTSTR(sb, f) \ - do { \ + } \ + } while (0) + +#define FMTSTR(sb, f) do { \ f_len = snprintf(bp, bufsize - t_len, sb, (uintmax_t)f); \ - if (f_len < 0) \ - goto internal; \ - t_len += f_len; \ - l_len += f_len; \ - if ((size_t)t_len < bufsize) \ - bp += f_len; \ - } while (/*CONSTCOND*/0) + if (f_len < 0) \ + goto internal; \ + t_len += f_len; \ + l_len += f_len; \ + if ((size_t)t_len < bufsize)\ + bp += f_len; \ + } while (0) /* * Chris Torek's new bitmask format is identified by a leading \177 @@ -183,10 +191,10 @@
CVS commit: src/common/lib/libutil
Module Name:src Committed By: rillig Date: Fri Feb 16 01:57:51 UTC 2024 Modified Files: src/common/lib/libutil: snprintb.c Log Message: snprintb: clean up Remove redundant parentheses and casts. Indent statement-like macros consistently, use separate lines for each statement, add parentheses to macro definitions. Remove CONSTCOND comments as lint doesn't need them anymore. No binary change. To generate a diff of this commit: cvs rdiff -u -r1.25 -r1.26 src/common/lib/libutil/snprintb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/common/lib/libc/atomic
Module Name:src Committed By: christos Date: Wed Feb 14 18:00:02 UTC 2024 Modified Files: src/common/lib/libc/atomic: atomic_load.c Log Message: sprinkle unused. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/common/lib/libc/atomic/atomic_load.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/common/lib/libc/atomic
Module Name:src Committed By: christos Date: Wed Feb 14 18:00:02 UTC 2024 Modified Files: src/common/lib/libc/atomic: atomic_load.c Log Message: sprinkle unused. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/common/lib/libc/atomic/atomic_load.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/common/lib/libc/atomic/atomic_load.c diff -u src/common/lib/libc/atomic/atomic_load.c:1.4 src/common/lib/libc/atomic/atomic_load.c:1.5 --- src/common/lib/libc/atomic/atomic_load.c:1.4 Sat Apr 9 19:38:57 2022 +++ src/common/lib/libc/atomic/atomic_load.c Wed Feb 14 13:00:02 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: atomic_load.c,v 1.4 2022/04/09 23:38:57 riastradh Exp $ */ +/* $NetBSD: atomic_load.c,v 1.5 2024/02/14 18:00:02 christos Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -27,7 +27,7 @@ */ #include -__RCSID("$NetBSD: atomic_load.c,v 1.4 2022/04/09 23:38:57 riastradh Exp $"); +__RCSID("$NetBSD: atomic_load.c,v 1.5 2024/02/14 18:00:02 christos Exp $"); #include "atomic_op_namespace.h" @@ -36,8 +36,9 @@ __RCSID("$NetBSD: atomic_load.c,v 1.4 20 #define atomic_load_n(n,b) \ uint ## b ## _t __atomic_load_ ## n(const volatile void *, int); \ +/*ARGSUSED*/ \ uint ## b ## _t \ -__atomic_load_ ## n(const volatile void *ptr, int memmodel) \ +__atomic_load_ ## n(const volatile void *ptr, int memmodel __unused) \ { \ uint## b ##_t val; \ val = *(const volatile uint ## b ## _t *)ptr; \
CVS commit: src/common/lib/libc/atomic
Module Name:src Committed By: christos Date: Sun Feb 4 16:19:12 UTC 2024 Modified Files: src/common/lib/libc/atomic: atomic_store.c Log Message: mark unused argument To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/common/lib/libc/atomic/atomic_store.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/common/lib/libc/atomic/atomic_store.c diff -u src/common/lib/libc/atomic/atomic_store.c:1.4 src/common/lib/libc/atomic/atomic_store.c:1.5 --- src/common/lib/libc/atomic/atomic_store.c:1.4 Sat Apr 9 19:38:57 2022 +++ src/common/lib/libc/atomic/atomic_store.c Sun Feb 4 11:19:12 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: atomic_store.c,v 1.4 2022/04/09 23:38:57 riastradh Exp $ */ +/* $NetBSD: atomic_store.c,v 1.5 2024/02/04 16:19:12 christos Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -27,7 +27,7 @@ */ #include -__RCSID("$NetBSD: atomic_store.c,v 1.4 2022/04/09 23:38:57 riastradh Exp $"); +__RCSID("$NetBSD: atomic_store.c,v 1.5 2024/02/04 16:19:12 christos Exp $"); #include "atomic_op_namespace.h" @@ -36,9 +36,10 @@ __RCSID("$NetBSD: atomic_store.c,v 1.4 2 #define atomic_store_n(n,b) \ void __atomic_store_ ## n(volatile void *, uint ## b ## _t, int); \ +/*ARGSUSED*/ \ void \ __atomic_store_ ## n(volatile void *ptr, uint ## b ## _t val, \ - int memmodel) \ + int memmodel __unused) \ { \ membar_release(); \ *(volatile uint ## b ## _t *)ptr = val; \
CVS commit: src/common/lib/libc/atomic
Module Name:src Committed By: christos Date: Sun Feb 4 16:19:12 UTC 2024 Modified Files: src/common/lib/libc/atomic: atomic_store.c Log Message: mark unused argument To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/common/lib/libc/atomic/atomic_store.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/common/lib/libc/atomic
Module Name:src Committed By: christos Date: Mon Jan 29 16:09:46 UTC 2024 Modified Files: src/common/lib/libc/atomic: atomic_c11_compare_exchange_cas_16.c atomic_c11_compare_exchange_cas_32.c atomic_c11_compare_exchange_cas_8.c Log Message: sprinkle argsused To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 \ src/common/lib/libc/atomic/atomic_c11_compare_exchange_cas_16.c \ src/common/lib/libc/atomic/atomic_c11_compare_exchange_cas_8.c cvs rdiff -u -r1.5 -r1.6 \ src/common/lib/libc/atomic/atomic_c11_compare_exchange_cas_32.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/common/lib/libc/atomic
Module Name:src Committed By: christos Date: Mon Jan 29 16:09:46 UTC 2024 Modified Files: src/common/lib/libc/atomic: atomic_c11_compare_exchange_cas_16.c atomic_c11_compare_exchange_cas_32.c atomic_c11_compare_exchange_cas_8.c Log Message: sprinkle argsused To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 \ src/common/lib/libc/atomic/atomic_c11_compare_exchange_cas_16.c \ src/common/lib/libc/atomic/atomic_c11_compare_exchange_cas_8.c cvs rdiff -u -r1.5 -r1.6 \ src/common/lib/libc/atomic/atomic_c11_compare_exchange_cas_32.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/common/lib/libc/atomic/atomic_c11_compare_exchange_cas_16.c diff -u src/common/lib/libc/atomic/atomic_c11_compare_exchange_cas_16.c:1.4 src/common/lib/libc/atomic/atomic_c11_compare_exchange_cas_16.c:1.5 --- src/common/lib/libc/atomic/atomic_c11_compare_exchange_cas_16.c:1.4 Sat May 14 01:35:55 2022 +++ src/common/lib/libc/atomic/atomic_c11_compare_exchange_cas_16.c Mon Jan 29 11:09:45 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: atomic_c11_compare_exchange_cas_16.c,v 1.4 2022/05/14 05:35:55 skrll Exp $ */ +/* $NetBSD: atomic_c11_compare_exchange_cas_16.c,v 1.5 2024/01/29 16:09:45 christos Exp $ */ /*- * Copyright (c) 2007 The NetBSD Foundation, Inc. @@ -40,6 +40,7 @@ bool __atomic_compare_exchange_2(volatil bool, int, int); bool +/*ARGSUSED*/ __atomic_compare_exchange_2(volatile void *mem, void *expected, uint16_t desired, bool weak, int success, int failure) Index: src/common/lib/libc/atomic/atomic_c11_compare_exchange_cas_8.c diff -u src/common/lib/libc/atomic/atomic_c11_compare_exchange_cas_8.c:1.4 src/common/lib/libc/atomic/atomic_c11_compare_exchange_cas_8.c:1.5 --- src/common/lib/libc/atomic/atomic_c11_compare_exchange_cas_8.c:1.4 Sat May 14 01:35:55 2022 +++ src/common/lib/libc/atomic/atomic_c11_compare_exchange_cas_8.c Mon Jan 29 11:09:45 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: atomic_c11_compare_exchange_cas_8.c,v 1.4 2022/05/14 05:35:55 skrll Exp $ */ +/* $NetBSD: atomic_c11_compare_exchange_cas_8.c,v 1.5 2024/01/29 16:09:45 christos Exp $ */ /*- * Copyright (c) 2007 The NetBSD Foundation, Inc. @@ -40,6 +40,7 @@ bool __atomic_compare_exchange_1(volatil bool, int, int); bool +/*ARGSUSED*/ __atomic_compare_exchange_1(volatile void *mem, void *expected, uint8_t desired, bool weak, int success, int failure) Index: src/common/lib/libc/atomic/atomic_c11_compare_exchange_cas_32.c diff -u src/common/lib/libc/atomic/atomic_c11_compare_exchange_cas_32.c:1.5 src/common/lib/libc/atomic/atomic_c11_compare_exchange_cas_32.c:1.6 --- src/common/lib/libc/atomic/atomic_c11_compare_exchange_cas_32.c:1.5 Mon May 16 02:07:23 2022 +++ src/common/lib/libc/atomic/atomic_c11_compare_exchange_cas_32.c Mon Jan 29 11:09:45 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: atomic_c11_compare_exchange_cas_32.c,v 1.5 2022/05/16 06:07:23 skrll Exp $ */ +/* $NetBSD: atomic_c11_compare_exchange_cas_32.c,v 1.6 2024/01/29 16:09:45 christos Exp $ */ /*- * Copyright (c) 2007 The NetBSD Foundation, Inc. @@ -40,6 +40,7 @@ bool __atomic_compare_exchange_4(volatil bool, int, int); bool +/*ARGSUSED*/ __atomic_compare_exchange_4(volatile void *mem, void *expected, uint32_t desired, bool weak, int success, int failure)
CVS commit: src/common/lib/libc/atomic
Module Name:src Committed By: thorpej Date: Sun Jan 21 03:42:08 UTC 2024 Modified Files: src/common/lib/libc/atomic: atomic_init_testset.c Log Message: Catch up with revision 1.5 of atomic_init_cas.c. Fixes building libc on sun2, and probably others. To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.19 src/common/lib/libc/atomic/atomic_init_testset.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/common/lib/libc/atomic
Module Name:src Committed By: thorpej Date: Sun Jan 21 03:42:08 UTC 2024 Modified Files: src/common/lib/libc/atomic: atomic_init_testset.c Log Message: Catch up with revision 1.5 of atomic_init_cas.c. Fixes building libc on sun2, and probably others. To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.19 src/common/lib/libc/atomic/atomic_init_testset.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/common/lib/libc/atomic/atomic_init_testset.c diff -u src/common/lib/libc/atomic/atomic_init_testset.c:1.18 src/common/lib/libc/atomic/atomic_init_testset.c:1.19 --- src/common/lib/libc/atomic/atomic_init_testset.c:1.18 Fri Jan 19 19:33:49 2024 +++ src/common/lib/libc/atomic/atomic_init_testset.c Sun Jan 21 03:42:08 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: atomic_init_testset.c,v 1.18 2024/01/19 19:33:49 christos Exp $ */ +/* $NetBSD: atomic_init_testset.c,v 1.19 2024/01/21 03:42:08 thorpej Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -36,8 +36,9 @@ */ #include -__RCSID("$NetBSD: atomic_init_testset.c,v 1.18 2024/01/19 19:33:49 christos Exp $"); +__RCSID("$NetBSD: atomic_init_testset.c,v 1.19 2024/01/21 03:42:08 thorpej Exp $"); +#include "extern.h" #include "atomic_op_namespace.h" #include
CVS commit: src/common/lib/libc/string
Module Name:src Committed By: christos Date: Sat Jan 20 14:55:11 UTC 2024 Modified Files: src/common/lib/libc/string: strpbrk.c Log Message: Add __UNCONST To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/common/lib/libc/string/strpbrk.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/common/lib/libc/string/strpbrk.c diff -u src/common/lib/libc/string/strpbrk.c:1.2 src/common/lib/libc/string/strpbrk.c:1.3 --- src/common/lib/libc/string/strpbrk.c:1.2 Sat Feb 3 20:13:45 2018 +++ src/common/lib/libc/string/strpbrk.c Sat Jan 20 09:55:11 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: strpbrk.c,v 1.2 2018/02/04 01:13:45 mrg Exp $ */ +/* $NetBSD: strpbrk.c,v 1.3 2024/01/20 14:55:11 christos Exp $ */ /*- * Copyright (c) 2008 Joerg Sonnenberger @@ -26,7 +26,7 @@ */ #include -__RCSID("$NetBSD: strpbrk.c,v 1.2 2018/02/04 01:13:45 mrg Exp $"); +__RCSID("$NetBSD: strpbrk.c,v 1.3 2024/01/20 14:55:11 christos Exp $"); #if !defined(_KERNEL) && !defined(_STANDALONE) #include @@ -64,7 +64,7 @@ strpbrk(const char *s, const char *chars if (charset[0] == '\0') return NULL; if (charset[1] == '\0') - return strchr(s, charset[0]); + return __UNCONST(strchr(s, charset[0])); for (; *charset != '\0'; ++charset) ADD_TO_SET(UC(*charset));
CVS commit: src/common/lib/libc/string
Module Name:src Committed By: christos Date: Sat Jan 20 14:55:11 UTC 2024 Modified Files: src/common/lib/libc/string: strpbrk.c Log Message: Add __UNCONST To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/common/lib/libc/string/strpbrk.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/common/lib/libc
Module Name:src Committed By: christos Date: Sat Jan 20 14:55:02 UTC 2024 Modified Files: src/common/lib/libc/gen: ptree.c src/common/lib/libc/hash/sha2: sha2.c Log Message: move local decls to headers To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/common/lib/libc/gen/ptree.c cvs rdiff -u -r1.25 -r1.26 src/common/lib/libc/hash/sha2/sha2.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/common/lib/libc/gen/ptree.c diff -u src/common/lib/libc/gen/ptree.c:1.12 src/common/lib/libc/gen/ptree.c:1.13 --- src/common/lib/libc/gen/ptree.c:1.12 Thu May 26 11:23:33 2022 +++ src/common/lib/libc/gen/ptree.c Sat Jan 20 09:55:02 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: ptree.c,v 1.12 2022/05/26 15:23:33 rillig Exp $ */ +/* $NetBSD: ptree.c,v 1.13 2024/01/20 14:55:02 christos Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -40,7 +40,7 @@ #include #include #include -__KERNEL_RCSID(0, "$NetBSD: ptree.c,v 1.12 2022/05/26 15:23:33 rillig Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ptree.c,v 1.13 2024/01/20 14:55:02 christos Exp $"); #else #include #include @@ -53,7 +53,7 @@ __KERNEL_RCSID(0, "$NetBSD: ptree.c,v 1. #else #define KASSERT(e) do { } while (0) #endif -__RCSID("$NetBSD: ptree.c,v 1.12 2022/05/26 15:23:33 rillig Exp $"); +__RCSID("$NetBSD: ptree.c,v 1.13 2024/01/20 14:55:02 christos Exp $"); #endif /* _KERNEL || _STANDALONE */ #ifdef _LIBC @@ -111,7 +111,6 @@ __RCSID("$NetBSD: ptree.c,v 1.12 2022/05 #define ITEMTONODE(pt, ptn) \ ((pt_node_t *)((uintptr_t)(ptn) + (pt)->pt_node_offset)) -bool ptree_check(const pt_tree_t *); #if PTCHECK > 1 #define PTREE_CHECK(pt) ptree_check(pt) #else Index: src/common/lib/libc/hash/sha2/sha2.c diff -u src/common/lib/libc/hash/sha2/sha2.c:1.25 src/common/lib/libc/hash/sha2/sha2.c:1.26 --- src/common/lib/libc/hash/sha2/sha2.c:1.25 Thu Oct 28 11:08:05 2021 +++ src/common/lib/libc/hash/sha2/sha2.c Sat Jan 20 09:55:02 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: sha2.c,v 1.25 2021/10/28 15:08:05 christos Exp $ */ +/* $NetBSD: sha2.c,v 1.26 2024/01/20 14:55:02 christos Exp $ */ /* $KAME: sha2.c,v 1.9 2003/07/20 00:28:38 itojun Exp $ */ /* @@ -43,7 +43,7 @@ #include #if defined(_KERNEL) || defined(_STANDALONE) -__KERNEL_RCSID(0, "$NetBSD: sha2.c,v 1.25 2021/10/28 15:08:05 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sha2.c,v 1.26 2024/01/20 14:55:02 christos Exp $"); #include /* XXX: to pull for vax memset(9) */ #include @@ -51,7 +51,7 @@ __KERNEL_RCSID(0, "$NetBSD: sha2.c,v 1.2 #else #if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: sha2.c,v 1.25 2021/10/28 15:08:05 christos Exp $"); +__RCSID("$NetBSD: sha2.c,v 1.26 2024/01/20 14:55:02 christos Exp $"); #endif /* LIBC_SCCS and not lint */ #include "namespace.h" @@ -59,6 +59,10 @@ __RCSID("$NetBSD: sha2.c,v 1.25 2021/10/ #endif +#ifndef _LIBC_INTERNAL +#define _LIBC_INTERNAL +#endif + #include #include @@ -122,10 +126,6 @@ __RCSID("$NetBSD: sha2.c,v 1.25 2021/10/ * only. */ static void SHA512_Last(SHA512_CTX *); -void SHA224_Transform(SHA224_CTX *, const uint32_t*); -void SHA256_Transform(SHA256_CTX *, const uint32_t*); -void SHA384_Transform(SHA384_CTX *, const uint64_t*); -void SHA512_Transform(SHA512_CTX *, const uint64_t*); /*** SHA-XYZ INITIAL HASH VALUES AND CONSTANTS /
CVS commit: src/common/lib/libc
Module Name:src Committed By: christos Date: Sat Jan 20 14:55:02 UTC 2024 Modified Files: src/common/lib/libc/gen: ptree.c src/common/lib/libc/hash/sha2: sha2.c Log Message: move local decls to headers To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/common/lib/libc/gen/ptree.c cvs rdiff -u -r1.25 -r1.26 src/common/lib/libc/hash/sha2/sha2.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/common/lib/libc/atomic
Module Name:src Committed By: christos Date: Fri Jan 19 19:33:49 UTC 2024 Modified Files: src/common/lib/libc/atomic: atomic_init_cas.c atomic_init_testset.c Log Message: make decls consistent To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/common/lib/libc/atomic/atomic_init_cas.c cvs rdiff -u -r1.17 -r1.18 src/common/lib/libc/atomic/atomic_init_testset.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/common/lib/libc/atomic/atomic_init_cas.c diff -u src/common/lib/libc/atomic/atomic_init_cas.c:1.4 src/common/lib/libc/atomic/atomic_init_cas.c:1.5 --- src/common/lib/libc/atomic/atomic_init_cas.c:1.4 Tue Aug 20 23:00:56 2013 +++ src/common/lib/libc/atomic/atomic_init_cas.c Fri Jan 19 14:33:49 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: atomic_init_cas.c,v 1.4 2013/08/21 03:00:56 matt Exp $ */ +/* $NetBSD: atomic_init_cas.c,v 1.5 2024/01/19 19:33:49 christos Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -32,11 +32,10 @@ */ #include -__RCSID("$NetBSD: atomic_init_cas.c,v 1.4 2013/08/21 03:00:56 matt Exp $"); +__RCSID("$NetBSD: atomic_init_cas.c,v 1.5 2024/01/19 19:33:49 christos Exp $"); +#include "extern.h" -void __libc_atomic_init(void) __attribute__ ((visibility("hidden"))); - -void __section(".text.startup") +void __section(".text.startup") __attribute__ ((__visibility__("hidden"))) __libc_atomic_init(void) { Index: src/common/lib/libc/atomic/atomic_init_testset.c diff -u src/common/lib/libc/atomic/atomic_init_testset.c:1.17 src/common/lib/libc/atomic/atomic_init_testset.c:1.18 --- src/common/lib/libc/atomic/atomic_init_testset.c:1.17 Fri May 15 11:20:40 2020 +++ src/common/lib/libc/atomic/atomic_init_testset.c Fri Jan 19 14:33:49 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: atomic_init_testset.c,v 1.17 2020/05/15 15:20:40 martin Exp $ */ +/* $NetBSD: atomic_init_testset.c,v 1.18 2024/01/19 19:33:49 christos Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -36,7 +36,7 @@ */ #include -__RCSID("$NetBSD: atomic_init_testset.c,v 1.17 2020/05/15 15:20:40 martin Exp $"); +__RCSID("$NetBSD: atomic_init_testset.c,v 1.18 2024/01/19 19:33:49 christos Exp $"); #include "atomic_op_namespace.h" @@ -98,8 +98,6 @@ static uint8_t (*_atomic_cas_8_fn)(volat _atomic_cas_8_up; RAS_DECL(_atomic_cas_8); -void __libc_atomic_init(void) __attribute__ ((visibility("hidden"))); - #ifndef __HAVE_ASM_ATOMIC_CAS_UP static uint32_t _atomic_cas_up(volatile uint32_t *ptr, uint32_t old, uint32_t new) @@ -276,7 +274,7 @@ _atomic_cas_8(volatile uint8_t *ptr, uin return (*_atomic_cas_8_fn)(ptr, old, new); } -void __section(".text.startup") +void __section(".text.startup") __attribute__ ((__visibility__("hidden"))) __libc_atomic_init(void) { int ncpu, mib[2];
CVS commit: src/common/lib/libc/atomic
Module Name:src Committed By: christos Date: Fri Jan 19 19:33:49 UTC 2024 Modified Files: src/common/lib/libc/atomic: atomic_init_cas.c atomic_init_testset.c Log Message: make decls consistent To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/common/lib/libc/atomic/atomic_init_cas.c cvs rdiff -u -r1.17 -r1.18 src/common/lib/libc/atomic/atomic_init_testset.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/common/lib/libc/hash/sha3
Module Name:src Committed By: christos Date: Fri Jan 19 19:32:42 UTC 2024 Modified Files: src/common/lib/libc/hash/sha3: sha3.c Log Message: use size_t To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/common/lib/libc/hash/sha3/sha3.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/common/lib/libc/hash/sha3
Module Name:src Committed By: christos Date: Fri Jan 19 19:32:42 UTC 2024 Modified Files: src/common/lib/libc/hash/sha3: sha3.c Log Message: use size_t To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/common/lib/libc/hash/sha3/sha3.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/common/lib/libc/hash/sha3/sha3.c diff -u src/common/lib/libc/hash/sha3/sha3.c:1.3 src/common/lib/libc/hash/sha3/sha3.c:1.4 --- src/common/lib/libc/hash/sha3/sha3.c:1.3 Sat Jul 31 10:36:33 2021 +++ src/common/lib/libc/hash/sha3/sha3.c Fri Jan 19 14:32:42 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: sha3.c,v 1.3 2021/07/31 14:36:33 andvar Exp $ */ +/* $NetBSD: sha3.c,v 1.4 2024/01/19 19:32:42 christos Exp $ */ /*- * Copyright (c) 2015 Taylor R. Campbell @@ -38,14 +38,14 @@ #if defined(_KERNEL) || defined(_STANDALONE) -__KERNEL_RCSID(0, "$NetBSD: sha3.c,v 1.3 2021/07/31 14:36:33 andvar Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sha3.c,v 1.4 2024/01/19 19:32:42 christos Exp $"); #include #define SHA3_ASSERT KASSERT #else -__RCSID("$NetBSD: sha3.c,v 1.3 2021/07/31 14:36:33 andvar Exp $"); +__RCSID("$NetBSD: sha3.c,v 1.4 2024/01/19 19:32:42 christos Exp $"); #include "namespace.h" @@ -228,7 +228,7 @@ sha3_final(uint8_t *h, unsigned d, struc } static void -shake_final(uint8_t *h, unsigned d, struct sha3 *C, unsigned rw) +shake_final(uint8_t *h, size_t d, struct sha3 *C, unsigned rw) { unsigned nw, iw;
CVS commit: src/common/lib/libc/misc
Module Name:src Committed By: andvar Date: Thu Dec 7 07:10:44 UTC 2023 Modified Files: src/common/lib/libc/misc: ubsan.c Log Message: s/miltiple/multiple/ in comment. To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/common/lib/libc/misc/ubsan.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/common/lib/libc/misc/ubsan.c diff -u src/common/lib/libc/misc/ubsan.c:1.11 src/common/lib/libc/misc/ubsan.c:1.12 --- src/common/lib/libc/misc/ubsan.c:1.11 Sun Sep 19 10:34:06 2021 +++ src/common/lib/libc/misc/ubsan.c Thu Dec 7 07:10:44 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: ubsan.c,v 1.11 2021/09/19 10:34:06 andvar Exp $ */ +/* $NetBSD: ubsan.c,v 1.12 2023/12/07 07:10:44 andvar Exp $ */ /*- * Copyright (c) 2018 The NetBSD Foundation, Inc. @@ -38,9 +38,9 @@ #include #if defined(_KERNEL) -__KERNEL_RCSID(0, "$NetBSD: ubsan.c,v 1.11 2021/09/19 10:34:06 andvar Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ubsan.c,v 1.12 2023/12/07 07:10:44 andvar Exp $"); #else -__RCSID("$NetBSD: ubsan.c,v 1.11 2021/09/19 10:34:06 andvar Exp $"); +__RCSID("$NetBSD: ubsan.c,v 1.12 2023/12/07 07:10:44 andvar Exp $"); #endif #if defined(_KERNEL) @@ -1249,7 +1249,7 @@ __ubsan_get_current_report_data(const ch * interrupt handling etc). * * A proper solution would need probably a lock-free bounded queue built - * with atomic operations with the property of miltiple consumers and + * with atomic operations with the property of multiple consumers and * multiple producers. Maintaining and validating such code is not * worth the effort. *
CVS commit: src/common/lib/libc/misc
Module Name:src Committed By: andvar Date: Thu Dec 7 07:10:44 UTC 2023 Modified Files: src/common/lib/libc/misc: ubsan.c Log Message: s/miltiple/multiple/ in comment. To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/common/lib/libc/misc/ubsan.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/common/lib/libprop
Module Name:src Committed By: thorpej Date: Fri Nov 17 21:29:33 UTC 2023 Modified Files: src/common/lib/libprop: prop_string.c Log Message: In _prop_string_instantiate(), when we de-dup a non-MUTABLE string, make sure we free the provided string buffer if NOCOPY is not set. Fixes a memory leak reported by M. Boerschig. While we're at it, also change _prop_string_instantiate() to free the provided string buffer in the not-NOCOPY case when string object allocation fails (this was previously handled by _prop_string_instantiate()'s callers). PR lib/57699 To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/common/lib/libprop/prop_string.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/common/lib/libprop
Module Name:src Committed By: thorpej Date: Fri Nov 17 21:29:33 UTC 2023 Modified Files: src/common/lib/libprop: prop_string.c Log Message: In _prop_string_instantiate(), when we de-dup a non-MUTABLE string, make sure we free the provided string buffer if NOCOPY is not set. Fixes a memory leak reported by M. Boerschig. While we're at it, also change _prop_string_instantiate() to free the provided string buffer in the not-NOCOPY case when string object allocation fails (this was previously handled by _prop_string_instantiate()'s callers). PR lib/57699 To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/common/lib/libprop/prop_string.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/common/lib/libprop/prop_string.c diff -u src/common/lib/libprop/prop_string.c:1.17 src/common/lib/libprop/prop_string.c:1.18 --- src/common/lib/libprop/prop_string.c:1.17 Wed Aug 3 21:13:46 2022 +++ src/common/lib/libprop/prop_string.c Fri Nov 17 21:29:33 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: prop_string.c,v 1.17 2022/08/03 21:13:46 riastradh Exp $ */ +/* $NetBSD: prop_string.c,v 1.18 2023/11/17 21:29:33 thorpej Exp $ */ /*- * Copyright (c) 2006, 2020 The NetBSD Foundation, Inc. @@ -247,12 +247,18 @@ _prop_string_instantiate(int const flags */ prop_object_retain(ops); _PROP_MUTEX_UNLOCK(_prop_string_tree_mutex); +if ((flags & PS_F_NOCOPY) == 0) { + _PROP_FREE(ps->ps_mutable, + M_PROP_STRING); +} _PROP_POOL_PUT(_prop_string_pool, ps); ps = ops; } else { _PROP_MUTEX_UNLOCK(_prop_string_tree_mutex); } } + } else if ((flags & PS_F_NOCOPY) == 0) { + _PROP_FREE(__UNCONST(str), M_PROP_STRING); } return (ps); @@ -311,7 +317,6 @@ prop_string_create_cstring_nocopy(const prop_string_t __printflike(1, 2) prop_string_create_format(const char *fmt, ...) { - prop_string_t ps; char *str = NULL; int len; size_t nlen; @@ -335,11 +340,7 @@ prop_string_create_format(const char *fm vsnprintf(str, nlen, fmt, ap); va_end(ap); - ps = _prop_string_instantiate(0, str, (size_t)len); - if (ps == NULL) - _PROP_FREE(str, M_PROP_STRING); - - return (ps); + return _prop_string_instantiate(0, str, (size_t)len); } /* @@ -374,7 +375,6 @@ prop_string_create_nocopy(const char *st prop_string_t prop_string_copy(prop_string_t ops) { - prop_string_t ps; char *cp; if (! prop_object_is_string(ops)) @@ -391,11 +391,7 @@ prop_string_copy(prop_string_t ops) strcpy(cp, prop_string_contents(ops)); - ps = _prop_string_instantiate(PS_F_MUTABLE, cp, ops->ps_size); - if (ps == NULL) - _PROP_FREE(cp, M_PROP_STRING); - - return (ps); + return _prop_string_instantiate(PS_F_MUTABLE, cp, ops->ps_size); } _PROP_DEPRECATED(prop_string_copy_mutable, @@ -404,7 +400,6 @@ _PROP_DEPRECATED(prop_string_copy_mutabl prop_string_t prop_string_copy_mutable(prop_string_t ops) { - prop_string_t ps; char *cp; if (! prop_object_is_string(ops)) @@ -416,11 +411,7 @@ prop_string_copy_mutable(prop_string_t o strcpy(cp, prop_string_contents(ops)); - ps = _prop_string_instantiate(PS_F_MUTABLE, cp, ops->ps_size); - if (ps == NULL) - _PROP_FREE(cp, M_PROP_STRING); - - return (ps); + return _prop_string_instantiate(PS_F_MUTABLE, cp, ops->ps_size); } /* @@ -655,7 +646,6 @@ bool _prop_string_internalize(prop_stack_t stack, prop_object_t *obj, struct _prop_object_internalize_context *ctx) { - prop_string_t string; char *str; size_t len, alen; @@ -691,10 +681,6 @@ _prop_string_internalize(prop_stack_t st return (true); } - string = _prop_string_instantiate(0, str, len); - if (string == NULL) - _PROP_FREE(str, M_PROP_STRING); - - *obj = string; + *obj = _prop_string_instantiate(0, str, len); return (true); }
CVS commit: src/common/lib/libc/arch/hppa/atomic
Module Name:src Committed By: skrll Date: Sun Oct 29 08:04:19 UTC 2023 Modified Files: src/common/lib/libc/arch/hppa/atomic: Makefile.inc Log Message: Define __HAVE_ATOMIC_CAS_64_UP and provide __sync_val_compare_and_swap_8 The new santizer code in gcc12 needs this. To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/common/lib/libc/arch/hppa/atomic/Makefile.inc Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/common/lib/libc/arch/hppa/atomic/Makefile.inc diff -u src/common/lib/libc/arch/hppa/atomic/Makefile.inc:1.15 src/common/lib/libc/arch/hppa/atomic/Makefile.inc:1.16 --- src/common/lib/libc/arch/hppa/atomic/Makefile.inc:1.15 Thu Mar 30 15:03:35 2023 +++ src/common/lib/libc/arch/hppa/atomic/Makefile.inc Sun Oct 29 08:04:18 2023 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.inc,v 1.15 2023/03/30 15:03:35 riastradh Exp $ +# $NetBSD: Makefile.inc,v 1.16 2023/10/29 08:04:18 skrll Exp $ .if defined(LIB) @@ -18,6 +18,7 @@ SRCS+= atomic_add_32_cas.c atomic_add_32 . if (${LIB} == "c" || ${LIB} == "pthread") SRCS+= atomic_init_testset.c +CPPFLAGS+= -D__HAVE_ATOMIC_CAS_64_UP SRCS+= atomic_cas_up.S CPPFLAGS+= -D__HAVE_ASM_ATOMIC_CAS_UP CPPFLAGS+= -D__HAVE_ASM_ATOMIC_CAS_16_UP
CVS commit: src/common/lib/libc/arch/hppa/atomic
Module Name:src Committed By: skrll Date: Sun Oct 29 08:04:19 UTC 2023 Modified Files: src/common/lib/libc/arch/hppa/atomic: Makefile.inc Log Message: Define __HAVE_ATOMIC_CAS_64_UP and provide __sync_val_compare_and_swap_8 The new santizer code in gcc12 needs this. To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/common/lib/libc/arch/hppa/atomic/Makefile.inc Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/common/lib/libc/gen
Module Name:src Committed By: ad Date: Sat Sep 23 19:17:38 UTC 2023 Modified Files: src/common/lib/libc/gen: radixtree.c Log Message: kmem_free() -> kmem_intr_free(). Spotted by rin@. To generate a diff of this commit: cvs rdiff -u -r1.32 -r1.33 src/common/lib/libc/gen/radixtree.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/common/lib/libc/gen/radixtree.c diff -u src/common/lib/libc/gen/radixtree.c:1.32 src/common/lib/libc/gen/radixtree.c:1.33 --- src/common/lib/libc/gen/radixtree.c:1.32 Sat Sep 23 18:21:11 2023 +++ src/common/lib/libc/gen/radixtree.c Sat Sep 23 19:17:38 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: radixtree.c,v 1.32 2023/09/23 18:21:11 ad Exp $ */ +/* $NetBSD: radixtree.c,v 1.33 2023/09/23 19:17:38 ad Exp $ */ /*- * Copyright (c)2011,2012,2013 YAMAMOTO Takashi, @@ -112,7 +112,7 @@ #include #if defined(_KERNEL) || defined(_STANDALONE) -__KERNEL_RCSID(0, "$NetBSD: radixtree.c,v 1.32 2023/09/23 18:21:11 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: radixtree.c,v 1.33 2023/09/23 19:17:38 ad Exp $"); #include #include #include @@ -122,7 +122,7 @@ __KERNEL_RCSID(0, "$NetBSD: radixtree.c, #include #endif /* defined(_STANDALONE) */ #else /* defined(_KERNEL) || defined(_STANDALONE) */ -__RCSID("$NetBSD: radixtree.c,v 1.32 2023/09/23 18:21:11 ad Exp $"); +__RCSID("$NetBSD: radixtree.c,v 1.33 2023/09/23 19:17:38 ad Exp $"); #include #include #include @@ -335,7 +335,7 @@ radix_tree_await_memory(void) KM_SLEEP); } while (--i >= 0) { - kmem_free(nodes[i], sizeof(struct radix_tree_node)); + kmem_intr_free(nodes[i], sizeof(struct radix_tree_node)); } }
CVS commit: src/common/lib/libc/gen
Module Name:src Committed By: ad Date: Sat Sep 23 19:17:38 UTC 2023 Modified Files: src/common/lib/libc/gen: radixtree.c Log Message: kmem_free() -> kmem_intr_free(). Spotted by rin@. To generate a diff of this commit: cvs rdiff -u -r1.32 -r1.33 src/common/lib/libc/gen/radixtree.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/common/lib/libc/arch/aarch64/string
Module Name:src Committed By: skrll Date: Sun Jul 23 07:54:37 UTC 2023 Modified Files: src/common/lib/libc/arch/aarch64/string: bcopy.S Log Message: port-arm/57388: Minor bug fix in bcopy.S Use correct register to check alignment of destination in backwards copy. Patch from Antoni Pokusinski. Thanks. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/common/lib/libc/arch/aarch64/string/bcopy.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/common/lib/libc/arch/aarch64/string/bcopy.S diff -u src/common/lib/libc/arch/aarch64/string/bcopy.S:1.2 src/common/lib/libc/arch/aarch64/string/bcopy.S:1.3 --- src/common/lib/libc/arch/aarch64/string/bcopy.S:1.2 Sat Apr 11 05:12:52 2020 +++ src/common/lib/libc/arch/aarch64/string/bcopy.S Sun Jul 23 07:54:37 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: bcopy.S,v 1.2 2020/04/11 05:12:52 ryo Exp $ */ +/* $NetBSD: bcopy.S,v 1.3 2023/07/23 07:54:37 skrll Exp $ */ /* * Copyright (c) 2018 Ryo Shimizu @@ -29,7 +29,7 @@ #include #if defined(LIBC_SCCS) -RCSID("$NetBSD: bcopy.S,v 1.2 2020/04/11 05:12:52 ryo Exp $") +RCSID("$NetBSD: bcopy.S,v 1.3 2023/07/23 07:54:37 skrll Exp $") #endif #if defined(MEMCOPY) @@ -306,7 +306,7 @@ backward_tiny: ret 9: /* length is small(<32), and src or dst may be unaligned */ - eor TMP_X, SRC0, DST0 + eor TMP_X, SRC0, DST ands TMP_X, TMP_X, #7 bne notaligned_backward_small
CVS commit: src/common/lib/libc/arch/aarch64/string
Module Name:src Committed By: skrll Date: Sun Jul 23 07:54:37 UTC 2023 Modified Files: src/common/lib/libc/arch/aarch64/string: bcopy.S Log Message: port-arm/57388: Minor bug fix in bcopy.S Use correct register to check alignment of destination in backwards copy. Patch from Antoni Pokusinski. Thanks. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/common/lib/libc/arch/aarch64/string/bcopy.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/common/lib/libc/string
Module Name:src Committed By: rillig Date: Sun Jun 18 22:18:13 UTC 2023 Modified Files: src/common/lib/libc/string: strspn.c Log Message: strspn: fix typo in comment To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/common/lib/libc/string/strspn.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/common/lib/libc/string/strspn.c diff -u src/common/lib/libc/string/strspn.c:1.2 src/common/lib/libc/string/strspn.c:1.3 --- src/common/lib/libc/string/strspn.c:1.2 Sun Feb 4 01:13:45 2018 +++ src/common/lib/libc/string/strspn.c Sun Jun 18 22:18:13 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: strspn.c,v 1.2 2018/02/04 01:13:45 mrg Exp $ */ +/* $NetBSD: strspn.c,v 1.3 2023/06/18 22:18:13 rillig Exp $ */ /*- * Copyright (c) 2008 Joerg Sonnenberger @@ -26,7 +26,7 @@ */ #include -__RCSID("$NetBSD: strspn.c,v 1.2 2018/02/04 01:13:45 mrg Exp $"); +__RCSID("$NetBSD: strspn.c,v 1.3 2023/06/18 22:18:13 rillig Exp $"); #if !defined(_KERNEL) && !defined(_STANDALONE) #include @@ -114,7 +114,7 @@ strspn_x(const char *s_s, const char *ch /* * We could do remove the lsb from m_0 to terminate at the * end of the input string. - * However prefetching the next char is benifitial and we must + * However prefetching the next char is beneficial and we must * not read the byte after the \0 - as it might fault! * So we take the 'hit' of the compare against 0. */
CVS commit: src/common/lib/libc/string
Module Name:src Committed By: rillig Date: Sun Jun 18 22:18:13 UTC 2023 Modified Files: src/common/lib/libc/string: strspn.c Log Message: strspn: fix typo in comment To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/common/lib/libc/string/strspn.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/common/lib/libprop
Module Name:src Committed By: rin Date: Wed Jun 14 00:35:19 UTC 2023 Modified Files: src/common/lib/libprop: prop_dictionary.c Log Message: Sprinkle braces around _PROP_RWLOCK_UNLOCK() in ``if'' block. It is expanded into /* nothing */ for _STANDALONE. To generate a diff of this commit: cvs rdiff -u -r1.45 -r1.46 src/common/lib/libprop/prop_dictionary.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/common/lib/libprop/prop_dictionary.c diff -u src/common/lib/libprop/prop_dictionary.c:1.45 src/common/lib/libprop/prop_dictionary.c:1.46 --- src/common/lib/libprop/prop_dictionary.c:1.45 Wed Aug 3 21:13:46 2022 +++ src/common/lib/libprop/prop_dictionary.c Wed Jun 14 00:35:18 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: prop_dictionary.c,v 1.45 2022/08/03 21:13:46 riastradh Exp $ */ +/* $NetBSD: prop_dictionary.c,v 1.46 2023/06/14 00:35:18 rin Exp $ */ /*- * Copyright (c) 2006, 2007, 2020 The NetBSD Foundation, Inc. @@ -915,15 +915,17 @@ _prop_dictionary_get(prop_dictionary_t p if (! prop_object_is_dictionary(pd)) return (NULL); - if (!locked) + if (!locked) { _PROP_RWLOCK_RDLOCK(pd->pd_rwlock); + } pde = _prop_dict_lookup(pd, key, NULL); if (pde != NULL) { _PROP_ASSERT(pde->pde_objref != NULL); po = pde->pde_objref; } - if (!locked) + if (!locked) { _PROP_RWLOCK_UNLOCK(pd->pd_rwlock); + } return (po); } /*
CVS commit: src/common/lib/libprop
Module Name:src Committed By: rin Date: Wed Jun 14 00:35:19 UTC 2023 Modified Files: src/common/lib/libprop: prop_dictionary.c Log Message: Sprinkle braces around _PROP_RWLOCK_UNLOCK() in ``if'' block. It is expanded into /* nothing */ for _STANDALONE. To generate a diff of this commit: cvs rdiff -u -r1.45 -r1.46 src/common/lib/libprop/prop_dictionary.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/common/lib/libc/atomic
Module Name:src Committed By: riastradh Date: Mon Apr 3 16:45:46 UTC 2023 Modified Files: src/common/lib/libc/atomic: atomic_is_lock_free.c Log Message: libc atomic: Make previous work a little less accidentally. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/common/lib/libc/atomic/atomic_is_lock_free.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/common/lib/libc/atomic/atomic_is_lock_free.c diff -u src/common/lib/libc/atomic/atomic_is_lock_free.c:1.2 src/common/lib/libc/atomic/atomic_is_lock_free.c:1.3 --- src/common/lib/libc/atomic/atomic_is_lock_free.c:1.2 Mon Apr 3 08:00:28 2023 +++ src/common/lib/libc/atomic/atomic_is_lock_free.c Mon Apr 3 16:45:46 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: atomic_is_lock_free.c,v 1.2 2023/04/03 08:00:28 riastradh Exp $ */ +/* $NetBSD: atomic_is_lock_free.c,v 1.3 2023/04/03 16:45:46 riastradh Exp $ */ /*- * Copyright (c) 2023 The NetBSD Foundation, Inc. @@ -27,7 +27,7 @@ */ #include -__RCSID("$NetBSD: atomic_is_lock_free.c,v 1.2 2023/04/03 08:00:28 riastradh Exp $"); +__RCSID("$NetBSD: atomic_is_lock_free.c,v 1.3 2023/04/03 16:45:46 riastradh Exp $"); #include @@ -38,9 +38,9 @@ __RCSID("$NetBSD: atomic_is_lock_free.c, * C name be different but using an asm rename to define the right * symbol. */ +bool __atomic_is_lock_free_hack(size_t, const volatile void *) +__RENAME(__atomic_is_lock_free); #define __atomic_is_lock_free __atomic_is_lock_free_hack -bool __atomic_is_lock_free(size_t, const volatile void *) -__RENAME("__atomic_is_lock_free"); bool __atomic_is_lock_free(size_t n, const volatile void *p __unused)
CVS commit: src/common/lib/libc/atomic
Module Name:src Committed By: riastradh Date: Mon Apr 3 16:45:46 UTC 2023 Modified Files: src/common/lib/libc/atomic: atomic_is_lock_free.c Log Message: libc atomic: Make previous work a little less accidentally. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/common/lib/libc/atomic/atomic_is_lock_free.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/common/lib/libc/atomic
Module Name:src Committed By: riastradh Date: Mon Apr 3 08:00:28 UTC 2023 Modified Files: src/common/lib/libc/atomic: atomic_is_lock_free.c Log Message: libc __atomic_is_lock_free: Fix clang build with symbol hacks. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/common/lib/libc/atomic/atomic_is_lock_free.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/common/lib/libc/atomic/atomic_is_lock_free.c diff -u src/common/lib/libc/atomic/atomic_is_lock_free.c:1.1 src/common/lib/libc/atomic/atomic_is_lock_free.c:1.2 --- src/common/lib/libc/atomic/atomic_is_lock_free.c:1.1 Thu Mar 30 15:03:36 2023 +++ src/common/lib/libc/atomic/atomic_is_lock_free.c Mon Apr 3 08:00:28 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: atomic_is_lock_free.c,v 1.1 2023/03/30 15:03:36 riastradh Exp $ */ +/* $NetBSD: atomic_is_lock_free.c,v 1.2 2023/04/03 08:00:28 riastradh Exp $ */ /*- * Copyright (c) 2023 The NetBSD Foundation, Inc. @@ -27,12 +27,21 @@ */ #include -__RCSID("$NetBSD: atomic_is_lock_free.c,v 1.1 2023/03/30 15:03:36 riastradh Exp $"); +__RCSID("$NetBSD: atomic_is_lock_free.c,v 1.2 2023/04/03 08:00:28 riastradh Exp $"); #include #include +/* + * XXX Work around clang's built-in __atomic_is_lock_free by having the + * C name be different but using an asm rename to define the right + * symbol. + */ +#define __atomic_is_lock_free __atomic_is_lock_free_hack +bool __atomic_is_lock_free(size_t, const volatile void *) +__RENAME("__atomic_is_lock_free"); + bool __atomic_is_lock_free(size_t n, const volatile void *p __unused) {
CVS commit: src/common/lib/libc/atomic
Module Name:src Committed By: riastradh Date: Mon Apr 3 08:00:28 UTC 2023 Modified Files: src/common/lib/libc/atomic: atomic_is_lock_free.c Log Message: libc __atomic_is_lock_free: Fix clang build with symbol hacks. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/common/lib/libc/atomic/atomic_is_lock_free.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/common/lib/libc
Module Name:src Committed By: riastradh Date: Thu Mar 30 15:03:36 UTC 2023 Modified Files: src/common/lib/libc/arch/hppa/atomic: Makefile.inc src/common/lib/libc/arch/m68k/atomic: Makefile.inc src/common/lib/libc/arch/mips/atomic: Makefile.inc src/common/lib/libc/arch/sh3/atomic: Makefile.inc src/common/lib/libc/arch/sparc/atomic: Makefile.inc src/common/lib/libc/arch/vax/atomic: Makefile.inc Added Files: src/common/lib/libc/atomic: atomic_is_lock_free.c Log Message: libc: Define __atomic_is_lock_free. Limited to architectures where it is actually needed by gcc for any calls to stdatomic.h atomic_is_lock_free for now. We should also add it to other architectures too, along with lockful atomic r/m/w operations for sizes that can't be handled natively, but that's a lot more work. It is also necessary for -fno-inline-atomics but we're missing a lot of other symbols for that too, to be fixed. For now, this should enable the OpenSSL build to complete on these architectures again after I reverted a local change. XXX pullup-10 To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 src/common/lib/libc/arch/hppa/atomic/Makefile.inc cvs rdiff -u -r1.15 -r1.16 src/common/lib/libc/arch/m68k/atomic/Makefile.inc cvs rdiff -u -r1.15 -r1.16 src/common/lib/libc/arch/mips/atomic/Makefile.inc cvs rdiff -u -r1.8 -r1.9 src/common/lib/libc/arch/sh3/atomic/Makefile.inc cvs rdiff -u -r1.23 -r1.24 src/common/lib/libc/arch/sparc/atomic/Makefile.inc cvs rdiff -u -r1.8 -r1.9 src/common/lib/libc/arch/vax/atomic/Makefile.inc cvs rdiff -u -r0 -r1.1 src/common/lib/libc/atomic/atomic_is_lock_free.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/common/lib/libc/arch/hppa/atomic/Makefile.inc diff -u src/common/lib/libc/arch/hppa/atomic/Makefile.inc:1.14 src/common/lib/libc/arch/hppa/atomic/Makefile.inc:1.15 --- src/common/lib/libc/arch/hppa/atomic/Makefile.inc:1.14 Thu Feb 28 02:35:37 2019 +++ src/common/lib/libc/arch/hppa/atomic/Makefile.inc Thu Mar 30 15:03:35 2023 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.inc,v 1.14 2019/02/28 02:35:37 isaki Exp $ +# $NetBSD: Makefile.inc,v 1.15 2023/03/30 15:03:35 riastradh Exp $ .if defined(LIB) @@ -36,6 +36,7 @@ SRCS+= atomic_xor_32_cas.c atomic_xor_16 atomic_cas_32_cas.c atomic_cas_16_cas.c atomic_cas_8_cas.c \ atomic_c11_compare_exchange_cas_32.c\ atomic_c11_compare_exchange_cas_16.c\ - atomic_c11_compare_exchange_cas_8.c + atomic_c11_compare_exchange_cas_8.c\ + atomic_is_lock_free.c .endif .endif Index: src/common/lib/libc/arch/m68k/atomic/Makefile.inc diff -u src/common/lib/libc/arch/m68k/atomic/Makefile.inc:1.15 src/common/lib/libc/arch/m68k/atomic/Makefile.inc:1.16 --- src/common/lib/libc/arch/m68k/atomic/Makefile.inc:1.15 Thu Feb 28 02:35:37 2019 +++ src/common/lib/libc/arch/m68k/atomic/Makefile.inc Thu Mar 30 15:03:35 2023 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.inc,v 1.15 2019/02/28 02:35:37 isaki Exp $ +# $NetBSD: Makefile.inc,v 1.16 2023/03/30 15:03:35 riastradh Exp $ # # Note: The atomic operations here in these assembly files are atomic @@ -57,3 +57,7 @@ CPPFLAGS+= -D__HAVE_ASM_ATOMIC_CAS_UP -D .endif .endif + +.if defined(LIB) && ${LIB} == "c" +SRCS+= atomic_is_lock_free.c +.endif Index: src/common/lib/libc/arch/mips/atomic/Makefile.inc diff -u src/common/lib/libc/arch/mips/atomic/Makefile.inc:1.15 src/common/lib/libc/arch/mips/atomic/Makefile.inc:1.16 --- src/common/lib/libc/arch/mips/atomic/Makefile.inc:1.15 Sun Apr 25 22:45:16 2021 +++ src/common/lib/libc/arch/mips/atomic/Makefile.inc Thu Mar 30 15:03:36 2023 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.inc,v 1.15 2021/04/25 22:45:16 christos Exp $ +# $NetBSD: Makefile.inc,v 1.16 2023/03/30 15:03:36 riastradh Exp $ .if defined(LIB) && (${LIB} == "kern" || ${LIB} == "c" || ${LIB} == "pthread" \ || ${LIB} == "rump") @@ -51,6 +51,9 @@ SRCS+= atomic_xor_32_cas.c atomic_xor_16 atomic_c11_compare_exchange_cas_32.c\ atomic_c11_compare_exchange_cas_16.c\ atomic_c11_compare_exchange_cas_8.c +.if !${MACHINE_MIPS64} +SRCS+= atomic_is_lock_free.c +.endif .endif .if defined(LIB) && (${LIB} == "kern" || ${LIB} == "rump") Index: src/common/lib/libc/arch/sh3/atomic/Makefile.inc diff -u src/common/lib/libc/arch/sh3/atomic/Makefile.inc:1.8 src/common/lib/libc/arch/sh3/atomic/Makefile.inc:1.9 --- src/common/lib/libc/arch/sh3/atomic/Makefile.inc:1.8 Thu Feb 28 02:35:37 2019 +++ src/common/lib/libc/arch/sh3/atomic/Makefile.inc Thu Mar 30 15:03:36 2023 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.inc,v 1.8 2019/02/28 02:35:37 isaki Exp $ +# $NetBSD: Makefile.inc,v 1.9 2023/03/30 15:03:36 riastradh Exp $ .if defined(LIB) && (${LIB} == "kern" || ${LIB} == "c" || ${LIB} == "pthread" \ || ${LIB} == "rump") @@ -20,7 +20,8 @@ SRCS+= atomic_add_16_cas.c atomic_add_8_ atomic_cas_32_cas.c atomic_cas_16_cas.c atomic_cas_8_cas.c \
CVS commit: src/common/lib/libc
Module Name:src Committed By: riastradh Date: Thu Mar 30 15:03:36 UTC 2023 Modified Files: src/common/lib/libc/arch/hppa/atomic: Makefile.inc src/common/lib/libc/arch/m68k/atomic: Makefile.inc src/common/lib/libc/arch/mips/atomic: Makefile.inc src/common/lib/libc/arch/sh3/atomic: Makefile.inc src/common/lib/libc/arch/sparc/atomic: Makefile.inc src/common/lib/libc/arch/vax/atomic: Makefile.inc Added Files: src/common/lib/libc/atomic: atomic_is_lock_free.c Log Message: libc: Define __atomic_is_lock_free. Limited to architectures where it is actually needed by gcc for any calls to stdatomic.h atomic_is_lock_free for now. We should also add it to other architectures too, along with lockful atomic r/m/w operations for sizes that can't be handled natively, but that's a lot more work. It is also necessary for -fno-inline-atomics but we're missing a lot of other symbols for that too, to be fixed. For now, this should enable the OpenSSL build to complete on these architectures again after I reverted a local change. XXX pullup-10 To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 src/common/lib/libc/arch/hppa/atomic/Makefile.inc cvs rdiff -u -r1.15 -r1.16 src/common/lib/libc/arch/m68k/atomic/Makefile.inc cvs rdiff -u -r1.15 -r1.16 src/common/lib/libc/arch/mips/atomic/Makefile.inc cvs rdiff -u -r1.8 -r1.9 src/common/lib/libc/arch/sh3/atomic/Makefile.inc cvs rdiff -u -r1.23 -r1.24 src/common/lib/libc/arch/sparc/atomic/Makefile.inc cvs rdiff -u -r1.8 -r1.9 src/common/lib/libc/arch/vax/atomic/Makefile.inc cvs rdiff -u -r0 -r1.1 src/common/lib/libc/atomic/atomic_is_lock_free.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/common/lib/libc/arch/arm/string
Module Name:src Committed By: mlelstv Date: Tue Jan 24 07:04:27 UTC 2023 Modified Files: src/common/lib/libc/arch/arm/string: memcpy_arm.S Log Message: Fix two signed comparisons that were missed in the last patch. Found be rillig@ To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/common/lib/libc/arch/arm/string/memcpy_arm.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/common/lib/libc/arch/arm/string/memcpy_arm.S diff -u src/common/lib/libc/arch/arm/string/memcpy_arm.S:1.6 src/common/lib/libc/arch/arm/string/memcpy_arm.S:1.7 --- src/common/lib/libc/arch/arm/string/memcpy_arm.S:1.6 Thu Jan 19 18:03:03 2023 +++ src/common/lib/libc/arch/arm/string/memcpy_arm.S Tue Jan 24 07:04:27 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: memcpy_arm.S,v 1.6 2023/01/19 18:03:03 mlelstv Exp $ */ +/* $NetBSD: memcpy_arm.S,v 1.7 2023/01/24 07:04:27 mlelstv Exp $ */ /*- * Copyright (c) 1997 The NetBSD Foundation, Inc. @@ -111,8 +111,8 @@ ENTRY(memcpy) blo .Lmemcpy_l4 subs r2, r2, #4 - ldrlt r3, [r1], #4 - strlt r3, [r0], #4 + ldrlo r3, [r1], #4 + strlo r3, [r0], #4 ldmiahs r1!, {r3, r12} stmiahs r0!, {r3, r12} subhs r2, r2, #4
CVS commit: src/common/lib/libc/arch/arm/string
Module Name:src Committed By: mlelstv Date: Tue Jan 24 07:04:27 UTC 2023 Modified Files: src/common/lib/libc/arch/arm/string: memcpy_arm.S Log Message: Fix two signed comparisons that were missed in the last patch. Found be rillig@ To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/common/lib/libc/arch/arm/string/memcpy_arm.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/common/lib/libc/arch/arm/string
Module Name:src Committed By: mlelstv Date: Thu Jan 19 18:03:03 UTC 2023 Modified Files: src/common/lib/libc/arch/arm/string: memcpy_arm.S memcpy_neon.S memcpy_xscale.S memmove.S memset.S memset_naive.S strlen_neon.S Log Message: Use unsigned comparisons for pointers and size_t values. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/common/lib/libc/arch/arm/string/memcpy_arm.S \ src/common/lib/libc/arch/arm/string/memcpy_xscale.S cvs rdiff -u -r1.1 -r1.2 src/common/lib/libc/arch/arm/string/memcpy_neon.S \ src/common/lib/libc/arch/arm/string/memset_naive.S cvs rdiff -u -r1.10 -r1.11 src/common/lib/libc/arch/arm/string/memmove.S cvs rdiff -u -r1.8 -r1.9 src/common/lib/libc/arch/arm/string/memset.S cvs rdiff -u -r1.3 -r1.4 src/common/lib/libc/arch/arm/string/strlen_neon.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/common/lib/libc/arch/arm/string
Module Name:src Committed By: mlelstv Date: Thu Jan 19 18:03:03 UTC 2023 Modified Files: src/common/lib/libc/arch/arm/string: memcpy_arm.S memcpy_neon.S memcpy_xscale.S memmove.S memset.S memset_naive.S strlen_neon.S Log Message: Use unsigned comparisons for pointers and size_t values. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/common/lib/libc/arch/arm/string/memcpy_arm.S \ src/common/lib/libc/arch/arm/string/memcpy_xscale.S cvs rdiff -u -r1.1 -r1.2 src/common/lib/libc/arch/arm/string/memcpy_neon.S \ src/common/lib/libc/arch/arm/string/memset_naive.S cvs rdiff -u -r1.10 -r1.11 src/common/lib/libc/arch/arm/string/memmove.S cvs rdiff -u -r1.8 -r1.9 src/common/lib/libc/arch/arm/string/memset.S cvs rdiff -u -r1.3 -r1.4 src/common/lib/libc/arch/arm/string/strlen_neon.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/common/lib/libc/arch/arm/string/memcpy_arm.S diff -u src/common/lib/libc/arch/arm/string/memcpy_arm.S:1.5 src/common/lib/libc/arch/arm/string/memcpy_arm.S:1.6 --- src/common/lib/libc/arch/arm/string/memcpy_arm.S:1.5 Mon Dec 2 21:21:33 2013 +++ src/common/lib/libc/arch/arm/string/memcpy_arm.S Thu Jan 19 18:03:03 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: memcpy_arm.S,v 1.5 2013/12/02 21:21:33 joerg Exp $ */ +/* $NetBSD: memcpy_arm.S,v 1.6 2023/01/19 18:03:03 mlelstv Exp $ */ /*- * Copyright (c) 1997 The NetBSD Foundation, Inc. @@ -66,7 +66,7 @@ ENTRY(memcpy) push {r0, lr} /* memcpy() returns dest addr */ subs r2, r2, #4 - blt .Lmemcpy_l4 /* less than 4 bytes */ + blo .Lmemcpy_l4 /* less than 4 bytes */ ands r12, r0, #3 bne .Lmemcpy_destul /* oh unaligned destination addr */ ands r12, r1, #3 @@ -75,9 +75,9 @@ ENTRY(memcpy) .Lmemcpy_t8: /* We have aligned source and destination */ subs r2, r2, #8 - blt .Lmemcpy_l12 /* less than 12 bytes (4 from above) */ + blo .Lmemcpy_l12 /* less than 12 bytes (4 from above) */ subs r2, r2, #0x14 - blt .Lmemcpy_l32 /* less than 32 bytes (12 from above) */ + blo .Lmemcpy_l32 /* less than 32 bytes (12 from above) */ push {r4} /* borrow r4 */ /* blat 32 bytes at a time */ @@ -88,12 +88,12 @@ ENTRY(memcpy) ldmia r1!, {r3, r4, r12, lr} stmia r0!, {r3, r4, r12, lr} subs r2, r2, #0x20 - bge .Lmemcpy_loop32 + bhs .Lmemcpy_loop32 cmn r2, #0x10 - ldmiage r1!, {r3, r4, r12, lr} /* blat a remaining 16 bytes */ - stmiage r0!, {r3, r4, r12, lr} - subge r2, r2, #0x10 + ldmiahs r1!, {r3, r4, r12, lr} /* blat a remaining 16 bytes */ + stmiahs r0!, {r3, r4, r12, lr} + subhs r2, r2, #0x10 pop {r4} /* return r4 */ .Lmemcpy_l32: @@ -101,21 +101,21 @@ ENTRY(memcpy) /* blat 12 bytes at a time */ .Lmemcpy_loop12: - ldmiage r1!, {r3, r12, lr} - stmiage r0!, {r3, r12, lr} - subsge r2, r2, #0x0c - bge .Lmemcpy_loop12 + ldmiahs r1!, {r3, r12, lr} + stmiahs r0!, {r3, r12, lr} + subshs r2, r2, #0x0c + bhs .Lmemcpy_loop12 .Lmemcpy_l12: adds r2, r2, #8 - blt .Lmemcpy_l4 + blo .Lmemcpy_l4 subs r2, r2, #4 ldrlt r3, [r1], #4 strlt r3, [r0], #4 - ldmiage r1!, {r3, r12} - stmiage r0!, {r3, r12} - subge r2, r2, #4 + ldmiahs r1!, {r3, r12} + stmiahs r0!, {r3, r12} + subhs r2, r2, #4 .Lmemcpy_l4: /* less than 4 bytes to go */ @@ -129,10 +129,10 @@ ENTRY(memcpy) cmp r2, #2 ldrb r3, [r1], #1 strb r3, [r0], #1 - ldrbge r3, [r1], #1 - strbge r3, [r0], #1 - ldrbgt r3, [r1], #1 - strbgt r3, [r0], #1 + ldrbhs r3, [r1], #1 + strbhs r3, [r0], #1 + ldrbhi r3, [r1], #1 + strbhi r3, [r0], #1 pop {r0, pc} /* erg - unaligned destination */ @@ -143,12 +143,12 @@ ENTRY(memcpy) /* align destination with byte copies */ ldrb r3, [r1], #1 strb r3, [r0], #1 - ldrbge r3, [r1], #1 - strbge r3, [r0], #1 - ldrbgt r3, [r1], #1 - strbgt r3, [r0], #1 + ldrbhs r3, [r1], #1 + strbhs r3, [r0], #1 + ldrbhi r3, [r1], #1 + strbhi r3, [r0], #1 subs r2, r2, r12 - blt .Lmemcpy_l4 /* less the 4 bytes */ + blo .Lmemcpy_l4 /* less the 4 bytes */ ands r12, r1, #3 beq .Lmemcpy_t8 /* we have an aligned source */ @@ -159,10 +159,10 @@ ENTRY(memcpy) bic r1, r1, #3 ldr lr, [r1], #4 cmp r12, #2 - bgt .Lmemcpy_srcul3 + bhi .Lmemcpy_srcul3 beq .Lmemcpy_srcul2 cmp r2, #0x0c - blt .Lmemcpy_srcul1loop4 + blo .Lmemcpy_srcul1loop4 sub r2, r2, #0x0c push {r4, r5} @@ -192,10 +192,10 @@ ENTRY(memcpy) #endif stmia r0!, {r3-r5, r12} subs r2, r2, #0x10 - bge .Lmemcpy_srcul1loop16 + bhs .Lmemcpy_srcul1loop16 pop {r4, r5} adds r2, r2, #0x0c - blt .Lmemcpy_srcul1l4 + blo .Lmemcpy_srcul1l4 .Lmemcpy_srcul1loop4: #ifdef __ARMEB__ @@ -211,7 +211,7 @@ ENTRY(memcpy) #endif str r12, [r0], #4 subs r2, r2, #4 - bge .Lmemcpy_srcul1loop4 + bhs .Lmemcpy_srcul1loop4 .Lmemcpy_srcul1l4: sub r1, r1, #3 @@ -219,7 +219,7 @@ ENTRY(memcpy) .Lmemcpy_srcul2: cmp r2, #0x0c - blt .Lmemcpy_srcul2loop4 + blo .Lmemcpy_srcul2loop4 sub r2, r2, #0x0c push {r4, r5} @@ -249,10 +249,10 @@
CVS commit: src/common/lib/libc/arch/arm/string
Module Name:src Committed By: skrll Date: Sun Jan 15 08:43:04 UTC 2023 Modified Files: src/common/lib/libc/arch/arm/string: strlen_arm.S Log Message: Fix strnlen with a large maxlen argument by using unsigned comparison conditions - from mlelstv. I had a similar, but not quite as good patch. To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/common/lib/libc/arch/arm/string/strlen_arm.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/common/lib/libc/arch/arm/string/strlen_arm.S diff -u src/common/lib/libc/arch/arm/string/strlen_arm.S:1.10 src/common/lib/libc/arch/arm/string/strlen_arm.S:1.11 --- src/common/lib/libc/arch/arm/string/strlen_arm.S:1.10 Sat Dec 3 11:34:38 2022 +++ src/common/lib/libc/arch/arm/string/strlen_arm.S Sun Jan 15 08:43:03 2023 @@ -29,7 +29,7 @@ #include -RCSID("$NetBSD: strlen_arm.S,v 1.10 2022/12/03 11:34:38 skrll Exp $") +RCSID("$NetBSD: strlen_arm.S,v 1.11 2023/01/15 08:43:03 skrll Exp $") #if defined(__thumb__) && !defined(_ARM_ARCH_T2) #error Only Thumb2 or ARM supported @@ -102,7 +102,7 @@ ENTRY(FUNCNAME) .Lmain_loop: #ifdef STRNLEN cmp r0, r5 /* gone too far? */ - bge .Lmaxed_out /* yes, return maxlen */ + bhs .Lmaxed_out /* yes, return maxlen */ #endif ldr r3, [r0], #4 /* load next word */ #if defined(_ARM_ARCH_6) @@ -164,9 +164,9 @@ ENTRY(FUNCNAME) #ifdef STRNLEN cmp r0, r4 /* is it larger than maxlen? */ #ifdef __thumb__ - it gt + it hi #endif - movgt r0, r4 /* yes, return maxlen */ + movhi r0, r4 /* yes, return maxlen */ pop {r4, r5} /* restore registers */ #endif RET/* return */
CVS commit: src/common/lib/libc/arch/arm/string
Module Name:src Committed By: skrll Date: Sun Jan 15 08:43:04 UTC 2023 Modified Files: src/common/lib/libc/arch/arm/string: strlen_arm.S Log Message: Fix strnlen with a large maxlen argument by using unsigned comparison conditions - from mlelstv. I had a similar, but not quite as good patch. To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/common/lib/libc/arch/arm/string/strlen_arm.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/common/lib/libc/arch/arm/string
Module Name:src Committed By: skrll Date: Sat Dec 3 11:34:38 UTC 2022 Modified Files: src/common/lib/libc/arch/arm/string: strlen_arm.S Log Message: Fix some comments To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/common/lib/libc/arch/arm/string/strlen_arm.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/common/lib/libc/arch/arm/string/strlen_arm.S diff -u src/common/lib/libc/arch/arm/string/strlen_arm.S:1.9 src/common/lib/libc/arch/arm/string/strlen_arm.S:1.10 --- src/common/lib/libc/arch/arm/string/strlen_arm.S:1.9 Tue May 6 16:02:11 2014 +++ src/common/lib/libc/arch/arm/string/strlen_arm.S Sat Dec 3 11:34:38 2022 @@ -29,7 +29,7 @@ #include -RCSID("$NetBSD: strlen_arm.S,v 1.9 2014/05/06 16:02:11 joerg Exp $") +RCSID("$NetBSD: strlen_arm.S,v 1.10 2022/12/03 11:34:38 skrll Exp $") #if defined(__thumb__) && !defined(_ARM_ARCH_T2) #error Only Thumb2 or ARM supported @@ -121,9 +121,9 @@ ENTRY(FUNCNAME) * (other tests for NULs in a word take more instructions/cycles). */ tst r3, #BYTE0 /* is this byte 0? */ - tstne r3, #BYTE1 /* no, is this byte 0? */ - tstne r3, #BYTE2 /* no, is this byte 0? */ - tstne r3, #BYTE3 /* no, is this byte 0? */ + tstne r3, #BYTE1 /* no, is this byte 1? */ + tstne r3, #BYTE2 /* no, is this byte 2? */ + tstne r3, #BYTE3 /* no, is this byte 3? */ bne .Lmain_loop /* no, then get next word */ #endif #if defined(_ARM_ARCH_6)
CVS commit: src/common/lib/libc/arch/arm/string
Module Name:src Committed By: skrll Date: Sat Dec 3 11:34:38 UTC 2022 Modified Files: src/common/lib/libc/arch/arm/string: strlen_arm.S Log Message: Fix some comments To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/common/lib/libc/arch/arm/string/strlen_arm.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/common/lib/libc/arch/arm/string
Module Name:src Committed By: skrll Date: Sat Dec 3 11:30:24 UTC 2022 Modified Files: src/common/lib/libc/arch/arm/string: strlen_naive.S Log Message: improve a comment To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/common/lib/libc/arch/arm/string/strlen_naive.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/common/lib/libc/arch/arm/string/strlen_naive.S diff -u src/common/lib/libc/arch/arm/string/strlen_naive.S:1.8 src/common/lib/libc/arch/arm/string/strlen_naive.S:1.9 --- src/common/lib/libc/arch/arm/string/strlen_naive.S:1.8 Mon Aug 19 17:02:25 2013 +++ src/common/lib/libc/arch/arm/string/strlen_naive.S Sat Dec 3 11:30:24 2022 @@ -28,7 +28,7 @@ */ #include -RCSID("$NetBSD: strlen_naive.S,v 1.8 2013/08/19 17:02:25 matt Exp $") +RCSID("$NetBSD: strlen_naive.S,v 1.9 2022/12/03 11:30:24 skrll Exp $") #ifdef STRNLEN /* LINTSTUB: size_t strnlen(const char *, size_t) */ @@ -40,7 +40,7 @@ ENTRY(strnlen) #else adds ip, r0, r1 /* [maxlen] */ #endif -1: cmp r0, ip /* is this of string? */ +1: cmp r0, ip /* is this the end of string? */ beq 2f /* yes it is */ #ifdef __thumb__ ldrb r2, [r0] /* read a byte */
CVS commit: src/common/lib/libc/arch/arm/string
Module Name:src Committed By: skrll Date: Sat Dec 3 11:30:24 UTC 2022 Modified Files: src/common/lib/libc/arch/arm/string: strlen_naive.S Log Message: improve a comment To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/common/lib/libc/arch/arm/string/strlen_naive.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/common/dist/zlib
Module Name:src Committed By: christos Date: Sat Oct 15 23:21:34 UTC 2022 Modified Files: src/common/dist/zlib: zlib.h zutil.h Log Message: Handle standalone code. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/common/dist/zlib/zlib.h \ src/common/dist/zlib/zutil.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/common/dist/zlib/zlib.h diff -u src/common/dist/zlib/zlib.h:1.6 src/common/dist/zlib/zlib.h:1.7 --- src/common/dist/zlib/zlib.h:1.6 Sat Oct 15 15:49:32 2022 +++ src/common/dist/zlib/zlib.h Sat Oct 15 19:21:34 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: zlib.h,v 1.6 2022/10/15 19:49:32 christos Exp $ */ +/* $NetBSD: zlib.h,v 1.7 2022/10/15 23:21:34 christos Exp $ */ /* zlib.h -- interface of the 'zlib' general purpose compression library version 1.2.13, October 13th, 2022 @@ -1726,7 +1726,9 @@ ZEXTERN uLong ZEXPORT adler32_combine OF negative, the result has no meaning or utility. */ +#if !defined(_KERNEL) && !defined(_STANDALONE) ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len)); +#endif /* Update a running CRC-32 with the bytes buf[0..len-1] and return the updated CRC-32. A CRC-32 value is in the range of a 32-bit unsigned integer. Index: src/common/dist/zlib/zutil.h diff -u src/common/dist/zlib/zutil.h:1.6 src/common/dist/zlib/zutil.h:1.7 --- src/common/dist/zlib/zutil.h:1.6 Sat Oct 15 15:49:32 2022 +++ src/common/dist/zlib/zutil.h Sat Oct 15 19:21:34 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: zutil.h,v 1.6 2022/10/15 19:49:32 christos Exp $ */ +/* $NetBSD: zutil.h,v 1.7 2022/10/15 23:21:34 christos Exp $ */ /* zutil.h -- internal interface and configuration of the compression library * Copyright (C) 1995-2022 Jean-loup Gailly, Mark Adler @@ -49,6 +49,13 @@ typedef ush FAR ushf; typedef unsigned long ulg; #if !defined(Z_U8) && !defined(Z_SOLO) && defined(STDC) +# if defined(_KERNEL) || defined(_STANDALONE) +# ifdef _LP64 +# define Z_U8 unsigned long +# else +# define Z_U8 unsigned long long +# endif +# else # include # if (ULONG_MAX == 0x) #define Z_U8 unsigned long @@ -57,6 +64,7 @@ typedef unsigned long ulg; # elif (UINT_MAX == 0x) #define Z_U8 unsigned # endif +# endif #endif extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
CVS commit: src/common/dist/zlib
Module Name:src Committed By: christos Date: Sat Oct 15 23:21:34 UTC 2022 Modified Files: src/common/dist/zlib: zlib.h zutil.h Log Message: Handle standalone code. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/common/dist/zlib/zlib.h \ src/common/dist/zlib/zutil.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/common/dist/zlib
Module Name:src Committed By: christos Date: Sat Oct 15 19:49:34 UTC 2022 Modified Files: src/common/dist/zlib: compress.c crc32.c deflate.c deflate.h gzguts.h gzwrite.c infback.c inffast.c inflate.c inftrees.c trees.c uncompr.c zconf.h zlib.h zutil.c zutil.h Removed Files: src/common/dist/zlib/contrib/amd64: amd64-match.S src/common/dist/zlib/contrib/asm686: README.686 match.S src/common/dist/zlib/contrib/inflate86: inffas86.c inffast.S src/common/dist/zlib/contrib/masmx64: bld_ml64.bat gvmat64.asm inffas8664.c inffasx64.asm readme.txt src/common/dist/zlib/contrib/masmx86: bld_ml32.bat inffas32.asm match686.asm readme.txt src/common/dist/zlib/contrib/vstudio/vc14: miniunz.vcxproj.user minizip.vcxproj.user testzlib.vcxproj.user testzlibdll.vcxproj.user zlibstat.vcxproj.user zlibvc.vcxproj.user Log Message: merge conflicts between 1.2.10 and 1.2.13 To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/common/dist/zlib/compress.c \ src/common/dist/zlib/infback.c src/common/dist/zlib/inftrees.c \ src/common/dist/zlib/uncompr.c src/common/dist/zlib/zconf.h \ src/common/dist/zlib/zutil.c cvs rdiff -u -r1.5 -r1.6 src/common/dist/zlib/crc32.c \ src/common/dist/zlib/deflate.c src/common/dist/zlib/trees.c \ src/common/dist/zlib/zlib.h src/common/dist/zlib/zutil.h cvs rdiff -u -r1.4 -r1.5 src/common/dist/zlib/deflate.h \ src/common/dist/zlib/inffast.c cvs rdiff -u -r1.2 -r1.3 src/common/dist/zlib/gzguts.h \ src/common/dist/zlib/gzwrite.c cvs rdiff -u -r1.6 -r1.7 src/common/dist/zlib/inflate.c cvs rdiff -u -r1.1.1.1 -r0 src/common/dist/zlib/contrib/amd64/amd64-match.S cvs rdiff -u -r1.1.1.2 -r0 src/common/dist/zlib/contrib/asm686/README.686 \ src/common/dist/zlib/contrib/asm686/match.S cvs rdiff -u -r1.1.1.2 -r0 src/common/dist/zlib/contrib/inflate86/inffas86.c cvs rdiff -u -r1.1.1.1 -r0 src/common/dist/zlib/contrib/inflate86/inffast.S cvs rdiff -u -r1.1.1.1 -r0 src/common/dist/zlib/contrib/masmx64/bld_ml64.bat cvs rdiff -u -r1.1.1.2 -r0 src/common/dist/zlib/contrib/masmx64/gvmat64.asm \ src/common/dist/zlib/contrib/masmx64/inffas8664.c \ src/common/dist/zlib/contrib/masmx64/inffasx64.asm \ src/common/dist/zlib/contrib/masmx64/readme.txt cvs rdiff -u -r1.1.1.2 -r0 src/common/dist/zlib/contrib/masmx86/bld_ml32.bat \ src/common/dist/zlib/contrib/masmx86/inffas32.asm \ src/common/dist/zlib/contrib/masmx86/readme.txt cvs rdiff -u -r1.1.1.1 -r0 src/common/dist/zlib/contrib/masmx86/match686.asm cvs rdiff -u -r1.1.1.1 -r0 \ src/common/dist/zlib/contrib/vstudio/vc14/miniunz.vcxproj.user \ src/common/dist/zlib/contrib/vstudio/vc14/minizip.vcxproj.user \ src/common/dist/zlib/contrib/vstudio/vc14/testzlib.vcxproj.user \ src/common/dist/zlib/contrib/vstudio/vc14/testzlibdll.vcxproj.user \ src/common/dist/zlib/contrib/vstudio/vc14/zlibstat.vcxproj.user \ src/common/dist/zlib/contrib/vstudio/vc14/zlibvc.vcxproj.user Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/common/lib/libprop
Module Name:src Committed By: riastradh Date: Sun Aug 7 23:49:46 UTC 2022 Modified Files: src/common/lib/libprop: prop_object.c Log Message: proplib: Allocate sizeof(*ctx), not sizeof(struct ...). No functional change intended. To generate a diff of this commit: cvs rdiff -u -r1.34 -r1.35 src/common/lib/libprop/prop_object.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/common/lib/libprop/prop_object.c diff -u src/common/lib/libprop/prop_object.c:1.34 src/common/lib/libprop/prop_object.c:1.35 --- src/common/lib/libprop/prop_object.c:1.34 Thu Aug 4 09:02:29 2022 +++ src/common/lib/libprop/prop_object.c Sun Aug 7 23:49:46 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: prop_object.c,v 1.34 2022/08/04 09:02:29 riastradh Exp $ */ +/* $NetBSD: prop_object.c,v 1.35 2022/08/07 23:49:46 riastradh Exp $ */ /*- * Copyright (c) 2006, 2007 The NetBSD Foundation, Inc. @@ -718,8 +718,7 @@ _prop_object_internalize_context_alloc(c { struct _prop_object_internalize_context *ctx; - ctx = _PROP_MALLOC(sizeof(struct _prop_object_internalize_context), - M_TEMP); + ctx = _PROP_MALLOC(sizeof(*ctx), M_TEMP); if (ctx == NULL) return (NULL);
CVS commit: src/common/lib/libprop
Module Name:src Committed By: riastradh Date: Sun Aug 7 23:49:46 UTC 2022 Modified Files: src/common/lib/libprop: prop_object.c Log Message: proplib: Allocate sizeof(*ctx), not sizeof(struct ...). No functional change intended. To generate a diff of this commit: cvs rdiff -u -r1.34 -r1.35 src/common/lib/libprop/prop_object.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/common/lib/libc/arch/aarch64/atomic
Module Name:src Committed By: riastradh Date: Sat Aug 6 21:31:33 UTC 2022 Modified Files: src/common/lib/libc/arch/aarch64/atomic: Makefile.inc __aarch64_lse.S Log Message: aarch64: Implement __aarch64_casN_sync. gcc generates calls to this symbol in programs that use __sync_*_compare_and_swap, which require full sequential consistency barriers, including store-before-load ordering on both sides of the atomic; none of the release/acquire operations guarantee that, so we have to insert explicit DMB instructions. Note: gcc's own definition omits some of the DMB instructions, but I can't prove that it's correct that way -- stores preceding the CAS must complete before the load part of the CAS, and the store part of the CAS must complete before loads following the CAS. Maybe there's some way to prove that one of these orderings is guaranteed some other way than a DMB but I'm not seeing it, and store-before-load ordering is hard to understand. Patch by skrll@ based on a patch by mrg@, soliloquy in commit message by me. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/common/lib/libc/arch/aarch64/atomic/Makefile.inc cvs rdiff -u -r1.6 -r1.7 \ src/common/lib/libc/arch/aarch64/atomic/__aarch64_lse.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/common/lib/libc/arch/aarch64/atomic/Makefile.inc diff -u src/common/lib/libc/arch/aarch64/atomic/Makefile.inc:1.4 src/common/lib/libc/arch/aarch64/atomic/Makefile.inc:1.5 --- src/common/lib/libc/arch/aarch64/atomic/Makefile.inc:1.4 Tue Apr 27 09:14:24 2021 +++ src/common/lib/libc/arch/aarch64/atomic/Makefile.inc Sat Aug 6 21:31:33 2022 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.inc,v 1.4 2021/04/27 09:14:24 skrll Exp $ +# $NetBSD: Makefile.inc,v 1.5 2022/08/06 21:31:33 riastradh Exp $ .if defined(LIB) && (${LIB} == "kern" || ${LIB} == "c" || ${LIB} == "pthread" \ || ${LIB} == "rump") @@ -14,7 +14,7 @@ SRCS.atomic+= membar_ops.S #and cas nand or sub swap xor .for op in swp cas clr set eor add .for sz in 1 2 4 8 -.for ar in _relax _acq _rel _acq_rel +.for ar in _relax _acq _rel _acq_rel _sync __aarch64_${op}${sz}${ar}.S: __aarch64_lse.S ${_MKTARGET_CREATE} printf '#define OP ${op}\n#define OP_${op}\n#define SZ ${sz}\n#define AR ${ar}\n#define AR${ar}\n#include "__aarch64_lse.S"\n' > ${.TARGET} @@ -23,7 +23,7 @@ SRCS.gen+= __aarch64_${op}${sz}${ar}.S .endfor .endfor .for op in casp -.for ar in _relax _acq _rel _acq_rel +.for ar in _relax _acq _rel _acq_rel _sync __aarch64_${op}${ar}.S: __aarch64_lse.S ${_MKTARGET_CREATE} printf '#define OP ${op}\n#define OP_${op}\n#define AR ${ar}\n#define AR${ar}\n#include "__aarch64_lse.S"\n' > ${.TARGET} Index: src/common/lib/libc/arch/aarch64/atomic/__aarch64_lse.S diff -u src/common/lib/libc/arch/aarch64/atomic/__aarch64_lse.S:1.6 src/common/lib/libc/arch/aarch64/atomic/__aarch64_lse.S:1.7 --- src/common/lib/libc/arch/aarch64/atomic/__aarch64_lse.S:1.6 Sat Jul 23 13:30:15 2022 +++ src/common/lib/libc/arch/aarch64/atomic/__aarch64_lse.S Sat Aug 6 21:31:33 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: __aarch64_lse.S,v 1.6 2022/07/23 13:30:15 skrll Exp $ */ +/* $NetBSD: __aarch64_lse.S,v 1.7 2022/08/06 21:31:33 riastradh Exp $ */ /*- * Copyright (c) 2021 The NetBSD Foundation, Inc. @@ -64,21 +64,31 @@ #if defined(AR_relax) #define ACQ #define REL +#define DMB #endif #if defined(AR_acq) #define ACQ a #define REL +#define DMB #endif #if defined(AR_rel) #define ACQ #define REL l +#define DMB #endif #if defined(AR_acq_rel) #define ACQ a #define REL l +#define DMB +#endif + +#if defined(AR_sync) +#define ACQ +#define REL +#define DMB dmb ish #endif #if defined(OP_clr) @@ -134,14 +144,18 @@ ENTRY_NP(SWP_FUNC) #ifdef _HAVE_LSE DO_LSE_INSN_IF_SUPPORTED(99f) + DMB SWP R0, R0, [x1] + DMB ret 99: #endif mov x4, x0 /* need x0 for return value */ + DMB/* potential barrier */ 1: LDXR R0, [x1] /* load old value */ STXR w3, R4, [x1] /* store new value */ cbnz w3, 2f /* succeed?? no, try again */ + DMB/* potential barrier */ ret/* return old value */ 2: b 1b END(SWP_FUNC) @@ -151,16 +165,20 @@ END(SWP_FUNC) ENTRY_NP(CAS_FUNC) #ifdef _HAVE_LSE DO_LSE_INSN_IF_SUPPORTED(99f) + DMB CAS R0, R1, [x2] + DMB ret 99: #endif mov x4, x0 /* need x0 for return value */ + DMB/* potential barrier */ 1: LDXR R0, [x2] /* load old value */ cmp R0, R4 /* compare */ b.ne 2f /* not equal? return */ STXR w3, R1, [x2] /* store new value */ cbnz w3, 3f /* succeed? nope, try again. */ + DMB/* potential barrier */ 2: ret/* return. */ 3: b 1b END(CAS_FUNC) @@ -170,12 +188,15 @@ END(CAS_FUNC) ENTRY_NP(CASP_FUNC) #ifdef _HAVE_LSE DO_LSE_INSN_IF_SUPPORTED(99f) + DMB CASP x0, x1, x2, x3, [x4] + DMB ret 99: #endif mov x5, x0 /* need x0 for return value */ mov x6, x1 /* need x1 for return
CVS commit: src/common/lib/libc/arch/aarch64/atomic
Module Name:src Committed By: riastradh Date: Sat Aug 6 21:31:33 UTC 2022 Modified Files: src/common/lib/libc/arch/aarch64/atomic: Makefile.inc __aarch64_lse.S Log Message: aarch64: Implement __aarch64_casN_sync. gcc generates calls to this symbol in programs that use __sync_*_compare_and_swap, which require full sequential consistency barriers, including store-before-load ordering on both sides of the atomic; none of the release/acquire operations guarantee that, so we have to insert explicit DMB instructions. Note: gcc's own definition omits some of the DMB instructions, but I can't prove that it's correct that way -- stores preceding the CAS must complete before the load part of the CAS, and the store part of the CAS must complete before loads following the CAS. Maybe there's some way to prove that one of these orderings is guaranteed some other way than a DMB but I'm not seeing it, and store-before-load ordering is hard to understand. Patch by skrll@ based on a patch by mrg@, soliloquy in commit message by me. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/common/lib/libc/arch/aarch64/atomic/Makefile.inc cvs rdiff -u -r1.6 -r1.7 \ src/common/lib/libc/arch/aarch64/atomic/__aarch64_lse.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/common/lib/libprop
Module Name:src Committed By: riastradh Date: Thu Aug 4 09:02:29 UTC 2022 Modified Files: src/common/lib/libprop: prop_object.c Log Message: proplib: Fix mistake in previous -- use strncmp for prefix matching. To generate a diff of this commit: cvs rdiff -u -r1.33 -r1.34 src/common/lib/libprop/prop_object.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/common/lib/libprop/prop_object.c diff -u src/common/lib/libprop/prop_object.c:1.33 src/common/lib/libprop/prop_object.c:1.34 --- src/common/lib/libprop/prop_object.c:1.33 Wed Aug 3 21:20:21 2022 +++ src/common/lib/libprop/prop_object.c Thu Aug 4 09:02:29 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: prop_object.c,v 1.33 2022/08/03 21:20:21 riastradh Exp $ */ +/* $NetBSD: prop_object.c,v 1.34 2022/08/04 09:02:29 riastradh Exp $ */ /*- * Copyright (c) 2006, 2007 The NetBSD Foundation, Inc. @@ -735,7 +735,7 @@ _prop_object_internalize_context_alloc(c if (_PROP_EOF(*xml) || *xml != '<') goto bad; -#define MATCH(str) (strcmp([1], str) == 0) +#define MATCH(str) (strncmp([1], str, strlen(str)) == 0) /* * Skip over the XML preamble that Apple XML property
CVS commit: src/common/lib/libprop
Module Name:src Committed By: riastradh Date: Thu Aug 4 09:02:29 UTC 2022 Modified Files: src/common/lib/libprop: prop_object.c Log Message: proplib: Fix mistake in previous -- use strncmp for prefix matching. To generate a diff of this commit: cvs rdiff -u -r1.33 -r1.34 src/common/lib/libprop/prop_object.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/common/lib/libprop
Module Name:src Committed By: riastradh Date: Wed Aug 3 21:20:21 UTC 2022 Modified Files: src/common/lib/libprop: prop_object.c Log Message: proplib: Don't run off end of buffer with memcmp. The input is required to be NUL-terminated anyway, so just use strcmp here. Reported-by: syzbot+69838802c8ec55909...@syzkaller.appspotmail.com https://syzkaller.appspot.com/bug?id=927d66e8aa079ba2be43497425a6d9878025ad09 To generate a diff of this commit: cvs rdiff -u -r1.32 -r1.33 src/common/lib/libprop/prop_object.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/common/lib/libprop/prop_object.c diff -u src/common/lib/libprop/prop_object.c:1.32 src/common/lib/libprop/prop_object.c:1.33 --- src/common/lib/libprop/prop_object.c:1.32 Wed Aug 3 21:13:46 2022 +++ src/common/lib/libprop/prop_object.c Wed Aug 3 21:20:21 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: prop_object.c,v 1.32 2022/08/03 21:13:46 riastradh Exp $ */ +/* $NetBSD: prop_object.c,v 1.33 2022/08/03 21:20:21 riastradh Exp $ */ /*- * Copyright (c) 2006, 2007 The NetBSD Foundation, Inc. @@ -735,7 +735,7 @@ _prop_object_internalize_context_alloc(c if (_PROP_EOF(*xml) || *xml != '<') goto bad; -#define MATCH(str) (memcmp([1], str, sizeof(str) - 1) == 0) +#define MATCH(str) (strcmp([1], str) == 0) /* * Skip over the XML preamble that Apple XML property
CVS commit: src/common/lib/libprop
Module Name:src Committed By: riastradh Date: Wed Aug 3 21:20:21 UTC 2022 Modified Files: src/common/lib/libprop: prop_object.c Log Message: proplib: Don't run off end of buffer with memcmp. The input is required to be NUL-terminated anyway, so just use strcmp here. Reported-by: syzbot+69838802c8ec55909...@syzkaller.appspotmail.com https://syzkaller.appspot.com/bug?id=927d66e8aa079ba2be43497425a6d9878025ad09 To generate a diff of this commit: cvs rdiff -u -r1.32 -r1.33 src/common/lib/libprop/prop_object.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/common/lib/libprop
Module Name:src Committed By: riastradh Date: Wed Aug 3 21:13:46 UTC 2022 Modified Files: src/common/lib/libprop: prop_array_util.c prop_data.c prop_dictionary.c prop_dictionary_util.c prop_kern.c prop_number.c prop_object.c prop_string.c Log Message: proplib: Nix trailing whitespace. To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/common/lib/libprop/prop_array_util.c \ src/common/lib/libprop/prop_dictionary_util.c cvs rdiff -u -r1.17 -r1.18 src/common/lib/libprop/prop_data.c cvs rdiff -u -r1.44 -r1.45 src/common/lib/libprop/prop_dictionary.c cvs rdiff -u -r1.24 -r1.25 src/common/lib/libprop/prop_kern.c cvs rdiff -u -r1.33 -r1.34 src/common/lib/libprop/prop_number.c cvs rdiff -u -r1.31 -r1.32 src/common/lib/libprop/prop_object.c cvs rdiff -u -r1.16 -r1.17 src/common/lib/libprop/prop_string.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/common/lib/libprop/prop_array_util.c diff -u src/common/lib/libprop/prop_array_util.c:1.8 src/common/lib/libprop/prop_array_util.c:1.9 --- src/common/lib/libprop/prop_array_util.c:1.8 Sun Jun 14 21:31:01 2020 +++ src/common/lib/libprop/prop_array_util.c Wed Aug 3 21:13:46 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: prop_array_util.c,v 1.8 2020/06/14 21:31:01 christos Exp $ */ +/* $NetBSD: prop_array_util.c,v 1.9 2022/08/03 21:13:46 riastradh Exp $ */ /*- * Copyright (c) 2006, 2020 The NetBSD Foundation, Inc. @@ -49,7 +49,7 @@ prop_array_get_bool(prop_array_t array, b = prop_array_get(array, indx); if (prop_object_type(b) != PROP_TYPE_BOOL) return (false); - + *valp = prop_bool_true(b); return (true); Index: src/common/lib/libprop/prop_dictionary_util.c diff -u src/common/lib/libprop/prop_dictionary_util.c:1.8 src/common/lib/libprop/prop_dictionary_util.c:1.9 --- src/common/lib/libprop/prop_dictionary_util.c:1.8 Mon Jun 15 00:46:00 2020 +++ src/common/lib/libprop/prop_dictionary_util.c Wed Aug 3 21:13:46 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: prop_dictionary_util.c,v 1.8 2020/06/15 00:46:00 christos Exp $ */ +/* $NetBSD: prop_dictionary_util.c,v 1.9 2022/08/03 21:13:46 riastradh Exp $ */ /*- * Copyright (c) 2006, 2020 The NetBSD Foundation, Inc. @@ -63,7 +63,7 @@ prop_dictionary_get_bool(prop_dictionary b = prop_dictionary_get(dict, key); if (prop_object_type(b) != PROP_TYPE_BOOL) return (false); - + *valp = prop_bool_true(b); return (true); @@ -179,7 +179,7 @@ prop_dictionary_get_string(prop_dictiona cp = prop_string_value(str); if (cp == NULL) return (false); - + *cpp = cp; return (true); } Index: src/common/lib/libprop/prop_data.c diff -u src/common/lib/libprop/prop_data.c:1.17 src/common/lib/libprop/prop_data.c:1.18 --- src/common/lib/libprop/prop_data.c:1.17 Mon Jun 8 21:31:56 2020 +++ src/common/lib/libprop/prop_data.c Wed Aug 3 21:13:46 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: prop_data.c,v 1.17 2020/06/08 21:31:56 thorpej Exp $ */ +/* $NetBSD: prop_data.c,v 1.18 2022/08/03 21:13:46 riastradh Exp $ */ /*- * Copyright (c) 2006, 2020 The NetBSD Foundation, Inc. @@ -171,7 +171,7 @@ _prop_data_externalize(struct _prop_obje if (_prop_object_externalize_end_tag(ctx, "data") == false) return (false); - + return (true); } @@ -377,7 +377,7 @@ prop_data_copy_value(prop_data_t pd, voi if (! prop_object_is_data(pd)) return (false); - + if (buf == NULL || buflen < pd->pd_size) return (false); @@ -411,7 +411,7 @@ prop_data_data(prop_data_t pd) v = _PROP_MALLOC(pd->pd_size, M_TEMP); if (v != NULL) memcpy(v, pd->pd_immutable, pd->pd_size); - + return (v); } @@ -569,7 +569,7 @@ _prop_data_internalize_decode(struct _pr return (false); ch = (unsigned char) *src; /* FALLTHROUGH */ - + case 3: /* Valid, two bytes of info */ /* * We know this char is a =. Is there anything but @@ -662,7 +662,7 @@ _prop_data_internalize(prop_stack_t stac buf = _PROP_MALLOC(len + 1, M_PROP_DATA); if (buf == NULL) return (true); - + if (_prop_data_internalize_decode(ctx, buf, len + 1, , >poic_cp) == false) { _PROP_FREE(buf, M_PROP_DATA); Index: src/common/lib/libprop/prop_dictionary.c diff -u src/common/lib/libprop/prop_dictionary.c:1.44 src/common/lib/libprop/prop_dictionary.c:1.45 --- src/common/lib/libprop/prop_dictionary.c:1.44 Sat Jul 2 16:30:13 2022 +++ src/common/lib/libprop/prop_dictionary.c Wed Aug 3 21:13:46 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: prop_dictionary.c,v 1.44 2022/07/02 16:30:13 andvar Exp $ */ +/* $NetBSD: prop_dictionary.c,v 1.45 2022/08/03 21:13:46 riastradh Exp $ */ /*- * Copyright (c) 2006, 2007, 2020 The NetBSD Foundation, Inc. @@ -133,7 +133,7 @@ static const struct _prop_object_type _p .pot_equals = _prop_dictionary_equals, .pot_equals_finish = _prop_dictionary_equals_finish, .pot_lock = _prop_dictionary_lock, - .pot_unlock =
CVS commit: src/common/lib/libprop
Module Name:src Committed By: riastradh Date: Wed Aug 3 21:13:46 UTC 2022 Modified Files: src/common/lib/libprop: prop_array_util.c prop_data.c prop_dictionary.c prop_dictionary_util.c prop_kern.c prop_number.c prop_object.c prop_string.c Log Message: proplib: Nix trailing whitespace. To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/common/lib/libprop/prop_array_util.c \ src/common/lib/libprop/prop_dictionary_util.c cvs rdiff -u -r1.17 -r1.18 src/common/lib/libprop/prop_data.c cvs rdiff -u -r1.44 -r1.45 src/common/lib/libprop/prop_dictionary.c cvs rdiff -u -r1.24 -r1.25 src/common/lib/libprop/prop_kern.c cvs rdiff -u -r1.33 -r1.34 src/common/lib/libprop/prop_number.c cvs rdiff -u -r1.31 -r1.32 src/common/lib/libprop/prop_object.c cvs rdiff -u -r1.16 -r1.17 src/common/lib/libprop/prop_string.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/common/lib/libc/arch/aarch64/atomic
Module Name:src Committed By: skrll Date: Sat Jul 23 13:30:15 UTC 2022 Modified Files: src/common/lib/libc/arch/aarch64/atomic: __aarch64_lse.S Log Message: whitespace To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 \ src/common/lib/libc/arch/aarch64/atomic/__aarch64_lse.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/common/lib/libc/arch/aarch64/atomic/__aarch64_lse.S diff -u src/common/lib/libc/arch/aarch64/atomic/__aarch64_lse.S:1.5 src/common/lib/libc/arch/aarch64/atomic/__aarch64_lse.S:1.6 --- src/common/lib/libc/arch/aarch64/atomic/__aarch64_lse.S:1.5 Sat Jun 18 08:01:56 2022 +++ src/common/lib/libc/arch/aarch64/atomic/__aarch64_lse.S Sat Jul 23 13:30:15 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: __aarch64_lse.S,v 1.5 2022/06/18 08:01:56 skrll Exp $ */ +/* $NetBSD: __aarch64_lse.S,v 1.6 2022/07/23 13:30:15 skrll Exp $ */ /*- * Copyright (c) 2021 The NetBSD Foundation, Inc. @@ -138,11 +138,11 @@ ENTRY_NP(SWP_FUNC) ret 99: #endif - mov x4, x0 /* need x0 for return value */ -1: LDXR R0, [x1] /* load old value */ - STXR w3, R4, [x1] /* store new value */ - cbnz w3, 2f /* succeed?? no, try again */ - ret/* return old value */ + mov x4, x0 /* need x0 for return value */ +1: LDXR R0, [x1] /* load old value */ + STXR w3, R4, [x1] /* store new value */ + cbnz w3, 2f /* succeed?? no, try again */ + ret/* return old value */ 2: b 1b END(SWP_FUNC) #endif @@ -196,12 +196,12 @@ ENTRY_NP(INSN_FUNC) ret 99: #endif - mov x4, x0 /* need x0 for return value */ -1: LDXR R0, [x1] /* load old value */ + mov x4, x0 /* need x0 for return value */ +1: LDXR R0, [x1] /* load old value */ INSNOP R4, R0, R4 - STXR w3, R4, [x1] /* store new value */ - cbnz w3, 2f /* succeed?? no, try again */ - ret/* return old value */ + STXR w3, R4, [x1] /* store new value */ + cbnz w3, 2f /* succeed?? no, try again */ + ret/* return old value */ 2: b 1b END(INSN_FUNC) #endif
CVS commit: src/common/lib/libc/arch/aarch64/atomic
Module Name:src Committed By: skrll Date: Sat Jul 23 13:30:15 UTC 2022 Modified Files: src/common/lib/libc/arch/aarch64/atomic: __aarch64_lse.S Log Message: whitespace To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 \ src/common/lib/libc/arch/aarch64/atomic/__aarch64_lse.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/common/lib/libprop
Module Name:src Committed By: andvar Date: Sat Jul 2 16:30:13 UTC 2022 Modified Files: src/common/lib/libprop: prop_dictionary.c Log Message: s/refrences/references/ To generate a diff of this commit: cvs rdiff -u -r1.43 -r1.44 src/common/lib/libprop/prop_dictionary.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/common/lib/libprop/prop_dictionary.c diff -u src/common/lib/libprop/prop_dictionary.c:1.43 src/common/lib/libprop/prop_dictionary.c:1.44 --- src/common/lib/libprop/prop_dictionary.c:1.43 Sun Dec 5 02:52:17 2021 +++ src/common/lib/libprop/prop_dictionary.c Sat Jul 2 16:30:13 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: prop_dictionary.c,v 1.43 2021/12/05 02:52:17 msaitoh Exp $ */ +/* $NetBSD: prop_dictionary.c,v 1.44 2022/07/02 16:30:13 andvar Exp $ */ /*- * Copyright (c) 2006, 2007, 2020 The NetBSD Foundation, Inc. @@ -689,7 +689,7 @@ prop_dictionary_create_with_capacity(uns * prop_dictionary_copy -- * Copy a dictionary. The new dictionary has an initial capacity equal * to the number of objects stored int the original dictionary. The new - * dictionary contains refrences to the original dictionary's objects, + * dictionary contains references to the original dictionary's objects, * not copies of those objects (i.e. a shallow copy). */ prop_dictionary_t