CVS commit: src/lib/libc/sys

2024-07-20 Thread Valery Ushakov
Module Name:src
Committed By:   uwe
Date:   Sat Jul 20 13:12:19 UTC 2024

Modified Files:
src/lib/libc/sys: link.2

Log Message:
link(2): links to directories are refused at the VFS level

Drop the condition that "the caller is the super-user and the file
system ... supports linking to directories."

>From nabijaczleweli.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/lib/libc/sys/link.2

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/sys/link.2
diff -u src/lib/libc/sys/link.2:1.33 src/lib/libc/sys/link.2:1.34
--- src/lib/libc/sys/link.2:1.33	Sun Sep  1 19:52:32 2019
+++ src/lib/libc/sys/link.2	Sat Jul 20 13:12:19 2024
@@ -1,4 +1,4 @@
-.\"	$NetBSD: link.2,v 1.33 2019/09/01 19:52:32 sevan Exp $
+.\"	$NetBSD: link.2,v 1.34 2024/07/20 13:12:19 uwe Exp $
 .\"
 .\" Copyright (c) 1980, 1991, 1993, 2011
 .\"	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\" @(#)link.2	8.3 (Berkeley) 1/12/94
 .\"
-.Dd September 1, 2019
+.Dd July 20, 2024
 .Dt LINK 2
 .Os
 .Sh NAME
@@ -78,8 +78,7 @@ and
 .Fa name2
 must be in the same file system.
 .Fa name1
-may not be a directory unless the caller is the super-user
-and the file system containing it supports linking to directories.
+may not be a directory.
 .Pp
 .Fn linkat
 works the same way as
@@ -188,11 +187,7 @@ does not support links.
 .It Bq Er EPERM
 The file named by
 .Fa name1
-is a directory and the effective
-user ID is not super-user,
-or the file system containing the file does not permit the use of
-.Fn link
-on a directory.
+is a directory.
 .It Bq Er EROFS
 The requested link requires writing in a directory on a read-only file
 system.



CVS commit: src/lib/libc/sys

2024-07-20 Thread Valery Ushakov
Module Name:src
Committed By:   uwe
Date:   Sat Jul 20 13:12:19 UTC 2024

Modified Files:
src/lib/libc/sys: link.2

Log Message:
link(2): links to directories are refused at the VFS level

Drop the condition that "the caller is the super-user and the file
system ... supports linking to directories."

>From nabijaczleweli.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/lib/libc/sys/link.2

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/lib/libc/string

2024-07-15 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Mon Jul 15 19:25:30 UTC 2024

Modified Files:
src/lib/libc/string: memccpy.3

Log Message:
memccpy(3): add STANDARDS section

With input from kre@


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/lib/libc/string/memccpy.3

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/string/memccpy.3
diff -u src/lib/libc/string/memccpy.3:1.10 src/lib/libc/string/memccpy.3:1.11
--- src/lib/libc/string/memccpy.3:1.10	Mon Oct 16 08:48:45 2006
+++ src/lib/libc/string/memccpy.3	Mon Jul 15 19:25:30 2024
@@ -26,9 +26,9 @@
 .\" SUCH DAMAGE.
 .\"
 .\" from: @(#)memccpy.3	8.1 (Berkeley) 6/9/93
-.\"	$NetBSD: memccpy.3,v 1.10 2006/10/16 08:48:45 wiz Exp $
+.\"	$NetBSD: memccpy.3,v 1.11 2024/07/15 19:25:30 wiz Exp $
 .\"
-.Dd June 9, 1993
+.Dd July 15, 2024
 .Dt MEMCCPY 3
 .Os
 .Sh NAME
@@ -65,8 +65,14 @@ bytes are copied, and a null pointer is 
 .Xr memcpy 3 ,
 .Xr memmove 3 ,
 .Xr strcpy 3
+.Sh STANDARDS
+.Nm
+conforms to
+.St -p1003.1
+and
+.St -svid4 .
 .Sh HISTORY
 The
 .Fn memccpy
 function first appeared in
-.Bx 4.4 .
+.Bx 4.3 Tahoe .



CVS commit: src/lib/libc/string

2024-07-15 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Mon Jul 15 19:25:30 UTC 2024

Modified Files:
src/lib/libc/string: memccpy.3

Log Message:
memccpy(3): add STANDARDS section

With input from kre@


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/lib/libc/string/memccpy.3

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/lib/libc/gen

2024-07-11 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Jul 11 06:04:13 UTC 2024

Modified Files:
src/lib/libc/gen: syslog.3

Log Message:
syslog(3): Nix trailing whitespace in man page.

No functional change intended.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/lib/libc/gen/syslog.3

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/lib/libc/gen

2024-07-11 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Jul 11 06:04:13 UTC 2024

Modified Files:
src/lib/libc/gen: syslog.3

Log Message:
syslog(3): Nix trailing whitespace in man page.

No functional change intended.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/lib/libc/gen/syslog.3

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/gen/syslog.3
diff -u src/lib/libc/gen/syslog.3:1.34 src/lib/libc/gen/syslog.3:1.35
--- src/lib/libc/gen/syslog.3:1.34	Mon Jul  8 22:14:31 2024
+++ src/lib/libc/gen/syslog.3	Thu Jul 11 06:04:13 2024
@@ -1,4 +1,4 @@
-.\"	$NetBSD: syslog.3,v 1.34 2024/07/08 22:14:31 christos Exp $
+.\"	$NetBSD: syslog.3,v 1.35 2024/07/11 06:04:13 riastradh Exp $
 .\"	$OpenBSD: syslog.3,v 1.25 2005/07/22 03:16:58 jaredy Exp $
 .\"
 .\" Copyright (c) 1985, 1991, 1993
@@ -210,7 +210,7 @@ Similarly
 .Fn vsyslog_ss
 is the async-signal-safe version of
 .Fn vsyslog_r .
-Same for 
+Same for
 .Fn syslogp_ss
 and
 .Fn syslogp_r ,



CVS commit: src/lib/libc/sys

2024-07-05 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat Jul  6 02:23:39 UTC 2024

Modified Files:
src/lib/libc/sys: dup.2

Log Message:
dup(2): Trailing whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/lib/libc/sys/dup.2

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/sys/dup.2
diff -u src/lib/libc/sys/dup.2:1.34 src/lib/libc/sys/dup.2:1.35
--- src/lib/libc/sys/dup.2:1.34	Sun May 19 16:04:46 2024
+++ src/lib/libc/sys/dup.2	Sat Jul  6 02:23:39 2024
@@ -1,4 +1,4 @@
-.\"	$NetBSD: dup.2,v 1.34 2024/05/19 16:04:46 christos Exp $
+.\"	$NetBSD: dup.2,v 1.35 2024/07/06 02:23:39 rin Exp $
 .\"
 .\" Copyright (c) 1980, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -117,10 +117,10 @@ and can to some extent be adjusted with
 .Pp
 The
 .Fn dup3
-call fails and returns 
+call fails and returns
 .Er EINVAL
 if the numeric value in the
-.Ar oldfd 
+.Ar oldfd
 argument is equal to the one in the
 .Ar newfd
 argument.



CVS commit: src/lib/libc/sys

2024-07-05 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat Jul  6 02:23:39 UTC 2024

Modified Files:
src/lib/libc/sys: dup.2

Log Message:
dup(2): Trailing whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/lib/libc/sys/dup.2

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/lib/libc/arch/vax/gen

2024-06-29 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat Jun 29 06:52:34 UTC 2024

Modified Files:
src/lib/libc/arch/vax/gen: __longjmp14.c _setjmp.S

Log Message:
vax: {,_}longjmp(3): Return 1 if `val` == 0

Found by tests/lib/libc/setjmp/t_setjmp:{,_}longjmp_zero.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/lib/libc/arch/vax/gen/__longjmp14.c
cvs rdiff -u -r1.10 -r1.11 src/lib/libc/arch/vax/gen/_setjmp.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/lib/libc/arch/vax/gen

2024-06-29 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat Jun 29 06:52:34 UTC 2024

Modified Files:
src/lib/libc/arch/vax/gen: __longjmp14.c _setjmp.S

Log Message:
vax: {,_}longjmp(3): Return 1 if `val` == 0

Found by tests/lib/libc/setjmp/t_setjmp:{,_}longjmp_zero.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/lib/libc/arch/vax/gen/__longjmp14.c
cvs rdiff -u -r1.10 -r1.11 src/lib/libc/arch/vax/gen/_setjmp.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/arch/vax/gen/__longjmp14.c
diff -u src/lib/libc/arch/vax/gen/__longjmp14.c:1.5 src/lib/libc/arch/vax/gen/__longjmp14.c:1.6
--- src/lib/libc/arch/vax/gen/__longjmp14.c:1.5	Sun Jan 24 22:02:48 2016
+++ src/lib/libc/arch/vax/gen/__longjmp14.c	Sat Jun 29 06:52:34 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: __longjmp14.c,v 1.5 2016/01/24 22:02:48 christos Exp $	*/
+/*	$NetBSD: __longjmp14.c,v 1.6 2024/06/29 06:52:34 rin Exp $	*/
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -56,9 +56,9 @@ __longjmp14(jmp_buf env, int val)
 	if (jb->jb_sc.sc_sp == 0)
 		goto err;
 
-	/* Ensure non-zero return value */
+	/* Return 1 if val is zero */
 	if (val == 0)
-		val = -1;
+		val = 1;
 
 	/* Set _UC_SIGMASK and _UC_CPU */
 	uc.uc_flags = _UC_SIGMASK | _UC_CPU;

Index: src/lib/libc/arch/vax/gen/_setjmp.S
diff -u src/lib/libc/arch/vax/gen/_setjmp.S:1.10 src/lib/libc/arch/vax/gen/_setjmp.S:1.11
--- src/lib/libc/arch/vax/gen/_setjmp.S:1.10	Tue Jan 25 02:38:15 2011
+++ src/lib/libc/arch/vax/gen/_setjmp.S	Sat Jun 29 06:52:34 2024
@@ -31,7 +31,7 @@
 
 #if defined(LIBC_SCCS) && !defined(lint)
 	/* .asciz "@(#)_setjmp.s	8.1 (Berkeley) 6/4/93" */
-RCSID("$NetBSD: _setjmp.S,v 1.10 2011/01/25 02:38:15 matt Exp $")
+RCSID("$NetBSD: _setjmp.S,v 1.11 2024/06/29 06:52:34 rin Exp $")
 #endif /* LIBC_SCCS and not lint */
 
 /*
@@ -68,7 +68,9 @@ END(_setjmp)
 
 ENTRY(_longjmp, 0)
 	movl	8(%ap),%r0		# return(v)
-	movl	4(%ap),%r1		# fetch buffer
+	jneq	1f
+	movl	$1,%r0
+1:	movl	4(%ap),%r1		# fetch buffer
 	tstl	12(%r1)			# is fp null
 	beql	botch
 	movq	44(%r1),%r6		# restore r6/r7



CVS commit: src/lib/libc/compat/gen

2024-06-17 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Jun 17 18:16:58 UTC 2024

Modified Files:
src/lib/libc/compat/gen: compat_ldexp_ieee754.c

Log Message:
libc ldexp(3): Avoid undefined behaviour in arithmetic overflow.

PR lib/58347


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/lib/libc/compat/gen/compat_ldexp_ieee754.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/compat/gen/compat_ldexp_ieee754.c
diff -u src/lib/libc/compat/gen/compat_ldexp_ieee754.c:1.8 src/lib/libc/compat/gen/compat_ldexp_ieee754.c:1.9
--- src/lib/libc/compat/gen/compat_ldexp_ieee754.c:1.8	Thu May 21 05:56:31 2020
+++ src/lib/libc/compat/gen/compat_ldexp_ieee754.c	Mon Jun 17 18:16:58 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: compat_ldexp_ieee754.c,v 1.8 2020/05/21 05:56:31 riastradh Exp $ */
+/* $NetBSD: compat_ldexp_ieee754.c,v 1.9 2024/06/17 18:16:58 riastradh Exp $ */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: compat_ldexp_ieee754.c,v 1.8 2020/05/21 05:56:31 riastradh Exp $");
+__RCSID("$NetBSD: compat_ldexp_ieee754.c,v 1.9 2024/06/17 18:16:58 riastradh Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include 
@@ -115,17 +115,31 @@ ldexp(double val, int expon)
 
 	/*
 	 * u.v is now normalized and oldexp has been adjusted if necessary.
-	 * Calculate the new exponent and check for underflow and overflow.
+	 * We have
+	 *
+	 *	0 <= oldexp <= DBL_EXP_INFNAN,
+	 *
+	 * but
+	 *
+	 *	INT_MIN <= expon <= INT_MAX.
+	 *
+	 * Check for underflow and overflow, and if none, calculate the
+	 * new exponent.
 	 */
-	newexp = oldexp + expon;
-
-	if (newexp >= DBL_EXP_INFNAN ||
-	(oldexp >= 0 && expon >= DBL_EXP_INFNAN)) {
+	if (expon >= DBL_EXP_INFNAN - oldexp) {
 		/*
 		 * The result overflowed; return +/-Inf.
 		 */
 		return overflow(val);
-	} else if (newexp <= 0) {
+	}
+
+	/*
+	 * We now have INT_MIN <= oldexp + expon <= DBL_EXP_INFNAN <= INT_MAX,
+	 * so the arithmetic is safe.
+	 */
+	newexp = oldexp + expon;
+
+	if (newexp <= 0) {
 		/*
 		 * The output number is either denormal or underflows (see
 		 * comments in machine/ieee.h).



CVS commit: src/lib/libc/compat/gen

2024-06-17 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Jun 17 18:16:58 UTC 2024

Modified Files:
src/lib/libc/compat/gen: compat_ldexp_ieee754.c

Log Message:
libc ldexp(3): Avoid undefined behaviour in arithmetic overflow.

PR lib/58347


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/lib/libc/compat/gen/compat_ldexp_ieee754.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/lib/libc/gdtoa

2024-06-09 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Sun Jun  9 15:06:07 UTC 2024

Modified Files:
src/lib/libc/gdtoa: hdtoa.c

Log Message:
Fix hdtoa() for VAX D floating point


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/lib/libc/gdtoa/hdtoa.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/lib/libc/gdtoa

2024-06-09 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Sun Jun  9 15:06:07 UTC 2024

Modified Files:
src/lib/libc/gdtoa: hdtoa.c

Log Message:
Fix hdtoa() for VAX D floating point


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/lib/libc/gdtoa/hdtoa.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/gdtoa/hdtoa.c
diff -u src/lib/libc/gdtoa/hdtoa.c:1.13 src/lib/libc/gdtoa/hdtoa.c:1.14
--- src/lib/libc/gdtoa/hdtoa.c:1.13	Thu May  9 12:24:24 2024
+++ src/lib/libc/gdtoa/hdtoa.c	Sun Jun  9 15:06:07 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: hdtoa.c,v 1.13 2024/05/09 12:24:24 riastradh Exp $	*/
+/*	$NetBSD: hdtoa.c,v 1.14 2024/06/09 15:06:07 jakllsch Exp $	*/
 
 /*-
  * Copyright (c) 2004, 2005 David Schultz 
@@ -30,7 +30,7 @@
 #if 0
 __FBSDID("$FreeBSD: src/lib/libc/gdtoa/_hdtoa.c,v 1.4 2007/01/03 04:57:58 das Exp $");
 #else
-__RCSID("$NetBSD: hdtoa.c,v 1.13 2024/05/09 12:24:24 riastradh Exp $");
+__RCSID("$NetBSD: hdtoa.c,v 1.14 2024/06/09 15:06:07 jakllsch Exp $");
 #endif
 
 #include 
@@ -59,8 +59,12 @@ __RCSID("$NetBSD: hdtoa.c,v 1.13 2024/05
 #define	INFSTR	"Infinity"
 #define	NANSTR	"NaN"
 
+#ifndef __vax__
 #define	DBL_ADJ		(DBL_MAX_EXP - 2 + ((DBL_MANT_DIG - 1) % 4))
 #define	LDBL_ADJ	(LDBL_MAX_EXP - 2 + ((LDBL_MANT_DIG - 1) % 4))
+#else /* __vax__ */
+#define	DBL_ADJ		(DBL_MAX_EXP + 4 + ((DBL_MANT_DIG) % 4))
+#endif
 
 /*
  * Round up the given digit string.  If the digit string is fff...f,
@@ -152,6 +156,11 @@ hdtoa(double d, const char *xdigs, int n
 
 	u.dblu_d = d;
 	*sign = u.dblu_dbl.dbl_sign;
+#ifdef __vax__
+	u.dfltu_dflt.dflt_fracl =
+	((u.dfltu_dflt.dflt_fracl >> 16) & 0x) |
+	((u.dfltu_dflt.dflt_fracl & 0x) << 16);
+#endif
 
 	switch (fpclassify(d)) {
 	case FP_NORMAL:
@@ -160,16 +169,11 @@ hdtoa(double d, const char *xdigs, int n
 	case FP_ZERO:
 		*decpt = 1;
 		return (nrv_alloc("0", rve, 1));
+#ifndef __vax__
 	case FP_SUBNORMAL:
-#ifdef __vax__
-		/* (DBL_MAX_EXP=127 / 2) + 2 = 65? */
-		u.dblu_d *= 0x1p65;
-		*decpt = u.dblu_dbl.dbl_exp - (65 + DBL_ADJ);
-#else
 		/* (DBL_MAX_EXP=1024 / 2) + 2 = 514? */
 		u.dblu_d *= 0x1p514;
 		*decpt = u.dblu_dbl.dbl_exp - (514 + DBL_ADJ);
-#endif
 		break;
 	case FP_INFINITE:
 		*decpt = INT_MAX;
@@ -177,6 +181,7 @@ hdtoa(double d, const char *xdigs, int n
 	case FP_NAN:
 		*decpt = INT_MAX;
 		return (nrv_alloc(NANSTR, rve, sizeof(NANSTR) - 1));
+#endif
 	default:
 		abort();
 	}
@@ -210,7 +215,8 @@ hdtoa(double d, const char *xdigs, int n
 		u.dblu_dbl.dbl_fracl >>= 4;
 	}
 #ifdef DBL_FRACMBITS
-	for (; s > s0; s--) {
+	for (; s > s0 + sigfigs - ((DBL_FRACLBITS + DBL_FRACMBITS) / 4) - 1
+&& s > s0; s--) {
 		*s = u.dblu_dbl.dbl_fracm & 0xf;
 		u.dblu_dbl.dbl_fracm >>= 4;
 	}



CVS commit: src/lib/libc

2024-06-08 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Sat Jun  8 21:35:18 UTC 2024

Modified Files:
src/lib/libc/locale: global_locale.c setlocale.c setlocale_local.h
src/lib/libc/string: Makefile.inc strerror_r.c

Log Message:
Redo l10n support in the strerror family.

Instead of opening the message catelog whenever strerror is called,
keep track of the translations in the locale cache. For the C locale,
the builtin sys_errlist is used directly. Other locales will open
the catalog file on the first strerror call and build a translation
table, so that further calls in this locale can just use an array
lookup.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/lib/libc/locale/global_locale.c
cvs rdiff -u -r1.65 -r1.66 src/lib/libc/locale/setlocale.c
cvs rdiff -u -r1.17 -r1.18 src/lib/libc/locale/setlocale_local.h
cvs rdiff -u -r1.89 -r1.90 src/lib/libc/string/Makefile.inc
cvs rdiff -u -r1.5 -r1.6 src/lib/libc/string/strerror_r.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/locale/global_locale.c
diff -u src/lib/libc/locale/global_locale.c:1.28 src/lib/libc/locale/global_locale.c:1.29
--- src/lib/libc/locale/global_locale.c:1.28	Fri Jun  7 13:53:23 2024
+++ src/lib/libc/locale/global_locale.c	Sat Jun  8 21:35:18 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: global_locale.c,v 1.28 2024/06/07 13:53:23 riastradh Exp $ */
+/* $NetBSD: global_locale.c,v 1.29 2024/06/08 21:35:18 joerg Exp $ */
 
 /*-
  * Copyright (c)2008 Citrus Project,
@@ -28,12 +28,15 @@
 
 #include 
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: global_locale.c,v 1.28 2024/06/07 13:53:23 riastradh Exp $");
+__RCSID("$NetBSD: global_locale.c,v 1.29 2024/06/08 21:35:18 joerg Exp $");
 #endif /* LIBC_SCCS and not lint */
 
+#include "namespace.h"
+
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #define __SETLOCALE_SOURCE__
@@ -137,6 +140,9 @@ __dso_hidden const struct _locale_cache_
 },
 .monetary_name = _lc_C_locale_name,
 .numeric_name = _lc_C_locale_name,
+.message_name = _lc_C_locale_name,
+.errlistp = _errlist,
+.errlist_prefix = "Unknown error: %d",
 };
 
 struct _locale _lc_global_locale = {

Index: src/lib/libc/locale/setlocale.c
diff -u src/lib/libc/locale/setlocale.c:1.65 src/lib/libc/locale/setlocale.c:1.66
--- src/lib/libc/locale/setlocale.c:1.65	Thu Jan  4 20:57:29 2018
+++ src/lib/libc/locale/setlocale.c	Sat Jun  8 21:35:18 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: setlocale.c,v 1.65 2018/01/04 20:57:29 kamil Exp $ */
+/* $NetBSD: setlocale.c,v 1.66 2024/06/08 21:35:18 joerg Exp $ */
 
 /*-
  * Copyright (c)2008 Citrus Project,
@@ -28,7 +28,7 @@
 
 #include 
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: setlocale.c,v 1.65 2018/01/04 20:57:29 kamil Exp $");
+__RCSID("$NetBSD: setlocale.c,v 1.66 2024/06/08 21:35:18 joerg Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include "namespace.h"
@@ -65,6 +65,7 @@ _setlocale_cache(locale_t loc, struct _l
 {
 	const char *monetary_name = loc->part_name[LC_MONETARY];
 	const char *numeric_name = loc->part_name[LC_NUMERIC];
+	const char *message_name = loc->part_name[LC_MESSAGES];
 	_NumericLocale *numeric = loc->part_impl[LC_NUMERIC];
 	_MonetaryLocale *monetary = loc->part_impl[LC_MONETARY];
 	struct lconv *ldata;
@@ -78,6 +79,9 @@ _setlocale_cache(locale_t loc, struct _l
 		if (numeric_name != old_cache->numeric_name &&
 		strcmp(numeric_name, old_cache->numeric_name) != 0)
 			continue;
+		if (message_name != old_cache->message_name &&
+		strcmp(message_name, old_cache->message_name) != 0)
+			continue;
 		loc->cache = old_cache;
 		free(cache);
 		return 0;
@@ -91,6 +95,10 @@ _setlocale_cache(locale_t loc, struct _l
 
 	cache->monetary_name = monetary_name;
 	cache->numeric_name = numeric_name;
+	cache->message_name = message_name;
+	cache->errlist = NULL;
+	cache->errlistp = >errlist;
+	cache->errlist_prefix = NULL;
 	ldata = >ldata;
 
 	ldata->decimal_point = __UNCONST(numeric->decimal_point);

Index: src/lib/libc/locale/setlocale_local.h
diff -u src/lib/libc/locale/setlocale_local.h:1.17 src/lib/libc/locale/setlocale_local.h:1.18
--- src/lib/libc/locale/setlocale_local.h:1.17	Fri Apr 29 16:26:48 2016
+++ src/lib/libc/locale/setlocale_local.h	Sat Jun  8 21:35:18 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: setlocale_local.h,v 1.17 2016/04/29 16:26:48 joerg Exp $ */
+/* $NetBSD: setlocale_local.h,v 1.18 2024/06/08 21:35:18 joerg Exp $ */
 
 /*-
  * Copyright (c)2008 Citrus Project,
@@ -48,7 +48,11 @@ struct _locale_cache_t {
 	SLIST_ENTRY(_locale_cache_t) cache_link;
 	const char *monetary_name;
 	const char *numeric_name;
+	const char *message_name;
 	struct lconv ldata;
+	const char * errlist_prefix;
+	const char * const *errlist;
+	const char * const **errlistp;
 };
 
 struct _locale {

Index: src/lib/libc/string/Makefile.inc
diff -u src/lib/libc/string/Makefile.inc:1.89 

CVS commit: src/lib/libc

2024-06-08 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Sat Jun  8 21:35:18 UTC 2024

Modified Files:
src/lib/libc/locale: global_locale.c setlocale.c setlocale_local.h
src/lib/libc/string: Makefile.inc strerror_r.c

Log Message:
Redo l10n support in the strerror family.

Instead of opening the message catelog whenever strerror is called,
keep track of the translations in the locale cache. For the C locale,
the builtin sys_errlist is used directly. Other locales will open
the catalog file on the first strerror call and build a translation
table, so that further calls in this locale can just use an array
lookup.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/lib/libc/locale/global_locale.c
cvs rdiff -u -r1.65 -r1.66 src/lib/libc/locale/setlocale.c
cvs rdiff -u -r1.17 -r1.18 src/lib/libc/locale/setlocale_local.h
cvs rdiff -u -r1.89 -r1.90 src/lib/libc/string/Makefile.inc
cvs rdiff -u -r1.5 -r1.6 src/lib/libc/string/strerror_r.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



Re: CVS commit: src/lib/libc

2024-06-08 Thread Taylor R Campbell
> Date: Sat, 8 Jun 2024 11:51:43 +0200
> From: Roland Illig 
> 
> Am 07.06.2024 um 22:50 schrieb Taylor R Campbell:
> > libc: Pacify lint on aarch64.
> >
> > +++ src/lib/libc/stdlib/Makefile.incFri Jun  7 20:50:13 2024
> > +# lint(1) spuriously complains about `*s == CHAR_MAX' even though *s
> > +# has type char.
> > +LINTFLAGS.strfmon.c += -X 230
> 
> I guess the "spuriously" here means "on platforms where 'char' is
> unsigned", not "sometimes on the same platform, unpredictably".

Correct.

> Lint does not warn if the constant is defined as a character constant,
> so '\xff' instead of 0xff would work, but I don't know what else would
> be affected if the definition of CHAR_MAX were changed.

Might work but I'm reluctant to try without extensive testing on a lot
of compilers in a lot of environments.  E.g., does that work in C89?

> Ideally, lint would not warn about this expression, but since lint only
> looks at the preprocessed translation unit, it cannot know that the 0xff
> comes from CHAR_MAX and thus is fine.  Practically, suppressing the
> warning in this particular case makes sense.
> 
> Any ideas how to resolve this situation?

No brilliant ideas, sorry, other than to teach lint to track
provenance of constants through macro expansion.  That's why I just
disabled the warning for this case.


Re: CVS commit: src/lib/libc

2024-06-08 Thread Roland Illig
Am 07.06.2024 um 22:50 schrieb Taylor R Campbell:
> libc: Pacify lint on aarch64.
>
> +++ src/lib/libc/stdlib/Makefile.inc  Fri Jun  7 20:50:13 2024
> +# lint(1) spuriously complains about `*s == CHAR_MAX' even though *s
> +# has type char.
> +LINTFLAGS.strfmon.c += -X 230

I guess the "spuriously" here means "on platforms where 'char' is
unsigned", not "sometimes on the same platform, unpredictably".

When CHAR_MAX is defined as 0xff, lint assumes that the same constant
with the same value is used on other platforms as well, thus the
warning.  This is due to lint's -p flag for portability checks.

Lint does not warn if the constant is defined as a character constant,
so '\xff' instead of 0xff would work, but I don't know what else would
be affected if the definition of CHAR_MAX were changed.

Ideally, lint would not warn about this expression, but since lint only
looks at the preprocessed translation unit, it cannot know that the 0xff
comes from CHAR_MAX and thus is fine.  Practically, suppressing the
warning in this particular case makes sense.

Any ideas how to resolve this situation?

Roland



CVS commit: src/lib/libc/compiler_rt

2024-06-07 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Jun  7 20:50:27 UTC 2024

Modified Files:
src/lib/libc/compiler_rt: Makefile.inc

Log Message:
lib/libc/compiler_rt/Makefile.inc: Sort LINTFLAGS lines.

No functional change intended.


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 src/lib/libc/compiler_rt/Makefile.inc

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/lib/libc/compiler_rt

2024-06-07 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Jun  7 20:50:27 UTC 2024

Modified Files:
src/lib/libc/compiler_rt: Makefile.inc

Log Message:
lib/libc/compiler_rt/Makefile.inc: Sort LINTFLAGS lines.

No functional change intended.


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 src/lib/libc/compiler_rt/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/lib/libc/compiler_rt/Makefile.inc
diff -u src/lib/libc/compiler_rt/Makefile.inc:1.49 src/lib/libc/compiler_rt/Makefile.inc:1.50
--- src/lib/libc/compiler_rt/Makefile.inc:1.49	Fri Jun  7 20:50:13 2024
+++ src/lib/libc/compiler_rt/Makefile.inc	Fri Jun  7 20:50:27 2024
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.inc,v 1.49 2024/06/07 20:50:13 riastradh Exp $
+# $NetBSD: Makefile.inc,v 1.50 2024/06/07 20:50:27 riastradh Exp $
 
 COMPILER_RT_DIR=	${NETBSDSRCDIR}/sys/external/bsd/compiler_rt
 COMPILER_RT_SRCDIR=	${COMPILER_RT_DIR}/dist
@@ -334,8 +334,8 @@ COPTS.${src}+=	-D__SOFT_FP__
 
 LINTFLAGS.GCDAProfiling.c += -X 123,132,351 # Ok, this is just sloppy
 LINTFLAGS.GCDAProfiling.c += -X 298 # vax
-LINTFLAGS.InstrProfiling.c += -X 351
 LINTFLAGS.InstrProfiling.c += -X 298 # vax
+LINTFLAGS.InstrProfiling.c += -X 351
 LINTFLAGS.InstrProfilingFile.c += -X 351
 LINTFLAGS.InstrProfilingPlatformLinux.c += -X 190,351
 LINTFLAGS.InstrProfilingValue.c += -X 132,231,275,351
@@ -349,8 +349,8 @@ LINTFLAGS.addvdi3.c += -X 351
 LINTFLAGS.addvsi3.c += -X 351
 LINTFLAGS.addvti3.c += -X 351
 LINTFLAGS.ashlti3.c += -X 351
-LINTFLAGS.ashrti3.c += -X 117,351
 LINTFLAGS.ashrdi3.c += -X 117 # vax
+LINTFLAGS.ashrti3.c += -X 117,351
 LINTFLAGS.clzdi2.c += -X 351
 LINTFLAGS.clzsi2.c += -X 351
 LINTFLAGS.cmpti2.c += -X 351
@@ -362,8 +362,8 @@ LINTFLAGS.ctzti2.c += -X 351
 LINTFLAGS.divdi3.c += -X 117 # vax
 LINTFLAGS.divmodsi4.c += -X 351
 LINTFLAGS.divsi3.c += -X 117
-LINTFLAGS.divti3.c += -X 117,351
 LINTFLAGS.divtc3.c += -X 351	# ppc
+LINTFLAGS.divti3.c += -X 117,351
 LINTFLAGS.dlfcn_elf.c += -X 351
 LINTFLAGS.ffsdi2.c += -X 132,351
 LINTFLAGS.ffsti2.c += -X 132,351
@@ -381,12 +381,12 @@ LINTFLAGS.fixunsxfsi.c += -X 132,309,351
 LINTFLAGS.fixunsxfti.c += -X 132,351
 LINTFLAGS.fixxfdi.c += -X 351
 LINTFLAGS.fixxfti.c += -X 117,132,351
-LINTFLAGS.floatdidf.c += -X 351
 LINTFLAGS.floatdidf.c += -X 117	# alpha
-LINTFLAGS.floatdisf.c += -X 351
+LINTFLAGS.floatdidf.c += -X 351
 LINTFLAGS.floatdisf.c += -X 117	# alpha
-LINTFLAGS.floatdixf.c += -X 351
+LINTFLAGS.floatdisf.c += -X 351
 LINTFLAGS.floatdixf.c += -X 117	# alpha
+LINTFLAGS.floatdixf.c += -X 351
 LINTFLAGS.floattidf.c += -X 117,122,141,267,351
 LINTFLAGS.floattisf.c += -X 117,351
 LINTFLAGS.floattisf.c += -X 117,351



CVS commit: src/lib/libc

2024-06-07 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Jun  7 20:50:13 UTC 2024

Modified Files:
src/lib/libc/arch/aarch64/gen: Makefile.inc fpgetmask.c fpgetround.c
fpsetmask.c fpsetround.c
src/lib/libc/compat/net: Makefile.inc
src/lib/libc/compiler_rt: Makefile.inc
src/lib/libc/gdtoa: Makefile.inc
src/lib/libc/nameser: Makefile.inc
src/lib/libc/stdlib: Makefile.inc

Log Message:
libc: Pacify lint on aarch64.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/lib/libc/arch/aarch64/gen/Makefile.inc \
src/lib/libc/arch/aarch64/gen/fpgetmask.c \
src/lib/libc/arch/aarch64/gen/fpgetround.c \
src/lib/libc/arch/aarch64/gen/fpsetmask.c \
src/lib/libc/arch/aarch64/gen/fpsetround.c
cvs rdiff -u -r1.2 -r1.3 src/lib/libc/compat/net/Makefile.inc
cvs rdiff -u -r1.48 -r1.49 src/lib/libc/compiler_rt/Makefile.inc
cvs rdiff -u -r1.14 -r1.15 src/lib/libc/gdtoa/Makefile.inc
cvs rdiff -u -r1.1 -r1.2 src/lib/libc/nameser/Makefile.inc
cvs rdiff -u -r1.98 -r1.99 src/lib/libc/stdlib/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/lib/libc/arch/aarch64/gen/Makefile.inc
diff -u src/lib/libc/arch/aarch64/gen/Makefile.inc:1.2 src/lib/libc/arch/aarch64/gen/Makefile.inc:1.3
--- src/lib/libc/arch/aarch64/gen/Makefile.inc:1.2	Tue Jul  7 21:40:19 2015
+++ src/lib/libc/arch/aarch64/gen/Makefile.inc	Fri Jun  7 20:50:13 2024
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.inc,v 1.2 2015/07/07 21:40:19 matt Exp $
+# $NetBSD: Makefile.inc,v 1.3 2024/06/07 20:50:13 riastradh Exp $
 
 SRCS+=	byte_swap_2.S byte_swap_4.S byte_swap_8.S
 SRCS+=	flt_rounds.c
@@ -27,6 +27,20 @@ SRCS+=	makecontext.c resumecontext.c swa
 
 SRCS+=	_lwp.c
 
+LINTFLAGS.fpclassifyl_ieee754.c+=	-X 132
+LINTFLAGS.isfinitel_ieee754.c+=		-X 132
+LINTFLAGS.isinfl_ieee754.c+=		-X 132
+LINTFLAGS.fixunstfdi_ieee754.c+=	-X 132
+LINTFLAGS.fixunstfsi_ieee754.c+=	-X 132
+LINTFLAGS.fpsetround.c+=		-X 132
+LINTFLAGS.isnanl_ieee754.c+=		-X 132
+LINTFLAGS.signbitl_ieee754.c+=		-X 132
+LINTFLAGS.fpgetmask.c+=			-X 132
+LINTFLAGS.fpgetround.c+=		-X 132
+LINTFLAGS.fpgetsticky.c+=		-X 132
+LINTFLAGS.fpsetmask.c+=			-X 132
+LINTFLAGS.fpsetsticky.c+=		-X 132
+
 #LSRCS.arm.gen=	Lint_bswap16.c Lint_bswap32.c Lint_swapcontext.c
 #LSRCS+=		${LSRCS.arm.gen}
 #DPSRCS+=	${LSRCS.arm.gen}
Index: src/lib/libc/arch/aarch64/gen/fpgetmask.c
diff -u src/lib/libc/arch/aarch64/gen/fpgetmask.c:1.2 src/lib/libc/arch/aarch64/gen/fpgetmask.c:1.3
--- src/lib/libc/arch/aarch64/gen/fpgetmask.c:1.2	Sat Dec 24 15:23:06 2016
+++ src/lib/libc/arch/aarch64/gen/fpgetmask.c	Fri Jun  7 20:50:13 2024
@@ -29,7 +29,7 @@
 
 #include 
 
-__RCSID("$NetBSD: fpgetmask.c,v 1.2 2016/12/24 15:23:06 maya Exp $");
+__RCSID("$NetBSD: fpgetmask.c,v 1.3 2024/06/07 20:50:13 riastradh Exp $");
 
 #include 
 #include 
@@ -40,7 +40,7 @@ __RCSID("$NetBSD: fpgetmask.c,v 1.2 2016
 
 #include 
 
-__weak_alias(fpgetmask,_fpgetmask);
+__weak_alias(fpgetmask,_fpgetmask)
 
 fp_except_t
 fpgetmask(void)
Index: src/lib/libc/arch/aarch64/gen/fpgetround.c
diff -u src/lib/libc/arch/aarch64/gen/fpgetround.c:1.2 src/lib/libc/arch/aarch64/gen/fpgetround.c:1.3
--- src/lib/libc/arch/aarch64/gen/fpgetround.c:1.2	Sat Dec 24 15:23:06 2016
+++ src/lib/libc/arch/aarch64/gen/fpgetround.c	Fri Jun  7 20:50:13 2024
@@ -29,7 +29,7 @@
 
 #include 
 
-__RCSID("$NetBSD: fpgetround.c,v 1.2 2016/12/24 15:23:06 maya Exp $");
+__RCSID("$NetBSD: fpgetround.c,v 1.3 2024/06/07 20:50:13 riastradh Exp $");
 
 #include 
 #include 
@@ -40,7 +40,7 @@ __RCSID("$NetBSD: fpgetround.c,v 1.2 201
 
 #include 
 
-__weak_alias(fpgetround,_fpgetround);
+__weak_alias(fpgetround,_fpgetround)
 
 fp_rnd_t
 fpgetround(void)
Index: src/lib/libc/arch/aarch64/gen/fpsetmask.c
diff -u src/lib/libc/arch/aarch64/gen/fpsetmask.c:1.2 src/lib/libc/arch/aarch64/gen/fpsetmask.c:1.3
--- src/lib/libc/arch/aarch64/gen/fpsetmask.c:1.2	Sat Dec 24 15:23:06 2016
+++ src/lib/libc/arch/aarch64/gen/fpsetmask.c	Fri Jun  7 20:50:13 2024
@@ -29,7 +29,7 @@
 
 #include 
 
-__RCSID("$NetBSD: fpsetmask.c,v 1.2 2016/12/24 15:23:06 maya Exp $");
+__RCSID("$NetBSD: fpsetmask.c,v 1.3 2024/06/07 20:50:13 riastradh Exp $");
 
 #include 
 #include 
@@ -40,7 +40,7 @@ __RCSID("$NetBSD: fpsetmask.c,v 1.2 2016
 
 #include 
 
-__weak_alias(fpsetmask,_fpsetmask);
+__weak_alias(fpsetmask,_fpsetmask)
 
 fp_except_t
 fpsetmask(fp_except_t mask)
Index: src/lib/libc/arch/aarch64/gen/fpsetround.c
diff -u src/lib/libc/arch/aarch64/gen/fpsetround.c:1.2 src/lib/libc/arch/aarch64/gen/fpsetround.c:1.3
--- src/lib/libc/arch/aarch64/gen/fpsetround.c:1.2	Sat Dec 24 15:23:06 2016
+++ src/lib/libc/arch/aarch64/gen/fpsetround.c	Fri Jun  7 20:50:13 2024
@@ -29,7 +29,7 @@
 
 #include 
 
-__RCSID("$NetBSD: fpsetround.c,v 1.2 2016/12/24 15:23:06 maya Exp $");
+__RCSID("$NetBSD: fpsetround.c,v 1.3 2024/06/07 20:50:13 riastradh Exp $");
 
 #include 
 #include 
@@ -40,7 

CVS commit: src/lib/libc

2024-06-07 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Jun  7 20:50:13 UTC 2024

Modified Files:
src/lib/libc/arch/aarch64/gen: Makefile.inc fpgetmask.c fpgetround.c
fpsetmask.c fpsetround.c
src/lib/libc/compat/net: Makefile.inc
src/lib/libc/compiler_rt: Makefile.inc
src/lib/libc/gdtoa: Makefile.inc
src/lib/libc/nameser: Makefile.inc
src/lib/libc/stdlib: Makefile.inc

Log Message:
libc: Pacify lint on aarch64.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/lib/libc/arch/aarch64/gen/Makefile.inc \
src/lib/libc/arch/aarch64/gen/fpgetmask.c \
src/lib/libc/arch/aarch64/gen/fpgetround.c \
src/lib/libc/arch/aarch64/gen/fpsetmask.c \
src/lib/libc/arch/aarch64/gen/fpsetround.c
cvs rdiff -u -r1.2 -r1.3 src/lib/libc/compat/net/Makefile.inc
cvs rdiff -u -r1.48 -r1.49 src/lib/libc/compiler_rt/Makefile.inc
cvs rdiff -u -r1.14 -r1.15 src/lib/libc/gdtoa/Makefile.inc
cvs rdiff -u -r1.1 -r1.2 src/lib/libc/nameser/Makefile.inc
cvs rdiff -u -r1.98 -r1.99 src/lib/libc/stdlib/Makefile.inc

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/lib/libc

2024-06-07 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Jun  7 13:53:23 UTC 2024

Modified Files:
src/lib/libc/gen: isctype.c
src/lib/libc/locale: global_locale.c iswctype_mb.c multibyte.h
src/lib/libc/time: strftime.c strptime.c

Log Message:
libc/locale: Nix needless size_t casts.

No functional change intended.  No binary change to aarch64 libc.

Prompted by code inspection around PR lib/58319.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/lib/libc/gen/isctype.c
cvs rdiff -u -r1.27 -r1.28 src/lib/libc/locale/global_locale.c
cvs rdiff -u -r1.13 -r1.14 src/lib/libc/locale/iswctype_mb.c
cvs rdiff -u -r1.7 -r1.8 src/lib/libc/locale/multibyte.h
cvs rdiff -u -r1.55 -r1.56 src/lib/libc/time/strftime.c
cvs rdiff -u -r1.66 -r1.67 src/lib/libc/time/strptime.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/gen/isctype.c
diff -u src/lib/libc/gen/isctype.c:1.25 src/lib/libc/gen/isctype.c:1.26
--- src/lib/libc/gen/isctype.c:1.25	Mon Aug 19 22:43:28 2013
+++ src/lib/libc/gen/isctype.c	Fri Jun  7 13:53:22 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: isctype.c,v 1.25 2013/08/19 22:43:28 joerg Exp $ */
+/* $NetBSD: isctype.c,v 1.26 2024/06/07 13:53:22 riastradh Exp $ */
 
 /*-
  * Copyright (c)2008 Citrus Project,
@@ -28,7 +28,7 @@
 
 #include 
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: isctype.c,v 1.25 2013/08/19 22:43:28 joerg Exp $");
+__RCSID("$NetBSD: isctype.c,v 1.26 2024/06/07 13:53:22 riastradh Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include "namespace.h"
@@ -48,7 +48,7 @@ __RCSID("$NetBSD: isctype.c,v 1.25 2013/
 #include "setlocale_local.h"
 
 #define _RUNE_LOCALE(loc) \
-((_RuneLocale *)((loc)->part_impl[(size_t)LC_CTYPE]))
+((_RuneLocale *)((loc)->part_impl[LC_CTYPE]))
 
 #define _ISCTYPE_FUNC(name, bit) \
 int \

Index: src/lib/libc/locale/global_locale.c
diff -u src/lib/libc/locale/global_locale.c:1.27 src/lib/libc/locale/global_locale.c:1.28
--- src/lib/libc/locale/global_locale.c:1.27	Fri Jun  7 13:53:12 2024
+++ src/lib/libc/locale/global_locale.c	Fri Jun  7 13:53:23 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: global_locale.c,v 1.27 2024/06/07 13:53:12 riastradh Exp $ */
+/* $NetBSD: global_locale.c,v 1.28 2024/06/07 13:53:23 riastradh Exp $ */
 
 /*-
  * Copyright (c)2008 Citrus Project,
@@ -28,7 +28,7 @@
 
 #include 
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: global_locale.c,v 1.27 2024/06/07 13:53:12 riastradh Exp $");
+__RCSID("$NetBSD: global_locale.c,v 1.28 2024/06/07 13:53:23 riastradh Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include 
@@ -143,26 +143,26 @@ struct _locale _lc_global_locale = {
 .cache = &_C_cache,
 .query = { _C_LOCALE },
 .part_name = {
-	[(size_t)LC_ALL ] = _lc_C_locale_name,
-	[(size_t)LC_COLLATE ] = _lc_C_locale_name,
-	[(size_t)LC_CTYPE   ] = _lc_C_locale_name,
-	[(size_t)LC_MONETARY] = _lc_C_locale_name,
-	[(size_t)LC_NUMERIC ] = _lc_C_locale_name,
-	[(size_t)LC_TIME] = _lc_C_locale_name,
-	[(size_t)LC_MESSAGES] = _lc_C_locale_name,
+	[LC_ALL ] = _lc_C_locale_name,
+	[LC_COLLATE ] = _lc_C_locale_name,
+	[LC_CTYPE   ] = _lc_C_locale_name,
+	[LC_MONETARY] = _lc_C_locale_name,
+	[LC_NUMERIC ] = _lc_C_locale_name,
+	[LC_TIME] = _lc_C_locale_name,
+	[LC_MESSAGES] = _lc_C_locale_name,
 },
 .part_impl = {
-	[(size_t)LC_ALL ] = (_locale_part_t)NULL,
-	[(size_t)LC_COLLATE ] = (_locale_part_t)NULL,
-	[(size_t)LC_CTYPE   ] = (_locale_part_t)
+	[LC_ALL ] = (_locale_part_t)NULL,
+	[LC_COLLATE ] = (_locale_part_t)NULL,
+	[LC_CTYPE   ] = (_locale_part_t)
 	__UNCONST(&_DefaultRuneLocale),
-	[(size_t)LC_MONETARY] = (_locale_part_t)
+	[LC_MONETARY] = (_locale_part_t)
 	__UNCONST(&_DefaultMonetaryLocale),
-	[(size_t)LC_NUMERIC ] = (_locale_part_t)
+	[LC_NUMERIC ] = (_locale_part_t)
 	__UNCONST(&_DefaultNumericLocale),
-	[(size_t)LC_MESSAGES] = (_locale_part_t)
+	[LC_MESSAGES] = (_locale_part_t)
 	__UNCONST(&_DefaultMessagesLocale),
-	[(size_t)LC_TIME] = (_locale_part_t)
+	[LC_TIME] = (_locale_part_t)
 	__UNCONST(&_DefaultTimeLocale),
 },
 };
@@ -171,26 +171,26 @@ const struct _locale _lc_C_locale = {
 .cache = &_C_cache,
 .query = { _C_LOCALE },
 .part_name = {
-	[(size_t)LC_ALL ] = _lc_C_locale_name,
-	[(size_t)LC_COLLATE ] = _lc_C_locale_name,
-	[(size_t)LC_CTYPE   ] = _lc_C_locale_name,
-	[(size_t)LC_MONETARY] = _lc_C_locale_name,
-	[(size_t)LC_NUMERIC ] = _lc_C_locale_name,
-	[(size_t)LC_TIME] = _lc_C_locale_name,
-	[(size_t)LC_MESSAGES] = _lc_C_locale_name,
+	[LC_ALL ] = _lc_C_locale_name,
+	[LC_COLLATE ] = _lc_C_locale_name,
+	[LC_CTYPE   ] = _lc_C_locale_name,
+	[LC_MONETARY] = _lc_C_locale_name,
+	[LC_NUMERIC ] = _lc_C_locale_name,
+	[LC_TIME] = _lc_C_locale_name,
+	[LC_MESSAGES] = _lc_C_locale_name,
 },
 .part_impl = {
-	[(size_t)LC_ALL ] = (_locale_part_t)NULL,
-	

CVS commit: src/lib/libc

2024-06-07 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Jun  7 13:53:12 UTC 2024

Modified Files:
src/lib/libc/citrus: citrus_fix_grouping.h
src/lib/libc/locale: fix_grouping.c global_locale.c

Log Message:
libc/locale: Nix needless char casts.

These appear to have been added to pacify a spurious warning by lint,
which no longer warns about it anyway.

No functional change intended.  No binary change to aarch64 libc.

Prompted by code inspection around PR lib/58319.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/lib/libc/citrus/citrus_fix_grouping.h
cvs rdiff -u -r1.6 -r1.7 src/lib/libc/locale/fix_grouping.c
cvs rdiff -u -r1.26 -r1.27 src/lib/libc/locale/global_locale.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/citrus/citrus_fix_grouping.h
diff -u src/lib/libc/citrus/citrus_fix_grouping.h:1.2 src/lib/libc/citrus/citrus_fix_grouping.h:1.3
--- src/lib/libc/citrus/citrus_fix_grouping.h:1.2	Sun Jan 11 02:46:24 2009
+++ src/lib/libc/citrus/citrus_fix_grouping.h	Fri Jun  7 13:53:12 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: citrus_fix_grouping.h,v 1.2 2009/01/11 02:46:24 christos Exp $ */
+/* $NetBSD: citrus_fix_grouping.h,v 1.3 2024/06/07 13:53:12 riastradh Exp $ */
 
 /*-
  * Copyright (c)2008 Citrus Project,
@@ -43,7 +43,7 @@ _citrus_fixup_char_max_md(char *grouping
 
 	for (p = grouping; *p != '\0'; ++p) {
 		if (*p == _CITRUS_LC_GROUPING_VALUE_NO_FUTHER)
-			*p = (char)CHAR_MAX;
+			*p = CHAR_MAX;
 	}
 }
 #define _CITRUS_FIXUP_CHAR_MAX_MD(grouping) \

Index: src/lib/libc/locale/fix_grouping.c
diff -u src/lib/libc/locale/fix_grouping.c:1.6 src/lib/libc/locale/fix_grouping.c:1.7
--- src/lib/libc/locale/fix_grouping.c:1.6	Wed Mar 21 14:11:24 2012
+++ src/lib/libc/locale/fix_grouping.c	Fri Jun  7 13:53:12 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: fix_grouping.c,v 1.6 2012/03/21 14:11:24 christos Exp $ */
+/* $NetBSD: fix_grouping.c,v 1.7 2024/06/07 13:53:12 riastradh Exp $ */
 
 /*
  * Copyright (c) 2001 Alexey Zelkin 
@@ -35,7 +35,7 @@
 
 #include 
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: fix_grouping.c,v 1.6 2012/03/21 14:11:24 christos Exp $");
+__RCSID("$NetBSD: fix_grouping.c,v 1.7 2024/06/07 13:53:12 riastradh Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include 
@@ -44,7 +44,7 @@ __RCSID("$NetBSD: fix_grouping.c,v 1.6 2
 #include "fix_grouping.h"
 
 #ifndef NBCHAR_MAX
-#define NBCHAR_MAX	(char)CHAR_MAX
+#define NBCHAR_MAX	CHAR_MAX
 #endif
 
 #ifndef __UNCONST

Index: src/lib/libc/locale/global_locale.c
diff -u src/lib/libc/locale/global_locale.c:1.26 src/lib/libc/locale/global_locale.c:1.27
--- src/lib/libc/locale/global_locale.c:1.26	Fri Jun  7 13:53:02 2024
+++ src/lib/libc/locale/global_locale.c	Fri Jun  7 13:53:12 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: global_locale.c,v 1.26 2024/06/07 13:53:02 riastradh Exp $ */
+/* $NetBSD: global_locale.c,v 1.27 2024/06/07 13:53:12 riastradh Exp $ */
 
 /*-
  * Copyright (c)2008 Citrus Project,
@@ -28,7 +28,7 @@
 
 #include 
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: global_locale.c,v 1.26 2024/06/07 13:53:02 riastradh Exp $");
+__RCSID("$NetBSD: global_locale.c,v 1.27 2024/06/07 13:53:12 riastradh Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include 
@@ -58,20 +58,20 @@ static const _MonetaryLocale _DefaultMon
 	"",
 	"",
 	"",
-	(char)CHAR_MAX,
-	(char)CHAR_MAX,
-	(char)CHAR_MAX,
-	(char)CHAR_MAX,
-	(char)CHAR_MAX,
-	(char)CHAR_MAX,
-	(char)CHAR_MAX,
-	(char)CHAR_MAX,
-	(char)CHAR_MAX,
-	(char)CHAR_MAX,
-	(char)CHAR_MAX,
-	(char)CHAR_MAX,
-	(char)CHAR_MAX,
-	(char)CHAR_MAX
+	CHAR_MAX,
+	CHAR_MAX,
+	CHAR_MAX,
+	CHAR_MAX,
+	CHAR_MAX,
+	CHAR_MAX,
+	CHAR_MAX,
+	CHAR_MAX,
+	CHAR_MAX,
+	CHAR_MAX,
+	CHAR_MAX,
+	CHAR_MAX,
+	CHAR_MAX,
+	CHAR_MAX
 };
 
 static const _NumericLocale _DefaultNumericLocale = {



CVS commit: src/lib/libc

2024-06-07 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Jun  7 13:53:23 UTC 2024

Modified Files:
src/lib/libc/gen: isctype.c
src/lib/libc/locale: global_locale.c iswctype_mb.c multibyte.h
src/lib/libc/time: strftime.c strptime.c

Log Message:
libc/locale: Nix needless size_t casts.

No functional change intended.  No binary change to aarch64 libc.

Prompted by code inspection around PR lib/58319.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/lib/libc/gen/isctype.c
cvs rdiff -u -r1.27 -r1.28 src/lib/libc/locale/global_locale.c
cvs rdiff -u -r1.13 -r1.14 src/lib/libc/locale/iswctype_mb.c
cvs rdiff -u -r1.7 -r1.8 src/lib/libc/locale/multibyte.h
cvs rdiff -u -r1.55 -r1.56 src/lib/libc/time/strftime.c
cvs rdiff -u -r1.66 -r1.67 src/lib/libc/time/strptime.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/lib/libc/locale

2024-06-07 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Jun  7 13:53:02 UTC 2024

Modified Files:
src/lib/libc/locale: global_locale.c

Log Message:
libc/locale/global_locale.c: Nix confusing NBCHAR_MAX.

NBCHAR_MAX is used only in the usr.bin/mklocale build, but that
doesn't use global_locale.c.  This was added when inserting char
casts, but using the mklocale's hook just to insert a char cast is
unnecessarily confusing -- and the char casts are unnecessary anyway.

No functional change intended.  No binary change to aarch64 libc.

Raised in PR lib/58319.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/lib/libc/locale/global_locale.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/locale/global_locale.c
diff -u src/lib/libc/locale/global_locale.c:1.25 src/lib/libc/locale/global_locale.c:1.26
--- src/lib/libc/locale/global_locale.c:1.25	Fri Apr 29 16:26:48 2016
+++ src/lib/libc/locale/global_locale.c	Fri Jun  7 13:53:02 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: global_locale.c,v 1.25 2016/04/29 16:26:48 joerg Exp $ */
+/* $NetBSD: global_locale.c,v 1.26 2024/06/07 13:53:02 riastradh Exp $ */
 
 /*-
  * Copyright (c)2008 Citrus Project,
@@ -28,7 +28,7 @@
 
 #include 
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: global_locale.c,v 1.25 2016/04/29 16:26:48 joerg Exp $");
+__RCSID("$NetBSD: global_locale.c,v 1.26 2024/06/07 13:53:02 riastradh Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include 
@@ -43,10 +43,6 @@ __RCSID("$NetBSD: global_locale.c,v 1.25
 #include "runetype_local.h"
 #include "setlocale_local.h"
 
-#ifndef NBCHAR_MAX
-#define NBCHAR_MAX (char)CHAR_MAX
-#endif
-
 static const _MessagesLocale _DefaultMessagesLocale = {
 	"^[Yy]",
 	"^[Nn]",
@@ -124,20 +120,20 @@ __dso_hidden const struct _locale_cache_
 	.mon_grouping		= __UNCONST(""),
 	.positive_sign		= __UNCONST(""),
 	.negative_sign		= __UNCONST(""),
-	.int_frac_digits	= NBCHAR_MAX,
-	.frac_digits		= NBCHAR_MAX,
-	.p_cs_precedes		= NBCHAR_MAX,
-	.p_sep_by_space		= NBCHAR_MAX,
-	.n_cs_precedes		= NBCHAR_MAX,
-	.n_sep_by_space		= NBCHAR_MAX,
-	.p_sign_posn		= NBCHAR_MAX,
-	.n_sign_posn		= NBCHAR_MAX,
-	.int_p_cs_precedes	= NBCHAR_MAX,
-	.int_n_cs_precedes	= NBCHAR_MAX,
-	.int_p_sep_by_space	= NBCHAR_MAX,
-	.int_n_sep_by_space	= NBCHAR_MAX,
-	.int_p_sign_posn	= NBCHAR_MAX,
-	.int_n_sign_posn	= NBCHAR_MAX,
+	.int_frac_digits	= CHAR_MAX,
+	.frac_digits		= CHAR_MAX,
+	.p_cs_precedes		= CHAR_MAX,
+	.p_sep_by_space		= CHAR_MAX,
+	.n_cs_precedes		= CHAR_MAX,
+	.n_sep_by_space		= CHAR_MAX,
+	.p_sign_posn		= CHAR_MAX,
+	.n_sign_posn		= CHAR_MAX,
+	.int_p_cs_precedes	= CHAR_MAX,
+	.int_n_cs_precedes	= CHAR_MAX,
+	.int_p_sep_by_space	= CHAR_MAX,
+	.int_n_sep_by_space	= CHAR_MAX,
+	.int_p_sign_posn	= CHAR_MAX,
+	.int_n_sign_posn	= CHAR_MAX,
 },
 .monetary_name = _lc_C_locale_name,
 .numeric_name = _lc_C_locale_name,



CVS commit: src/lib/libc

2024-06-07 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Jun  7 13:53:12 UTC 2024

Modified Files:
src/lib/libc/citrus: citrus_fix_grouping.h
src/lib/libc/locale: fix_grouping.c global_locale.c

Log Message:
libc/locale: Nix needless char casts.

These appear to have been added to pacify a spurious warning by lint,
which no longer warns about it anyway.

No functional change intended.  No binary change to aarch64 libc.

Prompted by code inspection around PR lib/58319.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/lib/libc/citrus/citrus_fix_grouping.h
cvs rdiff -u -r1.6 -r1.7 src/lib/libc/locale/fix_grouping.c
cvs rdiff -u -r1.26 -r1.27 src/lib/libc/locale/global_locale.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/lib/libc/locale

2024-06-07 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Jun  7 13:53:02 UTC 2024

Modified Files:
src/lib/libc/locale: global_locale.c

Log Message:
libc/locale/global_locale.c: Nix confusing NBCHAR_MAX.

NBCHAR_MAX is used only in the usr.bin/mklocale build, but that
doesn't use global_locale.c.  This was added when inserting char
casts, but using the mklocale's hook just to insert a char cast is
unnecessarily confusing -- and the char casts are unnecessary anyway.

No functional change intended.  No binary change to aarch64 libc.

Raised in PR lib/58319.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/lib/libc/locale/global_locale.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/lib/libc/compat/sys

2024-06-01 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Jun  1 13:33:46 UTC 2024

Modified Files:
src/lib/libc/compat/sys: compat__lwp_park.c

Log Message:
Don't include both  and .


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/lib/libc/compat/sys/compat__lwp_park.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/compat/sys/compat__lwp_park.c
diff -u src/lib/libc/compat/sys/compat__lwp_park.c:1.2 src/lib/libc/compat/sys/compat__lwp_park.c:1.3
--- src/lib/libc/compat/sys/compat__lwp_park.c:1.2	Sun Jan 11 02:46:26 2009
+++ src/lib/libc/compat/sys/compat__lwp_park.c	Sat Jun  1 13:33:46 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: compat__lwp_park.c,v 1.2 2009/01/11 02:46:26 christos Exp $ */
+/*	$NetBSD: compat__lwp_park.c,v 1.3 2024/06/01 13:33:46 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -37,14 +37,13 @@
  */
 #include 
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: compat__lwp_park.c,v 1.2 2009/01/11 02:46:26 christos Exp $");
+__RCSID("$NetBSD: compat__lwp_park.c,v 1.3 2024/06/01 13:33:46 thorpej Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include "namespace.h"
 #define __LIBC12_SOURCE__
 #include 
 #include 
-#include 
 #include 
 
 __warn_references(_lwp_park,



CVS commit: src/lib/libc/compat/sys

2024-06-01 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Jun  1 13:33:46 UTC 2024

Modified Files:
src/lib/libc/compat/sys: compat__lwp_park.c

Log Message:
Don't include both  and .


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/lib/libc/compat/sys/compat__lwp_park.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/lib/libc/arch/riscv

2024-05-30 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Thu May 30 15:56:43 UTC 2024

Modified Files:
src/lib/libc/arch/riscv: genassym.cf
src/lib/libc/arch/riscv/sys: __sigtramp2.S

Log Message:
Annotate the RISC-V signal trampoline with CFI attributes.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/lib/libc/arch/riscv/genassym.cf
cvs rdiff -u -r1.4 -r1.5 src/lib/libc/arch/riscv/sys/__sigtramp2.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/lib/libc/arch/riscv/sys

2024-05-28 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue May 28 06:57:17 UTC 2024

Modified Files:
src/lib/libc/arch/riscv/sys: __sigtramp2.S

Log Message:
Change MIPS to RISC-V.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/lib/libc/arch/riscv/sys/__sigtramp2.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/arch/riscv/sys/__sigtramp2.S
diff -u src/lib/libc/arch/riscv/sys/__sigtramp2.S:1.3 src/lib/libc/arch/riscv/sys/__sigtramp2.S:1.4
--- src/lib/libc/arch/riscv/sys/__sigtramp2.S:1.3	Sun May  7 12:41:47 2023
+++ src/lib/libc/arch/riscv/sys/__sigtramp2.S	Tue May 28 06:57:17 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: __sigtramp2.S,v 1.3 2023/05/07 12:41:47 skrll Exp $	*/
+/*	$NetBSD: __sigtramp2.S,v 1.4 2024/05/28 06:57:17 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -33,12 +33,12 @@
 #include "assym.h"
 
 #if defined(SYSLIBC_SCCS) && !defined(lint)
-	RCSID("$NetBSD: __sigtramp2.S,v 1.3 2023/05/07 12:41:47 skrll Exp $")
+	RCSID("$NetBSD: __sigtramp2.S,v 1.4 2024/05/28 06:57:17 skrll Exp $")
 #endif /* SYSLIBC_SCCS and not lint */
 
 
 /*
- * The MIPS signal trampoline is invoked only to return from
+ * The RISC-V signal trampoline is invoked only to return from
  * the signal; the kernel calls the signal handler directly.
  *
  * On entry, stack looks like:



CVS commit: src/lib/libc/arch/riscv/sys

2024-05-28 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue May 28 06:57:17 UTC 2024

Modified Files:
src/lib/libc/arch/riscv/sys: __sigtramp2.S

Log Message:
Change MIPS to RISC-V.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/lib/libc/arch/riscv/sys/__sigtramp2.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/lib/libc/compat

2024-05-19 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon May 20 01:33:40 UTC 2024

Modified Files:
src/lib/libc/compat/include: unistd.h
src/lib/libc/compat/sys: compat_dup3.c

Log Message:
finish renaming __dup3110 to __dup3100


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/lib/libc/compat/include/unistd.h
cvs rdiff -u -r1.1 -r1.2 src/lib/libc/compat/sys/compat_dup3.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/compat/include/unistd.h
diff -u src/lib/libc/compat/include/unistd.h:1.4 src/lib/libc/compat/include/unistd.h:1.5
--- src/lib/libc/compat/include/unistd.h:1.4	Sun May 19 18:25:47 2024
+++ src/lib/libc/compat/include/unistd.h	Sun May 19 21:33:39 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: unistd.h,v 1.4 2024/05/19 22:25:47 christos Exp $	*/
+/*	$NetBSD: unistd.h,v 1.5 2024/05/20 01:33:39 christos Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@@ -68,7 +68,7 @@ __BEGIN_DECLS
 pid_t	vfork(void) __returns_twice;
 pid_t	__vfork14(void) __returns_twice;
 int	dup3(int, int, int);
-int	__dup3110(int, int, int);
+int	__dup3100(int, int, int);
 
 __END_DECLS
 

Index: src/lib/libc/compat/sys/compat_dup3.c
diff -u src/lib/libc/compat/sys/compat_dup3.c:1.1 src/lib/libc/compat/sys/compat_dup3.c:1.2
--- src/lib/libc/compat/sys/compat_dup3.c:1.1	Sun May 19 18:25:48 2024
+++ src/lib/libc/compat/sys/compat_dup3.c	Sun May 19 21:33:40 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: compat_dup3.c,v 1.1 2024/05/19 22:25:48 christos Exp $ */
+/*	$NetBSD: compat_dup3.c,v 1.2 2024/05/20 01:33:40 christos Exp $ */
 
 /*-
  * Copyright (c) 2024 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 #include 
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: compat_dup3.c,v 1.1 2024/05/19 22:25:48 christos Exp $");
+__RCSID("$NetBSD: compat_dup3.c,v 1.2 2024/05/20 01:33:40 christos Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include "namespace.h"
@@ -45,7 +45,7 @@ int
 dup3(int oldfd, int newfd, int flags)
 {
 	if (oldfd != newfd) {
-		return __dup3110(oldfd, newfd, flags);
+		return __dup3100(oldfd, newfd, flags);
 	}
 	if (flags & (O_NONBLOCK|O_NOSIGPIPE)) {
 		int e = fcntl(newfd, F_GETFL, 0);



CVS commit: src/lib/libc/compat

2024-05-19 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon May 20 01:33:40 UTC 2024

Modified Files:
src/lib/libc/compat/include: unistd.h
src/lib/libc/compat/sys: compat_dup3.c

Log Message:
finish renaming __dup3110 to __dup3100


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/lib/libc/compat/include/unistd.h
cvs rdiff -u -r1.1 -r1.2 src/lib/libc/compat/sys/compat_dup3.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/lib/libc/sys

2024-05-19 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun May 19 16:04:46 UTC 2024

Modified Files:
src/lib/libc/sys: dup.2

Log Message:
Amend for oldfd == newfd returning EINVAL in dup3


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/lib/libc/sys/dup.2

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/sys/dup.2
diff -u src/lib/libc/sys/dup.2:1.33 src/lib/libc/sys/dup.2:1.34
--- src/lib/libc/sys/dup.2:1.33	Mon Jul  3 17:32:50 2017
+++ src/lib/libc/sys/dup.2	Sun May 19 12:04:46 2024
@@ -1,4 +1,4 @@
-.\"	$NetBSD: dup.2,v 1.33 2017/07/03 21:32:50 wiz Exp $
+.\"	$NetBSD: dup.2,v 1.34 2024/05/19 16:04:46 christos Exp $
 .\"
 .\" Copyright (c) 1980, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\" @(#)dup.2	8.1 (Berkeley) 6/4/93
 .\"
-.Dd December 24, 2013
+.Dd May 19, 2024
 .Dt DUP 2
 .Os
 .Sh NAME
@@ -117,7 +117,14 @@ and can to some extent be adjusted with
 .Pp
 The
 .Fn dup3
-call includes an additional
+call fails and returns 
+.Er EINVAL
+if the numeric value in the
+.Ar oldfd 
+argument is equal to the one in the
+.Ar newfd
+argument.
+It also includes an additional
 .Fa flags
 argument supporting a subset of the
 .Xr open 2
@@ -207,11 +214,15 @@ and
 .Fa newfd
 is not in the range of valid file descriptors.
 .It Bq Er EINVAL
-.Fa flags
-contained an invalid value.
-Only
+In the
 .Fn dup3
-can generate this error.
+call either the
+.Fa flags
+argument contained an invalid value or the
+.Ar oldfd
+argument is equal to the
+.Ar newfd
+argument.
 .It Bq Er EMFILE
 Too many descriptors are active.
 Only



CVS commit: src/lib/libc/sys

2024-05-19 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun May 19 16:04:46 UTC 2024

Modified Files:
src/lib/libc/sys: dup.2

Log Message:
Amend for oldfd == newfd returning EINVAL in dup3


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/lib/libc/sys/dup.2

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/lib/libc/arch/riscv/gen

2024-05-15 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu May 16 01:02:35 UTC 2024

Modified Files:
src/lib/libc/arch/riscv/gen: fpgetsticky.c fpsetsticky.c

Log Message:
riscv: More shiftiness reduction around FCSR in libc.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/lib/libc/arch/riscv/gen/fpgetsticky.c \
src/lib/libc/arch/riscv/gen/fpsetsticky.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/lib/libc/arch/riscv/gen

2024-05-15 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu May 16 01:02:35 UTC 2024

Modified Files:
src/lib/libc/arch/riscv/gen: fpgetsticky.c fpsetsticky.c

Log Message:
riscv: More shiftiness reduction around FCSR in libc.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/lib/libc/arch/riscv/gen/fpgetsticky.c \
src/lib/libc/arch/riscv/gen/fpsetsticky.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/arch/riscv/gen/fpgetsticky.c
diff -u src/lib/libc/arch/riscv/gen/fpgetsticky.c:1.3 src/lib/libc/arch/riscv/gen/fpgetsticky.c:1.4
--- src/lib/libc/arch/riscv/gen/fpgetsticky.c:1.3	Sun May  7 12:41:47 2023
+++ src/lib/libc/arch/riscv/gen/fpgetsticky.c	Thu May 16 01:02:35 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpgetsticky.c,v 1.3 2023/05/07 12:41:47 skrll Exp $	*/
+/*	$NetBSD: fpgetsticky.c,v 1.4 2024/05/16 01:02:35 riastradh Exp $	*/
 
 /*
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: fpgetsticky.c,v 1.3 2023/05/07 12:41:47 skrll Exp $");
+__RCSID("$NetBSD: fpgetsticky.c,v 1.4 2024/05/16 01:02:35 riastradh Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include "namespace.h"
@@ -47,5 +47,5 @@ __weak_alias(fpgetsticky,_fpgetsticky)
 fp_except
 fpgetsticky(void)
 {
-	return __SHIFTOUT(fcsr_read(), FCSR_FFLAGS);
+	return fcsr_fflags_read();
 }
Index: src/lib/libc/arch/riscv/gen/fpsetsticky.c
diff -u src/lib/libc/arch/riscv/gen/fpsetsticky.c:1.3 src/lib/libc/arch/riscv/gen/fpsetsticky.c:1.4
--- src/lib/libc/arch/riscv/gen/fpsetsticky.c:1.3	Sun May  7 12:41:47 2023
+++ src/lib/libc/arch/riscv/gen/fpsetsticky.c	Thu May 16 01:02:35 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpsetsticky.c,v 1.3 2023/05/07 12:41:47 skrll Exp $	*/
+/*	$NetBSD: fpsetsticky.c,v 1.4 2024/05/16 01:02:35 riastradh Exp $	*/
 
 /*
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: fpsetsticky.c,v 1.3 2023/05/07 12:41:47 skrll Exp $");
+__RCSID("$NetBSD: fpsetsticky.c,v 1.4 2024/05/16 01:02:35 riastradh Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include "namespace.h"
@@ -48,5 +48,5 @@ __weak_alias(fpsetsticky,_fpsetsticky)
 fp_except
 fpsetsticky(fp_except mask)
 {
-	return __SHIFTOUT(fcsr_fflags_write(__SHIFTIN(mask, FCSR_FFLAGS)), FCSR_FFLAGS);
+	return fcsr_fflags_write(mask);
 }



CVS commit: src/lib/libc/arch/riscv/gen

2024-05-15 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu May 16 00:56:11 UTC 2024

Modified Files:
src/lib/libc/arch/riscv/gen: fpgetround.c fpsetround.c

Log Message:
riscv: Nix shifting around FRRM and FSRM in libc too.

These read and write the floating-point rounding mode directly, not
the whole floating-point control and status register.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/lib/libc/arch/riscv/gen/fpgetround.c \
src/lib/libc/arch/riscv/gen/fpsetround.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/arch/riscv/gen/fpgetround.c
diff -u src/lib/libc/arch/riscv/gen/fpgetround.c:1.3 src/lib/libc/arch/riscv/gen/fpgetround.c:1.4
--- src/lib/libc/arch/riscv/gen/fpgetround.c:1.3	Sun May  7 12:41:47 2023
+++ src/lib/libc/arch/riscv/gen/fpgetround.c	Thu May 16 00:56:11 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpgetround.c,v 1.3 2023/05/07 12:41:47 skrll Exp $	*/
+/*	$NetBSD: fpgetround.c,v 1.4 2024/05/16 00:56:11 riastradh Exp $	*/
 
 /*
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: fpgetround.c,v 1.3 2023/05/07 12:41:47 skrll Exp $");
+__RCSID("$NetBSD: fpgetround.c,v 1.4 2024/05/16 00:56:11 riastradh Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include "namespace.h"
@@ -47,5 +47,5 @@ __weak_alias(fpgetround,_fpgetround)
 fp_rnd
 fpgetround(void)
 {
-	return __SHIFTOUT(fcsr_read(), FCSR_FRM);
+	return fcsr_frm_read();
 }
Index: src/lib/libc/arch/riscv/gen/fpsetround.c
diff -u src/lib/libc/arch/riscv/gen/fpsetround.c:1.3 src/lib/libc/arch/riscv/gen/fpsetround.c:1.4
--- src/lib/libc/arch/riscv/gen/fpsetround.c:1.3	Sun May  7 12:41:47 2023
+++ src/lib/libc/arch/riscv/gen/fpsetround.c	Thu May 16 00:56:11 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpsetround.c,v 1.3 2023/05/07 12:41:47 skrll Exp $	*/
+/*	$NetBSD: fpsetround.c,v 1.4 2024/05/16 00:56:11 riastradh Exp $	*/
 
 /*
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: fpsetround.c,v 1.3 2023/05/07 12:41:47 skrll Exp $");
+__RCSID("$NetBSD: fpsetround.c,v 1.4 2024/05/16 00:56:11 riastradh Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include "namespace.h"
@@ -47,5 +47,5 @@ __weak_alias(fpsetround,_fpsetround)
 fp_rnd
 fpsetround(fp_rnd rnd_dir)
 {
-	return __SHIFTOUT(fcsr_frm_write(__SHIFTIN(rnd_dir, FCSR_FRM)), FCSR_FRM);
+	return fcsr_frm_write(rnd_dir);
 }



CVS commit: src/lib/libc/arch/riscv/gen

2024-05-15 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu May 16 00:56:11 UTC 2024

Modified Files:
src/lib/libc/arch/riscv/gen: fpgetround.c fpsetround.c

Log Message:
riscv: Nix shifting around FRRM and FSRM in libc too.

These read and write the floating-point rounding mode directly, not
the whole floating-point control and status register.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/lib/libc/arch/riscv/gen/fpgetround.c \
src/lib/libc/arch/riscv/gen/fpsetround.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/lib/libc/gen

2024-05-15 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed May 15 13:12:04 UTC 2024

Modified Files:
src/lib/libc/gen: usleep.3

Log Message:
usleep(3): Note the historical rake that was stepped upon.

PR 58184


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/lib/libc/gen/usleep.3

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/gen/usleep.3
diff -u src/lib/libc/gen/usleep.3:1.21 src/lib/libc/gen/usleep.3:1.22
--- src/lib/libc/gen/usleep.3:1.21	Mon Apr 22 21:25:29 2024
+++ src/lib/libc/gen/usleep.3	Wed May 15 13:12:04 2024
@@ -1,4 +1,4 @@
-.\"	$NetBSD: usleep.3,v 1.21 2024/04/22 21:25:29 jdolecek Exp $
+.\"	$NetBSD: usleep.3,v 1.22 2024/05/15 13:12:04 riastradh Exp $
 .\"
 .\" Copyright (c) 1986, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -99,3 +99,17 @@ The
 .Fn usleep
 function appeared in
 .Bx 4.3 .
+.Sh CAVEATS
+In
+.St -p1003.1-2004 ,
+.Nm
+was limited to values of
+.Fa microseconds
+less than one million.
+Some implementations, including
+.Nx
+before 10.1, fail immediately with
+.Er EINVAL
+\(em and don't sleep at all \(em if
+.Fa microseconds
+is one million or greater.



CVS commit: src/lib/libc/gen

2024-05-15 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed May 15 13:12:04 UTC 2024

Modified Files:
src/lib/libc/gen: usleep.3

Log Message:
usleep(3): Note the historical rake that was stepped upon.

PR 58184


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/lib/libc/gen/usleep.3

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/lib/libc/gdtoa

2024-05-13 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon May 13 21:17:24 UTC 2024

Modified Files:
src/lib/libc/gdtoa: Makefile.inc

Log Message:
libc/hdtoa: suppress lint warning about possible accuracy loss

on sparc64: hdtoa.c(340): warning: conversion from 'unsigned long'
to 'char' may lose accuracy [132]


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/lib/libc/gdtoa/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/lib/libc/gdtoa/Makefile.inc
diff -u src/lib/libc/gdtoa/Makefile.inc:1.13 src/lib/libc/gdtoa/Makefile.inc:1.14
--- src/lib/libc/gdtoa/Makefile.inc:1.13	Sat Oct  7 12:15:53 2023
+++ src/lib/libc/gdtoa/Makefile.inc	Mon May 13 21:17:24 2024
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.13 2023/10/07 12:15:53 rin Exp $
+#	$NetBSD: Makefile.inc,v 1.14 2024/05/13 21:17:24 rillig Exp $
 
 # gdtoa sources
 .PATH: ${.CURDIR}/gdtoa
@@ -44,3 +44,5 @@ SRCS+=	dmisc.c \
 .if ${MACHINE_ARCH} != "vax"
 SRCS+=	strtord.c
 .endif
+
+LINTFLAGS.hdtoa.c+=	-X 132	# conversion may lose accuracy



CVS commit: src/lib/libc/gdtoa

2024-05-13 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon May 13 21:17:24 UTC 2024

Modified Files:
src/lib/libc/gdtoa: Makefile.inc

Log Message:
libc/hdtoa: suppress lint warning about possible accuracy loss

on sparc64: hdtoa.c(340): warning: conversion from 'unsigned long'
to 'char' may lose accuracy [132]


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/lib/libc/gdtoa/Makefile.inc

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/lib/libc/inet

2024-05-12 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Sun May 12 23:58:18 UTC 2024

Modified Files:
src/lib/libc/inet: inet_net_pton.c

Log Message:
s/Firey/Fiery/ in comment.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/lib/libc/inet/inet_net_pton.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/inet/inet_net_pton.c
diff -u src/lib/libc/inet/inet_net_pton.c:1.6 src/lib/libc/inet/inet_net_pton.c:1.7
--- src/lib/libc/inet/inet_net_pton.c:1.6	Mon Feb  5 21:46:05 2024
+++ src/lib/libc/inet/inet_net_pton.c	Sun May 12 23:58:18 2024
@@ -20,7 +20,7 @@
 #if 0
 static const char rcsid[] = "Id: inet_net_pton.c,v 1.4.2.1 2002/08/02 02:17:21 marka Exp ";
 #else
-__RCSID("$NetBSD: inet_net_pton.c,v 1.6 2024/02/05 21:46:05 andvar Exp $");
+__RCSID("$NetBSD: inet_net_pton.c,v 1.7 2024/05/12 23:58:18 msaitoh Exp $");
 #endif
 #endif
 
@@ -150,7 +150,7 @@ inet_net_pton_ipv4(const char *src, u_ch
 			goto enoent;
 	}
 
-	/* Firey death and destruction unless we prefetched EOS. */
+	/* Fiery death and destruction unless we prefetched EOS. */
 	if (ch != '\0')
 		goto enoent;
 



CVS commit: src/lib/libc/inet

2024-05-12 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Sun May 12 23:58:18 UTC 2024

Modified Files:
src/lib/libc/inet: inet_net_pton.c

Log Message:
s/Firey/Fiery/ in comment.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/lib/libc/inet/inet_net_pton.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/lib/libc/gen

2024-05-12 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun May 12 10:58:58 UTC 2024

Modified Files:
src/lib/libc/gen: pwcache.c

Log Message:
libc/pwcache.c: remove stray semicolon from do-while-0 macro


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/lib/libc/gen/pwcache.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/lib/libc/gen

2024-05-12 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun May 12 10:58:58 UTC 2024

Modified Files:
src/lib/libc/gen: pwcache.c

Log Message:
libc/pwcache.c: remove stray semicolon from do-while-0 macro


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/lib/libc/gen/pwcache.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/gen/pwcache.c
diff -u src/lib/libc/gen/pwcache.c:1.34 src/lib/libc/gen/pwcache.c:1.35
--- src/lib/libc/gen/pwcache.c:1.34	Tue Apr 19 20:32:15 2022
+++ src/lib/libc/gen/pwcache.c	Sun May 12 10:58:58 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: pwcache.c,v 1.34 2022/04/19 20:32:15 rillig Exp $	*/
+/*	$NetBSD: pwcache.c,v 1.35 2024/05/12 10:58:58 rillig Exp $	*/
 
 /*-
  * Copyright (c) 1992 Keith Muller.
@@ -74,7 +74,7 @@
 #if 0
 static char sccsid[] = "@(#)cache.c	8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: pwcache.c,v 1.34 2022/04/19 20:32:15 rillig Exp $");
+__RCSID("$NetBSD: pwcache.c,v 1.35 2024/05/12 10:58:58 rillig Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -524,7 +524,7 @@ gid_from_group(const char *name, gid_t *
 			arr = NULL;			\
 		}	\
 		fail = 0;\
-	} while (0);
+	} while (0)
 
 int
 pwcache_userdb(



CVS commit: src/lib/libc/arch/riscv/gen

2024-05-11 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat May 11 07:40:18 UTC 2024

Modified Files:
src/lib/libc/arch/riscv/gen: fpsetmask.c

Log Message:
Do the '#if FCSR_FMASK == 0' thing that fpgetmask.c does for consistency.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/lib/libc/arch/riscv/gen/fpsetmask.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/lib/libc/arch/riscv/gen

2024-05-11 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat May 11 07:40:18 UTC 2024

Modified Files:
src/lib/libc/arch/riscv/gen: fpsetmask.c

Log Message:
Do the '#if FCSR_FMASK == 0' thing that fpgetmask.c does for consistency.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/lib/libc/arch/riscv/gen/fpsetmask.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/arch/riscv/gen/fpsetmask.c
diff -u src/lib/libc/arch/riscv/gen/fpsetmask.c:1.3 src/lib/libc/arch/riscv/gen/fpsetmask.c:1.4
--- src/lib/libc/arch/riscv/gen/fpsetmask.c:1.3	Sun May  7 12:41:47 2023
+++ src/lib/libc/arch/riscv/gen/fpsetmask.c	Sat May 11 07:40:18 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpsetmask.c,v 1.3 2023/05/07 12:41:47 skrll Exp $	*/
+/*	$NetBSD: fpsetmask.c,v 1.4 2024/05/11 07:40:18 skrll Exp $	*/
 
 /*
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: fpsetmask.c,v 1.3 2023/05/07 12:41:47 skrll Exp $");
+__RCSID("$NetBSD: fpsetmask.c,v 1.4 2024/05/11 07:40:18 skrll Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include "namespace.h"
@@ -47,9 +47,9 @@ __weak_alias(fpsetmask,_fpsetmask)
 fp_except
 fpsetmask(fp_except mask)
 {
-#if 0
-	return __SHIFTOUT(fcsr_fmask_write(__SHIFTIN(mask, FCSR_MASK)), FCSR_FMASK);
-#else
+#if FCSR_FMASK == 0
 	return 0;
+#else
+	return __SHIFTOUT(fcsr_fmask_write(__SHIFTIN(mask, FCSR_MASK)), FCSR_FMASK);
 #endif
 }



CVS commit: src/lib/libc/net

2024-05-09 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Thu May  9 21:28:00 UTC 2024

Modified Files:
src/lib/libc/net: getaddrinfo.3

Log Message:
Document that freeaddrinfo(NULL) dumps core.

A source code comment already said this, but it's easier to
find in a man page.


To generate a diff of this commit:
cvs rdiff -u -r1.60 -r1.61 src/lib/libc/net/getaddrinfo.3

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/lib/libc/arch/arm/gen

2024-05-06 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon May  6 06:57:32 UTC 2024

Modified Files:
src/lib/libc/arch/arm/gen: setjmp.S

Log Message:
arm longjmp: Restore stack first, then signal mask.

Otherwise, a pending signal may be delivered on the wrong stack when
we restore the signal mask.

While here:

- Move the botched sp and lr tests earlier.

PR lib/57946


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/lib/libc/arch/arm/gen/setjmp.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/arch/arm/gen/setjmp.S
diff -u src/lib/libc/arch/arm/gen/setjmp.S:1.18 src/lib/libc/arch/arm/gen/setjmp.S:1.19
--- src/lib/libc/arch/arm/gen/setjmp.S:1.18	Tue Dec 13 12:43:32 2022
+++ src/lib/libc/arch/arm/gen/setjmp.S	Mon May  6 06:57:32 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: setjmp.S,v 1.18 2022/12/13 12:43:32 skrll Exp $	*/
+/*	$NetBSD: setjmp.S,v 1.19 2024/05/06 06:57:32 skrll Exp $	*/
 
 /*
  * Copyright (c) 1997 Mark Brinicombe
@@ -142,6 +142,25 @@ ENTRY(__longjmp14)
 	cmp	r3, ip
 	bne	.Lbotch
 
+	/* Validate sp and lr */
+	ldr	r2, [r0, #(_JB_REG_R13 * 4)]
+#if defined(__thumb__) && defined(_ARM_ARCH_T2)
+	cbz	r2, .Lbotch
+#else
+	cmp	r2, #0
+	beq	.Lbotch
+#endif
+
+	ldr	r3, [r0, #(_JB_REG_R14 * 4)]
+#if defined(__thumb__) && defined(_ARM_ARCH_T2)
+	cbz	r3, .Lbotch
+#else
+	cmp	r3, #0
+	beq	.Lbotch
+#endif
+	mov	sp, r2
+	mov	lr, r3
+
 	/* Restore the signal mask. */
 	push	{r0-r2, lr}
 	movs	r2, #0
@@ -186,25 +205,6 @@ ENTRY(__longjmp14)
 	adds	r0, r0, #4	/* skip ip(r12) */
 #endif
 
-	ldmia	r0!, {r2-r3}
-
-	/* Validate sp and lr */
-#if defined(__thumb__) && defined(_ARM_ARCH_T2)
-	cbz	r2, .Lbotch
-#else
-	cmp	r2, #0
-	beq	.Lbotch
-#endif
-	mov	sp, r2
-
-#if defined(__thumb__) && defined(_ARM_ARCH_T2)
-	cbz	r3, .Lbotch
-#else
-	cmp	r3, #0
-	beq	.Lbotch
-#endif
-	mov	lr, r3
-
 	/* Set return value */
 	movs	r0, r1
 #if !defined(__thumb__)



CVS commit: src/lib/libc/arch/arm/gen

2024-05-06 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon May  6 06:57:32 UTC 2024

Modified Files:
src/lib/libc/arch/arm/gen: setjmp.S

Log Message:
arm longjmp: Restore stack first, then signal mask.

Otherwise, a pending signal may be delivered on the wrong stack when
we restore the signal mask.

While here:

- Move the botched sp and lr tests earlier.

PR lib/57946


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/lib/libc/arch/arm/gen/setjmp.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/lib/libc/arch/hppa/gen

2024-05-04 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat May  4 14:48:28 UTC 2024

Modified Files:
src/lib/libc/arch/hppa/gen: _setjmp.S

Log Message:
Remove magic numbers. NFCI.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/lib/libc/arch/hppa/gen/_setjmp.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/lib/libc/arch/riscv/gen

2024-05-04 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat May  4 12:43:36 UTC 2024

Modified Files:
src/lib/libc/arch/riscv/gen: makecontext.c

Log Message:
makecontext: correct the type to setup register based arguments.

Use __greg_t rather than int for register based arguments. This fixes
various atf tests.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/lib/libc/arch/riscv/gen/makecontext.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/lib/libc/arch/riscv/gen

2024-05-04 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat May  4 12:43:36 UTC 2024

Modified Files:
src/lib/libc/arch/riscv/gen: makecontext.c

Log Message:
makecontext: correct the type to setup register based arguments.

Use __greg_t rather than int for register based arguments. This fixes
various atf tests.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/lib/libc/arch/riscv/gen/makecontext.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/arch/riscv/gen/makecontext.c
diff -u src/lib/libc/arch/riscv/gen/makecontext.c:1.2 src/lib/libc/arch/riscv/gen/makecontext.c:1.3
--- src/lib/libc/arch/riscv/gen/makecontext.c:1.2	Sun May  7 12:41:47 2023
+++ src/lib/libc/arch/riscv/gen/makecontext.c	Sat May  4 12:43:36 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: makecontext.c,v 1.2 2023/05/07 12:41:47 skrll Exp $	*/
+/*	$NetBSD: makecontext.c,v 1.3 2024/05/04 12:43:36 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: makecontext.c,v 1.2 2023/05/07 12:41:47 skrll Exp $");
+__RCSID("$NetBSD: makecontext.c,v 1.3 2024/05/04 12:43:36 skrll Exp $");
 #endif
 
 #include 
@@ -75,7 +75,7 @@ makecontext(ucontext_t *ucp, void (*func
 	va_start(ap, argc);
 	/* Up to the first eight arguments are passed in a0(x10)-a7(x17) */
 	for (i = 0; i < argc && i < 8; i++)
-		gr[_REG_A0 + i] = va_arg(ap, int);
+		gr[_REG_A0 + i] = va_arg(ap, __greg_t);
 	/* Pass remaining arguments on the stack above the backchain/lr gap. */
 	for (sp += 0; i < argc; i++)
 		*sp++ = va_arg(ap, long);



CVS commit: src/lib/libc/stdio

2024-05-03 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat May  4 05:50:49 UTC 2024

Modified Files:
src/lib/libc/stdio: mktemp.3

Log Message:
mktemp.3: mkdtemp is no longer nonstandard

Reported by Aleksey Cheusov on tech-userlevel.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/lib/libc/stdio/mktemp.3

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/lib/libc/stdio

2024-05-03 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat May  4 05:50:49 UTC 2024

Modified Files:
src/lib/libc/stdio: mktemp.3

Log Message:
mktemp.3: mkdtemp is no longer nonstandard

Reported by Aleksey Cheusov on tech-userlevel.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/lib/libc/stdio/mktemp.3

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/stdio/mktemp.3
diff -u src/lib/libc/stdio/mktemp.3:1.32 src/lib/libc/stdio/mktemp.3:1.33
--- src/lib/libc/stdio/mktemp.3:1.32	Thu Oct 28 09:51:39 2021
+++ src/lib/libc/stdio/mktemp.3	Sat May  4 05:50:49 2024
@@ -1,4 +1,4 @@
-.\"	$NetBSD: mktemp.3,v 1.32 2021/10/28 09:51:39 kim Exp $
+.\"	$NetBSD: mktemp.3,v 1.33 2024/05/04 05:50:49 rillig Exp $
 .\"
 .\" Copyright (c) 1989, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\" @(#)mktemp.3	8.1 (Berkeley) 6/4/93
 .\"
-.Dd July 25, 2021
+.Dd May 4, 2024
 .Dt MKTEMP 3
 .Os
 .Sh NAME
@@ -304,13 +304,12 @@ It was however removed from the specific
 revision.
 The
 .Fn mkstemp
-and
+function conforms to
+.St -p1003.1-2004 .
+The
 .Fn mkdtemp
-functions conform to
-.St -p1003.1-2004
-and
-.St -p1003.1-2008 ,
-respectively.
+function conforms to
+.St -p1003.1-2008 .
 .Sh HISTORY
 A
 .Fn mktemp
@@ -372,10 +371,6 @@ For this reason,
 .Xr ld 1
 will output a warning message whenever it links code that uses
 .Fn mktemp .
-.Pp
-The
-.Fn mkdtemp
-function is nonstandard and should not be used if portability is required.
 .Sh SECURITY CONSIDERATIONS
 The use of
 .Fn mktemp



CVS commit: src/lib/libc/compiler_rt

2024-05-01 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed May  1 18:38:15 UTC 2024

Modified Files:
src/lib/libc/compiler_rt: Makefile.inc

Log Message:
fix clang lint build.


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/lib/libc/compiler_rt/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/lib/libc/compiler_rt/Makefile.inc
diff -u src/lib/libc/compiler_rt/Makefile.inc:1.47 src/lib/libc/compiler_rt/Makefile.inc:1.48
--- src/lib/libc/compiler_rt/Makefile.inc:1.47	Sun Mar 10 14:00:13 2024
+++ src/lib/libc/compiler_rt/Makefile.inc	Wed May  1 14:38:15 2024
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.inc,v 1.47 2024/03/10 18:00:13 rillig Exp $
+# $NetBSD: Makefile.inc,v 1.48 2024/05/01 18:38:15 christos Exp $
 
 COMPILER_RT_DIR=	${NETBSDSRCDIR}/sys/external/bsd/compiler_rt
 COMPILER_RT_SRCDIR=	${COMPILER_RT_DIR}/dist
@@ -380,6 +380,7 @@ LINTFLAGS.floatuntidf.c += -X 122,141,26
 LINTFLAGS.floatuntisf.c += -X 351
 LINTFLAGS.floatuntixf.c += -X 122,351
 LINTFLAGS.floatuntixf.c += -X 141 # alpha
+LINTFLAGS.gcc_personality_v0.c += -X 132,231
 LINTFLAGS.int_util.c += -X 231
 LINTFLAGS.lshrti3.c += -X 351
 LINTFLAGS.moddi3.c += -X 117 # vax



CVS commit: src/lib/libc/compiler_rt

2024-05-01 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed May  1 18:38:15 UTC 2024

Modified Files:
src/lib/libc/compiler_rt: Makefile.inc

Log Message:
fix clang lint build.


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/lib/libc/compiler_rt/Makefile.inc

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/lib/libc/sys

2024-04-28 Thread Valery Ushakov
Module Name:src
Committed By:   uwe
Date:   Sun Apr 28 23:10:26 UTC 2024

Modified Files:
src/lib/libc/sys: execve.2

Log Message:
execve(2): brush up markup


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/lib/libc/sys/execve.2

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/sys/execve.2
diff -u src/lib/libc/sys/execve.2:1.46 src/lib/libc/sys/execve.2:1.47
--- src/lib/libc/sys/execve.2:1.46	Sun Apr 28 22:21:21 2024
+++ src/lib/libc/sys/execve.2	Sun Apr 28 23:10:26 2024
@@ -1,4 +1,4 @@
-.\"	$NetBSD: execve.2,v 1.46 2024/04/28 22:21:21 rillig Exp $
+.\"	$NetBSD: execve.2,v 1.47 2024/04/28 23:10:26 uwe Exp $
 .\"
 .\" Copyright (c) 1980, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -75,35 +75,32 @@ and
 .Xr a.out 5 .
 .Pp
 An interpreter file begins with a line of the form:
-.Pp
-.Bd -ragged -offset indent -compact
-.Sy 

CVS commit: src/lib/libc/sys

2024-04-28 Thread Valery Ushakov
Module Name:src
Committed By:   uwe
Date:   Sun Apr 28 23:10:26 UTC 2024

Modified Files:
src/lib/libc/sys: execve.2

Log Message:
execve(2): brush up markup


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/lib/libc/sys/execve.2

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/lib/libc/gen

2024-04-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Apr 28 22:57:16 UTC 2024

Modified Files:
src/lib/libc/gen: time.3

Log Message:
time.3: clarify that *tloc is always set if tloc != NULL


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/lib/libc/gen/time.3

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/gen/time.3
diff -u src/lib/libc/gen/time.3:1.16 src/lib/libc/gen/time.3:1.17
--- src/lib/libc/gen/time.3:1.16	Sat Nov  5 18:17:29 2011
+++ src/lib/libc/gen/time.3	Sun Apr 28 22:57:16 2024
@@ -1,4 +1,4 @@
-.\"	$NetBSD: time.3,v 1.16 2011/11/05 18:17:29 christos Exp $
+.\"	$NetBSD: time.3,v 1.17 2024/04/28 22:57:16 rillig Exp $
 .\"
 .\" Copyright (c) 1989, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -33,7 +33,7 @@
 .\"
 .\" @(#)time.3	8.1 (Berkeley) 6/4/93
 .\"
-.Dd November 5, 2011
+.Dd April 29, 2024
 .Dt TIME 3
 .Os
 .Sh NAME
@@ -52,21 +52,17 @@ function
 returns the value of time in seconds since 0 hours, 0 minutes,
 0 seconds, January 1, 1970, Coordinated Universal Time.
 .Pp
-A copy of the time value may be saved to the area indicated by the
-pointer
-.Fa tloc .
 If
 .Fa tloc
-is a
-.Dv NULL
-pointer, no value is stored.
+is not a null pointer, a copy of the time value is saved in
+.Fa *tloc .
 .Pp
 Upon successful completion,
 .Fn time
 returns the value of time.
 Otherwise a value of
 .Po
-.Po Fa time_t Pc \-1
+.Po Fa time_t Pc Ns \-1
 .Pc
 is returned and the global variable
 .Va errno



CVS commit: src/lib/libc/gen

2024-04-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Apr 28 22:57:16 UTC 2024

Modified Files:
src/lib/libc/gen: time.3

Log Message:
time.3: clarify that *tloc is always set if tloc != NULL


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/lib/libc/gen/time.3

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/lib/libc/gen

2024-04-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Apr 28 22:43:30 UTC 2024

Modified Files:
src/lib/libc/gen: setmode.3

Log Message:
setmode.3: fix typos


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/lib/libc/gen/setmode.3

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/gen/setmode.3
diff -u src/lib/libc/gen/setmode.3:1.23 src/lib/libc/gen/setmode.3:1.24
--- src/lib/libc/gen/setmode.3:1.23	Sat Mar 12 17:31:39 2022
+++ src/lib/libc/gen/setmode.3	Sun Apr 28 22:43:30 2024
@@ -1,4 +1,4 @@
-.\"	$NetBSD: setmode.3,v 1.23 2022/03/12 17:31:39 christos Exp $
+.\"	$NetBSD: setmode.3,v 1.24 2024/04/28 22:43:30 rillig Exp $
 .\"
 .\" Copyright (c) 1989, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -51,16 +51,15 @@ function accepts a string representation
 compiles it to binary form, and returns an abstract representation
 that may be passed to
 .Fn getmode .
-The string may be an numeric (octal) or symbolic string of the form
+The string may be a numeric (octal) or symbolic string of the form
 accepted by
 .Xr chmod 1 ,
 and may represent either an exact mode to set or a change to make to
-the existing mode.
+an existing mode.
 .Pp
 The
 .Fn getmode
-function
-adjusts the file permission bits given by
+function adjusts the file permission bits given by
 .Fa mode
 according to the compiled change representation
 .Fa set ,
@@ -116,7 +115,7 @@ or
 .Xr strtol 3 .
 In addition,
 .Fn setmode
-will fail and set
+may fail and set
 .Va errno
 to:
 .Bl -tag -width Er



CVS commit: src/lib/libc/gen

2024-04-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Apr 28 22:43:30 UTC 2024

Modified Files:
src/lib/libc/gen: setmode.3

Log Message:
setmode.3: fix typos


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/lib/libc/gen/setmode.3

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/lib/libc/sys

2024-04-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Apr 28 22:21:21 UTC 2024

Modified Files:
src/lib/libc/sys: execve.2

Log Message:
execve.2: fix typo in markup


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/lib/libc/sys/execve.2

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/sys/execve.2
diff -u src/lib/libc/sys/execve.2:1.45 src/lib/libc/sys/execve.2:1.46
--- src/lib/libc/sys/execve.2:1.45	Wed Sep 18 04:57:53 2019
+++ src/lib/libc/sys/execve.2	Sun Apr 28 22:21:21 2024
@@ -1,4 +1,4 @@
-.\"	$NetBSD: execve.2,v 1.45 2019/09/18 04:57:53 wiz Exp $
+.\"	$NetBSD: execve.2,v 1.46 2024/04/28 22:21:21 rillig Exp $
 .\"
 .\" Copyright (c) 1980, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -83,7 +83,7 @@ An interpreter file begins with a line o
 .Ed
 .Pp
 When an interpreter file is
-.Sy execve Ar d ,
+.Sy execve Ap d ,
 the system actually
 .Sy execve Ap s
 the specified



CVS commit: src/lib/libc/sys

2024-04-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Apr 28 22:21:21 UTC 2024

Modified Files:
src/lib/libc/sys: execve.2

Log Message:
execve.2: fix typo in markup


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/lib/libc/sys/execve.2

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/lib/libc/gen

2024-04-22 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Mon Apr 22 21:25:29 UTC 2024

Modified Files:
src/lib/libc/gen: usleep.3

Log Message:
it's nanosleep(2), not nanosleep(3)


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/lib/libc/gen/usleep.3

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/lib/libc/gen

2024-04-22 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Mon Apr 22 21:25:29 UTC 2024

Modified Files:
src/lib/libc/gen: usleep.3

Log Message:
it's nanosleep(2), not nanosleep(3)


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/lib/libc/gen/usleep.3

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/gen/usleep.3
diff -u src/lib/libc/gen/usleep.3:1.20 src/lib/libc/gen/usleep.3:1.21
--- src/lib/libc/gen/usleep.3:1.20	Mon Apr 22 21:02:18 2024
+++ src/lib/libc/gen/usleep.3	Mon Apr 22 21:25:29 2024
@@ -1,4 +1,4 @@
-.\"	$NetBSD: usleep.3,v 1.20 2024/04/22 21:02:18 jdolecek Exp $
+.\"	$NetBSD: usleep.3,v 1.21 2024/04/22 21:25:29 jdolecek Exp $
 .\"
 .\" Copyright (c) 1986, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -44,7 +44,7 @@
 .Sh DESCRIPTION
 .Bf -symbolic
 This interface is obsoleted by
-.Xr nanosleep 3 .
+.Xr nanosleep 2 .
 .Ef
 .Pp
 The



CVS commit: src/lib/libc/gen

2024-04-22 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Mon Apr 22 21:02:18 UTC 2024

Modified Files:
src/lib/libc/gen: usleep.3 usleep.c

Log Message:
allow usleep(3) with useconds >= 100

update manpage to mention this interface is obsolete, remove
EINVAL from the ERRORS and mention EINTR instead.

PR lib/58184 by Taylor R Campbell


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/lib/libc/gen/usleep.3
cvs rdiff -u -r1.20 -r1.21 src/lib/libc/gen/usleep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/lib/libc/gen

2024-04-22 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Mon Apr 22 21:02:18 UTC 2024

Modified Files:
src/lib/libc/gen: usleep.3 usleep.c

Log Message:
allow usleep(3) with useconds >= 100

update manpage to mention this interface is obsolete, remove
EINVAL from the ERRORS and mention EINTR instead.

PR lib/58184 by Taylor R Campbell


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/lib/libc/gen/usleep.3
cvs rdiff -u -r1.20 -r1.21 src/lib/libc/gen/usleep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/gen/usleep.3
diff -u src/lib/libc/gen/usleep.3:1.19 src/lib/libc/gen/usleep.3:1.20
--- src/lib/libc/gen/usleep.3:1.19	Thu Apr 29 17:29:56 2010
+++ src/lib/libc/gen/usleep.3	Mon Apr 22 21:02:18 2024
@@ -1,4 +1,4 @@
-.\"	$NetBSD: usleep.3,v 1.19 2010/04/29 17:29:56 jruoho Exp $
+.\"	$NetBSD: usleep.3,v 1.20 2024/04/22 21:02:18 jdolecek Exp $
 .\"
 .\" Copyright (c) 1986, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\" @(#)usleep.3	8.1 (Berkeley) 6/4/93
 .\"
-.Dd April 29, 2010
+.Dd April 22, 2024
 .Dt USLEEP 3
 .Os
 .Sh NAME
@@ -42,6 +42,11 @@
 .Ft int
 .Fn usleep "useconds_t microseconds"
 .Sh DESCRIPTION
+.Bf -symbolic
+This interface is obsoleted by
+.Xr nanosleep 3 .
+.Ef
+.Pp
 The
 .Fn usleep
 function
@@ -53,13 +58,6 @@ action is to invoke a signal catching fu
 process.
 The suspension time may be longer than requested due to the
 scheduling of other activity by the system.
-.Pp
-The
-.Fa microseconds
-argument must be less than 1,000,000.
-If the value of
-.Fa microseconds
-is 0, then the call has no effect.
 .Sh RETURN VALUES
 On successful completion,
 .Fn usleep
@@ -72,10 +70,9 @@ The
 .Fn usleep
 function may fail if:
 .Bl -tag -width Er
-.It Bq Er EINVAL
-The
-.Fa microseconds
-interval specified 1,000,000 or more microseconds.
+.It Bq Er EINTR
+.Nm
+was interrupted by the delivery of a signal.
 .El
 .Sh SEE ALSO
 .Xr nanosleep 2 ,

Index: src/lib/libc/gen/usleep.c
diff -u src/lib/libc/gen/usleep.c:1.20 src/lib/libc/gen/usleep.c:1.21
--- src/lib/libc/gen/usleep.c:1.20	Mon Jun 25 22:32:44 2012
+++ src/lib/libc/gen/usleep.c	Mon Apr 22 21:02:18 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: usleep.c,v 1.20 2012/06/25 22:32:44 abs Exp $	*/
+/*	$NetBSD: usleep.c,v 1.21 2024/04/22 21:02:18 jdolecek Exp $	*/
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: usleep.c,v 1.20 2012/06/25 22:32:44 abs Exp $");
+__RCSID("$NetBSD: usleep.c,v 1.21 2024/04/22 21:02:18 jdolecek Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include "namespace.h"
@@ -51,13 +51,8 @@ usleep(useconds_t useconds)
 	if (useconds == 0)
 		return (0);
 
-	if (useconds >= 100) {
-		errno = EINVAL;
-		return (-1);
-	}
-
-	ts.tv_sec  = 0;
-	ts.tv_nsec = useconds * 1000;
+	ts.tv_sec  = (useconds / 100);
+	ts.tv_nsec = (useconds % 100) * 1000;
 
 	nanosleep(, NULL);
 



CVS commit: src/lib/libc/arch/hppa

2024-04-20 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Apr 20 14:09:40 UTC 2024

Modified Files:
src/lib/libc/arch/hppa: genassym.cf
src/lib/libc/arch/hppa/gen: __setjmp14.S

Log Message:
Remove some magic numbers by using genassym.cf


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/lib/libc/arch/hppa/genassym.cf
cvs rdiff -u -r1.9 -r1.10 src/lib/libc/arch/hppa/gen/__setjmp14.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/arch/hppa/genassym.cf
diff -u src/lib/libc/arch/hppa/genassym.cf:1.4 src/lib/libc/arch/hppa/genassym.cf:1.5
--- src/lib/libc/arch/hppa/genassym.cf:1.4	Sun Jun 26 14:37:12 2022
+++ src/lib/libc/arch/hppa/genassym.cf	Sat Apr 20 14:09:40 2024
@@ -1,4 +1,4 @@
-#	$NetBSD: genassym.cf,v 1.4 2022/06/26 14:37:12 skrll Exp $
+#	$NetBSD: genassym.cf,v 1.5 2024/04/20 14:09:40 skrll Exp $
 
 #
 # Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -104,3 +104,16 @@ define _UC_GREGS_R28	offsetof(ucontext_t
 define _UC_GREGS_R29	offsetof(ucontext_t, uc_mcontext.__gregs[29])
 define _UC_GREGS_R30	offsetof(ucontext_t, uc_mcontext.__gregs[30])
 define _UC_GREGS_R31	offsetof(ucontext_t, uc_mcontext.__gregs[31])
+
+define SIZEOF_SIGCONTEXT	sizeof(struct sigcontext)
+define _SC_ONSTACK	offsetof(struct sigcontext, sc_onstack)
+define _SC_MASK13	offsetof(struct sigcontext, __sc_mask13)
+define _SC_REGS_SP	offsetof(struct sigcontext, sc_sp)
+define _SC_REGS_FP	offsetof(struct sigcontext, sc_fp)
+define _SC_REGS_AP	offsetof(struct sigcontext, sc_ap)
+define _SC_REGS_PCSQH	offsetof(struct sigcontext, sc_pcsqh)
+define _SC_REGS_PCOQH	offsetof(struct sigcontext, sc_pcoqh)
+define _SC_REGS_PCSQT	offsetof(struct sigcontext, sc_pcsqt)
+define _SC_REGS_PCOQT	offsetof(struct sigcontext, sc_pcoqt)
+define _SC_REGS_PS	offsetof(struct sigcontext, sc_ps)
+define _SC_MASK		offsetof(struct sigcontext, sc_mask)

Index: src/lib/libc/arch/hppa/gen/__setjmp14.S
diff -u src/lib/libc/arch/hppa/gen/__setjmp14.S:1.9 src/lib/libc/arch/hppa/gen/__setjmp14.S:1.10
--- src/lib/libc/arch/hppa/gen/__setjmp14.S:1.9	Tue May  5 06:20:55 2020
+++ src/lib/libc/arch/hppa/gen/__setjmp14.S	Sat Apr 20 14:09:40 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: __setjmp14.S,v 1.9 2020/05/05 06:20:55 skrll Exp $	*/
+/*	$NetBSD: __setjmp14.S,v 1.10 2024/04/20 14:09:40 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -29,12 +29,14 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
+#include "assym.h"
+
 #include 
 #include 
 #include 
 
 #if defined(LIBC_SCCS) && !defined(lint)
-	RCSID("$NetBSD: __setjmp14.S,v 1.9 2020/05/05 06:20:55 skrll Exp $")
+	RCSID("$NetBSD: __setjmp14.S,v 1.10 2024/04/20 14:09:40 skrll Exp $")
 #endif /* LIBC_SCCS and not lint */
 
 /*
@@ -54,21 +56,21 @@ ENTRY(__setjmp14,0)
 	stw	%arg0, HPPA_FRAME_ARG(0)(%sp)
 
 	/* A sigcontext is at the beginning of our jmp_buf. */
-	stw	%r0, 4(%arg0)		; unused word (old style signal mask)
-	stw	%sp, 8(%arg0)		; sc.sc_sp = %sp
-	stw	%r0, 16(%arg0)		; sc.sc_ap = NULL
+	stw	%r0, _SC_MASK13(%arg0)		; unused word (old style signal mask)
+	stw	%sp, _SC_REGS_SP(%arg0)		; sc.sc_sp = %sp
+	stw	%r0, _SC_REGS_AP(%arg0)		; sc.sc_ap = NULL
 	mfsp	%sr0, %r1
-	stw	%r1, 20(%arg0)		; sc.sc_pcsqh = %sr0
-	stw	%rp, 24(%arg0)		; sc.sc_pcoqh = %rp
-	stw	%r1, 28(%arg0)		; sc.sc_pcsqh = %sr0
+	stw	%r1, _SC_REGS_PCSQH(%arg0)	; sc.sc_pcsqh = %sr0
+	stw	%rp, _SC_REGS_PCOQH(%arg0)	; sc.sc_pcoqh = %rp
+	stw	%r1, _SC_REGS_PCSQT(%arg0)	; sc.sc_pcsqt = %sr0
 	ldo	4(%rp), %r1
-	stw	%r1, 32(%arg0)		; sc.sc_pcoqt = %rp + 4
+	stw	%r1, _SC_REGS_PCOQT(%arg0)	; sc.sc_pcoqt = %rp + 4
 	ldil	L%PSW_MBS, %r1
 	ldo	R%PSW_MBS(%r1), %r1
-	stw	%r1, 36(%arg0)		; set sc.sc_ps
+	stw	%r1, _SC_REGS_PS(%arg0)		; set sc.sc_ps
 
 	/* We store all callee-saved registers after the sigcontext. */
-	ldo	56(%arg0), %r1
+	ldo	SIZEOF_SIGCONTEXT(%arg0), %r1
 	stwm	%r3, 4(%r1)
 	stwm	%r4, 4(%r1)
 	stwm	%r5, 4(%r1)
@@ -111,7 +113,7 @@ ENTRY(__setjmp14,0)
 	stw	%r1, 0(%arg0)		; sc.sc_onstack
 
 	/* Get the signal mask. */
-	ldo	40(%arg0), %arg2	; oset = _mask
+	ldo	_SC_MASK(%arg0), %arg2	; oset = _mask
 	copy	%r0, %arg1		; set = NULL
 	bl	__sigprocmask14, %rp
 	 copy	%r0, %arg0		; action = 0 



CVS commit: src/lib/libc/arch/hppa

2024-04-20 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Apr 20 14:09:40 UTC 2024

Modified Files:
src/lib/libc/arch/hppa: genassym.cf
src/lib/libc/arch/hppa/gen: __setjmp14.S

Log Message:
Remove some magic numbers by using genassym.cf


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/lib/libc/arch/hppa/genassym.cf
cvs rdiff -u -r1.9 -r1.10 src/lib/libc/arch/hppa/gen/__setjmp14.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/lib/libc/rpc

2024-04-11 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Apr 11 18:41:03 UTC 2024

Modified Files:
src/lib/libc/rpc: xdr_float.c

Log Message:
avoid lint warning on the vax


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/lib/libc/rpc/xdr_float.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/rpc/xdr_float.c
diff -u src/lib/libc/rpc/xdr_float.c:1.41 src/lib/libc/rpc/xdr_float.c:1.42
--- src/lib/libc/rpc/xdr_float.c:1.41	Mon Feb 15 06:07:48 2016
+++ src/lib/libc/rpc/xdr_float.c	Thu Apr 11 14:41:03 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: xdr_float.c,v 1.41 2016/02/15 11:07:48 martin Exp $	*/
+/*	$NetBSD: xdr_float.c,v 1.42 2024/04/11 18:41:03 christos Exp $	*/
 
 /*
  * Copyright (c) 2010, Oracle America, Inc.
@@ -37,7 +37,7 @@
 static char *sccsid = "@(#)xdr_float.c 1.12 87/08/11 Copyr 1984 Sun Micro";
 static char *sccsid = "@(#)xdr_float.c	2.1 88/07/29 4.0 RPCSRC";
 #else
-__RCSID("$NetBSD: xdr_float.c,v 1.41 2016/02/15 11:07:48 martin Exp $");
+__RCSID("$NetBSD: xdr_float.c,v 1.42 2024/04/11 18:41:03 christos Exp $");
 #endif
 #endif
 
@@ -254,6 +254,7 @@ xdr_double(XDR *xdrs, double *dp)
 goto shipit;
 			}
 		}
+		/*LINTED: possible overflow*/
 		id.exp = vd.exp - VAX_DBL_BIAS + IEEE_DBL_BIAS;
 		id.mantissa1 = (vd.mantissa1 << 13) |
 			((unsigned int)vd.mantissa2 >> 3);
@@ -296,6 +297,7 @@ xdr_double(XDR *xdrs, double *dp)
 goto doneit;
 			}
 		}
+		/*LINTED: can overflow */
 		vd.exp = id.exp - IEEE_DBL_BIAS + VAX_DBL_BIAS;
 		vd.mantissa1 = ((unsigned int)id.mantissa1 >> 13);
 		vd.mantissa2 = ((id.mantissa1 & MASK(13)) << 3) |



CVS commit: src/lib/libc/rpc

2024-04-11 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Apr 11 18:41:03 UTC 2024

Modified Files:
src/lib/libc/rpc: xdr_float.c

Log Message:
avoid lint warning on the vax


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/lib/libc/rpc/xdr_float.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/lib/libc/arch/sparc/gen

2024-04-02 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Apr  2 20:42:13 UTC 2024

Modified Files:
src/lib/libc/arch/sparc/gen: fpsetround.c

Log Message:
sparc/fpsetround: fix the nearby signed integer overflow as well

Same as for sparc64 a few days ago.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/lib/libc/arch/sparc/gen/fpsetround.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/lib/libc/arch/sparc/gen

2024-04-02 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Apr  2 20:42:13 UTC 2024

Modified Files:
src/lib/libc/arch/sparc/gen: fpsetround.c

Log Message:
sparc/fpsetround: fix the nearby signed integer overflow as well

Same as for sparc64 a few days ago.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/lib/libc/arch/sparc/gen/fpsetround.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/arch/sparc/gen/fpsetround.c
diff -u src/lib/libc/arch/sparc/gen/fpsetround.c:1.7 src/lib/libc/arch/sparc/gen/fpsetround.c:1.8
--- src/lib/libc/arch/sparc/gen/fpsetround.c:1.7	Tue Apr  2 20:27:44 2024
+++ src/lib/libc/arch/sparc/gen/fpsetround.c	Tue Apr  2 20:42:12 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpsetround.c,v 1.7 2024/04/02 20:27:44 christos Exp $	*/
+/*	$NetBSD: fpsetround.c,v 1.8 2024/04/02 20:42:12 rillig Exp $	*/
 
 /*
  * Written by J.T. Conklin, Apr 10, 1995
@@ -7,7 +7,7 @@
 
 #include 
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: fpsetround.c,v 1.7 2024/04/02 20:27:44 christos Exp $");
+__RCSID("$NetBSD: fpsetround.c,v 1.8 2024/04/02 20:42:12 rillig Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include "namespace.h"
@@ -27,8 +27,8 @@ fpsetround(fp_rnd rnd_dir)
 	__asm("st %%fsr,%0" : "=m" (*));
 
 	new = old;
-	new &= ~(0x03U << 30); 
-	new |= ((rnd_dir & 0x03) << 30);
+	new &= ~(0x03U << 30);
+	new |= ((rnd_dir & 0x03U) << 30);
 
 	__asm("ld %0,%%fsr" : : "m" (*));
 



CVS commit: src/lib/libc/arch/sparc/gen

2024-04-02 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Apr  2 20:27:44 UTC 2024

Modified Files:
src/lib/libc/arch/sparc/gen: fpsetround.c

Log Message:
fix lint


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/lib/libc/arch/sparc/gen/fpsetround.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/lib/libc/arch/sparc/gen

2024-04-02 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Apr  2 20:27:44 UTC 2024

Modified Files:
src/lib/libc/arch/sparc/gen: fpsetround.c

Log Message:
fix lint


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/lib/libc/arch/sparc/gen/fpsetround.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/arch/sparc/gen/fpsetround.c
diff -u src/lib/libc/arch/sparc/gen/fpsetround.c:1.6 src/lib/libc/arch/sparc/gen/fpsetround.c:1.7
--- src/lib/libc/arch/sparc/gen/fpsetround.c:1.6	Tue Mar 20 20:38:35 2012
+++ src/lib/libc/arch/sparc/gen/fpsetround.c	Tue Apr  2 16:27:44 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpsetround.c,v 1.6 2012/03/21 00:38:35 christos Exp $	*/
+/*	$NetBSD: fpsetround.c,v 1.7 2024/04/02 20:27:44 christos Exp $	*/
 
 /*
  * Written by J.T. Conklin, Apr 10, 1995
@@ -7,7 +7,7 @@
 
 #include 
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: fpsetround.c,v 1.6 2012/03/21 00:38:35 christos Exp $");
+__RCSID("$NetBSD: fpsetround.c,v 1.7 2024/04/02 20:27:44 christos Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include "namespace.h"
@@ -27,7 +27,7 @@ fpsetround(fp_rnd rnd_dir)
 	__asm("st %%fsr,%0" : "=m" (*));
 
 	new = old;
-	new &= ~(0x03 << 30); 
+	new &= ~(0x03U << 30); 
 	new |= ((rnd_dir & 0x03) << 30);
 
 	__asm("ld %0,%%fsr" : : "m" (*));



CVS commit: src/lib/libc/stdio

2024-03-29 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Mar 29 22:39:41 UTC 2024

Modified Files:
src/lib/libc/stdio: fvwrite.c

Log Message:
>From enh at google dot com in tech-userlevel. Don't limit writes to BUFSIZ,
change the limit to INT_MAX; improves performance dramatically. From:
https://github.com/apple-oss-distributions/Libc/commit/\
c5a3293354e22262702a3add5b2dfc9bb0b93b85\
#diff-3b844a19cfb0aab1a23f7fbc457d3bce7453513730c489a72f66ff89d6557ff3


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/lib/libc/stdio/fvwrite.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/lib/libc/stdio

2024-03-29 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Mar 29 22:39:41 UTC 2024

Modified Files:
src/lib/libc/stdio: fvwrite.c

Log Message:
>From enh at google dot com in tech-userlevel. Don't limit writes to BUFSIZ,
change the limit to INT_MAX; improves performance dramatically. From:
https://github.com/apple-oss-distributions/Libc/commit/\
c5a3293354e22262702a3add5b2dfc9bb0b93b85\
#diff-3b844a19cfb0aab1a23f7fbc457d3bce7453513730c489a72f66ff89d6557ff3


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/lib/libc/stdio/fvwrite.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/stdio/fvwrite.c
diff -u src/lib/libc/stdio/fvwrite.c:1.30 src/lib/libc/stdio/fvwrite.c:1.31
--- src/lib/libc/stdio/fvwrite.c:1.30	Thu Jul 22 13:08:15 2021
+++ src/lib/libc/stdio/fvwrite.c	Fri Mar 29 18:39:41 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: fvwrite.c,v 1.30 2021/07/22 17:08:15 christos Exp $	*/
+/*	$NetBSD: fvwrite.c,v 1.31 2024/03/29 22:39:41 christos Exp $	*/
 
 /*-
  * Copyright (c) 1990, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)fvwrite.c	8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: fvwrite.c,v 1.30 2021/07/22 17:08:15 christos Exp $");
+__RCSID("$NetBSD: fvwrite.c,v 1.31 2024/03/29 22:39:41 christos Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -99,11 +99,12 @@ __sfvwrite(FILE *fp, struct __suio *uio)
 	}
 	if (fp->_flags & __SNBF) {
 		/*
-		 * Unbuffered: write up to BUFSIZ bytes at a time.
+		 * Unbuffered: write up to INT_MAX bytes at a time, to not
+		 * truncate the value of len if it is greater than 2^31 bytes.
 		 */
 		do {
 			GETIOV(;);
-			w = (*fp->_write)(fp->_cookie, p, MIN(len, BUFSIZ));
+			w = (*fp->_write)(fp->_cookie, p, MIN(len, INT_MAX));
 			if (w <= 0)
 goto err;
 			p += w;
@@ -113,7 +114,8 @@ __sfvwrite(FILE *fp, struct __suio *uio)
 		/*
 		 * Fully buffered: fill partially full buffer, if any,
 		 * and then flush.  If there is no partial buffer, write
-		 * one _bf._size byte chunk directly (without copying).
+		 * entire payload directly (without copying) up to a multiple
+		 * of the buffer size.
 		 *
 		 * String output is a special case: write as many bytes
 		 * as fit, but pretend we wrote everything.  This makes
@@ -159,7 +161,15 @@ __sfvwrite(FILE *fp, struct __suio *uio)
 if (fflush(fp))
 	goto err;
 			} else if (len >= (size_t)(w = fp->_bf._size)) {
-/* write directly */
+/*
+ * write directly up to INT_MAX or greatest
+ * multiple of buffer size (whatever is
+ * smaller), keeping in the memory buffer the
+ * remaining part of payload that is smaller
+ * than buffer size.
+ */
+if (w != 0)
+	w = MIN(w * (len / w), INT_MAX);
 w = (*fp->_write)(fp->_cookie, p, (size_t)w);
 if (w <= 0)
 	goto err;



CVS commit: src/lib/libc/rpc

2024-03-22 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Fri Mar 22 19:45:22 UTC 2024

Modified Files:
src/lib/libc/rpc: xdr_rec.c

Log Message:
Fix few typos in comments.


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/lib/libc/rpc/xdr_rec.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/rpc/xdr_rec.c
diff -u src/lib/libc/rpc/xdr_rec.c:1.40 src/lib/libc/rpc/xdr_rec.c:1.41
--- src/lib/libc/rpc/xdr_rec.c:1.40	Tue Jan 23 17:24:38 2024
+++ src/lib/libc/rpc/xdr_rec.c	Fri Mar 22 19:45:22 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: xdr_rec.c,v 1.40 2024/01/23 17:24:38 christos Exp $	*/
+/*	$NetBSD: xdr_rec.c,v 1.41 2024/03/22 19:45:22 andvar Exp $	*/
 
 /*
  * Copyright (c) 2010, Oracle America, Inc.
@@ -37,7 +37,7 @@
 static char *sccsid = "@(#)xdr_rec.c 1.21 87/08/11 Copyr 1984 Sun Micro";
 static char *sccsid = "@(#)xdr_rec.c	2.2 88/08/01 4.0 RPCSRC";
 #else
-__RCSID("$NetBSD: xdr_rec.c,v 1.40 2024/01/23 17:24:38 christos Exp $");
+__RCSID("$NetBSD: xdr_rec.c,v 1.41 2024/03/22 19:45:22 andvar Exp $");
 #endif
 #endif
 
@@ -242,7 +242,7 @@ xdrrec_create(
 
 
 /*
- * The reoutines defined below are the xdr ops which will go into the
+ * The routines defined below are the xdr ops which will go into the
  * xdr handle filled in by xdrrec_create.
  */
 
@@ -503,9 +503,9 @@ xdrrec_eof(XDR *xdrs)
 
 /*
  * The client must tell the package when an end-of-record has occurred.
- * The second paraemters tells whether the record should be flushed to the
+ * The second parameters tells whether the record should be flushed to the
  * (output) tcp stream.  (This let's the package support batched or
- * pipelined procedure calls.)  TRUE => immmediate flush to tcp connection.
+ * pipelined procedure calls.)  TRUE => immediate flush to tcp connection.
  */
 bool_t
 xdrrec_endofrecord(XDR *xdrs, int sendnow)



CVS commit: src/lib/libc/rpc

2024-03-22 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Fri Mar 22 19:45:22 UTC 2024

Modified Files:
src/lib/libc/rpc: xdr_rec.c

Log Message:
Fix few typos in comments.


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/lib/libc/rpc/xdr_rec.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/lib/libc/gen

2024-03-21 Thread Valery Ushakov
Module Name:src
Committed By:   uwe
Date:   Thu Mar 21 22:27:55 UTC 2024

Modified Files:
src/lib/libc/gen: sysconf.3

Log Message:
sysconf(3): a few more markup fixes


To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 src/lib/libc/gen/sysconf.3

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/gen/sysconf.3
diff -u src/lib/libc/gen/sysconf.3:1.56 src/lib/libc/gen/sysconf.3:1.57
--- src/lib/libc/gen/sysconf.3:1.56	Thu Mar 21 22:21:40 2024
+++ src/lib/libc/gen/sysconf.3	Thu Mar 21 22:27:55 2024
@@ -1,4 +1,4 @@
-.\"	$NetBSD: sysconf.3,v 1.56 2024/03/21 22:21:40 uwe Exp $
+.\"	$NetBSD: sysconf.3,v 1.57 2024/03/21 22:27:55 uwe Exp $
 .\"
 .\" Copyright (c) 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -90,7 +90,7 @@ The maximum size of a hostname, includin
 .Tn NUL .
 .It Dv _SC_IOV_MAX
 The maximum number of
-.Va iovec
+.Vt iovec
 structures that a process has available for use with
 .Xr preadv 2 ,
 .Xr pwritev 2 ,
@@ -189,11 +189,13 @@ Timers
 option to which the system attempts to conform,
 otherwise \-1.
 .It Dv _SC_CPUTIME
-The clockID CLOCK_PROCESS_CPUTIME_ID is supported,
-otherwise \-1.
+The clockID
+.Dv CLOCK_PROCESS_CPUTIME_ID
+is supported, otherwise \-1.
 .It Dv _SC_THREAD_CPUTIME
-The clockID CLOCK_THREAD_CPUTIME_ID is supported,
-otherwise \-1.
+The clockID
+.Dv CLOCK_THREAD_CPUTIME_ID
+is supported, otherwise \-1.
 .It Dv _SC_DELAYTIMER_MAX
 The maximum number of overrun for a specific timer,
 otherwise \-1.
@@ -352,6 +354,9 @@ The
 function first appeared in
 .Bx 4.4 .
 .Sh BUGS
-The value for _SC_STREAM_MAX is a minimum maximum, and required to be
-the same as ANSI C's FOPEN_MAX, so the returned value is a ridiculously
-small and misleading number.
+The value for
+.Dv _SC_STREAM_MAX
+is a minimum maximum, and required to be the same as
+.Tn ANSI C Ap s
+.Dv FOPEN_MAX ,
+so the returned value is a ridiculously small and misleading number.



CVS commit: src/lib/libc/gen

2024-03-21 Thread Valery Ushakov
Module Name:src
Committed By:   uwe
Date:   Thu Mar 21 22:27:55 UTC 2024

Modified Files:
src/lib/libc/gen: sysconf.3

Log Message:
sysconf(3): a few more markup fixes


To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 src/lib/libc/gen/sysconf.3

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/lib/libc/gen

2024-03-21 Thread Valery Ushakov
Module Name:src
Committed By:   uwe
Date:   Thu Mar 21 22:21:40 UTC 2024

Modified Files:
src/lib/libc/gen: sysconf.3

Log Message:
sysconf(3): the _SC constants are .Dv


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/lib/libc/gen/sysconf.3

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/gen/sysconf.3
diff -u src/lib/libc/gen/sysconf.3:1.55 src/lib/libc/gen/sysconf.3:1.56
--- src/lib/libc/gen/sysconf.3:1.55	Thu Mar 21 22:17:27 2024
+++ src/lib/libc/gen/sysconf.3	Thu Mar 21 22:21:40 2024
@@ -1,4 +1,4 @@
-.\"	$NetBSD: sysconf.3,v 1.55 2024/03/21 22:17:27 uwe Exp $
+.\"	$NetBSD: sysconf.3,v 1.56 2024/03/21 22:21:40 uwe Exp $
 .\"
 .\" Copyright (c) 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -58,37 +58,37 @@ Symbolic constants for each name value a
 .In unistd.h .
 .Pp
 The available values are as follows:
-.Bl -tag -width "123456"
-.It Li _SC_ARG_MAX
+.Bl -tag -width Dv
+.It Dv _SC_ARG_MAX
 The maximum bytes of argument to
 .Xr execve 2 .
-.It Li _SC_ATEXIT_MAX
+.It Dv _SC_ATEXIT_MAX
 The maximum number of functions that may be registered with
 .Xr atexit 3 .
-.It Li _SC_BARRIERS
+.It Dv _SC_BARRIERS
 The version of
 .St -p1003.1
 and its
 Barriers
 option to which the system attempts to conform,
 otherwise \-1.
-.It Li _SC_CLOCK_SELECTION
+.It Dv _SC_CLOCK_SELECTION
 Return the
 .Tn POSIX
 version the implementation of the Clock Selection option
 on this system conforms to,
 or \-1 if unavailable.
-.It Li _SC_CHILD_MAX
+.It Dv _SC_CHILD_MAX
 The maximum number of simultaneous processes per user id.
-.It Li _SC_CLK_TCK
+.It Dv _SC_CLK_TCK
 The number of clock ticks per second.
-.It Li _SC_FSYNC
+.It Dv _SC_FSYNC
 Return 1 if the File Synchronization option is available on this system,
 otherwise \-1.
-.It Li _SC_HOST_NAME_MAX
+.It Dv _SC_HOST_NAME_MAX
 The maximum size of a hostname, including the terminating
 .Tn NUL .
-.It Li _SC_IOV_MAX
+.It Dv _SC_IOV_MAX
 The maximum number of
 .Va iovec
 structures that a process has available for use with
@@ -99,114 +99,114 @@ structures that a process has available 
 .Xr sendmsg 2
 or
 .Xr writev 2 .
-.It Li _SC_JOB_CONTROL
+.It Dv _SC_JOB_CONTROL
 Return 1 if job control is available on this system, otherwise \-1.
-.It Li _SC_LOGIN_NAME_MAX
+.It Dv _SC_LOGIN_NAME_MAX
 Returns the size of the storage required for a login name, in bytes,
 including the terminating
 .Tn NUL .
-.It Li _SC_MAPPED_FILES
+.It Dv _SC_MAPPED_FILES
 Return 1 if the Memory Mapped Files option is available on this system,
 otherwise \-1.
-.It Li _SC_MEMLOCK
+.It Dv _SC_MEMLOCK
 Return 1 if the Process Memory Locking option is available on this system,
 otherwise \-1.
-.It Li _SC_MEMLOCK_RANGE
+.It Dv _SC_MEMLOCK_RANGE
 Return 1 if the Range Memory Locking option is available on this system,
 otherwise \-1.
-.It Li _SC_MEMORY_PROTECTION
+.It Dv _SC_MEMORY_PROTECTION
 Return 1 if the Memory Protection option is available on this system,
 otherwise \-1.
-.It Li _SC_MONOTONIC_CLOCK
+.It Dv _SC_MONOTONIC_CLOCK
 Return the
 .Tn POSIX
 version the implementation of the Monotonic Clock option
 on this system conforms to,
 or \-1 if unavailable.
-.It Li _SC_NGROUPS_MAX
+.It Dv _SC_NGROUPS_MAX
 The maximum number of supplemental groups.
-.It Li _SC_OPEN_MAX
+.It Dv _SC_OPEN_MAX
 The maximum number of open files per process.
-.It Li _SC_PAGESIZE
+.It Dv _SC_PAGESIZE
 The size of a system page in bytes.
-.It Li _SC_PASS_MAX
+.It Dv _SC_PASS_MAX
 The maximum length of the password, not counting the terminating
 .Tn NUL .
-.It Li _SC_READER_WRITER_LOCKS
+.It Dv _SC_READER_WRITER_LOCKS
 The version of
 .St -p1003.1
 and its
 Read-Write Locks
 option to which the system attempts to conform,
 otherwise \-1.
-.It Li _SC_REGEXP
+.It Dv _SC_REGEXP
 Return 1 if
 .Tn POSIX
 regular expressions are available on this system, otherwise \-1.
-.It Li _SC_SEMAPHORES
+.It Dv _SC_SEMAPHORES
 The version of
 .St -p1003.1
 and its
 Semaphores
 option to which the system attempts to conform,
 otherwise \-1.
-.It Li _SC_SEM_NSEMS_MAX
+.It Dv _SC_SEM_NSEMS_MAX
 The maximum number of semaphores that one process can have open at a time,
 otherwise \-1.
-.It Li _SC_SHELL
+.It Dv _SC_SHELL
 Return 1 if
 .Tn POSIX
 shell is available on this system, otherwise \-1.
-.It Li _SC_SPIN_LOCKS
+.It Dv _SC_SPIN_LOCKS
 The version of
 .St -p1003.1
 and its
 Spin Locks
 option to which the system attempts to conform,
 otherwise \-1.
-.It Li _SC_STREAM_MAX
+.It Dv _SC_STREAM_MAX
 The minimum maximum number of streams that a process may have open
 at any one time.
-.It Li _SC_SYMLOOP_MAX
+.It Dv _SC_SYMLOOP_MAX
 The maximum number of symbolic links that may be expanded in a path name.
-.It Li _SC_SYNCHRONIZED_IO
+.It Dv _SC_SYNCHRONIZED_IO
 Return 1 if the Synchronized I/O option is available on this system,
 otherwise \-1.
-.It Li _SC_THREADS
+.It Dv _SC_THREADS
 The 

CVS commit: src/lib/libc/gen

2024-03-21 Thread Valery Ushakov
Module Name:src
Committed By:   uwe
Date:   Thu Mar 21 22:21:40 UTC 2024

Modified Files:
src/lib/libc/gen: sysconf.3

Log Message:
sysconf(3): the _SC constants are .Dv


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/lib/libc/gen/sysconf.3

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/lib/libc/gen

2024-03-21 Thread Valery Ushakov
Module Name:src
Committed By:   uwe
Date:   Thu Mar 21 22:17:27 UTC 2024

Modified Files:
src/lib/libc/gen: sysconf.3

Log Message:
sysconf(3): NUL is not a defined variable


To generate a diff of this commit:
cvs rdiff -u -r1.54 -r1.55 src/lib/libc/gen/sysconf.3

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/gen/sysconf.3
diff -u src/lib/libc/gen/sysconf.3:1.54 src/lib/libc/gen/sysconf.3:1.55
--- src/lib/libc/gen/sysconf.3:1.54	Thu Mar 21 22:14:29 2024
+++ src/lib/libc/gen/sysconf.3	Thu Mar 21 22:17:27 2024
@@ -1,4 +1,4 @@
-.\"	$NetBSD: sysconf.3,v 1.54 2024/03/21 22:14:29 uwe Exp $
+.\"	$NetBSD: sysconf.3,v 1.55 2024/03/21 22:17:27 uwe Exp $
 .\"
 .\" Copyright (c) 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -87,7 +87,7 @@ Return 1 if the File Synchronization opt
 otherwise \-1.
 .It Li _SC_HOST_NAME_MAX
 The maximum size of a hostname, including the terminating
-.Dv NUL .
+.Tn NUL .
 .It Li _SC_IOV_MAX
 The maximum number of
 .Va iovec
@@ -104,7 +104,7 @@ Return 1 if job control is available on 
 .It Li _SC_LOGIN_NAME_MAX
 Returns the size of the storage required for a login name, in bytes,
 including the terminating
-.Dv NUL .
+.Tn NUL .
 .It Li _SC_MAPPED_FILES
 Return 1 if the Memory Mapped Files option is available on this system,
 otherwise \-1.
@@ -131,7 +131,7 @@ The maximum number of open files per pro
 The size of a system page in bytes.
 .It Li _SC_PASS_MAX
 The maximum length of the password, not counting the terminating
-.Dv NUL .
+.Tn NUL .
 .It Li _SC_READER_WRITER_LOCKS
 The version of
 .St -p1003.1



CVS commit: src/lib/libc/gen

2024-03-21 Thread Valery Ushakov
Module Name:src
Committed By:   uwe
Date:   Thu Mar 21 22:17:27 UTC 2024

Modified Files:
src/lib/libc/gen: sysconf.3

Log Message:
sysconf(3): NUL is not a defined variable


To generate a diff of this commit:
cvs rdiff -u -r1.54 -r1.55 src/lib/libc/gen/sysconf.3

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/lib/libc/gen

2024-03-21 Thread Valery Ushakov
Module Name:src
Committed By:   uwe
Date:   Thu Mar 21 22:14:29 UTC 2024

Modified Files:
src/lib/libc/gen: sysconf.3

Log Message:
sysconf(3): POSIX text doesn't capitalize "option".


To generate a diff of this commit:
cvs rdiff -u -r1.53 -r1.54 src/lib/libc/gen/sysconf.3

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/lib/libc/gen

2024-03-21 Thread Valery Ushakov
Module Name:src
Committed By:   uwe
Date:   Thu Mar 21 22:14:29 UTC 2024

Modified Files:
src/lib/libc/gen: sysconf.3

Log Message:
sysconf(3): POSIX text doesn't capitalize "option".


To generate a diff of this commit:
cvs rdiff -u -r1.53 -r1.54 src/lib/libc/gen/sysconf.3

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/gen/sysconf.3
diff -u src/lib/libc/gen/sysconf.3:1.53 src/lib/libc/gen/sysconf.3:1.54
--- src/lib/libc/gen/sysconf.3:1.53	Thu Mar 21 14:48:01 2024
+++ src/lib/libc/gen/sysconf.3	Thu Mar 21 22:14:29 2024
@@ -1,4 +1,4 @@
-.\"	$NetBSD: sysconf.3,v 1.53 2024/03/21 14:48:01 wiz Exp $
+.\"	$NetBSD: sysconf.3,v 1.54 2024/03/21 22:14:29 uwe Exp $
 .\"
 .\" Copyright (c) 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -75,7 +75,7 @@ otherwise \-1.
 .It Li _SC_CLOCK_SELECTION
 Return the
 .Tn POSIX
-version the implementation of the Clock Selection Option
+version the implementation of the Clock Selection option
 on this system conforms to,
 or \-1 if unavailable.
 .It Li _SC_CHILD_MAX
@@ -83,7 +83,7 @@ The maximum number of simultaneous proce
 .It Li _SC_CLK_TCK
 The number of clock ticks per second.
 .It Li _SC_FSYNC
-Return 1 if the File Synchronization Option is available on this system,
+Return 1 if the File Synchronization option is available on this system,
 otherwise \-1.
 .It Li _SC_HOST_NAME_MAX
 The maximum size of a hostname, including the terminating
@@ -106,21 +106,21 @@ Returns the size of the storage required
 including the terminating
 .Dv NUL .
 .It Li _SC_MAPPED_FILES
-Return 1 if the Memory Mapped Files Option is available on this system,
+Return 1 if the Memory Mapped Files option is available on this system,
 otherwise \-1.
 .It Li _SC_MEMLOCK
-Return 1 if the Process Memory Locking Option is available on this system,
+Return 1 if the Process Memory Locking option is available on this system,
 otherwise \-1.
 .It Li _SC_MEMLOCK_RANGE
-Return 1 if the Range Memory Locking Option is available on this system,
+Return 1 if the Range Memory Locking option is available on this system,
 otherwise \-1.
 .It Li _SC_MEMORY_PROTECTION
-Return 1 if the Memory Protection Option is available on this system,
+Return 1 if the Memory Protection option is available on this system,
 otherwise \-1.
 .It Li _SC_MONOTONIC_CLOCK
 Return the
 .Tn POSIX
-version the implementation of the Monotonic Clock Option
+version the implementation of the Monotonic Clock option
 on this system conforms to,
 or \-1 if unavailable.
 .It Li _SC_NGROUPS_MAX
@@ -170,7 +170,7 @@ at any one time.
 .It Li _SC_SYMLOOP_MAX
 The maximum number of symbolic links that may be expanded in a path name.
 .It Li _SC_SYNCHRONIZED_IO
-Return 1 if the Synchronized I/O Option is available on this system,
+Return 1 if the Synchronized I/O option is available on this system,
 otherwise \-1.
 .It Li _SC_THREADS
 The version of
@@ -252,26 +252,26 @@ permitted when using interval notation.
 The version of POSIX 1003.2 with which the system attempts to comply.
 .It Li _SC_2_C_BIND
 Return 1 if the system's C-language development facilities support the
-C-Language Bindings Option, otherwise \-1.
+C-Language Bindings option, otherwise \-1.
 .It Li _SC_2_C_DEV
-Return 1 if the system supports the C-Language Development Utilities Option,
+Return 1 if the system supports the C-Language Development Utilities option,
 otherwise \-1.
 .It Li _SC_2_CHAR_TERM
 Return 1 if the system supports at least one terminal type capable of
 all operations described in POSIX 1003.2, otherwise \-1.
 .It Li _SC_2_FORT_DEV
-Return 1 if the system supports the FORTRAN Development Utilities Option,
+Return 1 if the system supports the FORTRAN Development Utilities option,
 otherwise \-1.
 .It Li _SC_2_FORT_RUN
-Return 1 if the system supports the FORTRAN Runtime Utilities Option,
+Return 1 if the system supports the FORTRAN Runtime Utilities option,
 otherwise \-1.
 .It Li _SC_2_LOCALEDEF
 Return 1 if the system supports the creation of locales, otherwise \-1.
 .It Li _SC_2_SW_DEV
-Return 1 if the system supports the Software Development Utilities Option,
+Return 1 if the system supports the Software Development Utilities option,
 otherwise \-1.
 .It Li _SC_2_UPE
-Return 1 if the system supports the User Portability Utilities Option,
+Return 1 if the system supports the User Portability Utilities option,
 otherwise \-1.
 .It Li _SC_GETGR_R_SIZE_MAX
 The minimum size of the



CVS commit: src/lib/libc/gen

2024-03-21 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Thu Mar 21 14:48:01 UTC 2024

Modified Files:
src/lib/libc/gen: sysconf.3

Log Message:
Fix NUL/NULL confusion.

One of these was reported by Mouse in PR 58058.


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/lib/libc/gen/sysconf.3

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/lib/libc/gen

2024-03-21 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Thu Mar 21 14:48:01 UTC 2024

Modified Files:
src/lib/libc/gen: sysconf.3

Log Message:
Fix NUL/NULL confusion.

One of these was reported by Mouse in PR 58058.


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/lib/libc/gen/sysconf.3

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/gen/sysconf.3
diff -u src/lib/libc/gen/sysconf.3:1.52 src/lib/libc/gen/sysconf.3:1.53
--- src/lib/libc/gen/sysconf.3:1.52	Wed Oct 25 08:19:34 2023
+++ src/lib/libc/gen/sysconf.3	Thu Mar 21 14:48:01 2024
@@ -1,4 +1,4 @@
-.\"	$NetBSD: sysconf.3,v 1.52 2023/10/25 08:19:34 simonb Exp $
+.\"	$NetBSD: sysconf.3,v 1.53 2024/03/21 14:48:01 wiz Exp $
 .\"
 .\" Copyright (c) 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -86,8 +86,8 @@ The number of clock ticks per second.
 Return 1 if the File Synchronization Option is available on this system,
 otherwise \-1.
 .It Li _SC_HOST_NAME_MAX
-The maximum size of a hostname, including
-.Dv NULL .
+The maximum size of a hostname, including the terminating
+.Dv NUL .
 .It Li _SC_IOV_MAX
 The maximum number of
 .Va iovec
@@ -103,7 +103,8 @@ or
 Return 1 if job control is available on this system, otherwise \-1.
 .It Li _SC_LOGIN_NAME_MAX
 Returns the size of the storage required for a login name, in bytes,
-including the terminating NUL.
+including the terminating
+.Dv NUL .
 .It Li _SC_MAPPED_FILES
 Return 1 if the Memory Mapped Files Option is available on this system,
 otherwise \-1.
@@ -129,8 +130,8 @@ The maximum number of open files per pro
 .It Li _SC_PAGESIZE
 The size of a system page in bytes.
 .It Li _SC_PASS_MAX
-The maximum length of the password, not counting
-.Dv NULL .
+The maximum length of the password, not counting the terminating
+.Dv NUL .
 .It Li _SC_READER_WRITER_LOCKS
 The version of
 .St -p1003.1



CVS commit: src/lib/libc/arch/sparc64/gen

2024-03-20 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed Mar 20 06:15:40 UTC 2024

Modified Files:
src/lib/libc/arch/sparc64/gen: fpsetround.c

Log Message:
sparc64/fpsetround: avoid shifting into the sign bit

Lint had warned about the constant expression '0x03 << 30' but not about
the structurally equal nonconstant expression '(rnd_dir & 0x03) << 30'.

No binary change.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/lib/libc/arch/sparc64/gen/fpsetround.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/arch/sparc64/gen/fpsetround.c
diff -u src/lib/libc/arch/sparc64/gen/fpsetround.c:1.8 src/lib/libc/arch/sparc64/gen/fpsetround.c:1.9
--- src/lib/libc/arch/sparc64/gen/fpsetround.c:1.8	Mon Mar 11 23:05:35 2024
+++ src/lib/libc/arch/sparc64/gen/fpsetround.c	Wed Mar 20 06:15:39 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpsetround.c,v 1.8 2024/03/11 23:05:35 christos Exp $	*/
+/*	$NetBSD: fpsetround.c,v 1.9 2024/03/20 06:15:39 rillig Exp $	*/
 
 /*
  * Written by J.T. Conklin, Apr 10, 1995
@@ -7,7 +7,7 @@
 
 #include 
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: fpsetround.c,v 1.8 2024/03/11 23:05:35 christos Exp $");
+__RCSID("$NetBSD: fpsetround.c,v 1.9 2024/03/20 06:15:39 rillig Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include "namespace.h"
@@ -36,8 +36,8 @@ fpsetround(fp_rnd rnd_dir)
 #endif
 
 	new = old;
-	new &= ~(0x03U << 30); 
-	new |= ((rnd_dir & 0x03) << 30);
+	new &= ~(0x03U << 30);
+	new |= ((rnd_dir & 0x03U) << 30);
 
 	__asm("ld %0,%%fsr" : : "m" (*));
 



CVS commit: src/lib/libc/arch/sparc64/gen

2024-03-20 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed Mar 20 06:15:40 UTC 2024

Modified Files:
src/lib/libc/arch/sparc64/gen: fpsetround.c

Log Message:
sparc64/fpsetround: avoid shifting into the sign bit

Lint had warned about the constant expression '0x03 << 30' but not about
the structurally equal nonconstant expression '(rnd_dir & 0x03) << 30'.

No binary change.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/lib/libc/arch/sparc64/gen/fpsetround.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/lib/libc/time

2024-03-18 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Mar 18 16:15:24 UTC 2024

Modified Files:
src/lib/libc/time: strptime.c

Log Message:
strptime(3): Declare digit d as time_t.

This doesn't make a semantic difference -- d can only take on the ten
values {0,1,2,3,4,5,6,7,8,9}, and the arithmetic with it later all
comes out the same whether the type is unsigned or time_t, even if
time_t were int32_t instead of int64_t.

But it pacifies overzealous compilers used by downstream users of
this code.  And while it's silly to use a much wider type (64-bit
signed) than is needed here to store a single digit, it doesn't
really hurt either (32-bit unsigned is much larger than needed too).

PR lib/58041


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.66 src/lib/libc/time/strptime.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/lib/libc/time

2024-03-18 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Mar 18 16:15:24 UTC 2024

Modified Files:
src/lib/libc/time: strptime.c

Log Message:
strptime(3): Declare digit d as time_t.

This doesn't make a semantic difference -- d can only take on the ten
values {0,1,2,3,4,5,6,7,8,9}, and the arithmetic with it later all
comes out the same whether the type is unsigned or time_t, even if
time_t were int32_t instead of int64_t.

But it pacifies overzealous compilers used by downstream users of
this code.  And while it's silly to use a much wider type (64-bit
signed) than is needed here to store a single digit, it doesn't
really hurt either (32-bit unsigned is much larger than needed too).

PR lib/58041


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.66 src/lib/libc/time/strptime.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/time/strptime.c
diff -u src/lib/libc/time/strptime.c:1.65 src/lib/libc/time/strptime.c:1.66
--- src/lib/libc/time/strptime.c:1.65	Sat Mar 16 00:16:21 2024
+++ src/lib/libc/time/strptime.c	Mon Mar 18 16:15:24 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: strptime.c,v 1.65 2024/03/16 00:16:21 riastradh Exp $	*/
+/*	$NetBSD: strptime.c,v 1.66 2024/03/18 16:15:24 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998, 2005, 2008 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: strptime.c,v 1.65 2024/03/16 00:16:21 riastradh Exp $");
+__RCSID("$NetBSD: strptime.c,v 1.66 2024/03/18 16:15:24 riastradh Exp $");
 #endif
 
 #include "namespace.h"
@@ -348,8 +348,7 @@ literal:
 
 		case 's': {	/* seconds since the epoch */
 			const time_t TIME_MAX = __type_max(time_t);
-			time_t sse;
-			unsigned d;
+			time_t sse, d;
 
 			if (*bp < '0' || *bp > '9') {
 bp = NULL;



CVS commit: src/lib/libc/time

2024-03-15 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Mar 16 00:16:21 UTC 2024

Modified Files:
src/lib/libc/time: strptime.c

Log Message:
strptime(3): Reduce unnecessary indentation.

Post-fix tidying.

No functional change intended.

PR lib/58041


To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.65 src/lib/libc/time/strptime.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



  1   2   3   4   5   6   7   8   9   10   >