CVS commit: [netbsd-10] src/lib/libc/gen

2024-04-28 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Apr 28 13:23:20 UTC 2024

Modified Files:
src/lib/libc/gen [netbsd-10]: usleep.3 usleep.c

Log Message:
Pull up following revision(s) (requested by jdolecek in ticket #678):

lib/libc/gen/usleep.c: revision 1.21
lib/libc/gen/usleep.3: revision 1.20
lib/libc/gen/usleep.3: revision 1.21

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

it's nanosleep(2), not nanosleep(3)


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.19.56.1 src/lib/libc/gen/usleep.3
cvs rdiff -u -r1.20 -r1.20.42.1 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: [netbsd-10] src/lib/libc/gen

2024-04-28 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Apr 28 13:23:20 UTC 2024

Modified Files:
src/lib/libc/gen [netbsd-10]: usleep.3 usleep.c

Log Message:
Pull up following revision(s) (requested by jdolecek in ticket #678):

lib/libc/gen/usleep.c: revision 1.21
lib/libc/gen/usleep.3: revision 1.20
lib/libc/gen/usleep.3: revision 1.21

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

it's nanosleep(2), not nanosleep(3)


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.19.56.1 src/lib/libc/gen/usleep.3
cvs rdiff -u -r1.20 -r1.20.42.1 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.19.56.1
--- src/lib/libc/gen/usleep.3:1.19	Thu Apr 29 17:29:56 2010
+++ src/lib/libc/gen/usleep.3	Sun Apr 28 13:23:20 2024
@@ -1,4 +1,4 @@
-.\"	$NetBSD: usleep.3,v 1.19 2010/04/29 17:29:56 jruoho Exp $
+.\"	$NetBSD: usleep.3,v 1.19.56.1 2024/04/28 13:23:20 martin 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 2 .
+.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.20.42.1
--- src/lib/libc/gen/usleep.c:1.20	Mon Jun 25 22:32:44 2012
+++ src/lib/libc/gen/usleep.c	Sun Apr 28 13:23:20 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: usleep.c,v 1.20 2012/06/25 22:32:44 abs Exp $	*/
+/*	$NetBSD: usleep.c,v 1.20.42.1 2024/04/28 13:23:20 martin 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.20.42.1 2024/04/28 13:23:20 martin 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: [netbsd-10] src/lib/libc/gen

2024-03-11 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Mar 11 20:00:54 UTC 2024

Modified Files:
src/lib/libc/gen [netbsd-10]: getcap.c

Log Message:
Pull up following revision(s) (requested by ozaki-r in ticket #630):

lib/libc/gen/getcap.c: revision 1.58

Fix memory leak in getent()

Memory was not freed if record was not found


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.57.16.1 src/lib/libc/gen/getcap.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/getcap.c
diff -u src/lib/libc/gen/getcap.c:1.57 src/lib/libc/gen/getcap.c:1.57.16.1
--- src/lib/libc/gen/getcap.c:1.57	Sun Jun 18 03:56:39 2017
+++ src/lib/libc/gen/getcap.c	Mon Mar 11 20:00:53 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: getcap.c,v 1.57 2017/06/18 03:56:39 manu Exp $	*/
+/*	$NetBSD: getcap.c,v 1.57.16.1 2024/03/11 20:00:53 martin Exp $	*/
 
 /*-
  * Copyright (c) 1992, 1993
@@ -41,7 +41,7 @@
 #if 0
 static char sccsid[] = "@(#)getcap.c	8.3 (Berkeley) 3/25/94";
 #else
-__RCSID("$NetBSD: getcap.c,v 1.57 2017/06/18 03:56:39 manu Exp $");
+__RCSID("$NetBSD: getcap.c,v 1.57.16.1 2024/03/11 20:00:53 martin Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -502,8 +502,10 @@ getent(char **cap, size_t *len, const ch
 			break;
 	}
 
-	if (!foundit)
+	if (!foundit) {
+		free(record);
 		return -1;
+	}
 
 	/*
 	 * Got the capability record, but now we have to expand all tc=name



CVS commit: [netbsd-10] src/lib/libc/gen

2024-03-11 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Mar 11 20:00:54 UTC 2024

Modified Files:
src/lib/libc/gen [netbsd-10]: getcap.c

Log Message:
Pull up following revision(s) (requested by ozaki-r in ticket #630):

lib/libc/gen/getcap.c: revision 1.58

Fix memory leak in getent()

Memory was not freed if record was not found


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.57.16.1 src/lib/libc/gen/getcap.c

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



CVS commit: [netbsd-10] src/lib/libc/gen

2023-01-06 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Jan  6 13:44:41 UTC 2023

Modified Files:
src/lib/libc/gen [netbsd-10]: err.3

Log Message:
Pull up following revision(s) (requested by kre in ticket #37):

lib/libc/gen/err.3: revision 1.23

Add errc() and verrc() to the list of functions which do not return,
but exit() instead.

This was omitted when the *c() set of functions were added in 2014.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.22.16.1 src/lib/libc/gen/err.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/err.3
diff -u src/lib/libc/gen/err.3:1.22 src/lib/libc/gen/err.3:1.22.16.1
--- src/lib/libc/gen/err.3:1.22	Mon Jul  3 21:32:49 2017
+++ src/lib/libc/gen/err.3	Fri Jan  6 13:44:41 2023
@@ -1,4 +1,4 @@
-.\" $NetBSD: err.3,v 1.22 2017/07/03 21:32:49 wiz Exp $
+.\" $NetBSD: err.3,v 1.22.16.1 2023/01/06 13:44:41 martin Exp $
 .\"
 .\" Copyright (c) 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\"	@(#)err.3	8.1 (Berkeley) 6/9/93
 .\"
-.Dd January 16, 2014
+.Dd January 5, 2023
 .Dt ERR 3
 .Os
 .Sh NAME
@@ -124,6 +124,8 @@ functions will not output this error mes
 The
 .Fn err ,
 .Fn verr ,
+.Fn errc ,
+.Fn verrc ,
 .Fn errx ,
 and
 .Fn verrx



CVS commit: [netbsd-10] src/lib/libc/gen

2023-01-06 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Jan  6 13:44:41 UTC 2023

Modified Files:
src/lib/libc/gen [netbsd-10]: err.3

Log Message:
Pull up following revision(s) (requested by kre in ticket #37):

lib/libc/gen/err.3: revision 1.23

Add errc() and verrc() to the list of functions which do not return,
but exit() instead.

This was omitted when the *c() set of functions were added in 2014.


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

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