History log of /netbsd-current/include/unistd.h
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.164 19-Jan-2024 christos

Add missing decls


Revision tags: netbsd-10-0-RC3 netbsd-10-0-RC2 netbsd-10-0-RC1 netbsd-10-base
# 1.163 31-May-2022 riastradh

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.


Revision tags: cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base
# 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.


Revision tags: phil-wifi-20200421 phil-wifi-20200411 phil-wifi-20200406
# 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


Revision tags: is-mlppp-base phil-wifi-20191119
# 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


Revision tags: netbsd-9-3-RELEASE netbsd-9-2-RELEASE netbsd-9-1-RELEASE netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 netbsd-9-base phil-wifi-20190609 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126
# 1.151 18-Nov-2018 christos

more type protection macro lossage.


Revision tags: pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 1.150 15-Aug-2018 martin

PR standards/53525: move getsubopt() to stdlib.h


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
# 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


Revision tags: netbsd-8-2-RELEASE netbsd-8-1-RELEASE netbsd-8-1-RC1 netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 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)


Revision tags: netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 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


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 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


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8
# 1.138 12-Jan-2013 dholland

Remove #if defined(_KERNEL) around a userlevel function.


Revision tags: yamt-pagecache-base7
# 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


Revision tags: yamt-pagecache-base6
# 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()


Revision tags: yamt-pagecache-base5 yamt-pagecache-base4
# 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


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2
# 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.


Revision tags: yamt-pagecache-base
# 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.


Revision tags: cherry-xenmp-base uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base
# 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, ...); }.


Revision tags: matt-mips64-premerge-20101231 uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3
# 1.124 27-Aug-2010 christos

The signal number argument in psignal is int not unsigned int.
Add psiginfo.


Revision tags: uebayasi-xip-base2 uebayasi-xip-base1
# 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


Revision tags: uebayasi-xip-base matt-premerge-20091211
# 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.


Revision tags: jym-xensuspend-nbase jym-xensuspend-base
# 1.120 11-Jan-2009 christos

merge christos-time_t


Revision tags: christos-time_t-nbase christos-time_t-base
# 1.119 06-Jan-2009 lukem

Change the second argument of getlogin_r() from int to size_t, per POSIX.


Revision tags: netbsd-5-base matt-mips64-base2 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 simonb-wapbl-nbase simonb-wapbl-base
# 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.


Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 wrstuden-revivesa-base
# 1.116 28-Apr-2008 martin

branches: 1.116.2; 1.116.4;
Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-pf42-baseX yamt-pf42-base
# 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"


Revision tags: keiichi-mipv6-base matt-armv6-nbase hpcarm-cleanup-base
# 1.114 24-Dec-2007 perry

change some __attribute__s to __keywords


Revision tags: matt-armv6-prevmlocking cube-autoconf-base matt-armv6-base
# 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.


Revision tags: matt-mips64-base
# 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.


Revision tags: abandoned-netbsd-4-base netbsd-4-base
# 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.


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 netbsd-3-base
# 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.


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 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


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 nathanw_sa_before_merge fvdl_fs64_base nathanw_sa_base netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 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>.


Revision tags: netbsd-1-5-PATCH003 netbsd-1-5-PATCH002 netbsd-1-5-PATCH001 netbsd-1-5-RELEASE netbsd-1-5-BETA2 netbsd-1-5-BETA netbsd-1-5-ALPHA2 netbsd-1-5-base minoura-xpg4dl-base
# 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.


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base
# 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.


Revision tags: comdex-fall-1999-base
# 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__


Revision tags: netbsd-1-4-PATCH002 netbsd-1-4-PATCH001 netbsd-1-4-RELEASE netbsd-1-4-base
# 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>.


Revision tags: netbsd-1-3-PATCH002 netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base
# 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.


Revision tags: mrg-vm-swap2-base
# 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).


Revision tags: netbsd-1-2-base
# 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.)


Revision tags: netbsd-1-1-PATCH001 netbsd-1-1-RELEASE netbsd-1-1-base
# 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.


Revision tags: netbsd-1-0-PATCH06 netbsd-1-0-PATCH05 netbsd-1-0-PATCH04 netbsd-1-0-PATCH03 netbsd-1-0-PATCH02 netbsd-1-0-PATCH1 netbsd-1-0-PATCH0 netbsd-1-0-RELEASE netbsd-1-0-base
# 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.


Revision tags: netbsd-0-9-RELEASE netbsd-0-9-BETA netbsd-0-9-ALPHA2 netbsd-0-9-ALPHA netbsd-0-9-base
# 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.163 31-May-2022 riastradh

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.


Revision tags: cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base
# 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.


Revision tags: phil-wifi-20200421 phil-wifi-20200411 phil-wifi-20200406
# 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


Revision tags: is-mlppp-base phil-wifi-20191119
# 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


Revision tags: netbsd-9-2-RELEASE netbsd-9-1-RELEASE netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 netbsd-9-base phil-wifi-20190609 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126
# 1.151 18-Nov-2018 christos

more type protection macro lossage.


Revision tags: pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 1.150 15-Aug-2018 martin

PR standards/53525: move getsubopt() to stdlib.h


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
# 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


Revision tags: netbsd-8-2-RELEASE netbsd-8-1-RELEASE netbsd-8-1-RC1 netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 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)


Revision tags: netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 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


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 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


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8
# 1.138 12-Jan-2013 dholland

Remove #if defined(_KERNEL) around a userlevel function.


Revision tags: yamt-pagecache-base7
# 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


Revision tags: yamt-pagecache-base6
# 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()


Revision tags: yamt-pagecache-base5 yamt-pagecache-base4
# 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


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2
# 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.


Revision tags: yamt-pagecache-base
# 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.


Revision tags: cherry-xenmp-base uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base
# 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, ...); }.


Revision tags: matt-mips64-premerge-20101231 uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3
# 1.124 27-Aug-2010 christos

The signal number argument in psignal is int not unsigned int.
Add psiginfo.


Revision tags: uebayasi-xip-base2 uebayasi-xip-base1
# 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


Revision tags: uebayasi-xip-base matt-premerge-20091211
# 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.


Revision tags: jym-xensuspend-nbase jym-xensuspend-base
# 1.120 11-Jan-2009 christos

merge christos-time_t


Revision tags: christos-time_t-nbase christos-time_t-base
# 1.119 06-Jan-2009 lukem

Change the second argument of getlogin_r() from int to size_t, per POSIX.


Revision tags: netbsd-5-base matt-mips64-base2 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 simonb-wapbl-nbase simonb-wapbl-base
# 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.


Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 wrstuden-revivesa-base
# 1.116 28-Apr-2008 martin

branches: 1.116.2; 1.116.4;
Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-pf42-baseX yamt-pf42-base
# 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"


Revision tags: keiichi-mipv6-base matt-armv6-nbase hpcarm-cleanup-base
# 1.114 24-Dec-2007 perry

change some __attribute__s to __keywords


Revision tags: matt-armv6-prevmlocking cube-autoconf-base matt-armv6-base
# 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.


Revision tags: matt-mips64-base
# 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.


Revision tags: abandoned-netbsd-4-base netbsd-4-base
# 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.


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 netbsd-3-base
# 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.


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 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


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 nathanw_sa_before_merge fvdl_fs64_base nathanw_sa_base netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 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>.


Revision tags: netbsd-1-5-PATCH003 netbsd-1-5-PATCH002 netbsd-1-5-PATCH001 netbsd-1-5-RELEASE netbsd-1-5-BETA2 netbsd-1-5-BETA netbsd-1-5-ALPHA2 netbsd-1-5-base minoura-xpg4dl-base
# 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.


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base
# 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.


Revision tags: comdex-fall-1999-base
# 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__


Revision tags: netbsd-1-4-PATCH002 netbsd-1-4-PATCH001 netbsd-1-4-RELEASE netbsd-1-4-base
# 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>.


Revision tags: netbsd-1-3-PATCH002 netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base
# 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.


Revision tags: mrg-vm-swap2-base
# 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).


Revision tags: netbsd-1-2-base
# 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.)


Revision tags: netbsd-1-1-PATCH001 netbsd-1-1-RELEASE netbsd-1-1-base
# 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.


Revision tags: netbsd-1-0-PATCH06 netbsd-1-0-PATCH05 netbsd-1-0-PATCH04 netbsd-1-0-PATCH03 netbsd-1-0-PATCH02 netbsd-1-0-PATCH1 netbsd-1-0-PATCH0 netbsd-1-0-RELEASE netbsd-1-0-base
# 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.


Revision tags: netbsd-0-9-RELEASE netbsd-0-9-BETA netbsd-0-9-ALPHA2 netbsd-0-9-ALPHA netbsd-0-9-base
# 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.162 15-Oct-2021 andvar

fix typos in comments.


Revision tags: cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base
# 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.


Revision tags: phil-wifi-20200421 phil-wifi-20200411 phil-wifi-20200406
# 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


Revision tags: is-mlppp-base phil-wifi-20191119
# 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


Revision tags: netbsd-9-2-RELEASE netbsd-9-1-RELEASE netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 netbsd-9-base phil-wifi-20190609 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126
# 1.151 18-Nov-2018 christos

more type protection macro lossage.


Revision tags: pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 1.150 15-Aug-2018 martin

PR standards/53525: move getsubopt() to stdlib.h


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
# 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


Revision tags: netbsd-8-2-RELEASE netbsd-8-1-RELEASE netbsd-8-1-RC1 netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 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)


Revision tags: netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 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


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 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


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8
# 1.138 12-Jan-2013 dholland

Remove #if defined(_KERNEL) around a userlevel function.


Revision tags: yamt-pagecache-base7
# 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


Revision tags: yamt-pagecache-base6
# 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()


Revision tags: yamt-pagecache-base5 yamt-pagecache-base4
# 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


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2
# 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.


Revision tags: yamt-pagecache-base
# 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.


Revision tags: cherry-xenmp-base uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base
# 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, ...); }.


Revision tags: matt-mips64-premerge-20101231 uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3
# 1.124 27-Aug-2010 christos

The signal number argument in psignal is int not unsigned int.
Add psiginfo.


Revision tags: uebayasi-xip-base2 uebayasi-xip-base1
# 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


Revision tags: uebayasi-xip-base matt-premerge-20091211
# 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.


Revision tags: jym-xensuspend-nbase jym-xensuspend-base
# 1.120 11-Jan-2009 christos

merge christos-time_t


Revision tags: christos-time_t-nbase christos-time_t-base
# 1.119 06-Jan-2009 lukem

Change the second argument of getlogin_r() from int to size_t, per POSIX.


Revision tags: netbsd-5-base matt-mips64-base2 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 simonb-wapbl-nbase simonb-wapbl-base
# 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.


Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 wrstuden-revivesa-base
# 1.116 28-Apr-2008 martin

branches: 1.116.2; 1.116.4;
Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-pf42-baseX yamt-pf42-base
# 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"


Revision tags: keiichi-mipv6-base matt-armv6-nbase hpcarm-cleanup-base
# 1.114 24-Dec-2007 perry

change some __attribute__s to __keywords


Revision tags: matt-armv6-prevmlocking cube-autoconf-base matt-armv6-base
# 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.


Revision tags: matt-mips64-base
# 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.


Revision tags: abandoned-netbsd-4-base netbsd-4-base
# 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.


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 netbsd-3-base
# 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.


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 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


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 nathanw_sa_before_merge fvdl_fs64_base nathanw_sa_base netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 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>.


Revision tags: netbsd-1-5-PATCH003 netbsd-1-5-PATCH002 netbsd-1-5-PATCH001 netbsd-1-5-RELEASE netbsd-1-5-BETA2 netbsd-1-5-BETA netbsd-1-5-ALPHA2 netbsd-1-5-base minoura-xpg4dl-base
# 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.


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base
# 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.


Revision tags: comdex-fall-1999-base
# 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__


Revision tags: netbsd-1-4-PATCH002 netbsd-1-4-PATCH001 netbsd-1-4-RELEASE netbsd-1-4-base
# 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>.


Revision tags: netbsd-1-3-PATCH002 netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base
# 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.


Revision tags: mrg-vm-swap2-base
# 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).


Revision tags: netbsd-1-2-base
# 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.)


Revision tags: netbsd-1-1-PATCH001 netbsd-1-1-RELEASE netbsd-1-1-base
# 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.


Revision tags: netbsd-1-0-PATCH06 netbsd-1-0-PATCH05 netbsd-1-0-PATCH04 netbsd-1-0-PATCH03 netbsd-1-0-PATCH02 netbsd-1-0-PATCH1 netbsd-1-0-PATCH0 netbsd-1-0-RELEASE netbsd-1-0-base
# 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.


Revision tags: netbsd-0-9-RELEASE netbsd-0-9-BETA netbsd-0-9-ALPHA2 netbsd-0-9-ALPHA netbsd-0-9-base
# 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.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.


Revision tags: phil-wifi-20200421 phil-wifi-20200411 phil-wifi-20200406
# 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


Revision tags: is-mlppp-base phil-wifi-20191119
# 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


Revision tags: netbsd-9-1-RELEASE netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 netbsd-9-base phil-wifi-20190609 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126
# 1.151 18-Nov-2018 christos

more type protection macro lossage.


Revision tags: pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 1.150 15-Aug-2018 martin

PR standards/53525: move getsubopt() to stdlib.h


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
# 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


Revision tags: netbsd-8-2-RELEASE netbsd-8-1-RELEASE netbsd-8-1-RC1 netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 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)


Revision tags: netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 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


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 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


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8
# 1.138 12-Jan-2013 dholland

Remove #if defined(_KERNEL) around a userlevel function.


Revision tags: yamt-pagecache-base7
# 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


Revision tags: yamt-pagecache-base6
# 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()


Revision tags: yamt-pagecache-base5 yamt-pagecache-base4
# 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


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2
# 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.


Revision tags: yamt-pagecache-base
# 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.


Revision tags: cherry-xenmp-base uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base
# 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, ...); }.


Revision tags: matt-mips64-premerge-20101231 uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3
# 1.124 27-Aug-2010 christos

The signal number argument in psignal is int not unsigned int.
Add psiginfo.


Revision tags: uebayasi-xip-base2 uebayasi-xip-base1
# 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


Revision tags: uebayasi-xip-base matt-premerge-20091211
# 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.


Revision tags: jym-xensuspend-nbase jym-xensuspend-base
# 1.120 11-Jan-2009 christos

merge christos-time_t


Revision tags: christos-time_t-nbase christos-time_t-base
# 1.119 06-Jan-2009 lukem

Change the second argument of getlogin_r() from int to size_t, per POSIX.


Revision tags: netbsd-5-base matt-mips64-base2 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 simonb-wapbl-nbase simonb-wapbl-base
# 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.


Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 wrstuden-revivesa-base
# 1.116 28-Apr-2008 martin

branches: 1.116.2; 1.116.4;
Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-pf42-baseX yamt-pf42-base
# 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"


Revision tags: keiichi-mipv6-base matt-armv6-nbase hpcarm-cleanup-base
# 1.114 24-Dec-2007 perry

change some __attribute__s to __keywords


Revision tags: matt-armv6-prevmlocking cube-autoconf-base matt-armv6-base
# 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.


Revision tags: matt-mips64-base
# 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.


Revision tags: abandoned-netbsd-4-base netbsd-4-base
# 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.


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 netbsd-3-base
# 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.


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 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


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 nathanw_sa_before_merge fvdl_fs64_base nathanw_sa_base netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 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>.


Revision tags: netbsd-1-5-PATCH003 netbsd-1-5-PATCH002 netbsd-1-5-PATCH001 netbsd-1-5-RELEASE netbsd-1-5-BETA2 netbsd-1-5-BETA netbsd-1-5-ALPHA2 netbsd-1-5-base minoura-xpg4dl-base
# 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.


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base
# 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.


Revision tags: comdex-fall-1999-base
# 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__


Revision tags: netbsd-1-4-PATCH002 netbsd-1-4-PATCH001 netbsd-1-4-RELEASE netbsd-1-4-base
# 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>.


Revision tags: netbsd-1-3-PATCH002 netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base
# 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.


Revision tags: mrg-vm-swap2-base
# 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).


Revision tags: netbsd-1-2-base
# 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.)


Revision tags: netbsd-1-1-PATCH001 netbsd-1-1-RELEASE netbsd-1-1-base
# 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.


Revision tags: netbsd-1-0-PATCH06 netbsd-1-0-PATCH05 netbsd-1-0-PATCH04 netbsd-1-0-PATCH03 netbsd-1-0-PATCH02 netbsd-1-0-PATCH1 netbsd-1-0-PATCH0 netbsd-1-0-RELEASE netbsd-1-0-base
# 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.


Revision tags: netbsd-0-9-RELEASE netbsd-0-9-BETA netbsd-0-9-ALPHA2 netbsd-0-9-ALPHA netbsd-0-9-base
# 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.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.


Revision tags: phil-wifi-20200421 phil-wifi-20200411 phil-wifi-20200406
# 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


Revision tags: is-mlppp-base phil-wifi-20191119
# 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


Revision tags: netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 netbsd-9-base phil-wifi-20190609 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126
# 1.151 18-Nov-2018 christos

more type protection macro lossage.


Revision tags: pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 1.150 15-Aug-2018 martin

PR standards/53525: move getsubopt() to stdlib.h


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
# 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


Revision tags: netbsd-8-2-RELEASE netbsd-8-1-RELEASE netbsd-8-1-RC1 netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 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)


Revision tags: netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 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


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 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


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8
# 1.138 12-Jan-2013 dholland

Remove #if defined(_KERNEL) around a userlevel function.


Revision tags: yamt-pagecache-base7
# 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


Revision tags: yamt-pagecache-base6
# 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()


Revision tags: yamt-pagecache-base5 yamt-pagecache-base4
# 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


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2
# 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.


Revision tags: yamt-pagecache-base
# 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.


Revision tags: cherry-xenmp-base uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base
# 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, ...); }.


Revision tags: matt-mips64-premerge-20101231 uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3
# 1.124 27-Aug-2010 christos

The signal number argument in psignal is int not unsigned int.
Add psiginfo.


Revision tags: uebayasi-xip-base2 uebayasi-xip-base1
# 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


Revision tags: uebayasi-xip-base matt-premerge-20091211
# 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.


Revision tags: jym-xensuspend-nbase jym-xensuspend-base
# 1.120 11-Jan-2009 christos

merge christos-time_t


Revision tags: christos-time_t-nbase christos-time_t-base
# 1.119 06-Jan-2009 lukem

Change the second argument of getlogin_r() from int to size_t, per POSIX.


Revision tags: netbsd-5-base matt-mips64-base2 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 simonb-wapbl-nbase simonb-wapbl-base
# 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.


Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 wrstuden-revivesa-base
# 1.116 28-Apr-2008 martin

branches: 1.116.2; 1.116.4;
Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-pf42-baseX yamt-pf42-base
# 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"


Revision tags: keiichi-mipv6-base matt-armv6-nbase hpcarm-cleanup-base
# 1.114 24-Dec-2007 perry

change some __attribute__s to __keywords


Revision tags: matt-armv6-prevmlocking cube-autoconf-base matt-armv6-base
# 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.


Revision tags: matt-mips64-base
# 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.


Revision tags: abandoned-netbsd-4-base netbsd-4-base
# 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.


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 netbsd-3-base
# 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.


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 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


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 nathanw_sa_before_merge fvdl_fs64_base nathanw_sa_base netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 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>.


Revision tags: netbsd-1-5-PATCH003 netbsd-1-5-PATCH002 netbsd-1-5-PATCH001 netbsd-1-5-RELEASE netbsd-1-5-BETA2 netbsd-1-5-BETA netbsd-1-5-ALPHA2 netbsd-1-5-base minoura-xpg4dl-base
# 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.


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base
# 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.


Revision tags: comdex-fall-1999-base
# 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__


Revision tags: netbsd-1-4-PATCH002 netbsd-1-4-PATCH001 netbsd-1-4-RELEASE netbsd-1-4-base
# 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>.


Revision tags: netbsd-1-3-PATCH002 netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base
# 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.


Revision tags: mrg-vm-swap2-base
# 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).


Revision tags: netbsd-1-2-base
# 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.)


Revision tags: netbsd-1-1-PATCH001 netbsd-1-1-RELEASE netbsd-1-1-base
# 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.


Revision tags: netbsd-1-0-PATCH06 netbsd-1-0-PATCH05 netbsd-1-0-PATCH04 netbsd-1-0-PATCH03 netbsd-1-0-PATCH02 netbsd-1-0-PATCH1 netbsd-1-0-PATCH0 netbsd-1-0-RELEASE netbsd-1-0-base
# 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.


Revision tags: netbsd-0-9-RELEASE netbsd-0-9-BETA netbsd-0-9-ALPHA2 netbsd-0-9-ALPHA netbsd-0-9-base
# 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.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.


Revision tags: phil-wifi-20200421 phil-wifi-20200411 phil-wifi-20200406
# 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


Revision tags: is-mlppp-base phil-wifi-20191119
# 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


Revision tags: netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 netbsd-9-base phil-wifi-20190609 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126
# 1.151 18-Nov-2018 christos

more type protection macro lossage.


Revision tags: pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 1.150 15-Aug-2018 martin

PR standards/53525: move getsubopt() to stdlib.h


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
# 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


Revision tags: netbsd-8-2-RELEASE netbsd-8-1-RELEASE netbsd-8-1-RC1 netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 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)


Revision tags: netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 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


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 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


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8
# 1.138 12-Jan-2013 dholland

Remove #if defined(_KERNEL) around a userlevel function.


Revision tags: yamt-pagecache-base7
# 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


Revision tags: yamt-pagecache-base6
# 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()


Revision tags: yamt-pagecache-base5 yamt-pagecache-base4
# 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


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2
# 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.


Revision tags: yamt-pagecache-base
# 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.


Revision tags: cherry-xenmp-base uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base
# 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, ...); }.


Revision tags: matt-mips64-premerge-20101231 uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3
# 1.124 27-Aug-2010 christos

The signal number argument in psignal is int not unsigned int.
Add psiginfo.


Revision tags: uebayasi-xip-base2 uebayasi-xip-base1
# 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


Revision tags: uebayasi-xip-base matt-premerge-20091211
# 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.


Revision tags: jym-xensuspend-nbase jym-xensuspend-base
# 1.120 11-Jan-2009 christos

merge christos-time_t


Revision tags: christos-time_t-nbase christos-time_t-base
# 1.119 06-Jan-2009 lukem

Change the second argument of getlogin_r() from int to size_t, per POSIX.


Revision tags: netbsd-5-base matt-mips64-base2 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 simonb-wapbl-nbase simonb-wapbl-base
# 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.


Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 wrstuden-revivesa-base
# 1.116 28-Apr-2008 martin

branches: 1.116.2; 1.116.4;
Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-pf42-baseX yamt-pf42-base
# 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"


Revision tags: keiichi-mipv6-base matt-armv6-nbase hpcarm-cleanup-base
# 1.114 24-Dec-2007 perry

change some __attribute__s to __keywords


Revision tags: matt-armv6-prevmlocking cube-autoconf-base matt-armv6-base
# 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.


Revision tags: matt-mips64-base
# 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.


Revision tags: abandoned-netbsd-4-base netbsd-4-base
# 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.


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 netbsd-3-base
# 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.


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 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


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 nathanw_sa_before_merge fvdl_fs64_base nathanw_sa_base netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 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>.


Revision tags: netbsd-1-5-PATCH003 netbsd-1-5-PATCH002 netbsd-1-5-PATCH001 netbsd-1-5-RELEASE netbsd-1-5-BETA2 netbsd-1-5-BETA netbsd-1-5-ALPHA2 netbsd-1-5-base minoura-xpg4dl-base
# 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.


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base
# 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.


Revision tags: comdex-fall-1999-base
# 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__


Revision tags: netbsd-1-4-PATCH002 netbsd-1-4-PATCH001 netbsd-1-4-RELEASE netbsd-1-4-base
# 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>.


Revision tags: netbsd-1-3-PATCH002 netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base
# 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.


Revision tags: mrg-vm-swap2-base
# 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).


Revision tags: netbsd-1-2-base
# 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.)


Revision tags: netbsd-1-1-PATCH001 netbsd-1-1-RELEASE netbsd-1-1-base
# 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.


Revision tags: netbsd-1-0-PATCH06 netbsd-1-0-PATCH05 netbsd-1-0-PATCH04 netbsd-1-0-PATCH03 netbsd-1-0-PATCH02 netbsd-1-0-PATCH1 netbsd-1-0-PATCH0 netbsd-1-0-RELEASE netbsd-1-0-base
# 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.


Revision tags: netbsd-0-9-RELEASE netbsd-0-9-BETA netbsd-0-9-ALPHA2 netbsd-0-9-ALPHA netbsd-0-9-base
# 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.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.


Revision tags: phil-wifi-20200421 phil-wifi-20200411 phil-wifi-20200406
# 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


Revision tags: is-mlppp-base phil-wifi-20191119
# 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


Revision tags: netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 netbsd-9-base phil-wifi-20190609 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126
# 1.151 18-Nov-2018 christos

more type protection macro lossage.


Revision tags: pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 1.150 15-Aug-2018 martin

PR standards/53525: move getsubopt() to stdlib.h


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
# 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


Revision tags: netbsd-8-2-RELEASE netbsd-8-1-RELEASE netbsd-8-1-RC1 netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 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)


Revision tags: netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 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


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 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


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8
# 1.138 12-Jan-2013 dholland

Remove #if defined(_KERNEL) around a userlevel function.


Revision tags: yamt-pagecache-base7
# 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


Revision tags: yamt-pagecache-base6
# 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()


Revision tags: yamt-pagecache-base5 yamt-pagecache-base4
# 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


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2
# 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.


Revision tags: yamt-pagecache-base
# 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.


Revision tags: cherry-xenmp-base uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base
# 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, ...); }.


Revision tags: matt-mips64-premerge-20101231 uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3
# 1.124 27-Aug-2010 christos

The signal number argument in psignal is int not unsigned int.
Add psiginfo.


Revision tags: uebayasi-xip-base2 uebayasi-xip-base1
# 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


Revision tags: uebayasi-xip-base matt-premerge-20091211
# 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.


Revision tags: jym-xensuspend-nbase jym-xensuspend-base
# 1.120 11-Jan-2009 christos

merge christos-time_t


Revision tags: christos-time_t-nbase christos-time_t-base
# 1.119 06-Jan-2009 lukem

Change the second argument of getlogin_r() from int to size_t, per POSIX.


Revision tags: netbsd-5-base matt-mips64-base2 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 simonb-wapbl-nbase simonb-wapbl-base
# 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.


Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 wrstuden-revivesa-base
# 1.116 28-Apr-2008 martin

branches: 1.116.2; 1.116.4;
Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-pf42-baseX yamt-pf42-base
# 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"


Revision tags: keiichi-mipv6-base matt-armv6-nbase hpcarm-cleanup-base
# 1.114 24-Dec-2007 perry

change some __attribute__s to __keywords


Revision tags: matt-armv6-prevmlocking cube-autoconf-base matt-armv6-base
# 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.


Revision tags: matt-mips64-base
# 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.


Revision tags: abandoned-netbsd-4-base netbsd-4-base
# 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.


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 netbsd-3-base
# 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.


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 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


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 nathanw_sa_before_merge fvdl_fs64_base nathanw_sa_base netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 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>.


Revision tags: netbsd-1-5-PATCH003 netbsd-1-5-PATCH002 netbsd-1-5-PATCH001 netbsd-1-5-RELEASE netbsd-1-5-BETA2 netbsd-1-5-BETA netbsd-1-5-ALPHA2 netbsd-1-5-base minoura-xpg4dl-base
# 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.


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base
# 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.


Revision tags: comdex-fall-1999-base
# 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__


Revision tags: netbsd-1-4-PATCH002 netbsd-1-4-PATCH001 netbsd-1-4-RELEASE netbsd-1-4-base
# 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>.


Revision tags: netbsd-1-3-PATCH002 netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base
# 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.


Revision tags: mrg-vm-swap2-base
# 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).


Revision tags: netbsd-1-2-base
# 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.)


Revision tags: netbsd-1-1-PATCH001 netbsd-1-1-RELEASE netbsd-1-1-base
# 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.


Revision tags: netbsd-1-0-PATCH06 netbsd-1-0-PATCH05 netbsd-1-0-PATCH04 netbsd-1-0-PATCH03 netbsd-1-0-PATCH02 netbsd-1-0-PATCH1 netbsd-1-0-PATCH0 netbsd-1-0-RELEASE netbsd-1-0-base
# 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.


Revision tags: netbsd-0-9-RELEASE netbsd-0-9-BETA netbsd-0-9-ALPHA2 netbsd-0-9-ALPHA netbsd-0-9-base
# 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.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


Revision tags: phil-wifi-20191119
# 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


Revision tags: netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 netbsd-9-base phil-wifi-20190609 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126
# 1.151 18-Nov-2018 christos

more type protection macro lossage.


Revision tags: pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 1.150 15-Aug-2018 martin

PR standards/53525: move getsubopt() to stdlib.h


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
# 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


Revision tags: netbsd-8-2-RELEASE netbsd-8-1-RELEASE netbsd-8-1-RC1 netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 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)


Revision tags: netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 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


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 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


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8
# 1.138 12-Jan-2013 dholland

Remove #if defined(_KERNEL) around a userlevel function.


Revision tags: yamt-pagecache-base7
# 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


Revision tags: yamt-pagecache-base6
# 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()


Revision tags: yamt-pagecache-base5 yamt-pagecache-base4
# 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


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2
# 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.


Revision tags: yamt-pagecache-base
# 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.


Revision tags: cherry-xenmp-base uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base
# 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, ...); }.


Revision tags: matt-mips64-premerge-20101231 uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3
# 1.124 27-Aug-2010 christos

The signal number argument in psignal is int not unsigned int.
Add psiginfo.


Revision tags: uebayasi-xip-base2 uebayasi-xip-base1
# 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


Revision tags: uebayasi-xip-base matt-premerge-20091211
# 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.


Revision tags: jym-xensuspend-nbase jym-xensuspend-base
# 1.120 11-Jan-2009 christos

merge christos-time_t


Revision tags: christos-time_t-nbase christos-time_t-base
# 1.119 06-Jan-2009 lukem

Change the second argument of getlogin_r() from int to size_t, per POSIX.


Revision tags: netbsd-5-base matt-mips64-base2 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 simonb-wapbl-nbase simonb-wapbl-base
# 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.


Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 wrstuden-revivesa-base
# 1.116 28-Apr-2008 martin

branches: 1.116.2; 1.116.4;
Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-pf42-baseX yamt-pf42-base
# 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"


Revision tags: keiichi-mipv6-base matt-armv6-nbase hpcarm-cleanup-base
# 1.114 24-Dec-2007 perry

change some __attribute__s to __keywords


Revision tags: matt-armv6-prevmlocking cube-autoconf-base matt-armv6-base
# 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.


Revision tags: matt-mips64-base
# 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.


Revision tags: abandoned-netbsd-4-base netbsd-4-base
# 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.


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 netbsd-3-base
# 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.


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 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


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 nathanw_sa_before_merge fvdl_fs64_base nathanw_sa_base netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 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>.


Revision tags: netbsd-1-5-PATCH003 netbsd-1-5-PATCH002 netbsd-1-5-PATCH001 netbsd-1-5-RELEASE netbsd-1-5-BETA2 netbsd-1-5-BETA netbsd-1-5-ALPHA2 netbsd-1-5-base minoura-xpg4dl-base
# 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.


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base
# 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.


Revision tags: comdex-fall-1999-base
# 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__


Revision tags: netbsd-1-4-PATCH002 netbsd-1-4-PATCH001 netbsd-1-4-RELEASE netbsd-1-4-base
# 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>.


Revision tags: netbsd-1-3-PATCH002 netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base
# 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.


Revision tags: mrg-vm-swap2-base
# 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).


Revision tags: netbsd-1-2-base
# 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.)


Revision tags: netbsd-1-1-PATCH001 netbsd-1-1-RELEASE netbsd-1-1-base
# 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.


Revision tags: netbsd-1-0-PATCH06 netbsd-1-0-PATCH05 netbsd-1-0-PATCH04 netbsd-1-0-PATCH03 netbsd-1-0-PATCH02 netbsd-1-0-PATCH1 netbsd-1-0-PATCH0 netbsd-1-0-RELEASE netbsd-1-0-base
# 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.


Revision tags: netbsd-0-9-RELEASE netbsd-0-9-BETA netbsd-0-9-ALPHA2 netbsd-0-9-ALPHA netbsd-0-9-base
# 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.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


Revision tags: netbsd-9-base phil-wifi-20190609 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126
# 1.151 18-Nov-2018 christos

more type protection macro lossage.


Revision tags: pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 1.150 15-Aug-2018 martin

PR standards/53525: move getsubopt() to stdlib.h


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
# 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


Revision tags: netbsd-8-1-RELEASE netbsd-8-1-RC1 netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 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)


Revision tags: netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 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


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 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


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8
# 1.138 12-Jan-2013 dholland

Remove #if defined(_KERNEL) around a userlevel function.


Revision tags: yamt-pagecache-base7
# 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


Revision tags: yamt-pagecache-base6
# 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()


Revision tags: yamt-pagecache-base5 yamt-pagecache-base4
# 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


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2
# 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.


Revision tags: yamt-pagecache-base
# 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.


Revision tags: cherry-xenmp-base uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base
# 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, ...); }.


Revision tags: matt-mips64-premerge-20101231 uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3
# 1.124 27-Aug-2010 christos

The signal number argument in psignal is int not unsigned int.
Add psiginfo.


Revision tags: uebayasi-xip-base2 uebayasi-xip-base1
# 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


Revision tags: uebayasi-xip-base matt-premerge-20091211
# 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.


Revision tags: jym-xensuspend-nbase jym-xensuspend-base
# 1.120 11-Jan-2009 christos

merge christos-time_t


Revision tags: christos-time_t-nbase christos-time_t-base
# 1.119 06-Jan-2009 lukem

Change the second argument of getlogin_r() from int to size_t, per POSIX.


Revision tags: netbsd-5-base matt-mips64-base2 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 simonb-wapbl-nbase simonb-wapbl-base
# 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.


Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 wrstuden-revivesa-base
# 1.116 28-Apr-2008 martin

branches: 1.116.2; 1.116.4;
Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-pf42-baseX yamt-pf42-base
# 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"


Revision tags: keiichi-mipv6-base matt-armv6-nbase hpcarm-cleanup-base
# 1.114 24-Dec-2007 perry

change some __attribute__s to __keywords


Revision tags: matt-armv6-prevmlocking cube-autoconf-base matt-armv6-base
# 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.


Revision tags: matt-mips64-base
# 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.


Revision tags: abandoned-netbsd-4-base netbsd-4-base
# 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.


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 netbsd-3-base
# 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.


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 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


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 nathanw_sa_before_merge fvdl_fs64_base nathanw_sa_base netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 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>.


Revision tags: netbsd-1-5-PATCH003 netbsd-1-5-PATCH002 netbsd-1-5-PATCH001 netbsd-1-5-RELEASE netbsd-1-5-BETA2 netbsd-1-5-BETA netbsd-1-5-ALPHA2 netbsd-1-5-base minoura-xpg4dl-base
# 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.


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base
# 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.


Revision tags: comdex-fall-1999-base
# 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__


Revision tags: netbsd-1-4-PATCH002 netbsd-1-4-PATCH001 netbsd-1-4-RELEASE netbsd-1-4-base
# 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>.


Revision tags: netbsd-1-3-PATCH002 netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base
# 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.


Revision tags: mrg-vm-swap2-base
# 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).


Revision tags: netbsd-1-2-base
# 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.)


Revision tags: netbsd-1-1-PATCH001 netbsd-1-1-RELEASE netbsd-1-1-base
# 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.


Revision tags: netbsd-1-0-PATCH06 netbsd-1-0-PATCH05 netbsd-1-0-PATCH04 netbsd-1-0-PATCH03 netbsd-1-0-PATCH02 netbsd-1-0-PATCH1 netbsd-1-0-PATCH0 netbsd-1-0-RELEASE netbsd-1-0-base
# 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.


Revision tags: netbsd-0-9-RELEASE netbsd-0-9-BETA netbsd-0-9-ALPHA2 netbsd-0-9-ALPHA netbsd-0-9-base
# 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


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126
# 1.151 18-Nov-2018 christos

more type protection macro lossage.


Revision tags: pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 1.150 15-Aug-2018 martin

PR standards/53525: move getsubopt() to stdlib.h


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
# 1.149 06-Feb-2018 christos

branches: 1.149.2;
fix typo


# 1.148 06-Feb-2018 christos

detect duplicate declaration of pthread_atfork() in pthread.h


Revision tags: netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 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)


Revision tags: netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 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


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 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


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8
# 1.138 12-Jan-2013 dholland

Remove #if defined(_KERNEL) around a userlevel function.


Revision tags: yamt-pagecache-base7
# 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


Revision tags: yamt-pagecache-base6
# 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()


Revision tags: yamt-pagecache-base5 yamt-pagecache-base4
# 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


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2
# 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.


Revision tags: yamt-pagecache-base
# 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.


Revision tags: cherry-xenmp-base uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base
# 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, ...); }.


Revision tags: matt-mips64-premerge-20101231 uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3
# 1.124 27-Aug-2010 christos

The signal number argument in psignal is int not unsigned int.
Add psiginfo.


Revision tags: uebayasi-xip-base2 uebayasi-xip-base1
# 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


Revision tags: uebayasi-xip-base matt-premerge-20091211
# 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.


Revision tags: jym-xensuspend-nbase jym-xensuspend-base
# 1.120 11-Jan-2009 christos

merge christos-time_t


Revision tags: christos-time_t-nbase christos-time_t-base
# 1.119 06-Jan-2009 lukem

Change the second argument of getlogin_r() from int to size_t, per POSIX.


Revision tags: netbsd-5-base matt-mips64-base2 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 simonb-wapbl-nbase simonb-wapbl-base
# 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.


Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 wrstuden-revivesa-base
# 1.116 28-Apr-2008 martin

branches: 1.116.2; 1.116.4;
Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-pf42-baseX yamt-pf42-base
# 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"


Revision tags: keiichi-mipv6-base matt-armv6-nbase hpcarm-cleanup-base
# 1.114 24-Dec-2007 perry

change some __attribute__s to __keywords


Revision tags: matt-armv6-prevmlocking cube-autoconf-base matt-armv6-base
# 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.


Revision tags: matt-mips64-base
# 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.


Revision tags: abandoned-netbsd-4-base netbsd-4-base
# 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.


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 netbsd-3-base
# 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.


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 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


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 nathanw_sa_before_merge fvdl_fs64_base nathanw_sa_base netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 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>.


Revision tags: netbsd-1-5-PATCH003 netbsd-1-5-PATCH002 netbsd-1-5-PATCH001 netbsd-1-5-RELEASE netbsd-1-5-BETA2 netbsd-1-5-BETA netbsd-1-5-ALPHA2 netbsd-1-5-base minoura-xpg4dl-base
# 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.


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base
# 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.


Revision tags: comdex-fall-1999-base
# 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__


Revision tags: netbsd-1-4-PATCH002 netbsd-1-4-PATCH001 netbsd-1-4-RELEASE netbsd-1-4-base
# 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>.


Revision tags: netbsd-1-3-PATCH002 netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base
# 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.


Revision tags: mrg-vm-swap2-base
# 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).


Revision tags: netbsd-1-2-base
# 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.)


Revision tags: netbsd-1-1-PATCH001 netbsd-1-1-RELEASE netbsd-1-1-base
# 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.


Revision tags: netbsd-1-0-PATCH06 netbsd-1-0-PATCH05 netbsd-1-0-PATCH04 netbsd-1-0-PATCH03 netbsd-1-0-PATCH02 netbsd-1-0-PATCH1 netbsd-1-0-PATCH0 netbsd-1-0-RELEASE netbsd-1-0-base
# 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.


Revision tags: netbsd-0-9-RELEASE netbsd-0-9-BETA netbsd-0-9-ALPHA2 netbsd-0-9-ALPHA netbsd-0-9-base
# 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.149 06-Feb-2018 christos

fix typo


# 1.148 06-Feb-2018 christos

detect duplicate declaration of pthread_atfork() in pthread.h


Revision tags: matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 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)


Revision tags: netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 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


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 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


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8
# 1.138 12-Jan-2013 dholland

Remove #if defined(_KERNEL) around a userlevel function.


Revision tags: yamt-pagecache-base7
# 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


Revision tags: yamt-pagecache-base6
# 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()


Revision tags: yamt-pagecache-base5 yamt-pagecache-base4
# 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


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2
# 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.


Revision tags: yamt-pagecache-base
# 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.


Revision tags: cherry-xenmp-base uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base
# 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, ...); }.


Revision tags: matt-mips64-premerge-20101231 uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3
# 1.124 27-Aug-2010 christos

The signal number argument in psignal is int not unsigned int.
Add psiginfo.


Revision tags: uebayasi-xip-base2 uebayasi-xip-base1
# 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


Revision tags: uebayasi-xip-base matt-premerge-20091211
# 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.


Revision tags: jym-xensuspend-nbase jym-xensuspend-base
# 1.120 11-Jan-2009 christos

merge christos-time_t


Revision tags: christos-time_t-nbase christos-time_t-base
# 1.119 06-Jan-2009 lukem

Change the second argument of getlogin_r() from int to size_t, per POSIX.


Revision tags: netbsd-5-base matt-mips64-base2 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 simonb-wapbl-nbase simonb-wapbl-base
# 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.


Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 wrstuden-revivesa-base
# 1.116 28-Apr-2008 martin

branches: 1.116.2; 1.116.4;
Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-pf42-baseX yamt-pf42-base
# 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"


Revision tags: keiichi-mipv6-base matt-armv6-nbase hpcarm-cleanup-base
# 1.114 24-Dec-2007 perry

change some __attribute__s to __keywords


Revision tags: matt-armv6-prevmlocking cube-autoconf-base matt-armv6-base
# 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.


Revision tags: matt-mips64-base
# 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.


Revision tags: abandoned-netbsd-4-base netbsd-4-base
# 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.


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 netbsd-3-base
# 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.


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 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


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 nathanw_sa_before_merge fvdl_fs64_base nathanw_sa_base netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 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>.


Revision tags: netbsd-1-5-PATCH003 netbsd-1-5-PATCH002 netbsd-1-5-PATCH001 netbsd-1-5-RELEASE netbsd-1-5-BETA2 netbsd-1-5-BETA netbsd-1-5-ALPHA2 netbsd-1-5-base minoura-xpg4dl-base
# 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.


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base
# 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.


Revision tags: comdex-fall-1999-base
# 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__


Revision tags: netbsd-1-4-PATCH002 netbsd-1-4-PATCH001 netbsd-1-4-RELEASE netbsd-1-4-base
# 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>.


Revision tags: netbsd-1-3-PATCH002 netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base
# 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.


Revision tags: mrg-vm-swap2-base
# 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).


Revision tags: netbsd-1-2-base
# 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.)


Revision tags: netbsd-1-1-PATCH001 netbsd-1-1-RELEASE netbsd-1-1-base
# 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.


Revision tags: netbsd-1-0-PATCH06 netbsd-1-0-PATCH05 netbsd-1-0-PATCH04 netbsd-1-0-PATCH03 netbsd-1-0-PATCH02 netbsd-1-0-PATCH1 netbsd-1-0-PATCH0 netbsd-1-0-RELEASE netbsd-1-0-base
# 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.


Revision tags: netbsd-0-9-RELEASE netbsd-0-9-BETA netbsd-0-9-ALPHA2 netbsd-0-9-ALPHA netbsd-0-9-base
# 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


Revision tags: pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 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)


Revision tags: netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 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


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 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


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8
# 1.138 12-Jan-2013 dholland

Remove #if defined(_KERNEL) around a userlevel function.


Revision tags: yamt-pagecache-base7
# 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


Revision tags: yamt-pagecache-base6
# 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()


Revision tags: yamt-pagecache-base5 yamt-pagecache-base4
# 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


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2
# 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.


Revision tags: yamt-pagecache-base
# 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.


Revision tags: cherry-xenmp-base uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base
# 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, ...); }.


Revision tags: matt-mips64-premerge-20101231 uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3
# 1.124 27-Aug-2010 christos

The signal number argument in psignal is int not unsigned int.
Add psiginfo.


Revision tags: uebayasi-xip-base2 uebayasi-xip-base1
# 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


Revision tags: uebayasi-xip-base matt-premerge-20091211
# 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.


Revision tags: jym-xensuspend-nbase jym-xensuspend-base
# 1.120 11-Jan-2009 christos

merge christos-time_t


Revision tags: christos-time_t-nbase christos-time_t-base
# 1.119 06-Jan-2009 lukem

Change the second argument of getlogin_r() from int to size_t, per POSIX.


Revision tags: netbsd-5-base matt-mips64-base2 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 simonb-wapbl-nbase simonb-wapbl-base
# 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.


Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 wrstuden-revivesa-base
# 1.116 28-Apr-2008 martin

branches: 1.116.2; 1.116.4;
Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-pf42-baseX yamt-pf42-base
# 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"


Revision tags: keiichi-mipv6-base matt-armv6-nbase hpcarm-cleanup-base
# 1.114 24-Dec-2007 perry

change some __attribute__s to __keywords


Revision tags: matt-armv6-prevmlocking cube-autoconf-base matt-armv6-base
# 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.


Revision tags: matt-mips64-base
# 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.


Revision tags: abandoned-netbsd-4-base netbsd-4-base
# 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.


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 netbsd-3-base
# 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.


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 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


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 nathanw_sa_before_merge fvdl_fs64_base nathanw_sa_base netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 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>.


Revision tags: netbsd-1-5-PATCH003 netbsd-1-5-PATCH002 netbsd-1-5-PATCH001 netbsd-1-5-RELEASE netbsd-1-5-BETA2 netbsd-1-5-BETA netbsd-1-5-ALPHA2 netbsd-1-5-base minoura-xpg4dl-base
# 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.


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base
# 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.


Revision tags: comdex-fall-1999-base
# 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__


Revision tags: netbsd-1-4-PATCH002 netbsd-1-4-PATCH001 netbsd-1-4-RELEASE netbsd-1-4-base
# 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>.


Revision tags: netbsd-1-3-PATCH002 netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base
# 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.


Revision tags: mrg-vm-swap2-base
# 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).


Revision tags: netbsd-1-2-base
# 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.)


Revision tags: netbsd-1-1-PATCH001 netbsd-1-1-RELEASE netbsd-1-1-base
# 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.


Revision tags: netbsd-1-0-PATCH06 netbsd-1-0-PATCH05 netbsd-1-0-PATCH04 netbsd-1-0-PATCH03 netbsd-1-0-PATCH02 netbsd-1-0-PATCH1 netbsd-1-0-PATCH0 netbsd-1-0-RELEASE netbsd-1-0-base
# 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.


Revision tags: netbsd-0-9-RELEASE netbsd-0-9-BETA netbsd-0-9-ALPHA2 netbsd-0-9-ALPHA netbsd-0-9-base
# 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