Commit Graph

2394 Commits

Author SHA1 Message Date
riastradh 2b5e567d9c libc: Reintroduce getentropy.
This was introduced two years ago when the getrandom/getentropy API
question was still open, and removed because the discussion was
ongoing.  Now getentropy is more widely adopted and soon to be in
POSIX.  So reintroduce the symbol into libc since we'll be keeping it
anyway.  Discussion of details of the semantics, as interpreted by
NetBSD, is ongoing, but the symbol needs to get in before the
netbsd-10 branch.  The draft POSIX text is
(https://www.opengroup.org/austin/docs/austin_1110.pdf):

    SYNOPSIS
        #include <unistd.h>

        int getentropy(void *buffer, size_t length);

    DESCRIPTION
        The getentropy() function shall write length bytes of data
        starting at the location pointed to by buffer. The output
        shall be unpredictable high quality random data, generated by
        a cryptographically secure pseudo-random number
        generator. The maximum permitted value for the length
        argument is given by the {GETENTROPY_MAX} symbolic constant
        defined in <limits.h>.

    RETURN VALUES
        Upon successful completion, getentropy() shall return 0;
        otherwise, -1 shall be retunred and errno set to indicate the
        error.

    ERRORS
        The getentropy() function shall fail if:

        [EINVAL]        The value of length is greater than
                        {GETENTROPY_MAX}.

        The getentropy() function may fail if:

        [ENOSYS]        The system does not provide the necessary
                        source of entropy.

    RATIONALE
        The getentropy() function is not a cancellation point.

Minor changes from the previous introduction of getentropy into libc:

- Return EINVAL, not EIO, on buflen > 256.
- Define GETENTROPY_MAX in limits.h.

The declaration of getentropy in unistd.h and definition of
GETENTROPY_MAX in limits.h are currently conditional on
_NETBSD_SOURCE.  When the next revision of POSIX is finalized, we can
expose them also under _POSIX_C_SOURCE > 20yymmL as usual -- and this
can be done as a pullup without breaking existing compiled programs.
2022-05-31 13:42:58 +00:00
andvar ff23aff6ad fix various typos in comments, documentation and messages. 2022-05-31 08:43:13 +00:00
andvar a5c1e39951 s/wich/which in comments. 2022-05-15 20:37:50 +00:00
rillig 388550b026 lib: remove CONSTCOND comment
Since 2021-01-31, lint doesn't need it anymore for the common pattern of
'do ... while (0)'.
2022-04-19 20:32:14 +00:00
andvar f84252b461 fix various typos in comments and log messages. 2022-04-16 18:15:20 +00:00
gutteridge b9dd3a3166 popen.3: revert s/null-/nul-/ change, this is subject to debate 2022-03-27 00:32:15 +00:00
gutteridge 9d5e1357c3 popen.3: minor spelling, grammar, style, and xref tweaks 2022-03-24 01:55:15 +00:00
christos 3249d3dc15 reallocarr returns errno. preserve it. 2022-03-12 17:31:39 +00:00
nia 6e2ef45a7f setmode(3): use reallocarr instead of realloc(x * y) 2022-03-12 08:32:02 +00:00
nia 639499d824 setmode(3): use reallocarr instead of malloc(x * y) 2022-03-12 08:28:30 +00:00
uwe bcb93c2ab4 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.
2022-01-04 20:01:52 +00:00
andvar cbf5c65aff s/occured/occurred/ in comments, log messages and man pages. 2021-12-10 20:36:02 +00:00
andvar 8c4df4824b s/unaccessible/inaccessible/ 2021-12-10 19:30:05 +00:00
msaitoh 2b50e65cd3 s/numberic/numeric/ in comment. 2021-12-05 05:03:05 +00:00
kre 676e85297d More cleanups and typo corrections. 2021-11-15 16:00:25 +00:00
wiz 0c114f84f3 Clean up. 2021-11-15 14:07:30 +00:00
wiz 4769a7f2b1 Sort SEE ALSO. 2021-11-15 14:06:50 +00:00
christos 18b914f008 Add man pages for posix_spawn_file_actions_add{f,}chdir from piyush 2021-11-15 14:01:50 +00:00
christos 1c05296632 Commit the userland portion of the posix_spawn_chdir project by Piyush Sachdeva 2021-11-07 14:34:30 +00:00
nia 464e94c8b5 fts(3): Use reallocarr instead of realloc(x * y), eliminate a temporary
variable.
2021-11-02 08:39:20 +00:00
kre f3643917bc Add "--" 'options end' parameter to the sh -c call that runs the
command, so that the command cannot appear to be more options
(which always then fails, as there would be no arg for "-c" to
treat as the command string in that case).

For the full (LONG) explanation, see:
   http://mail-index.netbsd.org/current-users/2021/10/29/msg041629.html
2021-10-29 19:27:06 +00:00
nia 2ee81e7b06 scandir(3): Convert malloc(x * y) and realloc(x * y) to reallocarr 2021-10-29 10:40:00 +00:00
andvar 207defd036 Add missing double p and d for stopped and overriden accordingly.
Fix few more typos along the way, mainly in copy-pasted comments.
2021-09-11 20:28:03 +00:00
rillig 7f8984330e popen.3: move popenve from BUGS to HISTORY 2021-09-11 19:58:24 +00:00
andvar 6584ea569e fix various typos in compatibility, mainly in comments. 2021-08-09 20:49:08 +00:00
dholland 22cff1a7de typo 2021-08-07 03:17:23 +00:00
kre 144bb499f5 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+0000
2021-07-11 16:30:41 +00:00
christos 747b089bcb PR/56260: Alex Richardson: Out-of-bounds stack read in lib/libc/gen/vis.c
Also sync with other FreeBSD changes.
2021-06-18 10:57:14 +00:00
riastradh 2b70a4d80e Clarify what happens when you longjmp(..., 0).
Derived from C99 7.13.2.1 `The longjmp function'.
2021-05-24 23:59:59 +00:00
simonb e85380d6f9 Add links for the other functions documented in arc4random(3). 2021-05-03 11:07:55 +00:00
simonb 0cdd944264 Whitespace police. 2021-05-03 08:30:30 +00:00
christos c510facea2 Instead of compiling files with -fcommon, create an include file and declare
the 3 symbols that need to be common using an attribute. Put all the 3 symbol
definitions in libc in one place (initfini.c). Reviewed by joerg@
2021-04-20 21:42:31 +00:00
mrg 4084f973da use -fcommon where necessary. 2021-04-12 03:57:06 +00:00
rillig bc7a3fe21e libc/gen: fix hack for previously unsupported lint initializers
Supported since init.c 1.182 from 2021-03-30.
2021-03-30 15:31:51 +00:00
msaitoh 44f4353477 s/skiping/skipping/ 2021-03-11 01:13:11 +00:00
simonb b2de856f1a Add manpage links for asysctl(3) and asysctlbyname(3), already described
in sysctl(3).
2021-03-10 13:30:34 +00:00
wiz e607de02f4 Fix xref, add missing word. 2021-02-26 06:39:14 +00:00
rin e0b51b0024 Add missing endutent.3 to MAN. 2021-02-26 04:28:14 +00:00
christos af5f2d14c6 put back line accidentally removed. 2021-02-26 03:19:34 +00:00
christos 64f644717c PR/56012: Kouichi Hashikawa: getutent(3) man page is missing 2021-02-26 03:05:01 +00:00
rillig 0249cb139b isascii.3: fix typo 2021-02-21 16:33:22 +00:00
dholland 33b1043c4f Document that rewinddir(3) might either reopen or just lseek the dir.
(Currently it depends on the underlying directory, but documenting the
exact details seems inadvisable.)

Also, Someone(TM) should check if POSIX permits this or if we ought to
improve the implementation.
2021-02-17 23:51:04 +00:00
dholland 7a305b1ba6 Fix some typos/malapropisms in directory(3). 2021-02-17 23:39:46 +00:00
nia 796e3f7c10 remove getentropy bits 2020-09-22 21:37:47 +00:00
kre 631837b7c6 When not compiling -DSMALL permit use of names RTMIN[+n] and RTMAX[-n]
(where n is a decimal integer in the range [0 .. SIGRTMAX-SIGRTMIN].
As usual a leading "sig" is ignored and the strings are case independent.

Some implementations do not name the real time signals, and using
labels like RTMIN+3 can be the only way they can be manipulated,
so allow that technique (we still return the RTnn names on the inverse
translation though).

Because this is used by both kill(1) and sh(1) the kill and trap
commands both gain access to the new notation (when !SMALL).
2020-08-20 22:56:56 +00:00
christos 9630bba2c9 make sure errno is always set when we return -1 (Anon Ymous) 2020-08-18 19:18:06 +00:00
christos 65c5691e7d revert previous; utmpxname is already documented in getlastlogx.3. Should
probably be moved.
2020-07-05 01:09:48 +00:00
christos 20e726508c document utmpxname(3) 2020-07-05 01:05:50 +00:00
kamil 5d0165c29d timespec_get(3) was developed by myself
Remove FreeBSD from the authorship as it was just a pullup of small
documentation changes.
2020-06-02 19:30:29 +00:00
joerg 8409cf4a20 Hook up proper fork lock handling for malloc:
- lock all relevant mutexes just before fork
- unlock all mutexes just after fork in the parent
- full reinit non-spinlocks in the child
This is not using the normal pthread_atfork interface to ensure order of
operation, malloc is used as implementation detail too often.
2020-05-15 14:37:21 +00:00