Home | History | Annotate | Download | only in include
History log of /src/include/unistd.h
RevisionDateAuthorComments
 1.169  01-Nov-2024  nia libc: Expose pipe2 and dup3 to POSIX.2024 applications
 1.168  20-Sep-2024  kre The gethostname() function is (from when it was added to POSIX)
a base function, not an XSI optional extension, so it should be
made visible whenever _POSIX_C_SOURCE is >= 200112 (Posix Issue 6),
and not only for _XOPEN_SOURCE >= 600 (which would be for an XSI
function added then).

Move the prototype for gethostname() to the right section of the file.

Note this makes the visibility of gethostname() wider, it will remain
visible everywhere it was visible before - the only conceivable issue
would be if someone was abusing the name in a context where they
shouldn't be. (Some non NetBSD application, as all of NetBSD is
compiled with _NetBSD_SOURCE defined, everything tends to be visible,
so no change at all for the NetBSD source tree).

Issue pointed out by Thomas Klausner (wiz@)
 1.167  15-Aug-2024  riastradh getentropy(3): Make this visible to POSIX.1-2024 applications.

Likewise GETENTROPY_MAX.

It is now part of POSIX:

https://pubs.opengroup.org/onlinepubs/9799919799.2024edition/functions/getentropy.html

Cite standard in man page too. While here, use `.Nm' rather than
`.Fn getentropy' for self-reference in the man page, for consistency
with other usage.

PR standards/58603: getentropy(3): update visibility and documentation
for POSIX.1-2024
 1.166  20-May-2024  christos Rename dup3110 to dup3100 to match historical practice for NetBSD-11,
because we already have kevent100. Fix compat_dup3 to belong in compat_100
not compat_110.
 1.165  19-May-2024  christos version dup3
 1.164  19-Jan-2024  christos Add missing decls
 1.163  31-May-2022  riastradh branches: 1.163.2;
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.
 1.162  15-Oct-2021  andvar fix typos in comments.
 1.161  04-Dec-2020  kre Correct typo in previous.
 1.160  04-Dec-2020  christos Add __null_sentinel
 1.159  22-Sep-2020  nia remove getentropy bits
 1.158  16-May-2020  christos Add ACL support for FFS. From FreeBSD.
 1.157  06-May-2020  nia Add getentropy() to libc - a simple wrapper to access the kernel CSPRNG.

Posted to tech-userlevel@ a week ago and reviewed by riastradh@.

GETENTROPY(3) Library Functions Manual GETENTROPY(3)

NAME
getentropy - fill a buffer with high quality random data

LIBRARY
Standard C Library (libc, -lc)

SYNOPSIS
#include <unistd.h>

int
getentropy(void *buf, size_t buflen);

DESCRIPTION
The getentropy() function fills a buffer with high quality random data,
suitable for seeding cryptographically secure psuedorandom number
generators.

getentropy() is only intended for seeding random number generators and is
not intended for use by regular code which simply needs secure random
data. For this purpose, please use arc4random(3).

The maximum value for buflen is 256 bytes.

IMPLEMENTATION NOTES
getentropy() reads from the sysctl(7) variable kern.arandom.

RETURN VALUES
The getentropy() function returns 0 on success, and -1 if an error
occurred.

ERRORS
getentropy() will succeed unless:

[EFAULT] The buf argument points to an invalid memory address.

[EIO] Too many bytes were requested.

SEE ALSO
arc4random(3), rnd(4)

STANDARDS
The getentropy() function is non-standard.

HISTORY
The getentropy() function first appeared in OpenBSD 5.6, then in
FreeBSD 12.0, and NetBSD 10.
 1.156  31-Mar-2020  kamil Add getsid(2) to the XOPEN namespace (again)
 1.155  31-Mar-2020  kamil Expose getsid(2) to POSIX >= 2008
 1.154  15-Sep-2019  christos one fexecve declaration should be enough.
 1.153  15-Sep-2019  christos Remove the _INCOMPLETE_XOPEN_C063 stuff.
 1.152  15-Sep-2019  christos Declare fexecve
 1.151  18-Nov-2018  christos more type protection macro lossage.
 1.150  15-Aug-2018  martin PR standards/53525: move getsubopt() to stdlib.h
 1.149  06-Feb-2018  christos branches: 1.149.2; 1.149.4;
fix typo
 1.148  06-Feb-2018  christos detect duplicate declaration of pthread_atfork() in pthread.h
 1.147  30-Jun-2016  dholland PR 51287 Ralf Nolden: posix_fallocate belongs in <fcntl.h>
 1.146  18-Jun-2016  kamil Use generic types in the profil(2) function prototype (<unistd.h>)
 1.145  24-Mar-2015  wiz Put fseeko, ftello, pread, and pwrite in the POSIX 2001 namespace.
Ok christos, apb, martin
 1.144  22-Feb-2015  christos PR/49684: Pierre Pronchery: readlinkat(2) return type is wrong.
 1.143  26-Sep-2014  christos add execvpe, execlpe (reviewed by phone)
 1.142  25-Jul-2014  dholland branches: 1.142.2;
Add userlevel manifestations of posix_fallocate and fdiscard, in
unistd.h and libc, and add a man page.

Allow wiggle room in the man page for implementations of fallocate
that either (a) don't fully unwind on failure, leaving new blocks
allocated without changing the file size, or (b) create only in-memory
transient reservations that disappear when crashing or rebooting.

Also, add crossreference to fdiscard from ftruncate(2), and remove the
old BUGS entry from there that called for a generalized version that
allows discarding ranges of a file: that's what fdiscard is.
 1.141  18-Jun-2014  christos add mkostemp{s,} mkstemps from FreeBSD
 1.140  02-Jan-2014  christos branches: 1.140.2;
PR/4891: Wiz: readlink moved from xopen to base at issue 5.
 1.139  09-Oct-2013  njoly Follow OpenGroup online specification[1], move
fchmodat/mkdirat/mkfifoat/mknodat prototypes to <sys.stat.h>.

[1] http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_stat.h.html
 1.138  12-Jan-2013  dholland Remove #if defined(_KERNEL) around a userlevel function.
 1.137  01-Dec-2012  skrll Check for _NETBSD_SOURCE being defined wherever we check for
_INCOMPLETE_XOPEN_C063 so that we expose the new POSIX extended API set
recently added.
 1.136  18-Nov-2012  manu Add most system calls for POSIX extended API set, part 2, with test cases:
faccessat(2), fchmodat(2), fchownat(2), fstatat(2), mkdirat(2), mkfifoat(2),
mknodat(2), linkat(2), readlinkat(2), symlinkat(2), renameat(2), unlinkat(2),
utimensat(2), openat(2).

Also implement O_SEARCH for openat(2)

Still missing:
- some flags for openat(2)
- fexecve(2) implementation
 1.135  14-Jul-2012  darrenr branches: 1.135.2;
bin/46703: BSD r-commands use wrong source address for stderr
http://gnats.netbsd.org/cgi-bin/query-pr-single.pl?number=46703
Bump libc minor for the addition of rresvport_af_addr()
 1.134  14-Apr-2012  christos new flag.
 1.133  13-Apr-2012  christos add more options.
 1.132  13-Apr-2012  christos add timeout to getpassfd.
 1.131  12-Apr-2012  christos add GETPASS_ECHO_STAR
 1.130  12-Apr-2012  christos add getpassfd
 1.129  12-Apr-2012  christos add getpass_r
 1.128  05-Nov-2011  joerg branches: 1.128.2;
Add __returns_twice for the attribute of the same name. This makes the
attribute explicit based on the functions GCC gives it too.
 1.127  08-Aug-2011  manu branches: 1.127.2;
First stage of support for Extended API set 2. Most of the think is
unimplemented, except enough of linkat(2) to hardlink to a symlink.

Everything new in headers is guarded #ifdef _INCOMPLETE_XOPEN_C063 since
some software (e.g.: xcvs in our own tree) will assume they can use openat(2)
when AT_FDCWD is defined. _INCOMPLETE_XOPEN_C063 will go away once support
will be completed.
 1.126  26-Jun-2011  christos * Arrange for interfaces that create new file descriptors to be able to
set close-on-exec on creation (http://udrepper.livejournal.com/20407.html).

- Add F_DUPFD_CLOEXEC to fcntl(2).
- Add MSG_CMSG_CLOEXEC to recvmsg(2) for unix file descriptor passing.
- Add dup3(2) syscall with a flags argument for O_CLOEXEC, O_NONBLOCK.
- Add pipe2(2) syscall with a flags argument for O_CLOEXEC, O_NONBLOCK.
- Add flags SOCK_CLOEXEC, SOCK_NONBLOCK to the socket type parameter
for socket(2) and socketpair(2).
- Add new paccept(2) syscall that takes an additional sigset_t to alter
the sigmask temporarily and a flags argument to set SOCK_CLOEXEC,
SOCK_NONBLOCK.
- Add new mode character 'e' to fopen(3) and popen(3) to open pipes
and file descriptors for close on exec.
- Add new kqueue1(2) syscall with a new flags argument to open the
kqueue file descriptor with O_CLOEXEC, O_NONBLOCK.

* Fix the system calls that take socklen_t arguments to actually do so.

* Don't include userland header files (signal.h) from system header files
(rump_syscallargs.h).

* Bump libc version for the new syscalls.
 1.125  19-Jan-2011  christos Re-do ssp hijacking by defining inline functions and using the weak libc
symbols to do the indirection for unistd.h instead of #define tricks.
Fixes compilation for things that define struct { ssize_t read(int fd, ...); }.
 1.124  27-Aug-2010  christos The signal number argument in psignal is int not unsigned int.
Add psiginfo.
 1.123  17-Apr-2010  christos change size_t to ssize_t for POSIX compliance.
 1.122  17-Apr-2010  christos PR/43172: Jukka Ruohonen: swab(3) lacks restrict-keyword
 1.121  22-Jul-2009  kleink branches: 1.121.2;
Declare strsignal(3) in <string.h>, per POSIX-2008, and adjust
documentation accordingly.

Fixes PR standards/41325 from Perry E. Metzger.
 1.120  11-Jan-2009  christos merge christos-time_t
 1.119  06-Jan-2009  lukem Change the second argument of getlogin_r() from int to size_t, per POSIX.
 1.118  25-Jun-2008  ad branches: 1.118.4; 1.118.6;
SUS says that pthread_atfork() must also be in unistd.h
 1.117  25-Jun-2008  ad Add getlogin_r. Manual page changes mostly lifted from FreeBSD.
 1.116  28-Apr-2008  martin branches: 1.116.2; 1.116.4;
Remove clause 3 and 4 from TNF licenses
 1.115  01-Apr-2008  drochner branches: 1.115.2;
everyone else assumes that defining "_XOPEN_SOURCE" means XPG4.2,
so remove comparisions against the numerical values "3" or "4"
 1.114  24-Dec-2007  perry change some __attribute__s to __keywords
 1.113  09-Aug-2007  he branches: 1.113.2;
Add a new socket option for unix domain sockets: LOCAL_PEEREID, to make
it possible to get the pid, euid and egid of the process at the remote
end at the time it did bind() or connect().

Add a new libc function, getpeereid() to easily get at the euid and egid.
As a consequence, bump libc's minor number.

Document the LOCAL_PEEREID socket option in unix(4).

Based on contribution by Arne H. Juul, minor modifications by myself.
 1.112  02-Aug-2007  kristerw branches: 1.112.2;
Do not include SSP files unless _FORTIFY_SOURCE > 0.
 1.111  30-May-2007  tls Match usage of FORTIFY_SOURCE on other platforms by not requiring special
include path: the normal header files now include the "SSP" ones (which one
should note are not really named right: SSP and FORTIFY_SOURCE are independent
features).

Disable USE_SSP on targets where the compiler doesn't support it at all
(mips, alpha) or it's known broken (sh3). But enable FORTIFY_SOURCE,
without SSP, on those platforms -- tested on mipsel.
 1.110  26-Dec-2005  perry branches: 1.110.4; 1.110.6;
u_intN_t -> uintN_t
 1.109  24-Dec-2005  perry Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.108  26-Sep-2005  kleink Move ttyname_r() to the 1003.1c-1995 section.
 1.107  25-Sep-2005  christos ttyname_r returns int.
 1.106  25-Sep-2005  christos Add getenv_r and ttyname_r
 1.105  13-Sep-2005  christos compat code reorg
 1.104  11-Jun-2005  christos PR/30503: Nicolas Joly: swapctl(2) prototype does not match corresponding
syscall
 1.103  22-May-2005  kleink Remove the compatibility select() prototype. Going back to Lite2 select(2)
has also mandated <sys/time.h> to be included, which is now sufficient
for the prototype and all related declarations; thus the local duplicate
of the prototype can be removed. Approved by Christos.
 1.102  05-Mar-2005  kleink Provide select() and pselect() prototypes in <sys/select.h>, per
1003.1-2001, and leave the select() prototype in <unistd.h> for
compatibility. To allow for transition, reorganization of this is
deferred until netbsd-3 gets branched.
 1.101  03-Feb-2005  perry de-__P -- the hack is long since useless. Discussed with christos,
matt, kleink, others. Approved by christos.
 1.100  06-Jan-2005  lukem Implement getgroupmembership(3). This is similar to getgrouplist(3), except
that the "int maxgroups" and "int *ngroups" parameters are separated into
two separate parameters which makes it possible to call multiple nsswitch
back-ends and have the results correctly merged.
getgrouplist(3) is now implemented using getgroupmembership(3).

Proposed on tech-userlevel on December 1, 2004.
 1.99  01-Jun-2004  kleink Move declaration of closefrom(3) to local extensions.
 1.98  31-May-2004  itojun implement closefrom(3).
 1.97  10-May-2004  kleink While I'm at it: add restrict qualifiers to readlink(2).
 1.96  10-May-2004  kleink POSIX-2001: Change readlink(2)'s return type from int to ssize_t.
 1.95  18-Nov-2003  thorpej Userland portion of fsync_range(2), written by Bill Studenmund, and
contributed by Wasabi Systems, Inc.
 1.94  07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22270, verified by myself.
 1.93  08-Jul-2003  kristerw Do not give names to the parameters in function prototypes (those names
reduces the usefulness of the gcc -Wshadow flag).
 1.92  28-Apr-2003  bjh21 Add a new feature-test macro, _NETBSD_SOURCE. If this is defined
by the application, all NetBSD interfaces are made visible, even
if some other feature-test macro (like _POSIX_C_SOURCE) is defined.
<sys/featuretest.h> defined _NETBSD_SOURCE if none of _ANSI_SOURCE,
_POSIX_C_SOURCE and _XOPEN_SOURCE is defined, so as to preserve
existing behaviour.

This has two major advantages:
+ Programs that require non-POSIX facilities but define _POSIX_C_SOURCE
can trivially be overruled by putting -D_NETBSD_SOURCE in their CFLAGS.
+ It makes most of the #ifs simpler, in that they're all now ORs of the
various macros, rather than having checks for (!defined(_ANSI_SOURCE) ||
!defined(_POSIX_C_SOURCE) || !defined(_XOPEN_SOURCE)) all over the place.

I've tried not to change the semantics of the headers in any case where
_NETBSD_SOURCE wasn't defined, but there were some places where the
current semantics were clearly mad, and retaining them was harder than
correcting them. In particular, I've mostly normalised things so that
_ANSI_SOURCE gets you the smallest set of stuff, then _POSIX_C_SOURCE,
_XOPEN_SOURCE and _NETBSD_SOURCE in that order.

Tested by building for vax, encouraged by thorpej, and uncontested in
tech-userlevel for a week.
 1.91  14-Apr-2003  kleink Well, _The_ Open Group.
 1.90  14-Apr-2003  kleink Use the real TOG specification name for references.
 1.89  14-Apr-2003  jdolecek seteuid() and setegid() were adopted in IEEE Std 1003.1-2001 + X/Open
portability guide issue 6, adjust headers to expose the function
prototypes with appropriate _POSIX_C_SOURCE/_XOPEN_SOURCE defines
fixes standards/21136 by MAEKAWA Masahide
 1.88  29-Jul-2001  wiz Remove variable name from prototype.
Reported by John Heasley on current-users on 29 July 2001.
 1.87  18-Jul-2001  kleink Avoid trad. cpp recursion in intptr_t definition.
 1.86  18-Dec-2000  christos branches: 1.86.2;
protect against multiple declarations.
 1.85  27-Jun-2000  kleink Define intptr_t and uintptr_t via <machine/int_types.h>.
 1.84  21-Apr-2000  minoura New syscall issetugid.
 1.83  02-Apr-2000  christos backout previous. the definition of struct option caused too many namespace
collisions. Instead, define getopt_long in getopt.h and getopt in unistd.h
where it belongs.
 1.82  01-Apr-2000  christos Add getopt.h and collect all the getopt related stuff here.
Make unistd.h include <getopt.h> to get the getopt stuff.
This adds support for getopt_long from Dieter Baron and Thomas Klausner.
 1.81  27-Jan-2000  itojun add IPv6 support to rcmd() and friends.
rcmd() and iruserok(): unchanged
ruserok(): became address family independent
rcmd_af(), iruesrok_sa(): address family independent
 1.80  10-Jan-2000  kleink Move <null.h> to <sys/null.h> for the purpose of avoiding conflicts due to
std C headers including it, and a kernel module written in C++ would benfit
as well.
 1.79  22-Dec-1999  kleink For the benefit of G++'s null pointer constant implementation, #define NULL
as __null with egcs 1.0 (GCC 2.90) and above. As several headers are affected
by this change, move the definition into a new header file, <null.h>, to ease
maintenance.
 1.78  02-Dec-1999  kleink Change the declaration of the argv argument to getopt(3) from "char * const *"
(as originally declared in System V) to "char * const []", as was done in
1003.2 and subsequently propagated into XPG4.
From Andrew Cagney in PR lib/8930.
 1.77  12-Jul-1999  kleink branches: 1.77.4;
XSH5: change function signature to `void *sbrk(intptr_t)'.
 1.76  03-Jul-1999  kleink Move IPv6-related declarations into the implementation-defined domain.
 1.75  01-Jul-1999  itojun define IPv6 library functions and structures, as defined in
RFC2292 and RFC2553.
define internal state structure for IPv6-transport resolver.

Commits for source code will follow.
 1.74  20-Apr-1999  kleink #ifdef __STDC__ -> #if __STDC__
 1.73  26-Mar-1999  sommerfe branches: 1.73.2;
move __getcwd prototypes to libc-private header file.

XXX duplicate the prototype in getcwd regression test (which needs to
call the syscall directly for reasonably complete testing).
 1.72  22-Mar-1999  sommerfe Add fchroot, getcwd
 1.71  09-Mar-1999  kleink brk(2) actually returns an int indicating success (0) or failure (-1). Also,
change its argument to void *. (Both XSH5).
 1.70  09-Mar-1999  kleink G/C orphaned unwhiteout() prototype.
 1.69  30-Nov-1998  thorpej Change the type of sys_siglist and sys_signame from const char *const [] to
const char *const *, and rename them to __sys_siglist14 and __sys_signame14.
This will prevent the size of the exported symbol from changing when more
signals are added to the list.
 1.68  09-Nov-1998  kleink getpgid() is XPG4.2, actually.
 1.67  06-Nov-1998  mrg add a prototype for getpgid (missing for years!)
 1.66  30-Jul-1998  mycroft __Namespace__ __protection__.
 1.65  28-Jul-1998  mycroft Sprinkle in some __attribute__((noreturn))s.
 1.64  27-Jul-1998  mycroft Slight rearrangement.
 1.63  27-Jul-1998  mycroft If __AUDIT__ is defined, remove some traditional interfaces: gets, sprintf,
vsprintf, tempnam, mktemp, getwd.
 1.62  27-Jul-1998  mycroft Mark more functions returning internal buffers for const auditing.
 1.61  27-Jul-1998  mycroft Make many of the new consts dependent on a new `__AUDIT__' flag, to avoid
breaking third party software. *sigh*
 1.60  26-Jul-1998  mycroft KNF nit.
 1.59  26-Jul-1998  mycroft const poisoning.
 1.58  02-Jul-1998  kleink Addendum to previous change: since pread()'s and pwrite()'s first official
appearance was in X/Open CAE Spec Issue 5 Version 2, add a section for that
and move the prototypes there.
 1.57  30-Jun-1998  thorpej Prototype pread(2) and pwrite(2) if !defined(_POSIX_C_SOURCE).
 1.56  05-Jun-1998  kleink Add a prototype for fdatasync(2).
 1.55  01-Jun-1998  kleink * Reorganize name space protection.
* Remove mknod() prototype; it's located in <sys/stat.h> (XPG4.2).
* Remove re_comp() and re_exec() prototypes; their location is <re_comp.h>
(XPG4.2).
* Move setkey() prototype to <stdlib.h> (XPG4).
* Move mkstemp(), mktemp(), ttyslot() and valloc() prototypes to <stdlib.h>
(XPG4.2).
Assign copyright to TNF.
 1.54  24-May-1998  kleink Make the rename() prototype available to XPG Issue <=3 applications only; the
canonical header for the prototype has been <stdio.h> for quite a while.
 1.53  06-May-1998  kleink Change the type of the `namelen' argument of gethostname(), getdomainname(),
sethostname(), setdomainname() from int to size_t. The former change was
made due to an X/Open XNS5 requirement, the latter three were made for
consistency.
 1.52  27-Mar-1998  kleink Per X/Open CAE Spec Issue 5 Version 2, change the buffer size argument of
readlink() from type `int' to type `size_t'. This isn't an ABI change, since
the calling convention of our only LP64 platform (the Alpha) already promotes
this argument to a `long'.

This may not be the final action on this matter; readlink() still returns
an `int', which may change in a future revision of the standard.
 1.51  18-Feb-1998  thorpej Prototype getsid().
 1.50  14-Feb-1998  kleink If standards-compliance is requested by defining the preprocessor symbols
_POSIX_SOURCE or _XOPEN_SOURCE at compile time, use __RENAME() to call
__posix_chown(), __posix_fchown(), __posix_lchown() and __posix_rename()
instead of their NetBSD counterparts in order to remove the requirement of
linking against libposix.
 1.49  02-Feb-1998  perry merge lite-2
 1.48  12-Jan-1998  kleink Per XPG4, move the prototype of swab() from <string.h> to <unistd.h>.
 1.47  05-Jan-1998  thorpej Update for __vfork14().
 1.46  20-Dec-1997  kleink Add lockf(), an alternate interface to perform advisory record locking;
per XPG4.2.
 1.45  25-Nov-1997  kleink Per XPG4.2, use useconds_t for as argument and return type of ualarm().
 1.44  24-Nov-1997  kleink Per XPG4.2, change usleep() to take an useconds_t as its argument, and return
an int.
 1.43  02-Nov-1997  kleink Per XPG4.2, move mknod() prototype from <unistd.h> to <sys/stat.h>.
 1.42  16-Oct-1997  christos branches: 1.42.2;
move setmode and strsignal to unistd.h
 1.41  08-Oct-1997  mikel proto lchown() only if !_POSIX_SOURCE
 1.40  06-Oct-1997  enami Declare prototype of lchown(2).
 1.39  20-Jul-1997  christos Backout addition of user_from_uid and group_from_gid; they exist in pwd.h
and grp.h [pointed by cgd]
 1.38  20-Jul-1997  christos Add user_from_uid and group_from_gid
 1.37  13-Jul-1997  christos Add missing swapon prototype and mark it obsolete.
 1.36  04-Jul-1997  kleink Common sense dictates that the `basegid' paramater of initgroups(3) should
be of type gid_t, and not int.
 1.35  23-Jun-1997  mrg oops, forgot to commit this. prototype swapctl() in place of swapon().
 1.34  09-May-1997  christos Add missing prototype for getgrouplist as mentioned in the man page.
 1.33  21-Dec-1996  cgd branches: 1.33.2;
__syscall() should return quad_t, not int; what was i thinking?
 1.32  20-Dec-1996  cgd sethostid returns int not void, also add prototype for __syscall that
matches manual page.
 1.31  07-Sep-1996  mycroft Don't prototype poll(2) here. SysV requires poll.h to be included.
 1.30  07-Sep-1996  mycroft Prototype poll(2).
 1.29  09-Aug-1996  mrg update for new reboot(2).
 1.28  23-Jun-1996  mycroft Declare setre[ug]id() to take [ug]id_t args. No functional difference.
 1.27  28-May-1996  mrg Change iuserok() to take u_int32_t. Some netgroup fixes (partially
from OpenBSD and Theo).
 1.26  22-Nov-1995  cgd branches: 1.26.4;
change definition of profil() to make it 64-bit friendly. This has
no practical consequence on 32-bit systems. old prototype was
int profil(char *, int, int, int), and new one is int profile(char *,
size_t, u_long, u_int). the size_t is the size of the buffer,
and the u_long is the 'starting offset'. (I changed the last int
to u_int, because it's treated as a u_int everywhere, and isn't
logically a signed value.)
 1.25  19-Mar-1995  mycroft Make definitions of psignal() and sys_siglist match signal.h.
 1.24  28-Dec-1994  mycroft Add prototypes for undelete(2).
 1.23  23-Dec-1994  cgd proto for iruserok.
 1.22  26-Oct-1994  cgd new RCS ID format.
 1.21  19-Oct-1994  cgd better attributes.
 1.20  08-Jun-1994  mycroft NFS changes.
 1.19  23-May-1994  cgd kill *chflags protos
 1.18  07-May-1994  jtc add new getopt(3) extern variable optreset
 1.17  29-Mar-1994  jtc Last weekend's uid_t & gid_t changes allow us to change the uid & gid
arguments to fchown from ints to a uid_t and a gid_t.
 1.16  29-Mar-1994  jtc Last weekend's gid_t changes allow us to change the gidset argument of
getgroups() and setgroups() from a int ptr to a gid_t ptr.
 1.15  25-Jan-1994  cgd match 4.4's definitions for sys_siglist and sys_signame
 1.14  30-Dec-1993  cgd vfork() return type pid_t. reported by Peter Galbavy.
Also, whoever did the re-indenting in this file needs to be shot;
things shouldn't be indented by "tab-space"...
 1.13  02-Dec-1993  mycroft Add `const's to sys_siglist and sys_signame decls.
 1.12  14-Oct-1993  jtc Change prototypes of alarm and sleep to use "unsigned" instead of "u_int".
"u_int" is not defined by <sys/types.h> in a strict POSIX environment.
 1.11  13-Oct-1993  jtc Declare getopt(), getsubopt() and their external variables.
Still work to be done to handle all the combinations of _POSIX_SOURCE, and
_POSIX2_SOURCE, etc. to allow the user to select a strictly conforming
compilation environment, but this change allows us to transition
getopt() out of <stdlib.h>.
 1.10  25-Sep-1993  jtc POSIX.1 says that ssize_t is defined in <sys/types.h>.
 1.9  21-Sep-1993  jtc Provide prototype for POSIX.2 function confstr().
 1.8  10-Sep-1993  jtc Add prototypes for getdomainname() and setdomainname(); the man page
instructs the user to include unistd.h, but it didn't provide a
declaration.
 1.7  06-Aug-1993  jtc Add __dead qualifier to _exit(), as it never returns.
 1.6  06-Aug-1993  mycroft Add declaration of sys_signame[].
 1.5  01-Aug-1993  mycroft Add RCS identifiers.
 1.4  16-Jun-1993  jtc Update fnmatch to be more posix complient (from keith bostic)
 1.3  16-May-1993  cgd getpgrp actually takes void. ask the IEEE...
 1.2  15-May-1993  cgd fix bad prototype for getpgrp()
 1.1  21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.2  02-Feb-1998  perry import lite-2
 1.1.1.1  21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.26.4.2  10-Dec-1996  mycroft From trunk:
Implement setre[ug]id() for real.
 1.26.4.1  28-May-1996  mrg merge in some size fixes, fixes couple of alpha bugs.
 1.33.2.1  04-May-1997  mrg re-merge mrg-vm-swap into -current, and call it mrg-vm-swap2.
 1.42.2.1  22-Nov-1998  cgd Add missing declaration of getpgid(). corresponds to revisions 1.67 and
1.68 on the trunk, but the file's structure has changed since the 1.3
branch was cut. (kleink)
 1.73.2.1  06-Oct-2000  he Pull up revision 1.84 (requested by sommerfeld):
Introduce the issetugid() system call.
 1.77.4.1  27-Dec-1999  wrstuden Pull up to last week's -current.
 1.86.2.1  08-Oct-2001  nathanw Catch up to -current.
 1.110.6.1  03-Sep-2007  wrstuden Sync w/ NetBSD-4-RC_1
 1.110.4.2  24-Aug-2007  liamjfoy Pull up following revision(s) (requested by kristerw in ticket #833):
include/unistd.h: revision 1.112
lib/libc/ssp/snprintf_chk.c: revision 1.4
lib/libc/ssp/sprintf_chk.c: revision 1.4
lib/libc/ssp/vsprintf_chk.c: revision 1.4
lib/libc/ssp/gets_chk.c: revision 1.4
include/stdio.h: revision 1.70
lib/libc/ssp/vsnprintf_chk.c: revision 1.4
lib/libc/ssp/fgets_chk.c: revision 1.4
include/strings.h: revision 1.12
include/string.h: revision 1.33
Do not include SSP files unless _FORTIFY_SOURCE > 0.
Update includes so that this builds for USE_FORT=no too.
 1.110.4.1  22-Jul-2007  liamjfoy Pull up to netbsd-4 (requested by christos in ticket #773):

Move libssp to libc.
 1.112.2.2  02-Aug-2007  kristerw Do not include SSP files unless _FORTIFY_SOURCE > 0.
 1.112.2.1  02-Aug-2007  kristerw file unistd.h was added on branch matt-mips64 on 2007-08-02 21:49:11 +0000
 1.113.2.1  09-Jan-2008  matt sync with HEAD
 1.115.2.1  18-May-2008  yamt sync with head.
 1.116.4.1  27-Jun-2008  simonb Sync with head.
 1.116.2.1  18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.118.6.2  10-Jan-2009  christos sync with head
 1.118.6.1  25-Jun-2008  christos file unistd.h was added on branch christos-time_t on 2009-01-10 23:20:56 +0000
 1.118.4.2  17-Sep-2011  bouyer Pull up following revision(s) (requested by manu in ticket #1658):
sys/rump/include/rump/rump_syscalls.h: revision 1.52 via patch
sys/kern/init_sysent.c: revision 1.257 via patch
sys/rump/include/rump/rumpvnode_if.h: revision 1.12 via patch
lib/libc/sys/Makefile.inc: revision 1.208 via patch
sys/sys/syscallargs.h: revision 1.227 via patch
sys/kern/kern_exec.c: revision 1.317 via patch
sys/rump/librump/rumpkern/rump_syscalls.c: revision 1.74 via patch
include/limits.h: revision 1.30 via patch
sys/kern/syscalls.master: revision 1.251 via patch
sys/sys/vnode_if.h: revision 1.83 via patch
sys/sys/fcntl.h: revision 1.40 via patch
sys/sys/fcntl.h: revision 1.41 via patch
sys/kern/vfs_syscalls.c: revision 1.433 via patch
sys/rump/librump/rumpvfs/rumpvnode_if.c: revision 1.11 via patch
sys/kern/syscalls.c: revision 1.248 via patch
sys/sys/syscall.h: revision 1.244 via patch
lib/libc/sys/link.2: revision 1.25 via patch
include/unistd.h: revision 1.127 via patch
distrib/sets/lists/comp/mi: revision 1.1659 via patch
sys/sys/stat.h: revision 1.61 via patch
First stage of support for Extended API set 2. Most of the think is
unimplemented, except enough of linkat(2) to hardlink to a symlink.
Everything new in headers is guarded #ifdef _INCOMPLETE_XOPEN_C063 since
some software (e.g.: xcvs in our own tree) will assume they can use openat(2)
when AT_FDCWD is defined. _INCOMPLETE_XOPEN_C063 will go away once support
will be completed.
regen
improve comment about AT_* defines: they are not only used by linkat(2)
Add macros to hide OpenGroup extened API set 2 from GNU configure. This
is a temporary workaround until the implementation is completed.
 1.118.4.1  16-Jan-2009  snj Pull up following revision(s) (requested by lukem in ticket #247):
include/unistd.h: revision 1.119
lib/libc/gen/getlogin.c: revision 1.14
lib/libc/sys/getlogin.2: revision 1.21
Change the second argument of getlogin_r() from int to size_t, per POSIX.
 1.121.2.2  22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.121.2.1  30-Apr-2010  uebayasi Sync with HEAD.
 1.127.2.6  22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.127.2.5  23-Jan-2013  yamt sync with head
 1.127.2.4  16-Jan-2013  yamt sync with (a bit old) head
 1.127.2.3  30-Oct-2012  yamt sync with head
 1.127.2.2  17-Apr-2012  yamt sync with head
 1.127.2.1  10-Nov-2011  yamt sync with head
 1.128.2.1  14-Apr-2015  msaitoh Pull up following revision(s) (requested by khorben in ticket #1264):

include/unistd.h 1.144
sys/kern/init_sysent.c regen
sys/kern/syscalls.c regen
sys/kern/syscalls.master 1.272
sys/rump/include/rump/rump_syscalls.h regen
sys/rump/librump/rumpkern/rump_syscalls.c regen
sys/sys/syscall.h regen
sys/sys/syscallargs.h regen
sys/compat/netbds32/netbsd32_syscall.h regen
sys/compat/netbds32/netbsd32_syscallargs.h regen
sys/compat/netbds32/netbsd32_syscalls.c regen
sys/compat/netbds32/netbsd32_sysent.c regen
sys/compat/netbsd32/syscalls.master 1.102

Fix return type of the readlinkat(2) syscall. PR#49684.
 1.135.2.3  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.135.2.2  25-Feb-2013  tls resync with head
 1.135.2.1  20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.140.2.1  10-Aug-2014  tls Rebase.
 1.142.2.2  25-Mar-2015  snj Pull up following revision(s) (requested by wiz in ticket #642):
include/stdio.h: revision 1.96
include/unistd.h: revision 1.145
Put fseeko, ftello, pread, and pwrite in the POSIX 2001 namespace.
Ok christos, apb, martin
 1.142.2.1  24-Feb-2015  martin Pull up following revision(s) (requested by khorben in ticket #547):
include/unistd.h: revision 1.144
sys/kern/syscalls.master: revision 1.272

PR/49684: Pierre Pronchery: readlinkat(2) return type is wrong.
 1.149.4.3  13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.149.4.2  08-Apr-2020  martin Merge changes from current as of 20200406
 1.149.4.1  10-Jun-2019  christos Sync with HEAD
 1.149.2.2  26-Nov-2018  pgoyette Sync with HEAD, resolve a couple of conflicts
 1.149.2.1  06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.163.2.1  09-Oct-2024  martin Pull up following revision(s) (requested by riastradh in ticket #938):

lib/libc/gen/getentropy.3: revision 1.7
include/limits.h: revision 1.44
include/unistd.h: revision 1.167

getentropy(3): Make this visible to POSIX.1-2024 applications.

Likewise GETENTROPY_MAX.

It is now part of POSIX:
https://pubs.opengroup.org/onlinepubs/9799919799.2024edition/functions/getentropy.html

Cite standard in man page too. While here, use `.Nm' rather than
`.Fn getentropy' for self-reference in the man page, for consistency
with other usage.

PR standards/58603: getentropy(3): update visibility and documentation
for POSIX.1-2024

RSS XML Feed