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/libintl

2024-04-12 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Apr 13 02:01:38 UTC 2024

Modified Files:
src/lib/libintl: gettext.c

Log Message:
PR/58136: Paul Ripke: Fix use after free.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/lib/libintl/gettext.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/libintl/gettext.c
diff -u src/lib/libintl/gettext.c:1.31 src/lib/libintl/gettext.c:1.32
--- src/lib/libintl/gettext.c:1.31	Thu Oct  3 12:35:57 2019
+++ src/lib/libintl/gettext.c	Fri Apr 12 22:01:38 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: gettext.c,v 1.31 2019/10/03 16:35:57 christos Exp $	*/
+/*	$NetBSD: gettext.c,v 1.32 2024/04/13 02:01:38 christos Exp $	*/
 
 /*-
  * Copyright (c) 2000, 2001 Citrus Project,
@@ -29,7 +29,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: gettext.c,v 1.31 2019/10/03 16:35:57 christos Exp $");
+__RCSID("$NetBSD: gettext.c,v 1.32 2024/04/13 02:01:38 christos Exp $");
 
 #include 
 #include 
@@ -176,6 +176,9 @@ pgettext_impl(const char *domainname, co
 		msgid2, n, category);
 	free(msgctxt_id);
 
+	if (translation == msgctxt_id)
+		return msgid1;
+
 	p = strchr(translation, '\004');
 	if (p)
 		return p + 1;



CVS commit: src/lib/libintl

2024-04-12 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Apr 13 02:01:38 UTC 2024

Modified Files:
src/lib/libintl: gettext.c

Log Message:
PR/58136: Paul Ripke: Fix use after free.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/lib/libintl/gettext.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/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.



Re: CVS commit: src/lib/libutil

2024-04-09 Thread Valery Ushakov
On Mon, Apr 08, 2024 at 23:31:16 +0200, Roland Illig wrote:

> Am 08.04.2024 um 21:18 schrieb Valery Ushakov:
> >   "=\017FIFTEEN\0"
> >
> > with its result a few lines below that has:
> >
> >   BURST=0xf=FIFTEEN
> 
> Thank you for explaining this example. I had a gut feeling that there
> would be some hidden correlation between some octal/hexadecimal
> combinations, but I couldn't name it. Indeed, if the number base for
> output is hexadecimal, the field comparisons should be done in
> hexadecimal as well.
> 
> I adjusted the description and examples in the manual page accordingly.

Thanks!  My unscientific impression is that snprintb(3) was not very
popular and its uses sometimes are a bit of a cargo-cult, so existing
use cases have to be taken with a grain of salt and don't necessarily
represent good style.  This is why improving the docs with good
examples is important, imho.


-uwe


Re: CVS commit: src/lib/libutil

2024-04-08 Thread Roland Illig
Am 08.04.2024 um 21:18 schrieb Valery Ushakov:
>   "=\017FIFTEEN\0"
>
> with its result a few lines below that has:
>
>   BURST=0xf=FIFTEEN

Thank you for explaining this example. I had a gut feeling that there
would be some hidden correlation between some octal/hexadecimal
combinations, but I couldn't name it. Indeed, if the number base for
output is hexadecimal, the field comparisons should be done in
hexadecimal as well.

I adjusted the description and examples in the manual page accordingly.

Roland



Re: CVS commit: src/lib/libutil

2024-04-08 Thread Valery Ushakov
On Mon, Apr 08, 2024 at 20:21:07 +0200, Roland Illig wrote:

> I didn't eradicate _all_ hexadecimal examples, I just made each example
> use only one number base, not mix them both. There are both octal and
> hexadecimal examples in the manual page.

That's not what "prefer octal in examples" conveys.

I would also say that source code that says

  "=\x0f" "FIFTEEN\0"

aligns much better than

  "=\017FIFTEEN\0"

with its result a few lines below that has:

  BURST=0xf=FIFTEEN


-uwe


Re: CVS commit: src/lib/libutil

2024-04-08 Thread Roland Illig
Am 08.04.2024 um 03:24 schrieb Valery Ushakov:
> On Sun, Apr 07, 2024 at 14:28:27 +, Roland Illig wrote:
>
>> Log Message:
>> snprintb.3: clean up formatting and wording, prefer octal in examples
>>
>> Using hexadecimal character escapes requires separate string literals if
>> the description starts with one of the letters A-F; octal character
>> escapes have at most 3 digits, reducing ambiguity.
>
> 70s are over, very few people speak octal fluently.  If anything, the
> man page should highlight the potential snag.  Besides, separate
> literal for the name is good for readability anyway.

When I looked through the NetBSD tree exploring the current usage, I
found that a significant majority uses octal instead of hexadecimal. I
don't know the exact reasons for this, it might be due to existing
practice in the 1990s, to avoid splitting the bit position and the
description to separate string literals, to be able to easily split the
bit position into the byte and the bit portion mentally, or maybe
something entirely different.

While your claim that "very few people speak octal fluently" may be true
for programmers in general, I expect those using the snprintb function
to be more fluent than others. Of course, I saw cases where "\040" was
followed by "\039", just as I saw cases of "\x0fFIELD". Lint now warns
in both these cases.

Regarding the separate literals, I didn't see them in wide use up to
now. Existing code seems to focus more on compressing the source code
into as few lines as possible rather than making it easily readable. I
agree that separate string literals are more readable, and I converted
the example that uses hexadecimal escapes to this style.

I didn't eradicate _all_ hexadecimal examples, I just made each example
use only one number base, not mix them both. There are both octal and
hexadecimal examples in the manual page.

Roland



Re: CVS commit: src/lib/libutil

2024-04-07 Thread Valery Ushakov
On Sun, Apr 07, 2024 at 14:28:27 +, Roland Illig wrote:

> Log Message:
> snprintb.3: clean up formatting and wording, prefer octal in examples
> 
> Using hexadecimal character escapes requires separate string literals if
> the description starts with one of the letters A-F; octal character
> escapes have at most 3 digits, reducing ambiguity.

70s are over, very few people speak octal fluently.  If anything, the
man page should highlight the potential snag.  Besides, separate
literal for the name is good for readability anyway.

Please, revert.

-uwe


CVS commit: src/lib/libutil

2024-04-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Apr  7 14:28:27 UTC 2024

Modified Files:
src/lib/libutil: snprintb.3

Log Message:
snprintb.3: clean up formatting and wording, prefer octal in examples

Using hexadecimal character escapes requires separate string literals if
the description starts with one of the letters A-F; octal character
escapes have at most 3 digits, reducing ambiguity.


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/lib/libutil/snprintb.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/libutil/snprintb.3
diff -u src/lib/libutil/snprintb.3:1.37 src/lib/libutil/snprintb.3:1.38
--- src/lib/libutil/snprintb.3:1.37	Sun Apr  7 12:05:23 2024
+++ src/lib/libutil/snprintb.3	Sun Apr  7 14:28:26 2024
@@ -1,4 +1,4 @@
-.\" $NetBSD: snprintb.3,v 1.37 2024/04/07 12:05:23 rillig Exp $
+.\" $NetBSD: snprintb.3,v 1.38 2024/04/07 14:28:26 rillig Exp $
 .\"
 .\" Copyright (c) 1998, 2024 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd February 22, 2024
+.Dd April 7, 2024
 .Dt SNPRINTB 3
 .Os
 .Sh NAME
@@ -180,10 +180,10 @@ followed by type-specific parameters, ea
 followed by a
 .Tn NUL Ns -terminated description.
 The bit positions are 0-based,
-they range from
-.Sq \e000
-for the least significant bit to
-.Sq \e077
+ranging from
+.Ql \e000
+(0) for the least significant bit to
+.Ql \e077
 (63) for the most significant bit.
 .
 .Bl -tag -width Cm
@@ -252,15 +252,15 @@ If none of the previous
 .Sq Cm \&=
 or
 .Sq Cm \&:
-conversions matched, prints the field value, using the
-.Xr printf 3
-format
-.Ar fmt .
+conversions matched, prints the format string
+.Ar fmt
+via
+.Xr printf 3 .
 The format string
 .Ar fmt
 may contain a single
 .Vt uintmax_t
-conversion specification that prints the value that did not match.
+conversion specification to print the field value that did not match.
 .El
 .Pp
 The new format is terminated by an additional
@@ -285,15 +285,15 @@ total number of bytes.
 .Sh EXAMPLES
 Two examples of the old formatting style:
 .Bd -literal -offset indent
-snprintb(buf, bufsize, "\e10\e2BITTWO\e1BITONE", 3)
+snprintb(buf, bufsize, "\e010\e002BITTWO\e001BITONE", 3)
 \(rA "03"
 
 snprintb(buf, bufsize,
-"\e20"
-"\ex10NOTBOOT" "\ex0f""FPP" "\ex0eSDVMA"
-"\ex0cVIDEO" "\ex0bLORES" "\ex0a""FPA" "\ex09""DIAG"
-"\ex07""CACHE" "\ex06IOCACHE" "\ex05LOOPBACK"
-"\ex04""DBGCACHE",
+"\e020"
+"\ex10""NOTBOOT"   "\ex0f""FPP"   "\ex0e""SDVMA"
+"\ex0c""VIDEO" "\ex0b""LORES" "\ex0a""FPA"
+"\ex09""DIAG"  "\ex07""CACHE" "\ex06""IOCACHE"
+"\ex05""LOOPBACK"  "\ex04""DBGCACHE",
 0xe860)
 \(rA "0xe860"
 .Ed
@@ -302,9 +302,9 @@ An example of the new formatting style:
 .Bd -literal -offset indent
 snprintb(buf, bufsize,
 "\e177\e020"
-"b\e0LSB\e0" "b\e1BITONE\e0" "f\e4\e4NIBBLE2\e0"
-"f\ex10\e4BURST\e0" "=\e4FOUR\e0" "=\exf""FIFTEEN\e0"
-"b\ex1fMSB\e0",
+"b\e000LSB\e0" "b\e001BITONE\e0" "f\e004\e004NIBBLE2\e0"
+"f\e020\e004BURST\e0" "=\e004FOUR\e0" "=\e017FIFTEEN\e0"
+"b\e037MSB\e0",
 0x800f0701)
 \(rA "0x800f0701"
 .Ed
@@ -313,9 +313,9 @@ The same example using snprintb_m:
 .Bd -literal -offset indent
 snprintb_m(buf, bufsize,
 "\e177\e020"
-"b\e0LSB\e0" "b\e1BITONE\e0" "f\e4\e4NIBBLE2\e0"
-"f\ex10\e4BURST\e0" "=\e4FOUR\e0" "=\exf""FIFTEEN\e0"
-"b\ex1fMSB\e0",
+"b\e000LSB\e0" "b\e001BITONE\e0" "f\e004\e004NIBBLE2\e0"
+"f\e020\e004BURST\e0" "=\e004FOUR\e0" "=\e017FIFTEEN\e0"
+"b\e037MSB\e0",
 0x800f0701, 34)
 \(rA "0x800f0701\e0"
"0x800f0701\e0"



CVS commit: src/lib/libutil

2024-04-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Apr  7 14:28:27 UTC 2024

Modified Files:
src/lib/libutil: snprintb.3

Log Message:
snprintb.3: clean up formatting and wording, prefer octal in examples

Using hexadecimal character escapes requires separate string literals if
the description starts with one of the letters A-F; octal character
escapes have at most 3 digits, reducing ambiguity.


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/lib/libutil/snprintb.3

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



CVS commit: src/lib/libedit

2024-04-06 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Apr  6 13:36:11 UTC 2024

Modified Files:
src/lib/libedit: editline.7

Log Message:
update em-toggle-overwrite binding (Xose Vazquez Perez)


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/lib/libedit/editline.7

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

Modified files:

Index: src/lib/libedit/editline.7
diff -u src/lib/libedit/editline.7:1.5 src/lib/libedit/editline.7:1.6
--- src/lib/libedit/editline.7:1.5	Mon May  9 17:27:55 2016
+++ src/lib/libedit/editline.7	Sat Apr  6 09:36:11 2024
@@ -1,4 +1,4 @@
-.\"	$NetBSD: editline.7,v 1.5 2016/05/09 21:27:55 christos Exp $
+.\"	$NetBSD: editline.7,v 1.6 2024/04/06 13:36:11 christos Exp $
 .\"	$OpenBSD: editline.7,v 1.1 2016/04/20 01:11:45 schwarze Exp $
 .\"
 .\" Copyright (c) 2016 Ingo Schwarze 
@@ -15,7 +15,7 @@
 .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 .\"
-.Dd May 7, 2016
+.Dd April 6, 2024
 .Dt EDITLINE 7
 .Os
 .Sh NAME
@@ -546,7 +546,7 @@ It is an error if the cursor is already 
 buffer.
 .It Ic em-set-mark Pq emacs: Ctrl-Q, NUL
 Set the mark at the current cursor position.
-.It Ic em-toggle-overwrite Pq not bound by default
+.It Ic em-toggle-overwrite Pq insert
 Switch from insert to overwrite mode or vice versa.
 .It Ic em-universal-argument Pq not bound by default
 If in argument input mode, multiply the argument by 4.



CVS commit: src/lib/libedit

2024-04-06 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Apr  6 13:36:11 UTC 2024

Modified Files:
src/lib/libedit: editline.7

Log Message:
update em-toggle-overwrite binding (Xose Vazquez Perez)


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/lib/libedit/editline.7

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



CVS commit: src/lib/libterminfo

2024-04-05 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Apr  5 22:30:18 UTC 2024

Modified Files:
src/lib/libterminfo: genman

Log Message:
>From Jan-Benedict Glaw:

Use `printf` instead of `echo` for precise output

`man` pages generated under NetBSD and Linux differ as the escape codes
may or may not be interpreted when going through those two chained `echo`es.
Instead just use `printf`, which produces the desired output, always.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/lib/libterminfo/genman

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



CVS commit: src/lib/libterminfo

2024-04-05 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Apr  5 22:30:18 UTC 2024

Modified Files:
src/lib/libterminfo: genman

Log Message:
>From Jan-Benedict Glaw:

Use `printf` instead of `echo` for precise output

`man` pages generated under NetBSD and Linux differ as the escape codes
may or may not be interpreted when going through those two chained `echo`es.
Instead just use `printf`, which produces the desired output, always.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/lib/libterminfo/genman

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

Modified files:

Index: src/lib/libterminfo/genman
diff -u src/lib/libterminfo/genman:1.5 src/lib/libterminfo/genman:1.6
--- src/lib/libterminfo/genman:1.5	Fri Jan 25 07:52:45 2013
+++ src/lib/libterminfo/genman	Fri Apr  5 18:30:18 2024
@@ -1,5 +1,5 @@
 #!/bin/sh
-# $NetBSD: genman,v 1.5 2013/01/25 12:52:45 roy Exp $
+# $NetBSD: genman,v 1.6 2024/04/05 22:30:18 christos Exp $
 
 # Copyright (c) 2009, 2013 The NetBSD Foundation, Inc.
 #
@@ -44,11 +44,11 @@ gentab()
 	# Generate a list of long names and codes
 	$TOOL_SED -n \
 	-e "s/#define t_\([^(]*\).*>$tab\[TICODE_\([^]]*\).*/\1 \2/p" \
-	$ti | $TOOL_SORT | while read name code foo; do
+	$ti | $TOOL_SORT | while read name code _; do
 		cap=$($TOOL_SED -ne "s/.*{ \"\(..\)\", TICODE_$code }.*/\1/p" \
 		$tc | head -n 1)
 		desc=$($TOOL_SED -ne "s/ \* $name\: \(.*\)/\1/p" $ti)
-		echo ".It \"\\&$name\" Ta Sy \"\\&$code\" Ta Sy \"\\&$cap\" Ta \"\\&$desc\""
+		printf '.It "\\&%s" Ta Sy "\\&%s" Ta Sy "\\&%s" Ta "\\&%s"\n' "${name}" "${code}" "${cap}" "${desc}"
 	done
 }
 
@@ -56,15 +56,15 @@ boolcaps=$(gentab $TERMH $TERMC flags)
 numcaps=$(gentab $TERMH $TERMC nums)
 strcaps=$(gentab $TERMH $TERMC strs)
 
-echo ".\\\"DO NOT EDIT"
-echo ".\\\"Automatically generated from termcap.5.in"
-echo ".\\\""
+printf '.\\"DO NOT EDIT\n'
+printf '.\\"Automatically generated from termcap.5.in\n'
+printf '.\\"\n'
 
 while read -r line; do
 	case "$line" in
-	"@BOOLCAPS@")	echo "$boolcaps";;
-	"@NUMCAPS@")	echo "$numcaps";;
-	"@STRCAPS@")	echo "$strcaps";;
-	*)		echo "$line";;
+	"@BOOLCAPS@")	printf '%s\n' "${boolcaps}";;
+	"@NUMCAPS@")	printf '%s\n' "${numcaps}";;
+	"@STRCAPS@")	printf '%s\n' "${strcaps}";;
+	*)		printf '%s\n' "${line}";;
 	esac
 done <$TERMM



CVS commit: src/lib/librumpuser

2024-04-04 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Apr  4 17:27:23 UTC 2024

Modified Files:
src/lib/librumpuser: rumpuser_daemonize.c

Log Message:
rumpuser(3): New RUMP_STDOUT, RUMP_STDERR environment variables.

If set, then when rump daemonizes, it opens the path in RUMP_STDOUT
and redirects fd 1 to that (which mostly gets the kernel console
output), and opens the path in RUMP_STDERR and redirects fd 2 to that
(no idea what this gets but it's probably good to record if it ever
gets anything).

This will allow tests that rely on rump_server daemons to stash the
output for diagnostics in case, e.g., the rump kernel crashes.

PR bin/58112


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/lib/librumpuser/rumpuser_daemonize.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/librumpuser/rumpuser_daemonize.c
diff -u src/lib/librumpuser/rumpuser_daemonize.c:1.8 src/lib/librumpuser/rumpuser_daemonize.c:1.9
--- src/lib/librumpuser/rumpuser_daemonize.c:1.8	Thu Aug  3 20:45:49 2023
+++ src/lib/librumpuser/rumpuser_daemonize.c	Thu Apr  4 17:27:23 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: rumpuser_daemonize.c,v 1.8 2023/08/03 20:45:49 andvar Exp $	*/
+/*	$NetBSD: rumpuser_daemonize.c,v 1.9 2024/04/04 17:27:23 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2010 Antti Kantee.  All Rights Reserved.
@@ -28,7 +28,7 @@
 #include "rumpuser_port.h"
 
 #if !defined(lint)
-__RCSID("$NetBSD: rumpuser_daemonize.c,v 1.8 2023/08/03 20:45:49 andvar Exp $");
+__RCSID("$NetBSD: rumpuser_daemonize.c,v 1.9 2024/04/04 17:27:23 riastradh Exp $");
 #endif /* !lint */
 
 #include 
@@ -53,6 +53,27 @@ static int daemonpipe[2];
 
 #include 
 
+static int
+openstdoutstderr(void)
+{
+	char path[PATH_MAX];
+	int fd;
+
+	if (getenv_r("RUMP_STDOUT", path, sizeof(path)) == 0) {
+		if ((fd = open(path, O_WRONLY|O_CREAT)) == -1)
+			return -1;
+		dup2(fd, STDOUT_FILENO);
+		(void)close(fd);
+	}
+	if (getenv_r("RUMP_STDERR", path, sizeof(path)) == 0) {
+		if ((fd = open(path, O_WRONLY|O_CREAT)) == -1)
+			return -1;
+		dup2(fd, STDERR_FILENO);
+		(void)close(fd);
+	}
+	return 0;
+}
+
 int
 rumpuser_daemonize_begin(void)
 {
@@ -82,6 +103,13 @@ rumpuser_daemonize_begin(void)
 		goto out;
 	}
 
+	if (openstdoutstderr() == -1) {
+		rv = errno;
+		(void)close(daemonpipe[0]);
+		(void)close(daemonpipe[1]);
+		goto out;
+	}
+
 	switch (fork()) {
 	case 0:
 		if (setsid() == -1) {
@@ -125,8 +153,10 @@ rumpuser_daemonize_done(int error)
 			goto out;
 		}
 		dup2(fd, STDIN_FILENO);
-		dup2(fd, STDOUT_FILENO);
-		dup2(fd, STDERR_FILENO);
+		if (getenv("RUMP_STDOUT") == NULL)
+			dup2(fd, STDOUT_FILENO);
+		if (getenv("RUMP_STDERR") == NULL)
+			dup2(fd, STDERR_FILENO);
 		if (fd > STDERR_FILENO)
 			close(fd);
 	}



CVS commit: src/lib/librumpuser

2024-04-04 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Apr  4 17:27:23 UTC 2024

Modified Files:
src/lib/librumpuser: rumpuser_daemonize.c

Log Message:
rumpuser(3): New RUMP_STDOUT, RUMP_STDERR environment variables.

If set, then when rump daemonizes, it opens the path in RUMP_STDOUT
and redirects fd 1 to that (which mostly gets the kernel console
output), and opens the path in RUMP_STDERR and redirects fd 2 to that
(no idea what this gets but it's probably good to record if it ever
gets anything).

This will allow tests that rely on rump_server daemons to stash the
output for diagnostics in case, e.g., the rump kernel crashes.

PR bin/58112


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/lib/librumpuser/rumpuser_daemonize.c

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



CVS commit: src/lib/libm

2024-04-03 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Apr  3 18:53:42 UTC 2024

Modified Files:
src/lib/libm/ld80: b_tgammal.c e_lgammal_r.c s_cexpl.c s_cospil.c
s_erfl.c s_exp2l.c s_expl.c s_logl.c s_sinpil.c s_tanpil.c
src/lib/libm/src: e_acoshl.c e_atanhl.c e_coshl.c e_sinhl.c s_asinhl.c
s_cbrtl.c s_clogl.c s_cosl.c s_sincosl.c s_sinl.c s_tanhl.c
s_tanl.c

Log Message:
remove #include  for i386 now that it is included in math_private.h


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/lib/libm/ld80/b_tgammal.c
cvs rdiff -u -r1.1 -r1.2 src/lib/libm/ld80/e_lgammal_r.c \
src/lib/libm/ld80/s_cexpl.c src/lib/libm/ld80/s_cospil.c \
src/lib/libm/ld80/s_erfl.c src/lib/libm/ld80/s_exp2l.c \
src/lib/libm/ld80/s_expl.c src/lib/libm/ld80/s_logl.c \
src/lib/libm/ld80/s_sinpil.c src/lib/libm/ld80/s_tanpil.c
cvs rdiff -u -r1.3 -r1.4 src/lib/libm/src/e_acoshl.c \
src/lib/libm/src/e_atanhl.c src/lib/libm/src/s_asinhl.c \
src/lib/libm/src/s_cbrtl.c src/lib/libm/src/s_sincosl.c \
src/lib/libm/src/s_tanhl.c
cvs rdiff -u -r1.2 -r1.3 src/lib/libm/src/e_coshl.c src/lib/libm/src/s_sinl.c \
src/lib/libm/src/s_tanl.c
cvs rdiff -u -r1.1 -r1.2 src/lib/libm/src/e_sinhl.c \
src/lib/libm/src/s_clogl.c src/lib/libm/src/s_cosl.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/libm/ld80/b_tgammal.c
diff -u src/lib/libm/ld80/b_tgammal.c:1.2 src/lib/libm/ld80/b_tgammal.c:1.3
--- src/lib/libm/ld80/b_tgammal.c:1.2	Mon Jan 22 07:15:19 2024
+++ src/lib/libm/ld80/b_tgammal.c	Wed Apr  3 14:53:41 2024
@@ -53,10 +53,6 @@
 #error "Unsupported long double format"
 #endif
 
-#ifdef __i386__
-#include 
-#endif
-
 #include "math.h"
 #include "math_private.h"
 

Index: src/lib/libm/ld80/e_lgammal_r.c
diff -u src/lib/libm/ld80/e_lgammal_r.c:1.1 src/lib/libm/ld80/e_lgammal_r.c:1.2
--- src/lib/libm/ld80/e_lgammal_r.c:1.1	Sun Jan 21 13:53:16 2024
+++ src/lib/libm/ld80/e_lgammal_r.c	Wed Apr  3 14:53:41 2024
@@ -17,10 +17,6 @@
  * Converted to long double by Steven G. Kargl.
  */
 
-#ifdef __i386__
-#include 
-#endif
-
 #include "math.h"
 #include "math_private.h"
 
Index: src/lib/libm/ld80/s_cexpl.c
diff -u src/lib/libm/ld80/s_cexpl.c:1.1 src/lib/libm/ld80/s_cexpl.c:1.2
--- src/lib/libm/ld80/s_cexpl.c:1.1	Sun Jan 21 13:53:17 2024
+++ src/lib/libm/ld80/s_cexpl.c	Wed Apr  3 14:53:41 2024
@@ -31,9 +31,6 @@
 #include 
 #include 
 #include 
-#ifdef __i386__
-#include 
-#endif
 
 #include "fpmath.h"
 #include "math.h"
Index: src/lib/libm/ld80/s_cospil.c
diff -u src/lib/libm/ld80/s_cospil.c:1.1 src/lib/libm/ld80/s_cospil.c:1.2
--- src/lib/libm/ld80/s_cospil.c:1.1	Sun Jan 21 13:53:17 2024
+++ src/lib/libm/ld80/s_cospil.c	Wed Apr  3 14:53:41 2024
@@ -28,9 +28,6 @@
  * See ../src/s_cospi.c for implementation details.
  */
 
-#ifdef __i386__
-#include 
-#endif
 #include 
 
 #include "math.h"
Index: src/lib/libm/ld80/s_erfl.c
diff -u src/lib/libm/ld80/s_erfl.c:1.1 src/lib/libm/ld80/s_erfl.c:1.2
--- src/lib/libm/ld80/s_erfl.c:1.1	Sun Jan 21 13:53:17 2024
+++ src/lib/libm/ld80/s_erfl.c	Wed Apr  3 14:53:41 2024
@@ -17,9 +17,6 @@
  * Converted to long double by Steven G. Kargl.
  */
 #include 
-#ifdef __i386__
-#include 
-#endif
 
 #include "math.h"
 #include "math_private.h"
Index: src/lib/libm/ld80/s_exp2l.c
diff -u src/lib/libm/ld80/s_exp2l.c:1.1 src/lib/libm/ld80/s_exp2l.c:1.2
--- src/lib/libm/ld80/s_exp2l.c:1.1	Sun Jan 21 13:53:17 2024
+++ src/lib/libm/ld80/s_exp2l.c	Wed Apr  3 14:53:41 2024
@@ -30,10 +30,6 @@
 #include 
 #include 
 
-#ifdef __i386__
-#include 
-#endif
-
 #ifdef __FreeBSD__
 #include "fpmath.h"
 #endif
Index: src/lib/libm/ld80/s_expl.c
diff -u src/lib/libm/ld80/s_expl.c:1.1 src/lib/libm/ld80/s_expl.c:1.2
--- src/lib/libm/ld80/s_expl.c:1.1	Sun Jan 21 13:53:17 2024
+++ src/lib/libm/ld80/s_expl.c	Wed Apr  3 14:53:41 2024
@@ -41,10 +41,6 @@
 
 #include 
 
-#ifdef __i386__
-#include 
-#endif
-
 #ifdef __FreeBSD__
 #include "fpmath.h"
 #endif
Index: src/lib/libm/ld80/s_logl.c
diff -u src/lib/libm/ld80/s_logl.c:1.1 src/lib/libm/ld80/s_logl.c:1.2
--- src/lib/libm/ld80/s_logl.c:1.1	Sun Jan 21 13:53:17 2024
+++ src/lib/libm/ld80/s_logl.c	Wed Apr  3 14:53:41 2024
@@ -78,10 +78,6 @@
 #include 
 #endif
 
-#ifdef __i386__
-#include 
-#endif
-
 #ifdef __FreeBSD__
 #include "fpmath.h"
 #endif
Index: src/lib/libm/ld80/s_sinpil.c
diff -u src/lib/libm/ld80/s_sinpil.c:1.1 src/lib/libm/ld80/s_sinpil.c:1.2
--- src/lib/libm/ld80/s_sinpil.c:1.1	Sun Jan 21 13:53:17 2024
+++ src/lib/libm/ld80/s_sinpil.c	Wed Apr  3 14:53:41 2024
@@ -28,9 +28,6 @@
  * See ../src/s_sinpi.c for implementation details.
  */
 
-#ifdef __i386__
-#include 
-#endif
 #include 
 
 #include "math.h"
Index: src/lib/libm/ld80/s_tanpil.c
diff -u src/lib/libm/ld80/s_tanpil.c:1.1 src/lib/libm/ld80/s_tanpil.c:1.2
--- src/lib/libm/ld80/s_tanpil.c:1.1	Sun Jan 21 13:53:17 2024
+++ 

CVS commit: src/lib/libm

2024-04-03 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Apr  3 18:53:42 UTC 2024

Modified Files:
src/lib/libm/ld80: b_tgammal.c e_lgammal_r.c s_cexpl.c s_cospil.c
s_erfl.c s_exp2l.c s_expl.c s_logl.c s_sinpil.c s_tanpil.c
src/lib/libm/src: e_acoshl.c e_atanhl.c e_coshl.c e_sinhl.c s_asinhl.c
s_cbrtl.c s_clogl.c s_cosl.c s_sincosl.c s_sinl.c s_tanhl.c
s_tanl.c

Log Message:
remove #include  for i386 now that it is included in math_private.h


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/lib/libm/ld80/b_tgammal.c
cvs rdiff -u -r1.1 -r1.2 src/lib/libm/ld80/e_lgammal_r.c \
src/lib/libm/ld80/s_cexpl.c src/lib/libm/ld80/s_cospil.c \
src/lib/libm/ld80/s_erfl.c src/lib/libm/ld80/s_exp2l.c \
src/lib/libm/ld80/s_expl.c src/lib/libm/ld80/s_logl.c \
src/lib/libm/ld80/s_sinpil.c src/lib/libm/ld80/s_tanpil.c
cvs rdiff -u -r1.3 -r1.4 src/lib/libm/src/e_acoshl.c \
src/lib/libm/src/e_atanhl.c src/lib/libm/src/s_asinhl.c \
src/lib/libm/src/s_cbrtl.c src/lib/libm/src/s_sincosl.c \
src/lib/libm/src/s_tanhl.c
cvs rdiff -u -r1.2 -r1.3 src/lib/libm/src/e_coshl.c src/lib/libm/src/s_sinl.c \
src/lib/libm/src/s_tanl.c
cvs rdiff -u -r1.1 -r1.2 src/lib/libm/src/e_sinhl.c \
src/lib/libm/src/s_clogl.c src/lib/libm/src/s_cosl.c

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



CVS commit: src/lib/libm/src

2024-04-03 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Apr  3 14:54:51 UTC 2024

Modified Files:
src/lib/libm/src: s_cbrtl.c

Log Message:
need  for i386.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/lib/libm/src/s_cbrtl.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/libm/src/s_cbrtl.c
diff -u src/lib/libm/src/s_cbrtl.c:1.2 src/lib/libm/src/s_cbrtl.c:1.3
--- src/lib/libm/src/s_cbrtl.c:1.2	Tue Apr  2 21:51:01 2024
+++ src/lib/libm/src/s_cbrtl.c	Wed Apr  3 10:54:50 2024
@@ -14,10 +14,11 @@
  * and David A. Schultz.
  */
 #include 
-__RCSID("$NetBSD: s_cbrtl.c,v 1.2 2024/04/03 01:51:01 christos Exp $");
+__RCSID("$NetBSD: s_cbrtl.c,v 1.3 2024/04/03 14:54:50 christos Exp $");
 
 
 #include "namespace.h"
+#include 
 #include 
 #include 
 



CVS commit: src/lib/libm/src

2024-04-03 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Apr  3 14:54:51 UTC 2024

Modified Files:
src/lib/libm/src: s_cbrtl.c

Log Message:
need  for i386.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/lib/libm/src/s_cbrtl.c

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



CVS commit: src/lib/libm/src

2024-04-02 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Wed Apr  3 04:40:23 UTC 2024

Modified Files:
src/lib/libm/src: math_private.h

Log Message:
For i386, if ft[sg]etprec() are to be used, ensure there's a
prototype for them in scope (so include )

Might fix the i386 build.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/lib/libm/src/math_private.h

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

Modified files:

Index: src/lib/libm/src/math_private.h
diff -u src/lib/libm/src/math_private.h:1.31 src/lib/libm/src/math_private.h:1.32
--- src/lib/libm/src/math_private.h:1.31	Tue Jan 23 15:45:07 2024
+++ src/lib/libm/src/math_private.h	Wed Apr  3 04:40:23 2024
@@ -11,7 +11,7 @@
 
 /*
  * from: @(#)fdlibm.h 5.1 93/09/24
- * $NetBSD: math_private.h,v 1.31 2024/01/23 15:45:07 christos Exp $
+ * $NetBSD: math_private.h,v 1.32 2024/04/03 04:40:23 kre Exp $
  */
 
 #ifndef _MATH_PRIVATE_H_
@@ -348,6 +348,9 @@ do {\
 
 /* Support switching the mode to FP_PE if necessary. */
 #if defined(__i386__) && !defined(NO_FPSETPREC)
+
+#include 
+
 #define	ENTERI() ENTERIT(long double)
 #define	ENTERIT(returntype)			\
 	returntype __retval;			\



CVS commit: src/lib/libm/src

2024-04-02 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Wed Apr  3 04:40:23 UTC 2024

Modified Files:
src/lib/libm/src: math_private.h

Log Message:
For i386, if ft[sg]etprec() are to be used, ensure there's a
prototype for them in scope (so include )

Might fix the i386 build.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/lib/libm/src/math_private.h

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



CVS commit: src/lib/libm/src

2024-04-02 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Apr  3 01:51:02 UTC 2024

Modified Files:
src/lib/libm/src: s_cbrtl.c

Log Message:
reduce diff with FreeBSD


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/lib/libm/src/s_cbrtl.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/libm/src/s_cbrtl.c
diff -u src/lib/libm/src/s_cbrtl.c:1.1 src/lib/libm/src/s_cbrtl.c:1.2
--- src/lib/libm/src/s_cbrtl.c:1.1	Tue Nov 19 14:24:34 2013
+++ src/lib/libm/src/s_cbrtl.c	Tue Apr  2 21:51:01 2024
@@ -13,12 +13,9 @@
  * written by Steven G. Kargl with input from Bruce D. Evans
  * and David A. Schultz.
  */
-
 #include 
-__RCSID("$NetBSD: s_cbrtl.c,v 1.1 2013/11/19 19:24:34 joerg Exp $");
-#if 0
-__FBSDID("$FreeBSD: head/lib/msun/src/s_cbrtl.c 238924 2012-07-30 21:58:28Z kargl $");
-#endif
+__RCSID("$NetBSD: s_cbrtl.c,v 1.2 2024/04/03 01:51:01 christos Exp $");
+
 
 #include "namespace.h"
 #include 
@@ -30,44 +27,48 @@ __FBSDID("$FreeBSD: head/lib/msun/src/s_
 #ifdef __HAVE_LONG_DOUBLE
 __weak_alias(cbrtl, _cbrtl)
 
+#define	BIAS	(LDBL_MAX_EXP - 1)
+
 static const unsigned
 B1 = 709958130;	/* B1 = (127-127.0/3-0.03306235651)*2**23 */
 
 long double
 cbrtl(long double x)
 {
-	union ieee_ext_u ux, vx;
+	union ieee_ext_u u, v;
 	long double r, s, t, w;
 	double dr, dt, dx;
 	float ft, fx;
 	uint32_t hx;
+	uint16_t expsign;
 	int k;
 
-	ux.extu_ld = x;
-
+	u.extu_ld = x;
+	expsign = GET_EXPSIGN();
+	k = expsign & 0x7fff;
 
 	/*
 	 * If x = +-Inf, then cbrt(x) = +-Inf.
 	 * If x = NaN, then cbrt(x) = NaN.
 	 */
-	if (ux.extu_exp == EXT_EXP_INFNAN)
+	if (k == BIAS + LDBL_MAX_EXP)
 		return (x + x);
-	if ((ux.extu_frach | ux.extu_fracl | ux.extu_exp) == 0)
-		return (x);
 
-	vx.extu_ld = 1;
-	vx.extu_ext.ext_sign = ux.extu_ext.ext_sign;
-	ux.extu_ext.ext_sign = 0;
-	if (ux.extu_exp == 0) {
+	ENTERI();
+	if (k == 0) {
+		/* If x = +-0, then cbrt(x) = +-0. */
+		if ((u.extu_frach | u.extu_fracl) == 0)
+			RETURNI(x);
 		/* Adjust subnormal numbers. */
-		ux.extu_ld *= 0x1.0p514;
-		k = ux.extu_exp - EXT_EXP_BIAS - 514;
-	} else {
-		k = ux.extu_exp - EXT_EXP_BIAS;
-	}
+		u.extu_ld *= 0x1.0p514;
+		k = u.extu_exp;
+		k -= BIAS + 514;
+ 	} else
+		k -= BIAS;
+	SET_EXPSIGN(, BIAS);
+	v.extu_ld = 1; 
 
-	ux.extu_exp = EXT_EXP_BIAS;
-	x = ux.extu_ld;
+	x = u.extu_ld;
 	switch (k % 3) {
 	case 1:
 	case -2:
@@ -80,7 +81,7 @@ cbrtl(long double x)
 		k -= 2;
 		break;
 	}
-	vx.extu_exp = EXT_EXP_BIAS + k / 3;
+	SET_EXPSIGN(, (expsign & 0x8000) | (BIAS + k / 3));
 
 	/*
 	 * The following is the guts of s_cbrtf, with the handling of
@@ -136,10 +137,9 @@ cbrtl(long double x)
 	r=x/s;/* error <= 0.5 ulps; |r| < |t| */
 	w=t+t;/* t+t is exact */
 	r=(r-t)/(w+r);			/* r-t is exact; w+r ~= 3*t */
-	t=t+t*r;			/* error <= 0.5 + 0.5/3 + epsilon */
+	t=t+t*r;			/* error <= (0.5 + 0.5/3) * ulp */
 
-	t *= vx.extu_ld;
-	return t;
+	t *= v.extu_ld;
+	RETURNI(t);
 }
-
 #endif /* __HAVE_LONG_DOUBLE */



CVS commit: src/lib/libm/src

2024-04-02 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Apr  3 01:51:02 UTC 2024

Modified Files:
src/lib/libm/src: s_cbrtl.c

Log Message:
reduce diff with FreeBSD


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/lib/libm/src/s_cbrtl.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/libm/src

2024-04-02 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Apr  2 18:40:50 UTC 2024

Modified Files:
src/lib/libm/src: s_fabsl.c

Log Message:
undo accidental commit.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/lib/libm/src/s_fabsl.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/libm/src/s_fabsl.c
diff -u src/lib/libm/src/s_fabsl.c:1.7 src/lib/libm/src/s_fabsl.c:1.8
--- src/lib/libm/src/s_fabsl.c:1.7	Tue Apr  2 14:39:51 2024
+++ src/lib/libm/src/s_fabsl.c	Tue Apr  2 14:40:50 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: s_fabsl.c,v 1.7 2024/04/02 18:39:51 christos Exp $	*/
+/*	$NetBSD: s_fabsl.c,v 1.8 2024/04/02 18:40:50 christos Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -26,7 +26,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__RCSID("$NetBSD: s_fabsl.c,v 1.7 2024/04/02 18:39:51 christos Exp $");
+__RCSID("$NetBSD: s_fabsl.c,v 1.8 2024/04/02 18:40:50 christos Exp $");
 
 #include 
 #include 
@@ -47,6 +47,7 @@ fabsl(long double x)
 	return (ux.extu_ld);
 }
 #else
+#if 0
 /* defined in libc */
 long double
 fabsl(long double x)
@@ -54,3 +55,4 @@ fabsl(long double x)
 	return fabs(x);
 }
 #endif
+#endif



CVS commit: src/lib/libm/src

2024-04-02 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Apr  2 18:40:50 UTC 2024

Modified Files:
src/lib/libm/src: s_fabsl.c

Log Message:
undo accidental commit.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/lib/libm/src/s_fabsl.c

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



CVS commit: src/lib/libm/src

2024-04-02 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Apr  2 18:39:51 UTC 2024

Modified Files:
src/lib/libm/src: s_fabsl.c s_rintl.c

Log Message:
PR/58054: Martin Husemann: fix bug in expsign extraction and only use the
code for the floating point formats where it works (does not work for 112
bit mantisa in sparc64)


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/lib/libm/src/s_fabsl.c
cvs rdiff -u -r1.5 -r1.6 src/lib/libm/src/s_rintl.c

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



CVS commit: src/lib/libm/src

2024-04-02 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Apr  2 18:39:51 UTC 2024

Modified Files:
src/lib/libm/src: s_fabsl.c s_rintl.c

Log Message:
PR/58054: Martin Husemann: fix bug in expsign extraction and only use the
code for the floating point formats where it works (does not work for 112
bit mantisa in sparc64)


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/lib/libm/src/s_fabsl.c
cvs rdiff -u -r1.5 -r1.6 src/lib/libm/src/s_rintl.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/libm/src/s_fabsl.c
diff -u src/lib/libm/src/s_fabsl.c:1.6 src/lib/libm/src/s_fabsl.c:1.7
--- src/lib/libm/src/s_fabsl.c:1.6	Sun Feb 25 14:26:33 2024
+++ src/lib/libm/src/s_fabsl.c	Tue Apr  2 14:39:51 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: s_fabsl.c,v 1.6 2024/02/25 19:26:33 christos Exp $	*/
+/*	$NetBSD: s_fabsl.c,v 1.7 2024/04/02 18:39:51 christos Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -26,7 +26,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__RCSID("$NetBSD: s_fabsl.c,v 1.6 2024/02/25 19:26:33 christos Exp $");
+__RCSID("$NetBSD: s_fabsl.c,v 1.7 2024/04/02 18:39:51 christos Exp $");
 
 #include 
 #include 
@@ -47,7 +47,6 @@ fabsl(long double x)
 	return (ux.extu_ld);
 }
 #else
-#if 0
 /* defined in libc */
 long double
 fabsl(long double x)
@@ -55,4 +54,3 @@ fabsl(long double x)
 	return fabs(x);
 }
 #endif
-#endif

Index: src/lib/libm/src/s_rintl.c
diff -u src/lib/libm/src/s_rintl.c:1.5 src/lib/libm/src/s_rintl.c:1.6
--- src/lib/libm/src/s_rintl.c:1.5	Wed Aug 21 09:04:44 2013
+++ src/lib/libm/src/s_rintl.c	Tue Apr  2 14:39:51 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: s_rintl.c,v 1.5 2013/08/21 13:04:44 martin Exp $	*/
+/*	$NetBSD: s_rintl.c,v 1.6 2024/04/02 18:39:51 christos Exp $	*/
 
 /*-
  * Copyright (c) 2008 David Schultz 
@@ -30,7 +30,7 @@
 #if 0
 __FBSDID("$FreeBSD: src/lib/msun/src/s_rintl.c,v 1.5 2008/02/22 11:59:05 bde Exp $");
 #else
-__RCSID("$NetBSD: s_rintl.c,v 1.5 2013/08/21 13:04:44 martin Exp $");
+__RCSID("$NetBSD: s_rintl.c,v 1.6 2024/04/02 18:39:51 christos Exp $");
 #endif
 
 #include 
@@ -40,17 +40,19 @@ __RCSID("$NetBSD: s_rintl.c,v 1.5 2013/0
 #include "math_private.h"
 
 #ifdef __HAVE_LONG_DOUBLE
+
+# if EXT_FRACBITS == 64 || EXT_FRACBITS == 113 && LDBL_MAX_EXP == 0x4000
+
+#  define BIAS (LDBL_MAX_EXP - 1)
 static const float
 shift[2] = {
-#if EXT_FRACBITS == 64
+#  if EXT_FRACBITS == 64
 	0x1.0p63, -0x1.0p63
-#elif EXT_FRACBITS == 113
+#  elif EXT_FRACBITS == 113
 	0x1.0p112, -0x1.0p112
-#elif EXT_FRACBITS == 112
-	0x1.0p111, -0x1.0p111
-#else
-#error "Unsupported long double format"
-#endif
+#  else
+#   error "Unsupported long double format"
+#  endif
 };
 static const float zero[2] = { 0.0, -0.0 };
 
@@ -63,11 +65,11 @@ rintl(long double x)
 
 	u.extu_ld = x;
 	u.extu_ext.ext_frach &= ~0x8000;
-	expsign = u.extu_ext.ext_sign;
+	expsign = GET_EXPSIGN();
 	ex = expsign & 0x7fff;
 
-	if (ex >= EXT_EXP_BIAS + EXT_FRACBITS - 1) {
-		if (ex == EXT_EXP_BIAS + EXT_FRACBITS)
+	if (ex >= BIAS + EXT_FRACBITS - 1) {
+		if (ex == BIAS + EXT_FRACBITS)
 			return (x + x);	/* Inf, NaN, or unsupported format */
 		return (x);		/* finite and already an integer */
 	}
@@ -87,9 +89,18 @@ rintl(long double x)
 	 * If the result is +-0, then it must have the same sign as x, but
 	 * the above calculation doesn't always give this.  Fix up the sign.
 	 */
-	if (ex < EXT_EXP_BIAS && x == 0.0L)
+	if (ex < BIAS && x == 0.0L)
 		return (zero[sign]);
 
 	return (x);
 }
-#endif
+# else
+
+long double
+rintl(long double x)
+{
+	return rint(x);
+}
+
+# endif
+#endif /* __HAVE_LONG_DOUBLE */



CVS commit: src/lib/libperfuse

2024-03-30 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sat Mar 30 22:05:07 UTC 2024

Modified Files:
src/lib/libperfuse: perfuse.c

Log Message:
s/Unfortunatley/Unfortunately/ in comment.


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/lib/libperfuse/perfuse.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/libperfuse/perfuse.c
diff -u src/lib/libperfuse/perfuse.c:1.44 src/lib/libperfuse/perfuse.c:1.45
--- src/lib/libperfuse/perfuse.c:1.44	Wed Feb 23 21:54:40 2022
+++ src/lib/libperfuse/perfuse.c	Sat Mar 30 22:05:07 2024
@@ -1,4 +1,4 @@
-/*  $NetBSD: perfuse.c,v 1.44 2022/02/23 21:54:40 andvar Exp $ */
+/*  $NetBSD: perfuse.c,v 1.45 2024/03/30 22:05:07 andvar Exp $ */
 
 /*-
  *  Copyright (c) 2010-2011 Emmanuel Dreyfus. All rights reserved.
@@ -563,7 +563,7 @@ perfuse_init(struct perfuse_callbacks *p
 	 * It would be nice to avoid useless inactive, and only
 	 * get them on file open for writing (PUFFS does 
 	 * CLOSE/WRITE/INACTIVE, therefore actual close must be
-	 * done at INACTIVE time). Unfortunatley, puffs_setback
+	 * done at INACTIVE time). Unfortunately, puffs_setback
 	 * crashes when called on OPEN, therefore leave it for 
 	 * another day.
 	 */



CVS commit: src/lib/libperfuse

2024-03-30 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sat Mar 30 22:05:07 UTC 2024

Modified Files:
src/lib/libperfuse: perfuse.c

Log Message:
s/Unfortunatley/Unfortunately/ in comment.


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/lib/libperfuse/perfuse.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.



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/libm

2024-03-26 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Mar 26 20:12:47 UTC 2024

Modified Files:
src/lib/libm: Makefile

Log Message:
libm/s_logl: suppress lint warnings

Seen on sparc64.


To generate a diff of this commit:
cvs rdiff -u -r1.226 -r1.227 src/lib/libm/Makefile

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



CVS commit: src/lib/libm

2024-03-26 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Mar 26 20:12:47 UTC 2024

Modified Files:
src/lib/libm: Makefile

Log Message:
libm/s_logl: suppress lint warnings

Seen on sparc64.


To generate a diff of this commit:
cvs rdiff -u -r1.226 -r1.227 src/lib/libm/Makefile

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

Modified files:

Index: src/lib/libm/Makefile
diff -u src/lib/libm/Makefile:1.226 src/lib/libm/Makefile:1.227
--- src/lib/libm/Makefile:1.226	Fri Jan 26 22:01:40 2024
+++ src/lib/libm/Makefile	Tue Mar 26 20:12:47 2024
@@ -1,4 +1,4 @@
-#  $NetBSD: Makefile,v 1.226 2024/01/26 22:01:40 nros Exp $
+#  $NetBSD: Makefile,v 1.227 2024/03/26 20:12:47 rillig Exp $
 #
 #  @(#)Makefile 5.1beta 93/09/24
 #
@@ -55,6 +55,9 @@ LIBC_MACHINE_CPU?=	${MACHINE_CPU}
 
 LINTFLAGS+=	-g		# compiler_rt uses typeof() and __extension__
 LINTFLAGS+=	-X 117		# GCC sign-extends '>>' on signed int
+LINTFLAGS.s_logl.c+=	-X 161	# constant in conditional context
+LINTFLAGS.s_logl.c+=	-X 193	# unreachable statement (due to 161)
+LINTFLAGS.s_logl.c+=	-X 177	# non-constant initializer
 
 .if (${LIBC_MACHINE_CPU} == "aarch64")
 .PATH: ${.CURDIR}/arch/aarch64



CVS commit: src/lib/libedit

2024-03-26 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Mar 26 18:02:04 UTC 2024

Modified Files:
src/lib/libedit: readline.c

Log Message:
fix insert key (Xose Vazquez Perez)


To generate a diff of this commit:
cvs rdiff -u -r1.181 -r1.182 src/lib/libedit/readline.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/libedit/readline.c
diff -u src/lib/libedit/readline.c:1.181 src/lib/libedit/readline.c:1.182
--- src/lib/libedit/readline.c:1.181	Tue Apr 25 13:51:32 2023
+++ src/lib/libedit/readline.c	Tue Mar 26 14:02:04 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: readline.c,v 1.181 2023/04/25 17:51:32 christos Exp $	*/
+/*	$NetBSD: readline.c,v 1.182 2024/03/26 18:02:04 christos Exp $	*/
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include "config.h"
 #if !defined(lint) && !defined(SCCSID)
-__RCSID("$NetBSD: readline.c,v 1.181 2023/04/25 17:51:32 christos Exp $");
+__RCSID("$NetBSD: readline.c,v 1.182 2024/03/26 18:02:04 christos Exp $");
 #endif /* not lint && not SCCSID */
 
 #include 
@@ -402,7 +402,7 @@ rl_initialize(void)
 	 * Allow the use of the Delete/Insert keys.
 	 */
 	el_set(e, EL_BIND, "\\e[3~", "ed-delete-next-char", NULL);
-	el_set(e, EL_BIND, "\\e[2~", "ed-quoted-insert", NULL);
+	el_set(e, EL_BIND, "\\e[2~", "em-toggle-overwrite", NULL);
 
 	/*
 	 * Ctrl-left-arrow and Ctrl-right-arrow for word moving.



CVS commit: src/lib/libedit

2024-03-26 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Mar 26 18:02:04 UTC 2024

Modified Files:
src/lib/libedit: readline.c

Log Message:
fix insert key (Xose Vazquez Perez)


To generate a diff of this commit:
cvs rdiff -u -r1.181 -r1.182 src/lib/libedit/readline.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/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/librmt

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

Modified Files:
src/lib/librmt: rmtlib.c

Log Message:
s/Cannnot/Cannot/ in error message.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/lib/librmt/rmtlib.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/librmt/rmtlib.c
diff -u src/lib/librmt/rmtlib.c:1.28 src/lib/librmt/rmtlib.c:1.29
--- src/lib/librmt/rmtlib.c:1.28	Fri Dec 27 09:41:48 2019
+++ src/lib/librmt/rmtlib.c	Fri Mar 22 19:36:56 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: rmtlib.c,v 1.28 2019/12/27 09:41:48 msaitoh Exp $	*/
+/*	$NetBSD: rmtlib.c,v 1.29 2024/03/22 19:36:56 andvar Exp $	*/
 
 /*
  *	rmt --- remote tape emulator subroutines
@@ -28,7 +28,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: rmtlib.c,v 1.28 2019/12/27 09:41:48 msaitoh Exp $");
+__RCSID("$NetBSD: rmtlib.c,v 1.29 2024/03/22 19:36:56 andvar Exp $");
 
 #define RMTIOCTL	1
 /* #define USE_REXEC	1 */	/* rexec code courtesy of Dan Kegel, srs!dan */
@@ -364,7 +364,7 @@ _rmt_open(const char *path, int oflag, i
  *	bad problems if we get here
  */
 
-		err(1, "Cannnot exec %s", rshpath);
+		err(1, "Cannot exec %s", rshpath);
 		/*FALLTHROUGH*/
 	default:
 		break;



CVS commit: src/lib/librmt

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

Modified Files:
src/lib/librmt: rmtlib.c

Log Message:
s/Cannnot/Cannot/ in error message.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/lib/librmt/rmtlib.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.



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.

Modified files:

Index: src/lib/libc/time/strptime.c
diff -u src/lib/libc/time/strptime.c:1.64 src/lib/libc/time/strptime.c:1.65
--- src/lib/libc/time/strptime.c:1.64	Sat Mar 16 00:06:45 2024
+++ src/lib/libc/time/strptime.c	Sat Mar 16 00:16:21 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: strptime.c,v 1.64 2024/03/16 00:06:45 riastradh Exp $	*/
+/*	$NetBSD: strptime.c,v 1.65 2024/03/16 00:16:21 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.64 2024/03/16 00:06:45 riastradh Exp $");
+__RCSID("$NetBSD: strptime.c,v 1.65 2024/03/16 00:16:21 riastradh Exp $");
 #endif
 
 #include "namespace.h"
@@ -346,41 +346,40 @@ literal:
 			LEGAL_ALT(ALT_O);
 			continue;
 
-		case 's':	/* seconds since the epoch */
-			{
-const time_t TIME_MAX = __type_max(time_t);
-time_t sse;
-unsigned d;
+		case 's': {	/* seconds since the epoch */
+			const time_t TIME_MAX = __type_max(time_t);
+			time_t sse;
+			unsigned d;
 
-if (*bp < '0' || *bp > '9') {
-	bp = NULL;
-	continue;
-}
+			if (*bp < '0' || *bp > '9') {
+bp = NULL;
+continue;
+			}
 
-sse = *bp++ - '0';
-while (*bp >= '0' && *bp <= '9') {
-	d = *bp++ - '0';
-	if (sse > TIME_MAX/10) {
-		bp = NULL;
-		break;
-	}
-	sse *= 10;
-	if (sse > TIME_MAX - d) {
-		bp = NULL;
-		break;
-	}
-	sse += d;
+			sse = *bp++ - '0';
+			while (*bp >= '0' && *bp <= '9') {
+d = *bp++ - '0';
+if (sse > TIME_MAX/10) {
+	bp = NULL;
+	break;
 }
-if (bp == NULL)
-	continue;
-
-if (localtime_r(, tm) == NULL)
+sse *= 10;
+if (sse > TIME_MAX - d) {
 	bp = NULL;
-else
-	state |= S_YDAY | S_WDAY |
-	S_MON | S_MDAY | S_YEAR;
+	break;
+}
+sse += d;
 			}
+			if (bp == NULL)
+continue;
+
+			if (localtime_r(, tm) == NULL)
+bp = NULL;
+			else
+state |= S_YDAY | S_WDAY |
+S_MON | S_MDAY | S_YEAR;
 			continue;
+		}
 
 		case 'U':	/* The week of year, beginning on sunday. */
 		case 'W':	/* The week of year, beginning on monday. */



CVS commit: src/lib/libc/time

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

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

Log Message:
strptime(3): Avoid arithmetic overflow.

PR lib/58041


To generate a diff of this commit:
cvs rdiff -u -r1.63 -r1.64 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.63 src/lib/libc/time/strptime.c:1.64
--- src/lib/libc/time/strptime.c:1.63	Mon Sep 21 15:31:54 2020
+++ src/lib/libc/time/strptime.c	Sat Mar 16 00:06:45 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: strptime.c,v 1.63 2020/09/21 15:31:54 ginsbach Exp $	*/
+/*	$NetBSD: strptime.c,v 1.64 2024/03/16 00:06:45 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.63 2020/09/21 15:31:54 ginsbach Exp $");
+__RCSID("$NetBSD: strptime.c,v 1.64 2024/03/16 00:06:45 riastradh Exp $");
 #endif
 
 #include "namespace.h"
@@ -346,30 +346,33 @@ literal:
 			LEGAL_ALT(ALT_O);
 			continue;
 
-#ifndef TIME_MAX
-#define TIME_MAX	INT64_MAX
-#endif
 		case 's':	/* seconds since the epoch */
 			{
-time_t sse = 0;
-uint64_t rulim = TIME_MAX;
+const time_t TIME_MAX = __type_max(time_t);
+time_t sse;
+unsigned d;
 
 if (*bp < '0' || *bp > '9') {
 	bp = NULL;
 	continue;
 }
 
-do {
+sse = *bp++ - '0';
+while (*bp >= '0' && *bp <= '9') {
+	d = *bp++ - '0';
+	if (sse > TIME_MAX/10) {
+		bp = NULL;
+		break;
+	}
 	sse *= 10;
-	sse += *bp++ - '0';
-	rulim /= 10;
-} while ((sse * 10 <= TIME_MAX) &&
-	 rulim && *bp >= '0' && *bp <= '9');
-
-if (sse < 0 || (uint64_t)sse > TIME_MAX) {
-	bp = NULL;
-	continue;
+	if (sse > TIME_MAX - d) {
+		bp = NULL;
+		break;
+	}
+	sse += d;
 }
+if (bp == NULL)
+	continue;
 
 if (localtime_r(, tm) == NULL)
 	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:06:46 UTC 2024

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

Log Message:
strptime(3): Avoid arithmetic overflow.

PR lib/58041


To generate a diff of this commit:
cvs rdiff -u -r1.63 -r1.64 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/libusbhid

2024-03-14 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Thu Mar 14 15:39:23 UTC 2024

Modified Files:
src/lib/libusbhid: usb_hid_usages

Log Message:
Sync with OpenBSD


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/lib/libusbhid/usb_hid_usages

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

Modified files:

Index: src/lib/libusbhid/usb_hid_usages
diff -u src/lib/libusbhid/usb_hid_usages:1.11 src/lib/libusbhid/usb_hid_usages:1.12
--- src/lib/libusbhid/usb_hid_usages:1.11	Thu Mar 14 15:27:22 2024
+++ src/lib/libusbhid/usb_hid_usages	Thu Mar 14 15:39:23 2024
@@ -1,4 +1,5 @@
-# $NetBSD: usb_hid_usages,v 1.11 2024/03/14 15:27:22 jakllsch Exp $
+# $NetBSD: usb_hid_usages,v 1.12 2024/03/14 15:39:23 jakllsch Exp $
+# $OpenBSD: usb_hid_usages,v 1.6 2020/09/09 02:26:54 pamela Exp $
 #
 # USB HID usage table
 # Syntax:
@@ -19,6 +20,15 @@
 	0x07	Keypad
 	0x08	Multi-axis Controller
 	0x09	Tablet PC System Controls
+	0x0A	Water Cooling Device
+	0x0B	Computer Chassis Device
+	0x0C	Wireless Radio Controls
+	0x0D	Portable Device Control
+	0x0E	System Multi-Axis Controller
+	0x0F	Spatial Controller
+	0x10	Assistive Control
+	0x11	Device Dock
+	0x12	Dockable Device
 	0x30	X
 	0x31	Y
 	0x32	Z
@@ -43,6 +53,10 @@
 	0x46	Vno
 	0x47	Feature Notification
 	0x48	Resolution Multiplier
+	0x49	Qx
+	0x4A	Qy
+	0x4B	Qz
+	0x4C	Qw
 	0x80	System Control
 	0x81	System Power Down
 	0x82	System Sleep
@@ -63,6 +77,14 @@
 	0x91	D-pad Down
 	0x92	D-pad Right
 	0x93	D-pad Left
+	0x94	Index Trigger
+	0x95	Palm Trigger
+	0x96	Thumbstick
+	0x97	System Function Shift
+	0x98	System Function Shift Lock
+	0x99	System Function Shift Lock Indicator
+	0x9A	System Dismiss Notification
+	0x9B	System Do Not Disturb
 	0xA0	System Dock
 	0xA1	System Undock
 	0xA2	System Setup
@@ -80,6 +102,25 @@
 	0xB5	System Display Toggle Int/Ext
 	0xB6	System Display Swap Primary/Secondary
 	0xB7	System Display LCD Autoscale
+	0xC0	Sensor Zone
+	0xC1	RPM
+	0xC2	Coolant Level
+	0xC3	Coolant Critical Level
+	0xC4	Coolant Pump
+	0xC5	Chassis Enclosure
+	0xC6	Wireless Radio Button
+	0xC7	Wireless Radio LED
+	0xC8	Wireless Radio Slider Switch
+	0xC9	System Display Rotation Lock Button
+	0xCA	System Display Rotation Lock Slider Switch
+	0xCB	Control Enable
+	0xD0	Dockable Device Unique ID
+	0xD1	Dockable Device Vendor ID
+	0xD2	Dockable Device Primary Usage Page
+	0xD3	Dockable Device Primary Usage ID
+	0xD4	Dockable Device Docking State
+	0xD5	Dockable Device Display Occlusion
+	0xD6	Dockable Device Object Type
 
 2	Simulation Controls
 	0x00	Undefined
@@ -94,27 +135,26 @@
 	0x09	Airplane Simulation Device
 	0x0A	Helicopter Simulation Device
 	0x0B	Magic Carpet Simulation Device
-	0x0C	Bicycle
+	0x0C	Bicycle Simulation Device
 	0x20	Flight Control Stick
 	0x21	Flight Stick
 	0x22	Cyclic Control
 	0x23	Cyclic Trim
 	0x24	Flight Yoke
 	0x25	Track Control
-	0x26	Driving Control
 	0xB0	Aileron
 	0xB1	Aileron Trim
 	0xB2	Anti-Torque Control
-	0xB3	Auto-pilot Enable
+	0xB3	Autopilot Enable
 	0xB4	Chaff Release
 	0xB5	Collective Control
 	0xB6	Dive Brake
-	0xB7	Electronic Counter Measures
+	0xB7	Electronic Countermeasures
 	0xB8	Elevator
 	0xB9	Elevator Trim
 	0xBA	Rudder
 	0xBB	Throttle
-	0xBC	Flight Communication
+	0xBC	Flight Communications
 	0xBD	Flare Release
 	0xBE	Landing Gear
 	0xBF	Toe Brake
@@ -218,9 +258,11 @@
 	0x36	Gun Safety
 	0x37	Gamepad Fire/Jump
 	0x39	Gamepad Trigger
+	0x3A	Form-fitting Gamepad
 
 6	Device Controls
 	0x00	Undefined
+	0x06	Background/Nonuser Controls
 	0x20	Battery Strength
 	0x21	Wireless Channel
 	0x22	Wireless ID
@@ -228,6 +270,22 @@
 	0x24	Security Code Character Entered
 	0x25	Security Code Character Erased
 	0x26	Security Code Cleared
+	0x27	Sequence ID
+	0x28	Sequence ID Reset
+	0x29	RF Signal Strength
+	0x2A	Software Version
+	0x2B	Protocol Version
+	0x2C	Hardware Version
+	0x2D	Major
+	0x2E	Minor
+	0x2F	Revision
+	0x30	Handedness
+	0x31	Either Hand
+	0x32	Left Hand
+	0x33	Right Hand
+	0x34	Both Hands
+	0x40	Grip Pose Offset
+	0x41	Pointer Pose Offset
 
 7	Keyboard
 	0x00	No Event
@@ -529,6 +587,24 @@
 	0x4B	Generic Indicator
 	0x4C	System Suspend
 	0x4D	External Power Connected
+	0x4E	Indicator Blue
+	0x4F	Indicator Orange
+	0x50	Good Status
+	0x51	Warning Status
+	0x52	RGB LED
+	0x53	Red LED Channel
+	0x54	Blue LED Channel
+	0x55	Green LED Channel
+	0x56	LED Intensity
+	0x60	Player Indicator
+	0x61	Player 1
+	0x62	Player 2
+	0x63	Player 3
+	0x64	Player 4
+	0x65	Player 5
+	0x66	Player 6
+	0x67	Player 7
+	0x68	Player 8
 
 9	Button
 	0x00	No Button Pressed
@@ -605,6 +681,40 @@
 	0xBD	Phone Key B
 	0xBE	Phone Key C
 	0xBF	Phone Key D
+	0xC0	Phone Call History Key
+	0xC1	Phone Caller ID Key
+	0xC2	Phone Settings Key
+	0xF0	Host Control
+	0xF1	Host Available
+	0xF2	Host Call Active
+	0xF3	Activate Handset Audio
+	0xF4	Ring Type
+	0xF5	Re-dialable Phone Number
+	0xF8	Stop Ring Tone
+	0xF9	PSTN Ring Tone
+	0xFA	Host Ring Tone
+	0xFB	Alert Sound Error
+	

CVS commit: src/lib/libusbhid

2024-03-14 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Thu Mar 14 15:39:23 UTC 2024

Modified Files:
src/lib/libusbhid: usb_hid_usages

Log Message:
Sync with OpenBSD


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/lib/libusbhid/usb_hid_usages

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



CVS commit: src/lib/libusbhid

2024-03-14 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Thu Mar 14 15:27:23 UTC 2024

Modified Files:
src/lib/libusbhid: usb_hid_usages

Log Message:
Remove Reserved usages and ranges thereof

Helps align with future merge


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/lib/libusbhid/usb_hid_usages

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

Modified files:

Index: src/lib/libusbhid/usb_hid_usages
diff -u src/lib/libusbhid/usb_hid_usages:1.10 src/lib/libusbhid/usb_hid_usages:1.11
--- src/lib/libusbhid/usb_hid_usages:1.10	Thu Mar 14 15:23:52 2024
+++ src/lib/libusbhid/usb_hid_usages	Thu Mar 14 15:27:22 2024
@@ -1,4 +1,4 @@
-# $NetBSD: usb_hid_usages,v 1.10 2024/03/14 15:23:52 jakllsch Exp $
+# $NetBSD: usb_hid_usages,v 1.11 2024/03/14 15:27:22 jakllsch Exp $
 #
 # USB HID usage table
 # Syntax:
@@ -13,7 +13,6 @@
 	0x00	Undefined
 	0x01	Pointer
 	0x02	Mouse
-	0x03	Reserved
 	0x04	Joystick
 	0x05	Game Pad
 	0x06	Keyboard
@@ -530,7 +529,6 @@
 	0x4B	Generic Indicator
 	0x4C	System Suspend
 	0x4D	External Power Connected
-	0x4C-	Reserved
 
 9	Button
 	0x00	No Button Pressed



CVS commit: src/lib/libusbhid

2024-03-14 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Thu Mar 14 15:27:23 UTC 2024

Modified Files:
src/lib/libusbhid: usb_hid_usages

Log Message:
Remove Reserved usages and ranges thereof

Helps align with future merge


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/lib/libusbhid/usb_hid_usages

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



CVS commit: src/lib/libusbhid

2024-03-14 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Thu Mar 14 15:23:52 UTC 2024

Modified Files:
src/lib/libusbhid: usb_hid_usages

Log Message:
fix typos


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/lib/libusbhid/usb_hid_usages

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

Modified files:

Index: src/lib/libusbhid/usb_hid_usages
diff -u src/lib/libusbhid/usb_hid_usages:1.9 src/lib/libusbhid/usb_hid_usages:1.10
--- src/lib/libusbhid/usb_hid_usages:1.9	Sat Feb 10 09:21:52 2024
+++ src/lib/libusbhid/usb_hid_usages	Thu Mar 14 15:23:52 2024
@@ -1,4 +1,4 @@
-# $NetBSD: usb_hid_usages,v 1.9 2024/02/10 09:21:52 andvar Exp $
+# $NetBSD: usb_hid_usages,v 1.10 2024/03/14 15:23:52 jakllsch Exp $
 #
 # USB HID usage table
 # Syntax:
@@ -40,7 +40,7 @@
 	0x42	Vz
 	0x43	Vbrx
 	0x44	Vbry
-	0x45	Vbrx
+	0x45	Vbrz
 	0x46	Vno
 	0x47	Feature Notification
 	0x48	Resolution Multiplier
@@ -627,7 +627,7 @@
 	0x35	Illumination
 	0x36	Function Buttons
 	0x40	Menu
-	0x41	Menu  Pick
+	0x41	Menu Pick
 	0x42	Menu Up
 	0x43	Menu Down
 	0x44	Menu Left
@@ -688,7 +688,7 @@
 	0xB7	Stop
 	0xB8	Eject
 	0xB9	Random Play
-	0xBA	Select DisC
+	0xBA	Select Disc
 	0xBB	Enter Disc
 	0xBC	Repeat
 	0xBD	Tracking



CVS commit: src/lib/libusbhid

2024-03-14 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Thu Mar 14 15:23:52 UTC 2024

Modified Files:
src/lib/libusbhid: usb_hid_usages

Log Message:
fix typos


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/lib/libusbhid/usb_hid_usages

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/sparc64/gen

2024-03-11 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Mar 11 23:05:35 UTC 2024

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

Log Message:
fix lint


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 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/arch/sparc64/gen

2024-03-11 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Mar 11 23:05:35 UTC 2024

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

Log Message:
fix lint


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 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.7 src/lib/libc/arch/sparc64/gen/fpsetround.c:1.8
--- src/lib/libc/arch/sparc64/gen/fpsetround.c:1.7	Sun Oct 27 21:06:36 2013
+++ src/lib/libc/arch/sparc64/gen/fpsetround.c	Mon Mar 11 19:05:35 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpsetround.c,v 1.7 2013/10/28 01:06:36 mrg Exp $	*/
+/*	$NetBSD: fpsetround.c,v 1.8 2024/03/11 23:05:35 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.7 2013/10/28 01:06:36 mrg Exp $");
+__RCSID("$NetBSD: fpsetround.c,v 1.8 2024/03/11 23:05:35 christos Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include "namespace.h"
@@ -19,14 +19,15 @@ __RCSID("$NetBSD: fpsetround.c,v 1.7 201
 __weak_alias(fpsetround,_fpsetround)
 #endif
 
+#ifdef SOFTFLOATSPARC64_FOR_GCC
+extern fp_rnd _softfloat_float_rounding_mode;
+#endif
+
 fp_rnd
 fpsetround(fp_rnd rnd_dir)
 {
 	fp_rnd old;
 	fp_rnd new;
-#ifdef SOFTFLOATSPARC64_FOR_GCC
-	extern fp_rnd _softfloat_float_rounding_mode;
-#endif
 
 	__asm("st %%fsr,%0" : "=m" (*));
 
@@ -35,7 +36,7 @@ fpsetround(fp_rnd rnd_dir)
 #endif
 
 	new = old;
-	new &= ~(0x03 << 30); 
+	new &= ~(0x03U << 30); 
 	new |= ((rnd_dir & 0x03) << 30);
 
 	__asm("ld %0,%%fsr" : : "m" (*));



CVS commit: src/lib/libc/time

2024-03-11 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Mar 11 23:03:35 UTC 2024

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

Log Message:
add casts for compat code where time_t is 32 bits.


To generate a diff of this commit:
cvs rdiff -u -r1.142 -r1.143 src/lib/libc/time/localtime.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-11 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Mar 11 23:03:35 UTC 2024

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

Log Message:
add casts for compat code where time_t is 32 bits.


To generate a diff of this commit:
cvs rdiff -u -r1.142 -r1.143 src/lib/libc/time/localtime.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/localtime.c
diff -u src/lib/libc/time/localtime.c:1.142 src/lib/libc/time/localtime.c:1.143
--- src/lib/libc/time/localtime.c:1.142	Thu Mar  7 15:42:04 2024
+++ src/lib/libc/time/localtime.c	Mon Mar 11 19:03:35 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: localtime.c,v 1.142 2024/03/07 20:42:04 christos Exp $	*/
+/*	$NetBSD: localtime.c,v 1.143 2024/03/11 23:03:35 christos Exp $	*/
 
 /* Convert timestamp from time_t to struct tm.  */
 
@@ -12,7 +12,7 @@
 #if 0
 static char	elsieid[] = "@(#)localtime.c	8.17";
 #else
-__RCSID("$NetBSD: localtime.c,v 1.142 2024/03/07 20:42:04 christos Exp $");
+__RCSID("$NetBSD: localtime.c,v 1.143 2024/03/11 23:03:35 christos Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -1871,7 +1871,7 @@ timesub(const time_t *timep, int_fast32_
 	   for localtime values before 1970 when time_t is unsigned.  */
 	dayrem = (int)(tdays % DAYSPERREPEAT);
 	dayrem += dayoff % DAYSPERREPEAT;
-	y = (EPOCH_YEAR - YEARSPERREPEAT
+	y = (time_t)(EPOCH_YEAR - YEARSPERREPEAT
 	 + ((1 + dayoff / DAYSPERREPEAT + dayrem / DAYSPERREPEAT
 		 - ((dayrem % DAYSPERREPEAT) < 0)
 		 + tdays / DAYSPERREPEAT)
@@ -1884,7 +1884,7 @@ timesub(const time_t *timep, int_fast32_
 	while (year_lengths[isleap(y)] <= idays) {
 		int_fast32_t tdelta = idays / DAYSPERLYEAR;
 		int_fast32_t ydelta = tdelta + !tdelta;
-		time_t newy = y + ydelta;
+		time_t newy = (time_t)(y + ydelta);
 		register int	leapdays;
 		leapdays = (int)(leaps_thru_end_of(newy - 1) -
 			leaps_thru_end_of(y - 1));



CVS commit: src/lib/libc/compiler_rt

2024-03-10 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Mar 10 18:00:13 UTC 2024

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

Log Message:
compiler_rt: allow signed bit shifts for __negv

Standard C defines '1 << 31' as undefined behavior, but
https://gcc.gnu.org/onlinedocs/gcc/Integers-implementation.html allows
it for GCC.


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 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.46 src/lib/libc/compiler_rt/Makefile.inc:1.47
--- src/lib/libc/compiler_rt/Makefile.inc:1.46	Tue Jan 23 15:32:18 2024
+++ src/lib/libc/compiler_rt/Makefile.inc	Sun Mar 10 18:00:13 2024
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.inc,v 1.46 2024/01/23 15:32:18 christos Exp $
+# $NetBSD: Makefile.inc,v 1.47 2024/03/10 18:00:13 rillig Exp $
 
 COMPILER_RT_DIR=	${NETBSDSRCDIR}/sys/external/bsd/compiler_rt
 COMPILER_RT_SRCDIR=	${COMPILER_RT_DIR}/dist
@@ -396,9 +396,9 @@ LINTFLAGS.mulvti3.c += -X 117,351
 LINTFLAGS.negdf2.c += -X 309,351
 LINTFLAGS.negsf2.c += -X 132,351
 LINTFLAGS.negti2.c += -X 351
-LINTFLAGS.negvdi2.c += -X 351
-LINTFLAGS.negvsi2.c += -X 351
-LINTFLAGS.negvti2.c += -X 351
+LINTFLAGS.negvdi2.c += -X 141,351
+LINTFLAGS.negvsi2.c += -X 141,351
+LINTFLAGS.negvti2.c += -X 141,351
 LINTFLAGS.parityti2.c += -X 351
 LINTFLAGS.popcountdi2.c += -X 351
 LINTFLAGS.popcountsi2.c += -X 351



CVS commit: src/lib/libc/compiler_rt

2024-03-10 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Mar 10 18:00:13 UTC 2024

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

Log Message:
compiler_rt: allow signed bit shifts for __negv

Standard C defines '1 << 31' as undefined behavior, but
https://gcc.gnu.org/onlinedocs/gcc/Integers-implementation.html allows
it for GCC.


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 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/libcrypt

2024-03-09 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Mar  9 13:48:50 UTC 2024

Modified Files:
src/lib/libcrypt: crypt-argon2.c

Log Message:
Don't use uninitialized variable.
Fixes PR 57895.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/lib/libcrypt/crypt-argon2.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/libcrypt/crypt-argon2.c
diff -u src/lib/libcrypt/crypt-argon2.c:1.19 src/lib/libcrypt/crypt-argon2.c:1.20
--- src/lib/libcrypt/crypt-argon2.c:1.19	Sun May 29 12:15:00 2022
+++ src/lib/libcrypt/crypt-argon2.c	Sat Mar  9 13:48:50 2024
@@ -207,7 +207,7 @@ estimate_argon2_params(argon2_type atype
 
 		if (clock_gettime(CLOCK_MONOTONIC, ) == -1)
 			goto error;
-		for (; delta.tv_sec < 1 && time < ARGON2_MAX_TIME; ++time) {
+		for (; time < ARGON2_MAX_TIME; ++time) {
 			if (argon2_hash(time, memory, threads,
 			tmp_pwd, sizeof(tmp_pwd), 
 			tmp_salt, sizeof(tmp_salt), 
@@ -221,6 +221,8 @@ estimate_argon2_params(argon2_type atype
 			if (timespeccmp(, , >))
 break; /* broken system... */
 			timespecsub(, , );
+			if (delta.tv_sec >= 1)
+break;
 		}
 	} else {
 		time = *etime;



CVS commit: src/lib/libcrypt

2024-03-09 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Mar  9 13:48:50 UTC 2024

Modified Files:
src/lib/libcrypt: crypt-argon2.c

Log Message:
Don't use uninitialized variable.
Fixes PR 57895.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/lib/libcrypt/crypt-argon2.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-07 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Mar  7 20:42:04 UTC 2024

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

Log Message:
pass lint on sparc64 where int_fast32_t is long.


To generate a diff of this commit:
cvs rdiff -u -r1.141 -r1.142 src/lib/libc/time/localtime.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/localtime.c
diff -u src/lib/libc/time/localtime.c:1.141 src/lib/libc/time/localtime.c:1.142
--- src/lib/libc/time/localtime.c:1.141	Sat Feb 17 09:54:47 2024
+++ src/lib/libc/time/localtime.c	Thu Mar  7 15:42:04 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: localtime.c,v 1.141 2024/02/17 14:54:47 christos Exp $	*/
+/*	$NetBSD: localtime.c,v 1.142 2024/03/07 20:42:04 christos Exp $	*/
 
 /* Convert timestamp from time_t to struct tm.  */
 
@@ -12,7 +12,7 @@
 #if 0
 static char	elsieid[] = "@(#)localtime.c	8.17";
 #else
-__RCSID("$NetBSD: localtime.c,v 1.141 2024/02/17 14:54:47 christos Exp $");
+__RCSID("$NetBSD: localtime.c,v 1.142 2024/03/07 20:42:04 christos Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -569,10 +569,10 @@ tzloadbody(char const *name, struct stat
 		   && (ttisutcnt == typecnt || ttisutcnt == 0)))
 		  return EINVAL;
 
-		sp->leapcnt = leapcnt;
-		sp->timecnt = timecnt;
-		sp->typecnt = typecnt;
-		sp->charcnt = charcnt;
+		sp->leapcnt = (int)leapcnt;
+		sp->timecnt = (int)timecnt;
+		sp->typecnt = (int)typecnt;
+		sp->charcnt = (int)charcnt;
 
 		/* Read transitions, discarding those out of time_t range.
 		   But pretend the last transition before TIME_T_MIN
@@ -605,7 +605,7 @@ tzloadbody(char const *name, struct stat
 			if (sp->types[i])
 sp->types[timecnt++] = typ;
 		}
-		sp->timecnt = timecnt;
+		sp->timecnt = (int)timecnt;
 		for (i = 0; i < sp->typecnt; ++i) {
 			register struct ttinfo *	ttisp;
 			unsigned char isdst, desigidx;
@@ -660,7 +660,7 @@ tzloadbody(char const *name, struct stat
 		leapcnt++;
 		  }
 		}
-		sp->leapcnt = leapcnt;
+		sp->leapcnt = (int)leapcnt;
 
 		for (i = 0; i < sp->typecnt; ++i) {
 			register struct ttinfo *	ttisp;
@@ -725,7 +725,7 @@ tzloadbody(char const *name, struct stat
 			  size_t tsabbrlen = strlen(tsabbr);
 			  if (j + tsabbrlen < TZ_MAX_CHARS) {
 strcpy(sp->chars + j, tsabbr);
-charcnt = (int_fast32_t)(j + tsabbrlen + 1);
+charcnt = (int)(j + tsabbrlen + 1);
 ts->ttis[i].tt_desigidx = j;
 gotabbr++;
 			  }
@@ -1878,11 +1878,11 @@ timesub(const time_t *timep, int_fast32_
 		* YEARSPERREPEAT));
 	/* idays = (tdays + dayoff) mod DAYSPERREPEAT, sans overflow.  */
 	idays = (int)(tdays % DAYSPERREPEAT);
-	idays += dayoff % DAYSPERREPEAT + 2 * DAYSPERREPEAT;
+	idays += (dayoff % DAYSPERREPEAT + 2 * DAYSPERREPEAT);
 	idays %= DAYSPERREPEAT;
 	/* Increase Y and decrease IDAYS until IDAYS is in range for Y.  */
 	while (year_lengths[isleap(y)] <= idays) {
-		int tdelta = idays / DAYSPERLYEAR;
+		int_fast32_t tdelta = idays / DAYSPERLYEAR;
 		int_fast32_t ydelta = tdelta + !tdelta;
 		time_t newy = y + ydelta;
 		register int	leapdays;
@@ -1910,7 +1910,7 @@ timesub(const time_t *timep, int_fast32_
 	  return NULL;
 	}
 #endif
-	tmp->tm_yday = idays;
+	tmp->tm_yday = (int)idays;
 	/*
 	** The "extra" mods below avoid overflow problems.
 	*/
@@ -1925,8 +1925,8 @@ timesub(const time_t *timep, int_fast32_
 		tmp->tm_wday += DAYSPERWEEK;
 	tmp->tm_hour = (int) (rem / SECSPERHOUR);
 	rem %= SECSPERHOUR;
-	tmp->tm_min = rem / SECSPERMIN;
-	tmp->tm_sec = rem % SECSPERMIN;
+	tmp->tm_min = (int)(rem / SECSPERMIN);
+	tmp->tm_sec = (int)(rem % SECSPERMIN);
 
 	/* Use "... ??:??:60" at the end of the localtime minute containing
 	   the second just before the positive leap second.  */
@@ -1935,7 +1935,7 @@ timesub(const time_t *timep, int_fast32_
 	ip = mon_lengths[isleap(y)];
 	for (tmp->tm_mon = 0; idays >= ip[tmp->tm_mon]; ++(tmp->tm_mon))
 		idays -= ip[tmp->tm_mon];
-	tmp->tm_mday = idays + 1;
+	tmp->tm_mday = (int)(idays + 1);
 	tmp->tm_isdst = 0;
 #ifdef TM_GMTOFF
 	tmp->TM_GMTOFF = offset;



CVS commit: src/lib/libc/time

2024-03-07 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Mar  7 20:42:04 UTC 2024

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

Log Message:
pass lint on sparc64 where int_fast32_t is long.


To generate a diff of this commit:
cvs rdiff -u -r1.141 -r1.142 src/lib/libc/time/localtime.c

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



CVS commit: src/lib/libutil

2024-02-29 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Feb 29 21:08:55 UTC 2024

Modified Files:
src/lib/libutil: snprintb.3

Log Message:
snprintb.3: fix typo


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/lib/libutil/snprintb.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/libutil/snprintb.3
diff -u src/lib/libutil/snprintb.3:1.35 src/lib/libutil/snprintb.3:1.36
--- src/lib/libutil/snprintb.3:1.35	Thu Feb 22 21:04:24 2024
+++ src/lib/libutil/snprintb.3	Thu Feb 29 21:08:54 2024
@@ -1,4 +1,4 @@
-.\" $NetBSD: snprintb.3,v 1.35 2024/02/22 21:04:24 rillig Exp $
+.\" $NetBSD: snprintb.3,v 1.36 2024/02/29 21:08:54 rillig Exp $
 .\"
 .\" Copyright (c) 1998, 2024 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -69,7 +69,7 @@ terminating
 If
 .Fa bufsize
 is zero, nothing is written and
-.Fa arg
+.Fa buf
 may be a null pointer.
 .Pp
 The



CVS commit: src/lib/libutil

2024-02-29 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Feb 29 21:08:55 UTC 2024

Modified Files:
src/lib/libutil: snprintb.3

Log Message:
snprintb.3: fix typo


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/lib/libutil/snprintb.3

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



CVS commit: src/lib/libutil

2024-02-29 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Feb 29 20:55:35 UTC 2024

Modified Files:
src/lib/libutil: parsedate.y

Log Message:
parsedate.y: remove outdated comment

The number of shift/reduce conflicts has grown to 16.


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/lib/libutil/parsedate.y

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

Modified files:

Index: src/lib/libutil/parsedate.y
diff -u src/lib/libutil/parsedate.y:1.37 src/lib/libutil/parsedate.y:1.38
--- src/lib/libutil/parsedate.y:1.37	Sat Apr 23 13:02:04 2022
+++ src/lib/libutil/parsedate.y	Thu Feb 29 20:55:35 2024
@@ -5,8 +5,6 @@
 **  a couple of people on Usenet.  Completely overhauled by Rich $alz
 **   and Jim Berets  in August, 1990;
 **
-**  This grammar has 10 shift/reduce conflicts.
-**
 **  This code is in the public domain and has no copyright.
 */
 /* SUPPRESS 287 on yaccpar_sccsid *//* Unused static variable */
@@ -14,7 +12,7 @@
 
 #include 
 #ifdef __RCSID
-__RCSID("$NetBSD: parsedate.y,v 1.37 2022/04/23 13:02:04 christos Exp $");
+__RCSID("$NetBSD: parsedate.y,v 1.38 2024/02/29 20:55:35 rillig Exp $");
 #endif
 
 #include 



CVS commit: src/lib/libutil

2024-02-29 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Feb 29 20:55:35 UTC 2024

Modified Files:
src/lib/libutil: parsedate.y

Log Message:
parsedate.y: remove outdated comment

The number of shift/reduce conflicts has grown to 16.


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/lib/libutil/parsedate.y

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



CVS commit: src/lib/libc/softfloat/bits64

2024-02-27 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Feb 27 15:14:15 UTC 2024

Modified Files:
src/lib/libc/softfloat/bits64: softfloat.c

Log Message:
appease lint


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/lib/libc/softfloat/bits64/softfloat.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/softfloat/bits64/softfloat.c
diff -u src/lib/libc/softfloat/bits64/softfloat.c:1.14 src/lib/libc/softfloat/bits64/softfloat.c:1.15
--- src/lib/libc/softfloat/bits64/softfloat.c:1.14	Tue Mar 29 14:42:29 2016
+++ src/lib/libc/softfloat/bits64/softfloat.c	Tue Feb 27 10:14:15 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: softfloat.c,v 1.14 2016/03/29 18:42:29 martin Exp $ */
+/* $NetBSD: softfloat.c,v 1.15 2024/02/27 15:14:15 christos Exp $ */
 
 /*
  * This version hacked for use with gcc -msoft-float by bjh21.
@@ -46,7 +46,7 @@ this code that are retained.
 
 #include 
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: softfloat.c,v 1.14 2016/03/29 18:42:29 martin Exp $");
+__RCSID("$NetBSD: softfloat.c,v 1.15 2024/02/27 15:14:15 christos Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #ifdef SOFTFLOAT_FOR_GCC
@@ -5261,7 +5261,7 @@ float128 float128_sqrt( float128 a )
 if ( ( aSig0 | aSig1 ) == 0 ) return packFloat128( 0, 0, 0, 0 );
 normalizeFloat128Subnormal( aSig0, aSig1, , ,  );
 }
-zExp = (int32) ( (aExp - 0x3FFF) >> 1) + 0x3FFE;
+zExp = (int32) ( (bits32)(aExp - 0x3FFF) >> 1) + 0x3FFE;
 aSig0 |= LIT64( 0x0001 );
 zSig0 = estimateSqrt32((int16)aExp, (bits32)(aSig0>>17));
 shortShift128Left( aSig0, aSig1, 13 - ( aExp & 1 ), ,  );



CVS commit: src/lib/libc/softfloat/bits64

2024-02-27 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Feb 27 15:14:15 UTC 2024

Modified Files:
src/lib/libc/softfloat/bits64: softfloat.c

Log Message:
appease lint


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/lib/libc/softfloat/bits64/softfloat.c

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



CVS commit: src/lib

2024-02-26 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Mon Feb 26 20:16:16 UTC 2024

Modified Files:
src/lib: Makefile

Log Message:
revert previous - it doesn't mean what i thought and some builds broke.


To generate a diff of this commit:
cvs rdiff -u -r1.298 -r1.299 src/lib/Makefile

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

Modified files:

Index: src/lib/Makefile
diff -u src/lib/Makefile:1.298 src/lib/Makefile:1.299
--- src/lib/Makefile:1.298	Sun Feb 25 20:25:09 2024
+++ src/lib/Makefile	Mon Feb 26 20:16:16 2024
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.298 2024/02/25 20:25:09 mrg Exp $
+#	$NetBSD: Makefile,v 1.299 2024/02/26 20:16:16 mrg Exp $
 #	from: @(#)Makefile	5.25.1.1 (Berkeley) 5/7/91
 
 .include 
@@ -193,7 +193,7 @@ SUBDIR+=	.WAIT
 
 SUBDIR+=	libwrap
 
-.if (${MKGCC} != "no" && ${MKCXX} != "no" && ${MKLIBSTDCXX} != "no" && ${MKSANITIZER:Uno} == "yes")
+.if (${MKGCC} != "no" && ${MKCXX} != "no" && ${MKLIBSTDCXX} != "no")
 .for sanitizer in asan lsan ubsan
 .if exists(../external/gpl3/${EXTERNAL_GCC_SUBDIR}/lib/lib${sanitizer})
 SUBDIR+= ../external/gpl3/${EXTERNAL_GCC_SUBDIR}/lib/lib${sanitizer}



CVS commit: src/lib

2024-02-26 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Mon Feb 26 20:16:16 UTC 2024

Modified Files:
src/lib: Makefile

Log Message:
revert previous - it doesn't mean what i thought and some builds broke.


To generate a diff of this commit:
cvs rdiff -u -r1.298 -r1.299 src/lib/Makefile

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



CVS commit: src/lib

2024-02-25 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sun Feb 25 20:25:09 UTC 2024

Modified Files:
src/lib: Makefile

Log Message:
skip sanitizers if MKSANITIZER "no".


To generate a diff of this commit:
cvs rdiff -u -r1.297 -r1.298 src/lib/Makefile

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



CVS commit: src/lib

2024-02-25 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sun Feb 25 20:25:09 UTC 2024

Modified Files:
src/lib: Makefile

Log Message:
skip sanitizers if MKSANITIZER "no".


To generate a diff of this commit:
cvs rdiff -u -r1.297 -r1.298 src/lib/Makefile

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

Modified files:

Index: src/lib/Makefile
diff -u src/lib/Makefile:1.297 src/lib/Makefile:1.298
--- src/lib/Makefile:1.297	Wed Sep  6 23:44:43 2023
+++ src/lib/Makefile	Sun Feb 25 20:25:09 2024
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.297 2023/09/06 23:44:43 riastradh Exp $
+#	$NetBSD: Makefile,v 1.298 2024/02/25 20:25:09 mrg Exp $
 #	from: @(#)Makefile	5.25.1.1 (Berkeley) 5/7/91
 
 .include 
@@ -193,7 +193,7 @@ SUBDIR+=	.WAIT
 
 SUBDIR+=	libwrap
 
-.if (${MKGCC} != "no" && ${MKCXX} != "no" && ${MKLIBSTDCXX} != "no")
+.if (${MKGCC} != "no" && ${MKCXX} != "no" && ${MKLIBSTDCXX} != "no" && ${MKSANITIZER:Uno} == "yes")
 .for sanitizer in asan lsan ubsan
 .if exists(../external/gpl3/${EXTERNAL_GCC_SUBDIR}/lib/lib${sanitizer})
 SUBDIR+= ../external/gpl3/${EXTERNAL_GCC_SUBDIR}/lib/lib${sanitizer}



CVS commit: src/lib/libm/src

2024-02-25 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Feb 25 19:26:34 UTC 2024

Modified Files:
src/lib/libm/src: s_fabsl.c

Log Message:
fabsl is defined in libc...


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/lib/libm/src/s_fabsl.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/libm/src/s_fabsl.c
diff -u src/lib/libm/src/s_fabsl.c:1.5 src/lib/libm/src/s_fabsl.c:1.6
--- src/lib/libm/src/s_fabsl.c:1.5	Sat Feb 24 10:16:53 2024
+++ src/lib/libm/src/s_fabsl.c	Sun Feb 25 14:26:33 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: s_fabsl.c,v 1.5 2024/02/24 15:16:53 christos Exp $	*/
+/*	$NetBSD: s_fabsl.c,v 1.6 2024/02/25 19:26:33 christos Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -26,7 +26,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__RCSID("$NetBSD: s_fabsl.c,v 1.5 2024/02/24 15:16:53 christos Exp $");
+__RCSID("$NetBSD: s_fabsl.c,v 1.6 2024/02/25 19:26:33 christos Exp $");
 
 #include 
 #include 
@@ -47,9 +47,12 @@ fabsl(long double x)
 	return (ux.extu_ld);
 }
 #else
+#if 0
+/* defined in libc */
 long double
 fabsl(long double x)
 {
 	return fabs(x);
 }
 #endif
+#endif



CVS commit: src/lib/libm/src

2024-02-25 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Feb 25 19:26:34 UTC 2024

Modified Files:
src/lib/libm/src: s_fabsl.c

Log Message:
fabsl is defined in libc...


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/lib/libm/src/s_fabsl.c

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



CVS commit: src/lib/libm/src

2024-02-24 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sat Feb 24 19:32:09 UTC 2024

Modified Files:
src/lib/libm/src: namespace.h s_atanl.c s_remquo.c s_remquof.c
s_remquol.c

Log Message:
fix some fallout from 32-bit fixes for long double functions.

apply namespace.h to remqou*.  add missing weak aliases for some of them,
and normalise checkf for __weak_alias().

now libm.so seems to only have libc undefined symbols.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/lib/libm/src/namespace.h
cvs rdiff -u -r1.4 -r1.5 src/lib/libm/src/s_atanl.c \
src/lib/libm/src/s_remquol.c
cvs rdiff -u -r1.1 -r1.2 src/lib/libm/src/s_remquo.c \
src/lib/libm/src/s_remquof.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/libm/src/namespace.h
diff -u src/lib/libm/src/namespace.h:1.18 src/lib/libm/src/namespace.h:1.19
--- src/lib/libm/src/namespace.h:1.18	Sun Jan 21 18:53:18 2024
+++ src/lib/libm/src/namespace.h	Sat Feb 24 19:32:09 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: namespace.h,v 1.18 2024/01/21 18:53:18 christos Exp $ */
+/* $NetBSD: namespace.h,v 1.19 2024/02/24 19:32:09 mrg Exp $ */
 
 #define atan2 _atan2
 #define atan2f _atan2f
@@ -37,6 +37,10 @@
 #define asinf _asinf
 #define asinl _asinl
 
+#define remquo _remquo
+#define remquof _remquof
+#define remquol _remquol
+
 #define casin _casin
 #define casinf _casinf
 #define casinl _casinl

Index: src/lib/libm/src/s_atanl.c
diff -u src/lib/libm/src/s_atanl.c:1.4 src/lib/libm/src/s_atanl.c:1.5
--- src/lib/libm/src/s_atanl.c:1.4	Sat Feb 24 15:16:53 2024
+++ src/lib/libm/src/s_atanl.c	Sat Feb 24 19:32:09 2024
@@ -19,7 +19,9 @@
 #include "math.h"
 #include "math_private.h"
 
+#ifdef __weak_alias
 __weak_alias(atanl, _atanl)
+#endif
 
 #ifdef __HAVE_LONG_DOUBLE
 
Index: src/lib/libm/src/s_remquol.c
diff -u src/lib/libm/src/s_remquol.c:1.4 src/lib/libm/src/s_remquol.c:1.5
--- src/lib/libm/src/s_remquol.c:1.4	Sat Feb 24 15:16:53 2024
+++ src/lib/libm/src/s_remquol.c	Sat Feb 24 19:32:09 2024
@@ -10,6 +10,9 @@
  */
 
 #include 
+
+#include "namespace.h"
+
 #include 
 #include 
 #include 

Index: src/lib/libm/src/s_remquo.c
diff -u src/lib/libm/src/s_remquo.c:1.1 src/lib/libm/src/s_remquo.c:1.2
--- src/lib/libm/src/s_remquo.c:1.1	Sun Feb  6 01:53:38 2011
+++ src/lib/libm/src/s_remquo.c	Sat Feb 24 19:32:09 2024
@@ -12,11 +12,17 @@
 
 #include 
 
+#include "namespace.h"
+
 #include 
 
 #include "math.h"
 #include "math_private.h"
 
+#ifdef __weak_alias
+__weak_alias(remquo, _remquo)
+#endif
+
 static const double Zero[] = {0.0, -0.0,};
 
 /*
Index: src/lib/libm/src/s_remquof.c
diff -u src/lib/libm/src/s_remquof.c:1.1 src/lib/libm/src/s_remquof.c:1.2
--- src/lib/libm/src/s_remquof.c:1.1	Sun Feb  6 01:53:38 2011
+++ src/lib/libm/src/s_remquof.c	Sat Feb 24 19:32:09 2024
@@ -12,9 +12,15 @@
 
 #include 
 
+#include "namespace.h"
+
 #include "math.h"
 #include "math_private.h"
 
+#ifdef __weak_alias
+__weak_alias(remquof, _remquof)
+#endif
+
 static const float Zero[] = {0.0, -0.0,};
 
 /*



CVS commit: src/lib/libm/src

2024-02-24 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sat Feb 24 19:32:09 UTC 2024

Modified Files:
src/lib/libm/src: namespace.h s_atanl.c s_remquo.c s_remquof.c
s_remquol.c

Log Message:
fix some fallout from 32-bit fixes for long double functions.

apply namespace.h to remqou*.  add missing weak aliases for some of them,
and normalise checkf for __weak_alias().

now libm.so seems to only have libc undefined symbols.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/lib/libm/src/namespace.h
cvs rdiff -u -r1.4 -r1.5 src/lib/libm/src/s_atanl.c \
src/lib/libm/src/s_remquol.c
cvs rdiff -u -r1.1 -r1.2 src/lib/libm/src/s_remquo.c \
src/lib/libm/src/s_remquof.c

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



CVS commit: src/lib/libm/src

2024-02-24 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Feb 24 15:16:53 UTC 2024

Modified Files:
src/lib/libm/src: b_tgammal.c e_acoshl.c e_acosl.c e_asinl.c e_atanhl.c
s_asinhl.c s_atanl.c s_cospil.c s_erfl.c s_exp2l.c s_fabsl.c
s_llrintl.c s_logl.c s_lrintl.c s_nearbyint.c s_remquol.c
s_sincosl.c s_sinpil.c s_tanhl.c s_tanpil.c

Log Message:
add missing symbols for non long double architectures.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/lib/libm/src/b_tgammal.c \
src/lib/libm/src/e_acoshl.c src/lib/libm/src/e_acosl.c \
src/lib/libm/src/e_asinl.c src/lib/libm/src/e_atanhl.c \
src/lib/libm/src/s_asinhl.c src/lib/libm/src/s_cospil.c \
src/lib/libm/src/s_erfl.c src/lib/libm/src/s_exp2l.c \
src/lib/libm/src/s_sincosl.c src/lib/libm/src/s_sinpil.c \
src/lib/libm/src/s_tanhl.c src/lib/libm/src/s_tanpil.c
cvs rdiff -u -r1.3 -r1.4 src/lib/libm/src/s_atanl.c \
src/lib/libm/src/s_llrintl.c src/lib/libm/src/s_logl.c \
src/lib/libm/src/s_lrintl.c src/lib/libm/src/s_remquol.c
cvs rdiff -u -r1.4 -r1.5 src/lib/libm/src/s_fabsl.c \
src/lib/libm/src/s_nearbyint.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/libm/src/b_tgammal.c
diff -u src/lib/libm/src/b_tgammal.c:1.2 src/lib/libm/src/b_tgammal.c:1.3
--- src/lib/libm/src/b_tgammal.c:1.2	Tue Jan 23 10:45:07 2024
+++ src/lib/libm/src/b_tgammal.c	Sat Feb 24 10:16:53 2024
@@ -1,4 +1,4 @@
-/* 	$NetBSD: b_tgammal.c,v 1.2 2024/01/23 15:45:07 christos Exp $	*/
+/* 	$NetBSD: b_tgammal.c,v 1.3 2024/02/24 15:16:53 christos Exp $	*/
 
 /*-
  * Copyright (c) 2023 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 #include 
 #if defined(LIBM_SCCS) && !defined(lint)
-__RCSID("$NetBSD: b_tgammal.c,v 1.2 2024/01/23 15:45:07 christos Exp $");
+__RCSID("$NetBSD: b_tgammal.c,v 1.3 2024/02/24 15:16:53 christos Exp $");
 #endif
 
 #include "namespace.h"
@@ -38,13 +38,12 @@ __RCSID("$NetBSD: b_tgammal.c,v 1.2 2024
 #include 
 #include 
 
-
-#ifdef __HAVE_LONG_DOUBLE
-
 #ifdef __weak_alias
 __weak_alias(tgammal,_tgammal)
 #endif
 
+#ifdef __HAVE_LONG_DOUBLE
+
 #if LDBL_MANT_DIG == 64
 #include "../ld80/b_tgammal.c"
 #elif LDBL_MANT_DIG == 113
@@ -55,8 +54,10 @@ __weak_alias(tgammal,_tgammal)
 
 #else
 
-#ifdef __weak_alias
-__weak_alias(tgammal, tgamma)
-#endif
+long double 
+tgammal(long double x)
+{  
+	return tgamma(x);
+}
 
 #endif
Index: src/lib/libm/src/e_acoshl.c
diff -u src/lib/libm/src/e_acoshl.c:1.2 src/lib/libm/src/e_acoshl.c:1.3
--- src/lib/libm/src/e_acoshl.c:1.2	Sat Jan 27 00:50:42 2024
+++ src/lib/libm/src/e_acoshl.c	Sat Feb 24 10:16:53 2024
@@ -22,9 +22,10 @@
 #include "math.h"
 #include "math_private.h"
 
-#ifdef __HAVE_LONG_DOUBLE
 __weak_alias(acoshl, _acoshl)
 
+#ifdef __HAVE_LONG_DOUBLE
+
 /*
  * See e_acosh.c for complete comments.
  *
@@ -92,6 +93,9 @@ acoshl(long double x)
 	}
 }
 #else
-
-__weak_alias(acoshl, acosh)
+long double
+acoshl(long double x)
+{
+	return acosh(x);
+}
 #endif
Index: src/lib/libm/src/e_acosl.c
diff -u src/lib/libm/src/e_acosl.c:1.2 src/lib/libm/src/e_acosl.c:1.3
--- src/lib/libm/src/e_acosl.c:1.2	Sat Jan 27 00:50:42 2024
+++ src/lib/libm/src/e_acosl.c	Sat Feb 24 10:16:53 2024
@@ -24,9 +24,10 @@
 #include "math.h"
 #include "math_private.h"
 
-#ifdef __HAVE_LONG_DOUBLE
 __weak_alias(acosl, _acosl)
 
+#ifdef __HAVE_LONG_DOUBLE
+
 #if LDBL_MANT_DIG == 64
 #include "../ld80/invtrig.h"
 #elif LDBL_MANT_DIG == 113
@@ -99,5 +100,9 @@ acosl(long double x)
 	}
 }
 #else
-__weak_alias(acosl, acos)
+long double
+acosl(long double x)
+{
+	return acos(x);
+}
 #endif
Index: src/lib/libm/src/e_asinl.c
diff -u src/lib/libm/src/e_asinl.c:1.2 src/lib/libm/src/e_asinl.c:1.3
--- src/lib/libm/src/e_asinl.c:1.2	Sat Jan 27 00:50:42 2024
+++ src/lib/libm/src/e_asinl.c	Sat Feb 24 10:16:53 2024
@@ -24,10 +24,10 @@
 #include "math.h"
 #include "math_private.h"
 
-#ifdef __HAVE_LONG_DOUBLE
-
 __weak_alias(asinl, _asinl)
 
+#ifdef __HAVE_LONG_DOUBLE
+
 #if LDBL_MANT_DIG == 64
 #include "../ld80/invtrig.h"
 #elif LDBL_MANT_DIG == 113
@@ -90,5 +90,9 @@ asinl(long double x)
 	if(expsign>0) return t; else return -t;
 }
 #else
-__weak_alias(asinl, _asin)
+long double
+asinl(long double x)
+{
+	return asin(x);
+}
 #endif
Index: src/lib/libm/src/e_atanhl.c
diff -u src/lib/libm/src/e_atanhl.c:1.2 src/lib/libm/src/e_atanhl.c:1.3
--- src/lib/libm/src/e_atanhl.c:1.2	Sat Jan 27 00:50:42 2024
+++ src/lib/libm/src/e_atanhl.c	Sat Feb 24 10:16:53 2024
@@ -22,8 +22,9 @@
 #include "math.h"
 #include "math_private.h"
 
-#ifdef __HAVE_LONG_DOUBLE
 __weak_alias(atanhl, _atanhl)
+
+#ifdef __HAVE_LONG_DOUBLE
 /*
  * See e_atanh.c for complete comments.
  *
@@ -76,5 +77,9 @@ atanhl(long double x)
 	RETURNI((hx & 0x8000) == 0 ? t : -t);
 }
 #else
-__weak_alias(atanhl, atanh)
+long double
+atanhl(long double x)
+{
+	return atanh(x);
+}
 #endif
Index: src/lib/libm/src/s_asinhl.c

  1   2   3   4   5   6   7   8   9   10   >