CVS commit: src/lib/libc/gen
Module Name:src Committed By: riastradh Date: Wed May 15 13:12:04 UTC 2024 Modified Files: src/lib/libc/gen: usleep.3 Log Message: usleep(3): Note the historical rake that was stepped upon. PR 58184 To generate a diff of this commit: cvs rdiff -u -r1.21 -r1.22 src/lib/libc/gen/usleep.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libc/gen/usleep.3 diff -u src/lib/libc/gen/usleep.3:1.21 src/lib/libc/gen/usleep.3:1.22 --- src/lib/libc/gen/usleep.3:1.21 Mon Apr 22 21:25:29 2024 +++ src/lib/libc/gen/usleep.3 Wed May 15 13:12:04 2024 @@ -1,4 +1,4 @@ -.\" $NetBSD: usleep.3,v 1.21 2024/04/22 21:25:29 jdolecek Exp $ +.\" $NetBSD: usleep.3,v 1.22 2024/05/15 13:12:04 riastradh Exp $ .\" .\" Copyright (c) 1986, 1991, 1993 .\" The Regents of the University of California. All rights reserved. @@ -99,3 +99,17 @@ The .Fn usleep function appeared in .Bx 4.3 . +.Sh CAVEATS +In +.St -p1003.1-2004 , +.Nm +was limited to values of +.Fa microseconds +less than one million. +Some implementations, including +.Nx +before 10.1, fail immediately with +.Er EINVAL +\(em and don't sleep at all \(em if +.Fa microseconds +is one million or greater.
CVS commit: src/lib/libc/gen
Module Name:src Committed By: riastradh Date: Wed May 15 13:12:04 UTC 2024 Modified Files: src/lib/libc/gen: usleep.3 Log Message: usleep(3): Note the historical rake that was stepped upon. PR 58184 To generate a diff of this commit: cvs rdiff -u -r1.21 -r1.22 src/lib/libc/gen/usleep.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/lib/libc/gen
Module Name:src Committed By: rillig Date: Sun May 12 10:58:58 UTC 2024 Modified Files: src/lib/libc/gen: pwcache.c Log Message: libc/pwcache.c: remove stray semicolon from do-while-0 macro To generate a diff of this commit: cvs rdiff -u -r1.34 -r1.35 src/lib/libc/gen/pwcache.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/lib/libc/gen
Module Name:src Committed By: rillig Date: Sun May 12 10:58:58 UTC 2024 Modified Files: src/lib/libc/gen: pwcache.c Log Message: libc/pwcache.c: remove stray semicolon from do-while-0 macro To generate a diff of this commit: cvs rdiff -u -r1.34 -r1.35 src/lib/libc/gen/pwcache.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libc/gen/pwcache.c diff -u src/lib/libc/gen/pwcache.c:1.34 src/lib/libc/gen/pwcache.c:1.35 --- src/lib/libc/gen/pwcache.c:1.34 Tue Apr 19 20:32:15 2022 +++ src/lib/libc/gen/pwcache.c Sun May 12 10:58:58 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: pwcache.c,v 1.34 2022/04/19 20:32:15 rillig Exp $ */ +/* $NetBSD: pwcache.c,v 1.35 2024/05/12 10:58:58 rillig Exp $ */ /*- * Copyright (c) 1992 Keith Muller. @@ -74,7 +74,7 @@ #if 0 static char sccsid[] = "@(#)cache.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: pwcache.c,v 1.34 2022/04/19 20:32:15 rillig Exp $"); +__RCSID("$NetBSD: pwcache.c,v 1.35 2024/05/12 10:58:58 rillig Exp $"); #endif #endif /* LIBC_SCCS and not lint */ @@ -524,7 +524,7 @@ gid_from_group(const char *name, gid_t * arr = NULL; \ } \ fail = 0;\ - } while (0); + } while (0) int pwcache_userdb(
CVS commit: src/lib/libc/gen
Module Name:src Committed By: rillig Date: Sun Apr 28 22:57:16 UTC 2024 Modified Files: src/lib/libc/gen: time.3 Log Message: time.3: clarify that *tloc is always set if tloc != NULL To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 src/lib/libc/gen/time.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libc/gen/time.3 diff -u src/lib/libc/gen/time.3:1.16 src/lib/libc/gen/time.3:1.17 --- src/lib/libc/gen/time.3:1.16 Sat Nov 5 18:17:29 2011 +++ src/lib/libc/gen/time.3 Sun Apr 28 22:57:16 2024 @@ -1,4 +1,4 @@ -.\" $NetBSD: time.3,v 1.16 2011/11/05 18:17:29 christos Exp $ +.\" $NetBSD: time.3,v 1.17 2024/04/28 22:57:16 rillig Exp $ .\" .\" Copyright (c) 1989, 1991, 1993 .\" The Regents of the University of California. All rights reserved. @@ -33,7 +33,7 @@ .\" .\" @(#)time.3 8.1 (Berkeley) 6/4/93 .\" -.Dd November 5, 2011 +.Dd April 29, 2024 .Dt TIME 3 .Os .Sh NAME @@ -52,21 +52,17 @@ function returns the value of time in seconds since 0 hours, 0 minutes, 0 seconds, January 1, 1970, Coordinated Universal Time. .Pp -A copy of the time value may be saved to the area indicated by the -pointer -.Fa tloc . If .Fa tloc -is a -.Dv NULL -pointer, no value is stored. +is not a null pointer, a copy of the time value is saved in +.Fa *tloc . .Pp Upon successful completion, .Fn time returns the value of time. Otherwise a value of .Po -.Po Fa time_t Pc \-1 +.Po Fa time_t Pc Ns \-1 .Pc is returned and the global variable .Va errno
CVS commit: src/lib/libc/gen
Module Name:src Committed By: rillig Date: Sun Apr 28 22:57:16 UTC 2024 Modified Files: src/lib/libc/gen: time.3 Log Message: time.3: clarify that *tloc is always set if tloc != NULL To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 src/lib/libc/gen/time.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/lib/libc/gen
Module Name:src Committed By: rillig Date: Sun Apr 28 22:43:30 UTC 2024 Modified Files: src/lib/libc/gen: setmode.3 Log Message: setmode.3: fix typos To generate a diff of this commit: cvs rdiff -u -r1.23 -r1.24 src/lib/libc/gen/setmode.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libc/gen/setmode.3 diff -u src/lib/libc/gen/setmode.3:1.23 src/lib/libc/gen/setmode.3:1.24 --- src/lib/libc/gen/setmode.3:1.23 Sat Mar 12 17:31:39 2022 +++ src/lib/libc/gen/setmode.3 Sun Apr 28 22:43:30 2024 @@ -1,4 +1,4 @@ -.\" $NetBSD: setmode.3,v 1.23 2022/03/12 17:31:39 christos Exp $ +.\" $NetBSD: setmode.3,v 1.24 2024/04/28 22:43:30 rillig Exp $ .\" .\" Copyright (c) 1989, 1991, 1993 .\" The Regents of the University of California. All rights reserved. @@ -51,16 +51,15 @@ function accepts a string representation compiles it to binary form, and returns an abstract representation that may be passed to .Fn getmode . -The string may be an numeric (octal) or symbolic string of the form +The string may be a numeric (octal) or symbolic string of the form accepted by .Xr chmod 1 , and may represent either an exact mode to set or a change to make to -the existing mode. +an existing mode. .Pp The .Fn getmode -function -adjusts the file permission bits given by +function adjusts the file permission bits given by .Fa mode according to the compiled change representation .Fa set , @@ -116,7 +115,7 @@ or .Xr strtol 3 . In addition, .Fn setmode -will fail and set +may fail and set .Va errno to: .Bl -tag -width Er
CVS commit: src/lib/libc/gen
Module Name:src Committed By: rillig Date: Sun Apr 28 22:43:30 UTC 2024 Modified Files: src/lib/libc/gen: setmode.3 Log Message: setmode.3: fix typos To generate a diff of this commit: cvs rdiff -u -r1.23 -r1.24 src/lib/libc/gen/setmode.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/lib/libc/gen
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
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
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
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/gen
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
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
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
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
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
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
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
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
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
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/gen
Module Name:src Committed By: uwe Date: Fri Feb 9 17:24:45 UTC 2024 Modified Files: src/lib/libc/gen: signal.3 Log Message: signal(3): mention old signal(2) syscall in HISTORY To generate a diff of this commit: cvs rdiff -u -r1.29 -r1.30 src/lib/libc/gen/signal.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
Module Name:src Committed By: uwe Date: Fri Feb 9 17:24:45 UTC 2024 Modified Files: src/lib/libc/gen: signal.3 Log Message: signal(3): mention old signal(2) syscall in HISTORY To generate a diff of this commit: cvs rdiff -u -r1.29 -r1.30 src/lib/libc/gen/signal.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/signal.3 diff -u src/lib/libc/gen/signal.3:1.29 src/lib/libc/gen/signal.3:1.30 --- src/lib/libc/gen/signal.3:1.29 Sat Aug 7 03:17:23 2021 +++ src/lib/libc/gen/signal.3 Fri Feb 9 17:24:44 2024 @@ -1,4 +1,4 @@ -.\" $NetBSD: signal.3,v 1.29 2021/08/07 03:17:23 dholland Exp $ +.\" $NetBSD: signal.3,v 1.30 2024/02/09 17:24:44 uwe Exp $ .\" .\" Copyright (c) 1980, 1991, 1993 .\" The Regents of the University of California. All rights reserved. @@ -190,3 +190,11 @@ This .Fn signal facility appeared in .Bx 4.0 . +.Pp +The +.Fn signal +facility used to be a system call that implemented a different +semantics +.Dq ( old signals ) . +It first appeared in +.At v4 .
CVS commit: src/lib/libc/gen
Module Name:src Committed By: jkoshy Date: Fri Feb 2 21:16:42 UTC 2024 Modified Files: src/lib/libc/gen: err.3 Log Message: Make the err(3) manual clearer to read. - Mention that the 'fmt' argument to these functions holds a printf(3)-like format specification. - Clarify that the err()/warn()/errc()/warnc() family of functions will append an additional error message to the output. - Add whitespace to separate paragraphs describing distinct concepts. - Move the sentence mentioning the final output newline to a less ambiguous location within the text. - Add a cross-reference to printf(3). To generate a diff of this commit: cvs rdiff -u -r1.23 -r1.24 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.
CVS commit: src/lib/libc/gen
Module Name:src Committed By: jkoshy Date: Fri Feb 2 21:16:42 UTC 2024 Modified Files: src/lib/libc/gen: err.3 Log Message: Make the err(3) manual clearer to read. - Mention that the 'fmt' argument to these functions holds a printf(3)-like format specification. - Clarify that the err()/warn()/errc()/warnc() family of functions will append an additional error message to the output. - Add whitespace to separate paragraphs describing distinct concepts. - Move the sentence mentioning the final output newline to a less ambiguous location within the text. - Add a cross-reference to printf(3). To generate a diff of this commit: cvs rdiff -u -r1.23 -r1.24 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.23 src/lib/libc/gen/err.3:1.24 --- src/lib/libc/gen/err.3:1.23 Thu Jan 5 15:13:57 2023 +++ src/lib/libc/gen/err.3 Fri Feb 2 21:16:41 2024 @@ -1,4 +1,4 @@ -.\" $NetBSD: err.3,v 1.23 2023/01/05 15:13:57 kre Exp $ +.\" $NetBSD: err.3,v 1.24 2024/02/02 21:16:41 jkoshy 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 5, 2023 +.Dd February 2, 2024 .Dt ERR 3 .Os .Sh NAME @@ -81,27 +81,30 @@ and .Fn warn family of functions display a formatted error message on the standard error output. -In all cases, the last component of the program name, a colon character, -and a space are output. +.Pp +In all cases these functions output the last component of the program name, +a colon character, and a space. If the .Fa fmt argument is not .Dv NULL , -the formatted error message is output. +it is used as a +.Xr printf 3 Ns +-like format specification for the error message. +.Pp In the case of the .Fn err , .Fn verr , .Fn warn , and .Fn vwarn -functions, the error message string affiliated with the current value of -the global variable +functions, an additional error message string affiliated with the current +value of the global variable .Va errno is output next, preceded by a colon character and a space if .Fa fmt is not .Dv NULL . -In all cases, the output is followed by a newline character. The .Fn errc , .Fn verrc , @@ -119,7 +122,9 @@ The .Fn warnx , and .Fn vwarnx -functions will not output this error message string. +functions will not output an additional error message string. +.Pp +In all cases, the output is terminated by a newline character. .Pp The .Fn err , @@ -168,6 +173,7 @@ if ((fd = open(block_device, O_RDONLY, 0 .Sh SEE ALSO .Xr exit 3 , .Xr getprogname 3 , +.Xr printf 3 , .Xr strerror 3 .Sh HISTORY The
CVS commit: src/lib/libc/gen
Module Name:src Committed By: rin Date: Fri Jan 5 09:41:58 UTC 2024 Modified Files: src/lib/libc/gen: fixunstfdi_ieee754.c fixunstfsi_ieee754.c Log Message: fixunstf[sd]i_ieee754: Explicitly include stddef.h for size_t Fix build for mips{,n}64. Note that stddef.h has been implicitly included via eabi.h for aarch64, on the other hand. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/lib/libc/gen/fixunstfdi_ieee754.c cvs rdiff -u -r1.2 -r1.3 src/lib/libc/gen/fixunstfsi_ieee754.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/lib/libc/gen
Module Name:src Committed By: rin Date: Fri Jan 5 09:41:58 UTC 2024 Modified Files: src/lib/libc/gen: fixunstfdi_ieee754.c fixunstfsi_ieee754.c Log Message: fixunstf[sd]i_ieee754: Explicitly include stddef.h for size_t Fix build for mips{,n}64. Note that stddef.h has been implicitly included via eabi.h for aarch64, on the other hand. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/lib/libc/gen/fixunstfdi_ieee754.c cvs rdiff -u -r1.2 -r1.3 src/lib/libc/gen/fixunstfsi_ieee754.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libc/gen/fixunstfdi_ieee754.c diff -u src/lib/libc/gen/fixunstfdi_ieee754.c:1.1 src/lib/libc/gen/fixunstfdi_ieee754.c:1.2 --- src/lib/libc/gen/fixunstfdi_ieee754.c:1.1 Sat Jul 9 02:30:27 2011 +++ src/lib/libc/gen/fixunstfdi_ieee754.c Fri Jan 5 09:41:58 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: fixunstfdi_ieee754.c,v 1.1 2011/07/09 02:30:27 matt Exp $ */ +/* $NetBSD: fixunstfdi_ieee754.c,v 1.2 2024/01/05 09:41:58 rin Exp $ */ /*- * Copyright (c) 2011 The NetBSD Foundation, Inc. * All rights reserved. @@ -31,10 +31,11 @@ #include #if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: fixunstfdi_ieee754.c,v 1.1 2011/07/09 02:30:27 matt Exp $"); +__RCSID("$NetBSD: fixunstfdi_ieee754.c,v 1.2 2024/01/05 09:41:58 rin Exp $"); #endif /* LIBC_SCCS and not lint */ #include +#include #include #include #include Index: src/lib/libc/gen/fixunstfsi_ieee754.c diff -u src/lib/libc/gen/fixunstfsi_ieee754.c:1.2 src/lib/libc/gen/fixunstfsi_ieee754.c:1.3 --- src/lib/libc/gen/fixunstfsi_ieee754.c:1.2 Sun Aug 5 04:28:58 2012 +++ src/lib/libc/gen/fixunstfsi_ieee754.c Fri Jan 5 09:41:58 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: fixunstfsi_ieee754.c,v 1.2 2012/08/05 04:28:58 matt Exp $ */ +/* $NetBSD: fixunstfsi_ieee754.c,v 1.3 2024/01/05 09:41:58 rin Exp $ */ /*- * Copyright (c) 2011 The NetBSD Foundation, Inc. * All rights reserved. @@ -31,10 +31,11 @@ #include #if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: fixunstfsi_ieee754.c,v 1.2 2012/08/05 04:28:58 matt Exp $"); +__RCSID("$NetBSD: fixunstfsi_ieee754.c,v 1.3 2024/01/05 09:41:58 rin Exp $"); #endif /* LIBC_SCCS and not lint */ #include +#include #include #include #include
CVS commit: src/lib/libc/gen
Module Name:src Committed By: shm Date: Thu Sep 21 13:46:12 UTC 2023 Modified Files: src/lib/libc/gen: getcap.c Log Message: 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.58 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.58 --- src/lib/libc/gen/getcap.c:1.57 Sun Jun 18 03:56:39 2017 +++ src/lib/libc/gen/getcap.c Thu Sep 21 13:46:12 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: getcap.c,v 1.57 2017/06/18 03:56:39 manu Exp $ */ +/* $NetBSD: getcap.c,v 1.58 2023/09/21 13:46:12 shm 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.58 2023/09/21 13:46:12 shm 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: src/lib/libc/gen
Module Name:src Committed By: shm Date: Thu Sep 21 13:46:12 UTC 2023 Modified Files: src/lib/libc/gen: getcap.c Log Message: 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.58 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: src/lib/libc/gen
Module Name:src Committed By: riastradh Date: Sun Aug 13 15:20:37 UTC 2023 Modified Files: src/lib/libc/gen: vis.c Log Message: vis(3): Per KNF, sys/param.h comes before sys/types.h. Which is nice because that's also lexicographic. To generate a diff of this commit: cvs rdiff -u -r1.85 -r1.86 src/lib/libc/gen/vis.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
Module Name:src Committed By: riastradh Date: Sun Aug 13 15:20:37 UTC 2023 Modified Files: src/lib/libc/gen: vis.c Log Message: vis(3): Per KNF, sys/param.h comes before sys/types.h. Which is nice because that's also lexicographic. To generate a diff of this commit: cvs rdiff -u -r1.85 -r1.86 src/lib/libc/gen/vis.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/vis.c diff -u src/lib/libc/gen/vis.c:1.85 src/lib/libc/gen/vis.c:1.86 --- src/lib/libc/gen/vis.c:1.85 Sun Aug 13 15:19:24 2023 +++ src/lib/libc/gen/vis.c Sun Aug 13 15:20:37 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: vis.c,v 1.85 2023/08/13 15:19:24 riastradh Exp $ */ +/* $NetBSD: vis.c,v 1.86 2023/08/13 15:20:37 riastradh Exp $ */ /*- * Copyright (c) 1989, 1993 @@ -57,7 +57,7 @@ #include #if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: vis.c,v 1.85 2023/08/13 15:19:24 riastradh Exp $"); +__RCSID("$NetBSD: vis.c,v 1.86 2023/08/13 15:20:37 riastradh Exp $"); #endif /* LIBC_SCCS and not lint */ #ifdef __FBSDID __FBSDID("$FreeBSD$"); @@ -66,8 +66,8 @@ __FBSDID("$FreeBSD$"); #include "namespace.h" -#include #include +#include #include #include
CVS commit: src/lib/libc/gen
Module Name:src Committed By: riastradh Date: Sun Aug 13 15:19:24 UTC 2023 Modified Files: src/lib/libc/gen: vis.c Log Message: vis(3): Need for SIZE_MAX, per C standard. >From Kyle Evans . Followup to PR lib/57573. XXX pullup-10 XXX pullup-9 XXX pullup-8 To generate a diff of this commit: cvs rdiff -u -r1.84 -r1.85 src/lib/libc/gen/vis.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/vis.c diff -u src/lib/libc/gen/vis.c:1.84 src/lib/libc/gen/vis.c:1.85 --- src/lib/libc/gen/vis.c:1.84 Sun Aug 13 15:19:13 2023 +++ src/lib/libc/gen/vis.c Sun Aug 13 15:19:24 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: vis.c,v 1.84 2023/08/13 15:19:13 riastradh Exp $ */ +/* $NetBSD: vis.c,v 1.85 2023/08/13 15:19:24 riastradh Exp $ */ /*- * Copyright (c) 1989, 1993 @@ -57,7 +57,7 @@ #include #if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: vis.c,v 1.84 2023/08/13 15:19:13 riastradh Exp $"); +__RCSID("$NetBSD: vis.c,v 1.85 2023/08/13 15:19:24 riastradh Exp $"); #endif /* LIBC_SCCS and not lint */ #ifdef __FBSDID __FBSDID("$FreeBSD$"); @@ -71,6 +71,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include
CVS commit: src/lib/libc/gen
Module Name:src Committed By: riastradh Date: Sun Aug 13 15:19:24 UTC 2023 Modified Files: src/lib/libc/gen: vis.c Log Message: vis(3): Need for SIZE_MAX, per C standard. >From Kyle Evans . Followup to PR lib/57573. XXX pullup-10 XXX pullup-9 XXX pullup-8 To generate a diff of this commit: cvs rdiff -u -r1.84 -r1.85 src/lib/libc/gen/vis.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
Module Name:src Committed By: riastradh Date: Sun Aug 13 15:19:13 UTC 2023 Modified Files: src/lib/libc/gen: vis.c Log Message: vis(3): Sort includes. No functional change intended. Prompted by PR lib/57573. XXX pullup-10 XXX pullup-9 XXX pullup-8 To generate a diff of this commit: cvs rdiff -u -r1.83 -r1.84 src/lib/libc/gen/vis.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/vis.c diff -u src/lib/libc/gen/vis.c:1.83 src/lib/libc/gen/vis.c:1.84 --- src/lib/libc/gen/vis.c:1.83 Sat Aug 12 12:48:52 2023 +++ src/lib/libc/gen/vis.c Sun Aug 13 15:19:13 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: vis.c,v 1.83 2023/08/12 12:48:52 riastradh Exp $ */ +/* $NetBSD: vis.c,v 1.84 2023/08/13 15:19:13 riastradh Exp $ */ /*- * Copyright (c) 1989, 1993 @@ -57,7 +57,7 @@ #include #if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: vis.c,v 1.83 2023/08/12 12:48:52 riastradh Exp $"); +__RCSID("$NetBSD: vis.c,v 1.84 2023/08/13 15:19:13 riastradh Exp $"); #endif /* LIBC_SCCS and not lint */ #ifdef __FBSDID __FBSDID("$FreeBSD$"); @@ -65,13 +65,14 @@ __FBSDID("$FreeBSD$"); #endif #include "namespace.h" + #include #include #include -#include #include #include +#include #include #include
CVS commit: src/lib/libc/gen
Module Name:src Committed By: riastradh Date: Sun Aug 13 15:19:13 UTC 2023 Modified Files: src/lib/libc/gen: vis.c Log Message: vis(3): Sort includes. No functional change intended. Prompted by PR lib/57573. XXX pullup-10 XXX pullup-9 XXX pullup-8 To generate a diff of this commit: cvs rdiff -u -r1.83 -r1.84 src/lib/libc/gen/vis.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
Module Name:src Committed By: riastradh Date: Sat Aug 12 12:48:17 UTC 2023 Modified Files: src/lib/libc/gen: vis.c Log Message: vis(3): Avoid potential arithmetic overflow in maxolen. Can't easily prove that this overflow is impossible, so let's add a check. Prompted by PR lib/57573. XXX pullup-10 XXX pullup-9 XXX pullup-8 To generate a diff of this commit: cvs rdiff -u -r1.80 -r1.81 src/lib/libc/gen/vis.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/vis.c diff -u src/lib/libc/gen/vis.c:1.80 src/lib/libc/gen/vis.c:1.81 --- src/lib/libc/gen/vis.c:1.80 Sat Aug 12 12:48:01 2023 +++ src/lib/libc/gen/vis.c Sat Aug 12 12:48:17 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: vis.c,v 1.80 2023/08/12 12:48:01 riastradh Exp $ */ +/* $NetBSD: vis.c,v 1.81 2023/08/12 12:48:17 riastradh Exp $ */ /*- * Copyright (c) 1989, 1993 @@ -57,7 +57,7 @@ #include #if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: vis.c,v 1.80 2023/08/12 12:48:01 riastradh Exp $"); +__RCSID("$NetBSD: vis.c,v 1.81 2023/08/12 12:48:17 riastradh Exp $"); #endif /* LIBC_SCCS and not lint */ #ifdef __FBSDID __FBSDID("$FreeBSD$"); @@ -567,7 +567,15 @@ istrsenvisx(char **mbdstp, size_t *dlen, * output byte-by-byte here. Else use wctomb(). */ len = wcslen(start); - maxolen = dlen ? *dlen : (len * MB_LEN_MAX + 1); + if (dlen) { + maxolen = *dlen; + } else { + if (len > (SIZE_MAX - 1)/MB_LEN_MAX) { + errno = ENOSPC; + goto out; + } + maxolen = len*MB_LEN_MAX + 1; + } olen = 0; memset(, 0, sizeof(mbstate)); for (dst = start; len > 0; len--) {
CVS commit: src/lib/libc/gen
Module Name:src Committed By: riastradh Date: Sat Aug 12 12:48:01 UTC 2023 Modified Files: src/lib/libc/gen: vis.c Log Message: vis(3): Call wcslen(start) only once. It had better not change between these two times! Prompted by PR lib/57573. XXX pullup-10 XXX pullup-9 XXX pullup-8 To generate a diff of this commit: cvs rdiff -u -r1.79 -r1.80 src/lib/libc/gen/vis.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/vis.c diff -u src/lib/libc/gen/vis.c:1.79 src/lib/libc/gen/vis.c:1.80 --- src/lib/libc/gen/vis.c:1.79 Sat Aug 12 12:47:17 2023 +++ src/lib/libc/gen/vis.c Sat Aug 12 12:48:01 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: vis.c,v 1.79 2023/08/12 12:47:17 riastradh Exp $ */ +/* $NetBSD: vis.c,v 1.80 2023/08/12 12:48:01 riastradh Exp $ */ /*- * Copyright (c) 1989, 1993 @@ -57,7 +57,7 @@ #include #if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: vis.c,v 1.79 2023/08/12 12:47:17 riastradh Exp $"); +__RCSID("$NetBSD: vis.c,v 1.80 2023/08/12 12:48:01 riastradh Exp $"); #endif /* LIBC_SCCS and not lint */ #ifdef __FBSDID __FBSDID("$FreeBSD$"); @@ -567,7 +567,7 @@ istrsenvisx(char **mbdstp, size_t *dlen, * output byte-by-byte here. Else use wctomb(). */ len = wcslen(start); - maxolen = dlen ? *dlen : (wcslen(start) * MB_LEN_MAX + 1); + maxolen = dlen ? *dlen : (len * MB_LEN_MAX + 1); olen = 0; memset(, 0, sizeof(mbstate)); for (dst = start; len > 0; len--) {
CVS commit: src/lib/libc/gen
Module Name:src Committed By: riastradh Date: Sat Aug 12 12:48:01 UTC 2023 Modified Files: src/lib/libc/gen: vis.c Log Message: vis(3): Call wcslen(start) only once. It had better not change between these two times! Prompted by PR lib/57573. XXX pullup-10 XXX pullup-9 XXX pullup-8 To generate a diff of this commit: cvs rdiff -u -r1.79 -r1.80 src/lib/libc/gen/vis.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
Module Name:src Committed By: riastradh Date: Sat Aug 12 12:47:17 UTC 2023 Modified Files: src/lib/libc/gen: vis.c Log Message: vis(3): Avoid arithmetic overflow before calloc(3). Prompted by PR lib/57573. XXX pullup-10 XXX pullup-9 XXX pullup-8 To generate a diff of this commit: cvs rdiff -u -r1.78 -r1.79 src/lib/libc/gen/vis.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/vis.c diff -u src/lib/libc/gen/vis.c:1.78 src/lib/libc/gen/vis.c:1.79 --- src/lib/libc/gen/vis.c:1.78 Sat Aug 12 12:46:50 2023 +++ src/lib/libc/gen/vis.c Sat Aug 12 12:47:17 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: vis.c,v 1.78 2023/08/12 12:46:50 riastradh Exp $ */ +/* $NetBSD: vis.c,v 1.79 2023/08/12 12:47:17 riastradh Exp $ */ /*- * Copyright (c) 1989, 1993 @@ -57,7 +57,7 @@ #include #if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: vis.c,v 1.78 2023/08/12 12:46:50 riastradh Exp $"); +__RCSID("$NetBSD: vis.c,v 1.79 2023/08/12 12:47:17 riastradh Exp $"); #endif /* LIBC_SCCS and not lint */ #ifdef __FBSDID __FBSDID("$FreeBSD$"); @@ -432,6 +432,14 @@ istrsenvisx(char **mbdstp, size_t *dlen, * return to the caller. */ + /* + * Guarantee the arithmetic on input to calloc won't overflow. + */ + if (mbslength > (SIZE_MAX - 1)/16) { + errno = ENOMEM; + return -1; + } + /* Allocate space for the wide char strings */ psrc = pdst = extra = NULL; mdst = NULL;
CVS commit: src/lib/libc/gen
Module Name:src Committed By: riastradh Date: Sat Aug 12 12:47:17 UTC 2023 Modified Files: src/lib/libc/gen: vis.c Log Message: vis(3): Avoid arithmetic overflow before calloc(3). Prompted by PR lib/57573. XXX pullup-10 XXX pullup-9 XXX pullup-8 To generate a diff of this commit: cvs rdiff -u -r1.78 -r1.79 src/lib/libc/gen/vis.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
Module Name:src Committed By: riastradh Date: Sat Aug 12 12:46:50 UTC 2023 Modified Files: src/lib/libc/gen: vis.c Log Message: vis(3): Make mbslength unsigned. Sprinkle assertions and comments justifying the proposition that it would never go negative if signed. Obviates need to worry about mblength > SSIZE_MAX. Prompted by PR lib/57573. XXX pullup-10 XXX pullup-9 XXX pullup-8 To generate a diff of this commit: cvs rdiff -u -r1.77 -r1.78 src/lib/libc/gen/vis.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/vis.c diff -u src/lib/libc/gen/vis.c:1.77 src/lib/libc/gen/vis.c:1.78 --- src/lib/libc/gen/vis.c:1.77 Sat Aug 12 12:46:33 2023 +++ src/lib/libc/gen/vis.c Sat Aug 12 12:46:50 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: vis.c,v 1.77 2023/08/12 12:46:33 riastradh Exp $ */ +/* $NetBSD: vis.c,v 1.78 2023/08/12 12:46:50 riastradh Exp $ */ /*- * Copyright (c) 1989, 1993 @@ -57,7 +57,7 @@ #include #if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: vis.c,v 1.77 2023/08/12 12:46:33 riastradh Exp $"); +__RCSID("$NetBSD: vis.c,v 1.78 2023/08/12 12:46:50 riastradh Exp $"); #endif /* LIBC_SCCS and not lint */ #ifdef __FBSDID __FBSDID("$FreeBSD$"); @@ -403,7 +403,7 @@ istrsenvisx(char **mbdstp, size_t *dlen, visfun_t f; int clen = 0, cerr, error = -1, i, shft; char *mbdst, *mdst; - ssize_t mbslength; + size_t mbslength; size_t maxolen; mbstate_t mbstate; @@ -411,7 +411,7 @@ istrsenvisx(char **mbdstp, size_t *dlen, _DIAGASSERT(mbsrc != NULL || mblength == 0); _DIAGASSERT(mbextra != NULL); - mbslength = (ssize_t)mblength; + mbslength = mblength; /* * When inputing a single character, must also read in the * next character for nextc, the look-ahead character. @@ -466,12 +466,15 @@ istrsenvisx(char **mbdstp, size_t *dlen, memset(, 0, sizeof(mbstate)); while (mbslength > 0) { /* Convert one multibyte character to wchar_t. */ - if (!cerr) + if (!cerr) { clen = mbrtowc(src, mbsrc, (mbslength < MB_LEN_MAX ? mbslength : MB_LEN_MAX), ); + assert(clen < 0 || (size_t)clen <= mbslength); + assert(clen <= MB_LEN_MAX); + } if (cerr || clen < 0) { /* Conversion error, process as a byte instead. */ *src = (wint_t)(u_char)*mbsrc; @@ -485,6 +488,20 @@ istrsenvisx(char **mbdstp, size_t *dlen, */ clen = 1; } + /* + * Let n := MIN(mbslength, MB_LEN_MAX). We have: + * + * mbslength >= 1 + * mbrtowc(..., n, ) <= n, + * by the contract of mbrtowc + * + * clen is either + * (a) mbrtowc(..., n, ), in which case + * clen <= n <= mbslength; or + * (b) 1, in which case clen = 1 <= mbslength. + */ + assert(clen > 0); + assert((size_t)clen <= mbslength); /* Advance buffer character pointer. */ src++; /* Advance input pointer by number of bytes read. */
CVS commit: src/lib/libc/gen
Module Name:src Committed By: riastradh Date: Sat Aug 12 12:46:50 UTC 2023 Modified Files: src/lib/libc/gen: vis.c Log Message: vis(3): Make mbslength unsigned. Sprinkle assertions and comments justifying the proposition that it would never go negative if signed. Obviates need to worry about mblength > SSIZE_MAX. Prompted by PR lib/57573. XXX pullup-10 XXX pullup-9 XXX pullup-8 To generate a diff of this commit: cvs rdiff -u -r1.77 -r1.78 src/lib/libc/gen/vis.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
Module Name:src Committed By: riastradh Date: Sat Aug 12 12:46:33 UTC 2023 Modified Files: src/lib/libc/gen: vis.c Log Message: vis(3): Make maxolen unsigned size_t, not ssize_t. It is initialized once either to *dlen, which is unsigned size_t, or to wcslen(start) * MB_MAX_LEN + 1, and wcslen returns unsigned size_t too. So there appears to have never been any reason for this to be signed. Part of PR lib/57573. XXX pullup-10 XXX pullup-9 XXX pullup-8 To generate a diff of this commit: cvs rdiff -u -r1.76 -r1.77 src/lib/libc/gen/vis.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/vis.c diff -u src/lib/libc/gen/vis.c:1.76 src/lib/libc/gen/vis.c:1.77 --- src/lib/libc/gen/vis.c:1.76 Thu Jun 29 16:11:31 2023 +++ src/lib/libc/gen/vis.c Sat Aug 12 12:46:33 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: vis.c,v 1.76 2023/06/29 16:11:31 riastradh Exp $ */ +/* $NetBSD: vis.c,v 1.77 2023/08/12 12:46:33 riastradh Exp $ */ /*- * Copyright (c) 1989, 1993 @@ -57,7 +57,7 @@ #include #if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: vis.c,v 1.76 2023/06/29 16:11:31 riastradh Exp $"); +__RCSID("$NetBSD: vis.c,v 1.77 2023/08/12 12:46:33 riastradh Exp $"); #endif /* LIBC_SCCS and not lint */ #ifdef __FBSDID __FBSDID("$FreeBSD$"); @@ -403,7 +403,8 @@ istrsenvisx(char **mbdstp, size_t *dlen, visfun_t f; int clen = 0, cerr, error = -1, i, shft; char *mbdst, *mdst; - ssize_t mbslength, maxolen; + ssize_t mbslength; + size_t maxolen; mbstate_t mbstate; _DIAGASSERT(mbdstp != NULL); @@ -569,7 +570,7 @@ istrsenvisx(char **mbdstp, size_t *dlen, cerr = 1; } /* If this character would exceed our output limit, stop. */ - if (olen + clen > (size_t)maxolen) + if (olen + clen > maxolen) break; /* Advance output pointer by number of bytes written. */ mbdst += clen;
CVS commit: src/lib/libc/gen
Module Name:src Committed By: riastradh Date: Sat Aug 12 12:46:33 UTC 2023 Modified Files: src/lib/libc/gen: vis.c Log Message: vis(3): Make maxolen unsigned size_t, not ssize_t. It is initialized once either to *dlen, which is unsigned size_t, or to wcslen(start) * MB_MAX_LEN + 1, and wcslen returns unsigned size_t too. So there appears to have never been any reason for this to be signed. Part of PR lib/57573. XXX pullup-10 XXX pullup-9 XXX pullup-8 To generate a diff of this commit: cvs rdiff -u -r1.76 -r1.77 src/lib/libc/gen/vis.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
Module Name:src Committed By: uwe Date: Fri Jun 30 22:15:14 UTC 2023 Modified Files: src/lib/libc/gen: getentropy.3 Log Message: getentropy(3): use .Sx to xref CAVEATS To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/lib/libc/gen/getentropy.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/getentropy.3 diff -u src/lib/libc/gen/getentropy.3:1.5 src/lib/libc/gen/getentropy.3:1.6 --- src/lib/libc/gen/getentropy.3:1.5 Fri Jun 30 21:44:22 2023 +++ src/lib/libc/gen/getentropy.3 Fri Jun 30 22:15:14 2023 @@ -1,4 +1,4 @@ -.\" $NetBSD: getentropy.3,v 1.5 2023/06/30 21:44:22 riastradh Exp $ $ +.\" $NetBSD: getentropy.3,v 1.6 2023/06/30 22:15:14 uwe Exp $ $ .\" .\" Copyright (c) 2020 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -57,7 +57,9 @@ The output of .Nm is meant to be unpredictable to an adversary and fit for use in cryptography. -See CAVEATS below. +See +.Sx CAVEATS +below. .Pp .Nm is meant for seeding random number generators, not for direct use by
CVS commit: src/lib/libc/gen
Module Name:src Committed By: uwe Date: Fri Jun 30 22:15:14 UTC 2023 Modified Files: src/lib/libc/gen: getentropy.3 Log Message: getentropy(3): use .Sx to xref CAVEATS To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/lib/libc/gen/getentropy.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
Module Name:src Committed By: riastradh Date: Thu Jun 29 16:11:31 UTC 2023 Modified Files: src/lib/libc/gen: vis.c Log Message: vis(3): Avoid nonportable MIN in portable code. To generate a diff of this commit: cvs rdiff -u -r1.75 -r1.76 src/lib/libc/gen/vis.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/vis.c diff -u src/lib/libc/gen/vis.c:1.75 src/lib/libc/gen/vis.c:1.76 --- src/lib/libc/gen/vis.c:1.75 Fri Jun 18 10:57:14 2021 +++ src/lib/libc/gen/vis.c Thu Jun 29 16:11:31 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: vis.c,v 1.75 2021/06/18 10:57:14 christos Exp $ */ +/* $NetBSD: vis.c,v 1.76 2023/06/29 16:11:31 riastradh Exp $ */ /*- * Copyright (c) 1989, 1993 @@ -57,7 +57,7 @@ #include #if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: vis.c,v 1.75 2021/06/18 10:57:14 christos Exp $"); +__RCSID("$NetBSD: vis.c,v 1.76 2023/06/29 16:11:31 riastradh Exp $"); #endif /* LIBC_SCCS and not lint */ #ifdef __FBSDID __FBSDID("$FreeBSD$"); @@ -466,7 +466,10 @@ istrsenvisx(char **mbdstp, size_t *dlen, while (mbslength > 0) { /* Convert one multibyte character to wchar_t. */ if (!cerr) - clen = mbrtowc(src, mbsrc, MIN(mbslength, MB_LEN_MAX), + clen = mbrtowc(src, mbsrc, + (mbslength < MB_LEN_MAX +? mbslength +: MB_LEN_MAX), ); if (cerr || clen < 0) { /* Conversion error, process as a byte instead. */
CVS commit: src/lib/libc/gen
Module Name:src Committed By: riastradh Date: Thu Jun 29 16:11:31 UTC 2023 Modified Files: src/lib/libc/gen: vis.c Log Message: vis(3): Avoid nonportable MIN in portable code. To generate a diff of this commit: cvs rdiff -u -r1.75 -r1.76 src/lib/libc/gen/vis.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
Module Name:src Committed By: rillig Date: Sun Jan 22 13:38:48 UTC 2023 Modified Files: src/lib/libc/gen: fmtmsg.3 Log Message: fmtmsg.3: fix typo To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/lib/libc/gen/fmtmsg.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
Module Name:src Committed By: rillig Date: Sun Jan 22 13:38:48 UTC 2023 Modified Files: src/lib/libc/gen: fmtmsg.3 Log Message: fmtmsg.3: fix typo To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/lib/libc/gen/fmtmsg.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/fmtmsg.3 diff -u src/lib/libc/gen/fmtmsg.3:1.7 src/lib/libc/gen/fmtmsg.3:1.8 --- src/lib/libc/gen/fmtmsg.3:1.7 Mon Apr 11 05:59:11 2011 +++ src/lib/libc/gen/fmtmsg.3 Sun Jan 22 13:38:48 2023 @@ -1,4 +1,4 @@ -.\" $NetBSD: fmtmsg.3,v 1.7 2011/04/11 05:59:11 jruoho Exp $ +.\" $NetBSD: fmtmsg.3,v 1.8 2023/01/22 13:38:48 rillig Exp $ .\" .\" Copyright (c) 1999 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -190,7 +190,7 @@ with the same names. If .Ev MSGVERB is either not set or malformed (containing empty or unknown keywords), -its content is ignored an all message components will be selected. +its content is ignored and all message components will be selected. .Pp Note that displaying a message on the system console may fail due to inappropriate privileges or a non-permissive file mode of the console device.
CVS commit: src/lib/libc/gen
Module Name:src Committed By: simonb Date: Wed Jan 18 08:07:22 UTC 2023 Modified Files: src/lib/libc/gen: basename.c Log Message: KNF nit: opening brace of a function on next line. To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/lib/libc/gen/basename.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/basename.c diff -u src/lib/libc/gen/basename.c:1.11 src/lib/libc/gen/basename.c:1.12 --- src/lib/libc/gen/basename.c:1.11 Wed Jul 16 10:52:26 2014 +++ src/lib/libc/gen/basename.c Wed Jan 18 08:07:22 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: basename.c,v 1.11 2014/07/16 10:52:26 christos Exp $ */ +/* $NetBSD: basename.c,v 1.12 2023/01/18 08:07:22 simonb Exp $ */ /*- * Copyright (c) 1997, 2002 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ #include #if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: basename.c,v 1.11 2014/07/16 10:52:26 christos Exp $"); +__RCSID("$NetBSD: basename.c,v 1.12 2023/01/18 08:07:22 simonb Exp $"); #endif /* !LIBC_SCCS && !lint */ #include "namespace.h" @@ -91,7 +91,8 @@ out: #if !HAVE_BASENAME char * -basename(char *path) { +basename(char *path) +{ static char result[PATH_MAX]; (void)xbasename_r(path, result, sizeof(result));
CVS commit: src/lib/libc/gen
Module Name:src Committed By: simonb Date: Wed Jan 18 08:07:22 UTC 2023 Modified Files: src/lib/libc/gen: basename.c Log Message: KNF nit: opening brace of a function on next line. To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/lib/libc/gen/basename.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
Module Name:src Committed By: kre Date: Thu Jan 5 15:13:57 UTC 2023 Modified Files: src/lib/libc/gen: err.3 Log Message: 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.23 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.23 --- src/lib/libc/gen/err.3:1.22 Mon Jul 3 21:32:49 2017 +++ src/lib/libc/gen/err.3 Thu Jan 5 15:13:57 2023 @@ -1,4 +1,4 @@ -.\" $NetBSD: err.3,v 1.22 2017/07/03 21:32:49 wiz Exp $ +.\" $NetBSD: err.3,v 1.23 2023/01/05 15:13:57 kre 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: src/lib/libc/gen
Module Name:src Committed By: kre Date: Thu Jan 5 15:13:57 UTC 2023 Modified Files: src/lib/libc/gen: err.3 Log Message: 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.23 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.
CVS commit: src/lib/libc/gen
Module Name:src Committed By: uwe Date: Tue Dec 6 00:13:17 UTC 2022 Modified Files: src/lib/libc/gen: getbsize.3 Log Message: getbsize(3): Use .Ev for BLOCKSIZE To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/lib/libc/gen/getbsize.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/getbsize.3 diff -u src/lib/libc/gen/getbsize.3:1.9 src/lib/libc/gen/getbsize.3:1.10 --- src/lib/libc/gen/getbsize.3:1.9 Thu Aug 7 16:42:48 2003 +++ src/lib/libc/gen/getbsize.3 Tue Dec 6 00:13:17 2022 @@ -1,4 +1,4 @@ -.\" $NetBSD: getbsize.3,v 1.9 2003/08/07 16:42:48 agc Exp $ +.\" $NetBSD: getbsize.3,v 1.10 2022/12/06 00:13:17 uwe Exp $ .\" .\" Copyright (c) 1993 .\" The Regents of the University of California. All rights reserved. @@ -45,7 +45,7 @@ The .Nm getbsize function determines the user's preferred block size based on the value of the -.Dq BLOCKSIZE +.Ev BLOCKSIZE environment variable; see .Xr environ 7 for details on its use and format.
CVS commit: src/lib/libc/gen
Module Name:src Committed By: uwe Date: Tue Dec 6 00:13:17 UTC 2022 Modified Files: src/lib/libc/gen: getbsize.3 Log Message: getbsize(3): Use .Ev for BLOCKSIZE To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/lib/libc/gen/getbsize.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
Module Name:src Committed By: gutteridge Date: Thu Nov 10 00:47:01 UTC 2022 Modified Files: src/lib/libc/gen: closefrom.3 Log Message: closefrom.3: add a history section To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/lib/libc/gen/closefrom.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/closefrom.3 diff -u src/lib/libc/gen/closefrom.3:1.5 src/lib/libc/gen/closefrom.3:1.6 --- src/lib/libc/gen/closefrom.3:1.5 Tue Jun 1 16:12:51 2004 +++ src/lib/libc/gen/closefrom.3 Thu Nov 10 00:47:01 2022 @@ -1,4 +1,4 @@ -.\" $NetBSD: closefrom.3,v 1.5 2004/06/01 16:12:51 kleink Exp $ +.\" $NetBSD: closefrom.3,v 1.6 2022/11/10 00:47:01 gutteridge Exp $ .\" $OpenBSD: closefrom.2,v 1.2 2004/01/12 20:52:09 jmc Exp $ .\" .\" Copyright (c) 2004 Ted Unangst. All rights reserved. @@ -23,7 +23,7 @@ .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. -.Dd June 1, 2004 +.Dd November 9, 2022 .Dt CLOSEFROM 3 .Os .Sh NAME @@ -59,3 +59,6 @@ An interrupt was received. .El .Sh SEE ALSO .Xr close 2 +.Sh HISTORY +This function first appeared in +.Nx 3 .
CVS commit: src/lib/libc/gen
Module Name:src Committed By: gutteridge Date: Thu Nov 10 00:47:01 UTC 2022 Modified Files: src/lib/libc/gen: closefrom.3 Log Message: closefrom.3: add a history section To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/lib/libc/gen/closefrom.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
Module Name:src Committed By: riastradh Date: Tue Sep 13 10:18:47 UTC 2022 Modified Files: src/lib/libc/gen: pthread_atfork.c Log Message: pthread_atfork(3): Block signals during the call to pthread_atfork. This doesn't affect the calls to the atfork handlers -- it only protects access to the lists of handlers from interruption by a signal, in case the signal handler calls fork(2). To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 src/lib/libc/gen/pthread_atfork.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/pthread_atfork.c diff -u src/lib/libc/gen/pthread_atfork.c:1.16 src/lib/libc/gen/pthread_atfork.c:1.17 --- src/lib/libc/gen/pthread_atfork.c:1.16 Tue May 31 08:43:13 2022 +++ src/lib/libc/gen/pthread_atfork.c Tue Sep 13 10:18:47 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: pthread_atfork.c,v 1.16 2022/05/31 08:43:13 andvar Exp $ */ +/* $NetBSD: pthread_atfork.c,v 1.17 2022/09/13 10:18:47 riastradh Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ #include #if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: pthread_atfork.c,v 1.16 2022/05/31 08:43:13 andvar Exp $"); +__RCSID("$NetBSD: pthread_atfork.c,v 1.17 2022/09/13 10:18:47 riastradh Exp $"); #endif /* LIBC_SCCS and not lint */ #include "namespace.h" @@ -101,15 +101,20 @@ pthread_atfork(void (*prepare)(void), vo void (*child)(void)) { struct atfork_callback *newprepare, *newparent, *newchild; + sigset_t mask, omask; + int error; newprepare = newparent = newchild = NULL; + sigfillset(); + thr_sigsetmask(SIG_SETMASK, , ); + mutex_lock(_lock); if (prepare != NULL) { newprepare = af_alloc(); if (newprepare == NULL) { - mutex_unlock(_lock); - return ENOMEM; + error = ENOMEM; + goto out; } newprepare->fn = prepare; } @@ -119,8 +124,8 @@ pthread_atfork(void (*prepare)(void), vo if (newparent == NULL) { if (newprepare != NULL) af_free(newprepare); - mutex_unlock(_lock); - return ENOMEM; + error = ENOMEM; + goto out; } newparent->fn = parent; } @@ -132,8 +137,8 @@ pthread_atfork(void (*prepare)(void), vo af_free(newprepare); if (newparent != NULL) af_free(newparent); - mutex_unlock(_lock); - return ENOMEM; + error = ENOMEM; + goto out; } newchild->fn = child; } @@ -150,9 +155,11 @@ pthread_atfork(void (*prepare)(void), vo SIMPLEQ_INSERT_TAIL(, newparent, next); if (child) SIMPLEQ_INSERT_TAIL(, newchild, next); - mutex_unlock(_lock); + error = 0; - return 0; +out: mutex_unlock(_lock); + thr_sigsetmask(SIG_SETMASK, , NULL); + return error; } pid_t
CVS commit: src/lib/libc/gen
Module Name:src Committed By: riastradh Date: Tue Sep 13 10:18:47 UTC 2022 Modified Files: src/lib/libc/gen: pthread_atfork.c Log Message: pthread_atfork(3): Block signals during the call to pthread_atfork. This doesn't affect the calls to the atfork handlers -- it only protects access to the lists of handlers from interruption by a signal, in case the signal handler calls fork(2). To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 src/lib/libc/gen/pthread_atfork.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
Module Name:src Committed By: gutteridge Date: Sun Mar 27 00:32:15 UTC 2022 Modified Files: src/lib/libc/gen: popen.3 Log Message: popen.3: revert s/null-/nul-/ change, this is subject to debate To generate a diff of this commit: cvs rdiff -u -r1.23 -r1.24 src/lib/libc/gen/popen.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/popen.3 diff -u src/lib/libc/gen/popen.3:1.23 src/lib/libc/gen/popen.3:1.24 --- src/lib/libc/gen/popen.3:1.23 Thu Mar 24 01:55:15 2022 +++ src/lib/libc/gen/popen.3 Sun Mar 27 00:32:15 2022 @@ -1,4 +1,4 @@ -.\" $NetBSD: popen.3,v 1.23 2022/03/24 01:55:15 gutteridge Exp $ +.\" $NetBSD: popen.3,v 1.24 2022/03/27 00:32:15 gutteridge Exp $ .\" .\" Copyright (c) 1991, 1993 .\" The Regents of the University of California. All rights reserved. @@ -71,7 +71,7 @@ is now implemented using sockets, the may request a bidirectional data flow. The .Fa type -argument is a pointer to a nul-terminated string +argument is a pointer to a null-terminated string which must be .Ql r for reading, @@ -88,7 +88,7 @@ string, the file descriptor used interna .Pp The .Fa command -argument is a pointer to a nul-terminated string +argument is a pointer to a null-terminated string containing a shell command line. This command is passed to .Pa /bin/sh
CVS commit: src/lib/libc/gen
Module Name:src Committed By: gutteridge Date: Sun Mar 27 00:32:15 UTC 2022 Modified Files: src/lib/libc/gen: popen.3 Log Message: popen.3: revert s/null-/nul-/ change, this is subject to debate To generate a diff of this commit: cvs rdiff -u -r1.23 -r1.24 src/lib/libc/gen/popen.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Re: null-terminated vs. nul-terminated (was: Re: CVS commit: src/lib/libc/gen)
> On Mar 26, 2022, at 9:39 AM, Taylor R Campbell > wrote: > > `C string' is ambiguous because there are also char arrays that > function as strings but which are not guaranteed to be NUL-terminated, > as strncpy is intended for. A non-terminated char array is not a C-string. The term C-string is not ambiguous. This is something that, amazingly, even Internet trolls appear to agree on. However, they do disagree as to the spelling of the terminating character's name, which is why I think it's best to elide it altogether. -- thorpej
Re: null-terminated vs. nul-terminated (was: Re: CVS commit: src/lib/libc/gen)
> On Mar 26, 2022, at 9:09 AM, Warner Losh wrote: > > Since all the 'C' standards[*] use "null-terminated" and "null character", > it's likely best to use that terminology because there is a source of truth > for its definition in case of ambiguity or doubt. Ah, but you're giving up the opportunity to use indirection to solve the problem. By calling it a "C-string", then those who care what the standard calls the terminating character can go look it up! :-) -- thorpej
Re: null-terminated vs. nul-terminated (was: Re: CVS commit: src/lib/libc/gen)
On Sat, Mar 26, 2022 at 9:53 AM Roland Illig wrote: > Am 24.03.2022 um 02:55 schrieb David H. Gutteridge: > > Module Name: src > > Committed By: gutteridge > > Date: Thu Mar 24 01:55:15 UTC 2022 > > > > Modified Files: > > src/lib/libc/gen: popen.3 > > > > Log Message: > > popen.3: minor spelling, grammar, style, and xref tweaks > > > > > > To generate a diff of this commit: > > cvs rdiff -u -r1.22 -r1.23 src/lib/libc/gen/popen.3 > > The term "null-terminated string" is quite common when talking about C. > In contrast, the word "nul" in "nul-terminated" always reminds me of > the character abbreviation in ASCII, which has a narrower scope than C. > I prefer to keep "null-terminated" here. > The standard uses "null-terminated" and "null character" (see Character Sets section 5.2.1 (from the C2x draft, but this term dates back to C89): "A byte with all bits set to 0, called the null character, shall exist in the basic execution character set; it is used to terminate a character string." I couldn't find the definition for null-terminated though. This is different than the NULL #define Not to be confused with the all zeros ASCII charater, whose mnemonic is NUL, which is where some pressure to use NUL terminated comes from. I agree that it's usage is narrower and really only relevant for certain ASCII and ASCII-derived character sets, which is why the standard chose the spelling it did. Since all the 'C' standards[*] use "null-terminated" and "null character", it's likely best to use that terminology because there is a source of truth for its definition in case of ambiguity or doubt. Warner [*] I've not gone the extra mile and checked to see if K used this phrase, to be honest.
Re: null-terminated vs. nul-terminated (was: Re: CVS commit: src/lib/libc/gen)
> Date: Sat, 26 Mar 2022 16:53:19 +0100 > From: Roland Illig > > The term "null-terminated string" is quite common when talking about C. > In contrast, the word "nul" in "nul-terminated" always reminds me of > the character abbreviation in ASCII, which has a narrower scope than C. > I prefer to keep "null-terminated" here. I feel like I've usually seen it as NUL-terminated. I thought it was in /usr/share/misc/style but I must have been thinking of a different style guide. `NUL' is better than `null' or `NULL' here because it's not a null pointer, unlike, e.g., the execve argv terminator. Even if the string isn't US-ASCII, what character encoding calls a nonzero byte `NUL'? `NUL' is better than `zero' or `0' here because it's unambiguously the all-bits-zero byte, not the US-ASCII encoding of `0' (i.e., decimal 48 or 0x30). `C string' is ambiguous because there are also char arrays that function as strings but which are not guaranteed to be NUL-terminated, as strncpy is intended for.
Re: null-terminated vs. nul-terminated (was: Re: CVS commit: src/lib/libc/gen)
> On Mar 26, 2022, at 9:17 AM, Martin Husemann wrote: > When talking about it I prefer "zero terminated", or C-string, in > contrast to C++ std::string (which are objects) or Pascal strings > (which have an explicit length at the beginning). Yes, I also prefer the term “C-string" -- thorpej
Re: null-terminated vs. nul-terminated (was: Re: CVS commit: src/lib/libc/gen)
On Sat, Mar 26, 2022 at 04:53:19PM +0100, Roland Illig wrote: > The term "null-terminated string" is quite common when talking about C. NULL terminated lists/array are quite common, but NULL is a pointer and the string is terminated by a 0 char (sometimes spelled as \0 in a string literal, but implicitly added by the compiler at the end of a literal, and spelled as NUL in the ascii table). > I prefer to keep "null-terminated" here. I think it is a bug. When talking about it I prefer "zero terminated", or C-string, in contrast to C++ std::string (which are objects) or Pascal strings (which have an explicit length at the beginning). Martin
null-terminated vs. nul-terminated (was: Re: CVS commit: src/lib/libc/gen)
Am 24.03.2022 um 02:55 schrieb David H. Gutteridge: Module Name:src Committed By: gutteridge Date: Thu Mar 24 01:55:15 UTC 2022 Modified Files: src/lib/libc/gen: popen.3 Log Message: popen.3: minor spelling, grammar, style, and xref tweaks To generate a diff of this commit: cvs rdiff -u -r1.22 -r1.23 src/lib/libc/gen/popen.3 The term "null-terminated string" is quite common when talking about C. In contrast, the word "nul" in "nul-terminated" always reminds me of the character abbreviation in ASCII, which has a narrower scope than C. I prefer to keep "null-terminated" here. Roland
CVS commit: src/lib/libc/gen
Module Name:src Committed By: gutteridge Date: Thu Mar 24 01:55:15 UTC 2022 Modified Files: src/lib/libc/gen: popen.3 Log Message: popen.3: minor spelling, grammar, style, and xref tweaks To generate a diff of this commit: cvs rdiff -u -r1.22 -r1.23 src/lib/libc/gen/popen.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/popen.3 diff -u src/lib/libc/gen/popen.3:1.22 src/lib/libc/gen/popen.3:1.23 --- src/lib/libc/gen/popen.3:1.22 Sat Sep 11 19:58:24 2021 +++ src/lib/libc/gen/popen.3 Thu Mar 24 01:55:15 2022 @@ -1,4 +1,4 @@ -.\" $NetBSD: popen.3,v 1.22 2021/09/11 19:58:24 rillig Exp $ +.\" $NetBSD: popen.3,v 1.23 2022/03/24 01:55:15 gutteridge Exp $ .\" .\" Copyright (c) 1991, 1993 .\" The Regents of the University of California. All rights reserved. @@ -71,7 +71,7 @@ is now implemented using sockets, the may request a bidirectional data flow. The .Fa type -argument is a pointer to a null-terminated string +argument is a pointer to a nul-terminated string which must be .Ql r for reading, @@ -88,7 +88,7 @@ string, the file descriptor used interna .Pp The .Fa command -argument is a pointer to a null-terminated string +argument is a pointer to a nul-terminated string containing a shell command line. This command is passed to .Pa /bin/sh @@ -136,7 +136,7 @@ The function waits for the associated process to terminate and returns the exit status of the command as returned by -.Fn wait4 . +.Xr wait4 2 . .Sh RETURN VALUES The .Fn popen @@ -163,7 +163,7 @@ command, if has already been .Dq pclosed , setting errno to -.Dv ESRCH +.Dv ESRCH , or if .Xr wait4 2 returns an error, preserving the errno returned by @@ -174,6 +174,7 @@ returns an error, preserving the errno r .Xr fork 2 , .Xr pipe 2 , .Xr socketpair 2 , +.Xr vfork 2 , .Xr wait4 2 , .Xr fclose 3 , .Xr fflush 3 , @@ -214,7 +215,7 @@ before .Fn popen . .Pp Failure to execute the shell -is indistinguishable from the shell's failure to execute command, +is indistinguishable from the shell's failure to execute the command, or an immediate exit of the command. The only hint is an exit status of 127. .Pp
CVS commit: src/lib/libc/gen
Module Name:src Committed By: gutteridge Date: Thu Mar 24 01:55:15 UTC 2022 Modified Files: src/lib/libc/gen: popen.3 Log Message: popen.3: minor spelling, grammar, style, and xref tweaks To generate a diff of this commit: cvs rdiff -u -r1.22 -r1.23 src/lib/libc/gen/popen.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
Module Name:src Committed By: nia Date: Sat Mar 12 08:32:02 UTC 2022 Modified Files: src/lib/libc/gen: setmode.c Log Message: setmode(3): use reallocarr instead of realloc(x * y) To generate a diff of this commit: cvs rdiff -u -r1.35 -r1.36 src/lib/libc/gen/setmode.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/setmode.c diff -u src/lib/libc/gen/setmode.c:1.35 src/lib/libc/gen/setmode.c:1.36 --- src/lib/libc/gen/setmode.c:1.35 Sat Mar 12 08:28:30 2022 +++ src/lib/libc/gen/setmode.c Sat Mar 12 08:32:02 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: setmode.c,v 1.35 2022/03/12 08:28:30 nia Exp $ */ +/* $NetBSD: setmode.c,v 1.36 2022/03/12 08:32:02 nia Exp $ */ /* * Copyright (c) 1989, 1993, 1994 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)setmode.c 8.2 (Berkeley) 3/25/94"; #else -__RCSID("$NetBSD: setmode.c,v 1.35 2022/03/12 08:28:30 nia Exp $"); +__RCSID("$NetBSD: setmode.c,v 1.36 2022/03/12 08:32:02 nia Exp $"); #endif #endif /* LIBC_SCCS and not lint */ @@ -163,9 +163,11 @@ common: if (set->cmd2 & CMD2_CLR) { if (set >= endset) { \ BITCMD *newset; \ setlen += SET_LEN_INCR; \ - newset = realloc(saveset, sizeof(BITCMD) * setlen); \ - if (newset == NULL) \ + newset = saveset; \ + if (reallocarr(, setlen, sizeof(BITCMD)) != 0) { \ + errno = ENOMEM; \ goto out; \ + } \ set = newset + (set - saveset);\ saveset = newset; \ endset = newset + (setlen - 2);\
CVS commit: src/lib/libc/gen
Module Name:src Committed By: nia Date: Sat Mar 12 08:32:02 UTC 2022 Modified Files: src/lib/libc/gen: setmode.c Log Message: setmode(3): use reallocarr instead of realloc(x * y) To generate a diff of this commit: cvs rdiff -u -r1.35 -r1.36 src/lib/libc/gen/setmode.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
Module Name:src Committed By: nia Date: Sat Mar 12 08:28:30 UTC 2022 Modified Files: src/lib/libc/gen: setmode.c Log Message: setmode(3): use reallocarr instead of malloc(x * y) To generate a diff of this commit: cvs rdiff -u -r1.34 -r1.35 src/lib/libc/gen/setmode.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
Module Name:src Committed By: nia Date: Sat Mar 12 08:28:30 UTC 2022 Modified Files: src/lib/libc/gen: setmode.c Log Message: setmode(3): use reallocarr instead of malloc(x * y) To generate a diff of this commit: cvs rdiff -u -r1.34 -r1.35 src/lib/libc/gen/setmode.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/setmode.c diff -u src/lib/libc/gen/setmode.c:1.34 src/lib/libc/gen/setmode.c:1.35 --- src/lib/libc/gen/setmode.c:1.34 Mon Jun 25 22:32:43 2012 +++ src/lib/libc/gen/setmode.c Sat Mar 12 08:28:30 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: setmode.c,v 1.34 2012/06/25 22:32:43 abs Exp $ */ +/* $NetBSD: setmode.c,v 1.35 2022/03/12 08:28:30 nia Exp $ */ /* * Copyright (c) 1989, 1993, 1994 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)setmode.c 8.2 (Berkeley) 3/25/94"; #else -__RCSID("$NetBSD: setmode.c,v 1.34 2012/06/25 22:32:43 abs Exp $"); +__RCSID("$NetBSD: setmode.c,v 1.35 2022/03/12 08:28:30 nia Exp $"); #endif #endif /* LIBC_SCCS and not lint */ @@ -205,9 +205,11 @@ setmode(const char *p) (void)sigprocmask(SIG_SETMASK, , NULL); setlen = SET_LEN + 2; - - if ((set = malloc((u_int)(sizeof(BITCMD) * setlen))) == NULL) + set = NULL; + if (reallocarr(, setlen, sizeof(BITCMD)) != 0) { + errno = ENOMEM; return (NULL); + } saveset = set; endset = set + (setlen - 2);
CVS commit: src/lib/libc/gen
Module Name:src Committed By: uwe Date: Tue Jan 4 20:01:52 UTC 2022 Modified Files: src/lib/libc/gen: exec.3 Log Message: exec(3): execlpe() first argument should be named "file" "path" arguments are names used as-is, "file" arguments to "p" functions are used to construct the pathname using $PATH if necessary. To generate a diff of this commit: cvs rdiff -u -r1.31 -r1.32 src/lib/libc/gen/exec.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/exec.3 diff -u src/lib/libc/gen/exec.3:1.31 src/lib/libc/gen/exec.3:1.32 --- src/lib/libc/gen/exec.3:1.31 Sun Sep 1 19:36:09 2019 +++ src/lib/libc/gen/exec.3 Tue Jan 4 20:01:52 2022 @@ -1,4 +1,4 @@ -.\" $NetBSD: exec.3,v 1.31 2019/09/01 19:36:09 wiz Exp $ +.\" $NetBSD: exec.3,v 1.32 2022/01/04 20:01:52 uwe Exp $ .\" .\" Copyright (c) 1991, 1993 .\" The Regents of the University of California. All rights reserved. @@ -52,7 +52,7 @@ .Ft int .Fn execlp "const char *file" "const char *arg" ... .Ft int -.Fn execlpe "const char *path" "const char *arg" ... "char *const envp[]" +.Fn execlpe "const char *file" "const char *arg" ... "char *const envp[]" .Ft int .Fn execle "const char *path" "const char *arg" ... "char *const envp[]" .Ft int
CVS commit: src/lib/libc/gen
Module Name:src Committed By: uwe Date: Tue Jan 4 20:01:52 UTC 2022 Modified Files: src/lib/libc/gen: exec.3 Log Message: exec(3): execlpe() first argument should be named "file" "path" arguments are names used as-is, "file" arguments to "p" functions are used to construct the pathname using $PATH if necessary. To generate a diff of this commit: cvs rdiff -u -r1.31 -r1.32 src/lib/libc/gen/exec.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
Module Name:src Committed By: kre Date: Mon Nov 15 16:00:25 UTC 2021 Modified Files: src/lib/libc/gen: posix_spawn_file_actions_addchdir.3 Log Message: More cleanups and typo corrections. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/lib/libc/gen/posix_spawn_file_actions_addchdir.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/posix_spawn_file_actions_addchdir.3 diff -u src/lib/libc/gen/posix_spawn_file_actions_addchdir.3:1.2 src/lib/libc/gen/posix_spawn_file_actions_addchdir.3:1.3 --- src/lib/libc/gen/posix_spawn_file_actions_addchdir.3:1.2 Mon Nov 15 14:07:30 2021 +++ src/lib/libc/gen/posix_spawn_file_actions_addchdir.3 Mon Nov 15 16:00:25 2021 @@ -1,4 +1,4 @@ -.\" $NetBSD: posix_spawn_file_actions_addchdir.3,v 1.2 2021/11/15 14:07:30 wiz Exp $ +.\" $NetBSD: posix_spawn_file_actions_addchdir.3,v 1.3 2021/11/15 16:00:25 kre Exp $ .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions @@ -58,11 +58,11 @@ that causes the working directory to be chdir(path) .Ed .Pp -had been called) when a new process is spawned usign this file actions +had been called) for a new process spawned using this file actions object. A relative .Fa path -is interpreted in relation to the working directory determined by any +is interpreted relative to the working directory determined by any prior actions. The string pointed to by .Fa path @@ -72,16 +72,16 @@ function. .Pp The .Fn posix_spawn_file_actions_addfchdir -function adds a fchdir action to the object reference by +function adds a fchdir action to the object referenced by .Fa file_actions -that causes the working directory to be set to +that causes the working directory to be set to the directory referenced by .Fa fildes (as if .Bd -literal -offset indent fchdir(fildes) .Ed .Pp -had been called) when a new process is spawned using this file actions object. +had been called) for a new process spawned using this file actions object. .\" The last paragraph of APPLICATION USAGE .Pp File actions are performed in the new process created by @@ -89,7 +89,9 @@ File actions are performed in the new pr or .Fn posix_spawnp in the same order that they were added to the file actions object. -Thus the execution of an "open" action that was created by a call to +Thus the execution of an +.Dq open +action that was created by a call to .Fn posix_spawn_file_actions_addopen that specifies a relative path will be affected by the execution of a chdir or fchdir action that was created by a previous call to @@ -123,7 +125,7 @@ is invalid. Insufficient memory exists to add the spawn file actions object. .El .Pp -It shall not be considered an error for the +It is not an error for the .Fa path or .Fa fildes
CVS commit: src/lib/libc/gen
Module Name:src Committed By: kre Date: Mon Nov 15 16:00:25 UTC 2021 Modified Files: src/lib/libc/gen: posix_spawn_file_actions_addchdir.3 Log Message: More cleanups and typo corrections. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/lib/libc/gen/posix_spawn_file_actions_addchdir.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
Module Name:src Committed By: wiz Date: Mon Nov 15 14:07:30 UTC 2021 Modified Files: src/lib/libc/gen: posix_spawn_file_actions_addchdir.3 Log Message: Clean up. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/lib/libc/gen/posix_spawn_file_actions_addchdir.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
Module Name:src Committed By: wiz Date: Mon Nov 15 14:07:30 UTC 2021 Modified Files: src/lib/libc/gen: posix_spawn_file_actions_addchdir.3 Log Message: Clean up. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/lib/libc/gen/posix_spawn_file_actions_addchdir.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/posix_spawn_file_actions_addchdir.3 diff -u src/lib/libc/gen/posix_spawn_file_actions_addchdir.3:1.1 src/lib/libc/gen/posix_spawn_file_actions_addchdir.3:1.2 --- src/lib/libc/gen/posix_spawn_file_actions_addchdir.3:1.1 Mon Nov 15 14:01:51 2021 +++ src/lib/libc/gen/posix_spawn_file_actions_addchdir.3 Mon Nov 15 14:07:30 2021 @@ -1,4 +1,4 @@ -.\" $NetBSD: posix_spawn_file_actions_addchdir.3,v 1.1 2021/11/15 14:01:51 christos Exp $ +.\" $NetBSD: posix_spawn_file_actions_addchdir.3,v 1.2 2021/11/15 14:07:30 wiz Exp $ .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions @@ -37,7 +37,7 @@ .Sh NAME .Nm posix_spawn_file_actions_addchdir , .Nm posix_spawn_file_actions_addfchdir -.Nd "add chdir or fchdir action to spawn file actions object" +.Nd add chdir or fchdir action to spawn file actions object .Sh LIBRARY .Lb libc .Sh SYNOPSIS @@ -49,9 +49,9 @@ .Sh DESCRIPTION The .Fn posix_spawn_file_actions_addchdir -function shall add a chdir action to the object referenced by +function adds a chdir action to the object referenced by .Fa file_actions -that shall cause the working directory to be set to +that causes the working directory to be set to .Fa path (as if .Bd -literal -offset indent @@ -62,19 +62,19 @@ had been called) when a new process is s object. A relative .Fa path -shall be interpreted in relation to the working directory determined by any +is interpreted in relation to the working directory determined by any prior actions. The string pointed to by .Fa path -shall be copied by the +is copied by the .Fn posix_spawn_file_actions_addchdir function. .Pp The .Fn posix_spawn_file_actions_addfchdir -function shall add a fchdir action to the object reference by +function adds a fchdir action to the object reference by .Fa file_actions -that shall cause the working directory to be set to +that causes the working directory to be set to .Fa fildes (as if .Bd -literal -offset indent @@ -95,17 +95,17 @@ that specifies a relative path will be a chdir or fchdir action that was created by a previous call to .Fn posix_spawn_file_actions_addchdir or -.Fn posix_spawn_file_actions_addfchdir -\&. Likewise, a relaive path passed to +.Fn posix_spawn_file_actions_addfchdir . +Likewise, a relative path passed to .Fn posix_spawn will be affected by the last chdir or fchdir action in the file action list. .Sh RETURN VALUES Upon successful completion, these function return zero; -otherwise, an error number shall be returned to indicate the error. +otherwise, an error number is returned to indicate the error. .Sh ERRORS The .Fn posix_spawn_file_actions_addfchdir -function shall fail if: +function fails if: .Bl -tag -width Er .It Bq Er EBADF The value specified by @@ -113,25 +113,21 @@ The value specified by is negative. .El .Pp -These functions shall fail if: -.Bl -tag -width Er -.It Bq Er ENOMEM -Insufficient memory exists to add the spawn file actions object. -.El -.Pp -These functions may fail if: +Both functions may fail with: .Bl -tag -width Er .It Bq Er EINVAL The value specified by .Fa file_actions is invalid. +.It Bq Er ENOMEM +Insufficient memory exists to add the spawn file actions object. .El .Pp It shall not be considered an error for the .Fa path or .Fa fildes -argument passed to these functions to specify a pathanme or file descriptor +argument passed to these functions to specify a pathname or file descriptor for which the specified operation could not be performed at the time of the call. Any such error will be detected when the associated file actions object is later used during a
CVS commit: src/lib/libc/gen
Module Name:src Committed By: wiz Date: Mon Nov 15 14:06:50 UTC 2021 Modified Files: src/lib/libc/gen: posix_spawn.3 Log Message: Sort SEE ALSO. To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/lib/libc/gen/posix_spawn.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
Module Name:src Committed By: wiz Date: Mon Nov 15 14:06:50 UTC 2021 Modified Files: src/lib/libc/gen: posix_spawn.3 Log Message: Sort SEE ALSO. To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/lib/libc/gen/posix_spawn.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/posix_spawn.3 diff -u src/lib/libc/gen/posix_spawn.3:1.12 src/lib/libc/gen/posix_spawn.3:1.13 --- src/lib/libc/gen/posix_spawn.3:1.12 Mon Nov 15 14:01:51 2021 +++ src/lib/libc/gen/posix_spawn.3 Mon Nov 15 14:06:50 2021 @@ -1,4 +1,4 @@ -.\" $NetBSD: posix_spawn.3,v 1.12 2021/11/15 14:01:51 christos Exp $ +.\" $NetBSD: posix_spawn.3,v 1.13 2021/11/15 14:06:50 wiz Exp $ .\" .\" Copyright (c) 2008 Ed Schouten .\" All rights reserved. @@ -442,11 +442,11 @@ is returned. .Xr open 2 , .Xr setpgid 2 , .Xr vfork 2 , +.Xr posix_spawn_file_actions_addchdir 3 , .Xr posix_spawn_file_actions_addclose 3 , .Xr posix_spawn_file_actions_adddup2 3 , -.Xr posix_spawn_file_actions_addopen 3 , -.Xr posix_spawn_file_actions_addchdir 3 , .Xr posix_spawn_file_actions_addfchdir 3 , +.Xr posix_spawn_file_actions_addopen 3 , .Xr posix_spawn_file_actions_destroy 3 , .Xr posix_spawn_file_actions_init 3 , .Xr posix_spawnattr_destroy 3 ,
CVS commit: src/lib/libc/gen
Module Name:src Committed By: nia Date: Tue Nov 2 08:39:20 UTC 2021 Modified Files: src/lib/libc/gen: fts.c Log Message: fts(3): Use reallocarr instead of realloc(x * y), eliminate a temporary variable. To generate a diff of this commit: cvs rdiff -u -r1.49 -r1.50 src/lib/libc/gen/fts.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/fts.c diff -u src/lib/libc/gen/fts.c:1.49 src/lib/libc/gen/fts.c:1.50 --- src/lib/libc/gen/fts.c:1.49 Tue May 31 07:49:09 2016 +++ src/lib/libc/gen/fts.c Tue Nov 2 08:39:20 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: fts.c,v 1.49 2016/05/31 07:49:09 pgoyette Exp $ */ +/* $NetBSD: fts.c,v 1.50 2021/11/02 08:39:20 nia Exp $ */ /*- * Copyright (c) 1990, 1993, 1994 @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)fts.c 8.6 (Berkeley) 8/14/94"; #else -__RCSID("$NetBSD: fts.c,v 1.49 2016/05/31 07:49:09 pgoyette Exp $"); +__RCSID("$NetBSD: fts.c,v 1.50 2021/11/02 08:39:20 nia Exp $"); #endif #endif /* LIBC_SCCS and not lint */ @@ -1015,12 +1015,9 @@ fts_sort(FTS *sp, FTSENT *head, size_t n * 40 so don't realloc one entry at a time. */ if (nitems > sp->fts_nitems) { - FTSENT **new; - - new = realloc(sp->fts_array, sizeof(FTSENT *) * (nitems + 40)); - if (new == 0) + if (reallocarr(>fts_array, + nitems + 40, sizeof(FTSENT *)) != 0) return (head); - sp->fts_array = new; sp->fts_nitems = fts_nitems_truncate(nitems + 40); } for (ap = sp->fts_array, p = head; p; p = p->fts_link)
CVS commit: src/lib/libc/gen
Module Name:src Committed By: nia Date: Tue Nov 2 08:39:20 UTC 2021 Modified Files: src/lib/libc/gen: fts.c Log Message: fts(3): Use reallocarr instead of realloc(x * y), eliminate a temporary variable. To generate a diff of this commit: cvs rdiff -u -r1.49 -r1.50 src/lib/libc/gen/fts.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
Module Name:src Committed By: nia Date: Fri Oct 29 10:40:00 UTC 2021 Modified Files: src/lib/libc/gen: scandir.c Log Message: scandir(3): Convert malloc(x * y) and realloc(x * y) to reallocarr To generate a diff of this commit: cvs rdiff -u -r1.28 -r1.29 src/lib/libc/gen/scandir.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/scandir.c diff -u src/lib/libc/gen/scandir.c:1.28 src/lib/libc/gen/scandir.c:1.29 --- src/lib/libc/gen/scandir.c:1.28 Fri Dec 16 04:45:04 2016 +++ src/lib/libc/gen/scandir.c Fri Oct 29 10:40:00 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: scandir.c,v 1.28 2016/12/16 04:45:04 mrg Exp $ */ +/* $NetBSD: scandir.c,v 1.29 2021/10/29 10:40:00 nia Exp $ */ /* * Copyright (c) 1983, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)scandir.c 8.3 (Berkeley) 1/2/94"; #else -__RCSID("$NetBSD: scandir.c,v 1.28 2016/12/16 04:45:04 mrg Exp $"); +__RCSID("$NetBSD: scandir.c,v 1.29 2021/10/29 10:40:00 nia Exp $"); #endif #endif /* LIBC_SCCS and not lint */ @@ -91,7 +91,7 @@ scandir(const char *dirname, struct dire int (*selectfn)(const struct dirent *), int (*dcomp)(const COMPARARG, const COMPARARG)) { - struct dirent *d, *p, **names, **newnames; + struct dirent *d, *p, **names; size_t nitems, arraysz; DIR *dirp; @@ -104,8 +104,8 @@ scandir(const char *dirname, struct dire if ((arraysz = dirsize(dirp->dd_fd, 0)) == 0) goto bad; - names = malloc(arraysz * sizeof(*names)); - if (names == NULL) + names = NULL; + if (reallocarr(, arraysz, sizeof(*names)) != 0) goto bad; nitems = 0; @@ -120,10 +120,8 @@ scandir(const char *dirname, struct dire if (nitems >= arraysz) { if ((arraysz = dirsize(dirp->dd_fd, arraysz)) == 0) goto bad2; - newnames = realloc(names, arraysz * sizeof(*names)); - if (newnames == NULL) + if (reallocarr(, arraysz, sizeof(*names)) != 0) goto bad2; - names = newnames; } /*
CVS commit: src/lib/libc/gen
Module Name:src Committed By: nia Date: Fri Oct 29 10:40:00 UTC 2021 Modified Files: src/lib/libc/gen: scandir.c Log Message: scandir(3): Convert malloc(x * y) and realloc(x * y) to reallocarr To generate a diff of this commit: cvs rdiff -u -r1.28 -r1.29 src/lib/libc/gen/scandir.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
Module Name:src Committed By: rillig Date: Sat Sep 11 19:58:24 UTC 2021 Modified Files: src/lib/libc/gen: popen.3 Log Message: popen.3: move popenve from BUGS to HISTORY To generate a diff of this commit: cvs rdiff -u -r1.21 -r1.22 src/lib/libc/gen/popen.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/popen.3 diff -u src/lib/libc/gen/popen.3:1.21 src/lib/libc/gen/popen.3:1.22 --- src/lib/libc/gen/popen.3:1.21 Tue Feb 21 19:53:20 2017 +++ src/lib/libc/gen/popen.3 Sat Sep 11 19:58:24 2021 @@ -1,4 +1,4 @@ -.\" $NetBSD: popen.3,v 1.21 2017/02/21 19:53:20 abhinav Exp $ +.\" $NetBSD: popen.3,v 1.22 2021/09/11 19:58:24 rillig Exp $ .\" .\" Copyright (c) 1991, 1993 .\" The Regents of the University of California. All rights reserved. @@ -29,7 +29,7 @@ .\" .\" @(#)popen.3 8.2 (Berkeley) 5/3/95 .\" -.Dd January 19, 2015 +.Dd September 11, 2021 .Dt POPEN 3 .Os .Sh NAME @@ -195,6 +195,11 @@ and a .Fn pclose function appeared in .At v7 . +.Pp +The +.Fn popenve +function first appeared in +.Nx 8 . .Sh BUGS Since the standard input of a command opened for reading shares its seek offset with the process that called @@ -220,8 +225,3 @@ always calls .Xr sh 1 , never calls .Xr csh 1 . -.Pp -The -.Fn popenve -function first appeared in -.Nx 8 .
CVS commit: src/lib/libc/gen
Module Name:src Committed By: rillig Date: Sat Sep 11 19:58:24 UTC 2021 Modified Files: src/lib/libc/gen: popen.3 Log Message: popen.3: move popenve from BUGS to HISTORY To generate a diff of this commit: cvs rdiff -u -r1.21 -r1.22 src/lib/libc/gen/popen.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
Module Name:src Committed By: dholland Date: Sat Aug 7 03:17:23 UTC 2021 Modified Files: src/lib/libc/gen: signal.3 Log Message: typo To generate a diff of this commit: cvs rdiff -u -r1.28 -r1.29 src/lib/libc/gen/signal.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
Module Name:src Committed By: dholland Date: Sat Aug 7 03:17:23 UTC 2021 Modified Files: src/lib/libc/gen: signal.3 Log Message: typo To generate a diff of this commit: cvs rdiff -u -r1.28 -r1.29 src/lib/libc/gen/signal.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/signal.3 diff -u src/lib/libc/gen/signal.3:1.28 src/lib/libc/gen/signal.3:1.29 --- src/lib/libc/gen/signal.3:1.28 Wed Dec 6 16:38:22 2017 +++ src/lib/libc/gen/signal.3 Sat Aug 7 03:17:23 2021 @@ -1,4 +1,4 @@ -.\" $NetBSD: signal.3,v 1.28 2017/12/06 16:38:22 dholland Exp $ +.\" $NetBSD: signal.3,v 1.29 2021/08/07 03:17:23 dholland Exp $ .\" .\" Copyright (c) 1980, 1991, 1993 .\" The Regents of the University of California. All rights reserved. @@ -148,7 +148,7 @@ function; ignored signals remain ignored. .Pp Only functions that are async-signal-safe can safely be used in signal -handlers, see +handlers; see .Xr sigaction 2 for a complete list. .Sh RETURN VALUES
CVS commit: src/lib/libc/gen
Module Name:src Committed By: kre Date: Sun Jul 11 16:30:41 UTC 2021 Modified Files: src/lib/libc/gen: initdir.c Log Message: Make sure dd_size is init'd, even when nothing has been read (so it will be 0). Reported on tech-userlevel by Mouse 20210711T044753+ To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/lib/libc/gen/initdir.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
Module Name:src Committed By: kre Date: Sun Jul 11 16:30:41 UTC 2021 Modified Files: src/lib/libc/gen: initdir.c Log Message: Make sure dd_size is init'd, even when nothing has been read (so it will be 0). Reported on tech-userlevel by Mouse 20210711T044753+ To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/lib/libc/gen/initdir.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/initdir.c diff -u src/lib/libc/gen/initdir.c:1.4 src/lib/libc/gen/initdir.c:1.5 --- src/lib/libc/gen/initdir.c:1.4 Fri Dec 16 04:45:04 2016 +++ src/lib/libc/gen/initdir.c Sun Jul 11 16:30:41 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: initdir.c,v 1.4 2016/12/16 04:45:04 mrg Exp $ */ +/* $NetBSD: initdir.c,v 1.5 2021/07/11 16:30:41 kre Exp $ */ /* * Copyright (c) 1983, 1993 @@ -31,7 +31,7 @@ #include #if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: initdir.c,v 1.4 2016/12/16 04:45:04 mrg Exp $"); +__RCSID("$NetBSD: initdir.c,v 1.5 2021/07/11 16:30:41 kre Exp $"); #endif /* LIBC_SCCS and not lint */ #include "namespace.h" @@ -242,6 +242,7 @@ retry: dirp->dd_size = ddptr - dirp->dd_buf; } else { dirp->dd_len = incr; + dirp->dd_size = 0; dirp->dd_buf = malloc((size_t)dirp->dd_len); if (dirp->dd_buf == NULL) return errno;
CVS commit: src/lib/libc/gen
Module Name:src Committed By: christos Date: Fri Jun 18 10:57:14 UTC 2021 Modified Files: src/lib/libc/gen: vis.c Log Message: PR/56260: Alex Richardson: Out-of-bounds stack read in lib/libc/gen/vis.c Also sync with other FreeBSD changes. To generate a diff of this commit: cvs rdiff -u -r1.74 -r1.75 src/lib/libc/gen/vis.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/vis.c diff -u src/lib/libc/gen/vis.c:1.74 src/lib/libc/gen/vis.c:1.75 --- src/lib/libc/gen/vis.c:1.74 Mon Nov 27 11:37:21 2017 +++ src/lib/libc/gen/vis.c Fri Jun 18 06:57:14 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: vis.c,v 1.74 2017/11/27 16:37:21 christos Exp $ */ +/* $NetBSD: vis.c,v 1.75 2021/06/18 10:57:14 christos Exp $ */ /*- * Copyright (c) 1989, 1993 @@ -57,7 +57,7 @@ #include #if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: vis.c,v 1.74 2017/11/27 16:37:21 christos Exp $"); +__RCSID("$NetBSD: vis.c,v 1.75 2021/06/18 10:57:14 christos Exp $"); #endif /* LIBC_SCCS and not lint */ #ifdef __FBSDID __FBSDID("$FreeBSD$"); @@ -353,12 +353,15 @@ makeextralist(int flags, const char *src wchar_t *dst, *d; size_t len; const wchar_t *s; + mbstate_t mbstate; len = strlen(src); if ((dst = calloc(len + MAXEXTRAS, sizeof(*dst))) == NULL) return NULL; - if ((flags & VIS_NOLOCALE) || mbstowcs(dst, src, len) == (size_t)-1) { + memset(, 0, sizeof(mbstate)); + if ((flags & VIS_NOLOCALE) + || mbsrtowcs(dst, , len, ) == (size_t)-1) { size_t i; for (i = 0; i < len; i++) dst[i] = (wchar_t)(u_char)src[i]; @@ -401,6 +404,7 @@ istrsenvisx(char **mbdstp, size_t *dlen, int clen = 0, cerr, error = -1, i, shft; char *mbdst, *mdst; ssize_t mbslength, maxolen; + mbstate_t mbstate; _DIAGASSERT(mbdstp != NULL); _DIAGASSERT(mbsrc != NULL || mblength == 0); @@ -458,10 +462,12 @@ istrsenvisx(char **mbdstp, size_t *dlen, * stop at NULs because we may be processing a block of data * that includes NULs. */ + memset(, 0, sizeof(mbstate)); while (mbslength > 0) { /* Convert one multibyte character to wchar_t. */ if (!cerr) - clen = mbtowc(src, mbsrc, MB_LEN_MAX); + clen = mbrtowc(src, mbsrc, MIN(mbslength, MB_LEN_MAX), + ); if (cerr || clen < 0) { /* Conversion error, process as a byte instead. */ *src = (wint_t)(u_char)*mbsrc; @@ -534,9 +540,10 @@ istrsenvisx(char **mbdstp, size_t *dlen, len = wcslen(start); maxolen = dlen ? *dlen : (wcslen(start) * MB_LEN_MAX + 1); olen = 0; + memset(, 0, sizeof(mbstate)); for (dst = start; len > 0; len--) { if (!cerr) - clen = wctomb(mbdst, *dst); + clen = wcrtomb(mbdst, *dst, ); if (cerr || clen < 0) { /* * Conversion error, process as a byte(s) instead.
CVS commit: src/lib/libc/gen
Module Name:src Committed By: christos Date: Fri Jun 18 10:57:14 UTC 2021 Modified Files: src/lib/libc/gen: vis.c Log Message: PR/56260: Alex Richardson: Out-of-bounds stack read in lib/libc/gen/vis.c Also sync with other FreeBSD changes. To generate a diff of this commit: cvs rdiff -u -r1.74 -r1.75 src/lib/libc/gen/vis.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
Module Name:src Committed By: riastradh Date: Mon May 24 23:59:59 UTC 2021 Modified Files: src/lib/libc/gen: setjmp.3 Log Message: Clarify what happens when you longjmp(..., 0). Derived from C99 7.13.2.1 `The longjmp function'. To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/lib/libc/gen/setjmp.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/setjmp.3 diff -u src/lib/libc/gen/setjmp.3:1.17 src/lib/libc/gen/setjmp.3:1.18 --- src/lib/libc/gen/setjmp.3:1.17 Sat May 31 16:15:07 2008 +++ src/lib/libc/gen/setjmp.3 Mon May 24 23:59:59 2021 @@ -1,4 +1,4 @@ -.\" $NetBSD: setjmp.3,v 1.17 2008/05/31 16:15:07 enami Exp $ +.\" $NetBSD: setjmp.3,v 1.18 2021/05/24 23:59:59 riastradh Exp $ .\" .\" Copyright (c) 1990, 1991, 1993 .\" The Regents of the University of California. All rights reserved. @@ -85,6 +85,15 @@ invocation of the call had just returned the value specified by .Fa val , instead of 0. +The +.Fn longjmp +functions cannot cause +.Fn setjmp +to return 0; if +.Fa val +is 0, +.Fn setjmp +returns 1 instead. .Pp Pairs of calls may be intermixed, i.e., both .Fn sigsetjmp
CVS commit: src/lib/libc/gen
Module Name:src Committed By: riastradh Date: Mon May 24 23:59:59 UTC 2021 Modified Files: src/lib/libc/gen: setjmp.3 Log Message: Clarify what happens when you longjmp(..., 0). Derived from C99 7.13.2.1 `The longjmp function'. To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/lib/libc/gen/setjmp.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
Module Name:src Committed By: simonb Date: Mon May 3 08:30:30 UTC 2021 Modified Files: src/lib/libc/gen: Makefile.inc Log Message: Whitespace police. To generate a diff of this commit: cvs rdiff -u -r1.212 -r1.213 src/lib/libc/gen/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/gen/Makefile.inc diff -u src/lib/libc/gen/Makefile.inc:1.212 src/lib/libc/gen/Makefile.inc:1.213 --- src/lib/libc/gen/Makefile.inc:1.212 Tue Apr 20 21:42:32 2021 +++ src/lib/libc/gen/Makefile.inc Mon May 3 08:30:30 2021 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.inc,v 1.212 2021/04/20 21:42:32 christos Exp $ +# $NetBSD: Makefile.inc,v 1.213 2021/05/03 08:30:30 simonb Exp $ # from: @(#)Makefile.inc 8.6 (Berkeley) 5/4/95 # gen sources @@ -102,7 +102,7 @@ MLINKS+=endutxent.3 getutxent.3 endutxen MLINKS+=endutent.3 getutent.3 endutent.3 getutline.3 endutent.3 pututline.3 \ endutent.3 setutent.3 MLINKS+=err.3 verr.3 err.3 errx.3 err.3 verrx.3 err.3 warn.3 err.3 vwarn.3 \ -err.3 warnx.3 err.3 vwarnx.3 err.3 errc.3 err.3 verrc.3 err.3 warnc.3 \ + err.3 warnx.3 err.3 vwarnx.3 err.3 errc.3 err.3 verrc.3 err.3 warnc.3 \ err.3 vwarnc.3 MLINKS+=exec.3 execl.3 exec.3 execle.3 exec.3 execlp.3 exec.3 execlpe.3 \ exec.3 execv.3 exec.3 execvp.3 exec.3 execvpe.3 exec.3 exect.3 @@ -113,7 +113,7 @@ MLINKS+=extattr_namespace_to_string.3 ex extattr_copy_file.3 fcpxattr.3 \ extattr_copy_file.3 lcpxattr.3 MLINKS+=fpgetmask.3 fpgetround.3 fpgetmask.3 fpgetsticky.3 \ - fpgetmask.3 fpsetmask.3 fpgetmask.3 fpsetround.3 \ + fpgetmask.3 fpsetmask.3 fpgetmask.3 fpsetround.3 \ fpgetmask.3 fpsetsticky.3 fpgetmask.3 fpgetprec.3 \ fpgetmask.3 fpsetprec.3 MLINKS+=fts.3 fts_open.3 fts.3 fts_read.3 fts.3 fts_children.3 \
CVS commit: src/lib/libc/gen
Module Name:src Committed By: simonb Date: Mon May 3 08:30:30 UTC 2021 Modified Files: src/lib/libc/gen: Makefile.inc Log Message: Whitespace police. To generate a diff of this commit: cvs rdiff -u -r1.212 -r1.213 src/lib/libc/gen/Makefile.inc Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.