History log of /openbsd-current/include/unistd.h
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.108 12-Dec-2023 deraadt

remove support for syscall(2) -- the "indirection system call" because
it is a dangerous alternative entry point for all system calls, and thus
incompatible with the precision system call entry point scheme we are
heading towards. This has been a 3-year mission:
First perl needed a code-generated wrapper to fake syscall(2) as a giant
switch table, then all the ports were cleaned with relatively minor fixes,
except for "go". "go" required two fixes -- 1) a framework issue with
old library versions, and 2) like perl, a fake syscall(2) wrapper to
handle ioctl(2) and sysctl(2) because "syscall(SYS_ioctl" occurs all over
the place in the "go" ecosystem because the "go developers" are plan9-loving
unix-hating folk who tried to build an ecosystem without allowing "ioctl".
ok kettenis, jsing, afresh1, sthen


Revision tags: OPENBSD_7_3_BASE OPENBSD_7_4_BASE
# 1.107 07-Jan-2023 guenther

Add {get,set}thrname(2) for putting thread names in the kernel and
exposed in a new field returned by sysctl(KERN_PROC). Update
pthread_{get,set}_name_np(3) to use the syscalls. Show them, when
set, in ps -H and top -H output.

libc and libpthread minor bumps

ok mpi@, mvs@, deraadt@


Revision tags: OPENBSD_6_4_BASE OPENBSD_6_5_BASE OPENBSD_6_6_BASE OPENBSD_6_7_BASE OPENBSD_6_8_BASE OPENBSD_6_9_BASE OPENBSD_7_0_BASE OPENBSD_7_1_BASE OPENBSD_7_2_BASE
# 1.106 13-Jul-2018 beck

Unveiling unveil(2).
This brings unveil into the tree, disabled by default - Currently
this will return EPERM on all attempts to use it until we are
fully certain it is ready for people to start using, but this
now allows for others to do more tweaking and experimentation.

Still needs to send the unveil's across forks and execs before
fully enabling.

Many thanks to robert@ and deraadt@ for extensive testing.
ok deraadt@


Revision tags: OPENBSD_6_3_BASE
# 1.105 12-Dec-2017 deraadt

pledge()'s 2nd argument becomes char *execpromises, which becomes the
pledge for a new execve image immediately upon start. Also introduces
"error" which makes violations return -1 ENOSYS instead of killing the
program ("error" may not be handed to a setuid/setgid program, which
may be missing/ignoring syscall return values and would continue with
inconsistant state)
Discussion with many
florian has used this to improve the strictness of a daemon


Revision tags: OPENBSD_6_1_BASE OPENBSD_6_2_BASE
# 1.104 09-Mar-2017 fcambus

As per style.9, prototypes should not have variable names associated
with the types.

OK jca@


# 1.103 12-Sep-2016 guenther

Don't declare select() in <unistd.h>

ok deraadt@ millert@


# 1.102 09-Sep-2016 millert

Move the 10 (!) defintions of NULL to their own mini header file and
update the NULL definition for C++11. OK deraadt@ guenther@ kettenis@


Revision tags: OPENBSD_6_0_BASE
# 1.101 23-May-2016 guenther

Remove iruserok(_sa)? and __ivaliduser(sa)?

ok millert@ deraadt@


Revision tags: OPENBSD_5_9_BASE
# 1.100 09-Oct-2015 deraadt

tame -> pledge.


# 1.99 09-Sep-2015 deraadt

Move to next tame() API. The flags are now passed as a very simple string,
which results in tame() code placements being much more recognizeable.
tame() can be moved to unistd.h and does not need cpp symbols to turn the
bits on and off. The resulting API is a bit unexpected, but simplifies the
mapping to enabling bits in the kernel substantially.
vague ok's from various including guenther doug semarie


# 1.98 26-Aug-2015 guenther

Hide many (194!) symbols that nothing should be using.
Delete exect(2); it wasn't portable across archs and nothing used it.

ports test build by naddy@
ok deraadt@ kettenis@


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.97 13-Dec-2014 tedu

claim posix 2008 compat. apparently people look at this and get scared
when it's really old. but no actual ports fallout in espie's build.
ok deraadt


# 1.96 11-Dec-2014 tedu

update swab() to match the current posix definition. "rationale: none."
rewrite the function to be simpler as well. the compiler can unroll the
loop for us if necessary.
ok schwarze


# 1.95 08-Dec-2014 tedu

header changes for recent libc changes:
add siphash
delete setkey, encrypt, cfree


# 1.94 21-Nov-2014 tedu

change prototype for crypt_newhash. the login_cap_t is a holdover from its
pwd_gensalt origins, but a string argument works equally work and is more
friendly to consumers beyond local user accounts.
ok deraadt


# 1.93 18-Sep-2014 guenther

Our setpgrp() is the BSD version with two args and not the XSI
version with zero args, so it should only be visible if __BSD_VISIBLE
(and not also for __XPG_VISIBLE). Contrawise, readlink() has been
part of base POSIX since 1995, so move to proper #if area for that.
Move crypt_checkpass() to the pure-BSD section of the file.

setpgrp() issue noted by Matti Karnaattu (mkarnaattu (at) gmail.com)
ok millert@


# 1.92 01-Sep-2014 doug

Sync readlink(2) with IEEE Std 1003.1-2008.

discussion, help and ok guenther@


# 1.91 31-Aug-2014 guenther

Declare and document getthrid()

indirectly prodded by krw@


# 1.90 31-Aug-2014 guenther

Add additional kernel interfaces for setting close-on-exec on fds
when creating them: pipe2(), dup3(), accept4(), MSG_CMSG_CLOEXEC,
SOCK_CLOEXEC. Includes SOCK_NONBLOCK support.

ok matthew@


Revision tags: OPENBSD_5_6_BASE
# 1.89 08-Jul-2014 tedu

update _POSIX2_FORT_RUN, so that sysconf(_SC_2_FORT_RUN) remains correct.
because you care. reminded by matthew.


# 1.88 14-Jun-2014 deraadt

Change return value of getentropy() to int 0 for success. Maximum
buffersize is enforced strictly, this supplies sufficient entropy
payload to act as seed material. Discourage general use of this
API, but lock down this function name as the go-to for userland
PRNG seeding. Improve documentation.
ok miod matthew


# 1.87 13-Jun-2014 deraadt

Add new getentropy() system call. Code and pressure from matthew.
I accepted that he's right (again) to seperate this out from heavy
sysctl API and this will simply a variety of things. Functionname
is not used by anyone in the ports tree, so we guess we can use it.
Shocking that no application has a function called this.
ok matthew & others who pushed him to start this early on


# 1.86 16-May-2014 tedu

add prototypes for new crypt functions


# 1.85 21-Apr-2014 guenther

Use internal '__' names for __attributes__ in public headers


# 1.84 01-Apr-2014 matthew

Define intptr_t in <unistd.h> as specified by POSIX

ok millert


Revision tags: OPENBSD_5_5_BASE
# 1.83 28-Dec-2013 martynas

Annotate a few more bounded functions: realpath(3) needs a buffer
of size at least PATH_MAX. pread(2), pwrite(2) and readlinkat(2)
also take the buffer and the bound. OK theo.


# 1.82 04-Dec-2013 deraadt

express final disapproval of the interfaces in libcompat, such as
them ftime(), gtty(), stty(), re_comp(), cuserid() and others.
Discussion and ongoing work to fix the ports tree from many, especially
naddy.
ok naddy
[There is a bit more cleanup possible after that, but this is considered
the current safe step]


# 1.81 22-Nov-2013 millert

The getopt() prototype and externs don't belong in stdlib.h. Berkeley
moved them to unistd.h to match POSIX in 1995 but we never did.
The exception to this is getsubopt() which POSIX says should be in
stdlib.h. The non-standard suboptarg extern remains in the BSD-only
section of stdlib.h. Neither getsubopt() nor suboptarg belong in
unistd.h or getopt.h. They were only there to allow us to protect
all the getopt() bits from being multiply defined. OK guenther@


# 1.80 24-Oct-2013 guenther

Align suseconds_t with POSIX: it's the type of the tv_usec member of timeval.
Use useconds_t in the ualarm() declaration.
Bump libstdc++ major to be sure there isn't ABI issues.

ok deraadt@ jca@ jmc@ millert@
ports testing by landry@


Revision tags: OPENBSD_5_4_BASE
# 1.79 17-Jun-2013 guenther

Add support for the _POSIX_CPUTIME and _POSIX_THREAD_CPUTIME options,
including CLOCK_{PROCESS,THREAD}_CPUTIME_ID constants and
{clock,pthread}_getcpuclockid() functions.

Worked out at t2k13 with help from tedu@ and matthew@ and testing by aja@
ok matthew@


# 1.78 04-Jun-2013 brad

Enable the _POSIX_SHARED_MEMORY_OBJECTS option group now that we have shm_open / shm_unlink.

ok guenther@


# 1.77 15-Apr-2013 matthew

Implement fdatasync() as a wrapper around fsync()

ok guenther, deraadt, jmc


# 1.76 11-Apr-2013 guenther

getpgid() and getsid() were rolled into POSIX in 2008

ok millert@


# 1.75 01-Mar-2013 guenther

Adds the (somewhat silly) _CS_V[67]_ENV and _CS_POSIX_V[67]_* defines
to <unistd.h> and confstr(3) per POSIX 1003.1-2008

Change confstr(_CS_PATH) to operate directly instead of calling sysctl(3)

ports build tested by espie@


Revision tags: OPENBSD_5_3_BASE
# 1.74 05-Dec-2012 deraadt

Remove excessive sys/cdefs.h inclusion
ok guenther millert kettenis


Revision tags: OPENBSD_5_2_BASE
# 1.73 21-Jun-2012 guenther

__tfork() needs to set the stack address of the new thread in the kernel,
so that it can't get a signal while still running on the parent thread's
stack. Also, pass in sizeof(struct __tfork) to provide forward compat
when more members are added. This is an ABI change, so switch syscall
numbers and bump lib majors this time.

ok deraadt@ matthew@


# 1.72 30-May-2012 matthew

Move the _SC_* and _CS_* configurable system variables and strings
from sys/unistd.h to unistd.h.

From Brad; ok millert and me


# 1.71 14-May-2012 matthew

More sysconf(3)-y and pathconf(3)-y goodness from Brad.
ok guenther, millert (and me); bulk build test by naddy


# 1.70 12-Apr-2012 deraadt

remove rfork(); ok guenther miod


# 1.69 12-Apr-2012 deraadt

prototype getdtablecount()


# 1.68 21-Mar-2012 matthew

Implement execvpe(3) and posix_spawn(3) and family. Based on
FreeBSD's implementation via Frank Denis, with various cleanups and
tweaks by me.

ok deraadt@, guenther@; discussions and tweaks from many others
jmc@ promises to help me further with the man pages in tree


Revision tags: OPENBSD_5_1_BASE
# 1.67 13-Jan-2012 nigel

Replace _SELECT_DECLARED with _SELECT_DEFINED_

Ok sthen@, millert@, dcoppa@


# 1.66 09-Nov-2011 fgsch

getcwd() buffer's length can be smaller than 1024. In that case it will
fail with errno set to ERANGE if not enough room is provided. Similar for
getlogin_r() so remove minbytes enforcement attribute.
ok kettenis@ guenther@ deraadt@ on getcwd, deraadt@ on getlogin_r.


Revision tags: OPENBSD_5_0_BASE
# 1.65 18-Jul-2011 matthew

Expose a bunch of new functionality from POSIX 2008: openat(2),
fchmodat(2), fstatat(2), mkdirat(2), mkfifoat(2), mknodat(2),
faccessat(2), fchownat(2), linkat(2), readlinkat(2), renameat(2),
symlinkat(2), unlinkat(2), utimensat(2), futimens(2), and
fdopendir(3).

"Minor" libc bump.

Tested in a bulk build by naddy@
Much help from guenther@, thib@, tedu@, oga@, and others.
ok deraadt@, naddy@


# 1.64 03-Jul-2011 jsg

As pointed out by Richard Guenther our definition
of NULL was incorrect for c++ compilers that aren't
gcc (or pretend to be gcc like clang).

ok miod@


# 1.63 06-Apr-2011 miod

Define NULL as a void * instead of a long integer, as required by Single Unix.
Kernel and bootblocks still use the old 0L value until all the NULL abuses
in the code are fixed.


Revision tags: OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE
# 1.62 25-Jun-2008 millert

Move _POSIX_THREAD_SAFE_FUNCTIONS into unistd.h and set it to 200112
now that we support all the _r functions required by POSIX 1003.1-2001.
Also define _POSIX_REENTRANT_FUNCTIONS. OK kurt@ deraadt@


# 1.61 29-Apr-2008 kurt

Remove duplicate psignal(3) and sys_siglist definitions. signal.h
is the correct place for them and nothing gets them from here in
base/xenocara/ports. no objection millert@ okay kettenis@


# 1.60 24-Apr-2008 kurt

- correct brk(2) prototype and man page to match implementation and POSIX.
brk(2) returns an int value not a void *. brk(2) returns 0 upon success not
a pointer to the new end of memory. okay millert@, kettenis@, deraadt@


Revision tags: OPENBSD_4_1_BASE OPENBSD_4_2_BASE OPENBSD_4_3_BASE
# 1.59 20-Dec-2006 espie

zap bogus sentinel, as noticed by dasn.
okay theo


Revision tags: OPENBSD_4_0_BASE
# 1.58 28-Aug-2006 espie

zap argument name, okay millert@


Revision tags: OPENBSD_3_9_BASE
# 1.57 13-Dec-2005 millert

First step in include files overhaul. Use __FOO_VISIBLE (as defined
in sys/cdefs.h) instead of _FOO_SOURCE. Also fix several namespace
pollution issues, including the byte order defines. OK deraadt@


# 1.56 24-Nov-2005 deraadt

undelete died a while back; millert ok


# 1.55 21-Nov-2005 millert

Move contents of sys/select.h to sys/selinfo.h in preparation for a
userland-visible sys/select.h. Consistent with what Net and Free do.
OK deraadt@, tested with full ports build by naddy@.


# 1.54 20-Nov-2005 millert

brk() and sbrk() should use void *, not char *. Note that sbrk()
should take intptr_t, not int, but we don't presently have intptr_t
available from unistd.h. OK marco@


Revision tags: OPENBSD_3_8_BASE
# 1.53 27-May-2005 millert

mktemp(3) et al. go in stdlib.h, not unistd.h. While there be more
explicit about mktemp(3) in the man page.


Revision tags: OPENBSD_3_5_BASE OPENBSD_3_6_BASE OPENBSD_3_7_BASE
# 1.52 13-Jan-2004 millert

Prototype closefrom(); tedu@ OK


Revision tags: OPENBSD_3_4_BASE
# 1.51 07-Aug-2003 deraadt

des_cipher 3rd param is int32_t not long


# 1.50 01-Aug-2003 avsm

add __bounded__ attributes for userland headers; enabled with -Wbounded
ok deraadt@


# 1.49 26-Jun-2003 avsm

backout the __bounded__ attributes for a while; requested by deraadt@


# 1.48 26-Jun-2003 avsm

Mark various standard library functions with the __bounded__ attribute.
You must have an up-to-date gcc for this!
deraadt@ ok


# 1.47 02-Jun-2003 millert

Remove the advertising clause in the UCB license which Berkeley
rescinded 22 July 1999. Proofed by myself and Theo.


# 1.46 10-May-2003 miod

Do not let userland access the swapon system call anymore (nothing uses it
anyway).
ok deraadt@ weingart@


Revision tags: OPENBSD_3_3_BASE
# 1.45 03-Dec-2002 millert

GNU-like getopt_long() from NetBSD with changes by me to support
getopt_long_only(). At some point this should replace the BSD
getopt(3) but we are not there yet.

While I am here add protection from the multiple getopt() definitions
due to conflicting standards.


# 1.44 30-Oct-2002 millert

Add [gs]etres[ug]id(2) syscall to libc and use it in emulating some 4.3BSD
functions.


# 1.43 25-Oct-2002 millert

NULL is now 0L so it is the same size as a pointer.
OK mickey@ and discussed with deraadt@


Revision tags: OPENBSD_3_2_BASE
# 1.42 17-Sep-2002 deraadt

uncommit, since it breaks macppc libc. millert and miod have now said they
did NOT approve those for commit. why did mickey feel he was ok to go
commiting a set of diffs which had not been passed around and tested by people?
we don't know. mickey, have you got something to say for yourself?


# 1.41 17-Sep-2002 mickey

move __syscall prototype into unistd.h (like everybody else) and avoid private protos for it everywhere; millert@ ok


# 1.40 30-Aug-2002 espie

Put sentinel back in.


# 1.39 07-Jun-2002 miod

Backout previous change. Since it requires people to upgrade gcc, we want
to give them a larger timeslot to do that.
Requested by deraadt@ and various people on icb or vocally.


# 1.38 05-Jun-2002 espie

Use attribute((sentinel)) on functions where it makes sense.
(this will warn if they are used without a terminating NULL pointer.
Note *pointer*, very useful for arches where 0 != (void *)0, in size)

okay millert@


Revision tags: OPENBSD_3_1_BASE
# 1.37 17-Feb-2002 millert

Manual cleanup of remaining userland __P use (excluding packages maintained outside the tree)


# 1.36 16-Feb-2002 millert

Part one of userland __P removal. Done with a simple regexp with some minor hand editing to make comments line up correctly. Another pass is forthcoming that handles the cases that could not be done automatically.


Revision tags: OPENBSD_3_0_BASE
# 1.35 07-Aug-2001 millert

remove redundant __noreturn__ attributes now that __dead is sane for modern gcc


Revision tags: OPENBSD_2_9_BASE
# 1.34 06-Dec-2000 deraadt

use __x__ formats for __attribute__ arguments; guenther@gac.edu


Revision tags: OPENBSD_2_8_BASE
# 1.33 12-Sep-2000 millert

o add missing getsid() prototype
o fix typo in getsid() that broke getsid(pid) where pid != 0
o cause getsid() and getpgid() to return EPERM if requesting the
id of a session/process group not in the current session
o check for NULL session in getsid() for exiting processes


# 1.32 19-Jul-2000 mickey

from freebsd:
strtofflags/fflagstostr to convert file flags
to/from binary from/into a string as used in chflags(1).

use u_int32_t instead of u_long (as freebsd does).
increase libc minor.
millert@ ok.


Revision tags: OPENBSD_2_7_BASE
# 1.31 20-Apr-2000 deraadt

prototyping for p{read,write}{,v}


# 1.30 19-Feb-2000 deraadt

swapctl 2nd arg is const


# 1.29 27-Jan-2000 itojun

add IPv6-ready rcmd() friends.
rcmd(): IPv4 only
rcmd_af(): af independent
ruserok(): af independent
iruserok(): IPv4 only
iruserok_sa(): af independent


# 1.28 16-Dec-1999 deraadt

rresvport_af() and bindresvport_af()


Revision tags: OPENBSD_2_6_BASE
# 1.27 17-Sep-1999 espie

Be thorough about NULL as __null for C++.


# 1.26 11-Jun-1999 espie

Define NULL to be __null for C++: better quality of implementation.
__null is a magic constant of integral type that converts to a null pointer
as should be, but warns for ambiguity when used to resolved an overload
between an integral type and a pointer type.


# 1.25 22-May-1999 weingart

Add swapctl(2) prototype.


Revision tags: OPENBSD_2_5_BASE
# 1.24 20-Nov-1998 d

Add thread-safety to libc, so that libc_r will build (on i386 at least).
All POSIX libc api now there (to P1003.1c/D10)
(more md stuff is needed for other libc/arch/*)
(setlogin is no longer a special syscall)
Add -pthread option to gcc (that makes it use -lc_r and -D_POSIX_THREADS).
Doc some re-entrant routines
Add libc_r to intro(3)
dig() uses some libc srcs and an extra -I was needed there.
Add more md stuff to libc_r.
Update includes for the pthreads api
Update libc_r TODO


# 1.23 19-Nov-1998 deraadt

add getpgid() proto; form


Revision tags: OPENBSD_2_4_BASE
# 1.22 30-Jun-1998 deraadt

add mkstemp(char *template, int suffixlen) interface


# 1.21 13-May-1998 deraadt

change size parameter to size_t


# 1.20 25-Apr-1998 deraadt

readlink() 3rd param is size_t; XPG


Revision tags: OPENBSD_2_3_BASE
# 1.19 16-Feb-1998 deraadt

be more careful for _XOPEN_SOURCE


# 1.18 10-Feb-1998 deraadt

more explicit protos


# 1.17 10-Feb-1998 deraadt

move proto to unistd.h


# 1.16 27-Dec-1997 tholo

Make usleep prototype match manual page and implementation


# 1.15 22-Dec-1997 deraadt

add XPG4.2 lockf; kleink


# 1.14 16-Nov-1997 deraadt

move proto to sys/stat.h; XPG4.2


Revision tags: OPENBSD_2_2_BASE
# 1.13 20-Jun-1997 millert

Add mkdtemp(3)


Revision tags: OPENBSD_2_1_BASE
# 1.12 26-Jan-1997 downsj

Add lchown() declaration.


# 1.11 13-Dec-1996 deraadt

fix comments regarding {*path,sys}conf()


# 1.10 12-Dec-1996 deraadt

add quotactl


# 1.9 09-Dec-1996 deraadt

proto getgrouplist()


Revision tags: OPENBSD_2_0_BASE
# 1.8 25-Aug-1996 deraadt

+issetugid


# 1.7 22-Aug-1996 millert

Adds rcmdsh() prototype.


# 1.6 10-Jun-1996 deraadt

iruserok() can finally safely use a u_int32_t for the ip addr


# 1.5 25-Mar-1996 tholo

initgroups(3) 2nd argument should be gid_t


# 1.4 22-Mar-1996 tholo

sethostid() actually do return a value


# 1.3 12-Jan-1996 deraadt

proto rfork()


# 1.2 14-Dec-1995 deraadt

from netbsd; profil() fixed for 64 bit


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.107 07-Jan-2023 guenther

Add {get,set}thrname(2) for putting thread names in the kernel and
exposed in a new field returned by sysctl(KERN_PROC). Update
pthread_{get,set}_name_np(3) to use the syscalls. Show them, when
set, in ps -H and top -H output.

libc and libpthread minor bumps

ok mpi@, mvs@, deraadt@


Revision tags: OPENBSD_6_4_BASE OPENBSD_6_5_BASE OPENBSD_6_6_BASE OPENBSD_6_7_BASE OPENBSD_6_8_BASE OPENBSD_6_9_BASE OPENBSD_7_0_BASE OPENBSD_7_1_BASE OPENBSD_7_2_BASE
# 1.106 13-Jul-2018 beck

Unveiling unveil(2).
This brings unveil into the tree, disabled by default - Currently
this will return EPERM on all attempts to use it until we are
fully certain it is ready for people to start using, but this
now allows for others to do more tweaking and experimentation.

Still needs to send the unveil's across forks and execs before
fully enabling.

Many thanks to robert@ and deraadt@ for extensive testing.
ok deraadt@


Revision tags: OPENBSD_6_3_BASE
# 1.105 12-Dec-2017 deraadt

pledge()'s 2nd argument becomes char *execpromises, which becomes the
pledge for a new execve image immediately upon start. Also introduces
"error" which makes violations return -1 ENOSYS instead of killing the
program ("error" may not be handed to a setuid/setgid program, which
may be missing/ignoring syscall return values and would continue with
inconsistant state)
Discussion with many
florian has used this to improve the strictness of a daemon


Revision tags: OPENBSD_6_1_BASE OPENBSD_6_2_BASE
# 1.104 09-Mar-2017 fcambus

As per style.9, prototypes should not have variable names associated
with the types.

OK jca@


# 1.103 12-Sep-2016 guenther

Don't declare select() in <unistd.h>

ok deraadt@ millert@


# 1.102 09-Sep-2016 millert

Move the 10 (!) defintions of NULL to their own mini header file and
update the NULL definition for C++11. OK deraadt@ guenther@ kettenis@


Revision tags: OPENBSD_6_0_BASE
# 1.101 23-May-2016 guenther

Remove iruserok(_sa)? and __ivaliduser(sa)?

ok millert@ deraadt@


Revision tags: OPENBSD_5_9_BASE
# 1.100 09-Oct-2015 deraadt

tame -> pledge.


# 1.99 09-Sep-2015 deraadt

Move to next tame() API. The flags are now passed as a very simple string,
which results in tame() code placements being much more recognizeable.
tame() can be moved to unistd.h and does not need cpp symbols to turn the
bits on and off. The resulting API is a bit unexpected, but simplifies the
mapping to enabling bits in the kernel substantially.
vague ok's from various including guenther doug semarie


# 1.98 26-Aug-2015 guenther

Hide many (194!) symbols that nothing should be using.
Delete exect(2); it wasn't portable across archs and nothing used it.

ports test build by naddy@
ok deraadt@ kettenis@


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.97 13-Dec-2014 tedu

claim posix 2008 compat. apparently people look at this and get scared
when it's really old. but no actual ports fallout in espie's build.
ok deraadt


# 1.96 11-Dec-2014 tedu

update swab() to match the current posix definition. "rationale: none."
rewrite the function to be simpler as well. the compiler can unroll the
loop for us if necessary.
ok schwarze


# 1.95 08-Dec-2014 tedu

header changes for recent libc changes:
add siphash
delete setkey, encrypt, cfree


# 1.94 21-Nov-2014 tedu

change prototype for crypt_newhash. the login_cap_t is a holdover from its
pwd_gensalt origins, but a string argument works equally work and is more
friendly to consumers beyond local user accounts.
ok deraadt


# 1.93 18-Sep-2014 guenther

Our setpgrp() is the BSD version with two args and not the XSI
version with zero args, so it should only be visible if __BSD_VISIBLE
(and not also for __XPG_VISIBLE). Contrawise, readlink() has been
part of base POSIX since 1995, so move to proper #if area for that.
Move crypt_checkpass() to the pure-BSD section of the file.

setpgrp() issue noted by Matti Karnaattu (mkarnaattu (at) gmail.com)
ok millert@


# 1.92 01-Sep-2014 doug

Sync readlink(2) with IEEE Std 1003.1-2008.

discussion, help and ok guenther@


# 1.91 31-Aug-2014 guenther

Declare and document getthrid()

indirectly prodded by krw@


# 1.90 31-Aug-2014 guenther

Add additional kernel interfaces for setting close-on-exec on fds
when creating them: pipe2(), dup3(), accept4(), MSG_CMSG_CLOEXEC,
SOCK_CLOEXEC. Includes SOCK_NONBLOCK support.

ok matthew@


Revision tags: OPENBSD_5_6_BASE
# 1.89 08-Jul-2014 tedu

update _POSIX2_FORT_RUN, so that sysconf(_SC_2_FORT_RUN) remains correct.
because you care. reminded by matthew.


# 1.88 14-Jun-2014 deraadt

Change return value of getentropy() to int 0 for success. Maximum
buffersize is enforced strictly, this supplies sufficient entropy
payload to act as seed material. Discourage general use of this
API, but lock down this function name as the go-to for userland
PRNG seeding. Improve documentation.
ok miod matthew


# 1.87 13-Jun-2014 deraadt

Add new getentropy() system call. Code and pressure from matthew.
I accepted that he's right (again) to seperate this out from heavy
sysctl API and this will simply a variety of things. Functionname
is not used by anyone in the ports tree, so we guess we can use it.
Shocking that no application has a function called this.
ok matthew & others who pushed him to start this early on


# 1.86 16-May-2014 tedu

add prototypes for new crypt functions


# 1.85 21-Apr-2014 guenther

Use internal '__' names for __attributes__ in public headers


# 1.84 01-Apr-2014 matthew

Define intptr_t in <unistd.h> as specified by POSIX

ok millert


Revision tags: OPENBSD_5_5_BASE
# 1.83 28-Dec-2013 martynas

Annotate a few more bounded functions: realpath(3) needs a buffer
of size at least PATH_MAX. pread(2), pwrite(2) and readlinkat(2)
also take the buffer and the bound. OK theo.


# 1.82 04-Dec-2013 deraadt

express final disapproval of the interfaces in libcompat, such as
them ftime(), gtty(), stty(), re_comp(), cuserid() and others.
Discussion and ongoing work to fix the ports tree from many, especially
naddy.
ok naddy
[There is a bit more cleanup possible after that, but this is considered
the current safe step]


# 1.81 22-Nov-2013 millert

The getopt() prototype and externs don't belong in stdlib.h. Berkeley
moved them to unistd.h to match POSIX in 1995 but we never did.
The exception to this is getsubopt() which POSIX says should be in
stdlib.h. The non-standard suboptarg extern remains in the BSD-only
section of stdlib.h. Neither getsubopt() nor suboptarg belong in
unistd.h or getopt.h. They were only there to allow us to protect
all the getopt() bits from being multiply defined. OK guenther@


# 1.80 24-Oct-2013 guenther

Align suseconds_t with POSIX: it's the type of the tv_usec member of timeval.
Use useconds_t in the ualarm() declaration.
Bump libstdc++ major to be sure there isn't ABI issues.

ok deraadt@ jca@ jmc@ millert@
ports testing by landry@


Revision tags: OPENBSD_5_4_BASE
# 1.79 17-Jun-2013 guenther

Add support for the _POSIX_CPUTIME and _POSIX_THREAD_CPUTIME options,
including CLOCK_{PROCESS,THREAD}_CPUTIME_ID constants and
{clock,pthread}_getcpuclockid() functions.

Worked out at t2k13 with help from tedu@ and matthew@ and testing by aja@
ok matthew@


# 1.78 04-Jun-2013 brad

Enable the _POSIX_SHARED_MEMORY_OBJECTS option group now that we have shm_open / shm_unlink.

ok guenther@


# 1.77 15-Apr-2013 matthew

Implement fdatasync() as a wrapper around fsync()

ok guenther, deraadt, jmc


# 1.76 11-Apr-2013 guenther

getpgid() and getsid() were rolled into POSIX in 2008

ok millert@


# 1.75 01-Mar-2013 guenther

Adds the (somewhat silly) _CS_V[67]_ENV and _CS_POSIX_V[67]_* defines
to <unistd.h> and confstr(3) per POSIX 1003.1-2008

Change confstr(_CS_PATH) to operate directly instead of calling sysctl(3)

ports build tested by espie@


Revision tags: OPENBSD_5_3_BASE
# 1.74 05-Dec-2012 deraadt

Remove excessive sys/cdefs.h inclusion
ok guenther millert kettenis


Revision tags: OPENBSD_5_2_BASE
# 1.73 21-Jun-2012 guenther

__tfork() needs to set the stack address of the new thread in the kernel,
so that it can't get a signal while still running on the parent thread's
stack. Also, pass in sizeof(struct __tfork) to provide forward compat
when more members are added. This is an ABI change, so switch syscall
numbers and bump lib majors this time.

ok deraadt@ matthew@


# 1.72 30-May-2012 matthew

Move the _SC_* and _CS_* configurable system variables and strings
from sys/unistd.h to unistd.h.

From Brad; ok millert and me


# 1.71 14-May-2012 matthew

More sysconf(3)-y and pathconf(3)-y goodness from Brad.
ok guenther, millert (and me); bulk build test by naddy


# 1.70 12-Apr-2012 deraadt

remove rfork(); ok guenther miod


# 1.69 12-Apr-2012 deraadt

prototype getdtablecount()


# 1.68 21-Mar-2012 matthew

Implement execvpe(3) and posix_spawn(3) and family. Based on
FreeBSD's implementation via Frank Denis, with various cleanups and
tweaks by me.

ok deraadt@, guenther@; discussions and tweaks from many others
jmc@ promises to help me further with the man pages in tree


Revision tags: OPENBSD_5_1_BASE
# 1.67 13-Jan-2012 nigel

Replace _SELECT_DECLARED with _SELECT_DEFINED_

Ok sthen@, millert@, dcoppa@


# 1.66 09-Nov-2011 fgsch

getcwd() buffer's length can be smaller than 1024. In that case it will
fail with errno set to ERANGE if not enough room is provided. Similar for
getlogin_r() so remove minbytes enforcement attribute.
ok kettenis@ guenther@ deraadt@ on getcwd, deraadt@ on getlogin_r.


Revision tags: OPENBSD_5_0_BASE
# 1.65 18-Jul-2011 matthew

Expose a bunch of new functionality from POSIX 2008: openat(2),
fchmodat(2), fstatat(2), mkdirat(2), mkfifoat(2), mknodat(2),
faccessat(2), fchownat(2), linkat(2), readlinkat(2), renameat(2),
symlinkat(2), unlinkat(2), utimensat(2), futimens(2), and
fdopendir(3).

"Minor" libc bump.

Tested in a bulk build by naddy@
Much help from guenther@, thib@, tedu@, oga@, and others.
ok deraadt@, naddy@


# 1.64 03-Jul-2011 jsg

As pointed out by Richard Guenther our definition
of NULL was incorrect for c++ compilers that aren't
gcc (or pretend to be gcc like clang).

ok miod@


# 1.63 06-Apr-2011 miod

Define NULL as a void * instead of a long integer, as required by Single Unix.
Kernel and bootblocks still use the old 0L value until all the NULL abuses
in the code are fixed.


Revision tags: OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE
# 1.62 25-Jun-2008 millert

Move _POSIX_THREAD_SAFE_FUNCTIONS into unistd.h and set it to 200112
now that we support all the _r functions required by POSIX 1003.1-2001.
Also define _POSIX_REENTRANT_FUNCTIONS. OK kurt@ deraadt@


# 1.61 29-Apr-2008 kurt

Remove duplicate psignal(3) and sys_siglist definitions. signal.h
is the correct place for them and nothing gets them from here in
base/xenocara/ports. no objection millert@ okay kettenis@


# 1.60 24-Apr-2008 kurt

- correct brk(2) prototype and man page to match implementation and POSIX.
brk(2) returns an int value not a void *. brk(2) returns 0 upon success not
a pointer to the new end of memory. okay millert@, kettenis@, deraadt@


Revision tags: OPENBSD_4_1_BASE OPENBSD_4_2_BASE OPENBSD_4_3_BASE
# 1.59 20-Dec-2006 espie

zap bogus sentinel, as noticed by dasn.
okay theo


Revision tags: OPENBSD_4_0_BASE
# 1.58 28-Aug-2006 espie

zap argument name, okay millert@


Revision tags: OPENBSD_3_9_BASE
# 1.57 13-Dec-2005 millert

First step in include files overhaul. Use __FOO_VISIBLE (as defined
in sys/cdefs.h) instead of _FOO_SOURCE. Also fix several namespace
pollution issues, including the byte order defines. OK deraadt@


# 1.56 24-Nov-2005 deraadt

undelete died a while back; millert ok


# 1.55 21-Nov-2005 millert

Move contents of sys/select.h to sys/selinfo.h in preparation for a
userland-visible sys/select.h. Consistent with what Net and Free do.
OK deraadt@, tested with full ports build by naddy@.


# 1.54 20-Nov-2005 millert

brk() and sbrk() should use void *, not char *. Note that sbrk()
should take intptr_t, not int, but we don't presently have intptr_t
available from unistd.h. OK marco@


Revision tags: OPENBSD_3_8_BASE
# 1.53 27-May-2005 millert

mktemp(3) et al. go in stdlib.h, not unistd.h. While there be more
explicit about mktemp(3) in the man page.


Revision tags: OPENBSD_3_5_BASE OPENBSD_3_6_BASE OPENBSD_3_7_BASE
# 1.52 13-Jan-2004 millert

Prototype closefrom(); tedu@ OK


Revision tags: OPENBSD_3_4_BASE
# 1.51 07-Aug-2003 deraadt

des_cipher 3rd param is int32_t not long


# 1.50 01-Aug-2003 avsm

add __bounded__ attributes for userland headers; enabled with -Wbounded
ok deraadt@


# 1.49 26-Jun-2003 avsm

backout the __bounded__ attributes for a while; requested by deraadt@


# 1.48 26-Jun-2003 avsm

Mark various standard library functions with the __bounded__ attribute.
You must have an up-to-date gcc for this!
deraadt@ ok


# 1.47 02-Jun-2003 millert

Remove the advertising clause in the UCB license which Berkeley
rescinded 22 July 1999. Proofed by myself and Theo.


# 1.46 10-May-2003 miod

Do not let userland access the swapon system call anymore (nothing uses it
anyway).
ok deraadt@ weingart@


Revision tags: OPENBSD_3_3_BASE
# 1.45 03-Dec-2002 millert

GNU-like getopt_long() from NetBSD with changes by me to support
getopt_long_only(). At some point this should replace the BSD
getopt(3) but we are not there yet.

While I am here add protection from the multiple getopt() definitions
due to conflicting standards.


# 1.44 30-Oct-2002 millert

Add [gs]etres[ug]id(2) syscall to libc and use it in emulating some 4.3BSD
functions.


# 1.43 25-Oct-2002 millert

NULL is now 0L so it is the same size as a pointer.
OK mickey@ and discussed with deraadt@


Revision tags: OPENBSD_3_2_BASE
# 1.42 17-Sep-2002 deraadt

uncommit, since it breaks macppc libc. millert and miod have now said they
did NOT approve those for commit. why did mickey feel he was ok to go
commiting a set of diffs which had not been passed around and tested by people?
we don't know. mickey, have you got something to say for yourself?


# 1.41 17-Sep-2002 mickey

move __syscall prototype into unistd.h (like everybody else) and avoid private protos for it everywhere; millert@ ok


# 1.40 30-Aug-2002 espie

Put sentinel back in.


# 1.39 07-Jun-2002 miod

Backout previous change. Since it requires people to upgrade gcc, we want
to give them a larger timeslot to do that.
Requested by deraadt@ and various people on icb or vocally.


# 1.38 05-Jun-2002 espie

Use attribute((sentinel)) on functions where it makes sense.
(this will warn if they are used without a terminating NULL pointer.
Note *pointer*, very useful for arches where 0 != (void *)0, in size)

okay millert@


Revision tags: OPENBSD_3_1_BASE
# 1.37 17-Feb-2002 millert

Manual cleanup of remaining userland __P use (excluding packages maintained outside the tree)


# 1.36 16-Feb-2002 millert

Part one of userland __P removal. Done with a simple regexp with some minor hand editing to make comments line up correctly. Another pass is forthcoming that handles the cases that could not be done automatically.


Revision tags: OPENBSD_3_0_BASE
# 1.35 07-Aug-2001 millert

remove redundant __noreturn__ attributes now that __dead is sane for modern gcc


Revision tags: OPENBSD_2_9_BASE
# 1.34 06-Dec-2000 deraadt

use __x__ formats for __attribute__ arguments; guenther@gac.edu


Revision tags: OPENBSD_2_8_BASE
# 1.33 12-Sep-2000 millert

o add missing getsid() prototype
o fix typo in getsid() that broke getsid(pid) where pid != 0
o cause getsid() and getpgid() to return EPERM if requesting the
id of a session/process group not in the current session
o check for NULL session in getsid() for exiting processes


# 1.32 19-Jul-2000 mickey

from freebsd:
strtofflags/fflagstostr to convert file flags
to/from binary from/into a string as used in chflags(1).

use u_int32_t instead of u_long (as freebsd does).
increase libc minor.
millert@ ok.


Revision tags: OPENBSD_2_7_BASE
# 1.31 20-Apr-2000 deraadt

prototyping for p{read,write}{,v}


# 1.30 19-Feb-2000 deraadt

swapctl 2nd arg is const


# 1.29 27-Jan-2000 itojun

add IPv6-ready rcmd() friends.
rcmd(): IPv4 only
rcmd_af(): af independent
ruserok(): af independent
iruserok(): IPv4 only
iruserok_sa(): af independent


# 1.28 16-Dec-1999 deraadt

rresvport_af() and bindresvport_af()


Revision tags: OPENBSD_2_6_BASE
# 1.27 17-Sep-1999 espie

Be thorough about NULL as __null for C++.


# 1.26 11-Jun-1999 espie

Define NULL to be __null for C++: better quality of implementation.
__null is a magic constant of integral type that converts to a null pointer
as should be, but warns for ambiguity when used to resolved an overload
between an integral type and a pointer type.


# 1.25 22-May-1999 weingart

Add swapctl(2) prototype.


Revision tags: OPENBSD_2_5_BASE
# 1.24 20-Nov-1998 d

Add thread-safety to libc, so that libc_r will build (on i386 at least).
All POSIX libc api now there (to P1003.1c/D10)
(more md stuff is needed for other libc/arch/*)
(setlogin is no longer a special syscall)
Add -pthread option to gcc (that makes it use -lc_r and -D_POSIX_THREADS).
Doc some re-entrant routines
Add libc_r to intro(3)
dig() uses some libc srcs and an extra -I was needed there.
Add more md stuff to libc_r.
Update includes for the pthreads api
Update libc_r TODO


# 1.23 19-Nov-1998 deraadt

add getpgid() proto; form


Revision tags: OPENBSD_2_4_BASE
# 1.22 30-Jun-1998 deraadt

add mkstemp(char *template, int suffixlen) interface


# 1.21 13-May-1998 deraadt

change size parameter to size_t


# 1.20 25-Apr-1998 deraadt

readlink() 3rd param is size_t; XPG


Revision tags: OPENBSD_2_3_BASE
# 1.19 16-Feb-1998 deraadt

be more careful for _XOPEN_SOURCE


# 1.18 10-Feb-1998 deraadt

more explicit protos


# 1.17 10-Feb-1998 deraadt

move proto to unistd.h


# 1.16 27-Dec-1997 tholo

Make usleep prototype match manual page and implementation


# 1.15 22-Dec-1997 deraadt

add XPG4.2 lockf; kleink


# 1.14 16-Nov-1997 deraadt

move proto to sys/stat.h; XPG4.2


Revision tags: OPENBSD_2_2_BASE
# 1.13 20-Jun-1997 millert

Add mkdtemp(3)


Revision tags: OPENBSD_2_1_BASE
# 1.12 26-Jan-1997 downsj

Add lchown() declaration.


# 1.11 13-Dec-1996 deraadt

fix comments regarding {*path,sys}conf()


# 1.10 12-Dec-1996 deraadt

add quotactl


# 1.9 09-Dec-1996 deraadt

proto getgrouplist()


Revision tags: OPENBSD_2_0_BASE
# 1.8 25-Aug-1996 deraadt

+issetugid


# 1.7 22-Aug-1996 millert

Adds rcmdsh() prototype.


# 1.6 10-Jun-1996 deraadt

iruserok() can finally safely use a u_int32_t for the ip addr


# 1.5 25-Mar-1996 tholo

initgroups(3) 2nd argument should be gid_t


# 1.4 22-Mar-1996 tholo

sethostid() actually do return a value


# 1.3 12-Jan-1996 deraadt

proto rfork()


# 1.2 14-Dec-1995 deraadt

from netbsd; profil() fixed for 64 bit


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.106 13-Jul-2018 beck

Unveiling unveil(2).
This brings unveil into the tree, disabled by default - Currently
this will return EPERM on all attempts to use it until we are
fully certain it is ready for people to start using, but this
now allows for others to do more tweaking and experimentation.

Still needs to send the unveil's across forks and execs before
fully enabling.

Many thanks to robert@ and deraadt@ for extensive testing.
ok deraadt@


Revision tags: OPENBSD_6_3_BASE
# 1.105 12-Dec-2017 deraadt

pledge()'s 2nd argument becomes char *execpromises, which becomes the
pledge for a new execve image immediately upon start. Also introduces
"error" which makes violations return -1 ENOSYS instead of killing the
program ("error" may not be handed to a setuid/setgid program, which
may be missing/ignoring syscall return values and would continue with
inconsistant state)
Discussion with many
florian has used this to improve the strictness of a daemon


Revision tags: OPENBSD_6_1_BASE OPENBSD_6_2_BASE
# 1.104 09-Mar-2017 fcambus

As per style.9, prototypes should not have variable names associated
with the types.

OK jca@


# 1.103 12-Sep-2016 guenther

Don't declare select() in <unistd.h>

ok deraadt@ millert@


# 1.102 09-Sep-2016 millert

Move the 10 (!) defintions of NULL to their own mini header file and
update the NULL definition for C++11. OK deraadt@ guenther@ kettenis@


Revision tags: OPENBSD_6_0_BASE
# 1.101 23-May-2016 guenther

Remove iruserok(_sa)? and __ivaliduser(sa)?

ok millert@ deraadt@


Revision tags: OPENBSD_5_9_BASE
# 1.100 09-Oct-2015 deraadt

tame -> pledge.


# 1.99 09-Sep-2015 deraadt

Move to next tame() API. The flags are now passed as a very simple string,
which results in tame() code placements being much more recognizeable.
tame() can be moved to unistd.h and does not need cpp symbols to turn the
bits on and off. The resulting API is a bit unexpected, but simplifies the
mapping to enabling bits in the kernel substantially.
vague ok's from various including guenther doug semarie


# 1.98 26-Aug-2015 guenther

Hide many (194!) symbols that nothing should be using.
Delete exect(2); it wasn't portable across archs and nothing used it.

ports test build by naddy@
ok deraadt@ kettenis@


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.97 13-Dec-2014 tedu

claim posix 2008 compat. apparently people look at this and get scared
when it's really old. but no actual ports fallout in espie's build.
ok deraadt


# 1.96 11-Dec-2014 tedu

update swab() to match the current posix definition. "rationale: none."
rewrite the function to be simpler as well. the compiler can unroll the
loop for us if necessary.
ok schwarze


# 1.95 08-Dec-2014 tedu

header changes for recent libc changes:
add siphash
delete setkey, encrypt, cfree


# 1.94 21-Nov-2014 tedu

change prototype for crypt_newhash. the login_cap_t is a holdover from its
pwd_gensalt origins, but a string argument works equally work and is more
friendly to consumers beyond local user accounts.
ok deraadt


# 1.93 18-Sep-2014 guenther

Our setpgrp() is the BSD version with two args and not the XSI
version with zero args, so it should only be visible if __BSD_VISIBLE
(and not also for __XPG_VISIBLE). Contrawise, readlink() has been
part of base POSIX since 1995, so move to proper #if area for that.
Move crypt_checkpass() to the pure-BSD section of the file.

setpgrp() issue noted by Matti Karnaattu (mkarnaattu (at) gmail.com)
ok millert@


# 1.92 01-Sep-2014 doug

Sync readlink(2) with IEEE Std 1003.1-2008.

discussion, help and ok guenther@


# 1.91 31-Aug-2014 guenther

Declare and document getthrid()

indirectly prodded by krw@


# 1.90 31-Aug-2014 guenther

Add additional kernel interfaces for setting close-on-exec on fds
when creating them: pipe2(), dup3(), accept4(), MSG_CMSG_CLOEXEC,
SOCK_CLOEXEC. Includes SOCK_NONBLOCK support.

ok matthew@


Revision tags: OPENBSD_5_6_BASE
# 1.89 08-Jul-2014 tedu

update _POSIX2_FORT_RUN, so that sysconf(_SC_2_FORT_RUN) remains correct.
because you care. reminded by matthew.


# 1.88 14-Jun-2014 deraadt

Change return value of getentropy() to int 0 for success. Maximum
buffersize is enforced strictly, this supplies sufficient entropy
payload to act as seed material. Discourage general use of this
API, but lock down this function name as the go-to for userland
PRNG seeding. Improve documentation.
ok miod matthew


# 1.87 13-Jun-2014 deraadt

Add new getentropy() system call. Code and pressure from matthew.
I accepted that he's right (again) to seperate this out from heavy
sysctl API and this will simply a variety of things. Functionname
is not used by anyone in the ports tree, so we guess we can use it.
Shocking that no application has a function called this.
ok matthew & others who pushed him to start this early on


# 1.86 16-May-2014 tedu

add prototypes for new crypt functions


# 1.85 21-Apr-2014 guenther

Use internal '__' names for __attributes__ in public headers


# 1.84 01-Apr-2014 matthew

Define intptr_t in <unistd.h> as specified by POSIX

ok millert


Revision tags: OPENBSD_5_5_BASE
# 1.83 28-Dec-2013 martynas

Annotate a few more bounded functions: realpath(3) needs a buffer
of size at least PATH_MAX. pread(2), pwrite(2) and readlinkat(2)
also take the buffer and the bound. OK theo.


# 1.82 04-Dec-2013 deraadt

express final disapproval of the interfaces in libcompat, such as
them ftime(), gtty(), stty(), re_comp(), cuserid() and others.
Discussion and ongoing work to fix the ports tree from many, especially
naddy.
ok naddy
[There is a bit more cleanup possible after that, but this is considered
the current safe step]


# 1.81 22-Nov-2013 millert

The getopt() prototype and externs don't belong in stdlib.h. Berkeley
moved them to unistd.h to match POSIX in 1995 but we never did.
The exception to this is getsubopt() which POSIX says should be in
stdlib.h. The non-standard suboptarg extern remains in the BSD-only
section of stdlib.h. Neither getsubopt() nor suboptarg belong in
unistd.h or getopt.h. They were only there to allow us to protect
all the getopt() bits from being multiply defined. OK guenther@


# 1.80 24-Oct-2013 guenther

Align suseconds_t with POSIX: it's the type of the tv_usec member of timeval.
Use useconds_t in the ualarm() declaration.
Bump libstdc++ major to be sure there isn't ABI issues.

ok deraadt@ jca@ jmc@ millert@
ports testing by landry@


Revision tags: OPENBSD_5_4_BASE
# 1.79 17-Jun-2013 guenther

Add support for the _POSIX_CPUTIME and _POSIX_THREAD_CPUTIME options,
including CLOCK_{PROCESS,THREAD}_CPUTIME_ID constants and
{clock,pthread}_getcpuclockid() functions.

Worked out at t2k13 with help from tedu@ and matthew@ and testing by aja@
ok matthew@


# 1.78 04-Jun-2013 brad

Enable the _POSIX_SHARED_MEMORY_OBJECTS option group now that we have shm_open / shm_unlink.

ok guenther@


# 1.77 15-Apr-2013 matthew

Implement fdatasync() as a wrapper around fsync()

ok guenther, deraadt, jmc


# 1.76 11-Apr-2013 guenther

getpgid() and getsid() were rolled into POSIX in 2008

ok millert@


# 1.75 01-Mar-2013 guenther

Adds the (somewhat silly) _CS_V[67]_ENV and _CS_POSIX_V[67]_* defines
to <unistd.h> and confstr(3) per POSIX 1003.1-2008

Change confstr(_CS_PATH) to operate directly instead of calling sysctl(3)

ports build tested by espie@


Revision tags: OPENBSD_5_3_BASE
# 1.74 05-Dec-2012 deraadt

Remove excessive sys/cdefs.h inclusion
ok guenther millert kettenis


Revision tags: OPENBSD_5_2_BASE
# 1.73 21-Jun-2012 guenther

__tfork() needs to set the stack address of the new thread in the kernel,
so that it can't get a signal while still running on the parent thread's
stack. Also, pass in sizeof(struct __tfork) to provide forward compat
when more members are added. This is an ABI change, so switch syscall
numbers and bump lib majors this time.

ok deraadt@ matthew@


# 1.72 30-May-2012 matthew

Move the _SC_* and _CS_* configurable system variables and strings
from sys/unistd.h to unistd.h.

From Brad; ok millert and me


# 1.71 14-May-2012 matthew

More sysconf(3)-y and pathconf(3)-y goodness from Brad.
ok guenther, millert (and me); bulk build test by naddy


# 1.70 12-Apr-2012 deraadt

remove rfork(); ok guenther miod


# 1.69 12-Apr-2012 deraadt

prototype getdtablecount()


# 1.68 21-Mar-2012 matthew

Implement execvpe(3) and posix_spawn(3) and family. Based on
FreeBSD's implementation via Frank Denis, with various cleanups and
tweaks by me.

ok deraadt@, guenther@; discussions and tweaks from many others
jmc@ promises to help me further with the man pages in tree


Revision tags: OPENBSD_5_1_BASE
# 1.67 13-Jan-2012 nigel

Replace _SELECT_DECLARED with _SELECT_DEFINED_

Ok sthen@, millert@, dcoppa@


# 1.66 09-Nov-2011 fgsch

getcwd() buffer's length can be smaller than 1024. In that case it will
fail with errno set to ERANGE if not enough room is provided. Similar for
getlogin_r() so remove minbytes enforcement attribute.
ok kettenis@ guenther@ deraadt@ on getcwd, deraadt@ on getlogin_r.


Revision tags: OPENBSD_5_0_BASE
# 1.65 18-Jul-2011 matthew

Expose a bunch of new functionality from POSIX 2008: openat(2),
fchmodat(2), fstatat(2), mkdirat(2), mkfifoat(2), mknodat(2),
faccessat(2), fchownat(2), linkat(2), readlinkat(2), renameat(2),
symlinkat(2), unlinkat(2), utimensat(2), futimens(2), and
fdopendir(3).

"Minor" libc bump.

Tested in a bulk build by naddy@
Much help from guenther@, thib@, tedu@, oga@, and others.
ok deraadt@, naddy@


# 1.64 03-Jul-2011 jsg

As pointed out by Richard Guenther our definition
of NULL was incorrect for c++ compilers that aren't
gcc (or pretend to be gcc like clang).

ok miod@


# 1.63 06-Apr-2011 miod

Define NULL as a void * instead of a long integer, as required by Single Unix.
Kernel and bootblocks still use the old 0L value until all the NULL abuses
in the code are fixed.


Revision tags: OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE
# 1.62 25-Jun-2008 millert

Move _POSIX_THREAD_SAFE_FUNCTIONS into unistd.h and set it to 200112
now that we support all the _r functions required by POSIX 1003.1-2001.
Also define _POSIX_REENTRANT_FUNCTIONS. OK kurt@ deraadt@


# 1.61 29-Apr-2008 kurt

Remove duplicate psignal(3) and sys_siglist definitions. signal.h
is the correct place for them and nothing gets them from here in
base/xenocara/ports. no objection millert@ okay kettenis@


# 1.60 24-Apr-2008 kurt

- correct brk(2) prototype and man page to match implementation and POSIX.
brk(2) returns an int value not a void *. brk(2) returns 0 upon success not
a pointer to the new end of memory. okay millert@, kettenis@, deraadt@


Revision tags: OPENBSD_4_1_BASE OPENBSD_4_2_BASE OPENBSD_4_3_BASE
# 1.59 20-Dec-2006 espie

zap bogus sentinel, as noticed by dasn.
okay theo


Revision tags: OPENBSD_4_0_BASE
# 1.58 28-Aug-2006 espie

zap argument name, okay millert@


Revision tags: OPENBSD_3_9_BASE
# 1.57 13-Dec-2005 millert

First step in include files overhaul. Use __FOO_VISIBLE (as defined
in sys/cdefs.h) instead of _FOO_SOURCE. Also fix several namespace
pollution issues, including the byte order defines. OK deraadt@


# 1.56 24-Nov-2005 deraadt

undelete died a while back; millert ok


# 1.55 21-Nov-2005 millert

Move contents of sys/select.h to sys/selinfo.h in preparation for a
userland-visible sys/select.h. Consistent with what Net and Free do.
OK deraadt@, tested with full ports build by naddy@.


# 1.54 20-Nov-2005 millert

brk() and sbrk() should use void *, not char *. Note that sbrk()
should take intptr_t, not int, but we don't presently have intptr_t
available from unistd.h. OK marco@


Revision tags: OPENBSD_3_8_BASE
# 1.53 27-May-2005 millert

mktemp(3) et al. go in stdlib.h, not unistd.h. While there be more
explicit about mktemp(3) in the man page.


Revision tags: OPENBSD_3_5_BASE OPENBSD_3_6_BASE OPENBSD_3_7_BASE
# 1.52 13-Jan-2004 millert

Prototype closefrom(); tedu@ OK


Revision tags: OPENBSD_3_4_BASE
# 1.51 07-Aug-2003 deraadt

des_cipher 3rd param is int32_t not long


# 1.50 01-Aug-2003 avsm

add __bounded__ attributes for userland headers; enabled with -Wbounded
ok deraadt@


# 1.49 26-Jun-2003 avsm

backout the __bounded__ attributes for a while; requested by deraadt@


# 1.48 26-Jun-2003 avsm

Mark various standard library functions with the __bounded__ attribute.
You must have an up-to-date gcc for this!
deraadt@ ok


# 1.47 02-Jun-2003 millert

Remove the advertising clause in the UCB license which Berkeley
rescinded 22 July 1999. Proofed by myself and Theo.


# 1.46 10-May-2003 miod

Do not let userland access the swapon system call anymore (nothing uses it
anyway).
ok deraadt@ weingart@


Revision tags: OPENBSD_3_3_BASE
# 1.45 03-Dec-2002 millert

GNU-like getopt_long() from NetBSD with changes by me to support
getopt_long_only(). At some point this should replace the BSD
getopt(3) but we are not there yet.

While I am here add protection from the multiple getopt() definitions
due to conflicting standards.


# 1.44 30-Oct-2002 millert

Add [gs]etres[ug]id(2) syscall to libc and use it in emulating some 4.3BSD
functions.


# 1.43 25-Oct-2002 millert

NULL is now 0L so it is the same size as a pointer.
OK mickey@ and discussed with deraadt@


Revision tags: OPENBSD_3_2_BASE
# 1.42 17-Sep-2002 deraadt

uncommit, since it breaks macppc libc. millert and miod have now said they
did NOT approve those for commit. why did mickey feel he was ok to go
commiting a set of diffs which had not been passed around and tested by people?
we don't know. mickey, have you got something to say for yourself?


# 1.41 17-Sep-2002 mickey

move __syscall prototype into unistd.h (like everybody else) and avoid private protos for it everywhere; millert@ ok


# 1.40 30-Aug-2002 espie

Put sentinel back in.


# 1.39 07-Jun-2002 miod

Backout previous change. Since it requires people to upgrade gcc, we want
to give them a larger timeslot to do that.
Requested by deraadt@ and various people on icb or vocally.


# 1.38 05-Jun-2002 espie

Use attribute((sentinel)) on functions where it makes sense.
(this will warn if they are used without a terminating NULL pointer.
Note *pointer*, very useful for arches where 0 != (void *)0, in size)

okay millert@


Revision tags: OPENBSD_3_1_BASE
# 1.37 17-Feb-2002 millert

Manual cleanup of remaining userland __P use (excluding packages maintained outside the tree)


# 1.36 16-Feb-2002 millert

Part one of userland __P removal. Done with a simple regexp with some minor hand editing to make comments line up correctly. Another pass is forthcoming that handles the cases that could not be done automatically.


Revision tags: OPENBSD_3_0_BASE
# 1.35 07-Aug-2001 millert

remove redundant __noreturn__ attributes now that __dead is sane for modern gcc


Revision tags: OPENBSD_2_9_BASE
# 1.34 06-Dec-2000 deraadt

use __x__ formats for __attribute__ arguments; guenther@gac.edu


Revision tags: OPENBSD_2_8_BASE
# 1.33 12-Sep-2000 millert

o add missing getsid() prototype
o fix typo in getsid() that broke getsid(pid) where pid != 0
o cause getsid() and getpgid() to return EPERM if requesting the
id of a session/process group not in the current session
o check for NULL session in getsid() for exiting processes


# 1.32 19-Jul-2000 mickey

from freebsd:
strtofflags/fflagstostr to convert file flags
to/from binary from/into a string as used in chflags(1).

use u_int32_t instead of u_long (as freebsd does).
increase libc minor.
millert@ ok.


Revision tags: OPENBSD_2_7_BASE
# 1.31 20-Apr-2000 deraadt

prototyping for p{read,write}{,v}


# 1.30 19-Feb-2000 deraadt

swapctl 2nd arg is const


# 1.29 27-Jan-2000 itojun

add IPv6-ready rcmd() friends.
rcmd(): IPv4 only
rcmd_af(): af independent
ruserok(): af independent
iruserok(): IPv4 only
iruserok_sa(): af independent


# 1.28 16-Dec-1999 deraadt

rresvport_af() and bindresvport_af()


Revision tags: OPENBSD_2_6_BASE
# 1.27 17-Sep-1999 espie

Be thorough about NULL as __null for C++.


# 1.26 11-Jun-1999 espie

Define NULL to be __null for C++: better quality of implementation.
__null is a magic constant of integral type that converts to a null pointer
as should be, but warns for ambiguity when used to resolved an overload
between an integral type and a pointer type.


# 1.25 22-May-1999 weingart

Add swapctl(2) prototype.


Revision tags: OPENBSD_2_5_BASE
# 1.24 20-Nov-1998 d

Add thread-safety to libc, so that libc_r will build (on i386 at least).
All POSIX libc api now there (to P1003.1c/D10)
(more md stuff is needed for other libc/arch/*)
(setlogin is no longer a special syscall)
Add -pthread option to gcc (that makes it use -lc_r and -D_POSIX_THREADS).
Doc some re-entrant routines
Add libc_r to intro(3)
dig() uses some libc srcs and an extra -I was needed there.
Add more md stuff to libc_r.
Update includes for the pthreads api
Update libc_r TODO


# 1.23 19-Nov-1998 deraadt

add getpgid() proto; form


Revision tags: OPENBSD_2_4_BASE
# 1.22 30-Jun-1998 deraadt

add mkstemp(char *template, int suffixlen) interface


# 1.21 13-May-1998 deraadt

change size parameter to size_t


# 1.20 25-Apr-1998 deraadt

readlink() 3rd param is size_t; XPG


Revision tags: OPENBSD_2_3_BASE
# 1.19 16-Feb-1998 deraadt

be more careful for _XOPEN_SOURCE


# 1.18 10-Feb-1998 deraadt

more explicit protos


# 1.17 10-Feb-1998 deraadt

move proto to unistd.h


# 1.16 27-Dec-1997 tholo

Make usleep prototype match manual page and implementation


# 1.15 22-Dec-1997 deraadt

add XPG4.2 lockf; kleink


# 1.14 16-Nov-1997 deraadt

move proto to sys/stat.h; XPG4.2


Revision tags: OPENBSD_2_2_BASE
# 1.13 20-Jun-1997 millert

Add mkdtemp(3)


Revision tags: OPENBSD_2_1_BASE
# 1.12 26-Jan-1997 downsj

Add lchown() declaration.


# 1.11 13-Dec-1996 deraadt

fix comments regarding {*path,sys}conf()


# 1.10 12-Dec-1996 deraadt

add quotactl


# 1.9 09-Dec-1996 deraadt

proto getgrouplist()


Revision tags: OPENBSD_2_0_BASE
# 1.8 25-Aug-1996 deraadt

+issetugid


# 1.7 22-Aug-1996 millert

Adds rcmdsh() prototype.


# 1.6 10-Jun-1996 deraadt

iruserok() can finally safely use a u_int32_t for the ip addr


# 1.5 25-Mar-1996 tholo

initgroups(3) 2nd argument should be gid_t


# 1.4 22-Mar-1996 tholo

sethostid() actually do return a value


# 1.3 12-Jan-1996 deraadt

proto rfork()


# 1.2 14-Dec-1995 deraadt

from netbsd; profil() fixed for 64 bit


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.105 12-Dec-2017 deraadt

pledge()'s 2nd argument becomes char *execpromises, which becomes the
pledge for a new execve image immediately upon start. Also introduces
"error" which makes violations return -1 ENOSYS instead of killing the
program ("error" may not be handed to a setuid/setgid program, which
may be missing/ignoring syscall return values and would continue with
inconsistant state)
Discussion with many
florian has used this to improve the strictness of a daemon


Revision tags: OPENBSD_6_1_BASE OPENBSD_6_2_BASE
# 1.104 09-Mar-2017 fcambus

As per style.9, prototypes should not have variable names associated
with the types.

OK jca@


# 1.103 12-Sep-2016 guenther

Don't declare select() in <unistd.h>

ok deraadt@ millert@


# 1.102 09-Sep-2016 millert

Move the 10 (!) defintions of NULL to their own mini header file and
update the NULL definition for C++11. OK deraadt@ guenther@ kettenis@


Revision tags: OPENBSD_6_0_BASE
# 1.101 23-May-2016 guenther

Remove iruserok(_sa)? and __ivaliduser(sa)?

ok millert@ deraadt@


Revision tags: OPENBSD_5_9_BASE
# 1.100 09-Oct-2015 deraadt

tame -> pledge.


# 1.99 09-Sep-2015 deraadt

Move to next tame() API. The flags are now passed as a very simple string,
which results in tame() code placements being much more recognizeable.
tame() can be moved to unistd.h and does not need cpp symbols to turn the
bits on and off. The resulting API is a bit unexpected, but simplifies the
mapping to enabling bits in the kernel substantially.
vague ok's from various including guenther doug semarie


# 1.98 26-Aug-2015 guenther

Hide many (194!) symbols that nothing should be using.
Delete exect(2); it wasn't portable across archs and nothing used it.

ports test build by naddy@
ok deraadt@ kettenis@


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.97 13-Dec-2014 tedu

claim posix 2008 compat. apparently people look at this and get scared
when it's really old. but no actual ports fallout in espie's build.
ok deraadt


# 1.96 11-Dec-2014 tedu

update swab() to match the current posix definition. "rationale: none."
rewrite the function to be simpler as well. the compiler can unroll the
loop for us if necessary.
ok schwarze


# 1.95 08-Dec-2014 tedu

header changes for recent libc changes:
add siphash
delete setkey, encrypt, cfree


# 1.94 21-Nov-2014 tedu

change prototype for crypt_newhash. the login_cap_t is a holdover from its
pwd_gensalt origins, but a string argument works equally work and is more
friendly to consumers beyond local user accounts.
ok deraadt


# 1.93 18-Sep-2014 guenther

Our setpgrp() is the BSD version with two args and not the XSI
version with zero args, so it should only be visible if __BSD_VISIBLE
(and not also for __XPG_VISIBLE). Contrawise, readlink() has been
part of base POSIX since 1995, so move to proper #if area for that.
Move crypt_checkpass() to the pure-BSD section of the file.

setpgrp() issue noted by Matti Karnaattu (mkarnaattu (at) gmail.com)
ok millert@


# 1.92 01-Sep-2014 doug

Sync readlink(2) with IEEE Std 1003.1-2008.

discussion, help and ok guenther@


# 1.91 31-Aug-2014 guenther

Declare and document getthrid()

indirectly prodded by krw@


# 1.90 31-Aug-2014 guenther

Add additional kernel interfaces for setting close-on-exec on fds
when creating them: pipe2(), dup3(), accept4(), MSG_CMSG_CLOEXEC,
SOCK_CLOEXEC. Includes SOCK_NONBLOCK support.

ok matthew@


Revision tags: OPENBSD_5_6_BASE
# 1.89 08-Jul-2014 tedu

update _POSIX2_FORT_RUN, so that sysconf(_SC_2_FORT_RUN) remains correct.
because you care. reminded by matthew.


# 1.88 14-Jun-2014 deraadt

Change return value of getentropy() to int 0 for success. Maximum
buffersize is enforced strictly, this supplies sufficient entropy
payload to act as seed material. Discourage general use of this
API, but lock down this function name as the go-to for userland
PRNG seeding. Improve documentation.
ok miod matthew


# 1.87 13-Jun-2014 deraadt

Add new getentropy() system call. Code and pressure from matthew.
I accepted that he's right (again) to seperate this out from heavy
sysctl API and this will simply a variety of things. Functionname
is not used by anyone in the ports tree, so we guess we can use it.
Shocking that no application has a function called this.
ok matthew & others who pushed him to start this early on


# 1.86 16-May-2014 tedu

add prototypes for new crypt functions


# 1.85 21-Apr-2014 guenther

Use internal '__' names for __attributes__ in public headers


# 1.84 01-Apr-2014 matthew

Define intptr_t in <unistd.h> as specified by POSIX

ok millert


Revision tags: OPENBSD_5_5_BASE
# 1.83 28-Dec-2013 martynas

Annotate a few more bounded functions: realpath(3) needs a buffer
of size at least PATH_MAX. pread(2), pwrite(2) and readlinkat(2)
also take the buffer and the bound. OK theo.


# 1.82 04-Dec-2013 deraadt

express final disapproval of the interfaces in libcompat, such as
them ftime(), gtty(), stty(), re_comp(), cuserid() and others.
Discussion and ongoing work to fix the ports tree from many, especially
naddy.
ok naddy
[There is a bit more cleanup possible after that, but this is considered
the current safe step]


# 1.81 22-Nov-2013 millert

The getopt() prototype and externs don't belong in stdlib.h. Berkeley
moved them to unistd.h to match POSIX in 1995 but we never did.
The exception to this is getsubopt() which POSIX says should be in
stdlib.h. The non-standard suboptarg extern remains in the BSD-only
section of stdlib.h. Neither getsubopt() nor suboptarg belong in
unistd.h or getopt.h. They were only there to allow us to protect
all the getopt() bits from being multiply defined. OK guenther@


# 1.80 24-Oct-2013 guenther

Align suseconds_t with POSIX: it's the type of the tv_usec member of timeval.
Use useconds_t in the ualarm() declaration.
Bump libstdc++ major to be sure there isn't ABI issues.

ok deraadt@ jca@ jmc@ millert@
ports testing by landry@


Revision tags: OPENBSD_5_4_BASE
# 1.79 17-Jun-2013 guenther

Add support for the _POSIX_CPUTIME and _POSIX_THREAD_CPUTIME options,
including CLOCK_{PROCESS,THREAD}_CPUTIME_ID constants and
{clock,pthread}_getcpuclockid() functions.

Worked out at t2k13 with help from tedu@ and matthew@ and testing by aja@
ok matthew@


# 1.78 04-Jun-2013 brad

Enable the _POSIX_SHARED_MEMORY_OBJECTS option group now that we have shm_open / shm_unlink.

ok guenther@


# 1.77 15-Apr-2013 matthew

Implement fdatasync() as a wrapper around fsync()

ok guenther, deraadt, jmc


# 1.76 11-Apr-2013 guenther

getpgid() and getsid() were rolled into POSIX in 2008

ok millert@


# 1.75 01-Mar-2013 guenther

Adds the (somewhat silly) _CS_V[67]_ENV and _CS_POSIX_V[67]_* defines
to <unistd.h> and confstr(3) per POSIX 1003.1-2008

Change confstr(_CS_PATH) to operate directly instead of calling sysctl(3)

ports build tested by espie@


Revision tags: OPENBSD_5_3_BASE
# 1.74 05-Dec-2012 deraadt

Remove excessive sys/cdefs.h inclusion
ok guenther millert kettenis


Revision tags: OPENBSD_5_2_BASE
# 1.73 21-Jun-2012 guenther

__tfork() needs to set the stack address of the new thread in the kernel,
so that it can't get a signal while still running on the parent thread's
stack. Also, pass in sizeof(struct __tfork) to provide forward compat
when more members are added. This is an ABI change, so switch syscall
numbers and bump lib majors this time.

ok deraadt@ matthew@


# 1.72 30-May-2012 matthew

Move the _SC_* and _CS_* configurable system variables and strings
from sys/unistd.h to unistd.h.

From Brad; ok millert and me


# 1.71 14-May-2012 matthew

More sysconf(3)-y and pathconf(3)-y goodness from Brad.
ok guenther, millert (and me); bulk build test by naddy


# 1.70 12-Apr-2012 deraadt

remove rfork(); ok guenther miod


# 1.69 12-Apr-2012 deraadt

prototype getdtablecount()


# 1.68 21-Mar-2012 matthew

Implement execvpe(3) and posix_spawn(3) and family. Based on
FreeBSD's implementation via Frank Denis, with various cleanups and
tweaks by me.

ok deraadt@, guenther@; discussions and tweaks from many others
jmc@ promises to help me further with the man pages in tree


Revision tags: OPENBSD_5_1_BASE
# 1.67 13-Jan-2012 nigel

Replace _SELECT_DECLARED with _SELECT_DEFINED_

Ok sthen@, millert@, dcoppa@


# 1.66 09-Nov-2011 fgsch

getcwd() buffer's length can be smaller than 1024. In that case it will
fail with errno set to ERANGE if not enough room is provided. Similar for
getlogin_r() so remove minbytes enforcement attribute.
ok kettenis@ guenther@ deraadt@ on getcwd, deraadt@ on getlogin_r.


Revision tags: OPENBSD_5_0_BASE
# 1.65 18-Jul-2011 matthew

Expose a bunch of new functionality from POSIX 2008: openat(2),
fchmodat(2), fstatat(2), mkdirat(2), mkfifoat(2), mknodat(2),
faccessat(2), fchownat(2), linkat(2), readlinkat(2), renameat(2),
symlinkat(2), unlinkat(2), utimensat(2), futimens(2), and
fdopendir(3).

"Minor" libc bump.

Tested in a bulk build by naddy@
Much help from guenther@, thib@, tedu@, oga@, and others.
ok deraadt@, naddy@


# 1.64 03-Jul-2011 jsg

As pointed out by Richard Guenther our definition
of NULL was incorrect for c++ compilers that aren't
gcc (or pretend to be gcc like clang).

ok miod@


# 1.63 06-Apr-2011 miod

Define NULL as a void * instead of a long integer, as required by Single Unix.
Kernel and bootblocks still use the old 0L value until all the NULL abuses
in the code are fixed.


Revision tags: OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE
# 1.62 25-Jun-2008 millert

Move _POSIX_THREAD_SAFE_FUNCTIONS into unistd.h and set it to 200112
now that we support all the _r functions required by POSIX 1003.1-2001.
Also define _POSIX_REENTRANT_FUNCTIONS. OK kurt@ deraadt@


# 1.61 29-Apr-2008 kurt

Remove duplicate psignal(3) and sys_siglist definitions. signal.h
is the correct place for them and nothing gets them from here in
base/xenocara/ports. no objection millert@ okay kettenis@


# 1.60 24-Apr-2008 kurt

- correct brk(2) prototype and man page to match implementation and POSIX.
brk(2) returns an int value not a void *. brk(2) returns 0 upon success not
a pointer to the new end of memory. okay millert@, kettenis@, deraadt@


Revision tags: OPENBSD_4_1_BASE OPENBSD_4_2_BASE OPENBSD_4_3_BASE
# 1.59 20-Dec-2006 espie

zap bogus sentinel, as noticed by dasn.
okay theo


Revision tags: OPENBSD_4_0_BASE
# 1.58 28-Aug-2006 espie

zap argument name, okay millert@


Revision tags: OPENBSD_3_9_BASE
# 1.57 13-Dec-2005 millert

First step in include files overhaul. Use __FOO_VISIBLE (as defined
in sys/cdefs.h) instead of _FOO_SOURCE. Also fix several namespace
pollution issues, including the byte order defines. OK deraadt@


# 1.56 24-Nov-2005 deraadt

undelete died a while back; millert ok


# 1.55 21-Nov-2005 millert

Move contents of sys/select.h to sys/selinfo.h in preparation for a
userland-visible sys/select.h. Consistent with what Net and Free do.
OK deraadt@, tested with full ports build by naddy@.


# 1.54 20-Nov-2005 millert

brk() and sbrk() should use void *, not char *. Note that sbrk()
should take intptr_t, not int, but we don't presently have intptr_t
available from unistd.h. OK marco@


Revision tags: OPENBSD_3_8_BASE
# 1.53 27-May-2005 millert

mktemp(3) et al. go in stdlib.h, not unistd.h. While there be more
explicit about mktemp(3) in the man page.


Revision tags: OPENBSD_3_5_BASE OPENBSD_3_6_BASE OPENBSD_3_7_BASE
# 1.52 13-Jan-2004 millert

Prototype closefrom(); tedu@ OK


Revision tags: OPENBSD_3_4_BASE
# 1.51 07-Aug-2003 deraadt

des_cipher 3rd param is int32_t not long


# 1.50 01-Aug-2003 avsm

add __bounded__ attributes for userland headers; enabled with -Wbounded
ok deraadt@


# 1.49 26-Jun-2003 avsm

backout the __bounded__ attributes for a while; requested by deraadt@


# 1.48 26-Jun-2003 avsm

Mark various standard library functions with the __bounded__ attribute.
You must have an up-to-date gcc for this!
deraadt@ ok


# 1.47 02-Jun-2003 millert

Remove the advertising clause in the UCB license which Berkeley
rescinded 22 July 1999. Proofed by myself and Theo.


# 1.46 10-May-2003 miod

Do not let userland access the swapon system call anymore (nothing uses it
anyway).
ok deraadt@ weingart@


Revision tags: OPENBSD_3_3_BASE
# 1.45 03-Dec-2002 millert

GNU-like getopt_long() from NetBSD with changes by me to support
getopt_long_only(). At some point this should replace the BSD
getopt(3) but we are not there yet.

While I am here add protection from the multiple getopt() definitions
due to conflicting standards.


# 1.44 30-Oct-2002 millert

Add [gs]etres[ug]id(2) syscall to libc and use it in emulating some 4.3BSD
functions.


# 1.43 25-Oct-2002 millert

NULL is now 0L so it is the same size as a pointer.
OK mickey@ and discussed with deraadt@


Revision tags: OPENBSD_3_2_BASE
# 1.42 17-Sep-2002 deraadt

uncommit, since it breaks macppc libc. millert and miod have now said they
did NOT approve those for commit. why did mickey feel he was ok to go
commiting a set of diffs which had not been passed around and tested by people?
we don't know. mickey, have you got something to say for yourself?


# 1.41 17-Sep-2002 mickey

move __syscall prototype into unistd.h (like everybody else) and avoid private protos for it everywhere; millert@ ok


# 1.40 30-Aug-2002 espie

Put sentinel back in.


# 1.39 07-Jun-2002 miod

Backout previous change. Since it requires people to upgrade gcc, we want
to give them a larger timeslot to do that.
Requested by deraadt@ and various people on icb or vocally.


# 1.38 05-Jun-2002 espie

Use attribute((sentinel)) on functions where it makes sense.
(this will warn if they are used without a terminating NULL pointer.
Note *pointer*, very useful for arches where 0 != (void *)0, in size)

okay millert@


Revision tags: OPENBSD_3_1_BASE
# 1.37 17-Feb-2002 millert

Manual cleanup of remaining userland __P use (excluding packages maintained outside the tree)


# 1.36 16-Feb-2002 millert

Part one of userland __P removal. Done with a simple regexp with some minor hand editing to make comments line up correctly. Another pass is forthcoming that handles the cases that could not be done automatically.


Revision tags: OPENBSD_3_0_BASE
# 1.35 07-Aug-2001 millert

remove redundant __noreturn__ attributes now that __dead is sane for modern gcc


Revision tags: OPENBSD_2_9_BASE
# 1.34 06-Dec-2000 deraadt

use __x__ formats for __attribute__ arguments; guenther@gac.edu


Revision tags: OPENBSD_2_8_BASE
# 1.33 12-Sep-2000 millert

o add missing getsid() prototype
o fix typo in getsid() that broke getsid(pid) where pid != 0
o cause getsid() and getpgid() to return EPERM if requesting the
id of a session/process group not in the current session
o check for NULL session in getsid() for exiting processes


# 1.32 19-Jul-2000 mickey

from freebsd:
strtofflags/fflagstostr to convert file flags
to/from binary from/into a string as used in chflags(1).

use u_int32_t instead of u_long (as freebsd does).
increase libc minor.
millert@ ok.


Revision tags: OPENBSD_2_7_BASE
# 1.31 20-Apr-2000 deraadt

prototyping for p{read,write}{,v}


# 1.30 19-Feb-2000 deraadt

swapctl 2nd arg is const


# 1.29 27-Jan-2000 itojun

add IPv6-ready rcmd() friends.
rcmd(): IPv4 only
rcmd_af(): af independent
ruserok(): af independent
iruserok(): IPv4 only
iruserok_sa(): af independent


# 1.28 16-Dec-1999 deraadt

rresvport_af() and bindresvport_af()


Revision tags: OPENBSD_2_6_BASE
# 1.27 17-Sep-1999 espie

Be thorough about NULL as __null for C++.


# 1.26 11-Jun-1999 espie

Define NULL to be __null for C++: better quality of implementation.
__null is a magic constant of integral type that converts to a null pointer
as should be, but warns for ambiguity when used to resolved an overload
between an integral type and a pointer type.


# 1.25 22-May-1999 weingart

Add swapctl(2) prototype.


Revision tags: OPENBSD_2_5_BASE
# 1.24 20-Nov-1998 d

Add thread-safety to libc, so that libc_r will build (on i386 at least).
All POSIX libc api now there (to P1003.1c/D10)
(more md stuff is needed for other libc/arch/*)
(setlogin is no longer a special syscall)
Add -pthread option to gcc (that makes it use -lc_r and -D_POSIX_THREADS).
Doc some re-entrant routines
Add libc_r to intro(3)
dig() uses some libc srcs and an extra -I was needed there.
Add more md stuff to libc_r.
Update includes for the pthreads api
Update libc_r TODO


# 1.23 19-Nov-1998 deraadt

add getpgid() proto; form


Revision tags: OPENBSD_2_4_BASE
# 1.22 30-Jun-1998 deraadt

add mkstemp(char *template, int suffixlen) interface


# 1.21 13-May-1998 deraadt

change size parameter to size_t


# 1.20 25-Apr-1998 deraadt

readlink() 3rd param is size_t; XPG


Revision tags: OPENBSD_2_3_BASE
# 1.19 16-Feb-1998 deraadt

be more careful for _XOPEN_SOURCE


# 1.18 10-Feb-1998 deraadt

more explicit protos


# 1.17 10-Feb-1998 deraadt

move proto to unistd.h


# 1.16 27-Dec-1997 tholo

Make usleep prototype match manual page and implementation


# 1.15 22-Dec-1997 deraadt

add XPG4.2 lockf; kleink


# 1.14 16-Nov-1997 deraadt

move proto to sys/stat.h; XPG4.2


Revision tags: OPENBSD_2_2_BASE
# 1.13 20-Jun-1997 millert

Add mkdtemp(3)


Revision tags: OPENBSD_2_1_BASE
# 1.12 26-Jan-1997 downsj

Add lchown() declaration.


# 1.11 13-Dec-1996 deraadt

fix comments regarding {*path,sys}conf()


# 1.10 12-Dec-1996 deraadt

add quotactl


# 1.9 09-Dec-1996 deraadt

proto getgrouplist()


Revision tags: OPENBSD_2_0_BASE
# 1.8 25-Aug-1996 deraadt

+issetugid


# 1.7 22-Aug-1996 millert

Adds rcmdsh() prototype.


# 1.6 10-Jun-1996 deraadt

iruserok() can finally safely use a u_int32_t for the ip addr


# 1.5 25-Mar-1996 tholo

initgroups(3) 2nd argument should be gid_t


# 1.4 22-Mar-1996 tholo

sethostid() actually do return a value


# 1.3 12-Jan-1996 deraadt

proto rfork()


# 1.2 14-Dec-1995 deraadt

from netbsd; profil() fixed for 64 bit


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision