History log of /openbsd-current/lib/libc/sys/Makefile.inc
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.179 18-May-2024 guenther

Add pathconfat(2): pathconf(2) but with at-fd and flags arguments,
the latter supporting the ability to get timestamp resolution of
symlinks.

ok deraadt@ millert@


# 1.178 29-Mar-2024 deraadt

the msyscall(2) manual page can be deleted.
Also, the details described in sigaltstack(2) are no longer true.
ok jmc


Revision tags: OPENBSD_7_5_BASE
# 1.177 19-Jan-2024 deraadt

Stop initializing pinsyscall(SYS_execve in static binaries that contain
an execve(2) stub. The new pinsyscalls(2) that applies to all system
calls has made this redundant.


# 1.176 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


# 1.175 11-Dec-2023 deraadt

document upcoming pinsyscalls(2) system call
ok kettenis, some tweaks from jmc


Revision tags: OPENBSD_7_4_BASE
# 1.174 20-Aug-2023 visa

Add syscall stub for kqueue1(2)

This rides previous libc minor bump.

Feedback and OK guenther@


Revision tags: OPENBSD_7_3_BASE
# 1.173 27-Feb-2023 deraadt

Calculate the size of the static (and profiled static) execve syscall stub
and store it in a const variable for use by crt0.
help from kettenis and miod


# 1.172 21-Feb-2023 deraadt

create a stub for pinsyscall(2)
ok guenther


# 1.171 16-Feb-2023 deraadt

Document pinsyscall(2). The ld.so and kernel enforcement code is not
commited ye -- waiting for enough people to run kernels which support
the system call.
ok jmc


# 1.170 11-Feb-2023 deraadt

__syscall() is no longer neccessary since the system calls which needed
it are now unpadded
ok kettenis guenther


# 1.169 08-Jan-2023 guenther

Add getthrname(2) manpage

ok jmc@ schwarze@


# 1.168 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@


# 1.167 19-Dec-2022 guenther

Add waitid(2) manpage, based on a first pass by espie@ and bits
from FreeBSD and NetBSD.

ok kettenis@ jmc@ espie@


# 1.166 26-Oct-2022 kettenis

Add waitid(2) syscall stub.

Minor bump to both libc and libpthread: make sure you install a new kernel!

ok millert@, deraadt@


# 1.165 07-Oct-2022 deraadt

Add mimmutable(2) libc stub, add & adjust manual pages, and crank the minor.
ok kettenis


Revision tags: OPENBSD_7_2_BASE
# 1.164 09-Sep-2022 mbuhl

Add libc wrappers for the new sendmmsg and recvmmsg system calls.
Feedback tb@, miod@, jca@
OK jca@


# 1.163 17-Jul-2022 deraadt

Add ypconnect(2) stub inside libc so that libc functions can use it,
but do not export it.


# 1.162 17-Jul-2022 deraadt

add ypconnect(2) manual page


Revision tags: OPENBSD_7_1_BASE
# 1.161 23-Dec-2021 guenther

Roll the syscalls that have an off_t argument to remove the explicit padding.
Switch libc and ld.so to the generic stubs for these calls.
WARNING: reboot to updated kernel before installing libc or ld.so!

Time for a story...

When gcc (back in 1.x days) first implemented long long, it didn't (always)
pass 64bit arguments in 'aligned' registers/stack slots, with the result that
argument offsets didn't match structure offsets. This affected the nine system
calls that pass off_t arguments:
ftruncate lseek mmap mquery pread preadv pwrite pwritev truncate

To avoid having to do custom ASM wrappers for those, BSD put an explicit pad
argument in so that the off_t argument would always start on a even slot and
thus be naturally aligned. Thus those odd wrappers in lib/libc/sys/ that use
__syscall() and pass an extra '0' argument.

The ABIs for different CPUs eventually settled how things should be passed on
each and gcc 2.x followed them. The only arch now where it helps is landisk,
which needs to skip the last argument register if it would be the first half of
a 64bit argument. So: add new syscalls without the pad argument and on landisk
do that skipping directly in the syscall handler in the kernel. Keep compat
support for the existing syscalls long enough for the transition.

ok deraadt@


Revision tags: OPENBSD_7_0_BASE
# 1.160 11-Jun-2021 kettenis

Since futex(2) can fail, it needs a full syscall stub. This should fixes
issues on powerpc64 and sparc64.

Note that this makes the lib/libpthread/errno test fail since that test
detects that we are touching errno now. This will be addressed in a
future diff as it is not entirely clear whether the test is correct.

ok mpi@, bluhm@


Revision tags: OPENBSD_6_8_BASE OPENBSD_6_9_BASE
# 1.159 06-Jul-2020 pirofti

Add support for timeconting in userland.

This diff exposes parts of clock_gettime(2) and gettimeofday(2) to
userland via libc eliberating processes from the need for a context
switch everytime they want to count the passage of time.

If a timecounter clock can be exposed to userland than it needs to set
its tc_user member to a non-zero value. Tested with one or multiple
counters per architecture.

The timing data is shared through a pointer found in the new ELF
auxiliary vector AUX_openbsd_timekeep containing timehands information
that is frequently updated by the kernel.

Timing differences between the last kernel update and the current time
are adjusted in userland by the tc_get_timecount() function inside the
MD usertc.c file.

This permits a much more responsive environment, quite visible in
browsers, office programs and gaming (apparently one is are able to fly
in Minecraft now).

Tested by robert@, sthen@, naddy@, kmos@, phessler@, and many others!

OK from at least kettenis@, cheloha@, naddy@, sthen@


Revision tags: OPENBSD_6_7_BASE
# 1.158 27-Nov-2019 deraadt

Document msyscall(2): ld.so can use this (once only) to tell the kernel
where libc.so's text segment is, thereby allowing invocation of system
calls from that region. An upcoming change will kill the process if a
system call is invoked from addresses not explicitly permitted.
ok guenther kettenis mortimer


Revision tags: OPENBSD_6_6_BASE
# 1.157 28-May-2019 beck

Enable the use of the kernel __realpath() system call in the libc wrapper.

For now, this also still uses the existing realpath implmentation
and emits a syslog if we see differening results. Once we have run
with that for a little while we will remove the old code

ok deraadt@


Revision tags: OPENBSD_6_5_BASE
# 1.156 11-Jan-2019 deraadt

mincore() is a relic from the past, exposing physical machine information
about shared resources which no program should see. only a few pieces of
software use it, generally poorly thought out. they are being fixed, so
mincore() can be deleted.
ok guenther tedu jca sthen, others


Revision tags: OPENBSD_6_4_BASE
# 1.155 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.154 12-Jan-2018 deraadt

sysctl(3) can now be renamed to sysctl(2)


# 1.153 28-Nov-2017 guenther

Delete fktrace(2). The consequences of it were not thought through
sufficiently and at least one horrific security hole was the result.

ok deraadt@ beck@


Revision tags: OPENBSD_6_2_BASE
# 1.152 13-Aug-2017 tedu

add fktrace to libc


# 1.151 12-Aug-2017 guenther

Instead of hardcoding a partial dependency list for the syscall stub objects,
calculate them as done for other objects


# 1.150 31-May-2017 sthen

install futex(2), ok mpi


# 1.149 30-Apr-2017 mpi

Add futex(2) shim, bump minor.

Inputs from guenther@, ok kettenis@, visa@


Revision tags: OPENBSD_6_1_BASE
# 1.148 29-Mar-2017 deraadt

The hppa version of as(1) requires whitespace before a .file directive,
it may not be in column 0. This kind of thing is very common in GNU
and Linux software because the software was written from the start to
be 'compatible replacements' of vendor software.
ok jsing guenther


# 1.147 26-Mar-2017 guenther

Use .file to convince 'as' to generate proper FILE symbols in the syscall
stubs that aren't actually in files, so that syspatch can figure out what
order the syscall stub objects are in the .so. Use -P to suppress to #line
directives that would override that. Tested with both gcc/gas and clang.

ok deraadt@


Revision tags: OPENBSD_6_0_BASE
# 1.146 04-Jul-2016 guenther

DEBUGLIBS has been broken since the gcc4 switch, so delete it. CFLAGS
contains -g by default anyway

problem noted by Edgar Pettijohn (edgar (at) pettijohn-web.com)
ok millert@ kettenis@ deraadt@


# 1.145 30-May-2016 guenther

Move __getcwd from ASM to HIDDEN: we don't want the literal __getcwd symbol

ok millert@ deraadt@


# 1.144 19-May-2016 guenther

Add ASM_NOERR for syscalls that never fail and thus don't need the errno
setting logic...which can significantly reduce the size of the stub on
some archs; 20 syscalls get a trim with this.

in snaps for a bit and ok deraadt@


# 1.143 09-May-2016 guenther

Remove sigreturn declaration and the now-unused libc syscall stub


# 1.142 07-May-2016 guenther

Use a Thread Information Block in both single and multi-threaded programs.
This stores errno, the cancelation flags, and related bits for each thread
and is allocated by ld.so or libc.a. This is an ABI break from 5.9-stable!

Make libpthread dlopen'able by moving the cancelation wrappers into libc
and doing locking and fork/errno handling via callbacks that libpthread
registers when it first initializes. 'errno' *must* be declared via
<errno.h> now!

Clean up libpthread's symbol exports like libc.

On powerpc, offset the TIB/TCB/TLS data from the register per the ELF spec.

Testing by various, particularly sthen@ and patrick@
ok kettenis@


# 1.141 30-Mar-2016 guenther

Turd polish: use HIDDEN= instead of PSEUDO= for ptrace syscall stub, to
make its underlying symbol name look like others.


# 1.140 30-Mar-2016 guenther

Eliminate userspace caching by getlogin_r/setlogin; make the getlogin
syscall behave exactly like userspace getlogin_r() and rename it to
match. Eliminate the reduced-to-no-op wrappers of the syscalls.
Eliminate the unnecessary per-thread static buffering by getlogin().

ok kettenis@ deraadt@


# 1.139 30-Mar-2016 jmc

for some time now mandoc has not required MLINKS to function
correctly - logically complete that now by removing MLINKS from base;

authors need only to ensure there is an entry in NAME for any function/
util being added. MLINKS will still work, and remain for perl to ease
upgrades;

ok nicm (curses) bcook (ssl)
ok schwarze, who provided a lot of feedback and assistance
ok tb natano jung


# 1.138 21-Mar-2016 bluhm

Rename the system call sendsyslog2 to sendsyslog. Keep the old one
as osendsyslog for a while. The three argument variant is the only
one that will stay.
input kettenis@; OK deraadt@


Revision tags: OPENBSD_5_9_BASE
# 1.137 25-Nov-2015 deraadt

Add a syscall stub for sendsyslog2(2), and use it in syslog_r(3), passing
LOG_CONS to the kernel. As a result, the /dev/console opening code can
be removed.
ok kettenis millert beck


# 1.136 10-Nov-2015 guenther

Split the intra-thread functionality from kill(2) into its own syscall
thrkill(2), rolling the kill(2) syscall number with the ABI change to
avoid breaking binaries during during the transition. thrkill(2) includes
a 'tcb' argument that eliminates the need for locking in pthread_kill()
and simplifies pthread_cancel(). Switch __stack_smash_handler() to use
thrkill(2) and explicitly unblock SIGABRT.

Minor bump to both libc and libpthread: make sure you install a new kernel!

ok semarie@


# 1.135 23-Oct-2015 guenther

Merge the sigaction() and sigprocmask() overloads/wrappers from libpthread
into libc, and move pthread_sigmask() as well (just a trivial wrapper).
This provides consistent handling of SIGTHR between single- and multi-threaded
programs and is a step in the merge of all the libpthread overloads, providing
some ASM and Makefile bits that the other wrappers will need.

ok deraadt@ millert@


# 1.134 23-Oct-2015 deraadt

Remove dnssocket() and dnsconnect(), since we decided to use a SOCK_DNS
flag instead.
ok guenther tedu semarie


# 1.133 19-Oct-2015 deraadt

Remove old tame() stub


# 1.132 18-Oct-2015 deraadt

create libc stubs for dnssocket() and dnsconnect()


# 1.131 09-Oct-2015 deraadt

tame -> pledge conversion, in libc. I should crank libc, but am cheating
hoping things go well. The old symbol is faked via a stupid stub function,
until next major crank when it can be removed. I am expecting guenther
to scream at me.


# 1.130 13-Sep-2015 guenther

Rename __sysctl syscall to just sysctl, as the userland wrapper is no longer
necessary

ok deraadt@ jsing@


# 1.129 09-Sep-2015 guenther

Simplify makefile rules for building the ASM stubs into "pick something
from column A and something from column B".

ok miod@ deraadt@


# 1.128 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@


# 1.127 25-Aug-2015 guenther

Document kbind(2)


Revision tags: OPENBSD_5_8_BASE
# 1.126 19-Jul-2015 deraadt

manual page for tame(2). not very good, so i will be hearing from jmc


# 1.125 07-Apr-2015 guenther

Make pthread_atfork() track the DSO that called it like atexit() does,
unregistering callbacks if the DSO is unloaded. Move the callback
handling from libpthread to libc, though libpthread still overrides the
inner call to handle locking and thread-library reinitialization.
Major version bump for both libc and libpthread.

verification that this fixes various ports ajacoutot@
asm assistance miod@; ok millert@ deraadt@


Revision tags: OPENBSD_5_7_BASE
# 1.124 08-Dec-2014 guenther

Add chflagsat(), modeled on fchmodat() with name to match FreeBSD.


# 1.123 14-Nov-2014 guenther

Add sched_yield(2) manpage


# 1.122 31-Aug-2014 guenther

Declare and document getthrid()

indirectly prodded by krw@


# 1.121 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@


# 1.120 14-Aug-2014 tobias

fixed overrid(d)en typo

millert@ and jmc@ agree that "overriden" is wrong


Revision tags: OPENBSD_5_6_BASE
# 1.119 12-Jul-2014 deraadt

document sendsyslog(2); ok guenther tedu matthew


# 1.118 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.117 18-Mar-2014 miod

Retire hp300, mvme68k and mvme88k ports. These ports have no users, keeping
this hardware alive is becoming increasingly difficult, and I should heed the
message sent by the three disks which have died on me over the last few days.

Noone sane will mourn these ports anyway. So long, and thanks for the fish.


Revision tags: OPENBSD_5_5_BASE
# 1.116 13-Oct-2013 guenther

Make it possible to build to reduced version of a library, including
just specific objects that are compiled with additional options to
reduce their size. For use by distrib/ and crunchgen.

style and naming assistance from espie@


# 1.115 07-Oct-2013 guenther

getdirentries(2) is dead; long live getdents(2)!

confirmation that getdirentries(2) is unused by ports from sthen@ and naddy@


# 1.114 13-Aug-2013 guenther

Switch time_t, ino_t, clock_t, and struct kevent's ident and data
members to 64bit types. Assign new syscall numbers for (almost
all) the syscalls that involve the affected types, including anything
with time_t, timeval, itimerval, timespec, rusage, dirent, stat,
or kevent arguments. Add a d_off member to struct dirent and replace
getdirentries() with getdents(), thus immensely simplifying and
accelerating telldir/seekdir. Build perl with -DBIG_TIME.

Bump the major on every single base library: the compat bits included
here are only good enough to make the transition; the T32 compat
option will be burned as soon as we've reached the new world are
are happy with the snapshots for all architectures.

DANGER: ABI incompatibility. Updating to this kernel requires extra
work or you won't be able to login: install a snapshot instead.

Much assistance in fixing userland issues from deraadt@ and tedu@
and build assistance from todd@ and otto@


Revision tags: OPENBSD_5_4_BASE
# 1.113 05-Jun-2013 guenther

Move _Exit() from the exit() manpage to the _exit() manpage, as it's
just an alias of the latter.

ok matthew@ tedu@


# 1.112 01-Jun-2013 miod

Add utrace(2), a system call allowing for userland to send its own ktrace
records. From FreeBSD via otto@, with tweaks suggested by guenther@.
Commite on behalf of otto@ who is not around, to ride the libc minor bump.
Causes a librthread minor bump as well (new syscall).


# 1.111 29-Apr-2013 matthew

Extend P_SIGSUSPEND handling in userret() to properly restore the
sigmask even if there are no pending signals under the temporary
sigmask.

Refactor existing select() and poll() system calls to introduce the
pselect() and ppoll() system calls.

Add rthread wrappers for pselect() and ppoll(). While there, update
cancellation point comments to reflect recent fdatasync() addition.

Minor bumps for libc and librthread due to new symbols.

ok guenther, millert, deraadt, jmc


# 1.110 15-Apr-2013 matthew

Implement fdatasync() as a wrapper around fsync()

ok guenther, deraadt, jmc


Revision tags: OPENBSD_5_3_BASE
# 1.109 03-Feb-2013 miod

gremlin crept in


# 1.108 02-Feb-2013 miod

Userland bits for m68k/ELF. Mostly addition of register prefixes to the
assembler instructions, and cope with the few changes in return values
location.


# 1.107 04-Sep-2012 okan

remove lint leftovers; ok guenther@


# 1.106 23-Aug-2012 deraadt

no more nnpfspioctl() system call; ok guenther


# 1.105 22-Aug-2012 pascal

Convert cpp | as rules in bsd.lib.mk and lib/libc/sys/Makefile.inc to pure cc
invocations. This allows us to use the compiler builtin define __PIC__ to check
for PIC/PIEness rather than passing -DPIC. Simplifies PIE work a lot.

ok matthew@, conceptually ok kurt@


# 1.104 21-Aug-2012 pascal

Kill an old mips workaround; we don't support mips, just mips64.

ok deraadt@ kettenis@


Revision tags: OPENBSD_5_2_BASE
# 1.103 19-Jun-2012 deraadt

oops, forgot to install getdtablecount(2); noted by tedu


# 1.102 12-Apr-2012 deraadt

remove rfork(); ok guenther miod


# 1.101 12-Apr-2012 deraadt

kill lfs system call lines and libc stubs


# 1.100 12-Apr-2012 deraadt

New system call: getdtablecount(2) returns the number of file
descriptors the process currently has open.
ok guenther miod gilles ...


# 1.99 22-Mar-2012 guenther

Move __tfork_thread() from rthreads (libpthread) to libc so that
it can be used for not-strictly-threading purposes

ok matthew@ kurt@


# 1.98 13-Mar-2012 guenther

Add manpages for __thrsigdivert, __thrsleep, and __thrwakeup. Various
syntax and grammar fixes from jmc@


Revision tags: OPENBSD_5_1_BASE
# 1.97 17-Jan-2012 guenther

Reimplement mutexes, condvars, and rwlocks to eliminate bugs,
particularly the "consume the signal you just sent" hang, and putting
the wait queues in userspace.

Do cancellation handling in pthread_cond_*wait(), pthread_join(),
and sem_wait().

Add __ prefix to thr{sleep,wakeup,exit,sigdivert}() syscalls; add
'abort" argument to thrsleep to close cancellation race; make
thr{sleep,wakeup} return errno values via *retval to avoid touching
userspace errno.


# 1.96 22-Nov-2011 guenther

sigstack() is long dead, and the compat sigaltstack syscall is gone too.
Correct the namespace protections for sigreturn(), sigwait(), and psignal()

ok millert@


# 1.95 16-Oct-2011 guenther

Add stubs and manpage for __{get,set}_tcb

ok deraadt@


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

Add (rough draft) documentation for fdopendir(3) and the 15 new
XXXat(2) system calls from POSIX 2008. Editing will be done in tree.

General style discussed with jmc@, schwarze@, and deraadt@
ok jmc@


# 1.93 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@


Revision tags: OPENBSD_4_8_BASE OPENBSD_4_9_BASE
# 1.92 03-Jul-2010 guenther

Fix the naming of interfaces and variables for rdomains and rtables
and make it possible to bind sockets (including listening sockets!)
to rtables and not just rdomains. This changes the name of the
system calls, socket option, and ioctl. After building with this
you should remove the files /usr/share/man/cat2/[gs]etrdomain.0.

Since this removes the existing [gs]etrdomain() system calls, the
libc major is bumped.

Written by claudio@, criticized^Wcritiqued by me


# 1.91 01-Jul-2010 deraadt

getpeereid() can now be a library routine using getsockopt() with
SOL_SOCKET and SO_PEERCRED, only issue being that it cannot return
EFAULT for a page fault. The kernel code will soon be put into
compat, and then in 10 years or so tedu will delete it.
ok guenther millert


# 1.90 18-May-2010 tedu

add posix_madvise, posix_memalign, strndup, and strnlen. mostly from
brad and millert, with hints from guenther, jmc, and otto I think.
ok previous.


Revision tags: OPENBSD_4_7_BASE
# 1.89 03-Feb-2010 miod

Use MACHINE_CPU instead of MACHINE_ARCH to pick the correct machine dependent
files or directories when applicable.
The inspiration and name of MACHINE_CPU come from NetBSD, although the way to
provide it to Makefiles is completely different.
ok kettenis@


# 1.88 27-Nov-2009 guenther

Add setrdomain() and getrdomain() system calls. Committing now to
catch the libc major bump per request from deraadt@

Diff by reyk.

ok guenther@


# 1.87 13-Aug-2009 jmc

various MLINK fixes from Alan R. S. Bueno;


Revision tags: OPENBSD_4_6_BASE
# 1.86 03-Jun-2009 jj

Arla client rename from xfs to nnpfs for later upgrades. Tested on various arches. ok todd@ beck@


Revision tags: OPENBSD_4_4_BASE OPENBSD_4_5_BASE
# 1.85 22-Mar-2008 otto

move statvfs.c to gen, since it is not a syscall; ok deraadt@


# 1.84 16-Mar-2008 otto

statvfs support


Revision tags: OPENBSD_4_3_BASE
# 1.83 05-Jan-2008 deraadt

no more need for vadvise.o


# 1.82 09-Sep-2007 otto

Add lint stubs for the longjmp family of functions which are defined in
assembly on all platforms. ok deraadt@


# 1.81 09-Sep-2007 otto

Silence erroneous "environ used, but not defined" lint warning by
providing a stub. ok deraadt@


Revision tags: OPENBSD_4_1_BASE OPENBSD_4_2_BASE
# 1.80 24-Oct-2006 tedu

add rthread syscalls and bump minor.
rthreads are hardly done, but if just trying it out is too much of a hassle,
we'll never make more progress.
ok brad marc marco mbalmer


# 1.79 10-Oct-2006 deraadt

MLINKS to macros described in stat(2)


Revision tags: OPENBSD_4_0_BASE
# 1.78 14-Jun-2006 otto

Introducing adjfreq(2), to adjust the clock frequency.
Loosely based on dragonfly code. Man page help fro jmc@; ok deraadt@


# 1.77 27-May-2006 pedro

Make libc's getcwd() use the new __getcwd() system call
Hacked by marius@ at c2k5, okay miod@ krw@ deraadt@


# 1.76 13-Mar-2006 moritz

Clean the correct file. ok deraadt@


Revision tags: OPENBSD_3_9_BASE
# 1.75 29-Nov-2005 deraadt

Provide stubs for things which are supplied by crt0. I don't think we
want a crt0.ln, at least, not yet. We may reconsider later.


# 1.74 03-Oct-2005 jmc

add missing MLINK for WEXITSTATUS.2


Revision tags: OPENBSD_3_8_BASE
# 1.73 17-Jun-2005 drahn

Extended Attributes was a piece to get to ACLs, however ACLs have not
been worked on, so EA is pointless to maintain.


# 1.72 17-Jun-2005 millert

remove undelete syscall


Revision tags: OPENBSD_3_7_BASE
# 1.71 18-Sep-2004 deraadt

MLINK to macros provided in wait.2


# 1.70 16-Sep-2004 deraadt

add files missing for building a proper lint library


Revision tags: OPENBSD_3_5_BASE OPENBSD_3_6_BASE
# 1.69 13-Feb-2004 tedu

death to osigaltstack. ok deraadt@


# 1.68 15-Jan-2004 deraadt

ABI breakage happened with the sigaltstack replacement. It is too late,
now we just have to cope. Since setjmp uses it, the alpha and sparc64 are
unhappy with the structure change. In a few days, we will make the second
hop here, for now, use the old system call until all binaries have the new
struct in them.


# 1.67 12-Jan-2004 tedu

new syscall closefrom(2). ok deraadt millert


Revision tags: OPENBSD_3_4_BASE
# 1.66 10-May-2003 miod

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


# 1.65 14-Apr-2003 art

There are two related changes.

The first one is an mquery(2) syscall. It's for asking the VM system
about where to map things. It will be used by ld.so, read the man page
for details.

The second change is related and is a centralization of uvm_map hint
that all callers of uvm_map calculated. This will allow us to adjust
this hint on architectures that have segments for non-exec mappings.

deraadt@ drahn@ ok.


Revision tags: OPENBSD_3_3_BASE
# 1.64 31-Jan-2003 millert

Replace emulated versions of setreuid() and setregid() with real syscalls.
These are spec'd by POSIX as of 1003.1-2001; deraadt@ OK


# 1.63 02-Dec-2002 millert

Document getlogin_r()


# 1.62 02-Dec-2002 miod

Import propolice (http://www.trl.ibm.com/projects/security/ssp), a stack
attack protection scheme, into gcc.

This protection is enabled by default. It can be turned off by using the
-fno-stack-protector flag.

Code by Hiroaki Etoh (etoh at jp dot ibm dot com); work on openbsd-specific
integration by fgsch@, deraadt@ and myself; tests by fgsch@, naddy@ and
myself; beer drinking by myself.

Please note that system upgrades with this new code will require a new
libc and ld.so to be build and installed before the propolice-enabled
compiler can be installed.


# 1.61 10-Nov-2002 fgsch

missing MLINKs for setresuid(2). millert ok.


# 1.60 05-Nov-2002 marc

thread safe libc -- 2nd try. OK miod@, millert@
Thanks to miod@ for m68k and vax fixes


# 1.59 03-Nov-2002 marc

back out previous patch.. there are still some vax/m68k issues


# 1.58 03-Nov-2002 marc

libc changes for thread safety. Tested on:
alpha (millert@), i386 (marc@), m68k (millert@ and miod@),
powerpc (drahn@ and dhartmei@), sparc (millert@ and marc@),
sparc64 (marc@), and vax (millert@ and miod@).
Thanks to millert@, miod@, and mickey@ for fixes along the way.


# 1.57 30-Oct-2002 millert

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


Revision tags: OPENBSD_3_2_BASE
# 1.56 05-Aug-2002 art

Fix brain blackout.
Pointed out byb miod@.


# 1.55 05-Aug-2002 art

One more ELF_TOOLCHAIN.


# 1.54 06-Jul-2002 nordin

Remove kernel support for NTP. ok deraadt@ and tholo@


# 1.53 10-Jun-2002 fgsch

correct comment.


# 1.52 08-Jun-2002 drahn

ELF architectures all support weak aliases, enable them for this part.
ok fgsch@


Revision tags: OPENBSD_3_1_BASE
# 1.51 22-Feb-2002 drahn

Extended Attribute support, from FreeBSD/TrustedBSD. ok art@ deraadt@
libc support pieces


# 1.50 21-Feb-2002 art

remove rfork.o from the auto-generated assembler stubs


# 1.49 17-Feb-2002 deraadt

rfork() needs a fork.S-like stub as well; ok art


Revision tags: OPENBSD_3_0_BASE
# 1.48 25-Sep-2001 niklas

Forgotten DEBUGLIBS stuff


# 1.47 25-Sep-2001 drahn

Add an ASPICFLAG variable to bsd.own.mk which a platform use to pass flags
to 'as' to make it compile pic. add defaults for sparc64 which needs picflags
set to -fPIC and ASPICFLAGS to -KPIC.
Also simplifies the systemcall generation for sparc64 PIC mode.
ok epsie@.


# 1.46 20-Sep-2001 millert

Add PSEUDO_NOERROR similar to that used by NetBSD.
Some ports were setting errno in PSEUDO and some were not. Now errno
is set for all in PSEUDO and PSEUDO_NOERROR is provided for the
non-errno case (only used by _exit).

Needs testing on vax and m88k.
XXX - hppa and powerpc still lack a real PSEUDO_NOERROR implementation.
Currently PSEUDO_NOERROR and PSEUDO are the same (so builds don't
break on those platforms).


# 1.45 09-Jul-2001 fgsch

Install getpeereid(2) manpage.


# 1.44 26-Jun-2001 dugsong

implement djb's getpeereid(2), to allow local-domain servers to determine client credentials. mostly from superscript.com. deraadt@ ok


Revision tags: OPENBSD_2_9_BASE
# 1.43 14-Mar-2001 aaron

Move description of exect() to execve(2) man page. Add a note about exect() not
being portable.


# 1.42 09-Mar-2001 art

Add mlockall and munlockall. man-page from NetBSD.


# 1.41 10-Jan-2001 deraadt

put up FD_* manual pages, in section 3


# 1.40 23-Dec-2000 deraadt

create proper docs for timer{add,clear,sub,isset,cmp}


# 1.39 16-Nov-2000 provos

kqueue and kevent system calls


Revision tags: OPENBSD_2_8_BASE
# 1.38 17-Oct-2000 deraadt

damn it, i have had it with this untested weak shit


# 1.37 16-Oct-2000 deraadt

re-add weak sparc support; d@


# 1.36 15-May-2000 niklas

Add support for building libraries with debugging information in them.
Enable by setting DEBUGLIBS=yes in /etc/mk.conf, then -g libraries will get
installed in /usr/lib/debug. This directory will be searched first if
gcc is given the -g flag during the link stage.


Revision tags: OPENBSD_2_7_BASE
# 1.35 01-May-2000 deraadt

bye bye semconfig(2)


# 1.34 20-Apr-2000 deraadt

p{read,write}{,v} man pages


# 1.33 07-Feb-2000 assar

add fhopen, fhstat, fhstatfs system calls. largely from NetBSD


# 1.32 06-Jan-2000 d

for now, disable weak aliases for all archs except i386


# 1.31 14-Dec-1999 millert

Install swapctl.2, not swapon.2. swapon.2 should probably go away.


Revision tags: OPENBSD_2_6_BASE
# 1.30 07-Jun-1999 deraadt

replacement pipe() system call; copies data into place inside kernel, so
that EFAULT return value is possible


# 1.29 22-May-1999 weingart

Add swapctl(2), and crank shlib minor.


Revision tags: OPENBSD_2_5_BASE
# 1.28 01-Feb-1999 d

mi ptrace


# 1.27 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


Revision tags: OPENBSD_2_4_BASE
# 1.26 18-Sep-1998 art

make use of xfspioctl


Revision tags: OPENBSD_2_3_BASE
# 1.25 08-Feb-1998 tholo

Better lint(1) framework. Mostly from cgd@NetBSD


# 1.24 13-Nov-1997 deraadt

add getsid(2), XPG4


Revision tags: OPENBSD_2_2_BASE
# 1.23 30-May-1997 kstailey

add getpgrp(2) from NetBSD


Revision tags: OPENBSD_2_1_BASE
# 1.22 08-May-1997 kstailey

add tag


# 1.21 08-May-1997 kstailey

make clock_gettime.cat2


# 1.20 20-Apr-1997 tholo

New POSIX 1003.1b syscalls; from pk@NetBSD


# 1.19 04-Apr-1997 deraadt

seek(2) is not needed


# 1.18 29-Mar-1997 deraadt

futimes link; nakayosh@kcn.or.jp


# 1.17 26-Mar-1997 deraadt

install ktrace(2)


# 1.16 26-Jan-1997 downsj

Add a link for lchown.2


# 1.15 26-Jan-1997 downsj

Add lchown(), increment minor number.


# 1.14 11-Dec-1996 deraadt

generate reboot.o like other system calls


Revision tags: OPENBSD_2_0_BASE
# 1.13 02-Sep-1996 deraadt

shmdt link


# 1.12 25-Aug-1996 deraadt

and a man page


# 1.11 18-Jun-1996 deraadt

build poll.o


# 1.10 19-May-1996 pefo

Changes for mips.


# 1.9 18-May-1996 deraadt

poll() as a system call


# 1.8 08-May-1996 deraadt

install rfork man page


# 1.7 01-May-1996 deraadt

add futimes


# 1.6 25-Mar-1996 tholo

Add support for building lint(1) library


# 1.5 29-Jan-1996 tholo

Add kernel PLL for system clock
Add ntp_adjtime() and ntp_gettime() system calls
Mostly stolen from FreeBSD


# 1.4 08-Jan-1996 deraadt

add rfork.o and minherit.o


# 1.3 07-Jan-1996 deraadt

add minherit() system call


# 1.2 14-Dec-1995 deraadt

from netbsd:
add & fix a bunch of system call pages


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.178 29-Mar-2024 deraadt

the msyscall(2) manual page can be deleted.
Also, the details described in sigaltstack(2) are no longer true.
ok jmc


Revision tags: OPENBSD_7_5_BASE
# 1.177 19-Jan-2024 deraadt

Stop initializing pinsyscall(SYS_execve in static binaries that contain
an execve(2) stub. The new pinsyscalls(2) that applies to all system
calls has made this redundant.


# 1.176 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


# 1.175 11-Dec-2023 deraadt

document upcoming pinsyscalls(2) system call
ok kettenis, some tweaks from jmc


Revision tags: OPENBSD_7_4_BASE
# 1.174 20-Aug-2023 visa

Add syscall stub for kqueue1(2)

This rides previous libc minor bump.

Feedback and OK guenther@


Revision tags: OPENBSD_7_3_BASE
# 1.173 27-Feb-2023 deraadt

Calculate the size of the static (and profiled static) execve syscall stub
and store it in a const variable for use by crt0.
help from kettenis and miod


# 1.172 21-Feb-2023 deraadt

create a stub for pinsyscall(2)
ok guenther


# 1.171 16-Feb-2023 deraadt

Document pinsyscall(2). The ld.so and kernel enforcement code is not
commited ye -- waiting for enough people to run kernels which support
the system call.
ok jmc


# 1.170 11-Feb-2023 deraadt

__syscall() is no longer neccessary since the system calls which needed
it are now unpadded
ok kettenis guenther


# 1.169 08-Jan-2023 guenther

Add getthrname(2) manpage

ok jmc@ schwarze@


# 1.168 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@


# 1.167 19-Dec-2022 guenther

Add waitid(2) manpage, based on a first pass by espie@ and bits
from FreeBSD and NetBSD.

ok kettenis@ jmc@ espie@


# 1.166 26-Oct-2022 kettenis

Add waitid(2) syscall stub.

Minor bump to both libc and libpthread: make sure you install a new kernel!

ok millert@, deraadt@


# 1.165 07-Oct-2022 deraadt

Add mimmutable(2) libc stub, add & adjust manual pages, and crank the minor.
ok kettenis


Revision tags: OPENBSD_7_2_BASE
# 1.164 09-Sep-2022 mbuhl

Add libc wrappers for the new sendmmsg and recvmmsg system calls.
Feedback tb@, miod@, jca@
OK jca@


# 1.163 17-Jul-2022 deraadt

Add ypconnect(2) stub inside libc so that libc functions can use it,
but do not export it.


# 1.162 17-Jul-2022 deraadt

add ypconnect(2) manual page


Revision tags: OPENBSD_7_1_BASE
# 1.161 23-Dec-2021 guenther

Roll the syscalls that have an off_t argument to remove the explicit padding.
Switch libc and ld.so to the generic stubs for these calls.
WARNING: reboot to updated kernel before installing libc or ld.so!

Time for a story...

When gcc (back in 1.x days) first implemented long long, it didn't (always)
pass 64bit arguments in 'aligned' registers/stack slots, with the result that
argument offsets didn't match structure offsets. This affected the nine system
calls that pass off_t arguments:
ftruncate lseek mmap mquery pread preadv pwrite pwritev truncate

To avoid having to do custom ASM wrappers for those, BSD put an explicit pad
argument in so that the off_t argument would always start on a even slot and
thus be naturally aligned. Thus those odd wrappers in lib/libc/sys/ that use
__syscall() and pass an extra '0' argument.

The ABIs for different CPUs eventually settled how things should be passed on
each and gcc 2.x followed them. The only arch now where it helps is landisk,
which needs to skip the last argument register if it would be the first half of
a 64bit argument. So: add new syscalls without the pad argument and on landisk
do that skipping directly in the syscall handler in the kernel. Keep compat
support for the existing syscalls long enough for the transition.

ok deraadt@


Revision tags: OPENBSD_7_0_BASE
# 1.160 11-Jun-2021 kettenis

Since futex(2) can fail, it needs a full syscall stub. This should fixes
issues on powerpc64 and sparc64.

Note that this makes the lib/libpthread/errno test fail since that test
detects that we are touching errno now. This will be addressed in a
future diff as it is not entirely clear whether the test is correct.

ok mpi@, bluhm@


Revision tags: OPENBSD_6_8_BASE OPENBSD_6_9_BASE
# 1.159 06-Jul-2020 pirofti

Add support for timeconting in userland.

This diff exposes parts of clock_gettime(2) and gettimeofday(2) to
userland via libc eliberating processes from the need for a context
switch everytime they want to count the passage of time.

If a timecounter clock can be exposed to userland than it needs to set
its tc_user member to a non-zero value. Tested with one or multiple
counters per architecture.

The timing data is shared through a pointer found in the new ELF
auxiliary vector AUX_openbsd_timekeep containing timehands information
that is frequently updated by the kernel.

Timing differences between the last kernel update and the current time
are adjusted in userland by the tc_get_timecount() function inside the
MD usertc.c file.

This permits a much more responsive environment, quite visible in
browsers, office programs and gaming (apparently one is are able to fly
in Minecraft now).

Tested by robert@, sthen@, naddy@, kmos@, phessler@, and many others!

OK from at least kettenis@, cheloha@, naddy@, sthen@


Revision tags: OPENBSD_6_7_BASE
# 1.158 27-Nov-2019 deraadt

Document msyscall(2): ld.so can use this (once only) to tell the kernel
where libc.so's text segment is, thereby allowing invocation of system
calls from that region. An upcoming change will kill the process if a
system call is invoked from addresses not explicitly permitted.
ok guenther kettenis mortimer


Revision tags: OPENBSD_6_6_BASE
# 1.157 28-May-2019 beck

Enable the use of the kernel __realpath() system call in the libc wrapper.

For now, this also still uses the existing realpath implmentation
and emits a syslog if we see differening results. Once we have run
with that for a little while we will remove the old code

ok deraadt@


Revision tags: OPENBSD_6_5_BASE
# 1.156 11-Jan-2019 deraadt

mincore() is a relic from the past, exposing physical machine information
about shared resources which no program should see. only a few pieces of
software use it, generally poorly thought out. they are being fixed, so
mincore() can be deleted.
ok guenther tedu jca sthen, others


Revision tags: OPENBSD_6_4_BASE
# 1.155 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.154 12-Jan-2018 deraadt

sysctl(3) can now be renamed to sysctl(2)


# 1.153 28-Nov-2017 guenther

Delete fktrace(2). The consequences of it were not thought through
sufficiently and at least one horrific security hole was the result.

ok deraadt@ beck@


Revision tags: OPENBSD_6_2_BASE
# 1.152 13-Aug-2017 tedu

add fktrace to libc


# 1.151 12-Aug-2017 guenther

Instead of hardcoding a partial dependency list for the syscall stub objects,
calculate them as done for other objects


# 1.150 31-May-2017 sthen

install futex(2), ok mpi


# 1.149 30-Apr-2017 mpi

Add futex(2) shim, bump minor.

Inputs from guenther@, ok kettenis@, visa@


Revision tags: OPENBSD_6_1_BASE
# 1.148 29-Mar-2017 deraadt

The hppa version of as(1) requires whitespace before a .file directive,
it may not be in column 0. This kind of thing is very common in GNU
and Linux software because the software was written from the start to
be 'compatible replacements' of vendor software.
ok jsing guenther


# 1.147 26-Mar-2017 guenther

Use .file to convince 'as' to generate proper FILE symbols in the syscall
stubs that aren't actually in files, so that syspatch can figure out what
order the syscall stub objects are in the .so. Use -P to suppress to #line
directives that would override that. Tested with both gcc/gas and clang.

ok deraadt@


Revision tags: OPENBSD_6_0_BASE
# 1.146 04-Jul-2016 guenther

DEBUGLIBS has been broken since the gcc4 switch, so delete it. CFLAGS
contains -g by default anyway

problem noted by Edgar Pettijohn (edgar (at) pettijohn-web.com)
ok millert@ kettenis@ deraadt@


# 1.145 30-May-2016 guenther

Move __getcwd from ASM to HIDDEN: we don't want the literal __getcwd symbol

ok millert@ deraadt@


# 1.144 19-May-2016 guenther

Add ASM_NOERR for syscalls that never fail and thus don't need the errno
setting logic...which can significantly reduce the size of the stub on
some archs; 20 syscalls get a trim with this.

in snaps for a bit and ok deraadt@


# 1.143 09-May-2016 guenther

Remove sigreturn declaration and the now-unused libc syscall stub


# 1.142 07-May-2016 guenther

Use a Thread Information Block in both single and multi-threaded programs.
This stores errno, the cancelation flags, and related bits for each thread
and is allocated by ld.so or libc.a. This is an ABI break from 5.9-stable!

Make libpthread dlopen'able by moving the cancelation wrappers into libc
and doing locking and fork/errno handling via callbacks that libpthread
registers when it first initializes. 'errno' *must* be declared via
<errno.h> now!

Clean up libpthread's symbol exports like libc.

On powerpc, offset the TIB/TCB/TLS data from the register per the ELF spec.

Testing by various, particularly sthen@ and patrick@
ok kettenis@


# 1.141 30-Mar-2016 guenther

Turd polish: use HIDDEN= instead of PSEUDO= for ptrace syscall stub, to
make its underlying symbol name look like others.


# 1.140 30-Mar-2016 guenther

Eliminate userspace caching by getlogin_r/setlogin; make the getlogin
syscall behave exactly like userspace getlogin_r() and rename it to
match. Eliminate the reduced-to-no-op wrappers of the syscalls.
Eliminate the unnecessary per-thread static buffering by getlogin().

ok kettenis@ deraadt@


# 1.139 30-Mar-2016 jmc

for some time now mandoc has not required MLINKS to function
correctly - logically complete that now by removing MLINKS from base;

authors need only to ensure there is an entry in NAME for any function/
util being added. MLINKS will still work, and remain for perl to ease
upgrades;

ok nicm (curses) bcook (ssl)
ok schwarze, who provided a lot of feedback and assistance
ok tb natano jung


# 1.138 21-Mar-2016 bluhm

Rename the system call sendsyslog2 to sendsyslog. Keep the old one
as osendsyslog for a while. The three argument variant is the only
one that will stay.
input kettenis@; OK deraadt@


Revision tags: OPENBSD_5_9_BASE
# 1.137 25-Nov-2015 deraadt

Add a syscall stub for sendsyslog2(2), and use it in syslog_r(3), passing
LOG_CONS to the kernel. As a result, the /dev/console opening code can
be removed.
ok kettenis millert beck


# 1.136 10-Nov-2015 guenther

Split the intra-thread functionality from kill(2) into its own syscall
thrkill(2), rolling the kill(2) syscall number with the ABI change to
avoid breaking binaries during during the transition. thrkill(2) includes
a 'tcb' argument that eliminates the need for locking in pthread_kill()
and simplifies pthread_cancel(). Switch __stack_smash_handler() to use
thrkill(2) and explicitly unblock SIGABRT.

Minor bump to both libc and libpthread: make sure you install a new kernel!

ok semarie@


# 1.135 23-Oct-2015 guenther

Merge the sigaction() and sigprocmask() overloads/wrappers from libpthread
into libc, and move pthread_sigmask() as well (just a trivial wrapper).
This provides consistent handling of SIGTHR between single- and multi-threaded
programs and is a step in the merge of all the libpthread overloads, providing
some ASM and Makefile bits that the other wrappers will need.

ok deraadt@ millert@


# 1.134 23-Oct-2015 deraadt

Remove dnssocket() and dnsconnect(), since we decided to use a SOCK_DNS
flag instead.
ok guenther tedu semarie


# 1.133 19-Oct-2015 deraadt

Remove old tame() stub


# 1.132 18-Oct-2015 deraadt

create libc stubs for dnssocket() and dnsconnect()


# 1.131 09-Oct-2015 deraadt

tame -> pledge conversion, in libc. I should crank libc, but am cheating
hoping things go well. The old symbol is faked via a stupid stub function,
until next major crank when it can be removed. I am expecting guenther
to scream at me.


# 1.130 13-Sep-2015 guenther

Rename __sysctl syscall to just sysctl, as the userland wrapper is no longer
necessary

ok deraadt@ jsing@


# 1.129 09-Sep-2015 guenther

Simplify makefile rules for building the ASM stubs into "pick something
from column A and something from column B".

ok miod@ deraadt@


# 1.128 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@


# 1.127 25-Aug-2015 guenther

Document kbind(2)


Revision tags: OPENBSD_5_8_BASE
# 1.126 19-Jul-2015 deraadt

manual page for tame(2). not very good, so i will be hearing from jmc


# 1.125 07-Apr-2015 guenther

Make pthread_atfork() track the DSO that called it like atexit() does,
unregistering callbacks if the DSO is unloaded. Move the callback
handling from libpthread to libc, though libpthread still overrides the
inner call to handle locking and thread-library reinitialization.
Major version bump for both libc and libpthread.

verification that this fixes various ports ajacoutot@
asm assistance miod@; ok millert@ deraadt@


Revision tags: OPENBSD_5_7_BASE
# 1.124 08-Dec-2014 guenther

Add chflagsat(), modeled on fchmodat() with name to match FreeBSD.


# 1.123 14-Nov-2014 guenther

Add sched_yield(2) manpage


# 1.122 31-Aug-2014 guenther

Declare and document getthrid()

indirectly prodded by krw@


# 1.121 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@


# 1.120 14-Aug-2014 tobias

fixed overrid(d)en typo

millert@ and jmc@ agree that "overriden" is wrong


Revision tags: OPENBSD_5_6_BASE
# 1.119 12-Jul-2014 deraadt

document sendsyslog(2); ok guenther tedu matthew


# 1.118 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.117 18-Mar-2014 miod

Retire hp300, mvme68k and mvme88k ports. These ports have no users, keeping
this hardware alive is becoming increasingly difficult, and I should heed the
message sent by the three disks which have died on me over the last few days.

Noone sane will mourn these ports anyway. So long, and thanks for the fish.


Revision tags: OPENBSD_5_5_BASE
# 1.116 13-Oct-2013 guenther

Make it possible to build to reduced version of a library, including
just specific objects that are compiled with additional options to
reduce their size. For use by distrib/ and crunchgen.

style and naming assistance from espie@


# 1.115 07-Oct-2013 guenther

getdirentries(2) is dead; long live getdents(2)!

confirmation that getdirentries(2) is unused by ports from sthen@ and naddy@


# 1.114 13-Aug-2013 guenther

Switch time_t, ino_t, clock_t, and struct kevent's ident and data
members to 64bit types. Assign new syscall numbers for (almost
all) the syscalls that involve the affected types, including anything
with time_t, timeval, itimerval, timespec, rusage, dirent, stat,
or kevent arguments. Add a d_off member to struct dirent and replace
getdirentries() with getdents(), thus immensely simplifying and
accelerating telldir/seekdir. Build perl with -DBIG_TIME.

Bump the major on every single base library: the compat bits included
here are only good enough to make the transition; the T32 compat
option will be burned as soon as we've reached the new world are
are happy with the snapshots for all architectures.

DANGER: ABI incompatibility. Updating to this kernel requires extra
work or you won't be able to login: install a snapshot instead.

Much assistance in fixing userland issues from deraadt@ and tedu@
and build assistance from todd@ and otto@


Revision tags: OPENBSD_5_4_BASE
# 1.113 05-Jun-2013 guenther

Move _Exit() from the exit() manpage to the _exit() manpage, as it's
just an alias of the latter.

ok matthew@ tedu@


# 1.112 01-Jun-2013 miod

Add utrace(2), a system call allowing for userland to send its own ktrace
records. From FreeBSD via otto@, with tweaks suggested by guenther@.
Commite on behalf of otto@ who is not around, to ride the libc minor bump.
Causes a librthread minor bump as well (new syscall).


# 1.111 29-Apr-2013 matthew

Extend P_SIGSUSPEND handling in userret() to properly restore the
sigmask even if there are no pending signals under the temporary
sigmask.

Refactor existing select() and poll() system calls to introduce the
pselect() and ppoll() system calls.

Add rthread wrappers for pselect() and ppoll(). While there, update
cancellation point comments to reflect recent fdatasync() addition.

Minor bumps for libc and librthread due to new symbols.

ok guenther, millert, deraadt, jmc


# 1.110 15-Apr-2013 matthew

Implement fdatasync() as a wrapper around fsync()

ok guenther, deraadt, jmc


Revision tags: OPENBSD_5_3_BASE
# 1.109 03-Feb-2013 miod

gremlin crept in


# 1.108 02-Feb-2013 miod

Userland bits for m68k/ELF. Mostly addition of register prefixes to the
assembler instructions, and cope with the few changes in return values
location.


# 1.107 04-Sep-2012 okan

remove lint leftovers; ok guenther@


# 1.106 23-Aug-2012 deraadt

no more nnpfspioctl() system call; ok guenther


# 1.105 22-Aug-2012 pascal

Convert cpp | as rules in bsd.lib.mk and lib/libc/sys/Makefile.inc to pure cc
invocations. This allows us to use the compiler builtin define __PIC__ to check
for PIC/PIEness rather than passing -DPIC. Simplifies PIE work a lot.

ok matthew@, conceptually ok kurt@


# 1.104 21-Aug-2012 pascal

Kill an old mips workaround; we don't support mips, just mips64.

ok deraadt@ kettenis@


Revision tags: OPENBSD_5_2_BASE
# 1.103 19-Jun-2012 deraadt

oops, forgot to install getdtablecount(2); noted by tedu


# 1.102 12-Apr-2012 deraadt

remove rfork(); ok guenther miod


# 1.101 12-Apr-2012 deraadt

kill lfs system call lines and libc stubs


# 1.100 12-Apr-2012 deraadt

New system call: getdtablecount(2) returns the number of file
descriptors the process currently has open.
ok guenther miod gilles ...


# 1.99 22-Mar-2012 guenther

Move __tfork_thread() from rthreads (libpthread) to libc so that
it can be used for not-strictly-threading purposes

ok matthew@ kurt@


# 1.98 13-Mar-2012 guenther

Add manpages for __thrsigdivert, __thrsleep, and __thrwakeup. Various
syntax and grammar fixes from jmc@


Revision tags: OPENBSD_5_1_BASE
# 1.97 17-Jan-2012 guenther

Reimplement mutexes, condvars, and rwlocks to eliminate bugs,
particularly the "consume the signal you just sent" hang, and putting
the wait queues in userspace.

Do cancellation handling in pthread_cond_*wait(), pthread_join(),
and sem_wait().

Add __ prefix to thr{sleep,wakeup,exit,sigdivert}() syscalls; add
'abort" argument to thrsleep to close cancellation race; make
thr{sleep,wakeup} return errno values via *retval to avoid touching
userspace errno.


# 1.96 22-Nov-2011 guenther

sigstack() is long dead, and the compat sigaltstack syscall is gone too.
Correct the namespace protections for sigreturn(), sigwait(), and psignal()

ok millert@


# 1.95 16-Oct-2011 guenther

Add stubs and manpage for __{get,set}_tcb

ok deraadt@


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

Add (rough draft) documentation for fdopendir(3) and the 15 new
XXXat(2) system calls from POSIX 2008. Editing will be done in tree.

General style discussed with jmc@, schwarze@, and deraadt@
ok jmc@


# 1.93 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@


Revision tags: OPENBSD_4_8_BASE OPENBSD_4_9_BASE
# 1.92 03-Jul-2010 guenther

Fix the naming of interfaces and variables for rdomains and rtables
and make it possible to bind sockets (including listening sockets!)
to rtables and not just rdomains. This changes the name of the
system calls, socket option, and ioctl. After building with this
you should remove the files /usr/share/man/cat2/[gs]etrdomain.0.

Since this removes the existing [gs]etrdomain() system calls, the
libc major is bumped.

Written by claudio@, criticized^Wcritiqued by me


# 1.91 01-Jul-2010 deraadt

getpeereid() can now be a library routine using getsockopt() with
SOL_SOCKET and SO_PEERCRED, only issue being that it cannot return
EFAULT for a page fault. The kernel code will soon be put into
compat, and then in 10 years or so tedu will delete it.
ok guenther millert


# 1.90 18-May-2010 tedu

add posix_madvise, posix_memalign, strndup, and strnlen. mostly from
brad and millert, with hints from guenther, jmc, and otto I think.
ok previous.


Revision tags: OPENBSD_4_7_BASE
# 1.89 03-Feb-2010 miod

Use MACHINE_CPU instead of MACHINE_ARCH to pick the correct machine dependent
files or directories when applicable.
The inspiration and name of MACHINE_CPU come from NetBSD, although the way to
provide it to Makefiles is completely different.
ok kettenis@


# 1.88 27-Nov-2009 guenther

Add setrdomain() and getrdomain() system calls. Committing now to
catch the libc major bump per request from deraadt@

Diff by reyk.

ok guenther@


# 1.87 13-Aug-2009 jmc

various MLINK fixes from Alan R. S. Bueno;


Revision tags: OPENBSD_4_6_BASE
# 1.86 03-Jun-2009 jj

Arla client rename from xfs to nnpfs for later upgrades. Tested on various arches. ok todd@ beck@


Revision tags: OPENBSD_4_4_BASE OPENBSD_4_5_BASE
# 1.85 22-Mar-2008 otto

move statvfs.c to gen, since it is not a syscall; ok deraadt@


# 1.84 16-Mar-2008 otto

statvfs support


Revision tags: OPENBSD_4_3_BASE
# 1.83 05-Jan-2008 deraadt

no more need for vadvise.o


# 1.82 09-Sep-2007 otto

Add lint stubs for the longjmp family of functions which are defined in
assembly on all platforms. ok deraadt@


# 1.81 09-Sep-2007 otto

Silence erroneous "environ used, but not defined" lint warning by
providing a stub. ok deraadt@


Revision tags: OPENBSD_4_1_BASE OPENBSD_4_2_BASE
# 1.80 24-Oct-2006 tedu

add rthread syscalls and bump minor.
rthreads are hardly done, but if just trying it out is too much of a hassle,
we'll never make more progress.
ok brad marc marco mbalmer


# 1.79 10-Oct-2006 deraadt

MLINKS to macros described in stat(2)


Revision tags: OPENBSD_4_0_BASE
# 1.78 14-Jun-2006 otto

Introducing adjfreq(2), to adjust the clock frequency.
Loosely based on dragonfly code. Man page help fro jmc@; ok deraadt@


# 1.77 27-May-2006 pedro

Make libc's getcwd() use the new __getcwd() system call
Hacked by marius@ at c2k5, okay miod@ krw@ deraadt@


# 1.76 13-Mar-2006 moritz

Clean the correct file. ok deraadt@


Revision tags: OPENBSD_3_9_BASE
# 1.75 29-Nov-2005 deraadt

Provide stubs for things which are supplied by crt0. I don't think we
want a crt0.ln, at least, not yet. We may reconsider later.


# 1.74 03-Oct-2005 jmc

add missing MLINK for WEXITSTATUS.2


Revision tags: OPENBSD_3_8_BASE
# 1.73 17-Jun-2005 drahn

Extended Attributes was a piece to get to ACLs, however ACLs have not
been worked on, so EA is pointless to maintain.


# 1.72 17-Jun-2005 millert

remove undelete syscall


Revision tags: OPENBSD_3_7_BASE
# 1.71 18-Sep-2004 deraadt

MLINK to macros provided in wait.2


# 1.70 16-Sep-2004 deraadt

add files missing for building a proper lint library


Revision tags: OPENBSD_3_5_BASE OPENBSD_3_6_BASE
# 1.69 13-Feb-2004 tedu

death to osigaltstack. ok deraadt@


# 1.68 15-Jan-2004 deraadt

ABI breakage happened with the sigaltstack replacement. It is too late,
now we just have to cope. Since setjmp uses it, the alpha and sparc64 are
unhappy with the structure change. In a few days, we will make the second
hop here, for now, use the old system call until all binaries have the new
struct in them.


# 1.67 12-Jan-2004 tedu

new syscall closefrom(2). ok deraadt millert


Revision tags: OPENBSD_3_4_BASE
# 1.66 10-May-2003 miod

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


# 1.65 14-Apr-2003 art

There are two related changes.

The first one is an mquery(2) syscall. It's for asking the VM system
about where to map things. It will be used by ld.so, read the man page
for details.

The second change is related and is a centralization of uvm_map hint
that all callers of uvm_map calculated. This will allow us to adjust
this hint on architectures that have segments for non-exec mappings.

deraadt@ drahn@ ok.


Revision tags: OPENBSD_3_3_BASE
# 1.64 31-Jan-2003 millert

Replace emulated versions of setreuid() and setregid() with real syscalls.
These are spec'd by POSIX as of 1003.1-2001; deraadt@ OK


# 1.63 02-Dec-2002 millert

Document getlogin_r()


# 1.62 02-Dec-2002 miod

Import propolice (http://www.trl.ibm.com/projects/security/ssp), a stack
attack protection scheme, into gcc.

This protection is enabled by default. It can be turned off by using the
-fno-stack-protector flag.

Code by Hiroaki Etoh (etoh at jp dot ibm dot com); work on openbsd-specific
integration by fgsch@, deraadt@ and myself; tests by fgsch@, naddy@ and
myself; beer drinking by myself.

Please note that system upgrades with this new code will require a new
libc and ld.so to be build and installed before the propolice-enabled
compiler can be installed.


# 1.61 10-Nov-2002 fgsch

missing MLINKs for setresuid(2). millert ok.


# 1.60 05-Nov-2002 marc

thread safe libc -- 2nd try. OK miod@, millert@
Thanks to miod@ for m68k and vax fixes


# 1.59 03-Nov-2002 marc

back out previous patch.. there are still some vax/m68k issues


# 1.58 03-Nov-2002 marc

libc changes for thread safety. Tested on:
alpha (millert@), i386 (marc@), m68k (millert@ and miod@),
powerpc (drahn@ and dhartmei@), sparc (millert@ and marc@),
sparc64 (marc@), and vax (millert@ and miod@).
Thanks to millert@, miod@, and mickey@ for fixes along the way.


# 1.57 30-Oct-2002 millert

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


Revision tags: OPENBSD_3_2_BASE
# 1.56 05-Aug-2002 art

Fix brain blackout.
Pointed out byb miod@.


# 1.55 05-Aug-2002 art

One more ELF_TOOLCHAIN.


# 1.54 06-Jul-2002 nordin

Remove kernel support for NTP. ok deraadt@ and tholo@


# 1.53 10-Jun-2002 fgsch

correct comment.


# 1.52 08-Jun-2002 drahn

ELF architectures all support weak aliases, enable them for this part.
ok fgsch@


Revision tags: OPENBSD_3_1_BASE
# 1.51 22-Feb-2002 drahn

Extended Attribute support, from FreeBSD/TrustedBSD. ok art@ deraadt@
libc support pieces


# 1.50 21-Feb-2002 art

remove rfork.o from the auto-generated assembler stubs


# 1.49 17-Feb-2002 deraadt

rfork() needs a fork.S-like stub as well; ok art


Revision tags: OPENBSD_3_0_BASE
# 1.48 25-Sep-2001 niklas

Forgotten DEBUGLIBS stuff


# 1.47 25-Sep-2001 drahn

Add an ASPICFLAG variable to bsd.own.mk which a platform use to pass flags
to 'as' to make it compile pic. add defaults for sparc64 which needs picflags
set to -fPIC and ASPICFLAGS to -KPIC.
Also simplifies the systemcall generation for sparc64 PIC mode.
ok epsie@.


# 1.46 20-Sep-2001 millert

Add PSEUDO_NOERROR similar to that used by NetBSD.
Some ports were setting errno in PSEUDO and some were not. Now errno
is set for all in PSEUDO and PSEUDO_NOERROR is provided for the
non-errno case (only used by _exit).

Needs testing on vax and m88k.
XXX - hppa and powerpc still lack a real PSEUDO_NOERROR implementation.
Currently PSEUDO_NOERROR and PSEUDO are the same (so builds don't
break on those platforms).


# 1.45 09-Jul-2001 fgsch

Install getpeereid(2) manpage.


# 1.44 26-Jun-2001 dugsong

implement djb's getpeereid(2), to allow local-domain servers to determine client credentials. mostly from superscript.com. deraadt@ ok


Revision tags: OPENBSD_2_9_BASE
# 1.43 14-Mar-2001 aaron

Move description of exect() to execve(2) man page. Add a note about exect() not
being portable.


# 1.42 09-Mar-2001 art

Add mlockall and munlockall. man-page from NetBSD.


# 1.41 10-Jan-2001 deraadt

put up FD_* manual pages, in section 3


# 1.40 23-Dec-2000 deraadt

create proper docs for timer{add,clear,sub,isset,cmp}


# 1.39 16-Nov-2000 provos

kqueue and kevent system calls


Revision tags: OPENBSD_2_8_BASE
# 1.38 17-Oct-2000 deraadt

damn it, i have had it with this untested weak shit


# 1.37 16-Oct-2000 deraadt

re-add weak sparc support; d@


# 1.36 15-May-2000 niklas

Add support for building libraries with debugging information in them.
Enable by setting DEBUGLIBS=yes in /etc/mk.conf, then -g libraries will get
installed in /usr/lib/debug. This directory will be searched first if
gcc is given the -g flag during the link stage.


Revision tags: OPENBSD_2_7_BASE
# 1.35 01-May-2000 deraadt

bye bye semconfig(2)


# 1.34 20-Apr-2000 deraadt

p{read,write}{,v} man pages


# 1.33 07-Feb-2000 assar

add fhopen, fhstat, fhstatfs system calls. largely from NetBSD


# 1.32 06-Jan-2000 d

for now, disable weak aliases for all archs except i386


# 1.31 14-Dec-1999 millert

Install swapctl.2, not swapon.2. swapon.2 should probably go away.


Revision tags: OPENBSD_2_6_BASE
# 1.30 07-Jun-1999 deraadt

replacement pipe() system call; copies data into place inside kernel, so
that EFAULT return value is possible


# 1.29 22-May-1999 weingart

Add swapctl(2), and crank shlib minor.


Revision tags: OPENBSD_2_5_BASE
# 1.28 01-Feb-1999 d

mi ptrace


# 1.27 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


Revision tags: OPENBSD_2_4_BASE
# 1.26 18-Sep-1998 art

make use of xfspioctl


Revision tags: OPENBSD_2_3_BASE
# 1.25 08-Feb-1998 tholo

Better lint(1) framework. Mostly from cgd@NetBSD


# 1.24 13-Nov-1997 deraadt

add getsid(2), XPG4


Revision tags: OPENBSD_2_2_BASE
# 1.23 30-May-1997 kstailey

add getpgrp(2) from NetBSD


Revision tags: OPENBSD_2_1_BASE
# 1.22 08-May-1997 kstailey

add tag


# 1.21 08-May-1997 kstailey

make clock_gettime.cat2


# 1.20 20-Apr-1997 tholo

New POSIX 1003.1b syscalls; from pk@NetBSD


# 1.19 04-Apr-1997 deraadt

seek(2) is not needed


# 1.18 29-Mar-1997 deraadt

futimes link; nakayosh@kcn.or.jp


# 1.17 26-Mar-1997 deraadt

install ktrace(2)


# 1.16 26-Jan-1997 downsj

Add a link for lchown.2


# 1.15 26-Jan-1997 downsj

Add lchown(), increment minor number.


# 1.14 11-Dec-1996 deraadt

generate reboot.o like other system calls


Revision tags: OPENBSD_2_0_BASE
# 1.13 02-Sep-1996 deraadt

shmdt link


# 1.12 25-Aug-1996 deraadt

and a man page


# 1.11 18-Jun-1996 deraadt

build poll.o


# 1.10 19-May-1996 pefo

Changes for mips.


# 1.9 18-May-1996 deraadt

poll() as a system call


# 1.8 08-May-1996 deraadt

install rfork man page


# 1.7 01-May-1996 deraadt

add futimes


# 1.6 25-Mar-1996 tholo

Add support for building lint(1) library


# 1.5 29-Jan-1996 tholo

Add kernel PLL for system clock
Add ntp_adjtime() and ntp_gettime() system calls
Mostly stolen from FreeBSD


# 1.4 08-Jan-1996 deraadt

add rfork.o and minherit.o


# 1.3 07-Jan-1996 deraadt

add minherit() system call


# 1.2 14-Dec-1995 deraadt

from netbsd:
add & fix a bunch of system call pages


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.177 19-Jan-2024 deraadt

Stop initializing pinsyscall(SYS_execve in static binaries that contain
an execve(2) stub. The new pinsyscalls(2) that applies to all system
calls has made this redundant.


# 1.176 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


# 1.175 11-Dec-2023 deraadt

document upcoming pinsyscalls(2) system call
ok kettenis, some tweaks from jmc


Revision tags: OPENBSD_7_4_BASE
# 1.174 20-Aug-2023 visa

Add syscall stub for kqueue1(2)

This rides previous libc minor bump.

Feedback and OK guenther@


Revision tags: OPENBSD_7_3_BASE
# 1.173 27-Feb-2023 deraadt

Calculate the size of the static (and profiled static) execve syscall stub
and store it in a const variable for use by crt0.
help from kettenis and miod


# 1.172 21-Feb-2023 deraadt

create a stub for pinsyscall(2)
ok guenther


# 1.171 16-Feb-2023 deraadt

Document pinsyscall(2). The ld.so and kernel enforcement code is not
commited ye -- waiting for enough people to run kernels which support
the system call.
ok jmc


# 1.170 11-Feb-2023 deraadt

__syscall() is no longer neccessary since the system calls which needed
it are now unpadded
ok kettenis guenther


# 1.169 08-Jan-2023 guenther

Add getthrname(2) manpage

ok jmc@ schwarze@


# 1.168 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@


# 1.167 19-Dec-2022 guenther

Add waitid(2) manpage, based on a first pass by espie@ and bits
from FreeBSD and NetBSD.

ok kettenis@ jmc@ espie@


# 1.166 26-Oct-2022 kettenis

Add waitid(2) syscall stub.

Minor bump to both libc and libpthread: make sure you install a new kernel!

ok millert@, deraadt@


# 1.165 07-Oct-2022 deraadt

Add mimmutable(2) libc stub, add & adjust manual pages, and crank the minor.
ok kettenis


Revision tags: OPENBSD_7_2_BASE
# 1.164 09-Sep-2022 mbuhl

Add libc wrappers for the new sendmmsg and recvmmsg system calls.
Feedback tb@, miod@, jca@
OK jca@


# 1.163 17-Jul-2022 deraadt

Add ypconnect(2) stub inside libc so that libc functions can use it,
but do not export it.


# 1.162 17-Jul-2022 deraadt

add ypconnect(2) manual page


Revision tags: OPENBSD_7_1_BASE
# 1.161 23-Dec-2021 guenther

Roll the syscalls that have an off_t argument to remove the explicit padding.
Switch libc and ld.so to the generic stubs for these calls.
WARNING: reboot to updated kernel before installing libc or ld.so!

Time for a story...

When gcc (back in 1.x days) first implemented long long, it didn't (always)
pass 64bit arguments in 'aligned' registers/stack slots, with the result that
argument offsets didn't match structure offsets. This affected the nine system
calls that pass off_t arguments:
ftruncate lseek mmap mquery pread preadv pwrite pwritev truncate

To avoid having to do custom ASM wrappers for those, BSD put an explicit pad
argument in so that the off_t argument would always start on a even slot and
thus be naturally aligned. Thus those odd wrappers in lib/libc/sys/ that use
__syscall() and pass an extra '0' argument.

The ABIs for different CPUs eventually settled how things should be passed on
each and gcc 2.x followed them. The only arch now where it helps is landisk,
which needs to skip the last argument register if it would be the first half of
a 64bit argument. So: add new syscalls without the pad argument and on landisk
do that skipping directly in the syscall handler in the kernel. Keep compat
support for the existing syscalls long enough for the transition.

ok deraadt@


Revision tags: OPENBSD_7_0_BASE
# 1.160 11-Jun-2021 kettenis

Since futex(2) can fail, it needs a full syscall stub. This should fixes
issues on powerpc64 and sparc64.

Note that this makes the lib/libpthread/errno test fail since that test
detects that we are touching errno now. This will be addressed in a
future diff as it is not entirely clear whether the test is correct.

ok mpi@, bluhm@


Revision tags: OPENBSD_6_8_BASE OPENBSD_6_9_BASE
# 1.159 06-Jul-2020 pirofti

Add support for timeconting in userland.

This diff exposes parts of clock_gettime(2) and gettimeofday(2) to
userland via libc eliberating processes from the need for a context
switch everytime they want to count the passage of time.

If a timecounter clock can be exposed to userland than it needs to set
its tc_user member to a non-zero value. Tested with one or multiple
counters per architecture.

The timing data is shared through a pointer found in the new ELF
auxiliary vector AUX_openbsd_timekeep containing timehands information
that is frequently updated by the kernel.

Timing differences between the last kernel update and the current time
are adjusted in userland by the tc_get_timecount() function inside the
MD usertc.c file.

This permits a much more responsive environment, quite visible in
browsers, office programs and gaming (apparently one is are able to fly
in Minecraft now).

Tested by robert@, sthen@, naddy@, kmos@, phessler@, and many others!

OK from at least kettenis@, cheloha@, naddy@, sthen@


Revision tags: OPENBSD_6_7_BASE
# 1.158 27-Nov-2019 deraadt

Document msyscall(2): ld.so can use this (once only) to tell the kernel
where libc.so's text segment is, thereby allowing invocation of system
calls from that region. An upcoming change will kill the process if a
system call is invoked from addresses not explicitly permitted.
ok guenther kettenis mortimer


Revision tags: OPENBSD_6_6_BASE
# 1.157 28-May-2019 beck

Enable the use of the kernel __realpath() system call in the libc wrapper.

For now, this also still uses the existing realpath implmentation
and emits a syslog if we see differening results. Once we have run
with that for a little while we will remove the old code

ok deraadt@


Revision tags: OPENBSD_6_5_BASE
# 1.156 11-Jan-2019 deraadt

mincore() is a relic from the past, exposing physical machine information
about shared resources which no program should see. only a few pieces of
software use it, generally poorly thought out. they are being fixed, so
mincore() can be deleted.
ok guenther tedu jca sthen, others


Revision tags: OPENBSD_6_4_BASE
# 1.155 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.154 12-Jan-2018 deraadt

sysctl(3) can now be renamed to sysctl(2)


# 1.153 28-Nov-2017 guenther

Delete fktrace(2). The consequences of it were not thought through
sufficiently and at least one horrific security hole was the result.

ok deraadt@ beck@


Revision tags: OPENBSD_6_2_BASE
# 1.152 13-Aug-2017 tedu

add fktrace to libc


# 1.151 12-Aug-2017 guenther

Instead of hardcoding a partial dependency list for the syscall stub objects,
calculate them as done for other objects


# 1.150 31-May-2017 sthen

install futex(2), ok mpi


# 1.149 30-Apr-2017 mpi

Add futex(2) shim, bump minor.

Inputs from guenther@, ok kettenis@, visa@


Revision tags: OPENBSD_6_1_BASE
# 1.148 29-Mar-2017 deraadt

The hppa version of as(1) requires whitespace before a .file directive,
it may not be in column 0. This kind of thing is very common in GNU
and Linux software because the software was written from the start to
be 'compatible replacements' of vendor software.
ok jsing guenther


# 1.147 26-Mar-2017 guenther

Use .file to convince 'as' to generate proper FILE symbols in the syscall
stubs that aren't actually in files, so that syspatch can figure out what
order the syscall stub objects are in the .so. Use -P to suppress to #line
directives that would override that. Tested with both gcc/gas and clang.

ok deraadt@


Revision tags: OPENBSD_6_0_BASE
# 1.146 04-Jul-2016 guenther

DEBUGLIBS has been broken since the gcc4 switch, so delete it. CFLAGS
contains -g by default anyway

problem noted by Edgar Pettijohn (edgar (at) pettijohn-web.com)
ok millert@ kettenis@ deraadt@


# 1.145 30-May-2016 guenther

Move __getcwd from ASM to HIDDEN: we don't want the literal __getcwd symbol

ok millert@ deraadt@


# 1.144 19-May-2016 guenther

Add ASM_NOERR for syscalls that never fail and thus don't need the errno
setting logic...which can significantly reduce the size of the stub on
some archs; 20 syscalls get a trim with this.

in snaps for a bit and ok deraadt@


# 1.143 09-May-2016 guenther

Remove sigreturn declaration and the now-unused libc syscall stub


# 1.142 07-May-2016 guenther

Use a Thread Information Block in both single and multi-threaded programs.
This stores errno, the cancelation flags, and related bits for each thread
and is allocated by ld.so or libc.a. This is an ABI break from 5.9-stable!

Make libpthread dlopen'able by moving the cancelation wrappers into libc
and doing locking and fork/errno handling via callbacks that libpthread
registers when it first initializes. 'errno' *must* be declared via
<errno.h> now!

Clean up libpthread's symbol exports like libc.

On powerpc, offset the TIB/TCB/TLS data from the register per the ELF spec.

Testing by various, particularly sthen@ and patrick@
ok kettenis@


# 1.141 30-Mar-2016 guenther

Turd polish: use HIDDEN= instead of PSEUDO= for ptrace syscall stub, to
make its underlying symbol name look like others.


# 1.140 30-Mar-2016 guenther

Eliminate userspace caching by getlogin_r/setlogin; make the getlogin
syscall behave exactly like userspace getlogin_r() and rename it to
match. Eliminate the reduced-to-no-op wrappers of the syscalls.
Eliminate the unnecessary per-thread static buffering by getlogin().

ok kettenis@ deraadt@


# 1.139 30-Mar-2016 jmc

for some time now mandoc has not required MLINKS to function
correctly - logically complete that now by removing MLINKS from base;

authors need only to ensure there is an entry in NAME for any function/
util being added. MLINKS will still work, and remain for perl to ease
upgrades;

ok nicm (curses) bcook (ssl)
ok schwarze, who provided a lot of feedback and assistance
ok tb natano jung


# 1.138 21-Mar-2016 bluhm

Rename the system call sendsyslog2 to sendsyslog. Keep the old one
as osendsyslog for a while. The three argument variant is the only
one that will stay.
input kettenis@; OK deraadt@


Revision tags: OPENBSD_5_9_BASE
# 1.137 25-Nov-2015 deraadt

Add a syscall stub for sendsyslog2(2), and use it in syslog_r(3), passing
LOG_CONS to the kernel. As a result, the /dev/console opening code can
be removed.
ok kettenis millert beck


# 1.136 10-Nov-2015 guenther

Split the intra-thread functionality from kill(2) into its own syscall
thrkill(2), rolling the kill(2) syscall number with the ABI change to
avoid breaking binaries during during the transition. thrkill(2) includes
a 'tcb' argument that eliminates the need for locking in pthread_kill()
and simplifies pthread_cancel(). Switch __stack_smash_handler() to use
thrkill(2) and explicitly unblock SIGABRT.

Minor bump to both libc and libpthread: make sure you install a new kernel!

ok semarie@


# 1.135 23-Oct-2015 guenther

Merge the sigaction() and sigprocmask() overloads/wrappers from libpthread
into libc, and move pthread_sigmask() as well (just a trivial wrapper).
This provides consistent handling of SIGTHR between single- and multi-threaded
programs and is a step in the merge of all the libpthread overloads, providing
some ASM and Makefile bits that the other wrappers will need.

ok deraadt@ millert@


# 1.134 23-Oct-2015 deraadt

Remove dnssocket() and dnsconnect(), since we decided to use a SOCK_DNS
flag instead.
ok guenther tedu semarie


# 1.133 19-Oct-2015 deraadt

Remove old tame() stub


# 1.132 18-Oct-2015 deraadt

create libc stubs for dnssocket() and dnsconnect()


# 1.131 09-Oct-2015 deraadt

tame -> pledge conversion, in libc. I should crank libc, but am cheating
hoping things go well. The old symbol is faked via a stupid stub function,
until next major crank when it can be removed. I am expecting guenther
to scream at me.


# 1.130 13-Sep-2015 guenther

Rename __sysctl syscall to just sysctl, as the userland wrapper is no longer
necessary

ok deraadt@ jsing@


# 1.129 09-Sep-2015 guenther

Simplify makefile rules for building the ASM stubs into "pick something
from column A and something from column B".

ok miod@ deraadt@


# 1.128 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@


# 1.127 25-Aug-2015 guenther

Document kbind(2)


Revision tags: OPENBSD_5_8_BASE
# 1.126 19-Jul-2015 deraadt

manual page for tame(2). not very good, so i will be hearing from jmc


# 1.125 07-Apr-2015 guenther

Make pthread_atfork() track the DSO that called it like atexit() does,
unregistering callbacks if the DSO is unloaded. Move the callback
handling from libpthread to libc, though libpthread still overrides the
inner call to handle locking and thread-library reinitialization.
Major version bump for both libc and libpthread.

verification that this fixes various ports ajacoutot@
asm assistance miod@; ok millert@ deraadt@


Revision tags: OPENBSD_5_7_BASE
# 1.124 08-Dec-2014 guenther

Add chflagsat(), modeled on fchmodat() with name to match FreeBSD.


# 1.123 14-Nov-2014 guenther

Add sched_yield(2) manpage


# 1.122 31-Aug-2014 guenther

Declare and document getthrid()

indirectly prodded by krw@


# 1.121 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@


# 1.120 14-Aug-2014 tobias

fixed overrid(d)en typo

millert@ and jmc@ agree that "overriden" is wrong


Revision tags: OPENBSD_5_6_BASE
# 1.119 12-Jul-2014 deraadt

document sendsyslog(2); ok guenther tedu matthew


# 1.118 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.117 18-Mar-2014 miod

Retire hp300, mvme68k and mvme88k ports. These ports have no users, keeping
this hardware alive is becoming increasingly difficult, and I should heed the
message sent by the three disks which have died on me over the last few days.

Noone sane will mourn these ports anyway. So long, and thanks for the fish.


Revision tags: OPENBSD_5_5_BASE
# 1.116 13-Oct-2013 guenther

Make it possible to build to reduced version of a library, including
just specific objects that are compiled with additional options to
reduce their size. For use by distrib/ and crunchgen.

style and naming assistance from espie@


# 1.115 07-Oct-2013 guenther

getdirentries(2) is dead; long live getdents(2)!

confirmation that getdirentries(2) is unused by ports from sthen@ and naddy@


# 1.114 13-Aug-2013 guenther

Switch time_t, ino_t, clock_t, and struct kevent's ident and data
members to 64bit types. Assign new syscall numbers for (almost
all) the syscalls that involve the affected types, including anything
with time_t, timeval, itimerval, timespec, rusage, dirent, stat,
or kevent arguments. Add a d_off member to struct dirent and replace
getdirentries() with getdents(), thus immensely simplifying and
accelerating telldir/seekdir. Build perl with -DBIG_TIME.

Bump the major on every single base library: the compat bits included
here are only good enough to make the transition; the T32 compat
option will be burned as soon as we've reached the new world are
are happy with the snapshots for all architectures.

DANGER: ABI incompatibility. Updating to this kernel requires extra
work or you won't be able to login: install a snapshot instead.

Much assistance in fixing userland issues from deraadt@ and tedu@
and build assistance from todd@ and otto@


Revision tags: OPENBSD_5_4_BASE
# 1.113 05-Jun-2013 guenther

Move _Exit() from the exit() manpage to the _exit() manpage, as it's
just an alias of the latter.

ok matthew@ tedu@


# 1.112 01-Jun-2013 miod

Add utrace(2), a system call allowing for userland to send its own ktrace
records. From FreeBSD via otto@, with tweaks suggested by guenther@.
Commite on behalf of otto@ who is not around, to ride the libc minor bump.
Causes a librthread minor bump as well (new syscall).


# 1.111 29-Apr-2013 matthew

Extend P_SIGSUSPEND handling in userret() to properly restore the
sigmask even if there are no pending signals under the temporary
sigmask.

Refactor existing select() and poll() system calls to introduce the
pselect() and ppoll() system calls.

Add rthread wrappers for pselect() and ppoll(). While there, update
cancellation point comments to reflect recent fdatasync() addition.

Minor bumps for libc and librthread due to new symbols.

ok guenther, millert, deraadt, jmc


# 1.110 15-Apr-2013 matthew

Implement fdatasync() as a wrapper around fsync()

ok guenther, deraadt, jmc


Revision tags: OPENBSD_5_3_BASE
# 1.109 03-Feb-2013 miod

gremlin crept in


# 1.108 02-Feb-2013 miod

Userland bits for m68k/ELF. Mostly addition of register prefixes to the
assembler instructions, and cope with the few changes in return values
location.


# 1.107 04-Sep-2012 okan

remove lint leftovers; ok guenther@


# 1.106 23-Aug-2012 deraadt

no more nnpfspioctl() system call; ok guenther


# 1.105 22-Aug-2012 pascal

Convert cpp | as rules in bsd.lib.mk and lib/libc/sys/Makefile.inc to pure cc
invocations. This allows us to use the compiler builtin define __PIC__ to check
for PIC/PIEness rather than passing -DPIC. Simplifies PIE work a lot.

ok matthew@, conceptually ok kurt@


# 1.104 21-Aug-2012 pascal

Kill an old mips workaround; we don't support mips, just mips64.

ok deraadt@ kettenis@


Revision tags: OPENBSD_5_2_BASE
# 1.103 19-Jun-2012 deraadt

oops, forgot to install getdtablecount(2); noted by tedu


# 1.102 12-Apr-2012 deraadt

remove rfork(); ok guenther miod


# 1.101 12-Apr-2012 deraadt

kill lfs system call lines and libc stubs


# 1.100 12-Apr-2012 deraadt

New system call: getdtablecount(2) returns the number of file
descriptors the process currently has open.
ok guenther miod gilles ...


# 1.99 22-Mar-2012 guenther

Move __tfork_thread() from rthreads (libpthread) to libc so that
it can be used for not-strictly-threading purposes

ok matthew@ kurt@


# 1.98 13-Mar-2012 guenther

Add manpages for __thrsigdivert, __thrsleep, and __thrwakeup. Various
syntax and grammar fixes from jmc@


Revision tags: OPENBSD_5_1_BASE
# 1.97 17-Jan-2012 guenther

Reimplement mutexes, condvars, and rwlocks to eliminate bugs,
particularly the "consume the signal you just sent" hang, and putting
the wait queues in userspace.

Do cancellation handling in pthread_cond_*wait(), pthread_join(),
and sem_wait().

Add __ prefix to thr{sleep,wakeup,exit,sigdivert}() syscalls; add
'abort" argument to thrsleep to close cancellation race; make
thr{sleep,wakeup} return errno values via *retval to avoid touching
userspace errno.


# 1.96 22-Nov-2011 guenther

sigstack() is long dead, and the compat sigaltstack syscall is gone too.
Correct the namespace protections for sigreturn(), sigwait(), and psignal()

ok millert@


# 1.95 16-Oct-2011 guenther

Add stubs and manpage for __{get,set}_tcb

ok deraadt@


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

Add (rough draft) documentation for fdopendir(3) and the 15 new
XXXat(2) system calls from POSIX 2008. Editing will be done in tree.

General style discussed with jmc@, schwarze@, and deraadt@
ok jmc@


# 1.93 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@


Revision tags: OPENBSD_4_8_BASE OPENBSD_4_9_BASE
# 1.92 03-Jul-2010 guenther

Fix the naming of interfaces and variables for rdomains and rtables
and make it possible to bind sockets (including listening sockets!)
to rtables and not just rdomains. This changes the name of the
system calls, socket option, and ioctl. After building with this
you should remove the files /usr/share/man/cat2/[gs]etrdomain.0.

Since this removes the existing [gs]etrdomain() system calls, the
libc major is bumped.

Written by claudio@, criticized^Wcritiqued by me


# 1.91 01-Jul-2010 deraadt

getpeereid() can now be a library routine using getsockopt() with
SOL_SOCKET and SO_PEERCRED, only issue being that it cannot return
EFAULT for a page fault. The kernel code will soon be put into
compat, and then in 10 years or so tedu will delete it.
ok guenther millert


# 1.90 18-May-2010 tedu

add posix_madvise, posix_memalign, strndup, and strnlen. mostly from
brad and millert, with hints from guenther, jmc, and otto I think.
ok previous.


Revision tags: OPENBSD_4_7_BASE
# 1.89 03-Feb-2010 miod

Use MACHINE_CPU instead of MACHINE_ARCH to pick the correct machine dependent
files or directories when applicable.
The inspiration and name of MACHINE_CPU come from NetBSD, although the way to
provide it to Makefiles is completely different.
ok kettenis@


# 1.88 27-Nov-2009 guenther

Add setrdomain() and getrdomain() system calls. Committing now to
catch the libc major bump per request from deraadt@

Diff by reyk.

ok guenther@


# 1.87 13-Aug-2009 jmc

various MLINK fixes from Alan R. S. Bueno;


Revision tags: OPENBSD_4_6_BASE
# 1.86 03-Jun-2009 jj

Arla client rename from xfs to nnpfs for later upgrades. Tested on various arches. ok todd@ beck@


Revision tags: OPENBSD_4_4_BASE OPENBSD_4_5_BASE
# 1.85 22-Mar-2008 otto

move statvfs.c to gen, since it is not a syscall; ok deraadt@


# 1.84 16-Mar-2008 otto

statvfs support


Revision tags: OPENBSD_4_3_BASE
# 1.83 05-Jan-2008 deraadt

no more need for vadvise.o


# 1.82 09-Sep-2007 otto

Add lint stubs for the longjmp family of functions which are defined in
assembly on all platforms. ok deraadt@


# 1.81 09-Sep-2007 otto

Silence erroneous "environ used, but not defined" lint warning by
providing a stub. ok deraadt@


Revision tags: OPENBSD_4_1_BASE OPENBSD_4_2_BASE
# 1.80 24-Oct-2006 tedu

add rthread syscalls and bump minor.
rthreads are hardly done, but if just trying it out is too much of a hassle,
we'll never make more progress.
ok brad marc marco mbalmer


# 1.79 10-Oct-2006 deraadt

MLINKS to macros described in stat(2)


Revision tags: OPENBSD_4_0_BASE
# 1.78 14-Jun-2006 otto

Introducing adjfreq(2), to adjust the clock frequency.
Loosely based on dragonfly code. Man page help fro jmc@; ok deraadt@


# 1.77 27-May-2006 pedro

Make libc's getcwd() use the new __getcwd() system call
Hacked by marius@ at c2k5, okay miod@ krw@ deraadt@


# 1.76 13-Mar-2006 moritz

Clean the correct file. ok deraadt@


Revision tags: OPENBSD_3_9_BASE
# 1.75 29-Nov-2005 deraadt

Provide stubs for things which are supplied by crt0. I don't think we
want a crt0.ln, at least, not yet. We may reconsider later.


# 1.74 03-Oct-2005 jmc

add missing MLINK for WEXITSTATUS.2


Revision tags: OPENBSD_3_8_BASE
# 1.73 17-Jun-2005 drahn

Extended Attributes was a piece to get to ACLs, however ACLs have not
been worked on, so EA is pointless to maintain.


# 1.72 17-Jun-2005 millert

remove undelete syscall


Revision tags: OPENBSD_3_7_BASE
# 1.71 18-Sep-2004 deraadt

MLINK to macros provided in wait.2


# 1.70 16-Sep-2004 deraadt

add files missing for building a proper lint library


Revision tags: OPENBSD_3_5_BASE OPENBSD_3_6_BASE
# 1.69 13-Feb-2004 tedu

death to osigaltstack. ok deraadt@


# 1.68 15-Jan-2004 deraadt

ABI breakage happened with the sigaltstack replacement. It is too late,
now we just have to cope. Since setjmp uses it, the alpha and sparc64 are
unhappy with the structure change. In a few days, we will make the second
hop here, for now, use the old system call until all binaries have the new
struct in them.


# 1.67 12-Jan-2004 tedu

new syscall closefrom(2). ok deraadt millert


Revision tags: OPENBSD_3_4_BASE
# 1.66 10-May-2003 miod

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


# 1.65 14-Apr-2003 art

There are two related changes.

The first one is an mquery(2) syscall. It's for asking the VM system
about where to map things. It will be used by ld.so, read the man page
for details.

The second change is related and is a centralization of uvm_map hint
that all callers of uvm_map calculated. This will allow us to adjust
this hint on architectures that have segments for non-exec mappings.

deraadt@ drahn@ ok.


Revision tags: OPENBSD_3_3_BASE
# 1.64 31-Jan-2003 millert

Replace emulated versions of setreuid() and setregid() with real syscalls.
These are spec'd by POSIX as of 1003.1-2001; deraadt@ OK


# 1.63 02-Dec-2002 millert

Document getlogin_r()


# 1.62 02-Dec-2002 miod

Import propolice (http://www.trl.ibm.com/projects/security/ssp), a stack
attack protection scheme, into gcc.

This protection is enabled by default. It can be turned off by using the
-fno-stack-protector flag.

Code by Hiroaki Etoh (etoh at jp dot ibm dot com); work on openbsd-specific
integration by fgsch@, deraadt@ and myself; tests by fgsch@, naddy@ and
myself; beer drinking by myself.

Please note that system upgrades with this new code will require a new
libc and ld.so to be build and installed before the propolice-enabled
compiler can be installed.


# 1.61 10-Nov-2002 fgsch

missing MLINKs for setresuid(2). millert ok.


# 1.60 05-Nov-2002 marc

thread safe libc -- 2nd try. OK miod@, millert@
Thanks to miod@ for m68k and vax fixes


# 1.59 03-Nov-2002 marc

back out previous patch.. there are still some vax/m68k issues


# 1.58 03-Nov-2002 marc

libc changes for thread safety. Tested on:
alpha (millert@), i386 (marc@), m68k (millert@ and miod@),
powerpc (drahn@ and dhartmei@), sparc (millert@ and marc@),
sparc64 (marc@), and vax (millert@ and miod@).
Thanks to millert@, miod@, and mickey@ for fixes along the way.


# 1.57 30-Oct-2002 millert

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


Revision tags: OPENBSD_3_2_BASE
# 1.56 05-Aug-2002 art

Fix brain blackout.
Pointed out byb miod@.


# 1.55 05-Aug-2002 art

One more ELF_TOOLCHAIN.


# 1.54 06-Jul-2002 nordin

Remove kernel support for NTP. ok deraadt@ and tholo@


# 1.53 10-Jun-2002 fgsch

correct comment.


# 1.52 08-Jun-2002 drahn

ELF architectures all support weak aliases, enable them for this part.
ok fgsch@


Revision tags: OPENBSD_3_1_BASE
# 1.51 22-Feb-2002 drahn

Extended Attribute support, from FreeBSD/TrustedBSD. ok art@ deraadt@
libc support pieces


# 1.50 21-Feb-2002 art

remove rfork.o from the auto-generated assembler stubs


# 1.49 17-Feb-2002 deraadt

rfork() needs a fork.S-like stub as well; ok art


Revision tags: OPENBSD_3_0_BASE
# 1.48 25-Sep-2001 niklas

Forgotten DEBUGLIBS stuff


# 1.47 25-Sep-2001 drahn

Add an ASPICFLAG variable to bsd.own.mk which a platform use to pass flags
to 'as' to make it compile pic. add defaults for sparc64 which needs picflags
set to -fPIC and ASPICFLAGS to -KPIC.
Also simplifies the systemcall generation for sparc64 PIC mode.
ok epsie@.


# 1.46 20-Sep-2001 millert

Add PSEUDO_NOERROR similar to that used by NetBSD.
Some ports were setting errno in PSEUDO and some were not. Now errno
is set for all in PSEUDO and PSEUDO_NOERROR is provided for the
non-errno case (only used by _exit).

Needs testing on vax and m88k.
XXX - hppa and powerpc still lack a real PSEUDO_NOERROR implementation.
Currently PSEUDO_NOERROR and PSEUDO are the same (so builds don't
break on those platforms).


# 1.45 09-Jul-2001 fgsch

Install getpeereid(2) manpage.


# 1.44 26-Jun-2001 dugsong

implement djb's getpeereid(2), to allow local-domain servers to determine client credentials. mostly from superscript.com. deraadt@ ok


Revision tags: OPENBSD_2_9_BASE
# 1.43 14-Mar-2001 aaron

Move description of exect() to execve(2) man page. Add a note about exect() not
being portable.


# 1.42 09-Mar-2001 art

Add mlockall and munlockall. man-page from NetBSD.


# 1.41 10-Jan-2001 deraadt

put up FD_* manual pages, in section 3


# 1.40 23-Dec-2000 deraadt

create proper docs for timer{add,clear,sub,isset,cmp}


# 1.39 16-Nov-2000 provos

kqueue and kevent system calls


Revision tags: OPENBSD_2_8_BASE
# 1.38 17-Oct-2000 deraadt

damn it, i have had it with this untested weak shit


# 1.37 16-Oct-2000 deraadt

re-add weak sparc support; d@


# 1.36 15-May-2000 niklas

Add support for building libraries with debugging information in them.
Enable by setting DEBUGLIBS=yes in /etc/mk.conf, then -g libraries will get
installed in /usr/lib/debug. This directory will be searched first if
gcc is given the -g flag during the link stage.


Revision tags: OPENBSD_2_7_BASE
# 1.35 01-May-2000 deraadt

bye bye semconfig(2)


# 1.34 20-Apr-2000 deraadt

p{read,write}{,v} man pages


# 1.33 07-Feb-2000 assar

add fhopen, fhstat, fhstatfs system calls. largely from NetBSD


# 1.32 06-Jan-2000 d

for now, disable weak aliases for all archs except i386


# 1.31 14-Dec-1999 millert

Install swapctl.2, not swapon.2. swapon.2 should probably go away.


Revision tags: OPENBSD_2_6_BASE
# 1.30 07-Jun-1999 deraadt

replacement pipe() system call; copies data into place inside kernel, so
that EFAULT return value is possible


# 1.29 22-May-1999 weingart

Add swapctl(2), and crank shlib minor.


Revision tags: OPENBSD_2_5_BASE
# 1.28 01-Feb-1999 d

mi ptrace


# 1.27 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


Revision tags: OPENBSD_2_4_BASE
# 1.26 18-Sep-1998 art

make use of xfspioctl


Revision tags: OPENBSD_2_3_BASE
# 1.25 08-Feb-1998 tholo

Better lint(1) framework. Mostly from cgd@NetBSD


# 1.24 13-Nov-1997 deraadt

add getsid(2), XPG4


Revision tags: OPENBSD_2_2_BASE
# 1.23 30-May-1997 kstailey

add getpgrp(2) from NetBSD


Revision tags: OPENBSD_2_1_BASE
# 1.22 08-May-1997 kstailey

add tag


# 1.21 08-May-1997 kstailey

make clock_gettime.cat2


# 1.20 20-Apr-1997 tholo

New POSIX 1003.1b syscalls; from pk@NetBSD


# 1.19 04-Apr-1997 deraadt

seek(2) is not needed


# 1.18 29-Mar-1997 deraadt

futimes link; nakayosh@kcn.or.jp


# 1.17 26-Mar-1997 deraadt

install ktrace(2)


# 1.16 26-Jan-1997 downsj

Add a link for lchown.2


# 1.15 26-Jan-1997 downsj

Add lchown(), increment minor number.


# 1.14 11-Dec-1996 deraadt

generate reboot.o like other system calls


Revision tags: OPENBSD_2_0_BASE
# 1.13 02-Sep-1996 deraadt

shmdt link


# 1.12 25-Aug-1996 deraadt

and a man page


# 1.11 18-Jun-1996 deraadt

build poll.o


# 1.10 19-May-1996 pefo

Changes for mips.


# 1.9 18-May-1996 deraadt

poll() as a system call


# 1.8 08-May-1996 deraadt

install rfork man page


# 1.7 01-May-1996 deraadt

add futimes


# 1.6 25-Mar-1996 tholo

Add support for building lint(1) library


# 1.5 29-Jan-1996 tholo

Add kernel PLL for system clock
Add ntp_adjtime() and ntp_gettime() system calls
Mostly stolen from FreeBSD


# 1.4 08-Jan-1996 deraadt

add rfork.o and minherit.o


# 1.3 07-Jan-1996 deraadt

add minherit() system call


# 1.2 14-Dec-1995 deraadt

from netbsd:
add & fix a bunch of system call pages


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.176 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


# 1.175 11-Dec-2023 deraadt

document upcoming pinsyscalls(2) system call
ok kettenis, some tweaks from jmc


Revision tags: OPENBSD_7_4_BASE
# 1.174 20-Aug-2023 visa

Add syscall stub for kqueue1(2)

This rides previous libc minor bump.

Feedback and OK guenther@


Revision tags: OPENBSD_7_3_BASE
# 1.173 27-Feb-2023 deraadt

Calculate the size of the static (and profiled static) execve syscall stub
and store it in a const variable for use by crt0.
help from kettenis and miod


# 1.172 21-Feb-2023 deraadt

create a stub for pinsyscall(2)
ok guenther


# 1.171 16-Feb-2023 deraadt

Document pinsyscall(2). The ld.so and kernel enforcement code is not
commited ye -- waiting for enough people to run kernels which support
the system call.
ok jmc


# 1.170 11-Feb-2023 deraadt

__syscall() is no longer neccessary since the system calls which needed
it are now unpadded
ok kettenis guenther


# 1.169 08-Jan-2023 guenther

Add getthrname(2) manpage

ok jmc@ schwarze@


# 1.168 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@


# 1.167 19-Dec-2022 guenther

Add waitid(2) manpage, based on a first pass by espie@ and bits
from FreeBSD and NetBSD.

ok kettenis@ jmc@ espie@


# 1.166 26-Oct-2022 kettenis

Add waitid(2) syscall stub.

Minor bump to both libc and libpthread: make sure you install a new kernel!

ok millert@, deraadt@


# 1.165 07-Oct-2022 deraadt

Add mimmutable(2) libc stub, add & adjust manual pages, and crank the minor.
ok kettenis


Revision tags: OPENBSD_7_2_BASE
# 1.164 09-Sep-2022 mbuhl

Add libc wrappers for the new sendmmsg and recvmmsg system calls.
Feedback tb@, miod@, jca@
OK jca@


# 1.163 17-Jul-2022 deraadt

Add ypconnect(2) stub inside libc so that libc functions can use it,
but do not export it.


# 1.162 17-Jul-2022 deraadt

add ypconnect(2) manual page


Revision tags: OPENBSD_7_1_BASE
# 1.161 23-Dec-2021 guenther

Roll the syscalls that have an off_t argument to remove the explicit padding.
Switch libc and ld.so to the generic stubs for these calls.
WARNING: reboot to updated kernel before installing libc or ld.so!

Time for a story...

When gcc (back in 1.x days) first implemented long long, it didn't (always)
pass 64bit arguments in 'aligned' registers/stack slots, with the result that
argument offsets didn't match structure offsets. This affected the nine system
calls that pass off_t arguments:
ftruncate lseek mmap mquery pread preadv pwrite pwritev truncate

To avoid having to do custom ASM wrappers for those, BSD put an explicit pad
argument in so that the off_t argument would always start on a even slot and
thus be naturally aligned. Thus those odd wrappers in lib/libc/sys/ that use
__syscall() and pass an extra '0' argument.

The ABIs for different CPUs eventually settled how things should be passed on
each and gcc 2.x followed them. The only arch now where it helps is landisk,
which needs to skip the last argument register if it would be the first half of
a 64bit argument. So: add new syscalls without the pad argument and on landisk
do that skipping directly in the syscall handler in the kernel. Keep compat
support for the existing syscalls long enough for the transition.

ok deraadt@


Revision tags: OPENBSD_7_0_BASE
# 1.160 11-Jun-2021 kettenis

Since futex(2) can fail, it needs a full syscall stub. This should fixes
issues on powerpc64 and sparc64.

Note that this makes the lib/libpthread/errno test fail since that test
detects that we are touching errno now. This will be addressed in a
future diff as it is not entirely clear whether the test is correct.

ok mpi@, bluhm@


Revision tags: OPENBSD_6_8_BASE OPENBSD_6_9_BASE
# 1.159 06-Jul-2020 pirofti

Add support for timeconting in userland.

This diff exposes parts of clock_gettime(2) and gettimeofday(2) to
userland via libc eliberating processes from the need for a context
switch everytime they want to count the passage of time.

If a timecounter clock can be exposed to userland than it needs to set
its tc_user member to a non-zero value. Tested with one or multiple
counters per architecture.

The timing data is shared through a pointer found in the new ELF
auxiliary vector AUX_openbsd_timekeep containing timehands information
that is frequently updated by the kernel.

Timing differences between the last kernel update and the current time
are adjusted in userland by the tc_get_timecount() function inside the
MD usertc.c file.

This permits a much more responsive environment, quite visible in
browsers, office programs and gaming (apparently one is are able to fly
in Minecraft now).

Tested by robert@, sthen@, naddy@, kmos@, phessler@, and many others!

OK from at least kettenis@, cheloha@, naddy@, sthen@


Revision tags: OPENBSD_6_7_BASE
# 1.158 27-Nov-2019 deraadt

Document msyscall(2): ld.so can use this (once only) to tell the kernel
where libc.so's text segment is, thereby allowing invocation of system
calls from that region. An upcoming change will kill the process if a
system call is invoked from addresses not explicitly permitted.
ok guenther kettenis mortimer


Revision tags: OPENBSD_6_6_BASE
# 1.157 28-May-2019 beck

Enable the use of the kernel __realpath() system call in the libc wrapper.

For now, this also still uses the existing realpath implmentation
and emits a syslog if we see differening results. Once we have run
with that for a little while we will remove the old code

ok deraadt@


Revision tags: OPENBSD_6_5_BASE
# 1.156 11-Jan-2019 deraadt

mincore() is a relic from the past, exposing physical machine information
about shared resources which no program should see. only a few pieces of
software use it, generally poorly thought out. they are being fixed, so
mincore() can be deleted.
ok guenther tedu jca sthen, others


Revision tags: OPENBSD_6_4_BASE
# 1.155 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.154 12-Jan-2018 deraadt

sysctl(3) can now be renamed to sysctl(2)


# 1.153 28-Nov-2017 guenther

Delete fktrace(2). The consequences of it were not thought through
sufficiently and at least one horrific security hole was the result.

ok deraadt@ beck@


Revision tags: OPENBSD_6_2_BASE
# 1.152 13-Aug-2017 tedu

add fktrace to libc


# 1.151 12-Aug-2017 guenther

Instead of hardcoding a partial dependency list for the syscall stub objects,
calculate them as done for other objects


# 1.150 31-May-2017 sthen

install futex(2), ok mpi


# 1.149 30-Apr-2017 mpi

Add futex(2) shim, bump minor.

Inputs from guenther@, ok kettenis@, visa@


Revision tags: OPENBSD_6_1_BASE
# 1.148 29-Mar-2017 deraadt

The hppa version of as(1) requires whitespace before a .file directive,
it may not be in column 0. This kind of thing is very common in GNU
and Linux software because the software was written from the start to
be 'compatible replacements' of vendor software.
ok jsing guenther


# 1.147 26-Mar-2017 guenther

Use .file to convince 'as' to generate proper FILE symbols in the syscall
stubs that aren't actually in files, so that syspatch can figure out what
order the syscall stub objects are in the .so. Use -P to suppress to #line
directives that would override that. Tested with both gcc/gas and clang.

ok deraadt@


Revision tags: OPENBSD_6_0_BASE
# 1.146 04-Jul-2016 guenther

DEBUGLIBS has been broken since the gcc4 switch, so delete it. CFLAGS
contains -g by default anyway

problem noted by Edgar Pettijohn (edgar (at) pettijohn-web.com)
ok millert@ kettenis@ deraadt@


# 1.145 30-May-2016 guenther

Move __getcwd from ASM to HIDDEN: we don't want the literal __getcwd symbol

ok millert@ deraadt@


# 1.144 19-May-2016 guenther

Add ASM_NOERR for syscalls that never fail and thus don't need the errno
setting logic...which can significantly reduce the size of the stub on
some archs; 20 syscalls get a trim with this.

in snaps for a bit and ok deraadt@


# 1.143 09-May-2016 guenther

Remove sigreturn declaration and the now-unused libc syscall stub


# 1.142 07-May-2016 guenther

Use a Thread Information Block in both single and multi-threaded programs.
This stores errno, the cancelation flags, and related bits for each thread
and is allocated by ld.so or libc.a. This is an ABI break from 5.9-stable!

Make libpthread dlopen'able by moving the cancelation wrappers into libc
and doing locking and fork/errno handling via callbacks that libpthread
registers when it first initializes. 'errno' *must* be declared via
<errno.h> now!

Clean up libpthread's symbol exports like libc.

On powerpc, offset the TIB/TCB/TLS data from the register per the ELF spec.

Testing by various, particularly sthen@ and patrick@
ok kettenis@


# 1.141 30-Mar-2016 guenther

Turd polish: use HIDDEN= instead of PSEUDO= for ptrace syscall stub, to
make its underlying symbol name look like others.


# 1.140 30-Mar-2016 guenther

Eliminate userspace caching by getlogin_r/setlogin; make the getlogin
syscall behave exactly like userspace getlogin_r() and rename it to
match. Eliminate the reduced-to-no-op wrappers of the syscalls.
Eliminate the unnecessary per-thread static buffering by getlogin().

ok kettenis@ deraadt@


# 1.139 30-Mar-2016 jmc

for some time now mandoc has not required MLINKS to function
correctly - logically complete that now by removing MLINKS from base;

authors need only to ensure there is an entry in NAME for any function/
util being added. MLINKS will still work, and remain for perl to ease
upgrades;

ok nicm (curses) bcook (ssl)
ok schwarze, who provided a lot of feedback and assistance
ok tb natano jung


# 1.138 21-Mar-2016 bluhm

Rename the system call sendsyslog2 to sendsyslog. Keep the old one
as osendsyslog for a while. The three argument variant is the only
one that will stay.
input kettenis@; OK deraadt@


Revision tags: OPENBSD_5_9_BASE
# 1.137 25-Nov-2015 deraadt

Add a syscall stub for sendsyslog2(2), and use it in syslog_r(3), passing
LOG_CONS to the kernel. As a result, the /dev/console opening code can
be removed.
ok kettenis millert beck


# 1.136 10-Nov-2015 guenther

Split the intra-thread functionality from kill(2) into its own syscall
thrkill(2), rolling the kill(2) syscall number with the ABI change to
avoid breaking binaries during during the transition. thrkill(2) includes
a 'tcb' argument that eliminates the need for locking in pthread_kill()
and simplifies pthread_cancel(). Switch __stack_smash_handler() to use
thrkill(2) and explicitly unblock SIGABRT.

Minor bump to both libc and libpthread: make sure you install a new kernel!

ok semarie@


# 1.135 23-Oct-2015 guenther

Merge the sigaction() and sigprocmask() overloads/wrappers from libpthread
into libc, and move pthread_sigmask() as well (just a trivial wrapper).
This provides consistent handling of SIGTHR between single- and multi-threaded
programs and is a step in the merge of all the libpthread overloads, providing
some ASM and Makefile bits that the other wrappers will need.

ok deraadt@ millert@


# 1.134 23-Oct-2015 deraadt

Remove dnssocket() and dnsconnect(), since we decided to use a SOCK_DNS
flag instead.
ok guenther tedu semarie


# 1.133 19-Oct-2015 deraadt

Remove old tame() stub


# 1.132 18-Oct-2015 deraadt

create libc stubs for dnssocket() and dnsconnect()


# 1.131 09-Oct-2015 deraadt

tame -> pledge conversion, in libc. I should crank libc, but am cheating
hoping things go well. The old symbol is faked via a stupid stub function,
until next major crank when it can be removed. I am expecting guenther
to scream at me.


# 1.130 13-Sep-2015 guenther

Rename __sysctl syscall to just sysctl, as the userland wrapper is no longer
necessary

ok deraadt@ jsing@


# 1.129 09-Sep-2015 guenther

Simplify makefile rules for building the ASM stubs into "pick something
from column A and something from column B".

ok miod@ deraadt@


# 1.128 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@


# 1.127 25-Aug-2015 guenther

Document kbind(2)


Revision tags: OPENBSD_5_8_BASE
# 1.126 19-Jul-2015 deraadt

manual page for tame(2). not very good, so i will be hearing from jmc


# 1.125 07-Apr-2015 guenther

Make pthread_atfork() track the DSO that called it like atexit() does,
unregistering callbacks if the DSO is unloaded. Move the callback
handling from libpthread to libc, though libpthread still overrides the
inner call to handle locking and thread-library reinitialization.
Major version bump for both libc and libpthread.

verification that this fixes various ports ajacoutot@
asm assistance miod@; ok millert@ deraadt@


Revision tags: OPENBSD_5_7_BASE
# 1.124 08-Dec-2014 guenther

Add chflagsat(), modeled on fchmodat() with name to match FreeBSD.


# 1.123 14-Nov-2014 guenther

Add sched_yield(2) manpage


# 1.122 31-Aug-2014 guenther

Declare and document getthrid()

indirectly prodded by krw@


# 1.121 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@


# 1.120 14-Aug-2014 tobias

fixed overrid(d)en typo

millert@ and jmc@ agree that "overriden" is wrong


Revision tags: OPENBSD_5_6_BASE
# 1.119 12-Jul-2014 deraadt

document sendsyslog(2); ok guenther tedu matthew


# 1.118 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.117 18-Mar-2014 miod

Retire hp300, mvme68k and mvme88k ports. These ports have no users, keeping
this hardware alive is becoming increasingly difficult, and I should heed the
message sent by the three disks which have died on me over the last few days.

Noone sane will mourn these ports anyway. So long, and thanks for the fish.


Revision tags: OPENBSD_5_5_BASE
# 1.116 13-Oct-2013 guenther

Make it possible to build to reduced version of a library, including
just specific objects that are compiled with additional options to
reduce their size. For use by distrib/ and crunchgen.

style and naming assistance from espie@


# 1.115 07-Oct-2013 guenther

getdirentries(2) is dead; long live getdents(2)!

confirmation that getdirentries(2) is unused by ports from sthen@ and naddy@


# 1.114 13-Aug-2013 guenther

Switch time_t, ino_t, clock_t, and struct kevent's ident and data
members to 64bit types. Assign new syscall numbers for (almost
all) the syscalls that involve the affected types, including anything
with time_t, timeval, itimerval, timespec, rusage, dirent, stat,
or kevent arguments. Add a d_off member to struct dirent and replace
getdirentries() with getdents(), thus immensely simplifying and
accelerating telldir/seekdir. Build perl with -DBIG_TIME.

Bump the major on every single base library: the compat bits included
here are only good enough to make the transition; the T32 compat
option will be burned as soon as we've reached the new world are
are happy with the snapshots for all architectures.

DANGER: ABI incompatibility. Updating to this kernel requires extra
work or you won't be able to login: install a snapshot instead.

Much assistance in fixing userland issues from deraadt@ and tedu@
and build assistance from todd@ and otto@


Revision tags: OPENBSD_5_4_BASE
# 1.113 05-Jun-2013 guenther

Move _Exit() from the exit() manpage to the _exit() manpage, as it's
just an alias of the latter.

ok matthew@ tedu@


# 1.112 01-Jun-2013 miod

Add utrace(2), a system call allowing for userland to send its own ktrace
records. From FreeBSD via otto@, with tweaks suggested by guenther@.
Commite on behalf of otto@ who is not around, to ride the libc minor bump.
Causes a librthread minor bump as well (new syscall).


# 1.111 29-Apr-2013 matthew

Extend P_SIGSUSPEND handling in userret() to properly restore the
sigmask even if there are no pending signals under the temporary
sigmask.

Refactor existing select() and poll() system calls to introduce the
pselect() and ppoll() system calls.

Add rthread wrappers for pselect() and ppoll(). While there, update
cancellation point comments to reflect recent fdatasync() addition.

Minor bumps for libc and librthread due to new symbols.

ok guenther, millert, deraadt, jmc


# 1.110 15-Apr-2013 matthew

Implement fdatasync() as a wrapper around fsync()

ok guenther, deraadt, jmc


Revision tags: OPENBSD_5_3_BASE
# 1.109 03-Feb-2013 miod

gremlin crept in


# 1.108 02-Feb-2013 miod

Userland bits for m68k/ELF. Mostly addition of register prefixes to the
assembler instructions, and cope with the few changes in return values
location.


# 1.107 04-Sep-2012 okan

remove lint leftovers; ok guenther@


# 1.106 23-Aug-2012 deraadt

no more nnpfspioctl() system call; ok guenther


# 1.105 22-Aug-2012 pascal

Convert cpp | as rules in bsd.lib.mk and lib/libc/sys/Makefile.inc to pure cc
invocations. This allows us to use the compiler builtin define __PIC__ to check
for PIC/PIEness rather than passing -DPIC. Simplifies PIE work a lot.

ok matthew@, conceptually ok kurt@


# 1.104 21-Aug-2012 pascal

Kill an old mips workaround; we don't support mips, just mips64.

ok deraadt@ kettenis@


Revision tags: OPENBSD_5_2_BASE
# 1.103 19-Jun-2012 deraadt

oops, forgot to install getdtablecount(2); noted by tedu


# 1.102 12-Apr-2012 deraadt

remove rfork(); ok guenther miod


# 1.101 12-Apr-2012 deraadt

kill lfs system call lines and libc stubs


# 1.100 12-Apr-2012 deraadt

New system call: getdtablecount(2) returns the number of file
descriptors the process currently has open.
ok guenther miod gilles ...


# 1.99 22-Mar-2012 guenther

Move __tfork_thread() from rthreads (libpthread) to libc so that
it can be used for not-strictly-threading purposes

ok matthew@ kurt@


# 1.98 13-Mar-2012 guenther

Add manpages for __thrsigdivert, __thrsleep, and __thrwakeup. Various
syntax and grammar fixes from jmc@


Revision tags: OPENBSD_5_1_BASE
# 1.97 17-Jan-2012 guenther

Reimplement mutexes, condvars, and rwlocks to eliminate bugs,
particularly the "consume the signal you just sent" hang, and putting
the wait queues in userspace.

Do cancellation handling in pthread_cond_*wait(), pthread_join(),
and sem_wait().

Add __ prefix to thr{sleep,wakeup,exit,sigdivert}() syscalls; add
'abort" argument to thrsleep to close cancellation race; make
thr{sleep,wakeup} return errno values via *retval to avoid touching
userspace errno.


# 1.96 22-Nov-2011 guenther

sigstack() is long dead, and the compat sigaltstack syscall is gone too.
Correct the namespace protections for sigreturn(), sigwait(), and psignal()

ok millert@


# 1.95 16-Oct-2011 guenther

Add stubs and manpage for __{get,set}_tcb

ok deraadt@


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

Add (rough draft) documentation for fdopendir(3) and the 15 new
XXXat(2) system calls from POSIX 2008. Editing will be done in tree.

General style discussed with jmc@, schwarze@, and deraadt@
ok jmc@


# 1.93 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@


Revision tags: OPENBSD_4_8_BASE OPENBSD_4_9_BASE
# 1.92 03-Jul-2010 guenther

Fix the naming of interfaces and variables for rdomains and rtables
and make it possible to bind sockets (including listening sockets!)
to rtables and not just rdomains. This changes the name of the
system calls, socket option, and ioctl. After building with this
you should remove the files /usr/share/man/cat2/[gs]etrdomain.0.

Since this removes the existing [gs]etrdomain() system calls, the
libc major is bumped.

Written by claudio@, criticized^Wcritiqued by me


# 1.91 01-Jul-2010 deraadt

getpeereid() can now be a library routine using getsockopt() with
SOL_SOCKET and SO_PEERCRED, only issue being that it cannot return
EFAULT for a page fault. The kernel code will soon be put into
compat, and then in 10 years or so tedu will delete it.
ok guenther millert


# 1.90 18-May-2010 tedu

add posix_madvise, posix_memalign, strndup, and strnlen. mostly from
brad and millert, with hints from guenther, jmc, and otto I think.
ok previous.


Revision tags: OPENBSD_4_7_BASE
# 1.89 03-Feb-2010 miod

Use MACHINE_CPU instead of MACHINE_ARCH to pick the correct machine dependent
files or directories when applicable.
The inspiration and name of MACHINE_CPU come from NetBSD, although the way to
provide it to Makefiles is completely different.
ok kettenis@


# 1.88 27-Nov-2009 guenther

Add setrdomain() and getrdomain() system calls. Committing now to
catch the libc major bump per request from deraadt@

Diff by reyk.

ok guenther@


# 1.87 13-Aug-2009 jmc

various MLINK fixes from Alan R. S. Bueno;


Revision tags: OPENBSD_4_6_BASE
# 1.86 03-Jun-2009 jj

Arla client rename from xfs to nnpfs for later upgrades. Tested on various arches. ok todd@ beck@


Revision tags: OPENBSD_4_4_BASE OPENBSD_4_5_BASE
# 1.85 22-Mar-2008 otto

move statvfs.c to gen, since it is not a syscall; ok deraadt@


# 1.84 16-Mar-2008 otto

statvfs support


Revision tags: OPENBSD_4_3_BASE
# 1.83 05-Jan-2008 deraadt

no more need for vadvise.o


# 1.82 09-Sep-2007 otto

Add lint stubs for the longjmp family of functions which are defined in
assembly on all platforms. ok deraadt@


# 1.81 09-Sep-2007 otto

Silence erroneous "environ used, but not defined" lint warning by
providing a stub. ok deraadt@


Revision tags: OPENBSD_4_1_BASE OPENBSD_4_2_BASE
# 1.80 24-Oct-2006 tedu

add rthread syscalls and bump minor.
rthreads are hardly done, but if just trying it out is too much of a hassle,
we'll never make more progress.
ok brad marc marco mbalmer


# 1.79 10-Oct-2006 deraadt

MLINKS to macros described in stat(2)


Revision tags: OPENBSD_4_0_BASE
# 1.78 14-Jun-2006 otto

Introducing adjfreq(2), to adjust the clock frequency.
Loosely based on dragonfly code. Man page help fro jmc@; ok deraadt@


# 1.77 27-May-2006 pedro

Make libc's getcwd() use the new __getcwd() system call
Hacked by marius@ at c2k5, okay miod@ krw@ deraadt@


# 1.76 13-Mar-2006 moritz

Clean the correct file. ok deraadt@


Revision tags: OPENBSD_3_9_BASE
# 1.75 29-Nov-2005 deraadt

Provide stubs for things which are supplied by crt0. I don't think we
want a crt0.ln, at least, not yet. We may reconsider later.


# 1.74 03-Oct-2005 jmc

add missing MLINK for WEXITSTATUS.2


Revision tags: OPENBSD_3_8_BASE
# 1.73 17-Jun-2005 drahn

Extended Attributes was a piece to get to ACLs, however ACLs have not
been worked on, so EA is pointless to maintain.


# 1.72 17-Jun-2005 millert

remove undelete syscall


Revision tags: OPENBSD_3_7_BASE
# 1.71 18-Sep-2004 deraadt

MLINK to macros provided in wait.2


# 1.70 16-Sep-2004 deraadt

add files missing for building a proper lint library


Revision tags: OPENBSD_3_5_BASE OPENBSD_3_6_BASE
# 1.69 13-Feb-2004 tedu

death to osigaltstack. ok deraadt@


# 1.68 15-Jan-2004 deraadt

ABI breakage happened with the sigaltstack replacement. It is too late,
now we just have to cope. Since setjmp uses it, the alpha and sparc64 are
unhappy with the structure change. In a few days, we will make the second
hop here, for now, use the old system call until all binaries have the new
struct in them.


# 1.67 12-Jan-2004 tedu

new syscall closefrom(2). ok deraadt millert


Revision tags: OPENBSD_3_4_BASE
# 1.66 10-May-2003 miod

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


# 1.65 14-Apr-2003 art

There are two related changes.

The first one is an mquery(2) syscall. It's for asking the VM system
about where to map things. It will be used by ld.so, read the man page
for details.

The second change is related and is a centralization of uvm_map hint
that all callers of uvm_map calculated. This will allow us to adjust
this hint on architectures that have segments for non-exec mappings.

deraadt@ drahn@ ok.


Revision tags: OPENBSD_3_3_BASE
# 1.64 31-Jan-2003 millert

Replace emulated versions of setreuid() and setregid() with real syscalls.
These are spec'd by POSIX as of 1003.1-2001; deraadt@ OK


# 1.63 02-Dec-2002 millert

Document getlogin_r()


# 1.62 02-Dec-2002 miod

Import propolice (http://www.trl.ibm.com/projects/security/ssp), a stack
attack protection scheme, into gcc.

This protection is enabled by default. It can be turned off by using the
-fno-stack-protector flag.

Code by Hiroaki Etoh (etoh at jp dot ibm dot com); work on openbsd-specific
integration by fgsch@, deraadt@ and myself; tests by fgsch@, naddy@ and
myself; beer drinking by myself.

Please note that system upgrades with this new code will require a new
libc and ld.so to be build and installed before the propolice-enabled
compiler can be installed.


# 1.61 10-Nov-2002 fgsch

missing MLINKs for setresuid(2). millert ok.


# 1.60 05-Nov-2002 marc

thread safe libc -- 2nd try. OK miod@, millert@
Thanks to miod@ for m68k and vax fixes


# 1.59 03-Nov-2002 marc

back out previous patch.. there are still some vax/m68k issues


# 1.58 03-Nov-2002 marc

libc changes for thread safety. Tested on:
alpha (millert@), i386 (marc@), m68k (millert@ and miod@),
powerpc (drahn@ and dhartmei@), sparc (millert@ and marc@),
sparc64 (marc@), and vax (millert@ and miod@).
Thanks to millert@, miod@, and mickey@ for fixes along the way.


# 1.57 30-Oct-2002 millert

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


Revision tags: OPENBSD_3_2_BASE
# 1.56 05-Aug-2002 art

Fix brain blackout.
Pointed out byb miod@.


# 1.55 05-Aug-2002 art

One more ELF_TOOLCHAIN.


# 1.54 06-Jul-2002 nordin

Remove kernel support for NTP. ok deraadt@ and tholo@


# 1.53 10-Jun-2002 fgsch

correct comment.


# 1.52 08-Jun-2002 drahn

ELF architectures all support weak aliases, enable them for this part.
ok fgsch@


Revision tags: OPENBSD_3_1_BASE
# 1.51 22-Feb-2002 drahn

Extended Attribute support, from FreeBSD/TrustedBSD. ok art@ deraadt@
libc support pieces


# 1.50 21-Feb-2002 art

remove rfork.o from the auto-generated assembler stubs


# 1.49 17-Feb-2002 deraadt

rfork() needs a fork.S-like stub as well; ok art


Revision tags: OPENBSD_3_0_BASE
# 1.48 25-Sep-2001 niklas

Forgotten DEBUGLIBS stuff


# 1.47 25-Sep-2001 drahn

Add an ASPICFLAG variable to bsd.own.mk which a platform use to pass flags
to 'as' to make it compile pic. add defaults for sparc64 which needs picflags
set to -fPIC and ASPICFLAGS to -KPIC.
Also simplifies the systemcall generation for sparc64 PIC mode.
ok epsie@.


# 1.46 20-Sep-2001 millert

Add PSEUDO_NOERROR similar to that used by NetBSD.
Some ports were setting errno in PSEUDO and some were not. Now errno
is set for all in PSEUDO and PSEUDO_NOERROR is provided for the
non-errno case (only used by _exit).

Needs testing on vax and m88k.
XXX - hppa and powerpc still lack a real PSEUDO_NOERROR implementation.
Currently PSEUDO_NOERROR and PSEUDO are the same (so builds don't
break on those platforms).


# 1.45 09-Jul-2001 fgsch

Install getpeereid(2) manpage.


# 1.44 26-Jun-2001 dugsong

implement djb's getpeereid(2), to allow local-domain servers to determine client credentials. mostly from superscript.com. deraadt@ ok


Revision tags: OPENBSD_2_9_BASE
# 1.43 14-Mar-2001 aaron

Move description of exect() to execve(2) man page. Add a note about exect() not
being portable.


# 1.42 09-Mar-2001 art

Add mlockall and munlockall. man-page from NetBSD.


# 1.41 10-Jan-2001 deraadt

put up FD_* manual pages, in section 3


# 1.40 23-Dec-2000 deraadt

create proper docs for timer{add,clear,sub,isset,cmp}


# 1.39 16-Nov-2000 provos

kqueue and kevent system calls


Revision tags: OPENBSD_2_8_BASE
# 1.38 17-Oct-2000 deraadt

damn it, i have had it with this untested weak shit


# 1.37 16-Oct-2000 deraadt

re-add weak sparc support; d@


# 1.36 15-May-2000 niklas

Add support for building libraries with debugging information in them.
Enable by setting DEBUGLIBS=yes in /etc/mk.conf, then -g libraries will get
installed in /usr/lib/debug. This directory will be searched first if
gcc is given the -g flag during the link stage.


Revision tags: OPENBSD_2_7_BASE
# 1.35 01-May-2000 deraadt

bye bye semconfig(2)


# 1.34 20-Apr-2000 deraadt

p{read,write}{,v} man pages


# 1.33 07-Feb-2000 assar

add fhopen, fhstat, fhstatfs system calls. largely from NetBSD


# 1.32 06-Jan-2000 d

for now, disable weak aliases for all archs except i386


# 1.31 14-Dec-1999 millert

Install swapctl.2, not swapon.2. swapon.2 should probably go away.


Revision tags: OPENBSD_2_6_BASE
# 1.30 07-Jun-1999 deraadt

replacement pipe() system call; copies data into place inside kernel, so
that EFAULT return value is possible


# 1.29 22-May-1999 weingart

Add swapctl(2), and crank shlib minor.


Revision tags: OPENBSD_2_5_BASE
# 1.28 01-Feb-1999 d

mi ptrace


# 1.27 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


Revision tags: OPENBSD_2_4_BASE
# 1.26 18-Sep-1998 art

make use of xfspioctl


Revision tags: OPENBSD_2_3_BASE
# 1.25 08-Feb-1998 tholo

Better lint(1) framework. Mostly from cgd@NetBSD


# 1.24 13-Nov-1997 deraadt

add getsid(2), XPG4


Revision tags: OPENBSD_2_2_BASE
# 1.23 30-May-1997 kstailey

add getpgrp(2) from NetBSD


Revision tags: OPENBSD_2_1_BASE
# 1.22 08-May-1997 kstailey

add tag


# 1.21 08-May-1997 kstailey

make clock_gettime.cat2


# 1.20 20-Apr-1997 tholo

New POSIX 1003.1b syscalls; from pk@NetBSD


# 1.19 04-Apr-1997 deraadt

seek(2) is not needed


# 1.18 29-Mar-1997 deraadt

futimes link; nakayosh@kcn.or.jp


# 1.17 26-Mar-1997 deraadt

install ktrace(2)


# 1.16 26-Jan-1997 downsj

Add a link for lchown.2


# 1.15 26-Jan-1997 downsj

Add lchown(), increment minor number.


# 1.14 11-Dec-1996 deraadt

generate reboot.o like other system calls


Revision tags: OPENBSD_2_0_BASE
# 1.13 02-Sep-1996 deraadt

shmdt link


# 1.12 25-Aug-1996 deraadt

and a man page


# 1.11 18-Jun-1996 deraadt

build poll.o


# 1.10 19-May-1996 pefo

Changes for mips.


# 1.9 18-May-1996 deraadt

poll() as a system call


# 1.8 08-May-1996 deraadt

install rfork man page


# 1.7 01-May-1996 deraadt

add futimes


# 1.6 25-Mar-1996 tholo

Add support for building lint(1) library


# 1.5 29-Jan-1996 tholo

Add kernel PLL for system clock
Add ntp_adjtime() and ntp_gettime() system calls
Mostly stolen from FreeBSD


# 1.4 08-Jan-1996 deraadt

add rfork.o and minherit.o


# 1.3 07-Jan-1996 deraadt

add minherit() system call


# 1.2 14-Dec-1995 deraadt

from netbsd:
add & fix a bunch of system call pages


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.175 11-Dec-2023 deraadt

document upcoming pinsyscalls(2) system call
ok kettenis, some tweaks from jmc


Revision tags: OPENBSD_7_4_BASE
# 1.174 20-Aug-2023 visa

Add syscall stub for kqueue1(2)

This rides previous libc minor bump.

Feedback and OK guenther@


Revision tags: OPENBSD_7_3_BASE
# 1.173 27-Feb-2023 deraadt

Calculate the size of the static (and profiled static) execve syscall stub
and store it in a const variable for use by crt0.
help from kettenis and miod


# 1.172 21-Feb-2023 deraadt

create a stub for pinsyscall(2)
ok guenther


# 1.171 16-Feb-2023 deraadt

Document pinsyscall(2). The ld.so and kernel enforcement code is not
commited ye -- waiting for enough people to run kernels which support
the system call.
ok jmc


# 1.170 11-Feb-2023 deraadt

__syscall() is no longer neccessary since the system calls which needed
it are now unpadded
ok kettenis guenther


# 1.169 08-Jan-2023 guenther

Add getthrname(2) manpage

ok jmc@ schwarze@


# 1.168 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@


# 1.167 19-Dec-2022 guenther

Add waitid(2) manpage, based on a first pass by espie@ and bits
from FreeBSD and NetBSD.

ok kettenis@ jmc@ espie@


# 1.166 26-Oct-2022 kettenis

Add waitid(2) syscall stub.

Minor bump to both libc and libpthread: make sure you install a new kernel!

ok millert@, deraadt@


# 1.165 07-Oct-2022 deraadt

Add mimmutable(2) libc stub, add & adjust manual pages, and crank the minor.
ok kettenis


Revision tags: OPENBSD_7_2_BASE
# 1.164 09-Sep-2022 mbuhl

Add libc wrappers for the new sendmmsg and recvmmsg system calls.
Feedback tb@, miod@, jca@
OK jca@


# 1.163 17-Jul-2022 deraadt

Add ypconnect(2) stub inside libc so that libc functions can use it,
but do not export it.


# 1.162 17-Jul-2022 deraadt

add ypconnect(2) manual page


Revision tags: OPENBSD_7_1_BASE
# 1.161 23-Dec-2021 guenther

Roll the syscalls that have an off_t argument to remove the explicit padding.
Switch libc and ld.so to the generic stubs for these calls.
WARNING: reboot to updated kernel before installing libc or ld.so!

Time for a story...

When gcc (back in 1.x days) first implemented long long, it didn't (always)
pass 64bit arguments in 'aligned' registers/stack slots, with the result that
argument offsets didn't match structure offsets. This affected the nine system
calls that pass off_t arguments:
ftruncate lseek mmap mquery pread preadv pwrite pwritev truncate

To avoid having to do custom ASM wrappers for those, BSD put an explicit pad
argument in so that the off_t argument would always start on a even slot and
thus be naturally aligned. Thus those odd wrappers in lib/libc/sys/ that use
__syscall() and pass an extra '0' argument.

The ABIs for different CPUs eventually settled how things should be passed on
each and gcc 2.x followed them. The only arch now where it helps is landisk,
which needs to skip the last argument register if it would be the first half of
a 64bit argument. So: add new syscalls without the pad argument and on landisk
do that skipping directly in the syscall handler in the kernel. Keep compat
support for the existing syscalls long enough for the transition.

ok deraadt@


Revision tags: OPENBSD_7_0_BASE
# 1.160 11-Jun-2021 kettenis

Since futex(2) can fail, it needs a full syscall stub. This should fixes
issues on powerpc64 and sparc64.

Note that this makes the lib/libpthread/errno test fail since that test
detects that we are touching errno now. This will be addressed in a
future diff as it is not entirely clear whether the test is correct.

ok mpi@, bluhm@


Revision tags: OPENBSD_6_8_BASE OPENBSD_6_9_BASE
# 1.159 06-Jul-2020 pirofti

Add support for timeconting in userland.

This diff exposes parts of clock_gettime(2) and gettimeofday(2) to
userland via libc eliberating processes from the need for a context
switch everytime they want to count the passage of time.

If a timecounter clock can be exposed to userland than it needs to set
its tc_user member to a non-zero value. Tested with one or multiple
counters per architecture.

The timing data is shared through a pointer found in the new ELF
auxiliary vector AUX_openbsd_timekeep containing timehands information
that is frequently updated by the kernel.

Timing differences between the last kernel update and the current time
are adjusted in userland by the tc_get_timecount() function inside the
MD usertc.c file.

This permits a much more responsive environment, quite visible in
browsers, office programs and gaming (apparently one is are able to fly
in Minecraft now).

Tested by robert@, sthen@, naddy@, kmos@, phessler@, and many others!

OK from at least kettenis@, cheloha@, naddy@, sthen@


Revision tags: OPENBSD_6_7_BASE
# 1.158 27-Nov-2019 deraadt

Document msyscall(2): ld.so can use this (once only) to tell the kernel
where libc.so's text segment is, thereby allowing invocation of system
calls from that region. An upcoming change will kill the process if a
system call is invoked from addresses not explicitly permitted.
ok guenther kettenis mortimer


Revision tags: OPENBSD_6_6_BASE
# 1.157 28-May-2019 beck

Enable the use of the kernel __realpath() system call in the libc wrapper.

For now, this also still uses the existing realpath implmentation
and emits a syslog if we see differening results. Once we have run
with that for a little while we will remove the old code

ok deraadt@


Revision tags: OPENBSD_6_5_BASE
# 1.156 11-Jan-2019 deraadt

mincore() is a relic from the past, exposing physical machine information
about shared resources which no program should see. only a few pieces of
software use it, generally poorly thought out. they are being fixed, so
mincore() can be deleted.
ok guenther tedu jca sthen, others


Revision tags: OPENBSD_6_4_BASE
# 1.155 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.154 12-Jan-2018 deraadt

sysctl(3) can now be renamed to sysctl(2)


# 1.153 28-Nov-2017 guenther

Delete fktrace(2). The consequences of it were not thought through
sufficiently and at least one horrific security hole was the result.

ok deraadt@ beck@


Revision tags: OPENBSD_6_2_BASE
# 1.152 13-Aug-2017 tedu

add fktrace to libc


# 1.151 12-Aug-2017 guenther

Instead of hardcoding a partial dependency list for the syscall stub objects,
calculate them as done for other objects


# 1.150 31-May-2017 sthen

install futex(2), ok mpi


# 1.149 30-Apr-2017 mpi

Add futex(2) shim, bump minor.

Inputs from guenther@, ok kettenis@, visa@


Revision tags: OPENBSD_6_1_BASE
# 1.148 29-Mar-2017 deraadt

The hppa version of as(1) requires whitespace before a .file directive,
it may not be in column 0. This kind of thing is very common in GNU
and Linux software because the software was written from the start to
be 'compatible replacements' of vendor software.
ok jsing guenther


# 1.147 26-Mar-2017 guenther

Use .file to convince 'as' to generate proper FILE symbols in the syscall
stubs that aren't actually in files, so that syspatch can figure out what
order the syscall stub objects are in the .so. Use -P to suppress to #line
directives that would override that. Tested with both gcc/gas and clang.

ok deraadt@


Revision tags: OPENBSD_6_0_BASE
# 1.146 04-Jul-2016 guenther

DEBUGLIBS has been broken since the gcc4 switch, so delete it. CFLAGS
contains -g by default anyway

problem noted by Edgar Pettijohn (edgar (at) pettijohn-web.com)
ok millert@ kettenis@ deraadt@


# 1.145 30-May-2016 guenther

Move __getcwd from ASM to HIDDEN: we don't want the literal __getcwd symbol

ok millert@ deraadt@


# 1.144 19-May-2016 guenther

Add ASM_NOERR for syscalls that never fail and thus don't need the errno
setting logic...which can significantly reduce the size of the stub on
some archs; 20 syscalls get a trim with this.

in snaps for a bit and ok deraadt@


# 1.143 09-May-2016 guenther

Remove sigreturn declaration and the now-unused libc syscall stub


# 1.142 07-May-2016 guenther

Use a Thread Information Block in both single and multi-threaded programs.
This stores errno, the cancelation flags, and related bits for each thread
and is allocated by ld.so or libc.a. This is an ABI break from 5.9-stable!

Make libpthread dlopen'able by moving the cancelation wrappers into libc
and doing locking and fork/errno handling via callbacks that libpthread
registers when it first initializes. 'errno' *must* be declared via
<errno.h> now!

Clean up libpthread's symbol exports like libc.

On powerpc, offset the TIB/TCB/TLS data from the register per the ELF spec.

Testing by various, particularly sthen@ and patrick@
ok kettenis@


# 1.141 30-Mar-2016 guenther

Turd polish: use HIDDEN= instead of PSEUDO= for ptrace syscall stub, to
make its underlying symbol name look like others.


# 1.140 30-Mar-2016 guenther

Eliminate userspace caching by getlogin_r/setlogin; make the getlogin
syscall behave exactly like userspace getlogin_r() and rename it to
match. Eliminate the reduced-to-no-op wrappers of the syscalls.
Eliminate the unnecessary per-thread static buffering by getlogin().

ok kettenis@ deraadt@


# 1.139 30-Mar-2016 jmc

for some time now mandoc has not required MLINKS to function
correctly - logically complete that now by removing MLINKS from base;

authors need only to ensure there is an entry in NAME for any function/
util being added. MLINKS will still work, and remain for perl to ease
upgrades;

ok nicm (curses) bcook (ssl)
ok schwarze, who provided a lot of feedback and assistance
ok tb natano jung


# 1.138 21-Mar-2016 bluhm

Rename the system call sendsyslog2 to sendsyslog. Keep the old one
as osendsyslog for a while. The three argument variant is the only
one that will stay.
input kettenis@; OK deraadt@


Revision tags: OPENBSD_5_9_BASE
# 1.137 25-Nov-2015 deraadt

Add a syscall stub for sendsyslog2(2), and use it in syslog_r(3), passing
LOG_CONS to the kernel. As a result, the /dev/console opening code can
be removed.
ok kettenis millert beck


# 1.136 10-Nov-2015 guenther

Split the intra-thread functionality from kill(2) into its own syscall
thrkill(2), rolling the kill(2) syscall number with the ABI change to
avoid breaking binaries during during the transition. thrkill(2) includes
a 'tcb' argument that eliminates the need for locking in pthread_kill()
and simplifies pthread_cancel(). Switch __stack_smash_handler() to use
thrkill(2) and explicitly unblock SIGABRT.

Minor bump to both libc and libpthread: make sure you install a new kernel!

ok semarie@


# 1.135 23-Oct-2015 guenther

Merge the sigaction() and sigprocmask() overloads/wrappers from libpthread
into libc, and move pthread_sigmask() as well (just a trivial wrapper).
This provides consistent handling of SIGTHR between single- and multi-threaded
programs and is a step in the merge of all the libpthread overloads, providing
some ASM and Makefile bits that the other wrappers will need.

ok deraadt@ millert@


# 1.134 23-Oct-2015 deraadt

Remove dnssocket() and dnsconnect(), since we decided to use a SOCK_DNS
flag instead.
ok guenther tedu semarie


# 1.133 19-Oct-2015 deraadt

Remove old tame() stub


# 1.132 18-Oct-2015 deraadt

create libc stubs for dnssocket() and dnsconnect()


# 1.131 09-Oct-2015 deraadt

tame -> pledge conversion, in libc. I should crank libc, but am cheating
hoping things go well. The old symbol is faked via a stupid stub function,
until next major crank when it can be removed. I am expecting guenther
to scream at me.


# 1.130 13-Sep-2015 guenther

Rename __sysctl syscall to just sysctl, as the userland wrapper is no longer
necessary

ok deraadt@ jsing@


# 1.129 09-Sep-2015 guenther

Simplify makefile rules for building the ASM stubs into "pick something
from column A and something from column B".

ok miod@ deraadt@


# 1.128 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@


# 1.127 25-Aug-2015 guenther

Document kbind(2)


Revision tags: OPENBSD_5_8_BASE
# 1.126 19-Jul-2015 deraadt

manual page for tame(2). not very good, so i will be hearing from jmc


# 1.125 07-Apr-2015 guenther

Make pthread_atfork() track the DSO that called it like atexit() does,
unregistering callbacks if the DSO is unloaded. Move the callback
handling from libpthread to libc, though libpthread still overrides the
inner call to handle locking and thread-library reinitialization.
Major version bump for both libc and libpthread.

verification that this fixes various ports ajacoutot@
asm assistance miod@; ok millert@ deraadt@


Revision tags: OPENBSD_5_7_BASE
# 1.124 08-Dec-2014 guenther

Add chflagsat(), modeled on fchmodat() with name to match FreeBSD.


# 1.123 14-Nov-2014 guenther

Add sched_yield(2) manpage


# 1.122 31-Aug-2014 guenther

Declare and document getthrid()

indirectly prodded by krw@


# 1.121 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@


# 1.120 14-Aug-2014 tobias

fixed overrid(d)en typo

millert@ and jmc@ agree that "overriden" is wrong


Revision tags: OPENBSD_5_6_BASE
# 1.119 12-Jul-2014 deraadt

document sendsyslog(2); ok guenther tedu matthew


# 1.118 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.117 18-Mar-2014 miod

Retire hp300, mvme68k and mvme88k ports. These ports have no users, keeping
this hardware alive is becoming increasingly difficult, and I should heed the
message sent by the three disks which have died on me over the last few days.

Noone sane will mourn these ports anyway. So long, and thanks for the fish.


Revision tags: OPENBSD_5_5_BASE
# 1.116 13-Oct-2013 guenther

Make it possible to build to reduced version of a library, including
just specific objects that are compiled with additional options to
reduce their size. For use by distrib/ and crunchgen.

style and naming assistance from espie@


# 1.115 07-Oct-2013 guenther

getdirentries(2) is dead; long live getdents(2)!

confirmation that getdirentries(2) is unused by ports from sthen@ and naddy@


# 1.114 13-Aug-2013 guenther

Switch time_t, ino_t, clock_t, and struct kevent's ident and data
members to 64bit types. Assign new syscall numbers for (almost
all) the syscalls that involve the affected types, including anything
with time_t, timeval, itimerval, timespec, rusage, dirent, stat,
or kevent arguments. Add a d_off member to struct dirent and replace
getdirentries() with getdents(), thus immensely simplifying and
accelerating telldir/seekdir. Build perl with -DBIG_TIME.

Bump the major on every single base library: the compat bits included
here are only good enough to make the transition; the T32 compat
option will be burned as soon as we've reached the new world are
are happy with the snapshots for all architectures.

DANGER: ABI incompatibility. Updating to this kernel requires extra
work or you won't be able to login: install a snapshot instead.

Much assistance in fixing userland issues from deraadt@ and tedu@
and build assistance from todd@ and otto@


Revision tags: OPENBSD_5_4_BASE
# 1.113 05-Jun-2013 guenther

Move _Exit() from the exit() manpage to the _exit() manpage, as it's
just an alias of the latter.

ok matthew@ tedu@


# 1.112 01-Jun-2013 miod

Add utrace(2), a system call allowing for userland to send its own ktrace
records. From FreeBSD via otto@, with tweaks suggested by guenther@.
Commite on behalf of otto@ who is not around, to ride the libc minor bump.
Causes a librthread minor bump as well (new syscall).


# 1.111 29-Apr-2013 matthew

Extend P_SIGSUSPEND handling in userret() to properly restore the
sigmask even if there are no pending signals under the temporary
sigmask.

Refactor existing select() and poll() system calls to introduce the
pselect() and ppoll() system calls.

Add rthread wrappers for pselect() and ppoll(). While there, update
cancellation point comments to reflect recent fdatasync() addition.

Minor bumps for libc and librthread due to new symbols.

ok guenther, millert, deraadt, jmc


# 1.110 15-Apr-2013 matthew

Implement fdatasync() as a wrapper around fsync()

ok guenther, deraadt, jmc


Revision tags: OPENBSD_5_3_BASE
# 1.109 03-Feb-2013 miod

gremlin crept in


# 1.108 02-Feb-2013 miod

Userland bits for m68k/ELF. Mostly addition of register prefixes to the
assembler instructions, and cope with the few changes in return values
location.


# 1.107 04-Sep-2012 okan

remove lint leftovers; ok guenther@


# 1.106 23-Aug-2012 deraadt

no more nnpfspioctl() system call; ok guenther


# 1.105 22-Aug-2012 pascal

Convert cpp | as rules in bsd.lib.mk and lib/libc/sys/Makefile.inc to pure cc
invocations. This allows us to use the compiler builtin define __PIC__ to check
for PIC/PIEness rather than passing -DPIC. Simplifies PIE work a lot.

ok matthew@, conceptually ok kurt@


# 1.104 21-Aug-2012 pascal

Kill an old mips workaround; we don't support mips, just mips64.

ok deraadt@ kettenis@


Revision tags: OPENBSD_5_2_BASE
# 1.103 19-Jun-2012 deraadt

oops, forgot to install getdtablecount(2); noted by tedu


# 1.102 12-Apr-2012 deraadt

remove rfork(); ok guenther miod


# 1.101 12-Apr-2012 deraadt

kill lfs system call lines and libc stubs


# 1.100 12-Apr-2012 deraadt

New system call: getdtablecount(2) returns the number of file
descriptors the process currently has open.
ok guenther miod gilles ...


# 1.99 22-Mar-2012 guenther

Move __tfork_thread() from rthreads (libpthread) to libc so that
it can be used for not-strictly-threading purposes

ok matthew@ kurt@


# 1.98 13-Mar-2012 guenther

Add manpages for __thrsigdivert, __thrsleep, and __thrwakeup. Various
syntax and grammar fixes from jmc@


Revision tags: OPENBSD_5_1_BASE
# 1.97 17-Jan-2012 guenther

Reimplement mutexes, condvars, and rwlocks to eliminate bugs,
particularly the "consume the signal you just sent" hang, and putting
the wait queues in userspace.

Do cancellation handling in pthread_cond_*wait(), pthread_join(),
and sem_wait().

Add __ prefix to thr{sleep,wakeup,exit,sigdivert}() syscalls; add
'abort" argument to thrsleep to close cancellation race; make
thr{sleep,wakeup} return errno values via *retval to avoid touching
userspace errno.


# 1.96 22-Nov-2011 guenther

sigstack() is long dead, and the compat sigaltstack syscall is gone too.
Correct the namespace protections for sigreturn(), sigwait(), and psignal()

ok millert@


# 1.95 16-Oct-2011 guenther

Add stubs and manpage for __{get,set}_tcb

ok deraadt@


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

Add (rough draft) documentation for fdopendir(3) and the 15 new
XXXat(2) system calls from POSIX 2008. Editing will be done in tree.

General style discussed with jmc@, schwarze@, and deraadt@
ok jmc@


# 1.93 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@


Revision tags: OPENBSD_4_8_BASE OPENBSD_4_9_BASE
# 1.92 03-Jul-2010 guenther

Fix the naming of interfaces and variables for rdomains and rtables
and make it possible to bind sockets (including listening sockets!)
to rtables and not just rdomains. This changes the name of the
system calls, socket option, and ioctl. After building with this
you should remove the files /usr/share/man/cat2/[gs]etrdomain.0.

Since this removes the existing [gs]etrdomain() system calls, the
libc major is bumped.

Written by claudio@, criticized^Wcritiqued by me


# 1.91 01-Jul-2010 deraadt

getpeereid() can now be a library routine using getsockopt() with
SOL_SOCKET and SO_PEERCRED, only issue being that it cannot return
EFAULT for a page fault. The kernel code will soon be put into
compat, and then in 10 years or so tedu will delete it.
ok guenther millert


# 1.90 18-May-2010 tedu

add posix_madvise, posix_memalign, strndup, and strnlen. mostly from
brad and millert, with hints from guenther, jmc, and otto I think.
ok previous.


Revision tags: OPENBSD_4_7_BASE
# 1.89 03-Feb-2010 miod

Use MACHINE_CPU instead of MACHINE_ARCH to pick the correct machine dependent
files or directories when applicable.
The inspiration and name of MACHINE_CPU come from NetBSD, although the way to
provide it to Makefiles is completely different.
ok kettenis@


# 1.88 27-Nov-2009 guenther

Add setrdomain() and getrdomain() system calls. Committing now to
catch the libc major bump per request from deraadt@

Diff by reyk.

ok guenther@


# 1.87 13-Aug-2009 jmc

various MLINK fixes from Alan R. S. Bueno;


Revision tags: OPENBSD_4_6_BASE
# 1.86 03-Jun-2009 jj

Arla client rename from xfs to nnpfs for later upgrades. Tested on various arches. ok todd@ beck@


Revision tags: OPENBSD_4_4_BASE OPENBSD_4_5_BASE
# 1.85 22-Mar-2008 otto

move statvfs.c to gen, since it is not a syscall; ok deraadt@


# 1.84 16-Mar-2008 otto

statvfs support


Revision tags: OPENBSD_4_3_BASE
# 1.83 05-Jan-2008 deraadt

no more need for vadvise.o


# 1.82 09-Sep-2007 otto

Add lint stubs for the longjmp family of functions which are defined in
assembly on all platforms. ok deraadt@


# 1.81 09-Sep-2007 otto

Silence erroneous "environ used, but not defined" lint warning by
providing a stub. ok deraadt@


Revision tags: OPENBSD_4_1_BASE OPENBSD_4_2_BASE
# 1.80 24-Oct-2006 tedu

add rthread syscalls and bump minor.
rthreads are hardly done, but if just trying it out is too much of a hassle,
we'll never make more progress.
ok brad marc marco mbalmer


# 1.79 10-Oct-2006 deraadt

MLINKS to macros described in stat(2)


Revision tags: OPENBSD_4_0_BASE
# 1.78 14-Jun-2006 otto

Introducing adjfreq(2), to adjust the clock frequency.
Loosely based on dragonfly code. Man page help fro jmc@; ok deraadt@


# 1.77 27-May-2006 pedro

Make libc's getcwd() use the new __getcwd() system call
Hacked by marius@ at c2k5, okay miod@ krw@ deraadt@


# 1.76 13-Mar-2006 moritz

Clean the correct file. ok deraadt@


Revision tags: OPENBSD_3_9_BASE
# 1.75 29-Nov-2005 deraadt

Provide stubs for things which are supplied by crt0. I don't think we
want a crt0.ln, at least, not yet. We may reconsider later.


# 1.74 03-Oct-2005 jmc

add missing MLINK for WEXITSTATUS.2


Revision tags: OPENBSD_3_8_BASE
# 1.73 17-Jun-2005 drahn

Extended Attributes was a piece to get to ACLs, however ACLs have not
been worked on, so EA is pointless to maintain.


# 1.72 17-Jun-2005 millert

remove undelete syscall


Revision tags: OPENBSD_3_7_BASE
# 1.71 18-Sep-2004 deraadt

MLINK to macros provided in wait.2


# 1.70 16-Sep-2004 deraadt

add files missing for building a proper lint library


Revision tags: OPENBSD_3_5_BASE OPENBSD_3_6_BASE
# 1.69 13-Feb-2004 tedu

death to osigaltstack. ok deraadt@


# 1.68 15-Jan-2004 deraadt

ABI breakage happened with the sigaltstack replacement. It is too late,
now we just have to cope. Since setjmp uses it, the alpha and sparc64 are
unhappy with the structure change. In a few days, we will make the second
hop here, for now, use the old system call until all binaries have the new
struct in them.


# 1.67 12-Jan-2004 tedu

new syscall closefrom(2). ok deraadt millert


Revision tags: OPENBSD_3_4_BASE
# 1.66 10-May-2003 miod

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


# 1.65 14-Apr-2003 art

There are two related changes.

The first one is an mquery(2) syscall. It's for asking the VM system
about where to map things. It will be used by ld.so, read the man page
for details.

The second change is related and is a centralization of uvm_map hint
that all callers of uvm_map calculated. This will allow us to adjust
this hint on architectures that have segments for non-exec mappings.

deraadt@ drahn@ ok.


Revision tags: OPENBSD_3_3_BASE
# 1.64 31-Jan-2003 millert

Replace emulated versions of setreuid() and setregid() with real syscalls.
These are spec'd by POSIX as of 1003.1-2001; deraadt@ OK


# 1.63 02-Dec-2002 millert

Document getlogin_r()


# 1.62 02-Dec-2002 miod

Import propolice (http://www.trl.ibm.com/projects/security/ssp), a stack
attack protection scheme, into gcc.

This protection is enabled by default. It can be turned off by using the
-fno-stack-protector flag.

Code by Hiroaki Etoh (etoh at jp dot ibm dot com); work on openbsd-specific
integration by fgsch@, deraadt@ and myself; tests by fgsch@, naddy@ and
myself; beer drinking by myself.

Please note that system upgrades with this new code will require a new
libc and ld.so to be build and installed before the propolice-enabled
compiler can be installed.


# 1.61 10-Nov-2002 fgsch

missing MLINKs for setresuid(2). millert ok.


# 1.60 05-Nov-2002 marc

thread safe libc -- 2nd try. OK miod@, millert@
Thanks to miod@ for m68k and vax fixes


# 1.59 03-Nov-2002 marc

back out previous patch.. there are still some vax/m68k issues


# 1.58 03-Nov-2002 marc

libc changes for thread safety. Tested on:
alpha (millert@), i386 (marc@), m68k (millert@ and miod@),
powerpc (drahn@ and dhartmei@), sparc (millert@ and marc@),
sparc64 (marc@), and vax (millert@ and miod@).
Thanks to millert@, miod@, and mickey@ for fixes along the way.


# 1.57 30-Oct-2002 millert

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


Revision tags: OPENBSD_3_2_BASE
# 1.56 05-Aug-2002 art

Fix brain blackout.
Pointed out byb miod@.


# 1.55 05-Aug-2002 art

One more ELF_TOOLCHAIN.


# 1.54 06-Jul-2002 nordin

Remove kernel support for NTP. ok deraadt@ and tholo@


# 1.53 10-Jun-2002 fgsch

correct comment.


# 1.52 08-Jun-2002 drahn

ELF architectures all support weak aliases, enable them for this part.
ok fgsch@


Revision tags: OPENBSD_3_1_BASE
# 1.51 22-Feb-2002 drahn

Extended Attribute support, from FreeBSD/TrustedBSD. ok art@ deraadt@
libc support pieces


# 1.50 21-Feb-2002 art

remove rfork.o from the auto-generated assembler stubs


# 1.49 17-Feb-2002 deraadt

rfork() needs a fork.S-like stub as well; ok art


Revision tags: OPENBSD_3_0_BASE
# 1.48 25-Sep-2001 niklas

Forgotten DEBUGLIBS stuff


# 1.47 25-Sep-2001 drahn

Add an ASPICFLAG variable to bsd.own.mk which a platform use to pass flags
to 'as' to make it compile pic. add defaults for sparc64 which needs picflags
set to -fPIC and ASPICFLAGS to -KPIC.
Also simplifies the systemcall generation for sparc64 PIC mode.
ok epsie@.


# 1.46 20-Sep-2001 millert

Add PSEUDO_NOERROR similar to that used by NetBSD.
Some ports were setting errno in PSEUDO and some were not. Now errno
is set for all in PSEUDO and PSEUDO_NOERROR is provided for the
non-errno case (only used by _exit).

Needs testing on vax and m88k.
XXX - hppa and powerpc still lack a real PSEUDO_NOERROR implementation.
Currently PSEUDO_NOERROR and PSEUDO are the same (so builds don't
break on those platforms).


# 1.45 09-Jul-2001 fgsch

Install getpeereid(2) manpage.


# 1.44 26-Jun-2001 dugsong

implement djb's getpeereid(2), to allow local-domain servers to determine client credentials. mostly from superscript.com. deraadt@ ok


Revision tags: OPENBSD_2_9_BASE
# 1.43 14-Mar-2001 aaron

Move description of exect() to execve(2) man page. Add a note about exect() not
being portable.


# 1.42 09-Mar-2001 art

Add mlockall and munlockall. man-page from NetBSD.


# 1.41 10-Jan-2001 deraadt

put up FD_* manual pages, in section 3


# 1.40 23-Dec-2000 deraadt

create proper docs for timer{add,clear,sub,isset,cmp}


# 1.39 16-Nov-2000 provos

kqueue and kevent system calls


Revision tags: OPENBSD_2_8_BASE
# 1.38 17-Oct-2000 deraadt

damn it, i have had it with this untested weak shit


# 1.37 16-Oct-2000 deraadt

re-add weak sparc support; d@


# 1.36 15-May-2000 niklas

Add support for building libraries with debugging information in them.
Enable by setting DEBUGLIBS=yes in /etc/mk.conf, then -g libraries will get
installed in /usr/lib/debug. This directory will be searched first if
gcc is given the -g flag during the link stage.


Revision tags: OPENBSD_2_7_BASE
# 1.35 01-May-2000 deraadt

bye bye semconfig(2)


# 1.34 20-Apr-2000 deraadt

p{read,write}{,v} man pages


# 1.33 07-Feb-2000 assar

add fhopen, fhstat, fhstatfs system calls. largely from NetBSD


# 1.32 06-Jan-2000 d

for now, disable weak aliases for all archs except i386


# 1.31 14-Dec-1999 millert

Install swapctl.2, not swapon.2. swapon.2 should probably go away.


Revision tags: OPENBSD_2_6_BASE
# 1.30 07-Jun-1999 deraadt

replacement pipe() system call; copies data into place inside kernel, so
that EFAULT return value is possible


# 1.29 22-May-1999 weingart

Add swapctl(2), and crank shlib minor.


Revision tags: OPENBSD_2_5_BASE
# 1.28 01-Feb-1999 d

mi ptrace


# 1.27 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


Revision tags: OPENBSD_2_4_BASE
# 1.26 18-Sep-1998 art

make use of xfspioctl


Revision tags: OPENBSD_2_3_BASE
# 1.25 08-Feb-1998 tholo

Better lint(1) framework. Mostly from cgd@NetBSD


# 1.24 13-Nov-1997 deraadt

add getsid(2), XPG4


Revision tags: OPENBSD_2_2_BASE
# 1.23 30-May-1997 kstailey

add getpgrp(2) from NetBSD


Revision tags: OPENBSD_2_1_BASE
# 1.22 08-May-1997 kstailey

add tag


# 1.21 08-May-1997 kstailey

make clock_gettime.cat2


# 1.20 20-Apr-1997 tholo

New POSIX 1003.1b syscalls; from pk@NetBSD


# 1.19 04-Apr-1997 deraadt

seek(2) is not needed


# 1.18 29-Mar-1997 deraadt

futimes link; nakayosh@kcn.or.jp


# 1.17 26-Mar-1997 deraadt

install ktrace(2)


# 1.16 26-Jan-1997 downsj

Add a link for lchown.2


# 1.15 26-Jan-1997 downsj

Add lchown(), increment minor number.


# 1.14 11-Dec-1996 deraadt

generate reboot.o like other system calls


Revision tags: OPENBSD_2_0_BASE
# 1.13 02-Sep-1996 deraadt

shmdt link


# 1.12 25-Aug-1996 deraadt

and a man page


# 1.11 18-Jun-1996 deraadt

build poll.o


# 1.10 19-May-1996 pefo

Changes for mips.


# 1.9 18-May-1996 deraadt

poll() as a system call


# 1.8 08-May-1996 deraadt

install rfork man page


# 1.7 01-May-1996 deraadt

add futimes


# 1.6 25-Mar-1996 tholo

Add support for building lint(1) library


# 1.5 29-Jan-1996 tholo

Add kernel PLL for system clock
Add ntp_adjtime() and ntp_gettime() system calls
Mostly stolen from FreeBSD


# 1.4 08-Jan-1996 deraadt

add rfork.o and minherit.o


# 1.3 07-Jan-1996 deraadt

add minherit() system call


# 1.2 14-Dec-1995 deraadt

from netbsd:
add & fix a bunch of system call pages


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.174 20-Aug-2023 visa

Add syscall stub for kqueue1(2)

This rides previous libc minor bump.

Feedback and OK guenther@


Revision tags: OPENBSD_7_3_BASE
# 1.173 27-Feb-2023 deraadt

Calculate the size of the static (and profiled static) execve syscall stub
and store it in a const variable for use by crt0.
help from kettenis and miod


# 1.172 21-Feb-2023 deraadt

create a stub for pinsyscall(2)
ok guenther


# 1.171 16-Feb-2023 deraadt

Document pinsyscall(2). The ld.so and kernel enforcement code is not
commited ye -- waiting for enough people to run kernels which support
the system call.
ok jmc


# 1.170 11-Feb-2023 deraadt

__syscall() is no longer neccessary since the system calls which needed
it are now unpadded
ok kettenis guenther


# 1.169 08-Jan-2023 guenther

Add getthrname(2) manpage

ok jmc@ schwarze@


# 1.168 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@


# 1.167 19-Dec-2022 guenther

Add waitid(2) manpage, based on a first pass by espie@ and bits
from FreeBSD and NetBSD.

ok kettenis@ jmc@ espie@


# 1.166 26-Oct-2022 kettenis

Add waitid(2) syscall stub.

Minor bump to both libc and libpthread: make sure you install a new kernel!

ok millert@, deraadt@


# 1.165 07-Oct-2022 deraadt

Add mimmutable(2) libc stub, add & adjust manual pages, and crank the minor.
ok kettenis


Revision tags: OPENBSD_7_2_BASE
# 1.164 09-Sep-2022 mbuhl

Add libc wrappers for the new sendmmsg and recvmmsg system calls.
Feedback tb@, miod@, jca@
OK jca@


# 1.163 17-Jul-2022 deraadt

Add ypconnect(2) stub inside libc so that libc functions can use it,
but do not export it.


# 1.162 17-Jul-2022 deraadt

add ypconnect(2) manual page


Revision tags: OPENBSD_7_1_BASE
# 1.161 23-Dec-2021 guenther

Roll the syscalls that have an off_t argument to remove the explicit padding.
Switch libc and ld.so to the generic stubs for these calls.
WARNING: reboot to updated kernel before installing libc or ld.so!

Time for a story...

When gcc (back in 1.x days) first implemented long long, it didn't (always)
pass 64bit arguments in 'aligned' registers/stack slots, with the result that
argument offsets didn't match structure offsets. This affected the nine system
calls that pass off_t arguments:
ftruncate lseek mmap mquery pread preadv pwrite pwritev truncate

To avoid having to do custom ASM wrappers for those, BSD put an explicit pad
argument in so that the off_t argument would always start on a even slot and
thus be naturally aligned. Thus those odd wrappers in lib/libc/sys/ that use
__syscall() and pass an extra '0' argument.

The ABIs for different CPUs eventually settled how things should be passed on
each and gcc 2.x followed them. The only arch now where it helps is landisk,
which needs to skip the last argument register if it would be the first half of
a 64bit argument. So: add new syscalls without the pad argument and on landisk
do that skipping directly in the syscall handler in the kernel. Keep compat
support for the existing syscalls long enough for the transition.

ok deraadt@


Revision tags: OPENBSD_7_0_BASE
# 1.160 11-Jun-2021 kettenis

Since futex(2) can fail, it needs a full syscall stub. This should fixes
issues on powerpc64 and sparc64.

Note that this makes the lib/libpthread/errno test fail since that test
detects that we are touching errno now. This will be addressed in a
future diff as it is not entirely clear whether the test is correct.

ok mpi@, bluhm@


Revision tags: OPENBSD_6_8_BASE OPENBSD_6_9_BASE
# 1.159 06-Jul-2020 pirofti

Add support for timeconting in userland.

This diff exposes parts of clock_gettime(2) and gettimeofday(2) to
userland via libc eliberating processes from the need for a context
switch everytime they want to count the passage of time.

If a timecounter clock can be exposed to userland than it needs to set
its tc_user member to a non-zero value. Tested with one or multiple
counters per architecture.

The timing data is shared through a pointer found in the new ELF
auxiliary vector AUX_openbsd_timekeep containing timehands information
that is frequently updated by the kernel.

Timing differences between the last kernel update and the current time
are adjusted in userland by the tc_get_timecount() function inside the
MD usertc.c file.

This permits a much more responsive environment, quite visible in
browsers, office programs and gaming (apparently one is are able to fly
in Minecraft now).

Tested by robert@, sthen@, naddy@, kmos@, phessler@, and many others!

OK from at least kettenis@, cheloha@, naddy@, sthen@


Revision tags: OPENBSD_6_7_BASE
# 1.158 27-Nov-2019 deraadt

Document msyscall(2): ld.so can use this (once only) to tell the kernel
where libc.so's text segment is, thereby allowing invocation of system
calls from that region. An upcoming change will kill the process if a
system call is invoked from addresses not explicitly permitted.
ok guenther kettenis mortimer


Revision tags: OPENBSD_6_6_BASE
# 1.157 28-May-2019 beck

Enable the use of the kernel __realpath() system call in the libc wrapper.

For now, this also still uses the existing realpath implmentation
and emits a syslog if we see differening results. Once we have run
with that for a little while we will remove the old code

ok deraadt@


Revision tags: OPENBSD_6_5_BASE
# 1.156 11-Jan-2019 deraadt

mincore() is a relic from the past, exposing physical machine information
about shared resources which no program should see. only a few pieces of
software use it, generally poorly thought out. they are being fixed, so
mincore() can be deleted.
ok guenther tedu jca sthen, others


Revision tags: OPENBSD_6_4_BASE
# 1.155 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.154 12-Jan-2018 deraadt

sysctl(3) can now be renamed to sysctl(2)


# 1.153 28-Nov-2017 guenther

Delete fktrace(2). The consequences of it were not thought through
sufficiently and at least one horrific security hole was the result.

ok deraadt@ beck@


Revision tags: OPENBSD_6_2_BASE
# 1.152 13-Aug-2017 tedu

add fktrace to libc


# 1.151 12-Aug-2017 guenther

Instead of hardcoding a partial dependency list for the syscall stub objects,
calculate them as done for other objects


# 1.150 31-May-2017 sthen

install futex(2), ok mpi


# 1.149 30-Apr-2017 mpi

Add futex(2) shim, bump minor.

Inputs from guenther@, ok kettenis@, visa@


Revision tags: OPENBSD_6_1_BASE
# 1.148 29-Mar-2017 deraadt

The hppa version of as(1) requires whitespace before a .file directive,
it may not be in column 0. This kind of thing is very common in GNU
and Linux software because the software was written from the start to
be 'compatible replacements' of vendor software.
ok jsing guenther


# 1.147 26-Mar-2017 guenther

Use .file to convince 'as' to generate proper FILE symbols in the syscall
stubs that aren't actually in files, so that syspatch can figure out what
order the syscall stub objects are in the .so. Use -P to suppress to #line
directives that would override that. Tested with both gcc/gas and clang.

ok deraadt@


Revision tags: OPENBSD_6_0_BASE
# 1.146 04-Jul-2016 guenther

DEBUGLIBS has been broken since the gcc4 switch, so delete it. CFLAGS
contains -g by default anyway

problem noted by Edgar Pettijohn (edgar (at) pettijohn-web.com)
ok millert@ kettenis@ deraadt@


# 1.145 30-May-2016 guenther

Move __getcwd from ASM to HIDDEN: we don't want the literal __getcwd symbol

ok millert@ deraadt@


# 1.144 19-May-2016 guenther

Add ASM_NOERR for syscalls that never fail and thus don't need the errno
setting logic...which can significantly reduce the size of the stub on
some archs; 20 syscalls get a trim with this.

in snaps for a bit and ok deraadt@


# 1.143 09-May-2016 guenther

Remove sigreturn declaration and the now-unused libc syscall stub


# 1.142 07-May-2016 guenther

Use a Thread Information Block in both single and multi-threaded programs.
This stores errno, the cancelation flags, and related bits for each thread
and is allocated by ld.so or libc.a. This is an ABI break from 5.9-stable!

Make libpthread dlopen'able by moving the cancelation wrappers into libc
and doing locking and fork/errno handling via callbacks that libpthread
registers when it first initializes. 'errno' *must* be declared via
<errno.h> now!

Clean up libpthread's symbol exports like libc.

On powerpc, offset the TIB/TCB/TLS data from the register per the ELF spec.

Testing by various, particularly sthen@ and patrick@
ok kettenis@


# 1.141 30-Mar-2016 guenther

Turd polish: use HIDDEN= instead of PSEUDO= for ptrace syscall stub, to
make its underlying symbol name look like others.


# 1.140 30-Mar-2016 guenther

Eliminate userspace caching by getlogin_r/setlogin; make the getlogin
syscall behave exactly like userspace getlogin_r() and rename it to
match. Eliminate the reduced-to-no-op wrappers of the syscalls.
Eliminate the unnecessary per-thread static buffering by getlogin().

ok kettenis@ deraadt@


# 1.139 30-Mar-2016 jmc

for some time now mandoc has not required MLINKS to function
correctly - logically complete that now by removing MLINKS from base;

authors need only to ensure there is an entry in NAME for any function/
util being added. MLINKS will still work, and remain for perl to ease
upgrades;

ok nicm (curses) bcook (ssl)
ok schwarze, who provided a lot of feedback and assistance
ok tb natano jung


# 1.138 21-Mar-2016 bluhm

Rename the system call sendsyslog2 to sendsyslog. Keep the old one
as osendsyslog for a while. The three argument variant is the only
one that will stay.
input kettenis@; OK deraadt@


Revision tags: OPENBSD_5_9_BASE
# 1.137 25-Nov-2015 deraadt

Add a syscall stub for sendsyslog2(2), and use it in syslog_r(3), passing
LOG_CONS to the kernel. As a result, the /dev/console opening code can
be removed.
ok kettenis millert beck


# 1.136 10-Nov-2015 guenther

Split the intra-thread functionality from kill(2) into its own syscall
thrkill(2), rolling the kill(2) syscall number with the ABI change to
avoid breaking binaries during during the transition. thrkill(2) includes
a 'tcb' argument that eliminates the need for locking in pthread_kill()
and simplifies pthread_cancel(). Switch __stack_smash_handler() to use
thrkill(2) and explicitly unblock SIGABRT.

Minor bump to both libc and libpthread: make sure you install a new kernel!

ok semarie@


# 1.135 23-Oct-2015 guenther

Merge the sigaction() and sigprocmask() overloads/wrappers from libpthread
into libc, and move pthread_sigmask() as well (just a trivial wrapper).
This provides consistent handling of SIGTHR between single- and multi-threaded
programs and is a step in the merge of all the libpthread overloads, providing
some ASM and Makefile bits that the other wrappers will need.

ok deraadt@ millert@


# 1.134 23-Oct-2015 deraadt

Remove dnssocket() and dnsconnect(), since we decided to use a SOCK_DNS
flag instead.
ok guenther tedu semarie


# 1.133 19-Oct-2015 deraadt

Remove old tame() stub


# 1.132 18-Oct-2015 deraadt

create libc stubs for dnssocket() and dnsconnect()


# 1.131 09-Oct-2015 deraadt

tame -> pledge conversion, in libc. I should crank libc, but am cheating
hoping things go well. The old symbol is faked via a stupid stub function,
until next major crank when it can be removed. I am expecting guenther
to scream at me.


# 1.130 13-Sep-2015 guenther

Rename __sysctl syscall to just sysctl, as the userland wrapper is no longer
necessary

ok deraadt@ jsing@


# 1.129 09-Sep-2015 guenther

Simplify makefile rules for building the ASM stubs into "pick something
from column A and something from column B".

ok miod@ deraadt@


# 1.128 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@


# 1.127 25-Aug-2015 guenther

Document kbind(2)


Revision tags: OPENBSD_5_8_BASE
# 1.126 19-Jul-2015 deraadt

manual page for tame(2). not very good, so i will be hearing from jmc


# 1.125 07-Apr-2015 guenther

Make pthread_atfork() track the DSO that called it like atexit() does,
unregistering callbacks if the DSO is unloaded. Move the callback
handling from libpthread to libc, though libpthread still overrides the
inner call to handle locking and thread-library reinitialization.
Major version bump for both libc and libpthread.

verification that this fixes various ports ajacoutot@
asm assistance miod@; ok millert@ deraadt@


Revision tags: OPENBSD_5_7_BASE
# 1.124 08-Dec-2014 guenther

Add chflagsat(), modeled on fchmodat() with name to match FreeBSD.


# 1.123 14-Nov-2014 guenther

Add sched_yield(2) manpage


# 1.122 31-Aug-2014 guenther

Declare and document getthrid()

indirectly prodded by krw@


# 1.121 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@


# 1.120 14-Aug-2014 tobias

fixed overrid(d)en typo

millert@ and jmc@ agree that "overriden" is wrong


Revision tags: OPENBSD_5_6_BASE
# 1.119 12-Jul-2014 deraadt

document sendsyslog(2); ok guenther tedu matthew


# 1.118 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.117 18-Mar-2014 miod

Retire hp300, mvme68k and mvme88k ports. These ports have no users, keeping
this hardware alive is becoming increasingly difficult, and I should heed the
message sent by the three disks which have died on me over the last few days.

Noone sane will mourn these ports anyway. So long, and thanks for the fish.


Revision tags: OPENBSD_5_5_BASE
# 1.116 13-Oct-2013 guenther

Make it possible to build to reduced version of a library, including
just specific objects that are compiled with additional options to
reduce their size. For use by distrib/ and crunchgen.

style and naming assistance from espie@


# 1.115 07-Oct-2013 guenther

getdirentries(2) is dead; long live getdents(2)!

confirmation that getdirentries(2) is unused by ports from sthen@ and naddy@


# 1.114 13-Aug-2013 guenther

Switch time_t, ino_t, clock_t, and struct kevent's ident and data
members to 64bit types. Assign new syscall numbers for (almost
all) the syscalls that involve the affected types, including anything
with time_t, timeval, itimerval, timespec, rusage, dirent, stat,
or kevent arguments. Add a d_off member to struct dirent and replace
getdirentries() with getdents(), thus immensely simplifying and
accelerating telldir/seekdir. Build perl with -DBIG_TIME.

Bump the major on every single base library: the compat bits included
here are only good enough to make the transition; the T32 compat
option will be burned as soon as we've reached the new world are
are happy with the snapshots for all architectures.

DANGER: ABI incompatibility. Updating to this kernel requires extra
work or you won't be able to login: install a snapshot instead.

Much assistance in fixing userland issues from deraadt@ and tedu@
and build assistance from todd@ and otto@


Revision tags: OPENBSD_5_4_BASE
# 1.113 05-Jun-2013 guenther

Move _Exit() from the exit() manpage to the _exit() manpage, as it's
just an alias of the latter.

ok matthew@ tedu@


# 1.112 01-Jun-2013 miod

Add utrace(2), a system call allowing for userland to send its own ktrace
records. From FreeBSD via otto@, with tweaks suggested by guenther@.
Commite on behalf of otto@ who is not around, to ride the libc minor bump.
Causes a librthread minor bump as well (new syscall).


# 1.111 29-Apr-2013 matthew

Extend P_SIGSUSPEND handling in userret() to properly restore the
sigmask even if there are no pending signals under the temporary
sigmask.

Refactor existing select() and poll() system calls to introduce the
pselect() and ppoll() system calls.

Add rthread wrappers for pselect() and ppoll(). While there, update
cancellation point comments to reflect recent fdatasync() addition.

Minor bumps for libc and librthread due to new symbols.

ok guenther, millert, deraadt, jmc


# 1.110 15-Apr-2013 matthew

Implement fdatasync() as a wrapper around fsync()

ok guenther, deraadt, jmc


Revision tags: OPENBSD_5_3_BASE
# 1.109 03-Feb-2013 miod

gremlin crept in


# 1.108 02-Feb-2013 miod

Userland bits for m68k/ELF. Mostly addition of register prefixes to the
assembler instructions, and cope with the few changes in return values
location.


# 1.107 04-Sep-2012 okan

remove lint leftovers; ok guenther@


# 1.106 23-Aug-2012 deraadt

no more nnpfspioctl() system call; ok guenther


# 1.105 22-Aug-2012 pascal

Convert cpp | as rules in bsd.lib.mk and lib/libc/sys/Makefile.inc to pure cc
invocations. This allows us to use the compiler builtin define __PIC__ to check
for PIC/PIEness rather than passing -DPIC. Simplifies PIE work a lot.

ok matthew@, conceptually ok kurt@


# 1.104 21-Aug-2012 pascal

Kill an old mips workaround; we don't support mips, just mips64.

ok deraadt@ kettenis@


Revision tags: OPENBSD_5_2_BASE
# 1.103 19-Jun-2012 deraadt

oops, forgot to install getdtablecount(2); noted by tedu


# 1.102 12-Apr-2012 deraadt

remove rfork(); ok guenther miod


# 1.101 12-Apr-2012 deraadt

kill lfs system call lines and libc stubs


# 1.100 12-Apr-2012 deraadt

New system call: getdtablecount(2) returns the number of file
descriptors the process currently has open.
ok guenther miod gilles ...


# 1.99 22-Mar-2012 guenther

Move __tfork_thread() from rthreads (libpthread) to libc so that
it can be used for not-strictly-threading purposes

ok matthew@ kurt@


# 1.98 13-Mar-2012 guenther

Add manpages for __thrsigdivert, __thrsleep, and __thrwakeup. Various
syntax and grammar fixes from jmc@


Revision tags: OPENBSD_5_1_BASE
# 1.97 17-Jan-2012 guenther

Reimplement mutexes, condvars, and rwlocks to eliminate bugs,
particularly the "consume the signal you just sent" hang, and putting
the wait queues in userspace.

Do cancellation handling in pthread_cond_*wait(), pthread_join(),
and sem_wait().

Add __ prefix to thr{sleep,wakeup,exit,sigdivert}() syscalls; add
'abort" argument to thrsleep to close cancellation race; make
thr{sleep,wakeup} return errno values via *retval to avoid touching
userspace errno.


# 1.96 22-Nov-2011 guenther

sigstack() is long dead, and the compat sigaltstack syscall is gone too.
Correct the namespace protections for sigreturn(), sigwait(), and psignal()

ok millert@


# 1.95 16-Oct-2011 guenther

Add stubs and manpage for __{get,set}_tcb

ok deraadt@


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

Add (rough draft) documentation for fdopendir(3) and the 15 new
XXXat(2) system calls from POSIX 2008. Editing will be done in tree.

General style discussed with jmc@, schwarze@, and deraadt@
ok jmc@


# 1.93 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@


Revision tags: OPENBSD_4_8_BASE OPENBSD_4_9_BASE
# 1.92 03-Jul-2010 guenther

Fix the naming of interfaces and variables for rdomains and rtables
and make it possible to bind sockets (including listening sockets!)
to rtables and not just rdomains. This changes the name of the
system calls, socket option, and ioctl. After building with this
you should remove the files /usr/share/man/cat2/[gs]etrdomain.0.

Since this removes the existing [gs]etrdomain() system calls, the
libc major is bumped.

Written by claudio@, criticized^Wcritiqued by me


# 1.91 01-Jul-2010 deraadt

getpeereid() can now be a library routine using getsockopt() with
SOL_SOCKET and SO_PEERCRED, only issue being that it cannot return
EFAULT for a page fault. The kernel code will soon be put into
compat, and then in 10 years or so tedu will delete it.
ok guenther millert


# 1.90 18-May-2010 tedu

add posix_madvise, posix_memalign, strndup, and strnlen. mostly from
brad and millert, with hints from guenther, jmc, and otto I think.
ok previous.


Revision tags: OPENBSD_4_7_BASE
# 1.89 03-Feb-2010 miod

Use MACHINE_CPU instead of MACHINE_ARCH to pick the correct machine dependent
files or directories when applicable.
The inspiration and name of MACHINE_CPU come from NetBSD, although the way to
provide it to Makefiles is completely different.
ok kettenis@


# 1.88 27-Nov-2009 guenther

Add setrdomain() and getrdomain() system calls. Committing now to
catch the libc major bump per request from deraadt@

Diff by reyk.

ok guenther@


# 1.87 13-Aug-2009 jmc

various MLINK fixes from Alan R. S. Bueno;


Revision tags: OPENBSD_4_6_BASE
# 1.86 03-Jun-2009 jj

Arla client rename from xfs to nnpfs for later upgrades. Tested on various arches. ok todd@ beck@


Revision tags: OPENBSD_4_4_BASE OPENBSD_4_5_BASE
# 1.85 22-Mar-2008 otto

move statvfs.c to gen, since it is not a syscall; ok deraadt@


# 1.84 16-Mar-2008 otto

statvfs support


Revision tags: OPENBSD_4_3_BASE
# 1.83 05-Jan-2008 deraadt

no more need for vadvise.o


# 1.82 09-Sep-2007 otto

Add lint stubs for the longjmp family of functions which are defined in
assembly on all platforms. ok deraadt@


# 1.81 09-Sep-2007 otto

Silence erroneous "environ used, but not defined" lint warning by
providing a stub. ok deraadt@


Revision tags: OPENBSD_4_1_BASE OPENBSD_4_2_BASE
# 1.80 24-Oct-2006 tedu

add rthread syscalls and bump minor.
rthreads are hardly done, but if just trying it out is too much of a hassle,
we'll never make more progress.
ok brad marc marco mbalmer


# 1.79 10-Oct-2006 deraadt

MLINKS to macros described in stat(2)


Revision tags: OPENBSD_4_0_BASE
# 1.78 14-Jun-2006 otto

Introducing adjfreq(2), to adjust the clock frequency.
Loosely based on dragonfly code. Man page help fro jmc@; ok deraadt@


# 1.77 27-May-2006 pedro

Make libc's getcwd() use the new __getcwd() system call
Hacked by marius@ at c2k5, okay miod@ krw@ deraadt@


# 1.76 13-Mar-2006 moritz

Clean the correct file. ok deraadt@


Revision tags: OPENBSD_3_9_BASE
# 1.75 29-Nov-2005 deraadt

Provide stubs for things which are supplied by crt0. I don't think we
want a crt0.ln, at least, not yet. We may reconsider later.


# 1.74 03-Oct-2005 jmc

add missing MLINK for WEXITSTATUS.2


Revision tags: OPENBSD_3_8_BASE
# 1.73 17-Jun-2005 drahn

Extended Attributes was a piece to get to ACLs, however ACLs have not
been worked on, so EA is pointless to maintain.


# 1.72 17-Jun-2005 millert

remove undelete syscall


Revision tags: OPENBSD_3_7_BASE
# 1.71 18-Sep-2004 deraadt

MLINK to macros provided in wait.2


# 1.70 16-Sep-2004 deraadt

add files missing for building a proper lint library


Revision tags: OPENBSD_3_5_BASE OPENBSD_3_6_BASE
# 1.69 13-Feb-2004 tedu

death to osigaltstack. ok deraadt@


# 1.68 15-Jan-2004 deraadt

ABI breakage happened with the sigaltstack replacement. It is too late,
now we just have to cope. Since setjmp uses it, the alpha and sparc64 are
unhappy with the structure change. In a few days, we will make the second
hop here, for now, use the old system call until all binaries have the new
struct in them.


# 1.67 12-Jan-2004 tedu

new syscall closefrom(2). ok deraadt millert


Revision tags: OPENBSD_3_4_BASE
# 1.66 10-May-2003 miod

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


# 1.65 14-Apr-2003 art

There are two related changes.

The first one is an mquery(2) syscall. It's for asking the VM system
about where to map things. It will be used by ld.so, read the man page
for details.

The second change is related and is a centralization of uvm_map hint
that all callers of uvm_map calculated. This will allow us to adjust
this hint on architectures that have segments for non-exec mappings.

deraadt@ drahn@ ok.


Revision tags: OPENBSD_3_3_BASE
# 1.64 31-Jan-2003 millert

Replace emulated versions of setreuid() and setregid() with real syscalls.
These are spec'd by POSIX as of 1003.1-2001; deraadt@ OK


# 1.63 02-Dec-2002 millert

Document getlogin_r()


# 1.62 02-Dec-2002 miod

Import propolice (http://www.trl.ibm.com/projects/security/ssp), a stack
attack protection scheme, into gcc.

This protection is enabled by default. It can be turned off by using the
-fno-stack-protector flag.

Code by Hiroaki Etoh (etoh at jp dot ibm dot com); work on openbsd-specific
integration by fgsch@, deraadt@ and myself; tests by fgsch@, naddy@ and
myself; beer drinking by myself.

Please note that system upgrades with this new code will require a new
libc and ld.so to be build and installed before the propolice-enabled
compiler can be installed.


# 1.61 10-Nov-2002 fgsch

missing MLINKs for setresuid(2). millert ok.


# 1.60 05-Nov-2002 marc

thread safe libc -- 2nd try. OK miod@, millert@
Thanks to miod@ for m68k and vax fixes


# 1.59 03-Nov-2002 marc

back out previous patch.. there are still some vax/m68k issues


# 1.58 03-Nov-2002 marc

libc changes for thread safety. Tested on:
alpha (millert@), i386 (marc@), m68k (millert@ and miod@),
powerpc (drahn@ and dhartmei@), sparc (millert@ and marc@),
sparc64 (marc@), and vax (millert@ and miod@).
Thanks to millert@, miod@, and mickey@ for fixes along the way.


# 1.57 30-Oct-2002 millert

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


Revision tags: OPENBSD_3_2_BASE
# 1.56 05-Aug-2002 art

Fix brain blackout.
Pointed out byb miod@.


# 1.55 05-Aug-2002 art

One more ELF_TOOLCHAIN.


# 1.54 06-Jul-2002 nordin

Remove kernel support for NTP. ok deraadt@ and tholo@


# 1.53 10-Jun-2002 fgsch

correct comment.


# 1.52 08-Jun-2002 drahn

ELF architectures all support weak aliases, enable them for this part.
ok fgsch@


Revision tags: OPENBSD_3_1_BASE
# 1.51 22-Feb-2002 drahn

Extended Attribute support, from FreeBSD/TrustedBSD. ok art@ deraadt@
libc support pieces


# 1.50 21-Feb-2002 art

remove rfork.o from the auto-generated assembler stubs


# 1.49 17-Feb-2002 deraadt

rfork() needs a fork.S-like stub as well; ok art


Revision tags: OPENBSD_3_0_BASE
# 1.48 25-Sep-2001 niklas

Forgotten DEBUGLIBS stuff


# 1.47 25-Sep-2001 drahn

Add an ASPICFLAG variable to bsd.own.mk which a platform use to pass flags
to 'as' to make it compile pic. add defaults for sparc64 which needs picflags
set to -fPIC and ASPICFLAGS to -KPIC.
Also simplifies the systemcall generation for sparc64 PIC mode.
ok epsie@.


# 1.46 20-Sep-2001 millert

Add PSEUDO_NOERROR similar to that used by NetBSD.
Some ports were setting errno in PSEUDO and some were not. Now errno
is set for all in PSEUDO and PSEUDO_NOERROR is provided for the
non-errno case (only used by _exit).

Needs testing on vax and m88k.
XXX - hppa and powerpc still lack a real PSEUDO_NOERROR implementation.
Currently PSEUDO_NOERROR and PSEUDO are the same (so builds don't
break on those platforms).


# 1.45 09-Jul-2001 fgsch

Install getpeereid(2) manpage.


# 1.44 26-Jun-2001 dugsong

implement djb's getpeereid(2), to allow local-domain servers to determine client credentials. mostly from superscript.com. deraadt@ ok


Revision tags: OPENBSD_2_9_BASE
# 1.43 14-Mar-2001 aaron

Move description of exect() to execve(2) man page. Add a note about exect() not
being portable.


# 1.42 09-Mar-2001 art

Add mlockall and munlockall. man-page from NetBSD.


# 1.41 10-Jan-2001 deraadt

put up FD_* manual pages, in section 3


# 1.40 23-Dec-2000 deraadt

create proper docs for timer{add,clear,sub,isset,cmp}


# 1.39 16-Nov-2000 provos

kqueue and kevent system calls


Revision tags: OPENBSD_2_8_BASE
# 1.38 17-Oct-2000 deraadt

damn it, i have had it with this untested weak shit


# 1.37 16-Oct-2000 deraadt

re-add weak sparc support; d@


# 1.36 15-May-2000 niklas

Add support for building libraries with debugging information in them.
Enable by setting DEBUGLIBS=yes in /etc/mk.conf, then -g libraries will get
installed in /usr/lib/debug. This directory will be searched first if
gcc is given the -g flag during the link stage.


Revision tags: OPENBSD_2_7_BASE
# 1.35 01-May-2000 deraadt

bye bye semconfig(2)


# 1.34 20-Apr-2000 deraadt

p{read,write}{,v} man pages


# 1.33 07-Feb-2000 assar

add fhopen, fhstat, fhstatfs system calls. largely from NetBSD


# 1.32 06-Jan-2000 d

for now, disable weak aliases for all archs except i386


# 1.31 14-Dec-1999 millert

Install swapctl.2, not swapon.2. swapon.2 should probably go away.


Revision tags: OPENBSD_2_6_BASE
# 1.30 07-Jun-1999 deraadt

replacement pipe() system call; copies data into place inside kernel, so
that EFAULT return value is possible


# 1.29 22-May-1999 weingart

Add swapctl(2), and crank shlib minor.


Revision tags: OPENBSD_2_5_BASE
# 1.28 01-Feb-1999 d

mi ptrace


# 1.27 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


Revision tags: OPENBSD_2_4_BASE
# 1.26 18-Sep-1998 art

make use of xfspioctl


Revision tags: OPENBSD_2_3_BASE
# 1.25 08-Feb-1998 tholo

Better lint(1) framework. Mostly from cgd@NetBSD


# 1.24 13-Nov-1997 deraadt

add getsid(2), XPG4


Revision tags: OPENBSD_2_2_BASE
# 1.23 30-May-1997 kstailey

add getpgrp(2) from NetBSD


Revision tags: OPENBSD_2_1_BASE
# 1.22 08-May-1997 kstailey

add tag


# 1.21 08-May-1997 kstailey

make clock_gettime.cat2


# 1.20 20-Apr-1997 tholo

New POSIX 1003.1b syscalls; from pk@NetBSD


# 1.19 04-Apr-1997 deraadt

seek(2) is not needed


# 1.18 29-Mar-1997 deraadt

futimes link; nakayosh@kcn.or.jp


# 1.17 26-Mar-1997 deraadt

install ktrace(2)


# 1.16 26-Jan-1997 downsj

Add a link for lchown.2


# 1.15 26-Jan-1997 downsj

Add lchown(), increment minor number.


# 1.14 11-Dec-1996 deraadt

generate reboot.o like other system calls


Revision tags: OPENBSD_2_0_BASE
# 1.13 02-Sep-1996 deraadt

shmdt link


# 1.12 25-Aug-1996 deraadt

and a man page


# 1.11 18-Jun-1996 deraadt

build poll.o


# 1.10 19-May-1996 pefo

Changes for mips.


# 1.9 18-May-1996 deraadt

poll() as a system call


# 1.8 08-May-1996 deraadt

install rfork man page


# 1.7 01-May-1996 deraadt

add futimes


# 1.6 25-Mar-1996 tholo

Add support for building lint(1) library


# 1.5 29-Jan-1996 tholo

Add kernel PLL for system clock
Add ntp_adjtime() and ntp_gettime() system calls
Mostly stolen from FreeBSD


# 1.4 08-Jan-1996 deraadt

add rfork.o and minherit.o


# 1.3 07-Jan-1996 deraadt

add minherit() system call


# 1.2 14-Dec-1995 deraadt

from netbsd:
add & fix a bunch of system call pages


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.173 27-Feb-2023 deraadt

Calculate the size of the static (and profiled static) execve syscall stub
and store it in a const variable for use by crt0.
help from kettenis and miod


# 1.172 21-Feb-2023 deraadt

create a stub for pinsyscall(2)
ok guenther


# 1.171 16-Feb-2023 deraadt

Document pinsyscall(2). The ld.so and kernel enforcement code is not
commited ye -- waiting for enough people to run kernels which support
the system call.
ok jmc


# 1.170 11-Feb-2023 deraadt

__syscall() is no longer neccessary since the system calls which needed
it are now unpadded
ok kettenis guenther


# 1.169 08-Jan-2023 guenther

Add getthrname(2) manpage

ok jmc@ schwarze@


# 1.168 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@


# 1.167 19-Dec-2022 guenther

Add waitid(2) manpage, based on a first pass by espie@ and bits
from FreeBSD and NetBSD.

ok kettenis@ jmc@ espie@


# 1.166 26-Oct-2022 kettenis

Add waitid(2) syscall stub.

Minor bump to both libc and libpthread: make sure you install a new kernel!

ok millert@, deraadt@


# 1.165 07-Oct-2022 deraadt

Add mimmutable(2) libc stub, add & adjust manual pages, and crank the minor.
ok kettenis


Revision tags: OPENBSD_7_2_BASE
# 1.164 09-Sep-2022 mbuhl

Add libc wrappers for the new sendmmsg and recvmmsg system calls.
Feedback tb@, miod@, jca@
OK jca@


# 1.163 17-Jul-2022 deraadt

Add ypconnect(2) stub inside libc so that libc functions can use it,
but do not export it.


# 1.162 17-Jul-2022 deraadt

add ypconnect(2) manual page


Revision tags: OPENBSD_7_1_BASE
# 1.161 23-Dec-2021 guenther

Roll the syscalls that have an off_t argument to remove the explicit padding.
Switch libc and ld.so to the generic stubs for these calls.
WARNING: reboot to updated kernel before installing libc or ld.so!

Time for a story...

When gcc (back in 1.x days) first implemented long long, it didn't (always)
pass 64bit arguments in 'aligned' registers/stack slots, with the result that
argument offsets didn't match structure offsets. This affected the nine system
calls that pass off_t arguments:
ftruncate lseek mmap mquery pread preadv pwrite pwritev truncate

To avoid having to do custom ASM wrappers for those, BSD put an explicit pad
argument in so that the off_t argument would always start on a even slot and
thus be naturally aligned. Thus those odd wrappers in lib/libc/sys/ that use
__syscall() and pass an extra '0' argument.

The ABIs for different CPUs eventually settled how things should be passed on
each and gcc 2.x followed them. The only arch now where it helps is landisk,
which needs to skip the last argument register if it would be the first half of
a 64bit argument. So: add new syscalls without the pad argument and on landisk
do that skipping directly in the syscall handler in the kernel. Keep compat
support for the existing syscalls long enough for the transition.

ok deraadt@


Revision tags: OPENBSD_7_0_BASE
# 1.160 11-Jun-2021 kettenis

Since futex(2) can fail, it needs a full syscall stub. This should fixes
issues on powerpc64 and sparc64.

Note that this makes the lib/libpthread/errno test fail since that test
detects that we are touching errno now. This will be addressed in a
future diff as it is not entirely clear whether the test is correct.

ok mpi@, bluhm@


Revision tags: OPENBSD_6_8_BASE OPENBSD_6_9_BASE
# 1.159 06-Jul-2020 pirofti

Add support for timeconting in userland.

This diff exposes parts of clock_gettime(2) and gettimeofday(2) to
userland via libc eliberating processes from the need for a context
switch everytime they want to count the passage of time.

If a timecounter clock can be exposed to userland than it needs to set
its tc_user member to a non-zero value. Tested with one or multiple
counters per architecture.

The timing data is shared through a pointer found in the new ELF
auxiliary vector AUX_openbsd_timekeep containing timehands information
that is frequently updated by the kernel.

Timing differences between the last kernel update and the current time
are adjusted in userland by the tc_get_timecount() function inside the
MD usertc.c file.

This permits a much more responsive environment, quite visible in
browsers, office programs and gaming (apparently one is are able to fly
in Minecraft now).

Tested by robert@, sthen@, naddy@, kmos@, phessler@, and many others!

OK from at least kettenis@, cheloha@, naddy@, sthen@


Revision tags: OPENBSD_6_7_BASE
# 1.158 27-Nov-2019 deraadt

Document msyscall(2): ld.so can use this (once only) to tell the kernel
where libc.so's text segment is, thereby allowing invocation of system
calls from that region. An upcoming change will kill the process if a
system call is invoked from addresses not explicitly permitted.
ok guenther kettenis mortimer


Revision tags: OPENBSD_6_6_BASE
# 1.157 28-May-2019 beck

Enable the use of the kernel __realpath() system call in the libc wrapper.

For now, this also still uses the existing realpath implmentation
and emits a syslog if we see differening results. Once we have run
with that for a little while we will remove the old code

ok deraadt@


Revision tags: OPENBSD_6_5_BASE
# 1.156 11-Jan-2019 deraadt

mincore() is a relic from the past, exposing physical machine information
about shared resources which no program should see. only a few pieces of
software use it, generally poorly thought out. they are being fixed, so
mincore() can be deleted.
ok guenther tedu jca sthen, others


Revision tags: OPENBSD_6_4_BASE
# 1.155 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.154 12-Jan-2018 deraadt

sysctl(3) can now be renamed to sysctl(2)


# 1.153 28-Nov-2017 guenther

Delete fktrace(2). The consequences of it were not thought through
sufficiently and at least one horrific security hole was the result.

ok deraadt@ beck@


Revision tags: OPENBSD_6_2_BASE
# 1.152 13-Aug-2017 tedu

add fktrace to libc


# 1.151 12-Aug-2017 guenther

Instead of hardcoding a partial dependency list for the syscall stub objects,
calculate them as done for other objects


# 1.150 31-May-2017 sthen

install futex(2), ok mpi


# 1.149 30-Apr-2017 mpi

Add futex(2) shim, bump minor.

Inputs from guenther@, ok kettenis@, visa@


Revision tags: OPENBSD_6_1_BASE
# 1.148 29-Mar-2017 deraadt

The hppa version of as(1) requires whitespace before a .file directive,
it may not be in column 0. This kind of thing is very common in GNU
and Linux software because the software was written from the start to
be 'compatible replacements' of vendor software.
ok jsing guenther


# 1.147 26-Mar-2017 guenther

Use .file to convince 'as' to generate proper FILE symbols in the syscall
stubs that aren't actually in files, so that syspatch can figure out what
order the syscall stub objects are in the .so. Use -P to suppress to #line
directives that would override that. Tested with both gcc/gas and clang.

ok deraadt@


Revision tags: OPENBSD_6_0_BASE
# 1.146 04-Jul-2016 guenther

DEBUGLIBS has been broken since the gcc4 switch, so delete it. CFLAGS
contains -g by default anyway

problem noted by Edgar Pettijohn (edgar (at) pettijohn-web.com)
ok millert@ kettenis@ deraadt@


# 1.145 30-May-2016 guenther

Move __getcwd from ASM to HIDDEN: we don't want the literal __getcwd symbol

ok millert@ deraadt@


# 1.144 19-May-2016 guenther

Add ASM_NOERR for syscalls that never fail and thus don't need the errno
setting logic...which can significantly reduce the size of the stub on
some archs; 20 syscalls get a trim with this.

in snaps for a bit and ok deraadt@


# 1.143 09-May-2016 guenther

Remove sigreturn declaration and the now-unused libc syscall stub


# 1.142 07-May-2016 guenther

Use a Thread Information Block in both single and multi-threaded programs.
This stores errno, the cancelation flags, and related bits for each thread
and is allocated by ld.so or libc.a. This is an ABI break from 5.9-stable!

Make libpthread dlopen'able by moving the cancelation wrappers into libc
and doing locking and fork/errno handling via callbacks that libpthread
registers when it first initializes. 'errno' *must* be declared via
<errno.h> now!

Clean up libpthread's symbol exports like libc.

On powerpc, offset the TIB/TCB/TLS data from the register per the ELF spec.

Testing by various, particularly sthen@ and patrick@
ok kettenis@


# 1.141 30-Mar-2016 guenther

Turd polish: use HIDDEN= instead of PSEUDO= for ptrace syscall stub, to
make its underlying symbol name look like others.


# 1.140 30-Mar-2016 guenther

Eliminate userspace caching by getlogin_r/setlogin; make the getlogin
syscall behave exactly like userspace getlogin_r() and rename it to
match. Eliminate the reduced-to-no-op wrappers of the syscalls.
Eliminate the unnecessary per-thread static buffering by getlogin().

ok kettenis@ deraadt@


# 1.139 30-Mar-2016 jmc

for some time now mandoc has not required MLINKS to function
correctly - logically complete that now by removing MLINKS from base;

authors need only to ensure there is an entry in NAME for any function/
util being added. MLINKS will still work, and remain for perl to ease
upgrades;

ok nicm (curses) bcook (ssl)
ok schwarze, who provided a lot of feedback and assistance
ok tb natano jung


# 1.138 21-Mar-2016 bluhm

Rename the system call sendsyslog2 to sendsyslog. Keep the old one
as osendsyslog for a while. The three argument variant is the only
one that will stay.
input kettenis@; OK deraadt@


Revision tags: OPENBSD_5_9_BASE
# 1.137 25-Nov-2015 deraadt

Add a syscall stub for sendsyslog2(2), and use it in syslog_r(3), passing
LOG_CONS to the kernel. As a result, the /dev/console opening code can
be removed.
ok kettenis millert beck


# 1.136 10-Nov-2015 guenther

Split the intra-thread functionality from kill(2) into its own syscall
thrkill(2), rolling the kill(2) syscall number with the ABI change to
avoid breaking binaries during during the transition. thrkill(2) includes
a 'tcb' argument that eliminates the need for locking in pthread_kill()
and simplifies pthread_cancel(). Switch __stack_smash_handler() to use
thrkill(2) and explicitly unblock SIGABRT.

Minor bump to both libc and libpthread: make sure you install a new kernel!

ok semarie@


# 1.135 23-Oct-2015 guenther

Merge the sigaction() and sigprocmask() overloads/wrappers from libpthread
into libc, and move pthread_sigmask() as well (just a trivial wrapper).
This provides consistent handling of SIGTHR between single- and multi-threaded
programs and is a step in the merge of all the libpthread overloads, providing
some ASM and Makefile bits that the other wrappers will need.

ok deraadt@ millert@


# 1.134 23-Oct-2015 deraadt

Remove dnssocket() and dnsconnect(), since we decided to use a SOCK_DNS
flag instead.
ok guenther tedu semarie


# 1.133 19-Oct-2015 deraadt

Remove old tame() stub


# 1.132 18-Oct-2015 deraadt

create libc stubs for dnssocket() and dnsconnect()


# 1.131 09-Oct-2015 deraadt

tame -> pledge conversion, in libc. I should crank libc, but am cheating
hoping things go well. The old symbol is faked via a stupid stub function,
until next major crank when it can be removed. I am expecting guenther
to scream at me.


# 1.130 13-Sep-2015 guenther

Rename __sysctl syscall to just sysctl, as the userland wrapper is no longer
necessary

ok deraadt@ jsing@


# 1.129 09-Sep-2015 guenther

Simplify makefile rules for building the ASM stubs into "pick something
from column A and something from column B".

ok miod@ deraadt@


# 1.128 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@


# 1.127 25-Aug-2015 guenther

Document kbind(2)


Revision tags: OPENBSD_5_8_BASE
# 1.126 19-Jul-2015 deraadt

manual page for tame(2). not very good, so i will be hearing from jmc


# 1.125 07-Apr-2015 guenther

Make pthread_atfork() track the DSO that called it like atexit() does,
unregistering callbacks if the DSO is unloaded. Move the callback
handling from libpthread to libc, though libpthread still overrides the
inner call to handle locking and thread-library reinitialization.
Major version bump for both libc and libpthread.

verification that this fixes various ports ajacoutot@
asm assistance miod@; ok millert@ deraadt@


Revision tags: OPENBSD_5_7_BASE
# 1.124 08-Dec-2014 guenther

Add chflagsat(), modeled on fchmodat() with name to match FreeBSD.


# 1.123 14-Nov-2014 guenther

Add sched_yield(2) manpage


# 1.122 31-Aug-2014 guenther

Declare and document getthrid()

indirectly prodded by krw@


# 1.121 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@


# 1.120 14-Aug-2014 tobias

fixed overrid(d)en typo

millert@ and jmc@ agree that "overriden" is wrong


Revision tags: OPENBSD_5_6_BASE
# 1.119 12-Jul-2014 deraadt

document sendsyslog(2); ok guenther tedu matthew


# 1.118 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.117 18-Mar-2014 miod

Retire hp300, mvme68k and mvme88k ports. These ports have no users, keeping
this hardware alive is becoming increasingly difficult, and I should heed the
message sent by the three disks which have died on me over the last few days.

Noone sane will mourn these ports anyway. So long, and thanks for the fish.


Revision tags: OPENBSD_5_5_BASE
# 1.116 13-Oct-2013 guenther

Make it possible to build to reduced version of a library, including
just specific objects that are compiled with additional options to
reduce their size. For use by distrib/ and crunchgen.

style and naming assistance from espie@


# 1.115 07-Oct-2013 guenther

getdirentries(2) is dead; long live getdents(2)!

confirmation that getdirentries(2) is unused by ports from sthen@ and naddy@


# 1.114 13-Aug-2013 guenther

Switch time_t, ino_t, clock_t, and struct kevent's ident and data
members to 64bit types. Assign new syscall numbers for (almost
all) the syscalls that involve the affected types, including anything
with time_t, timeval, itimerval, timespec, rusage, dirent, stat,
or kevent arguments. Add a d_off member to struct dirent and replace
getdirentries() with getdents(), thus immensely simplifying and
accelerating telldir/seekdir. Build perl with -DBIG_TIME.

Bump the major on every single base library: the compat bits included
here are only good enough to make the transition; the T32 compat
option will be burned as soon as we've reached the new world are
are happy with the snapshots for all architectures.

DANGER: ABI incompatibility. Updating to this kernel requires extra
work or you won't be able to login: install a snapshot instead.

Much assistance in fixing userland issues from deraadt@ and tedu@
and build assistance from todd@ and otto@


Revision tags: OPENBSD_5_4_BASE
# 1.113 05-Jun-2013 guenther

Move _Exit() from the exit() manpage to the _exit() manpage, as it's
just an alias of the latter.

ok matthew@ tedu@


# 1.112 01-Jun-2013 miod

Add utrace(2), a system call allowing for userland to send its own ktrace
records. From FreeBSD via otto@, with tweaks suggested by guenther@.
Commite on behalf of otto@ who is not around, to ride the libc minor bump.
Causes a librthread minor bump as well (new syscall).


# 1.111 29-Apr-2013 matthew

Extend P_SIGSUSPEND handling in userret() to properly restore the
sigmask even if there are no pending signals under the temporary
sigmask.

Refactor existing select() and poll() system calls to introduce the
pselect() and ppoll() system calls.

Add rthread wrappers for pselect() and ppoll(). While there, update
cancellation point comments to reflect recent fdatasync() addition.

Minor bumps for libc and librthread due to new symbols.

ok guenther, millert, deraadt, jmc


# 1.110 15-Apr-2013 matthew

Implement fdatasync() as a wrapper around fsync()

ok guenther, deraadt, jmc


Revision tags: OPENBSD_5_3_BASE
# 1.109 03-Feb-2013 miod

gremlin crept in


# 1.108 02-Feb-2013 miod

Userland bits for m68k/ELF. Mostly addition of register prefixes to the
assembler instructions, and cope with the few changes in return values
location.


# 1.107 04-Sep-2012 okan

remove lint leftovers; ok guenther@


# 1.106 23-Aug-2012 deraadt

no more nnpfspioctl() system call; ok guenther


# 1.105 22-Aug-2012 pascal

Convert cpp | as rules in bsd.lib.mk and lib/libc/sys/Makefile.inc to pure cc
invocations. This allows us to use the compiler builtin define __PIC__ to check
for PIC/PIEness rather than passing -DPIC. Simplifies PIE work a lot.

ok matthew@, conceptually ok kurt@


# 1.104 21-Aug-2012 pascal

Kill an old mips workaround; we don't support mips, just mips64.

ok deraadt@ kettenis@


Revision tags: OPENBSD_5_2_BASE
# 1.103 19-Jun-2012 deraadt

oops, forgot to install getdtablecount(2); noted by tedu


# 1.102 12-Apr-2012 deraadt

remove rfork(); ok guenther miod


# 1.101 12-Apr-2012 deraadt

kill lfs system call lines and libc stubs


# 1.100 12-Apr-2012 deraadt

New system call: getdtablecount(2) returns the number of file
descriptors the process currently has open.
ok guenther miod gilles ...


# 1.99 22-Mar-2012 guenther

Move __tfork_thread() from rthreads (libpthread) to libc so that
it can be used for not-strictly-threading purposes

ok matthew@ kurt@


# 1.98 13-Mar-2012 guenther

Add manpages for __thrsigdivert, __thrsleep, and __thrwakeup. Various
syntax and grammar fixes from jmc@


Revision tags: OPENBSD_5_1_BASE
# 1.97 17-Jan-2012 guenther

Reimplement mutexes, condvars, and rwlocks to eliminate bugs,
particularly the "consume the signal you just sent" hang, and putting
the wait queues in userspace.

Do cancellation handling in pthread_cond_*wait(), pthread_join(),
and sem_wait().

Add __ prefix to thr{sleep,wakeup,exit,sigdivert}() syscalls; add
'abort" argument to thrsleep to close cancellation race; make
thr{sleep,wakeup} return errno values via *retval to avoid touching
userspace errno.


# 1.96 22-Nov-2011 guenther

sigstack() is long dead, and the compat sigaltstack syscall is gone too.
Correct the namespace protections for sigreturn(), sigwait(), and psignal()

ok millert@


# 1.95 16-Oct-2011 guenther

Add stubs and manpage for __{get,set}_tcb

ok deraadt@


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

Add (rough draft) documentation for fdopendir(3) and the 15 new
XXXat(2) system calls from POSIX 2008. Editing will be done in tree.

General style discussed with jmc@, schwarze@, and deraadt@
ok jmc@


# 1.93 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@


Revision tags: OPENBSD_4_8_BASE OPENBSD_4_9_BASE
# 1.92 03-Jul-2010 guenther

Fix the naming of interfaces and variables for rdomains and rtables
and make it possible to bind sockets (including listening sockets!)
to rtables and not just rdomains. This changes the name of the
system calls, socket option, and ioctl. After building with this
you should remove the files /usr/share/man/cat2/[gs]etrdomain.0.

Since this removes the existing [gs]etrdomain() system calls, the
libc major is bumped.

Written by claudio@, criticized^Wcritiqued by me


# 1.91 01-Jul-2010 deraadt

getpeereid() can now be a library routine using getsockopt() with
SOL_SOCKET and SO_PEERCRED, only issue being that it cannot return
EFAULT for a page fault. The kernel code will soon be put into
compat, and then in 10 years or so tedu will delete it.
ok guenther millert


# 1.90 18-May-2010 tedu

add posix_madvise, posix_memalign, strndup, and strnlen. mostly from
brad and millert, with hints from guenther, jmc, and otto I think.
ok previous.


Revision tags: OPENBSD_4_7_BASE
# 1.89 03-Feb-2010 miod

Use MACHINE_CPU instead of MACHINE_ARCH to pick the correct machine dependent
files or directories when applicable.
The inspiration and name of MACHINE_CPU come from NetBSD, although the way to
provide it to Makefiles is completely different.
ok kettenis@


# 1.88 27-Nov-2009 guenther

Add setrdomain() and getrdomain() system calls. Committing now to
catch the libc major bump per request from deraadt@

Diff by reyk.

ok guenther@


# 1.87 13-Aug-2009 jmc

various MLINK fixes from Alan R. S. Bueno;


Revision tags: OPENBSD_4_6_BASE
# 1.86 03-Jun-2009 jj

Arla client rename from xfs to nnpfs for later upgrades. Tested on various arches. ok todd@ beck@


Revision tags: OPENBSD_4_4_BASE OPENBSD_4_5_BASE
# 1.85 22-Mar-2008 otto

move statvfs.c to gen, since it is not a syscall; ok deraadt@


# 1.84 16-Mar-2008 otto

statvfs support


Revision tags: OPENBSD_4_3_BASE
# 1.83 05-Jan-2008 deraadt

no more need for vadvise.o


# 1.82 09-Sep-2007 otto

Add lint stubs for the longjmp family of functions which are defined in
assembly on all platforms. ok deraadt@


# 1.81 09-Sep-2007 otto

Silence erroneous "environ used, but not defined" lint warning by
providing a stub. ok deraadt@


Revision tags: OPENBSD_4_1_BASE OPENBSD_4_2_BASE
# 1.80 24-Oct-2006 tedu

add rthread syscalls and bump minor.
rthreads are hardly done, but if just trying it out is too much of a hassle,
we'll never make more progress.
ok brad marc marco mbalmer


# 1.79 10-Oct-2006 deraadt

MLINKS to macros described in stat(2)


Revision tags: OPENBSD_4_0_BASE
# 1.78 14-Jun-2006 otto

Introducing adjfreq(2), to adjust the clock frequency.
Loosely based on dragonfly code. Man page help fro jmc@; ok deraadt@


# 1.77 27-May-2006 pedro

Make libc's getcwd() use the new __getcwd() system call
Hacked by marius@ at c2k5, okay miod@ krw@ deraadt@


# 1.76 13-Mar-2006 moritz

Clean the correct file. ok deraadt@


Revision tags: OPENBSD_3_9_BASE
# 1.75 29-Nov-2005 deraadt

Provide stubs for things which are supplied by crt0. I don't think we
want a crt0.ln, at least, not yet. We may reconsider later.


# 1.74 03-Oct-2005 jmc

add missing MLINK for WEXITSTATUS.2


Revision tags: OPENBSD_3_8_BASE
# 1.73 17-Jun-2005 drahn

Extended Attributes was a piece to get to ACLs, however ACLs have not
been worked on, so EA is pointless to maintain.


# 1.72 17-Jun-2005 millert

remove undelete syscall


Revision tags: OPENBSD_3_7_BASE
# 1.71 18-Sep-2004 deraadt

MLINK to macros provided in wait.2


# 1.70 16-Sep-2004 deraadt

add files missing for building a proper lint library


Revision tags: OPENBSD_3_5_BASE OPENBSD_3_6_BASE
# 1.69 13-Feb-2004 tedu

death to osigaltstack. ok deraadt@


# 1.68 15-Jan-2004 deraadt

ABI breakage happened with the sigaltstack replacement. It is too late,
now we just have to cope. Since setjmp uses it, the alpha and sparc64 are
unhappy with the structure change. In a few days, we will make the second
hop here, for now, use the old system call until all binaries have the new
struct in them.


# 1.67 12-Jan-2004 tedu

new syscall closefrom(2). ok deraadt millert


Revision tags: OPENBSD_3_4_BASE
# 1.66 10-May-2003 miod

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


# 1.65 14-Apr-2003 art

There are two related changes.

The first one is an mquery(2) syscall. It's for asking the VM system
about where to map things. It will be used by ld.so, read the man page
for details.

The second change is related and is a centralization of uvm_map hint
that all callers of uvm_map calculated. This will allow us to adjust
this hint on architectures that have segments for non-exec mappings.

deraadt@ drahn@ ok.


Revision tags: OPENBSD_3_3_BASE
# 1.64 31-Jan-2003 millert

Replace emulated versions of setreuid() and setregid() with real syscalls.
These are spec'd by POSIX as of 1003.1-2001; deraadt@ OK


# 1.63 02-Dec-2002 millert

Document getlogin_r()


# 1.62 02-Dec-2002 miod

Import propolice (http://www.trl.ibm.com/projects/security/ssp), a stack
attack protection scheme, into gcc.

This protection is enabled by default. It can be turned off by using the
-fno-stack-protector flag.

Code by Hiroaki Etoh (etoh at jp dot ibm dot com); work on openbsd-specific
integration by fgsch@, deraadt@ and myself; tests by fgsch@, naddy@ and
myself; beer drinking by myself.

Please note that system upgrades with this new code will require a new
libc and ld.so to be build and installed before the propolice-enabled
compiler can be installed.


# 1.61 10-Nov-2002 fgsch

missing MLINKs for setresuid(2). millert ok.


# 1.60 05-Nov-2002 marc

thread safe libc -- 2nd try. OK miod@, millert@
Thanks to miod@ for m68k and vax fixes


# 1.59 03-Nov-2002 marc

back out previous patch.. there are still some vax/m68k issues


# 1.58 03-Nov-2002 marc

libc changes for thread safety. Tested on:
alpha (millert@), i386 (marc@), m68k (millert@ and miod@),
powerpc (drahn@ and dhartmei@), sparc (millert@ and marc@),
sparc64 (marc@), and vax (millert@ and miod@).
Thanks to millert@, miod@, and mickey@ for fixes along the way.


# 1.57 30-Oct-2002 millert

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


Revision tags: OPENBSD_3_2_BASE
# 1.56 05-Aug-2002 art

Fix brain blackout.
Pointed out byb miod@.


# 1.55 05-Aug-2002 art

One more ELF_TOOLCHAIN.


# 1.54 06-Jul-2002 nordin

Remove kernel support for NTP. ok deraadt@ and tholo@


# 1.53 10-Jun-2002 fgsch

correct comment.


# 1.52 08-Jun-2002 drahn

ELF architectures all support weak aliases, enable them for this part.
ok fgsch@


Revision tags: OPENBSD_3_1_BASE
# 1.51 22-Feb-2002 drahn

Extended Attribute support, from FreeBSD/TrustedBSD. ok art@ deraadt@
libc support pieces


# 1.50 21-Feb-2002 art

remove rfork.o from the auto-generated assembler stubs


# 1.49 17-Feb-2002 deraadt

rfork() needs a fork.S-like stub as well; ok art


Revision tags: OPENBSD_3_0_BASE
# 1.48 25-Sep-2001 niklas

Forgotten DEBUGLIBS stuff


# 1.47 25-Sep-2001 drahn

Add an ASPICFLAG variable to bsd.own.mk which a platform use to pass flags
to 'as' to make it compile pic. add defaults for sparc64 which needs picflags
set to -fPIC and ASPICFLAGS to -KPIC.
Also simplifies the systemcall generation for sparc64 PIC mode.
ok epsie@.


# 1.46 20-Sep-2001 millert

Add PSEUDO_NOERROR similar to that used by NetBSD.
Some ports were setting errno in PSEUDO and some were not. Now errno
is set for all in PSEUDO and PSEUDO_NOERROR is provided for the
non-errno case (only used by _exit).

Needs testing on vax and m88k.
XXX - hppa and powerpc still lack a real PSEUDO_NOERROR implementation.
Currently PSEUDO_NOERROR and PSEUDO are the same (so builds don't
break on those platforms).


# 1.45 09-Jul-2001 fgsch

Install getpeereid(2) manpage.


# 1.44 26-Jun-2001 dugsong

implement djb's getpeereid(2), to allow local-domain servers to determine client credentials. mostly from superscript.com. deraadt@ ok


Revision tags: OPENBSD_2_9_BASE
# 1.43 14-Mar-2001 aaron

Move description of exect() to execve(2) man page. Add a note about exect() not
being portable.


# 1.42 09-Mar-2001 art

Add mlockall and munlockall. man-page from NetBSD.


# 1.41 10-Jan-2001 deraadt

put up FD_* manual pages, in section 3


# 1.40 23-Dec-2000 deraadt

create proper docs for timer{add,clear,sub,isset,cmp}


# 1.39 16-Nov-2000 provos

kqueue and kevent system calls


Revision tags: OPENBSD_2_8_BASE
# 1.38 17-Oct-2000 deraadt

damn it, i have had it with this untested weak shit


# 1.37 16-Oct-2000 deraadt

re-add weak sparc support; d@


# 1.36 15-May-2000 niklas

Add support for building libraries with debugging information in them.
Enable by setting DEBUGLIBS=yes in /etc/mk.conf, then -g libraries will get
installed in /usr/lib/debug. This directory will be searched first if
gcc is given the -g flag during the link stage.


Revision tags: OPENBSD_2_7_BASE
# 1.35 01-May-2000 deraadt

bye bye semconfig(2)


# 1.34 20-Apr-2000 deraadt

p{read,write}{,v} man pages


# 1.33 07-Feb-2000 assar

add fhopen, fhstat, fhstatfs system calls. largely from NetBSD


# 1.32 06-Jan-2000 d

for now, disable weak aliases for all archs except i386


# 1.31 14-Dec-1999 millert

Install swapctl.2, not swapon.2. swapon.2 should probably go away.


Revision tags: OPENBSD_2_6_BASE
# 1.30 07-Jun-1999 deraadt

replacement pipe() system call; copies data into place inside kernel, so
that EFAULT return value is possible


# 1.29 22-May-1999 weingart

Add swapctl(2), and crank shlib minor.


Revision tags: OPENBSD_2_5_BASE
# 1.28 01-Feb-1999 d

mi ptrace


# 1.27 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


Revision tags: OPENBSD_2_4_BASE
# 1.26 18-Sep-1998 art

make use of xfspioctl


Revision tags: OPENBSD_2_3_BASE
# 1.25 08-Feb-1998 tholo

Better lint(1) framework. Mostly from cgd@NetBSD


# 1.24 13-Nov-1997 deraadt

add getsid(2), XPG4


Revision tags: OPENBSD_2_2_BASE
# 1.23 30-May-1997 kstailey

add getpgrp(2) from NetBSD


Revision tags: OPENBSD_2_1_BASE
# 1.22 08-May-1997 kstailey

add tag


# 1.21 08-May-1997 kstailey

make clock_gettime.cat2


# 1.20 20-Apr-1997 tholo

New POSIX 1003.1b syscalls; from pk@NetBSD


# 1.19 04-Apr-1997 deraadt

seek(2) is not needed


# 1.18 29-Mar-1997 deraadt

futimes link; nakayosh@kcn.or.jp


# 1.17 26-Mar-1997 deraadt

install ktrace(2)


# 1.16 26-Jan-1997 downsj

Add a link for lchown.2


# 1.15 26-Jan-1997 downsj

Add lchown(), increment minor number.


# 1.14 11-Dec-1996 deraadt

generate reboot.o like other system calls


Revision tags: OPENBSD_2_0_BASE
# 1.13 02-Sep-1996 deraadt

shmdt link


# 1.12 25-Aug-1996 deraadt

and a man page


# 1.11 18-Jun-1996 deraadt

build poll.o


# 1.10 19-May-1996 pefo

Changes for mips.


# 1.9 18-May-1996 deraadt

poll() as a system call


# 1.8 08-May-1996 deraadt

install rfork man page


# 1.7 01-May-1996 deraadt

add futimes


# 1.6 25-Mar-1996 tholo

Add support for building lint(1) library


# 1.5 29-Jan-1996 tholo

Add kernel PLL for system clock
Add ntp_adjtime() and ntp_gettime() system calls
Mostly stolen from FreeBSD


# 1.4 08-Jan-1996 deraadt

add rfork.o and minherit.o


# 1.3 07-Jan-1996 deraadt

add minherit() system call


# 1.2 14-Dec-1995 deraadt

from netbsd:
add & fix a bunch of system call pages


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.172 21-Feb-2023 deraadt

create a stub for pinsyscall(2)
ok guenther


# 1.171 16-Feb-2023 deraadt

Document pinsyscall(2). The ld.so and kernel enforcement code is not
commited ye -- waiting for enough people to run kernels which support
the system call.
ok jmc


# 1.170 11-Feb-2023 deraadt

__syscall() is no longer neccessary since the system calls which needed
it are now unpadded
ok kettenis guenther


# 1.169 08-Jan-2023 guenther

Add getthrname(2) manpage

ok jmc@ schwarze@


# 1.168 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@


# 1.167 19-Dec-2022 guenther

Add waitid(2) manpage, based on a first pass by espie@ and bits
from FreeBSD and NetBSD.

ok kettenis@ jmc@ espie@


# 1.166 26-Oct-2022 kettenis

Add waitid(2) syscall stub.

Minor bump to both libc and libpthread: make sure you install a new kernel!

ok millert@, deraadt@


# 1.165 07-Oct-2022 deraadt

Add mimmutable(2) libc stub, add & adjust manual pages, and crank the minor.
ok kettenis


Revision tags: OPENBSD_7_2_BASE
# 1.164 09-Sep-2022 mbuhl

Add libc wrappers for the new sendmmsg and recvmmsg system calls.
Feedback tb@, miod@, jca@
OK jca@


# 1.163 17-Jul-2022 deraadt

Add ypconnect(2) stub inside libc so that libc functions can use it,
but do not export it.


# 1.162 17-Jul-2022 deraadt

add ypconnect(2) manual page


Revision tags: OPENBSD_7_1_BASE
# 1.161 23-Dec-2021 guenther

Roll the syscalls that have an off_t argument to remove the explicit padding.
Switch libc and ld.so to the generic stubs for these calls.
WARNING: reboot to updated kernel before installing libc or ld.so!

Time for a story...

When gcc (back in 1.x days) first implemented long long, it didn't (always)
pass 64bit arguments in 'aligned' registers/stack slots, with the result that
argument offsets didn't match structure offsets. This affected the nine system
calls that pass off_t arguments:
ftruncate lseek mmap mquery pread preadv pwrite pwritev truncate

To avoid having to do custom ASM wrappers for those, BSD put an explicit pad
argument in so that the off_t argument would always start on a even slot and
thus be naturally aligned. Thus those odd wrappers in lib/libc/sys/ that use
__syscall() and pass an extra '0' argument.

The ABIs for different CPUs eventually settled how things should be passed on
each and gcc 2.x followed them. The only arch now where it helps is landisk,
which needs to skip the last argument register if it would be the first half of
a 64bit argument. So: add new syscalls without the pad argument and on landisk
do that skipping directly in the syscall handler in the kernel. Keep compat
support for the existing syscalls long enough for the transition.

ok deraadt@


Revision tags: OPENBSD_7_0_BASE
# 1.160 11-Jun-2021 kettenis

Since futex(2) can fail, it needs a full syscall stub. This should fixes
issues on powerpc64 and sparc64.

Note that this makes the lib/libpthread/errno test fail since that test
detects that we are touching errno now. This will be addressed in a
future diff as it is not entirely clear whether the test is correct.

ok mpi@, bluhm@


Revision tags: OPENBSD_6_8_BASE OPENBSD_6_9_BASE
# 1.159 06-Jul-2020 pirofti

Add support for timeconting in userland.

This diff exposes parts of clock_gettime(2) and gettimeofday(2) to
userland via libc eliberating processes from the need for a context
switch everytime they want to count the passage of time.

If a timecounter clock can be exposed to userland than it needs to set
its tc_user member to a non-zero value. Tested with one or multiple
counters per architecture.

The timing data is shared through a pointer found in the new ELF
auxiliary vector AUX_openbsd_timekeep containing timehands information
that is frequently updated by the kernel.

Timing differences between the last kernel update and the current time
are adjusted in userland by the tc_get_timecount() function inside the
MD usertc.c file.

This permits a much more responsive environment, quite visible in
browsers, office programs and gaming (apparently one is are able to fly
in Minecraft now).

Tested by robert@, sthen@, naddy@, kmos@, phessler@, and many others!

OK from at least kettenis@, cheloha@, naddy@, sthen@


Revision tags: OPENBSD_6_7_BASE
# 1.158 27-Nov-2019 deraadt

Document msyscall(2): ld.so can use this (once only) to tell the kernel
where libc.so's text segment is, thereby allowing invocation of system
calls from that region. An upcoming change will kill the process if a
system call is invoked from addresses not explicitly permitted.
ok guenther kettenis mortimer


Revision tags: OPENBSD_6_6_BASE
# 1.157 28-May-2019 beck

Enable the use of the kernel __realpath() system call in the libc wrapper.

For now, this also still uses the existing realpath implmentation
and emits a syslog if we see differening results. Once we have run
with that for a little while we will remove the old code

ok deraadt@


Revision tags: OPENBSD_6_5_BASE
# 1.156 11-Jan-2019 deraadt

mincore() is a relic from the past, exposing physical machine information
about shared resources which no program should see. only a few pieces of
software use it, generally poorly thought out. they are being fixed, so
mincore() can be deleted.
ok guenther tedu jca sthen, others


Revision tags: OPENBSD_6_4_BASE
# 1.155 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.154 12-Jan-2018 deraadt

sysctl(3) can now be renamed to sysctl(2)


# 1.153 28-Nov-2017 guenther

Delete fktrace(2). The consequences of it were not thought through
sufficiently and at least one horrific security hole was the result.

ok deraadt@ beck@


Revision tags: OPENBSD_6_2_BASE
# 1.152 13-Aug-2017 tedu

add fktrace to libc


# 1.151 12-Aug-2017 guenther

Instead of hardcoding a partial dependency list for the syscall stub objects,
calculate them as done for other objects


# 1.150 31-May-2017 sthen

install futex(2), ok mpi


# 1.149 30-Apr-2017 mpi

Add futex(2) shim, bump minor.

Inputs from guenther@, ok kettenis@, visa@


Revision tags: OPENBSD_6_1_BASE
# 1.148 29-Mar-2017 deraadt

The hppa version of as(1) requires whitespace before a .file directive,
it may not be in column 0. This kind of thing is very common in GNU
and Linux software because the software was written from the start to
be 'compatible replacements' of vendor software.
ok jsing guenther


# 1.147 26-Mar-2017 guenther

Use .file to convince 'as' to generate proper FILE symbols in the syscall
stubs that aren't actually in files, so that syspatch can figure out what
order the syscall stub objects are in the .so. Use -P to suppress to #line
directives that would override that. Tested with both gcc/gas and clang.

ok deraadt@


Revision tags: OPENBSD_6_0_BASE
# 1.146 04-Jul-2016 guenther

DEBUGLIBS has been broken since the gcc4 switch, so delete it. CFLAGS
contains -g by default anyway

problem noted by Edgar Pettijohn (edgar (at) pettijohn-web.com)
ok millert@ kettenis@ deraadt@


# 1.145 30-May-2016 guenther

Move __getcwd from ASM to HIDDEN: we don't want the literal __getcwd symbol

ok millert@ deraadt@


# 1.144 19-May-2016 guenther

Add ASM_NOERR for syscalls that never fail and thus don't need the errno
setting logic...which can significantly reduce the size of the stub on
some archs; 20 syscalls get a trim with this.

in snaps for a bit and ok deraadt@


# 1.143 09-May-2016 guenther

Remove sigreturn declaration and the now-unused libc syscall stub


# 1.142 07-May-2016 guenther

Use a Thread Information Block in both single and multi-threaded programs.
This stores errno, the cancelation flags, and related bits for each thread
and is allocated by ld.so or libc.a. This is an ABI break from 5.9-stable!

Make libpthread dlopen'able by moving the cancelation wrappers into libc
and doing locking and fork/errno handling via callbacks that libpthread
registers when it first initializes. 'errno' *must* be declared via
<errno.h> now!

Clean up libpthread's symbol exports like libc.

On powerpc, offset the TIB/TCB/TLS data from the register per the ELF spec.

Testing by various, particularly sthen@ and patrick@
ok kettenis@


# 1.141 30-Mar-2016 guenther

Turd polish: use HIDDEN= instead of PSEUDO= for ptrace syscall stub, to
make its underlying symbol name look like others.


# 1.140 30-Mar-2016 guenther

Eliminate userspace caching by getlogin_r/setlogin; make the getlogin
syscall behave exactly like userspace getlogin_r() and rename it to
match. Eliminate the reduced-to-no-op wrappers of the syscalls.
Eliminate the unnecessary per-thread static buffering by getlogin().

ok kettenis@ deraadt@


# 1.139 30-Mar-2016 jmc

for some time now mandoc has not required MLINKS to function
correctly - logically complete that now by removing MLINKS from base;

authors need only to ensure there is an entry in NAME for any function/
util being added. MLINKS will still work, and remain for perl to ease
upgrades;

ok nicm (curses) bcook (ssl)
ok schwarze, who provided a lot of feedback and assistance
ok tb natano jung


# 1.138 21-Mar-2016 bluhm

Rename the system call sendsyslog2 to sendsyslog. Keep the old one
as osendsyslog for a while. The three argument variant is the only
one that will stay.
input kettenis@; OK deraadt@


Revision tags: OPENBSD_5_9_BASE
# 1.137 25-Nov-2015 deraadt

Add a syscall stub for sendsyslog2(2), and use it in syslog_r(3), passing
LOG_CONS to the kernel. As a result, the /dev/console opening code can
be removed.
ok kettenis millert beck


# 1.136 10-Nov-2015 guenther

Split the intra-thread functionality from kill(2) into its own syscall
thrkill(2), rolling the kill(2) syscall number with the ABI change to
avoid breaking binaries during during the transition. thrkill(2) includes
a 'tcb' argument that eliminates the need for locking in pthread_kill()
and simplifies pthread_cancel(). Switch __stack_smash_handler() to use
thrkill(2) and explicitly unblock SIGABRT.

Minor bump to both libc and libpthread: make sure you install a new kernel!

ok semarie@


# 1.135 23-Oct-2015 guenther

Merge the sigaction() and sigprocmask() overloads/wrappers from libpthread
into libc, and move pthread_sigmask() as well (just a trivial wrapper).
This provides consistent handling of SIGTHR between single- and multi-threaded
programs and is a step in the merge of all the libpthread overloads, providing
some ASM and Makefile bits that the other wrappers will need.

ok deraadt@ millert@


# 1.134 23-Oct-2015 deraadt

Remove dnssocket() and dnsconnect(), since we decided to use a SOCK_DNS
flag instead.
ok guenther tedu semarie


# 1.133 19-Oct-2015 deraadt

Remove old tame() stub


# 1.132 18-Oct-2015 deraadt

create libc stubs for dnssocket() and dnsconnect()


# 1.131 09-Oct-2015 deraadt

tame -> pledge conversion, in libc. I should crank libc, but am cheating
hoping things go well. The old symbol is faked via a stupid stub function,
until next major crank when it can be removed. I am expecting guenther
to scream at me.


# 1.130 13-Sep-2015 guenther

Rename __sysctl syscall to just sysctl, as the userland wrapper is no longer
necessary

ok deraadt@ jsing@


# 1.129 09-Sep-2015 guenther

Simplify makefile rules for building the ASM stubs into "pick something
from column A and something from column B".

ok miod@ deraadt@


# 1.128 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@


# 1.127 25-Aug-2015 guenther

Document kbind(2)


Revision tags: OPENBSD_5_8_BASE
# 1.126 19-Jul-2015 deraadt

manual page for tame(2). not very good, so i will be hearing from jmc


# 1.125 07-Apr-2015 guenther

Make pthread_atfork() track the DSO that called it like atexit() does,
unregistering callbacks if the DSO is unloaded. Move the callback
handling from libpthread to libc, though libpthread still overrides the
inner call to handle locking and thread-library reinitialization.
Major version bump for both libc and libpthread.

verification that this fixes various ports ajacoutot@
asm assistance miod@; ok millert@ deraadt@


Revision tags: OPENBSD_5_7_BASE
# 1.124 08-Dec-2014 guenther

Add chflagsat(), modeled on fchmodat() with name to match FreeBSD.


# 1.123 14-Nov-2014 guenther

Add sched_yield(2) manpage


# 1.122 31-Aug-2014 guenther

Declare and document getthrid()

indirectly prodded by krw@


# 1.121 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@


# 1.120 14-Aug-2014 tobias

fixed overrid(d)en typo

millert@ and jmc@ agree that "overriden" is wrong


Revision tags: OPENBSD_5_6_BASE
# 1.119 12-Jul-2014 deraadt

document sendsyslog(2); ok guenther tedu matthew


# 1.118 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.117 18-Mar-2014 miod

Retire hp300, mvme68k and mvme88k ports. These ports have no users, keeping
this hardware alive is becoming increasingly difficult, and I should heed the
message sent by the three disks which have died on me over the last few days.

Noone sane will mourn these ports anyway. So long, and thanks for the fish.


Revision tags: OPENBSD_5_5_BASE
# 1.116 13-Oct-2013 guenther

Make it possible to build to reduced version of a library, including
just specific objects that are compiled with additional options to
reduce their size. For use by distrib/ and crunchgen.

style and naming assistance from espie@


# 1.115 07-Oct-2013 guenther

getdirentries(2) is dead; long live getdents(2)!

confirmation that getdirentries(2) is unused by ports from sthen@ and naddy@


# 1.114 13-Aug-2013 guenther

Switch time_t, ino_t, clock_t, and struct kevent's ident and data
members to 64bit types. Assign new syscall numbers for (almost
all) the syscalls that involve the affected types, including anything
with time_t, timeval, itimerval, timespec, rusage, dirent, stat,
or kevent arguments. Add a d_off member to struct dirent and replace
getdirentries() with getdents(), thus immensely simplifying and
accelerating telldir/seekdir. Build perl with -DBIG_TIME.

Bump the major on every single base library: the compat bits included
here are only good enough to make the transition; the T32 compat
option will be burned as soon as we've reached the new world are
are happy with the snapshots for all architectures.

DANGER: ABI incompatibility. Updating to this kernel requires extra
work or you won't be able to login: install a snapshot instead.

Much assistance in fixing userland issues from deraadt@ and tedu@
and build assistance from todd@ and otto@


Revision tags: OPENBSD_5_4_BASE
# 1.113 05-Jun-2013 guenther

Move _Exit() from the exit() manpage to the _exit() manpage, as it's
just an alias of the latter.

ok matthew@ tedu@


# 1.112 01-Jun-2013 miod

Add utrace(2), a system call allowing for userland to send its own ktrace
records. From FreeBSD via otto@, with tweaks suggested by guenther@.
Commite on behalf of otto@ who is not around, to ride the libc minor bump.
Causes a librthread minor bump as well (new syscall).


# 1.111 29-Apr-2013 matthew

Extend P_SIGSUSPEND handling in userret() to properly restore the
sigmask even if there are no pending signals under the temporary
sigmask.

Refactor existing select() and poll() system calls to introduce the
pselect() and ppoll() system calls.

Add rthread wrappers for pselect() and ppoll(). While there, update
cancellation point comments to reflect recent fdatasync() addition.

Minor bumps for libc and librthread due to new symbols.

ok guenther, millert, deraadt, jmc


# 1.110 15-Apr-2013 matthew

Implement fdatasync() as a wrapper around fsync()

ok guenther, deraadt, jmc


Revision tags: OPENBSD_5_3_BASE
# 1.109 03-Feb-2013 miod

gremlin crept in


# 1.108 02-Feb-2013 miod

Userland bits for m68k/ELF. Mostly addition of register prefixes to the
assembler instructions, and cope with the few changes in return values
location.


# 1.107 04-Sep-2012 okan

remove lint leftovers; ok guenther@


# 1.106 23-Aug-2012 deraadt

no more nnpfspioctl() system call; ok guenther


# 1.105 22-Aug-2012 pascal

Convert cpp | as rules in bsd.lib.mk and lib/libc/sys/Makefile.inc to pure cc
invocations. This allows us to use the compiler builtin define __PIC__ to check
for PIC/PIEness rather than passing -DPIC. Simplifies PIE work a lot.

ok matthew@, conceptually ok kurt@


# 1.104 21-Aug-2012 pascal

Kill an old mips workaround; we don't support mips, just mips64.

ok deraadt@ kettenis@


Revision tags: OPENBSD_5_2_BASE
# 1.103 19-Jun-2012 deraadt

oops, forgot to install getdtablecount(2); noted by tedu


# 1.102 12-Apr-2012 deraadt

remove rfork(); ok guenther miod


# 1.101 12-Apr-2012 deraadt

kill lfs system call lines and libc stubs


# 1.100 12-Apr-2012 deraadt

New system call: getdtablecount(2) returns the number of file
descriptors the process currently has open.
ok guenther miod gilles ...


# 1.99 22-Mar-2012 guenther

Move __tfork_thread() from rthreads (libpthread) to libc so that
it can be used for not-strictly-threading purposes

ok matthew@ kurt@


# 1.98 13-Mar-2012 guenther

Add manpages for __thrsigdivert, __thrsleep, and __thrwakeup. Various
syntax and grammar fixes from jmc@


Revision tags: OPENBSD_5_1_BASE
# 1.97 17-Jan-2012 guenther

Reimplement mutexes, condvars, and rwlocks to eliminate bugs,
particularly the "consume the signal you just sent" hang, and putting
the wait queues in userspace.

Do cancellation handling in pthread_cond_*wait(), pthread_join(),
and sem_wait().

Add __ prefix to thr{sleep,wakeup,exit,sigdivert}() syscalls; add
'abort" argument to thrsleep to close cancellation race; make
thr{sleep,wakeup} return errno values via *retval to avoid touching
userspace errno.


# 1.96 22-Nov-2011 guenther

sigstack() is long dead, and the compat sigaltstack syscall is gone too.
Correct the namespace protections for sigreturn(), sigwait(), and psignal()

ok millert@


# 1.95 16-Oct-2011 guenther

Add stubs and manpage for __{get,set}_tcb

ok deraadt@


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

Add (rough draft) documentation for fdopendir(3) and the 15 new
XXXat(2) system calls from POSIX 2008. Editing will be done in tree.

General style discussed with jmc@, schwarze@, and deraadt@
ok jmc@


# 1.93 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@


Revision tags: OPENBSD_4_8_BASE OPENBSD_4_9_BASE
# 1.92 03-Jul-2010 guenther

Fix the naming of interfaces and variables for rdomains and rtables
and make it possible to bind sockets (including listening sockets!)
to rtables and not just rdomains. This changes the name of the
system calls, socket option, and ioctl. After building with this
you should remove the files /usr/share/man/cat2/[gs]etrdomain.0.

Since this removes the existing [gs]etrdomain() system calls, the
libc major is bumped.

Written by claudio@, criticized^Wcritiqued by me


# 1.91 01-Jul-2010 deraadt

getpeereid() can now be a library routine using getsockopt() with
SOL_SOCKET and SO_PEERCRED, only issue being that it cannot return
EFAULT for a page fault. The kernel code will soon be put into
compat, and then in 10 years or so tedu will delete it.
ok guenther millert


# 1.90 18-May-2010 tedu

add posix_madvise, posix_memalign, strndup, and strnlen. mostly from
brad and millert, with hints from guenther, jmc, and otto I think.
ok previous.


Revision tags: OPENBSD_4_7_BASE
# 1.89 03-Feb-2010 miod

Use MACHINE_CPU instead of MACHINE_ARCH to pick the correct machine dependent
files or directories when applicable.
The inspiration and name of MACHINE_CPU come from NetBSD, although the way to
provide it to Makefiles is completely different.
ok kettenis@


# 1.88 27-Nov-2009 guenther

Add setrdomain() and getrdomain() system calls. Committing now to
catch the libc major bump per request from deraadt@

Diff by reyk.

ok guenther@


# 1.87 13-Aug-2009 jmc

various MLINK fixes from Alan R. S. Bueno;


Revision tags: OPENBSD_4_6_BASE
# 1.86 03-Jun-2009 jj

Arla client rename from xfs to nnpfs for later upgrades. Tested on various arches. ok todd@ beck@


Revision tags: OPENBSD_4_4_BASE OPENBSD_4_5_BASE
# 1.85 22-Mar-2008 otto

move statvfs.c to gen, since it is not a syscall; ok deraadt@


# 1.84 16-Mar-2008 otto

statvfs support


Revision tags: OPENBSD_4_3_BASE
# 1.83 05-Jan-2008 deraadt

no more need for vadvise.o


# 1.82 09-Sep-2007 otto

Add lint stubs for the longjmp family of functions which are defined in
assembly on all platforms. ok deraadt@


# 1.81 09-Sep-2007 otto

Silence erroneous "environ used, but not defined" lint warning by
providing a stub. ok deraadt@


Revision tags: OPENBSD_4_1_BASE OPENBSD_4_2_BASE
# 1.80 24-Oct-2006 tedu

add rthread syscalls and bump minor.
rthreads are hardly done, but if just trying it out is too much of a hassle,
we'll never make more progress.
ok brad marc marco mbalmer


# 1.79 10-Oct-2006 deraadt

MLINKS to macros described in stat(2)


Revision tags: OPENBSD_4_0_BASE
# 1.78 14-Jun-2006 otto

Introducing adjfreq(2), to adjust the clock frequency.
Loosely based on dragonfly code. Man page help fro jmc@; ok deraadt@


# 1.77 27-May-2006 pedro

Make libc's getcwd() use the new __getcwd() system call
Hacked by marius@ at c2k5, okay miod@ krw@ deraadt@


# 1.76 13-Mar-2006 moritz

Clean the correct file. ok deraadt@


Revision tags: OPENBSD_3_9_BASE
# 1.75 29-Nov-2005 deraadt

Provide stubs for things which are supplied by crt0. I don't think we
want a crt0.ln, at least, not yet. We may reconsider later.


# 1.74 03-Oct-2005 jmc

add missing MLINK for WEXITSTATUS.2


Revision tags: OPENBSD_3_8_BASE
# 1.73 17-Jun-2005 drahn

Extended Attributes was a piece to get to ACLs, however ACLs have not
been worked on, so EA is pointless to maintain.


# 1.72 17-Jun-2005 millert

remove undelete syscall


Revision tags: OPENBSD_3_7_BASE
# 1.71 18-Sep-2004 deraadt

MLINK to macros provided in wait.2


# 1.70 16-Sep-2004 deraadt

add files missing for building a proper lint library


Revision tags: OPENBSD_3_5_BASE OPENBSD_3_6_BASE
# 1.69 13-Feb-2004 tedu

death to osigaltstack. ok deraadt@


# 1.68 15-Jan-2004 deraadt

ABI breakage happened with the sigaltstack replacement. It is too late,
now we just have to cope. Since setjmp uses it, the alpha and sparc64 are
unhappy with the structure change. In a few days, we will make the second
hop here, for now, use the old system call until all binaries have the new
struct in them.


# 1.67 12-Jan-2004 tedu

new syscall closefrom(2). ok deraadt millert


Revision tags: OPENBSD_3_4_BASE
# 1.66 10-May-2003 miod

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


# 1.65 14-Apr-2003 art

There are two related changes.

The first one is an mquery(2) syscall. It's for asking the VM system
about where to map things. It will be used by ld.so, read the man page
for details.

The second change is related and is a centralization of uvm_map hint
that all callers of uvm_map calculated. This will allow us to adjust
this hint on architectures that have segments for non-exec mappings.

deraadt@ drahn@ ok.


Revision tags: OPENBSD_3_3_BASE
# 1.64 31-Jan-2003 millert

Replace emulated versions of setreuid() and setregid() with real syscalls.
These are spec'd by POSIX as of 1003.1-2001; deraadt@ OK


# 1.63 02-Dec-2002 millert

Document getlogin_r()


# 1.62 02-Dec-2002 miod

Import propolice (http://www.trl.ibm.com/projects/security/ssp), a stack
attack protection scheme, into gcc.

This protection is enabled by default. It can be turned off by using the
-fno-stack-protector flag.

Code by Hiroaki Etoh (etoh at jp dot ibm dot com); work on openbsd-specific
integration by fgsch@, deraadt@ and myself; tests by fgsch@, naddy@ and
myself; beer drinking by myself.

Please note that system upgrades with this new code will require a new
libc and ld.so to be build and installed before the propolice-enabled
compiler can be installed.


# 1.61 10-Nov-2002 fgsch

missing MLINKs for setresuid(2). millert ok.


# 1.60 05-Nov-2002 marc

thread safe libc -- 2nd try. OK miod@, millert@
Thanks to miod@ for m68k and vax fixes


# 1.59 03-Nov-2002 marc

back out previous patch.. there are still some vax/m68k issues


# 1.58 03-Nov-2002 marc

libc changes for thread safety. Tested on:
alpha (millert@), i386 (marc@), m68k (millert@ and miod@),
powerpc (drahn@ and dhartmei@), sparc (millert@ and marc@),
sparc64 (marc@), and vax (millert@ and miod@).
Thanks to millert@, miod@, and mickey@ for fixes along the way.


# 1.57 30-Oct-2002 millert

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


Revision tags: OPENBSD_3_2_BASE
# 1.56 05-Aug-2002 art

Fix brain blackout.
Pointed out byb miod@.


# 1.55 05-Aug-2002 art

One more ELF_TOOLCHAIN.


# 1.54 06-Jul-2002 nordin

Remove kernel support for NTP. ok deraadt@ and tholo@


# 1.53 10-Jun-2002 fgsch

correct comment.


# 1.52 08-Jun-2002 drahn

ELF architectures all support weak aliases, enable them for this part.
ok fgsch@


Revision tags: OPENBSD_3_1_BASE
# 1.51 22-Feb-2002 drahn

Extended Attribute support, from FreeBSD/TrustedBSD. ok art@ deraadt@
libc support pieces


# 1.50 21-Feb-2002 art

remove rfork.o from the auto-generated assembler stubs


# 1.49 17-Feb-2002 deraadt

rfork() needs a fork.S-like stub as well; ok art


Revision tags: OPENBSD_3_0_BASE
# 1.48 25-Sep-2001 niklas

Forgotten DEBUGLIBS stuff


# 1.47 25-Sep-2001 drahn

Add an ASPICFLAG variable to bsd.own.mk which a platform use to pass flags
to 'as' to make it compile pic. add defaults for sparc64 which needs picflags
set to -fPIC and ASPICFLAGS to -KPIC.
Also simplifies the systemcall generation for sparc64 PIC mode.
ok epsie@.


# 1.46 20-Sep-2001 millert

Add PSEUDO_NOERROR similar to that used by NetBSD.
Some ports were setting errno in PSEUDO and some were not. Now errno
is set for all in PSEUDO and PSEUDO_NOERROR is provided for the
non-errno case (only used by _exit).

Needs testing on vax and m88k.
XXX - hppa and powerpc still lack a real PSEUDO_NOERROR implementation.
Currently PSEUDO_NOERROR and PSEUDO are the same (so builds don't
break on those platforms).


# 1.45 09-Jul-2001 fgsch

Install getpeereid(2) manpage.


# 1.44 26-Jun-2001 dugsong

implement djb's getpeereid(2), to allow local-domain servers to determine client credentials. mostly from superscript.com. deraadt@ ok


Revision tags: OPENBSD_2_9_BASE
# 1.43 14-Mar-2001 aaron

Move description of exect() to execve(2) man page. Add a note about exect() not
being portable.


# 1.42 09-Mar-2001 art

Add mlockall and munlockall. man-page from NetBSD.


# 1.41 10-Jan-2001 deraadt

put up FD_* manual pages, in section 3


# 1.40 23-Dec-2000 deraadt

create proper docs for timer{add,clear,sub,isset,cmp}


# 1.39 16-Nov-2000 provos

kqueue and kevent system calls


Revision tags: OPENBSD_2_8_BASE
# 1.38 17-Oct-2000 deraadt

damn it, i have had it with this untested weak shit


# 1.37 16-Oct-2000 deraadt

re-add weak sparc support; d@


# 1.36 15-May-2000 niklas

Add support for building libraries with debugging information in them.
Enable by setting DEBUGLIBS=yes in /etc/mk.conf, then -g libraries will get
installed in /usr/lib/debug. This directory will be searched first if
gcc is given the -g flag during the link stage.


Revision tags: OPENBSD_2_7_BASE
# 1.35 01-May-2000 deraadt

bye bye semconfig(2)


# 1.34 20-Apr-2000 deraadt

p{read,write}{,v} man pages


# 1.33 07-Feb-2000 assar

add fhopen, fhstat, fhstatfs system calls. largely from NetBSD


# 1.32 06-Jan-2000 d

for now, disable weak aliases for all archs except i386


# 1.31 14-Dec-1999 millert

Install swapctl.2, not swapon.2. swapon.2 should probably go away.


Revision tags: OPENBSD_2_6_BASE
# 1.30 07-Jun-1999 deraadt

replacement pipe() system call; copies data into place inside kernel, so
that EFAULT return value is possible


# 1.29 22-May-1999 weingart

Add swapctl(2), and crank shlib minor.


Revision tags: OPENBSD_2_5_BASE
# 1.28 01-Feb-1999 d

mi ptrace


# 1.27 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


Revision tags: OPENBSD_2_4_BASE
# 1.26 18-Sep-1998 art

make use of xfspioctl


Revision tags: OPENBSD_2_3_BASE
# 1.25 08-Feb-1998 tholo

Better lint(1) framework. Mostly from cgd@NetBSD


# 1.24 13-Nov-1997 deraadt

add getsid(2), XPG4


Revision tags: OPENBSD_2_2_BASE
# 1.23 30-May-1997 kstailey

add getpgrp(2) from NetBSD


Revision tags: OPENBSD_2_1_BASE
# 1.22 08-May-1997 kstailey

add tag


# 1.21 08-May-1997 kstailey

make clock_gettime.cat2


# 1.20 20-Apr-1997 tholo

New POSIX 1003.1b syscalls; from pk@NetBSD


# 1.19 04-Apr-1997 deraadt

seek(2) is not needed


# 1.18 29-Mar-1997 deraadt

futimes link; nakayosh@kcn.or.jp


# 1.17 26-Mar-1997 deraadt

install ktrace(2)


# 1.16 26-Jan-1997 downsj

Add a link for lchown.2


# 1.15 26-Jan-1997 downsj

Add lchown(), increment minor number.


# 1.14 11-Dec-1996 deraadt

generate reboot.o like other system calls


Revision tags: OPENBSD_2_0_BASE
# 1.13 02-Sep-1996 deraadt

shmdt link


# 1.12 25-Aug-1996 deraadt

and a man page


# 1.11 18-Jun-1996 deraadt

build poll.o


# 1.10 19-May-1996 pefo

Changes for mips.


# 1.9 18-May-1996 deraadt

poll() as a system call


# 1.8 08-May-1996 deraadt

install rfork man page


# 1.7 01-May-1996 deraadt

add futimes


# 1.6 25-Mar-1996 tholo

Add support for building lint(1) library


# 1.5 29-Jan-1996 tholo

Add kernel PLL for system clock
Add ntp_adjtime() and ntp_gettime() system calls
Mostly stolen from FreeBSD


# 1.4 08-Jan-1996 deraadt

add rfork.o and minherit.o


# 1.3 07-Jan-1996 deraadt

add minherit() system call


# 1.2 14-Dec-1995 deraadt

from netbsd:
add & fix a bunch of system call pages


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.171 16-Feb-2023 deraadt

Document pinsyscall(2). The ld.so and kernel enforcement code is not
commited ye -- waiting for enough people to run kernels which support
the system call.
ok jmc


# 1.170 11-Feb-2023 deraadt

__syscall() is no longer neccessary since the system calls which needed
it are now unpadded
ok kettenis guenther


# 1.169 08-Jan-2023 guenther

Add getthrname(2) manpage

ok jmc@ schwarze@


# 1.168 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@


# 1.167 19-Dec-2022 guenther

Add waitid(2) manpage, based on a first pass by espie@ and bits
from FreeBSD and NetBSD.

ok kettenis@ jmc@ espie@


# 1.166 26-Oct-2022 kettenis

Add waitid(2) syscall stub.

Minor bump to both libc and libpthread: make sure you install a new kernel!

ok millert@, deraadt@


# 1.165 07-Oct-2022 deraadt

Add mimmutable(2) libc stub, add & adjust manual pages, and crank the minor.
ok kettenis


Revision tags: OPENBSD_7_2_BASE
# 1.164 09-Sep-2022 mbuhl

Add libc wrappers for the new sendmmsg and recvmmsg system calls.
Feedback tb@, miod@, jca@
OK jca@


# 1.163 17-Jul-2022 deraadt

Add ypconnect(2) stub inside libc so that libc functions can use it,
but do not export it.


# 1.162 17-Jul-2022 deraadt

add ypconnect(2) manual page


Revision tags: OPENBSD_7_1_BASE
# 1.161 23-Dec-2021 guenther

Roll the syscalls that have an off_t argument to remove the explicit padding.
Switch libc and ld.so to the generic stubs for these calls.
WARNING: reboot to updated kernel before installing libc or ld.so!

Time for a story...

When gcc (back in 1.x days) first implemented long long, it didn't (always)
pass 64bit arguments in 'aligned' registers/stack slots, with the result that
argument offsets didn't match structure offsets. This affected the nine system
calls that pass off_t arguments:
ftruncate lseek mmap mquery pread preadv pwrite pwritev truncate

To avoid having to do custom ASM wrappers for those, BSD put an explicit pad
argument in so that the off_t argument would always start on a even slot and
thus be naturally aligned. Thus those odd wrappers in lib/libc/sys/ that use
__syscall() and pass an extra '0' argument.

The ABIs for different CPUs eventually settled how things should be passed on
each and gcc 2.x followed them. The only arch now where it helps is landisk,
which needs to skip the last argument register if it would be the first half of
a 64bit argument. So: add new syscalls without the pad argument and on landisk
do that skipping directly in the syscall handler in the kernel. Keep compat
support for the existing syscalls long enough for the transition.

ok deraadt@


Revision tags: OPENBSD_7_0_BASE
# 1.160 11-Jun-2021 kettenis

Since futex(2) can fail, it needs a full syscall stub. This should fixes
issues on powerpc64 and sparc64.

Note that this makes the lib/libpthread/errno test fail since that test
detects that we are touching errno now. This will be addressed in a
future diff as it is not entirely clear whether the test is correct.

ok mpi@, bluhm@


Revision tags: OPENBSD_6_8_BASE OPENBSD_6_9_BASE
# 1.159 06-Jul-2020 pirofti

Add support for timeconting in userland.

This diff exposes parts of clock_gettime(2) and gettimeofday(2) to
userland via libc eliberating processes from the need for a context
switch everytime they want to count the passage of time.

If a timecounter clock can be exposed to userland than it needs to set
its tc_user member to a non-zero value. Tested with one or multiple
counters per architecture.

The timing data is shared through a pointer found in the new ELF
auxiliary vector AUX_openbsd_timekeep containing timehands information
that is frequently updated by the kernel.

Timing differences between the last kernel update and the current time
are adjusted in userland by the tc_get_timecount() function inside the
MD usertc.c file.

This permits a much more responsive environment, quite visible in
browsers, office programs and gaming (apparently one is are able to fly
in Minecraft now).

Tested by robert@, sthen@, naddy@, kmos@, phessler@, and many others!

OK from at least kettenis@, cheloha@, naddy@, sthen@


Revision tags: OPENBSD_6_7_BASE
# 1.158 27-Nov-2019 deraadt

Document msyscall(2): ld.so can use this (once only) to tell the kernel
where libc.so's text segment is, thereby allowing invocation of system
calls from that region. An upcoming change will kill the process if a
system call is invoked from addresses not explicitly permitted.
ok guenther kettenis mortimer


Revision tags: OPENBSD_6_6_BASE
# 1.157 28-May-2019 beck

Enable the use of the kernel __realpath() system call in the libc wrapper.

For now, this also still uses the existing realpath implmentation
and emits a syslog if we see differening results. Once we have run
with that for a little while we will remove the old code

ok deraadt@


Revision tags: OPENBSD_6_5_BASE
# 1.156 11-Jan-2019 deraadt

mincore() is a relic from the past, exposing physical machine information
about shared resources which no program should see. only a few pieces of
software use it, generally poorly thought out. they are being fixed, so
mincore() can be deleted.
ok guenther tedu jca sthen, others


Revision tags: OPENBSD_6_4_BASE
# 1.155 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.154 12-Jan-2018 deraadt

sysctl(3) can now be renamed to sysctl(2)


# 1.153 28-Nov-2017 guenther

Delete fktrace(2). The consequences of it were not thought through
sufficiently and at least one horrific security hole was the result.

ok deraadt@ beck@


Revision tags: OPENBSD_6_2_BASE
# 1.152 13-Aug-2017 tedu

add fktrace to libc


# 1.151 12-Aug-2017 guenther

Instead of hardcoding a partial dependency list for the syscall stub objects,
calculate them as done for other objects


# 1.150 31-May-2017 sthen

install futex(2), ok mpi


# 1.149 30-Apr-2017 mpi

Add futex(2) shim, bump minor.

Inputs from guenther@, ok kettenis@, visa@


Revision tags: OPENBSD_6_1_BASE
# 1.148 29-Mar-2017 deraadt

The hppa version of as(1) requires whitespace before a .file directive,
it may not be in column 0. This kind of thing is very common in GNU
and Linux software because the software was written from the start to
be 'compatible replacements' of vendor software.
ok jsing guenther


# 1.147 26-Mar-2017 guenther

Use .file to convince 'as' to generate proper FILE symbols in the syscall
stubs that aren't actually in files, so that syspatch can figure out what
order the syscall stub objects are in the .so. Use -P to suppress to #line
directives that would override that. Tested with both gcc/gas and clang.

ok deraadt@


Revision tags: OPENBSD_6_0_BASE
# 1.146 04-Jul-2016 guenther

DEBUGLIBS has been broken since the gcc4 switch, so delete it. CFLAGS
contains -g by default anyway

problem noted by Edgar Pettijohn (edgar (at) pettijohn-web.com)
ok millert@ kettenis@ deraadt@


# 1.145 30-May-2016 guenther

Move __getcwd from ASM to HIDDEN: we don't want the literal __getcwd symbol

ok millert@ deraadt@


# 1.144 19-May-2016 guenther

Add ASM_NOERR for syscalls that never fail and thus don't need the errno
setting logic...which can significantly reduce the size of the stub on
some archs; 20 syscalls get a trim with this.

in snaps for a bit and ok deraadt@


# 1.143 09-May-2016 guenther

Remove sigreturn declaration and the now-unused libc syscall stub


# 1.142 07-May-2016 guenther

Use a Thread Information Block in both single and multi-threaded programs.
This stores errno, the cancelation flags, and related bits for each thread
and is allocated by ld.so or libc.a. This is an ABI break from 5.9-stable!

Make libpthread dlopen'able by moving the cancelation wrappers into libc
and doing locking and fork/errno handling via callbacks that libpthread
registers when it first initializes. 'errno' *must* be declared via
<errno.h> now!

Clean up libpthread's symbol exports like libc.

On powerpc, offset the TIB/TCB/TLS data from the register per the ELF spec.

Testing by various, particularly sthen@ and patrick@
ok kettenis@


# 1.141 30-Mar-2016 guenther

Turd polish: use HIDDEN= instead of PSEUDO= for ptrace syscall stub, to
make its underlying symbol name look like others.


# 1.140 30-Mar-2016 guenther

Eliminate userspace caching by getlogin_r/setlogin; make the getlogin
syscall behave exactly like userspace getlogin_r() and rename it to
match. Eliminate the reduced-to-no-op wrappers of the syscalls.
Eliminate the unnecessary per-thread static buffering by getlogin().

ok kettenis@ deraadt@


# 1.139 30-Mar-2016 jmc

for some time now mandoc has not required MLINKS to function
correctly - logically complete that now by removing MLINKS from base;

authors need only to ensure there is an entry in NAME for any function/
util being added. MLINKS will still work, and remain for perl to ease
upgrades;

ok nicm (curses) bcook (ssl)
ok schwarze, who provided a lot of feedback and assistance
ok tb natano jung


# 1.138 21-Mar-2016 bluhm

Rename the system call sendsyslog2 to sendsyslog. Keep the old one
as osendsyslog for a while. The three argument variant is the only
one that will stay.
input kettenis@; OK deraadt@


Revision tags: OPENBSD_5_9_BASE
# 1.137 25-Nov-2015 deraadt

Add a syscall stub for sendsyslog2(2), and use it in syslog_r(3), passing
LOG_CONS to the kernel. As a result, the /dev/console opening code can
be removed.
ok kettenis millert beck


# 1.136 10-Nov-2015 guenther

Split the intra-thread functionality from kill(2) into its own syscall
thrkill(2), rolling the kill(2) syscall number with the ABI change to
avoid breaking binaries during during the transition. thrkill(2) includes
a 'tcb' argument that eliminates the need for locking in pthread_kill()
and simplifies pthread_cancel(). Switch __stack_smash_handler() to use
thrkill(2) and explicitly unblock SIGABRT.

Minor bump to both libc and libpthread: make sure you install a new kernel!

ok semarie@


# 1.135 23-Oct-2015 guenther

Merge the sigaction() and sigprocmask() overloads/wrappers from libpthread
into libc, and move pthread_sigmask() as well (just a trivial wrapper).
This provides consistent handling of SIGTHR between single- and multi-threaded
programs and is a step in the merge of all the libpthread overloads, providing
some ASM and Makefile bits that the other wrappers will need.

ok deraadt@ millert@


# 1.134 23-Oct-2015 deraadt

Remove dnssocket() and dnsconnect(), since we decided to use a SOCK_DNS
flag instead.
ok guenther tedu semarie


# 1.133 19-Oct-2015 deraadt

Remove old tame() stub


# 1.132 18-Oct-2015 deraadt

create libc stubs for dnssocket() and dnsconnect()


# 1.131 09-Oct-2015 deraadt

tame -> pledge conversion, in libc. I should crank libc, but am cheating
hoping things go well. The old symbol is faked via a stupid stub function,
until next major crank when it can be removed. I am expecting guenther
to scream at me.


# 1.130 13-Sep-2015 guenther

Rename __sysctl syscall to just sysctl, as the userland wrapper is no longer
necessary

ok deraadt@ jsing@


# 1.129 09-Sep-2015 guenther

Simplify makefile rules for building the ASM stubs into "pick something
from column A and something from column B".

ok miod@ deraadt@


# 1.128 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@


# 1.127 25-Aug-2015 guenther

Document kbind(2)


Revision tags: OPENBSD_5_8_BASE
# 1.126 19-Jul-2015 deraadt

manual page for tame(2). not very good, so i will be hearing from jmc


# 1.125 07-Apr-2015 guenther

Make pthread_atfork() track the DSO that called it like atexit() does,
unregistering callbacks if the DSO is unloaded. Move the callback
handling from libpthread to libc, though libpthread still overrides the
inner call to handle locking and thread-library reinitialization.
Major version bump for both libc and libpthread.

verification that this fixes various ports ajacoutot@
asm assistance miod@; ok millert@ deraadt@


Revision tags: OPENBSD_5_7_BASE
# 1.124 08-Dec-2014 guenther

Add chflagsat(), modeled on fchmodat() with name to match FreeBSD.


# 1.123 14-Nov-2014 guenther

Add sched_yield(2) manpage


# 1.122 31-Aug-2014 guenther

Declare and document getthrid()

indirectly prodded by krw@


# 1.121 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@


# 1.120 14-Aug-2014 tobias

fixed overrid(d)en typo

millert@ and jmc@ agree that "overriden" is wrong


Revision tags: OPENBSD_5_6_BASE
# 1.119 12-Jul-2014 deraadt

document sendsyslog(2); ok guenther tedu matthew


# 1.118 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.117 18-Mar-2014 miod

Retire hp300, mvme68k and mvme88k ports. These ports have no users, keeping
this hardware alive is becoming increasingly difficult, and I should heed the
message sent by the three disks which have died on me over the last few days.

Noone sane will mourn these ports anyway. So long, and thanks for the fish.


Revision tags: OPENBSD_5_5_BASE
# 1.116 13-Oct-2013 guenther

Make it possible to build to reduced version of a library, including
just specific objects that are compiled with additional options to
reduce their size. For use by distrib/ and crunchgen.

style and naming assistance from espie@


# 1.115 07-Oct-2013 guenther

getdirentries(2) is dead; long live getdents(2)!

confirmation that getdirentries(2) is unused by ports from sthen@ and naddy@


# 1.114 13-Aug-2013 guenther

Switch time_t, ino_t, clock_t, and struct kevent's ident and data
members to 64bit types. Assign new syscall numbers for (almost
all) the syscalls that involve the affected types, including anything
with time_t, timeval, itimerval, timespec, rusage, dirent, stat,
or kevent arguments. Add a d_off member to struct dirent and replace
getdirentries() with getdents(), thus immensely simplifying and
accelerating telldir/seekdir. Build perl with -DBIG_TIME.

Bump the major on every single base library: the compat bits included
here are only good enough to make the transition; the T32 compat
option will be burned as soon as we've reached the new world are
are happy with the snapshots for all architectures.

DANGER: ABI incompatibility. Updating to this kernel requires extra
work or you won't be able to login: install a snapshot instead.

Much assistance in fixing userland issues from deraadt@ and tedu@
and build assistance from todd@ and otto@


Revision tags: OPENBSD_5_4_BASE
# 1.113 05-Jun-2013 guenther

Move _Exit() from the exit() manpage to the _exit() manpage, as it's
just an alias of the latter.

ok matthew@ tedu@


# 1.112 01-Jun-2013 miod

Add utrace(2), a system call allowing for userland to send its own ktrace
records. From FreeBSD via otto@, with tweaks suggested by guenther@.
Commite on behalf of otto@ who is not around, to ride the libc minor bump.
Causes a librthread minor bump as well (new syscall).


# 1.111 29-Apr-2013 matthew

Extend P_SIGSUSPEND handling in userret() to properly restore the
sigmask even if there are no pending signals under the temporary
sigmask.

Refactor existing select() and poll() system calls to introduce the
pselect() and ppoll() system calls.

Add rthread wrappers for pselect() and ppoll(). While there, update
cancellation point comments to reflect recent fdatasync() addition.

Minor bumps for libc and librthread due to new symbols.

ok guenther, millert, deraadt, jmc


# 1.110 15-Apr-2013 matthew

Implement fdatasync() as a wrapper around fsync()

ok guenther, deraadt, jmc


Revision tags: OPENBSD_5_3_BASE
# 1.109 03-Feb-2013 miod

gremlin crept in


# 1.108 02-Feb-2013 miod

Userland bits for m68k/ELF. Mostly addition of register prefixes to the
assembler instructions, and cope with the few changes in return values
location.


# 1.107 04-Sep-2012 okan

remove lint leftovers; ok guenther@


# 1.106 23-Aug-2012 deraadt

no more nnpfspioctl() system call; ok guenther


# 1.105 22-Aug-2012 pascal

Convert cpp | as rules in bsd.lib.mk and lib/libc/sys/Makefile.inc to pure cc
invocations. This allows us to use the compiler builtin define __PIC__ to check
for PIC/PIEness rather than passing -DPIC. Simplifies PIE work a lot.

ok matthew@, conceptually ok kurt@


# 1.104 21-Aug-2012 pascal

Kill an old mips workaround; we don't support mips, just mips64.

ok deraadt@ kettenis@


Revision tags: OPENBSD_5_2_BASE
# 1.103 19-Jun-2012 deraadt

oops, forgot to install getdtablecount(2); noted by tedu


# 1.102 12-Apr-2012 deraadt

remove rfork(); ok guenther miod


# 1.101 12-Apr-2012 deraadt

kill lfs system call lines and libc stubs


# 1.100 12-Apr-2012 deraadt

New system call: getdtablecount(2) returns the number of file
descriptors the process currently has open.
ok guenther miod gilles ...


# 1.99 22-Mar-2012 guenther

Move __tfork_thread() from rthreads (libpthread) to libc so that
it can be used for not-strictly-threading purposes

ok matthew@ kurt@


# 1.98 13-Mar-2012 guenther

Add manpages for __thrsigdivert, __thrsleep, and __thrwakeup. Various
syntax and grammar fixes from jmc@


Revision tags: OPENBSD_5_1_BASE
# 1.97 17-Jan-2012 guenther

Reimplement mutexes, condvars, and rwlocks to eliminate bugs,
particularly the "consume the signal you just sent" hang, and putting
the wait queues in userspace.

Do cancellation handling in pthread_cond_*wait(), pthread_join(),
and sem_wait().

Add __ prefix to thr{sleep,wakeup,exit,sigdivert}() syscalls; add
'abort" argument to thrsleep to close cancellation race; make
thr{sleep,wakeup} return errno values via *retval to avoid touching
userspace errno.


# 1.96 22-Nov-2011 guenther

sigstack() is long dead, and the compat sigaltstack syscall is gone too.
Correct the namespace protections for sigreturn(), sigwait(), and psignal()

ok millert@


# 1.95 16-Oct-2011 guenther

Add stubs and manpage for __{get,set}_tcb

ok deraadt@


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

Add (rough draft) documentation for fdopendir(3) and the 15 new
XXXat(2) system calls from POSIX 2008. Editing will be done in tree.

General style discussed with jmc@, schwarze@, and deraadt@
ok jmc@


# 1.93 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@


Revision tags: OPENBSD_4_8_BASE OPENBSD_4_9_BASE
# 1.92 03-Jul-2010 guenther

Fix the naming of interfaces and variables for rdomains and rtables
and make it possible to bind sockets (including listening sockets!)
to rtables and not just rdomains. This changes the name of the
system calls, socket option, and ioctl. After building with this
you should remove the files /usr/share/man/cat2/[gs]etrdomain.0.

Since this removes the existing [gs]etrdomain() system calls, the
libc major is bumped.

Written by claudio@, criticized^Wcritiqued by me


# 1.91 01-Jul-2010 deraadt

getpeereid() can now be a library routine using getsockopt() with
SOL_SOCKET and SO_PEERCRED, only issue being that it cannot return
EFAULT for a page fault. The kernel code will soon be put into
compat, and then in 10 years or so tedu will delete it.
ok guenther millert


# 1.90 18-May-2010 tedu

add posix_madvise, posix_memalign, strndup, and strnlen. mostly from
brad and millert, with hints from guenther, jmc, and otto I think.
ok previous.


Revision tags: OPENBSD_4_7_BASE
# 1.89 03-Feb-2010 miod

Use MACHINE_CPU instead of MACHINE_ARCH to pick the correct machine dependent
files or directories when applicable.
The inspiration and name of MACHINE_CPU come from NetBSD, although the way to
provide it to Makefiles is completely different.
ok kettenis@


# 1.88 27-Nov-2009 guenther

Add setrdomain() and getrdomain() system calls. Committing now to
catch the libc major bump per request from deraadt@

Diff by reyk.

ok guenther@


# 1.87 13-Aug-2009 jmc

various MLINK fixes from Alan R. S. Bueno;


Revision tags: OPENBSD_4_6_BASE
# 1.86 03-Jun-2009 jj

Arla client rename from xfs to nnpfs for later upgrades. Tested on various arches. ok todd@ beck@


Revision tags: OPENBSD_4_4_BASE OPENBSD_4_5_BASE
# 1.85 22-Mar-2008 otto

move statvfs.c to gen, since it is not a syscall; ok deraadt@


# 1.84 16-Mar-2008 otto

statvfs support


Revision tags: OPENBSD_4_3_BASE
# 1.83 05-Jan-2008 deraadt

no more need for vadvise.o


# 1.82 09-Sep-2007 otto

Add lint stubs for the longjmp family of functions which are defined in
assembly on all platforms. ok deraadt@


# 1.81 09-Sep-2007 otto

Silence erroneous "environ used, but not defined" lint warning by
providing a stub. ok deraadt@


Revision tags: OPENBSD_4_1_BASE OPENBSD_4_2_BASE
# 1.80 24-Oct-2006 tedu

add rthread syscalls and bump minor.
rthreads are hardly done, but if just trying it out is too much of a hassle,
we'll never make more progress.
ok brad marc marco mbalmer


# 1.79 10-Oct-2006 deraadt

MLINKS to macros described in stat(2)


Revision tags: OPENBSD_4_0_BASE
# 1.78 14-Jun-2006 otto

Introducing adjfreq(2), to adjust the clock frequency.
Loosely based on dragonfly code. Man page help fro jmc@; ok deraadt@


# 1.77 27-May-2006 pedro

Make libc's getcwd() use the new __getcwd() system call
Hacked by marius@ at c2k5, okay miod@ krw@ deraadt@


# 1.76 13-Mar-2006 moritz

Clean the correct file. ok deraadt@


Revision tags: OPENBSD_3_9_BASE
# 1.75 29-Nov-2005 deraadt

Provide stubs for things which are supplied by crt0. I don't think we
want a crt0.ln, at least, not yet. We may reconsider later.


# 1.74 03-Oct-2005 jmc

add missing MLINK for WEXITSTATUS.2


Revision tags: OPENBSD_3_8_BASE
# 1.73 17-Jun-2005 drahn

Extended Attributes was a piece to get to ACLs, however ACLs have not
been worked on, so EA is pointless to maintain.


# 1.72 17-Jun-2005 millert

remove undelete syscall


Revision tags: OPENBSD_3_7_BASE
# 1.71 18-Sep-2004 deraadt

MLINK to macros provided in wait.2


# 1.70 16-Sep-2004 deraadt

add files missing for building a proper lint library


Revision tags: OPENBSD_3_5_BASE OPENBSD_3_6_BASE
# 1.69 13-Feb-2004 tedu

death to osigaltstack. ok deraadt@


# 1.68 15-Jan-2004 deraadt

ABI breakage happened with the sigaltstack replacement. It is too late,
now we just have to cope. Since setjmp uses it, the alpha and sparc64 are
unhappy with the structure change. In a few days, we will make the second
hop here, for now, use the old system call until all binaries have the new
struct in them.


# 1.67 12-Jan-2004 tedu

new syscall closefrom(2). ok deraadt millert


Revision tags: OPENBSD_3_4_BASE
# 1.66 10-May-2003 miod

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


# 1.65 14-Apr-2003 art

There are two related changes.

The first one is an mquery(2) syscall. It's for asking the VM system
about where to map things. It will be used by ld.so, read the man page
for details.

The second change is related and is a centralization of uvm_map hint
that all callers of uvm_map calculated. This will allow us to adjust
this hint on architectures that have segments for non-exec mappings.

deraadt@ drahn@ ok.


Revision tags: OPENBSD_3_3_BASE
# 1.64 31-Jan-2003 millert

Replace emulated versions of setreuid() and setregid() with real syscalls.
These are spec'd by POSIX as of 1003.1-2001; deraadt@ OK


# 1.63 02-Dec-2002 millert

Document getlogin_r()


# 1.62 02-Dec-2002 miod

Import propolice (http://www.trl.ibm.com/projects/security/ssp), a stack
attack protection scheme, into gcc.

This protection is enabled by default. It can be turned off by using the
-fno-stack-protector flag.

Code by Hiroaki Etoh (etoh at jp dot ibm dot com); work on openbsd-specific
integration by fgsch@, deraadt@ and myself; tests by fgsch@, naddy@ and
myself; beer drinking by myself.

Please note that system upgrades with this new code will require a new
libc and ld.so to be build and installed before the propolice-enabled
compiler can be installed.


# 1.61 10-Nov-2002 fgsch

missing MLINKs for setresuid(2). millert ok.


# 1.60 05-Nov-2002 marc

thread safe libc -- 2nd try. OK miod@, millert@
Thanks to miod@ for m68k and vax fixes


# 1.59 03-Nov-2002 marc

back out previous patch.. there are still some vax/m68k issues


# 1.58 03-Nov-2002 marc

libc changes for thread safety. Tested on:
alpha (millert@), i386 (marc@), m68k (millert@ and miod@),
powerpc (drahn@ and dhartmei@), sparc (millert@ and marc@),
sparc64 (marc@), and vax (millert@ and miod@).
Thanks to millert@, miod@, and mickey@ for fixes along the way.


# 1.57 30-Oct-2002 millert

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


Revision tags: OPENBSD_3_2_BASE
# 1.56 05-Aug-2002 art

Fix brain blackout.
Pointed out byb miod@.


# 1.55 05-Aug-2002 art

One more ELF_TOOLCHAIN.


# 1.54 06-Jul-2002 nordin

Remove kernel support for NTP. ok deraadt@ and tholo@


# 1.53 10-Jun-2002 fgsch

correct comment.


# 1.52 08-Jun-2002 drahn

ELF architectures all support weak aliases, enable them for this part.
ok fgsch@


Revision tags: OPENBSD_3_1_BASE
# 1.51 22-Feb-2002 drahn

Extended Attribute support, from FreeBSD/TrustedBSD. ok art@ deraadt@
libc support pieces


# 1.50 21-Feb-2002 art

remove rfork.o from the auto-generated assembler stubs


# 1.49 17-Feb-2002 deraadt

rfork() needs a fork.S-like stub as well; ok art


Revision tags: OPENBSD_3_0_BASE
# 1.48 25-Sep-2001 niklas

Forgotten DEBUGLIBS stuff


# 1.47 25-Sep-2001 drahn

Add an ASPICFLAG variable to bsd.own.mk which a platform use to pass flags
to 'as' to make it compile pic. add defaults for sparc64 which needs picflags
set to -fPIC and ASPICFLAGS to -KPIC.
Also simplifies the systemcall generation for sparc64 PIC mode.
ok epsie@.


# 1.46 20-Sep-2001 millert

Add PSEUDO_NOERROR similar to that used by NetBSD.
Some ports were setting errno in PSEUDO and some were not. Now errno
is set for all in PSEUDO and PSEUDO_NOERROR is provided for the
non-errno case (only used by _exit).

Needs testing on vax and m88k.
XXX - hppa and powerpc still lack a real PSEUDO_NOERROR implementation.
Currently PSEUDO_NOERROR and PSEUDO are the same (so builds don't
break on those platforms).


# 1.45 09-Jul-2001 fgsch

Install getpeereid(2) manpage.


# 1.44 26-Jun-2001 dugsong

implement djb's getpeereid(2), to allow local-domain servers to determine client credentials. mostly from superscript.com. deraadt@ ok


Revision tags: OPENBSD_2_9_BASE
# 1.43 14-Mar-2001 aaron

Move description of exect() to execve(2) man page. Add a note about exect() not
being portable.


# 1.42 09-Mar-2001 art

Add mlockall and munlockall. man-page from NetBSD.


# 1.41 10-Jan-2001 deraadt

put up FD_* manual pages, in section 3


# 1.40 23-Dec-2000 deraadt

create proper docs for timer{add,clear,sub,isset,cmp}


# 1.39 16-Nov-2000 provos

kqueue and kevent system calls


Revision tags: OPENBSD_2_8_BASE
# 1.38 17-Oct-2000 deraadt

damn it, i have had it with this untested weak shit


# 1.37 16-Oct-2000 deraadt

re-add weak sparc support; d@


# 1.36 15-May-2000 niklas

Add support for building libraries with debugging information in them.
Enable by setting DEBUGLIBS=yes in /etc/mk.conf, then -g libraries will get
installed in /usr/lib/debug. This directory will be searched first if
gcc is given the -g flag during the link stage.


Revision tags: OPENBSD_2_7_BASE
# 1.35 01-May-2000 deraadt

bye bye semconfig(2)


# 1.34 20-Apr-2000 deraadt

p{read,write}{,v} man pages


# 1.33 07-Feb-2000 assar

add fhopen, fhstat, fhstatfs system calls. largely from NetBSD


# 1.32 06-Jan-2000 d

for now, disable weak aliases for all archs except i386


# 1.31 14-Dec-1999 millert

Install swapctl.2, not swapon.2. swapon.2 should probably go away.


Revision tags: OPENBSD_2_6_BASE
# 1.30 07-Jun-1999 deraadt

replacement pipe() system call; copies data into place inside kernel, so
that EFAULT return value is possible


# 1.29 22-May-1999 weingart

Add swapctl(2), and crank shlib minor.


Revision tags: OPENBSD_2_5_BASE
# 1.28 01-Feb-1999 d

mi ptrace


# 1.27 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


Revision tags: OPENBSD_2_4_BASE
# 1.26 18-Sep-1998 art

make use of xfspioctl


Revision tags: OPENBSD_2_3_BASE
# 1.25 08-Feb-1998 tholo

Better lint(1) framework. Mostly from cgd@NetBSD


# 1.24 13-Nov-1997 deraadt

add getsid(2), XPG4


Revision tags: OPENBSD_2_2_BASE
# 1.23 30-May-1997 kstailey

add getpgrp(2) from NetBSD


Revision tags: OPENBSD_2_1_BASE
# 1.22 08-May-1997 kstailey

add tag


# 1.21 08-May-1997 kstailey

make clock_gettime.cat2


# 1.20 20-Apr-1997 tholo

New POSIX 1003.1b syscalls; from pk@NetBSD


# 1.19 04-Apr-1997 deraadt

seek(2) is not needed


# 1.18 29-Mar-1997 deraadt

futimes link; nakayosh@kcn.or.jp


# 1.17 26-Mar-1997 deraadt

install ktrace(2)


# 1.16 26-Jan-1997 downsj

Add a link for lchown.2


# 1.15 26-Jan-1997 downsj

Add lchown(), increment minor number.


# 1.14 11-Dec-1996 deraadt

generate reboot.o like other system calls


Revision tags: OPENBSD_2_0_BASE
# 1.13 02-Sep-1996 deraadt

shmdt link


# 1.12 25-Aug-1996 deraadt

and a man page


# 1.11 18-Jun-1996 deraadt

build poll.o


# 1.10 19-May-1996 pefo

Changes for mips.


# 1.9 18-May-1996 deraadt

poll() as a system call


# 1.8 08-May-1996 deraadt

install rfork man page


# 1.7 01-May-1996 deraadt

add futimes


# 1.6 25-Mar-1996 tholo

Add support for building lint(1) library


# 1.5 29-Jan-1996 tholo

Add kernel PLL for system clock
Add ntp_adjtime() and ntp_gettime() system calls
Mostly stolen from FreeBSD


# 1.4 08-Jan-1996 deraadt

add rfork.o and minherit.o


# 1.3 07-Jan-1996 deraadt

add minherit() system call


# 1.2 14-Dec-1995 deraadt

from netbsd:
add & fix a bunch of system call pages


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.170 11-Feb-2023 deraadt

__syscall() is no longer neccessary since the system calls which needed
it are now unpadded
ok kettenis guenther


# 1.169 08-Jan-2023 guenther

Add getthrname(2) manpage

ok jmc@ schwarze@


# 1.168 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@


# 1.167 19-Dec-2022 guenther

Add waitid(2) manpage, based on a first pass by espie@ and bits
from FreeBSD and NetBSD.

ok kettenis@ jmc@ espie@


# 1.166 26-Oct-2022 kettenis

Add waitid(2) syscall stub.

Minor bump to both libc and libpthread: make sure you install a new kernel!

ok millert@, deraadt@


# 1.165 07-Oct-2022 deraadt

Add mimmutable(2) libc stub, add & adjust manual pages, and crank the minor.
ok kettenis


Revision tags: OPENBSD_7_2_BASE
# 1.164 09-Sep-2022 mbuhl

Add libc wrappers for the new sendmmsg and recvmmsg system calls.
Feedback tb@, miod@, jca@
OK jca@


# 1.163 17-Jul-2022 deraadt

Add ypconnect(2) stub inside libc so that libc functions can use it,
but do not export it.


# 1.162 17-Jul-2022 deraadt

add ypconnect(2) manual page


Revision tags: OPENBSD_7_1_BASE
# 1.161 23-Dec-2021 guenther

Roll the syscalls that have an off_t argument to remove the explicit padding.
Switch libc and ld.so to the generic stubs for these calls.
WARNING: reboot to updated kernel before installing libc or ld.so!

Time for a story...

When gcc (back in 1.x days) first implemented long long, it didn't (always)
pass 64bit arguments in 'aligned' registers/stack slots, with the result that
argument offsets didn't match structure offsets. This affected the nine system
calls that pass off_t arguments:
ftruncate lseek mmap mquery pread preadv pwrite pwritev truncate

To avoid having to do custom ASM wrappers for those, BSD put an explicit pad
argument in so that the off_t argument would always start on a even slot and
thus be naturally aligned. Thus those odd wrappers in lib/libc/sys/ that use
__syscall() and pass an extra '0' argument.

The ABIs for different CPUs eventually settled how things should be passed on
each and gcc 2.x followed them. The only arch now where it helps is landisk,
which needs to skip the last argument register if it would be the first half of
a 64bit argument. So: add new syscalls without the pad argument and on landisk
do that skipping directly in the syscall handler in the kernel. Keep compat
support for the existing syscalls long enough for the transition.

ok deraadt@


Revision tags: OPENBSD_7_0_BASE
# 1.160 11-Jun-2021 kettenis

Since futex(2) can fail, it needs a full syscall stub. This should fixes
issues on powerpc64 and sparc64.

Note that this makes the lib/libpthread/errno test fail since that test
detects that we are touching errno now. This will be addressed in a
future diff as it is not entirely clear whether the test is correct.

ok mpi@, bluhm@


Revision tags: OPENBSD_6_8_BASE OPENBSD_6_9_BASE
# 1.159 06-Jul-2020 pirofti

Add support for timeconting in userland.

This diff exposes parts of clock_gettime(2) and gettimeofday(2) to
userland via libc eliberating processes from the need for a context
switch everytime they want to count the passage of time.

If a timecounter clock can be exposed to userland than it needs to set
its tc_user member to a non-zero value. Tested with one or multiple
counters per architecture.

The timing data is shared through a pointer found in the new ELF
auxiliary vector AUX_openbsd_timekeep containing timehands information
that is frequently updated by the kernel.

Timing differences between the last kernel update and the current time
are adjusted in userland by the tc_get_timecount() function inside the
MD usertc.c file.

This permits a much more responsive environment, quite visible in
browsers, office programs and gaming (apparently one is are able to fly
in Minecraft now).

Tested by robert@, sthen@, naddy@, kmos@, phessler@, and many others!

OK from at least kettenis@, cheloha@, naddy@, sthen@


Revision tags: OPENBSD_6_7_BASE
# 1.158 27-Nov-2019 deraadt

Document msyscall(2): ld.so can use this (once only) to tell the kernel
where libc.so's text segment is, thereby allowing invocation of system
calls from that region. An upcoming change will kill the process if a
system call is invoked from addresses not explicitly permitted.
ok guenther kettenis mortimer


Revision tags: OPENBSD_6_6_BASE
# 1.157 28-May-2019 beck

Enable the use of the kernel __realpath() system call in the libc wrapper.

For now, this also still uses the existing realpath implmentation
and emits a syslog if we see differening results. Once we have run
with that for a little while we will remove the old code

ok deraadt@


Revision tags: OPENBSD_6_5_BASE
# 1.156 11-Jan-2019 deraadt

mincore() is a relic from the past, exposing physical machine information
about shared resources which no program should see. only a few pieces of
software use it, generally poorly thought out. they are being fixed, so
mincore() can be deleted.
ok guenther tedu jca sthen, others


Revision tags: OPENBSD_6_4_BASE
# 1.155 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.154 12-Jan-2018 deraadt

sysctl(3) can now be renamed to sysctl(2)


# 1.153 28-Nov-2017 guenther

Delete fktrace(2). The consequences of it were not thought through
sufficiently and at least one horrific security hole was the result.

ok deraadt@ beck@


Revision tags: OPENBSD_6_2_BASE
# 1.152 13-Aug-2017 tedu

add fktrace to libc


# 1.151 12-Aug-2017 guenther

Instead of hardcoding a partial dependency list for the syscall stub objects,
calculate them as done for other objects


# 1.150 31-May-2017 sthen

install futex(2), ok mpi


# 1.149 30-Apr-2017 mpi

Add futex(2) shim, bump minor.

Inputs from guenther@, ok kettenis@, visa@


Revision tags: OPENBSD_6_1_BASE
# 1.148 29-Mar-2017 deraadt

The hppa version of as(1) requires whitespace before a .file directive,
it may not be in column 0. This kind of thing is very common in GNU
and Linux software because the software was written from the start to
be 'compatible replacements' of vendor software.
ok jsing guenther


# 1.147 26-Mar-2017 guenther

Use .file to convince 'as' to generate proper FILE symbols in the syscall
stubs that aren't actually in files, so that syspatch can figure out what
order the syscall stub objects are in the .so. Use -P to suppress to #line
directives that would override that. Tested with both gcc/gas and clang.

ok deraadt@


Revision tags: OPENBSD_6_0_BASE
# 1.146 04-Jul-2016 guenther

DEBUGLIBS has been broken since the gcc4 switch, so delete it. CFLAGS
contains -g by default anyway

problem noted by Edgar Pettijohn (edgar (at) pettijohn-web.com)
ok millert@ kettenis@ deraadt@


# 1.145 30-May-2016 guenther

Move __getcwd from ASM to HIDDEN: we don't want the literal __getcwd symbol

ok millert@ deraadt@


# 1.144 19-May-2016 guenther

Add ASM_NOERR for syscalls that never fail and thus don't need the errno
setting logic...which can significantly reduce the size of the stub on
some archs; 20 syscalls get a trim with this.

in snaps for a bit and ok deraadt@


# 1.143 09-May-2016 guenther

Remove sigreturn declaration and the now-unused libc syscall stub


# 1.142 07-May-2016 guenther

Use a Thread Information Block in both single and multi-threaded programs.
This stores errno, the cancelation flags, and related bits for each thread
and is allocated by ld.so or libc.a. This is an ABI break from 5.9-stable!

Make libpthread dlopen'able by moving the cancelation wrappers into libc
and doing locking and fork/errno handling via callbacks that libpthread
registers when it first initializes. 'errno' *must* be declared via
<errno.h> now!

Clean up libpthread's symbol exports like libc.

On powerpc, offset the TIB/TCB/TLS data from the register per the ELF spec.

Testing by various, particularly sthen@ and patrick@
ok kettenis@


# 1.141 30-Mar-2016 guenther

Turd polish: use HIDDEN= instead of PSEUDO= for ptrace syscall stub, to
make its underlying symbol name look like others.


# 1.140 30-Mar-2016 guenther

Eliminate userspace caching by getlogin_r/setlogin; make the getlogin
syscall behave exactly like userspace getlogin_r() and rename it to
match. Eliminate the reduced-to-no-op wrappers of the syscalls.
Eliminate the unnecessary per-thread static buffering by getlogin().

ok kettenis@ deraadt@


# 1.139 30-Mar-2016 jmc

for some time now mandoc has not required MLINKS to function
correctly - logically complete that now by removing MLINKS from base;

authors need only to ensure there is an entry in NAME for any function/
util being added. MLINKS will still work, and remain for perl to ease
upgrades;

ok nicm (curses) bcook (ssl)
ok schwarze, who provided a lot of feedback and assistance
ok tb natano jung


# 1.138 21-Mar-2016 bluhm

Rename the system call sendsyslog2 to sendsyslog. Keep the old one
as osendsyslog for a while. The three argument variant is the only
one that will stay.
input kettenis@; OK deraadt@


Revision tags: OPENBSD_5_9_BASE
# 1.137 25-Nov-2015 deraadt

Add a syscall stub for sendsyslog2(2), and use it in syslog_r(3), passing
LOG_CONS to the kernel. As a result, the /dev/console opening code can
be removed.
ok kettenis millert beck


# 1.136 10-Nov-2015 guenther

Split the intra-thread functionality from kill(2) into its own syscall
thrkill(2), rolling the kill(2) syscall number with the ABI change to
avoid breaking binaries during during the transition. thrkill(2) includes
a 'tcb' argument that eliminates the need for locking in pthread_kill()
and simplifies pthread_cancel(). Switch __stack_smash_handler() to use
thrkill(2) and explicitly unblock SIGABRT.

Minor bump to both libc and libpthread: make sure you install a new kernel!

ok semarie@


# 1.135 23-Oct-2015 guenther

Merge the sigaction() and sigprocmask() overloads/wrappers from libpthread
into libc, and move pthread_sigmask() as well (just a trivial wrapper).
This provides consistent handling of SIGTHR between single- and multi-threaded
programs and is a step in the merge of all the libpthread overloads, providing
some ASM and Makefile bits that the other wrappers will need.

ok deraadt@ millert@


# 1.134 23-Oct-2015 deraadt

Remove dnssocket() and dnsconnect(), since we decided to use a SOCK_DNS
flag instead.
ok guenther tedu semarie


# 1.133 19-Oct-2015 deraadt

Remove old tame() stub


# 1.132 18-Oct-2015 deraadt

create libc stubs for dnssocket() and dnsconnect()


# 1.131 09-Oct-2015 deraadt

tame -> pledge conversion, in libc. I should crank libc, but am cheating
hoping things go well. The old symbol is faked via a stupid stub function,
until next major crank when it can be removed. I am expecting guenther
to scream at me.


# 1.130 13-Sep-2015 guenther

Rename __sysctl syscall to just sysctl, as the userland wrapper is no longer
necessary

ok deraadt@ jsing@


# 1.129 09-Sep-2015 guenther

Simplify makefile rules for building the ASM stubs into "pick something
from column A and something from column B".

ok miod@ deraadt@


# 1.128 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@


# 1.127 25-Aug-2015 guenther

Document kbind(2)


Revision tags: OPENBSD_5_8_BASE
# 1.126 19-Jul-2015 deraadt

manual page for tame(2). not very good, so i will be hearing from jmc


# 1.125 07-Apr-2015 guenther

Make pthread_atfork() track the DSO that called it like atexit() does,
unregistering callbacks if the DSO is unloaded. Move the callback
handling from libpthread to libc, though libpthread still overrides the
inner call to handle locking and thread-library reinitialization.
Major version bump for both libc and libpthread.

verification that this fixes various ports ajacoutot@
asm assistance miod@; ok millert@ deraadt@


Revision tags: OPENBSD_5_7_BASE
# 1.124 08-Dec-2014 guenther

Add chflagsat(), modeled on fchmodat() with name to match FreeBSD.


# 1.123 14-Nov-2014 guenther

Add sched_yield(2) manpage


# 1.122 31-Aug-2014 guenther

Declare and document getthrid()

indirectly prodded by krw@


# 1.121 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@


# 1.120 14-Aug-2014 tobias

fixed overrid(d)en typo

millert@ and jmc@ agree that "overriden" is wrong


Revision tags: OPENBSD_5_6_BASE
# 1.119 12-Jul-2014 deraadt

document sendsyslog(2); ok guenther tedu matthew


# 1.118 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.117 18-Mar-2014 miod

Retire hp300, mvme68k and mvme88k ports. These ports have no users, keeping
this hardware alive is becoming increasingly difficult, and I should heed the
message sent by the three disks which have died on me over the last few days.

Noone sane will mourn these ports anyway. So long, and thanks for the fish.


Revision tags: OPENBSD_5_5_BASE
# 1.116 13-Oct-2013 guenther

Make it possible to build to reduced version of a library, including
just specific objects that are compiled with additional options to
reduce their size. For use by distrib/ and crunchgen.

style and naming assistance from espie@


# 1.115 07-Oct-2013 guenther

getdirentries(2) is dead; long live getdents(2)!

confirmation that getdirentries(2) is unused by ports from sthen@ and naddy@


# 1.114 13-Aug-2013 guenther

Switch time_t, ino_t, clock_t, and struct kevent's ident and data
members to 64bit types. Assign new syscall numbers for (almost
all) the syscalls that involve the affected types, including anything
with time_t, timeval, itimerval, timespec, rusage, dirent, stat,
or kevent arguments. Add a d_off member to struct dirent and replace
getdirentries() with getdents(), thus immensely simplifying and
accelerating telldir/seekdir. Build perl with -DBIG_TIME.

Bump the major on every single base library: the compat bits included
here are only good enough to make the transition; the T32 compat
option will be burned as soon as we've reached the new world are
are happy with the snapshots for all architectures.

DANGER: ABI incompatibility. Updating to this kernel requires extra
work or you won't be able to login: install a snapshot instead.

Much assistance in fixing userland issues from deraadt@ and tedu@
and build assistance from todd@ and otto@


Revision tags: OPENBSD_5_4_BASE
# 1.113 05-Jun-2013 guenther

Move _Exit() from the exit() manpage to the _exit() manpage, as it's
just an alias of the latter.

ok matthew@ tedu@


# 1.112 01-Jun-2013 miod

Add utrace(2), a system call allowing for userland to send its own ktrace
records. From FreeBSD via otto@, with tweaks suggested by guenther@.
Commite on behalf of otto@ who is not around, to ride the libc minor bump.
Causes a librthread minor bump as well (new syscall).


# 1.111 29-Apr-2013 matthew

Extend P_SIGSUSPEND handling in userret() to properly restore the
sigmask even if there are no pending signals under the temporary
sigmask.

Refactor existing select() and poll() system calls to introduce the
pselect() and ppoll() system calls.

Add rthread wrappers for pselect() and ppoll(). While there, update
cancellation point comments to reflect recent fdatasync() addition.

Minor bumps for libc and librthread due to new symbols.

ok guenther, millert, deraadt, jmc


# 1.110 15-Apr-2013 matthew

Implement fdatasync() as a wrapper around fsync()

ok guenther, deraadt, jmc


Revision tags: OPENBSD_5_3_BASE
# 1.109 03-Feb-2013 miod

gremlin crept in


# 1.108 02-Feb-2013 miod

Userland bits for m68k/ELF. Mostly addition of register prefixes to the
assembler instructions, and cope with the few changes in return values
location.


# 1.107 04-Sep-2012 okan

remove lint leftovers; ok guenther@


# 1.106 23-Aug-2012 deraadt

no more nnpfspioctl() system call; ok guenther


# 1.105 22-Aug-2012 pascal

Convert cpp | as rules in bsd.lib.mk and lib/libc/sys/Makefile.inc to pure cc
invocations. This allows us to use the compiler builtin define __PIC__ to check
for PIC/PIEness rather than passing -DPIC. Simplifies PIE work a lot.

ok matthew@, conceptually ok kurt@


# 1.104 21-Aug-2012 pascal

Kill an old mips workaround; we don't support mips, just mips64.

ok deraadt@ kettenis@


Revision tags: OPENBSD_5_2_BASE
# 1.103 19-Jun-2012 deraadt

oops, forgot to install getdtablecount(2); noted by tedu


# 1.102 12-Apr-2012 deraadt

remove rfork(); ok guenther miod


# 1.101 12-Apr-2012 deraadt

kill lfs system call lines and libc stubs


# 1.100 12-Apr-2012 deraadt

New system call: getdtablecount(2) returns the number of file
descriptors the process currently has open.
ok guenther miod gilles ...


# 1.99 22-Mar-2012 guenther

Move __tfork_thread() from rthreads (libpthread) to libc so that
it can be used for not-strictly-threading purposes

ok matthew@ kurt@


# 1.98 13-Mar-2012 guenther

Add manpages for __thrsigdivert, __thrsleep, and __thrwakeup. Various
syntax and grammar fixes from jmc@


Revision tags: OPENBSD_5_1_BASE
# 1.97 17-Jan-2012 guenther

Reimplement mutexes, condvars, and rwlocks to eliminate bugs,
particularly the "consume the signal you just sent" hang, and putting
the wait queues in userspace.

Do cancellation handling in pthread_cond_*wait(), pthread_join(),
and sem_wait().

Add __ prefix to thr{sleep,wakeup,exit,sigdivert}() syscalls; add
'abort" argument to thrsleep to close cancellation race; make
thr{sleep,wakeup} return errno values via *retval to avoid touching
userspace errno.


# 1.96 22-Nov-2011 guenther

sigstack() is long dead, and the compat sigaltstack syscall is gone too.
Correct the namespace protections for sigreturn(), sigwait(), and psignal()

ok millert@


# 1.95 16-Oct-2011 guenther

Add stubs and manpage for __{get,set}_tcb

ok deraadt@


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

Add (rough draft) documentation for fdopendir(3) and the 15 new
XXXat(2) system calls from POSIX 2008. Editing will be done in tree.

General style discussed with jmc@, schwarze@, and deraadt@
ok jmc@


# 1.93 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@


Revision tags: OPENBSD_4_8_BASE OPENBSD_4_9_BASE
# 1.92 03-Jul-2010 guenther

Fix the naming of interfaces and variables for rdomains and rtables
and make it possible to bind sockets (including listening sockets!)
to rtables and not just rdomains. This changes the name of the
system calls, socket option, and ioctl. After building with this
you should remove the files /usr/share/man/cat2/[gs]etrdomain.0.

Since this removes the existing [gs]etrdomain() system calls, the
libc major is bumped.

Written by claudio@, criticized^Wcritiqued by me


# 1.91 01-Jul-2010 deraadt

getpeereid() can now be a library routine using getsockopt() with
SOL_SOCKET and SO_PEERCRED, only issue being that it cannot return
EFAULT for a page fault. The kernel code will soon be put into
compat, and then in 10 years or so tedu will delete it.
ok guenther millert


# 1.90 18-May-2010 tedu

add posix_madvise, posix_memalign, strndup, and strnlen. mostly from
brad and millert, with hints from guenther, jmc, and otto I think.
ok previous.


Revision tags: OPENBSD_4_7_BASE
# 1.89 03-Feb-2010 miod

Use MACHINE_CPU instead of MACHINE_ARCH to pick the correct machine dependent
files or directories when applicable.
The inspiration and name of MACHINE_CPU come from NetBSD, although the way to
provide it to Makefiles is completely different.
ok kettenis@


# 1.88 27-Nov-2009 guenther

Add setrdomain() and getrdomain() system calls. Committing now to
catch the libc major bump per request from deraadt@

Diff by reyk.

ok guenther@


# 1.87 13-Aug-2009 jmc

various MLINK fixes from Alan R. S. Bueno;


Revision tags: OPENBSD_4_6_BASE
# 1.86 03-Jun-2009 jj

Arla client rename from xfs to nnpfs for later upgrades. Tested on various arches. ok todd@ beck@


Revision tags: OPENBSD_4_4_BASE OPENBSD_4_5_BASE
# 1.85 22-Mar-2008 otto

move statvfs.c to gen, since it is not a syscall; ok deraadt@


# 1.84 16-Mar-2008 otto

statvfs support


Revision tags: OPENBSD_4_3_BASE
# 1.83 05-Jan-2008 deraadt

no more need for vadvise.o


# 1.82 09-Sep-2007 otto

Add lint stubs for the longjmp family of functions which are defined in
assembly on all platforms. ok deraadt@


# 1.81 09-Sep-2007 otto

Silence erroneous "environ used, but not defined" lint warning by
providing a stub. ok deraadt@


Revision tags: OPENBSD_4_1_BASE OPENBSD_4_2_BASE
# 1.80 24-Oct-2006 tedu

add rthread syscalls and bump minor.
rthreads are hardly done, but if just trying it out is too much of a hassle,
we'll never make more progress.
ok brad marc marco mbalmer


# 1.79 10-Oct-2006 deraadt

MLINKS to macros described in stat(2)


Revision tags: OPENBSD_4_0_BASE
# 1.78 14-Jun-2006 otto

Introducing adjfreq(2), to adjust the clock frequency.
Loosely based on dragonfly code. Man page help fro jmc@; ok deraadt@


# 1.77 27-May-2006 pedro

Make libc's getcwd() use the new __getcwd() system call
Hacked by marius@ at c2k5, okay miod@ krw@ deraadt@


# 1.76 13-Mar-2006 moritz

Clean the correct file. ok deraadt@


Revision tags: OPENBSD_3_9_BASE
# 1.75 29-Nov-2005 deraadt

Provide stubs for things which are supplied by crt0. I don't think we
want a crt0.ln, at least, not yet. We may reconsider later.


# 1.74 03-Oct-2005 jmc

add missing MLINK for WEXITSTATUS.2


Revision tags: OPENBSD_3_8_BASE
# 1.73 17-Jun-2005 drahn

Extended Attributes was a piece to get to ACLs, however ACLs have not
been worked on, so EA is pointless to maintain.


# 1.72 17-Jun-2005 millert

remove undelete syscall


Revision tags: OPENBSD_3_7_BASE
# 1.71 18-Sep-2004 deraadt

MLINK to macros provided in wait.2


# 1.70 16-Sep-2004 deraadt

add files missing for building a proper lint library


Revision tags: OPENBSD_3_5_BASE OPENBSD_3_6_BASE
# 1.69 13-Feb-2004 tedu

death to osigaltstack. ok deraadt@


# 1.68 15-Jan-2004 deraadt

ABI breakage happened with the sigaltstack replacement. It is too late,
now we just have to cope. Since setjmp uses it, the alpha and sparc64 are
unhappy with the structure change. In a few days, we will make the second
hop here, for now, use the old system call until all binaries have the new
struct in them.


# 1.67 12-Jan-2004 tedu

new syscall closefrom(2). ok deraadt millert


Revision tags: OPENBSD_3_4_BASE
# 1.66 10-May-2003 miod

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


# 1.65 14-Apr-2003 art

There are two related changes.

The first one is an mquery(2) syscall. It's for asking the VM system
about where to map things. It will be used by ld.so, read the man page
for details.

The second change is related and is a centralization of uvm_map hint
that all callers of uvm_map calculated. This will allow us to adjust
this hint on architectures that have segments for non-exec mappings.

deraadt@ drahn@ ok.


Revision tags: OPENBSD_3_3_BASE
# 1.64 31-Jan-2003 millert

Replace emulated versions of setreuid() and setregid() with real syscalls.
These are spec'd by POSIX as of 1003.1-2001; deraadt@ OK


# 1.63 02-Dec-2002 millert

Document getlogin_r()


# 1.62 02-Dec-2002 miod

Import propolice (http://www.trl.ibm.com/projects/security/ssp), a stack
attack protection scheme, into gcc.

This protection is enabled by default. It can be turned off by using the
-fno-stack-protector flag.

Code by Hiroaki Etoh (etoh at jp dot ibm dot com); work on openbsd-specific
integration by fgsch@, deraadt@ and myself; tests by fgsch@, naddy@ and
myself; beer drinking by myself.

Please note that system upgrades with this new code will require a new
libc and ld.so to be build and installed before the propolice-enabled
compiler can be installed.


# 1.61 10-Nov-2002 fgsch

missing MLINKs for setresuid(2). millert ok.


# 1.60 05-Nov-2002 marc

thread safe libc -- 2nd try. OK miod@, millert@
Thanks to miod@ for m68k and vax fixes


# 1.59 03-Nov-2002 marc

back out previous patch.. there are still some vax/m68k issues


# 1.58 03-Nov-2002 marc

libc changes for thread safety. Tested on:
alpha (millert@), i386 (marc@), m68k (millert@ and miod@),
powerpc (drahn@ and dhartmei@), sparc (millert@ and marc@),
sparc64 (marc@), and vax (millert@ and miod@).
Thanks to millert@, miod@, and mickey@ for fixes along the way.


# 1.57 30-Oct-2002 millert

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


Revision tags: OPENBSD_3_2_BASE
# 1.56 05-Aug-2002 art

Fix brain blackout.
Pointed out byb miod@.


# 1.55 05-Aug-2002 art

One more ELF_TOOLCHAIN.


# 1.54 06-Jul-2002 nordin

Remove kernel support for NTP. ok deraadt@ and tholo@


# 1.53 10-Jun-2002 fgsch

correct comment.


# 1.52 08-Jun-2002 drahn

ELF architectures all support weak aliases, enable them for this part.
ok fgsch@


Revision tags: OPENBSD_3_1_BASE
# 1.51 22-Feb-2002 drahn

Extended Attribute support, from FreeBSD/TrustedBSD. ok art@ deraadt@
libc support pieces


# 1.50 21-Feb-2002 art

remove rfork.o from the auto-generated assembler stubs


# 1.49 17-Feb-2002 deraadt

rfork() needs a fork.S-like stub as well; ok art


Revision tags: OPENBSD_3_0_BASE
# 1.48 25-Sep-2001 niklas

Forgotten DEBUGLIBS stuff


# 1.47 25-Sep-2001 drahn

Add an ASPICFLAG variable to bsd.own.mk which a platform use to pass flags
to 'as' to make it compile pic. add defaults for sparc64 which needs picflags
set to -fPIC and ASPICFLAGS to -KPIC.
Also simplifies the systemcall generation for sparc64 PIC mode.
ok epsie@.


# 1.46 20-Sep-2001 millert

Add PSEUDO_NOERROR similar to that used by NetBSD.
Some ports were setting errno in PSEUDO and some were not. Now errno
is set for all in PSEUDO and PSEUDO_NOERROR is provided for the
non-errno case (only used by _exit).

Needs testing on vax and m88k.
XXX - hppa and powerpc still lack a real PSEUDO_NOERROR implementation.
Currently PSEUDO_NOERROR and PSEUDO are the same (so builds don't
break on those platforms).


# 1.45 09-Jul-2001 fgsch

Install getpeereid(2) manpage.


# 1.44 26-Jun-2001 dugsong

implement djb's getpeereid(2), to allow local-domain servers to determine client credentials. mostly from superscript.com. deraadt@ ok


Revision tags: OPENBSD_2_9_BASE
# 1.43 14-Mar-2001 aaron

Move description of exect() to execve(2) man page. Add a note about exect() not
being portable.


# 1.42 09-Mar-2001 art

Add mlockall and munlockall. man-page from NetBSD.


# 1.41 10-Jan-2001 deraadt

put up FD_* manual pages, in section 3


# 1.40 23-Dec-2000 deraadt

create proper docs for timer{add,clear,sub,isset,cmp}


# 1.39 16-Nov-2000 provos

kqueue and kevent system calls


Revision tags: OPENBSD_2_8_BASE
# 1.38 17-Oct-2000 deraadt

damn it, i have had it with this untested weak shit


# 1.37 16-Oct-2000 deraadt

re-add weak sparc support; d@


# 1.36 15-May-2000 niklas

Add support for building libraries with debugging information in them.
Enable by setting DEBUGLIBS=yes in /etc/mk.conf, then -g libraries will get
installed in /usr/lib/debug. This directory will be searched first if
gcc is given the -g flag during the link stage.


Revision tags: OPENBSD_2_7_BASE
# 1.35 01-May-2000 deraadt

bye bye semconfig(2)


# 1.34 20-Apr-2000 deraadt

p{read,write}{,v} man pages


# 1.33 07-Feb-2000 assar

add fhopen, fhstat, fhstatfs system calls. largely from NetBSD


# 1.32 06-Jan-2000 d

for now, disable weak aliases for all archs except i386


# 1.31 14-Dec-1999 millert

Install swapctl.2, not swapon.2. swapon.2 should probably go away.


Revision tags: OPENBSD_2_6_BASE
# 1.30 07-Jun-1999 deraadt

replacement pipe() system call; copies data into place inside kernel, so
that EFAULT return value is possible


# 1.29 22-May-1999 weingart

Add swapctl(2), and crank shlib minor.


Revision tags: OPENBSD_2_5_BASE
# 1.28 01-Feb-1999 d

mi ptrace


# 1.27 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


Revision tags: OPENBSD_2_4_BASE
# 1.26 18-Sep-1998 art

make use of xfspioctl


Revision tags: OPENBSD_2_3_BASE
# 1.25 08-Feb-1998 tholo

Better lint(1) framework. Mostly from cgd@NetBSD


# 1.24 13-Nov-1997 deraadt

add getsid(2), XPG4


Revision tags: OPENBSD_2_2_BASE
# 1.23 30-May-1997 kstailey

add getpgrp(2) from NetBSD


Revision tags: OPENBSD_2_1_BASE
# 1.22 08-May-1997 kstailey

add tag


# 1.21 08-May-1997 kstailey

make clock_gettime.cat2


# 1.20 20-Apr-1997 tholo

New POSIX 1003.1b syscalls; from pk@NetBSD


# 1.19 04-Apr-1997 deraadt

seek(2) is not needed


# 1.18 29-Mar-1997 deraadt

futimes link; nakayosh@kcn.or.jp


# 1.17 26-Mar-1997 deraadt

install ktrace(2)


# 1.16 26-Jan-1997 downsj

Add a link for lchown.2


# 1.15 26-Jan-1997 downsj

Add lchown(), increment minor number.


# 1.14 11-Dec-1996 deraadt

generate reboot.o like other system calls


Revision tags: OPENBSD_2_0_BASE
# 1.13 02-Sep-1996 deraadt

shmdt link


# 1.12 25-Aug-1996 deraadt

and a man page


# 1.11 18-Jun-1996 deraadt

build poll.o


# 1.10 19-May-1996 pefo

Changes for mips.


# 1.9 18-May-1996 deraadt

poll() as a system call


# 1.8 08-May-1996 deraadt

install rfork man page


# 1.7 01-May-1996 deraadt

add futimes


# 1.6 25-Mar-1996 tholo

Add support for building lint(1) library


# 1.5 29-Jan-1996 tholo

Add kernel PLL for system clock
Add ntp_adjtime() and ntp_gettime() system calls
Mostly stolen from FreeBSD


# 1.4 08-Jan-1996 deraadt

add rfork.o and minherit.o


# 1.3 07-Jan-1996 deraadt

add minherit() system call


# 1.2 14-Dec-1995 deraadt

from netbsd:
add & fix a bunch of system call pages


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.169 08-Jan-2023 guenther

Add getthrname(2) manpage

ok jmc@ schwarze@


# 1.168 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@


# 1.167 19-Dec-2022 guenther

Add waitid(2) manpage, based on a first pass by espie@ and bits
from FreeBSD and NetBSD.

ok kettenis@ jmc@ espie@


# 1.166 26-Oct-2022 kettenis

Add waitid(2) syscall stub.

Minor bump to both libc and libpthread: make sure you install a new kernel!

ok millert@, deraadt@


# 1.165 07-Oct-2022 deraadt

Add mimmutable(2) libc stub, add & adjust manual pages, and crank the minor.
ok kettenis


Revision tags: OPENBSD_7_2_BASE
# 1.164 09-Sep-2022 mbuhl

Add libc wrappers for the new sendmmsg and recvmmsg system calls.
Feedback tb@, miod@, jca@
OK jca@


# 1.163 17-Jul-2022 deraadt

Add ypconnect(2) stub inside libc so that libc functions can use it,
but do not export it.


# 1.162 17-Jul-2022 deraadt

add ypconnect(2) manual page


Revision tags: OPENBSD_7_1_BASE
# 1.161 23-Dec-2021 guenther

Roll the syscalls that have an off_t argument to remove the explicit padding.
Switch libc and ld.so to the generic stubs for these calls.
WARNING: reboot to updated kernel before installing libc or ld.so!

Time for a story...

When gcc (back in 1.x days) first implemented long long, it didn't (always)
pass 64bit arguments in 'aligned' registers/stack slots, with the result that
argument offsets didn't match structure offsets. This affected the nine system
calls that pass off_t arguments:
ftruncate lseek mmap mquery pread preadv pwrite pwritev truncate

To avoid having to do custom ASM wrappers for those, BSD put an explicit pad
argument in so that the off_t argument would always start on a even slot and
thus be naturally aligned. Thus those odd wrappers in lib/libc/sys/ that use
__syscall() and pass an extra '0' argument.

The ABIs for different CPUs eventually settled how things should be passed on
each and gcc 2.x followed them. The only arch now where it helps is landisk,
which needs to skip the last argument register if it would be the first half of
a 64bit argument. So: add new syscalls without the pad argument and on landisk
do that skipping directly in the syscall handler in the kernel. Keep compat
support for the existing syscalls long enough for the transition.

ok deraadt@


Revision tags: OPENBSD_7_0_BASE
# 1.160 11-Jun-2021 kettenis

Since futex(2) can fail, it needs a full syscall stub. This should fixes
issues on powerpc64 and sparc64.

Note that this makes the lib/libpthread/errno test fail since that test
detects that we are touching errno now. This will be addressed in a
future diff as it is not entirely clear whether the test is correct.

ok mpi@, bluhm@


Revision tags: OPENBSD_6_8_BASE OPENBSD_6_9_BASE
# 1.159 06-Jul-2020 pirofti

Add support for timeconting in userland.

This diff exposes parts of clock_gettime(2) and gettimeofday(2) to
userland via libc eliberating processes from the need for a context
switch everytime they want to count the passage of time.

If a timecounter clock can be exposed to userland than it needs to set
its tc_user member to a non-zero value. Tested with one or multiple
counters per architecture.

The timing data is shared through a pointer found in the new ELF
auxiliary vector AUX_openbsd_timekeep containing timehands information
that is frequently updated by the kernel.

Timing differences between the last kernel update and the current time
are adjusted in userland by the tc_get_timecount() function inside the
MD usertc.c file.

This permits a much more responsive environment, quite visible in
browsers, office programs and gaming (apparently one is are able to fly
in Minecraft now).

Tested by robert@, sthen@, naddy@, kmos@, phessler@, and many others!

OK from at least kettenis@, cheloha@, naddy@, sthen@


Revision tags: OPENBSD_6_7_BASE
# 1.158 27-Nov-2019 deraadt

Document msyscall(2): ld.so can use this (once only) to tell the kernel
where libc.so's text segment is, thereby allowing invocation of system
calls from that region. An upcoming change will kill the process if a
system call is invoked from addresses not explicitly permitted.
ok guenther kettenis mortimer


Revision tags: OPENBSD_6_6_BASE
# 1.157 28-May-2019 beck

Enable the use of the kernel __realpath() system call in the libc wrapper.

For now, this also still uses the existing realpath implmentation
and emits a syslog if we see differening results. Once we have run
with that for a little while we will remove the old code

ok deraadt@


Revision tags: OPENBSD_6_5_BASE
# 1.156 11-Jan-2019 deraadt

mincore() is a relic from the past, exposing physical machine information
about shared resources which no program should see. only a few pieces of
software use it, generally poorly thought out. they are being fixed, so
mincore() can be deleted.
ok guenther tedu jca sthen, others


Revision tags: OPENBSD_6_4_BASE
# 1.155 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.154 12-Jan-2018 deraadt

sysctl(3) can now be renamed to sysctl(2)


# 1.153 28-Nov-2017 guenther

Delete fktrace(2). The consequences of it were not thought through
sufficiently and at least one horrific security hole was the result.

ok deraadt@ beck@


Revision tags: OPENBSD_6_2_BASE
# 1.152 13-Aug-2017 tedu

add fktrace to libc


# 1.151 12-Aug-2017 guenther

Instead of hardcoding a partial dependency list for the syscall stub objects,
calculate them as done for other objects


# 1.150 31-May-2017 sthen

install futex(2), ok mpi


# 1.149 30-Apr-2017 mpi

Add futex(2) shim, bump minor.

Inputs from guenther@, ok kettenis@, visa@


Revision tags: OPENBSD_6_1_BASE
# 1.148 29-Mar-2017 deraadt

The hppa version of as(1) requires whitespace before a .file directive,
it may not be in column 0. This kind of thing is very common in GNU
and Linux software because the software was written from the start to
be 'compatible replacements' of vendor software.
ok jsing guenther


# 1.147 26-Mar-2017 guenther

Use .file to convince 'as' to generate proper FILE symbols in the syscall
stubs that aren't actually in files, so that syspatch can figure out what
order the syscall stub objects are in the .so. Use -P to suppress to #line
directives that would override that. Tested with both gcc/gas and clang.

ok deraadt@


Revision tags: OPENBSD_6_0_BASE
# 1.146 04-Jul-2016 guenther

DEBUGLIBS has been broken since the gcc4 switch, so delete it. CFLAGS
contains -g by default anyway

problem noted by Edgar Pettijohn (edgar (at) pettijohn-web.com)
ok millert@ kettenis@ deraadt@


# 1.145 30-May-2016 guenther

Move __getcwd from ASM to HIDDEN: we don't want the literal __getcwd symbol

ok millert@ deraadt@


# 1.144 19-May-2016 guenther

Add ASM_NOERR for syscalls that never fail and thus don't need the errno
setting logic...which can significantly reduce the size of the stub on
some archs; 20 syscalls get a trim with this.

in snaps for a bit and ok deraadt@


# 1.143 09-May-2016 guenther

Remove sigreturn declaration and the now-unused libc syscall stub


# 1.142 07-May-2016 guenther

Use a Thread Information Block in both single and multi-threaded programs.
This stores errno, the cancelation flags, and related bits for each thread
and is allocated by ld.so or libc.a. This is an ABI break from 5.9-stable!

Make libpthread dlopen'able by moving the cancelation wrappers into libc
and doing locking and fork/errno handling via callbacks that libpthread
registers when it first initializes. 'errno' *must* be declared via
<errno.h> now!

Clean up libpthread's symbol exports like libc.

On powerpc, offset the TIB/TCB/TLS data from the register per the ELF spec.

Testing by various, particularly sthen@ and patrick@
ok kettenis@


# 1.141 30-Mar-2016 guenther

Turd polish: use HIDDEN= instead of PSEUDO= for ptrace syscall stub, to
make its underlying symbol name look like others.


# 1.140 30-Mar-2016 guenther

Eliminate userspace caching by getlogin_r/setlogin; make the getlogin
syscall behave exactly like userspace getlogin_r() and rename it to
match. Eliminate the reduced-to-no-op wrappers of the syscalls.
Eliminate the unnecessary per-thread static buffering by getlogin().

ok kettenis@ deraadt@


# 1.139 30-Mar-2016 jmc

for some time now mandoc has not required MLINKS to function
correctly - logically complete that now by removing MLINKS from base;

authors need only to ensure there is an entry in NAME for any function/
util being added. MLINKS will still work, and remain for perl to ease
upgrades;

ok nicm (curses) bcook (ssl)
ok schwarze, who provided a lot of feedback and assistance
ok tb natano jung


# 1.138 21-Mar-2016 bluhm

Rename the system call sendsyslog2 to sendsyslog. Keep the old one
as osendsyslog for a while. The three argument variant is the only
one that will stay.
input kettenis@; OK deraadt@


Revision tags: OPENBSD_5_9_BASE
# 1.137 25-Nov-2015 deraadt

Add a syscall stub for sendsyslog2(2), and use it in syslog_r(3), passing
LOG_CONS to the kernel. As a result, the /dev/console opening code can
be removed.
ok kettenis millert beck


# 1.136 10-Nov-2015 guenther

Split the intra-thread functionality from kill(2) into its own syscall
thrkill(2), rolling the kill(2) syscall number with the ABI change to
avoid breaking binaries during during the transition. thrkill(2) includes
a 'tcb' argument that eliminates the need for locking in pthread_kill()
and simplifies pthread_cancel(). Switch __stack_smash_handler() to use
thrkill(2) and explicitly unblock SIGABRT.

Minor bump to both libc and libpthread: make sure you install a new kernel!

ok semarie@


# 1.135 23-Oct-2015 guenther

Merge the sigaction() and sigprocmask() overloads/wrappers from libpthread
into libc, and move pthread_sigmask() as well (just a trivial wrapper).
This provides consistent handling of SIGTHR between single- and multi-threaded
programs and is a step in the merge of all the libpthread overloads, providing
some ASM and Makefile bits that the other wrappers will need.

ok deraadt@ millert@


# 1.134 23-Oct-2015 deraadt

Remove dnssocket() and dnsconnect(), since we decided to use a SOCK_DNS
flag instead.
ok guenther tedu semarie


# 1.133 19-Oct-2015 deraadt

Remove old tame() stub


# 1.132 18-Oct-2015 deraadt

create libc stubs for dnssocket() and dnsconnect()


# 1.131 09-Oct-2015 deraadt

tame -> pledge conversion, in libc. I should crank libc, but am cheating
hoping things go well. The old symbol is faked via a stupid stub function,
until next major crank when it can be removed. I am expecting guenther
to scream at me.


# 1.130 13-Sep-2015 guenther

Rename __sysctl syscall to just sysctl, as the userland wrapper is no longer
necessary

ok deraadt@ jsing@


# 1.129 09-Sep-2015 guenther

Simplify makefile rules for building the ASM stubs into "pick something
from column A and something from column B".

ok miod@ deraadt@


# 1.128 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@


# 1.127 25-Aug-2015 guenther

Document kbind(2)


Revision tags: OPENBSD_5_8_BASE
# 1.126 19-Jul-2015 deraadt

manual page for tame(2). not very good, so i will be hearing from jmc


# 1.125 07-Apr-2015 guenther

Make pthread_atfork() track the DSO that called it like atexit() does,
unregistering callbacks if the DSO is unloaded. Move the callback
handling from libpthread to libc, though libpthread still overrides the
inner call to handle locking and thread-library reinitialization.
Major version bump for both libc and libpthread.

verification that this fixes various ports ajacoutot@
asm assistance miod@; ok millert@ deraadt@


Revision tags: OPENBSD_5_7_BASE
# 1.124 08-Dec-2014 guenther

Add chflagsat(), modeled on fchmodat() with name to match FreeBSD.


# 1.123 14-Nov-2014 guenther

Add sched_yield(2) manpage


# 1.122 31-Aug-2014 guenther

Declare and document getthrid()

indirectly prodded by krw@


# 1.121 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@


# 1.120 14-Aug-2014 tobias

fixed overrid(d)en typo

millert@ and jmc@ agree that "overriden" is wrong


Revision tags: OPENBSD_5_6_BASE
# 1.119 12-Jul-2014 deraadt

document sendsyslog(2); ok guenther tedu matthew


# 1.118 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.117 18-Mar-2014 miod

Retire hp300, mvme68k and mvme88k ports. These ports have no users, keeping
this hardware alive is becoming increasingly difficult, and I should heed the
message sent by the three disks which have died on me over the last few days.

Noone sane will mourn these ports anyway. So long, and thanks for the fish.


Revision tags: OPENBSD_5_5_BASE
# 1.116 13-Oct-2013 guenther

Make it possible to build to reduced version of a library, including
just specific objects that are compiled with additional options to
reduce their size. For use by distrib/ and crunchgen.

style and naming assistance from espie@


# 1.115 07-Oct-2013 guenther

getdirentries(2) is dead; long live getdents(2)!

confirmation that getdirentries(2) is unused by ports from sthen@ and naddy@


# 1.114 13-Aug-2013 guenther

Switch time_t, ino_t, clock_t, and struct kevent's ident and data
members to 64bit types. Assign new syscall numbers for (almost
all) the syscalls that involve the affected types, including anything
with time_t, timeval, itimerval, timespec, rusage, dirent, stat,
or kevent arguments. Add a d_off member to struct dirent and replace
getdirentries() with getdents(), thus immensely simplifying and
accelerating telldir/seekdir. Build perl with -DBIG_TIME.

Bump the major on every single base library: the compat bits included
here are only good enough to make the transition; the T32 compat
option will be burned as soon as we've reached the new world are
are happy with the snapshots for all architectures.

DANGER: ABI incompatibility. Updating to this kernel requires extra
work or you won't be able to login: install a snapshot instead.

Much assistance in fixing userland issues from deraadt@ and tedu@
and build assistance from todd@ and otto@


Revision tags: OPENBSD_5_4_BASE
# 1.113 05-Jun-2013 guenther

Move _Exit() from the exit() manpage to the _exit() manpage, as it's
just an alias of the latter.

ok matthew@ tedu@


# 1.112 01-Jun-2013 miod

Add utrace(2), a system call allowing for userland to send its own ktrace
records. From FreeBSD via otto@, with tweaks suggested by guenther@.
Commite on behalf of otto@ who is not around, to ride the libc minor bump.
Causes a librthread minor bump as well (new syscall).


# 1.111 29-Apr-2013 matthew

Extend P_SIGSUSPEND handling in userret() to properly restore the
sigmask even if there are no pending signals under the temporary
sigmask.

Refactor existing select() and poll() system calls to introduce the
pselect() and ppoll() system calls.

Add rthread wrappers for pselect() and ppoll(). While there, update
cancellation point comments to reflect recent fdatasync() addition.

Minor bumps for libc and librthread due to new symbols.

ok guenther, millert, deraadt, jmc


# 1.110 15-Apr-2013 matthew

Implement fdatasync() as a wrapper around fsync()

ok guenther, deraadt, jmc


Revision tags: OPENBSD_5_3_BASE
# 1.109 03-Feb-2013 miod

gremlin crept in


# 1.108 02-Feb-2013 miod

Userland bits for m68k/ELF. Mostly addition of register prefixes to the
assembler instructions, and cope with the few changes in return values
location.


# 1.107 04-Sep-2012 okan

remove lint leftovers; ok guenther@


# 1.106 23-Aug-2012 deraadt

no more nnpfspioctl() system call; ok guenther


# 1.105 22-Aug-2012 pascal

Convert cpp | as rules in bsd.lib.mk and lib/libc/sys/Makefile.inc to pure cc
invocations. This allows us to use the compiler builtin define __PIC__ to check
for PIC/PIEness rather than passing -DPIC. Simplifies PIE work a lot.

ok matthew@, conceptually ok kurt@


# 1.104 21-Aug-2012 pascal

Kill an old mips workaround; we don't support mips, just mips64.

ok deraadt@ kettenis@


Revision tags: OPENBSD_5_2_BASE
# 1.103 19-Jun-2012 deraadt

oops, forgot to install getdtablecount(2); noted by tedu


# 1.102 12-Apr-2012 deraadt

remove rfork(); ok guenther miod


# 1.101 12-Apr-2012 deraadt

kill lfs system call lines and libc stubs


# 1.100 12-Apr-2012 deraadt

New system call: getdtablecount(2) returns the number of file
descriptors the process currently has open.
ok guenther miod gilles ...


# 1.99 22-Mar-2012 guenther

Move __tfork_thread() from rthreads (libpthread) to libc so that
it can be used for not-strictly-threading purposes

ok matthew@ kurt@


# 1.98 13-Mar-2012 guenther

Add manpages for __thrsigdivert, __thrsleep, and __thrwakeup. Various
syntax and grammar fixes from jmc@


Revision tags: OPENBSD_5_1_BASE
# 1.97 17-Jan-2012 guenther

Reimplement mutexes, condvars, and rwlocks to eliminate bugs,
particularly the "consume the signal you just sent" hang, and putting
the wait queues in userspace.

Do cancellation handling in pthread_cond_*wait(), pthread_join(),
and sem_wait().

Add __ prefix to thr{sleep,wakeup,exit,sigdivert}() syscalls; add
'abort" argument to thrsleep to close cancellation race; make
thr{sleep,wakeup} return errno values via *retval to avoid touching
userspace errno.


# 1.96 22-Nov-2011 guenther

sigstack() is long dead, and the compat sigaltstack syscall is gone too.
Correct the namespace protections for sigreturn(), sigwait(), and psignal()

ok millert@


# 1.95 16-Oct-2011 guenther

Add stubs and manpage for __{get,set}_tcb

ok deraadt@


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

Add (rough draft) documentation for fdopendir(3) and the 15 new
XXXat(2) system calls from POSIX 2008. Editing will be done in tree.

General style discussed with jmc@, schwarze@, and deraadt@
ok jmc@


# 1.93 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@


Revision tags: OPENBSD_4_8_BASE OPENBSD_4_9_BASE
# 1.92 03-Jul-2010 guenther

Fix the naming of interfaces and variables for rdomains and rtables
and make it possible to bind sockets (including listening sockets!)
to rtables and not just rdomains. This changes the name of the
system calls, socket option, and ioctl. After building with this
you should remove the files /usr/share/man/cat2/[gs]etrdomain.0.

Since this removes the existing [gs]etrdomain() system calls, the
libc major is bumped.

Written by claudio@, criticized^Wcritiqued by me


# 1.91 01-Jul-2010 deraadt

getpeereid() can now be a library routine using getsockopt() with
SOL_SOCKET and SO_PEERCRED, only issue being that it cannot return
EFAULT for a page fault. The kernel code will soon be put into
compat, and then in 10 years or so tedu will delete it.
ok guenther millert


# 1.90 18-May-2010 tedu

add posix_madvise, posix_memalign, strndup, and strnlen. mostly from
brad and millert, with hints from guenther, jmc, and otto I think.
ok previous.


Revision tags: OPENBSD_4_7_BASE
# 1.89 03-Feb-2010 miod

Use MACHINE_CPU instead of MACHINE_ARCH to pick the correct machine dependent
files or directories when applicable.
The inspiration and name of MACHINE_CPU come from NetBSD, although the way to
provide it to Makefiles is completely different.
ok kettenis@


# 1.88 27-Nov-2009 guenther

Add setrdomain() and getrdomain() system calls. Committing now to
catch the libc major bump per request from deraadt@

Diff by reyk.

ok guenther@


# 1.87 13-Aug-2009 jmc

various MLINK fixes from Alan R. S. Bueno;


Revision tags: OPENBSD_4_6_BASE
# 1.86 03-Jun-2009 jj

Arla client rename from xfs to nnpfs for later upgrades. Tested on various arches. ok todd@ beck@


Revision tags: OPENBSD_4_4_BASE OPENBSD_4_5_BASE
# 1.85 22-Mar-2008 otto

move statvfs.c to gen, since it is not a syscall; ok deraadt@


# 1.84 16-Mar-2008 otto

statvfs support


Revision tags: OPENBSD_4_3_BASE
# 1.83 05-Jan-2008 deraadt

no more need for vadvise.o


# 1.82 09-Sep-2007 otto

Add lint stubs for the longjmp family of functions which are defined in
assembly on all platforms. ok deraadt@


# 1.81 09-Sep-2007 otto

Silence erroneous "environ used, but not defined" lint warning by
providing a stub. ok deraadt@


Revision tags: OPENBSD_4_1_BASE OPENBSD_4_2_BASE
# 1.80 24-Oct-2006 tedu

add rthread syscalls and bump minor.
rthreads are hardly done, but if just trying it out is too much of a hassle,
we'll never make more progress.
ok brad marc marco mbalmer


# 1.79 10-Oct-2006 deraadt

MLINKS to macros described in stat(2)


Revision tags: OPENBSD_4_0_BASE
# 1.78 14-Jun-2006 otto

Introducing adjfreq(2), to adjust the clock frequency.
Loosely based on dragonfly code. Man page help fro jmc@; ok deraadt@


# 1.77 27-May-2006 pedro

Make libc's getcwd() use the new __getcwd() system call
Hacked by marius@ at c2k5, okay miod@ krw@ deraadt@


# 1.76 13-Mar-2006 moritz

Clean the correct file. ok deraadt@


Revision tags: OPENBSD_3_9_BASE
# 1.75 29-Nov-2005 deraadt

Provide stubs for things which are supplied by crt0. I don't think we
want a crt0.ln, at least, not yet. We may reconsider later.


# 1.74 03-Oct-2005 jmc

add missing MLINK for WEXITSTATUS.2


Revision tags: OPENBSD_3_8_BASE
# 1.73 17-Jun-2005 drahn

Extended Attributes was a piece to get to ACLs, however ACLs have not
been worked on, so EA is pointless to maintain.


# 1.72 17-Jun-2005 millert

remove undelete syscall


Revision tags: OPENBSD_3_7_BASE
# 1.71 18-Sep-2004 deraadt

MLINK to macros provided in wait.2


# 1.70 16-Sep-2004 deraadt

add files missing for building a proper lint library


Revision tags: OPENBSD_3_5_BASE OPENBSD_3_6_BASE
# 1.69 13-Feb-2004 tedu

death to osigaltstack. ok deraadt@


# 1.68 15-Jan-2004 deraadt

ABI breakage happened with the sigaltstack replacement. It is too late,
now we just have to cope. Since setjmp uses it, the alpha and sparc64 are
unhappy with the structure change. In a few days, we will make the second
hop here, for now, use the old system call until all binaries have the new
struct in them.


# 1.67 12-Jan-2004 tedu

new syscall closefrom(2). ok deraadt millert


Revision tags: OPENBSD_3_4_BASE
# 1.66 10-May-2003 miod

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


# 1.65 14-Apr-2003 art

There are two related changes.

The first one is an mquery(2) syscall. It's for asking the VM system
about where to map things. It will be used by ld.so, read the man page
for details.

The second change is related and is a centralization of uvm_map hint
that all callers of uvm_map calculated. This will allow us to adjust
this hint on architectures that have segments for non-exec mappings.

deraadt@ drahn@ ok.


Revision tags: OPENBSD_3_3_BASE
# 1.64 31-Jan-2003 millert

Replace emulated versions of setreuid() and setregid() with real syscalls.
These are spec'd by POSIX as of 1003.1-2001; deraadt@ OK


# 1.63 02-Dec-2002 millert

Document getlogin_r()


# 1.62 02-Dec-2002 miod

Import propolice (http://www.trl.ibm.com/projects/security/ssp), a stack
attack protection scheme, into gcc.

This protection is enabled by default. It can be turned off by using the
-fno-stack-protector flag.

Code by Hiroaki Etoh (etoh at jp dot ibm dot com); work on openbsd-specific
integration by fgsch@, deraadt@ and myself; tests by fgsch@, naddy@ and
myself; beer drinking by myself.

Please note that system upgrades with this new code will require a new
libc and ld.so to be build and installed before the propolice-enabled
compiler can be installed.


# 1.61 10-Nov-2002 fgsch

missing MLINKs for setresuid(2). millert ok.


# 1.60 05-Nov-2002 marc

thread safe libc -- 2nd try. OK miod@, millert@
Thanks to miod@ for m68k and vax fixes


# 1.59 03-Nov-2002 marc

back out previous patch.. there are still some vax/m68k issues


# 1.58 03-Nov-2002 marc

libc changes for thread safety. Tested on:
alpha (millert@), i386 (marc@), m68k (millert@ and miod@),
powerpc (drahn@ and dhartmei@), sparc (millert@ and marc@),
sparc64 (marc@), and vax (millert@ and miod@).
Thanks to millert@, miod@, and mickey@ for fixes along the way.


# 1.57 30-Oct-2002 millert

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


Revision tags: OPENBSD_3_2_BASE
# 1.56 05-Aug-2002 art

Fix brain blackout.
Pointed out byb miod@.


# 1.55 05-Aug-2002 art

One more ELF_TOOLCHAIN.


# 1.54 06-Jul-2002 nordin

Remove kernel support for NTP. ok deraadt@ and tholo@


# 1.53 10-Jun-2002 fgsch

correct comment.


# 1.52 08-Jun-2002 drahn

ELF architectures all support weak aliases, enable them for this part.
ok fgsch@


Revision tags: OPENBSD_3_1_BASE
# 1.51 22-Feb-2002 drahn

Extended Attribute support, from FreeBSD/TrustedBSD. ok art@ deraadt@
libc support pieces


# 1.50 21-Feb-2002 art

remove rfork.o from the auto-generated assembler stubs


# 1.49 17-Feb-2002 deraadt

rfork() needs a fork.S-like stub as well; ok art


Revision tags: OPENBSD_3_0_BASE
# 1.48 25-Sep-2001 niklas

Forgotten DEBUGLIBS stuff


# 1.47 25-Sep-2001 drahn

Add an ASPICFLAG variable to bsd.own.mk which a platform use to pass flags
to 'as' to make it compile pic. add defaults for sparc64 which needs picflags
set to -fPIC and ASPICFLAGS to -KPIC.
Also simplifies the systemcall generation for sparc64 PIC mode.
ok epsie@.


# 1.46 20-Sep-2001 millert

Add PSEUDO_NOERROR similar to that used by NetBSD.
Some ports were setting errno in PSEUDO and some were not. Now errno
is set for all in PSEUDO and PSEUDO_NOERROR is provided for the
non-errno case (only used by _exit).

Needs testing on vax and m88k.
XXX - hppa and powerpc still lack a real PSEUDO_NOERROR implementation.
Currently PSEUDO_NOERROR and PSEUDO are the same (so builds don't
break on those platforms).


# 1.45 09-Jul-2001 fgsch

Install getpeereid(2) manpage.


# 1.44 26-Jun-2001 dugsong

implement djb's getpeereid(2), to allow local-domain servers to determine client credentials. mostly from superscript.com. deraadt@ ok


Revision tags: OPENBSD_2_9_BASE
# 1.43 14-Mar-2001 aaron

Move description of exect() to execve(2) man page. Add a note about exect() not
being portable.


# 1.42 09-Mar-2001 art

Add mlockall and munlockall. man-page from NetBSD.


# 1.41 10-Jan-2001 deraadt

put up FD_* manual pages, in section 3


# 1.40 23-Dec-2000 deraadt

create proper docs for timer{add,clear,sub,isset,cmp}


# 1.39 16-Nov-2000 provos

kqueue and kevent system calls


Revision tags: OPENBSD_2_8_BASE
# 1.38 17-Oct-2000 deraadt

damn it, i have had it with this untested weak shit


# 1.37 16-Oct-2000 deraadt

re-add weak sparc support; d@


# 1.36 15-May-2000 niklas

Add support for building libraries with debugging information in them.
Enable by setting DEBUGLIBS=yes in /etc/mk.conf, then -g libraries will get
installed in /usr/lib/debug. This directory will be searched first if
gcc is given the -g flag during the link stage.


Revision tags: OPENBSD_2_7_BASE
# 1.35 01-May-2000 deraadt

bye bye semconfig(2)


# 1.34 20-Apr-2000 deraadt

p{read,write}{,v} man pages


# 1.33 07-Feb-2000 assar

add fhopen, fhstat, fhstatfs system calls. largely from NetBSD


# 1.32 06-Jan-2000 d

for now, disable weak aliases for all archs except i386


# 1.31 14-Dec-1999 millert

Install swapctl.2, not swapon.2. swapon.2 should probably go away.


Revision tags: OPENBSD_2_6_BASE
# 1.30 07-Jun-1999 deraadt

replacement pipe() system call; copies data into place inside kernel, so
that EFAULT return value is possible


# 1.29 22-May-1999 weingart

Add swapctl(2), and crank shlib minor.


Revision tags: OPENBSD_2_5_BASE
# 1.28 01-Feb-1999 d

mi ptrace


# 1.27 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


Revision tags: OPENBSD_2_4_BASE
# 1.26 18-Sep-1998 art

make use of xfspioctl


Revision tags: OPENBSD_2_3_BASE
# 1.25 08-Feb-1998 tholo

Better lint(1) framework. Mostly from cgd@NetBSD


# 1.24 13-Nov-1997 deraadt

add getsid(2), XPG4


Revision tags: OPENBSD_2_2_BASE
# 1.23 30-May-1997 kstailey

add getpgrp(2) from NetBSD


Revision tags: OPENBSD_2_1_BASE
# 1.22 08-May-1997 kstailey

add tag


# 1.21 08-May-1997 kstailey

make clock_gettime.cat2


# 1.20 20-Apr-1997 tholo

New POSIX 1003.1b syscalls; from pk@NetBSD


# 1.19 04-Apr-1997 deraadt

seek(2) is not needed


# 1.18 29-Mar-1997 deraadt

futimes link; nakayosh@kcn.or.jp


# 1.17 26-Mar-1997 deraadt

install ktrace(2)


# 1.16 26-Jan-1997 downsj

Add a link for lchown.2


# 1.15 26-Jan-1997 downsj

Add lchown(), increment minor number.


# 1.14 11-Dec-1996 deraadt

generate reboot.o like other system calls


Revision tags: OPENBSD_2_0_BASE
# 1.13 02-Sep-1996 deraadt

shmdt link


# 1.12 25-Aug-1996 deraadt

and a man page


# 1.11 18-Jun-1996 deraadt

build poll.o


# 1.10 19-May-1996 pefo

Changes for mips.


# 1.9 18-May-1996 deraadt

poll() as a system call


# 1.8 08-May-1996 deraadt

install rfork man page


# 1.7 01-May-1996 deraadt

add futimes


# 1.6 25-Mar-1996 tholo

Add support for building lint(1) library


# 1.5 29-Jan-1996 tholo

Add kernel PLL for system clock
Add ntp_adjtime() and ntp_gettime() system calls
Mostly stolen from FreeBSD


# 1.4 08-Jan-1996 deraadt

add rfork.o and minherit.o


# 1.3 07-Jan-1996 deraadt

add minherit() system call


# 1.2 14-Dec-1995 deraadt

from netbsd:
add & fix a bunch of system call pages


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.168 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@


# 1.167 19-Dec-2022 guenther

Add waitid(2) manpage, based on a first pass by espie@ and bits
from FreeBSD and NetBSD.

ok kettenis@ jmc@ espie@


# 1.166 26-Oct-2022 kettenis

Add waitid(2) syscall stub.

Minor bump to both libc and libpthread: make sure you install a new kernel!

ok millert@, deraadt@


# 1.165 07-Oct-2022 deraadt

Add mimmutable(2) libc stub, add & adjust manual pages, and crank the minor.
ok kettenis


Revision tags: OPENBSD_7_2_BASE
# 1.164 09-Sep-2022 mbuhl

Add libc wrappers for the new sendmmsg and recvmmsg system calls.
Feedback tb@, miod@, jca@
OK jca@


# 1.163 17-Jul-2022 deraadt

Add ypconnect(2) stub inside libc so that libc functions can use it,
but do not export it.


# 1.162 17-Jul-2022 deraadt

add ypconnect(2) manual page


Revision tags: OPENBSD_7_1_BASE
# 1.161 23-Dec-2021 guenther

Roll the syscalls that have an off_t argument to remove the explicit padding.
Switch libc and ld.so to the generic stubs for these calls.
WARNING: reboot to updated kernel before installing libc or ld.so!

Time for a story...

When gcc (back in 1.x days) first implemented long long, it didn't (always)
pass 64bit arguments in 'aligned' registers/stack slots, with the result that
argument offsets didn't match structure offsets. This affected the nine system
calls that pass off_t arguments:
ftruncate lseek mmap mquery pread preadv pwrite pwritev truncate

To avoid having to do custom ASM wrappers for those, BSD put an explicit pad
argument in so that the off_t argument would always start on a even slot and
thus be naturally aligned. Thus those odd wrappers in lib/libc/sys/ that use
__syscall() and pass an extra '0' argument.

The ABIs for different CPUs eventually settled how things should be passed on
each and gcc 2.x followed them. The only arch now where it helps is landisk,
which needs to skip the last argument register if it would be the first half of
a 64bit argument. So: add new syscalls without the pad argument and on landisk
do that skipping directly in the syscall handler in the kernel. Keep compat
support for the existing syscalls long enough for the transition.

ok deraadt@


Revision tags: OPENBSD_7_0_BASE
# 1.160 11-Jun-2021 kettenis

Since futex(2) can fail, it needs a full syscall stub. This should fixes
issues on powerpc64 and sparc64.

Note that this makes the lib/libpthread/errno test fail since that test
detects that we are touching errno now. This will be addressed in a
future diff as it is not entirely clear whether the test is correct.

ok mpi@, bluhm@


Revision tags: OPENBSD_6_8_BASE OPENBSD_6_9_BASE
# 1.159 06-Jul-2020 pirofti

Add support for timeconting in userland.

This diff exposes parts of clock_gettime(2) and gettimeofday(2) to
userland via libc eliberating processes from the need for a context
switch everytime they want to count the passage of time.

If a timecounter clock can be exposed to userland than it needs to set
its tc_user member to a non-zero value. Tested with one or multiple
counters per architecture.

The timing data is shared through a pointer found in the new ELF
auxiliary vector AUX_openbsd_timekeep containing timehands information
that is frequently updated by the kernel.

Timing differences between the last kernel update and the current time
are adjusted in userland by the tc_get_timecount() function inside the
MD usertc.c file.

This permits a much more responsive environment, quite visible in
browsers, office programs and gaming (apparently one is are able to fly
in Minecraft now).

Tested by robert@, sthen@, naddy@, kmos@, phessler@, and many others!

OK from at least kettenis@, cheloha@, naddy@, sthen@


Revision tags: OPENBSD_6_7_BASE
# 1.158 27-Nov-2019 deraadt

Document msyscall(2): ld.so can use this (once only) to tell the kernel
where libc.so's text segment is, thereby allowing invocation of system
calls from that region. An upcoming change will kill the process if a
system call is invoked from addresses not explicitly permitted.
ok guenther kettenis mortimer


Revision tags: OPENBSD_6_6_BASE
# 1.157 28-May-2019 beck

Enable the use of the kernel __realpath() system call in the libc wrapper.

For now, this also still uses the existing realpath implmentation
and emits a syslog if we see differening results. Once we have run
with that for a little while we will remove the old code

ok deraadt@


Revision tags: OPENBSD_6_5_BASE
# 1.156 11-Jan-2019 deraadt

mincore() is a relic from the past, exposing physical machine information
about shared resources which no program should see. only a few pieces of
software use it, generally poorly thought out. they are being fixed, so
mincore() can be deleted.
ok guenther tedu jca sthen, others


Revision tags: OPENBSD_6_4_BASE
# 1.155 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.154 12-Jan-2018 deraadt

sysctl(3) can now be renamed to sysctl(2)


# 1.153 28-Nov-2017 guenther

Delete fktrace(2). The consequences of it were not thought through
sufficiently and at least one horrific security hole was the result.

ok deraadt@ beck@


Revision tags: OPENBSD_6_2_BASE
# 1.152 13-Aug-2017 tedu

add fktrace to libc


# 1.151 12-Aug-2017 guenther

Instead of hardcoding a partial dependency list for the syscall stub objects,
calculate them as done for other objects


# 1.150 31-May-2017 sthen

install futex(2), ok mpi


# 1.149 30-Apr-2017 mpi

Add futex(2) shim, bump minor.

Inputs from guenther@, ok kettenis@, visa@


Revision tags: OPENBSD_6_1_BASE
# 1.148 29-Mar-2017 deraadt

The hppa version of as(1) requires whitespace before a .file directive,
it may not be in column 0. This kind of thing is very common in GNU
and Linux software because the software was written from the start to
be 'compatible replacements' of vendor software.
ok jsing guenther


# 1.147 26-Mar-2017 guenther

Use .file to convince 'as' to generate proper FILE symbols in the syscall
stubs that aren't actually in files, so that syspatch can figure out what
order the syscall stub objects are in the .so. Use -P to suppress to #line
directives that would override that. Tested with both gcc/gas and clang.

ok deraadt@


Revision tags: OPENBSD_6_0_BASE
# 1.146 04-Jul-2016 guenther

DEBUGLIBS has been broken since the gcc4 switch, so delete it. CFLAGS
contains -g by default anyway

problem noted by Edgar Pettijohn (edgar (at) pettijohn-web.com)
ok millert@ kettenis@ deraadt@


# 1.145 30-May-2016 guenther

Move __getcwd from ASM to HIDDEN: we don't want the literal __getcwd symbol

ok millert@ deraadt@


# 1.144 19-May-2016 guenther

Add ASM_NOERR for syscalls that never fail and thus don't need the errno
setting logic...which can significantly reduce the size of the stub on
some archs; 20 syscalls get a trim with this.

in snaps for a bit and ok deraadt@


# 1.143 09-May-2016 guenther

Remove sigreturn declaration and the now-unused libc syscall stub


# 1.142 07-May-2016 guenther

Use a Thread Information Block in both single and multi-threaded programs.
This stores errno, the cancelation flags, and related bits for each thread
and is allocated by ld.so or libc.a. This is an ABI break from 5.9-stable!

Make libpthread dlopen'able by moving the cancelation wrappers into libc
and doing locking and fork/errno handling via callbacks that libpthread
registers when it first initializes. 'errno' *must* be declared via
<errno.h> now!

Clean up libpthread's symbol exports like libc.

On powerpc, offset the TIB/TCB/TLS data from the register per the ELF spec.

Testing by various, particularly sthen@ and patrick@
ok kettenis@


# 1.141 30-Mar-2016 guenther

Turd polish: use HIDDEN= instead of PSEUDO= for ptrace syscall stub, to
make its underlying symbol name look like others.


# 1.140 30-Mar-2016 guenther

Eliminate userspace caching by getlogin_r/setlogin; make the getlogin
syscall behave exactly like userspace getlogin_r() and rename it to
match. Eliminate the reduced-to-no-op wrappers of the syscalls.
Eliminate the unnecessary per-thread static buffering by getlogin().

ok kettenis@ deraadt@


# 1.139 30-Mar-2016 jmc

for some time now mandoc has not required MLINKS to function
correctly - logically complete that now by removing MLINKS from base;

authors need only to ensure there is an entry in NAME for any function/
util being added. MLINKS will still work, and remain for perl to ease
upgrades;

ok nicm (curses) bcook (ssl)
ok schwarze, who provided a lot of feedback and assistance
ok tb natano jung


# 1.138 21-Mar-2016 bluhm

Rename the system call sendsyslog2 to sendsyslog. Keep the old one
as osendsyslog for a while. The three argument variant is the only
one that will stay.
input kettenis@; OK deraadt@


Revision tags: OPENBSD_5_9_BASE
# 1.137 25-Nov-2015 deraadt

Add a syscall stub for sendsyslog2(2), and use it in syslog_r(3), passing
LOG_CONS to the kernel. As a result, the /dev/console opening code can
be removed.
ok kettenis millert beck


# 1.136 10-Nov-2015 guenther

Split the intra-thread functionality from kill(2) into its own syscall
thrkill(2), rolling the kill(2) syscall number with the ABI change to
avoid breaking binaries during during the transition. thrkill(2) includes
a 'tcb' argument that eliminates the need for locking in pthread_kill()
and simplifies pthread_cancel(). Switch __stack_smash_handler() to use
thrkill(2) and explicitly unblock SIGABRT.

Minor bump to both libc and libpthread: make sure you install a new kernel!

ok semarie@


# 1.135 23-Oct-2015 guenther

Merge the sigaction() and sigprocmask() overloads/wrappers from libpthread
into libc, and move pthread_sigmask() as well (just a trivial wrapper).
This provides consistent handling of SIGTHR between single- and multi-threaded
programs and is a step in the merge of all the libpthread overloads, providing
some ASM and Makefile bits that the other wrappers will need.

ok deraadt@ millert@


# 1.134 23-Oct-2015 deraadt

Remove dnssocket() and dnsconnect(), since we decided to use a SOCK_DNS
flag instead.
ok guenther tedu semarie


# 1.133 19-Oct-2015 deraadt

Remove old tame() stub


# 1.132 18-Oct-2015 deraadt

create libc stubs for dnssocket() and dnsconnect()


# 1.131 09-Oct-2015 deraadt

tame -> pledge conversion, in libc. I should crank libc, but am cheating
hoping things go well. The old symbol is faked via a stupid stub function,
until next major crank when it can be removed. I am expecting guenther
to scream at me.


# 1.130 13-Sep-2015 guenther

Rename __sysctl syscall to just sysctl, as the userland wrapper is no longer
necessary

ok deraadt@ jsing@


# 1.129 09-Sep-2015 guenther

Simplify makefile rules for building the ASM stubs into "pick something
from column A and something from column B".

ok miod@ deraadt@


# 1.128 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@


# 1.127 25-Aug-2015 guenther

Document kbind(2)


Revision tags: OPENBSD_5_8_BASE
# 1.126 19-Jul-2015 deraadt

manual page for tame(2). not very good, so i will be hearing from jmc


# 1.125 07-Apr-2015 guenther

Make pthread_atfork() track the DSO that called it like atexit() does,
unregistering callbacks if the DSO is unloaded. Move the callback
handling from libpthread to libc, though libpthread still overrides the
inner call to handle locking and thread-library reinitialization.
Major version bump for both libc and libpthread.

verification that this fixes various ports ajacoutot@
asm assistance miod@; ok millert@ deraadt@


Revision tags: OPENBSD_5_7_BASE
# 1.124 08-Dec-2014 guenther

Add chflagsat(), modeled on fchmodat() with name to match FreeBSD.


# 1.123 14-Nov-2014 guenther

Add sched_yield(2) manpage


# 1.122 31-Aug-2014 guenther

Declare and document getthrid()

indirectly prodded by krw@


# 1.121 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@


# 1.120 14-Aug-2014 tobias

fixed overrid(d)en typo

millert@ and jmc@ agree that "overriden" is wrong


Revision tags: OPENBSD_5_6_BASE
# 1.119 12-Jul-2014 deraadt

document sendsyslog(2); ok guenther tedu matthew


# 1.118 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.117 18-Mar-2014 miod

Retire hp300, mvme68k and mvme88k ports. These ports have no users, keeping
this hardware alive is becoming increasingly difficult, and I should heed the
message sent by the three disks which have died on me over the last few days.

Noone sane will mourn these ports anyway. So long, and thanks for the fish.


Revision tags: OPENBSD_5_5_BASE
# 1.116 13-Oct-2013 guenther

Make it possible to build to reduced version of a library, including
just specific objects that are compiled with additional options to
reduce their size. For use by distrib/ and crunchgen.

style and naming assistance from espie@


# 1.115 07-Oct-2013 guenther

getdirentries(2) is dead; long live getdents(2)!

confirmation that getdirentries(2) is unused by ports from sthen@ and naddy@


# 1.114 13-Aug-2013 guenther

Switch time_t, ino_t, clock_t, and struct kevent's ident and data
members to 64bit types. Assign new syscall numbers for (almost
all) the syscalls that involve the affected types, including anything
with time_t, timeval, itimerval, timespec, rusage, dirent, stat,
or kevent arguments. Add a d_off member to struct dirent and replace
getdirentries() with getdents(), thus immensely simplifying and
accelerating telldir/seekdir. Build perl with -DBIG_TIME.

Bump the major on every single base library: the compat bits included
here are only good enough to make the transition; the T32 compat
option will be burned as soon as we've reached the new world are
are happy with the snapshots for all architectures.

DANGER: ABI incompatibility. Updating to this kernel requires extra
work or you won't be able to login: install a snapshot instead.

Much assistance in fixing userland issues from deraadt@ and tedu@
and build assistance from todd@ and otto@


Revision tags: OPENBSD_5_4_BASE
# 1.113 05-Jun-2013 guenther

Move _Exit() from the exit() manpage to the _exit() manpage, as it's
just an alias of the latter.

ok matthew@ tedu@


# 1.112 01-Jun-2013 miod

Add utrace(2), a system call allowing for userland to send its own ktrace
records. From FreeBSD via otto@, with tweaks suggested by guenther@.
Commite on behalf of otto@ who is not around, to ride the libc minor bump.
Causes a librthread minor bump as well (new syscall).


# 1.111 29-Apr-2013 matthew

Extend P_SIGSUSPEND handling in userret() to properly restore the
sigmask even if there are no pending signals under the temporary
sigmask.

Refactor existing select() and poll() system calls to introduce the
pselect() and ppoll() system calls.

Add rthread wrappers for pselect() and ppoll(). While there, update
cancellation point comments to reflect recent fdatasync() addition.

Minor bumps for libc and librthread due to new symbols.

ok guenther, millert, deraadt, jmc


# 1.110 15-Apr-2013 matthew

Implement fdatasync() as a wrapper around fsync()

ok guenther, deraadt, jmc


Revision tags: OPENBSD_5_3_BASE
# 1.109 03-Feb-2013 miod

gremlin crept in


# 1.108 02-Feb-2013 miod

Userland bits for m68k/ELF. Mostly addition of register prefixes to the
assembler instructions, and cope with the few changes in return values
location.


# 1.107 04-Sep-2012 okan

remove lint leftovers; ok guenther@


# 1.106 23-Aug-2012 deraadt

no more nnpfspioctl() system call; ok guenther


# 1.105 22-Aug-2012 pascal

Convert cpp | as rules in bsd.lib.mk and lib/libc/sys/Makefile.inc to pure cc
invocations. This allows us to use the compiler builtin define __PIC__ to check
for PIC/PIEness rather than passing -DPIC. Simplifies PIE work a lot.

ok matthew@, conceptually ok kurt@


# 1.104 21-Aug-2012 pascal

Kill an old mips workaround; we don't support mips, just mips64.

ok deraadt@ kettenis@


Revision tags: OPENBSD_5_2_BASE
# 1.103 19-Jun-2012 deraadt

oops, forgot to install getdtablecount(2); noted by tedu


# 1.102 12-Apr-2012 deraadt

remove rfork(); ok guenther miod


# 1.101 12-Apr-2012 deraadt

kill lfs system call lines and libc stubs


# 1.100 12-Apr-2012 deraadt

New system call: getdtablecount(2) returns the number of file
descriptors the process currently has open.
ok guenther miod gilles ...


# 1.99 22-Mar-2012 guenther

Move __tfork_thread() from rthreads (libpthread) to libc so that
it can be used for not-strictly-threading purposes

ok matthew@ kurt@


# 1.98 13-Mar-2012 guenther

Add manpages for __thrsigdivert, __thrsleep, and __thrwakeup. Various
syntax and grammar fixes from jmc@


Revision tags: OPENBSD_5_1_BASE
# 1.97 17-Jan-2012 guenther

Reimplement mutexes, condvars, and rwlocks to eliminate bugs,
particularly the "consume the signal you just sent" hang, and putting
the wait queues in userspace.

Do cancellation handling in pthread_cond_*wait(), pthread_join(),
and sem_wait().

Add __ prefix to thr{sleep,wakeup,exit,sigdivert}() syscalls; add
'abort" argument to thrsleep to close cancellation race; make
thr{sleep,wakeup} return errno values via *retval to avoid touching
userspace errno.


# 1.96 22-Nov-2011 guenther

sigstack() is long dead, and the compat sigaltstack syscall is gone too.
Correct the namespace protections for sigreturn(), sigwait(), and psignal()

ok millert@


# 1.95 16-Oct-2011 guenther

Add stubs and manpage for __{get,set}_tcb

ok deraadt@


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

Add (rough draft) documentation for fdopendir(3) and the 15 new
XXXat(2) system calls from POSIX 2008. Editing will be done in tree.

General style discussed with jmc@, schwarze@, and deraadt@
ok jmc@


# 1.93 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@


Revision tags: OPENBSD_4_8_BASE OPENBSD_4_9_BASE
# 1.92 03-Jul-2010 guenther

Fix the naming of interfaces and variables for rdomains and rtables
and make it possible to bind sockets (including listening sockets!)
to rtables and not just rdomains. This changes the name of the
system calls, socket option, and ioctl. After building with this
you should remove the files /usr/share/man/cat2/[gs]etrdomain.0.

Since this removes the existing [gs]etrdomain() system calls, the
libc major is bumped.

Written by claudio@, criticized^Wcritiqued by me


# 1.91 01-Jul-2010 deraadt

getpeereid() can now be a library routine using getsockopt() with
SOL_SOCKET and SO_PEERCRED, only issue being that it cannot return
EFAULT for a page fault. The kernel code will soon be put into
compat, and then in 10 years or so tedu will delete it.
ok guenther millert


# 1.90 18-May-2010 tedu

add posix_madvise, posix_memalign, strndup, and strnlen. mostly from
brad and millert, with hints from guenther, jmc, and otto I think.
ok previous.


Revision tags: OPENBSD_4_7_BASE
# 1.89 03-Feb-2010 miod

Use MACHINE_CPU instead of MACHINE_ARCH to pick the correct machine dependent
files or directories when applicable.
The inspiration and name of MACHINE_CPU come from NetBSD, although the way to
provide it to Makefiles is completely different.
ok kettenis@


# 1.88 27-Nov-2009 guenther

Add setrdomain() and getrdomain() system calls. Committing now to
catch the libc major bump per request from deraadt@

Diff by reyk.

ok guenther@


# 1.87 13-Aug-2009 jmc

various MLINK fixes from Alan R. S. Bueno;


Revision tags: OPENBSD_4_6_BASE
# 1.86 03-Jun-2009 jj

Arla client rename from xfs to nnpfs for later upgrades. Tested on various arches. ok todd@ beck@


Revision tags: OPENBSD_4_4_BASE OPENBSD_4_5_BASE
# 1.85 22-Mar-2008 otto

move statvfs.c to gen, since it is not a syscall; ok deraadt@


# 1.84 16-Mar-2008 otto

statvfs support


Revision tags: OPENBSD_4_3_BASE
# 1.83 05-Jan-2008 deraadt

no more need for vadvise.o


# 1.82 09-Sep-2007 otto

Add lint stubs for the longjmp family of functions which are defined in
assembly on all platforms. ok deraadt@


# 1.81 09-Sep-2007 otto

Silence erroneous "environ used, but not defined" lint warning by
providing a stub. ok deraadt@


Revision tags: OPENBSD_4_1_BASE OPENBSD_4_2_BASE
# 1.80 24-Oct-2006 tedu

add rthread syscalls and bump minor.
rthreads are hardly done, but if just trying it out is too much of a hassle,
we'll never make more progress.
ok brad marc marco mbalmer


# 1.79 10-Oct-2006 deraadt

MLINKS to macros described in stat(2)


Revision tags: OPENBSD_4_0_BASE
# 1.78 14-Jun-2006 otto

Introducing adjfreq(2), to adjust the clock frequency.
Loosely based on dragonfly code. Man page help fro jmc@; ok deraadt@


# 1.77 27-May-2006 pedro

Make libc's getcwd() use the new __getcwd() system call
Hacked by marius@ at c2k5, okay miod@ krw@ deraadt@


# 1.76 13-Mar-2006 moritz

Clean the correct file. ok deraadt@


Revision tags: OPENBSD_3_9_BASE
# 1.75 29-Nov-2005 deraadt

Provide stubs for things which are supplied by crt0. I don't think we
want a crt0.ln, at least, not yet. We may reconsider later.


# 1.74 03-Oct-2005 jmc

add missing MLINK for WEXITSTATUS.2


Revision tags: OPENBSD_3_8_BASE
# 1.73 17-Jun-2005 drahn

Extended Attributes was a piece to get to ACLs, however ACLs have not
been worked on, so EA is pointless to maintain.


# 1.72 17-Jun-2005 millert

remove undelete syscall


Revision tags: OPENBSD_3_7_BASE
# 1.71 18-Sep-2004 deraadt

MLINK to macros provided in wait.2


# 1.70 16-Sep-2004 deraadt

add files missing for building a proper lint library


Revision tags: OPENBSD_3_5_BASE OPENBSD_3_6_BASE
# 1.69 13-Feb-2004 tedu

death to osigaltstack. ok deraadt@


# 1.68 15-Jan-2004 deraadt

ABI breakage happened with the sigaltstack replacement. It is too late,
now we just have to cope. Since setjmp uses it, the alpha and sparc64 are
unhappy with the structure change. In a few days, we will make the second
hop here, for now, use the old system call until all binaries have the new
struct in them.


# 1.67 12-Jan-2004 tedu

new syscall closefrom(2). ok deraadt millert


Revision tags: OPENBSD_3_4_BASE
# 1.66 10-May-2003 miod

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


# 1.65 14-Apr-2003 art

There are two related changes.

The first one is an mquery(2) syscall. It's for asking the VM system
about where to map things. It will be used by ld.so, read the man page
for details.

The second change is related and is a centralization of uvm_map hint
that all callers of uvm_map calculated. This will allow us to adjust
this hint on architectures that have segments for non-exec mappings.

deraadt@ drahn@ ok.


Revision tags: OPENBSD_3_3_BASE
# 1.64 31-Jan-2003 millert

Replace emulated versions of setreuid() and setregid() with real syscalls.
These are spec'd by POSIX as of 1003.1-2001; deraadt@ OK


# 1.63 02-Dec-2002 millert

Document getlogin_r()


# 1.62 02-Dec-2002 miod

Import propolice (http://www.trl.ibm.com/projects/security/ssp), a stack
attack protection scheme, into gcc.

This protection is enabled by default. It can be turned off by using the
-fno-stack-protector flag.

Code by Hiroaki Etoh (etoh at jp dot ibm dot com); work on openbsd-specific
integration by fgsch@, deraadt@ and myself; tests by fgsch@, naddy@ and
myself; beer drinking by myself.

Please note that system upgrades with this new code will require a new
libc and ld.so to be build and installed before the propolice-enabled
compiler can be installed.


# 1.61 10-Nov-2002 fgsch

missing MLINKs for setresuid(2). millert ok.


# 1.60 05-Nov-2002 marc

thread safe libc -- 2nd try. OK miod@, millert@
Thanks to miod@ for m68k and vax fixes


# 1.59 03-Nov-2002 marc

back out previous patch.. there are still some vax/m68k issues


# 1.58 03-Nov-2002 marc

libc changes for thread safety. Tested on:
alpha (millert@), i386 (marc@), m68k (millert@ and miod@),
powerpc (drahn@ and dhartmei@), sparc (millert@ and marc@),
sparc64 (marc@), and vax (millert@ and miod@).
Thanks to millert@, miod@, and mickey@ for fixes along the way.


# 1.57 30-Oct-2002 millert

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


Revision tags: OPENBSD_3_2_BASE
# 1.56 05-Aug-2002 art

Fix brain blackout.
Pointed out byb miod@.


# 1.55 05-Aug-2002 art

One more ELF_TOOLCHAIN.


# 1.54 06-Jul-2002 nordin

Remove kernel support for NTP. ok deraadt@ and tholo@


# 1.53 10-Jun-2002 fgsch

correct comment.


# 1.52 08-Jun-2002 drahn

ELF architectures all support weak aliases, enable them for this part.
ok fgsch@


Revision tags: OPENBSD_3_1_BASE
# 1.51 22-Feb-2002 drahn

Extended Attribute support, from FreeBSD/TrustedBSD. ok art@ deraadt@
libc support pieces


# 1.50 21-Feb-2002 art

remove rfork.o from the auto-generated assembler stubs


# 1.49 17-Feb-2002 deraadt

rfork() needs a fork.S-like stub as well; ok art


Revision tags: OPENBSD_3_0_BASE
# 1.48 25-Sep-2001 niklas

Forgotten DEBUGLIBS stuff


# 1.47 25-Sep-2001 drahn

Add an ASPICFLAG variable to bsd.own.mk which a platform use to pass flags
to 'as' to make it compile pic. add defaults for sparc64 which needs picflags
set to -fPIC and ASPICFLAGS to -KPIC.
Also simplifies the systemcall generation for sparc64 PIC mode.
ok epsie@.


# 1.46 20-Sep-2001 millert

Add PSEUDO_NOERROR similar to that used by NetBSD.
Some ports were setting errno in PSEUDO and some were not. Now errno
is set for all in PSEUDO and PSEUDO_NOERROR is provided for the
non-errno case (only used by _exit).

Needs testing on vax and m88k.
XXX - hppa and powerpc still lack a real PSEUDO_NOERROR implementation.
Currently PSEUDO_NOERROR and PSEUDO are the same (so builds don't
break on those platforms).


# 1.45 09-Jul-2001 fgsch

Install getpeereid(2) manpage.


# 1.44 26-Jun-2001 dugsong

implement djb's getpeereid(2), to allow local-domain servers to determine client credentials. mostly from superscript.com. deraadt@ ok


Revision tags: OPENBSD_2_9_BASE
# 1.43 14-Mar-2001 aaron

Move description of exect() to execve(2) man page. Add a note about exect() not
being portable.


# 1.42 09-Mar-2001 art

Add mlockall and munlockall. man-page from NetBSD.


# 1.41 10-Jan-2001 deraadt

put up FD_* manual pages, in section 3


# 1.40 23-Dec-2000 deraadt

create proper docs for timer{add,clear,sub,isset,cmp}


# 1.39 16-Nov-2000 provos

kqueue and kevent system calls


Revision tags: OPENBSD_2_8_BASE
# 1.38 17-Oct-2000 deraadt

damn it, i have had it with this untested weak shit


# 1.37 16-Oct-2000 deraadt

re-add weak sparc support; d@


# 1.36 15-May-2000 niklas

Add support for building libraries with debugging information in them.
Enable by setting DEBUGLIBS=yes in /etc/mk.conf, then -g libraries will get
installed in /usr/lib/debug. This directory will be searched first if
gcc is given the -g flag during the link stage.


Revision tags: OPENBSD_2_7_BASE
# 1.35 01-May-2000 deraadt

bye bye semconfig(2)


# 1.34 20-Apr-2000 deraadt

p{read,write}{,v} man pages


# 1.33 07-Feb-2000 assar

add fhopen, fhstat, fhstatfs system calls. largely from NetBSD


# 1.32 06-Jan-2000 d

for now, disable weak aliases for all archs except i386


# 1.31 14-Dec-1999 millert

Install swapctl.2, not swapon.2. swapon.2 should probably go away.


Revision tags: OPENBSD_2_6_BASE
# 1.30 07-Jun-1999 deraadt

replacement pipe() system call; copies data into place inside kernel, so
that EFAULT return value is possible


# 1.29 22-May-1999 weingart

Add swapctl(2), and crank shlib minor.


Revision tags: OPENBSD_2_5_BASE
# 1.28 01-Feb-1999 d

mi ptrace


# 1.27 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


Revision tags: OPENBSD_2_4_BASE
# 1.26 18-Sep-1998 art

make use of xfspioctl


Revision tags: OPENBSD_2_3_BASE
# 1.25 08-Feb-1998 tholo

Better lint(1) framework. Mostly from cgd@NetBSD


# 1.24 13-Nov-1997 deraadt

add getsid(2), XPG4


Revision tags: OPENBSD_2_2_BASE
# 1.23 30-May-1997 kstailey

add getpgrp(2) from NetBSD


Revision tags: OPENBSD_2_1_BASE
# 1.22 08-May-1997 kstailey

add tag


# 1.21 08-May-1997 kstailey

make clock_gettime.cat2


# 1.20 20-Apr-1997 tholo

New POSIX 1003.1b syscalls; from pk@NetBSD


# 1.19 04-Apr-1997 deraadt

seek(2) is not needed


# 1.18 29-Mar-1997 deraadt

futimes link; nakayosh@kcn.or.jp


# 1.17 26-Mar-1997 deraadt

install ktrace(2)


# 1.16 26-Jan-1997 downsj

Add a link for lchown.2


# 1.15 26-Jan-1997 downsj

Add lchown(), increment minor number.


# 1.14 11-Dec-1996 deraadt

generate reboot.o like other system calls


Revision tags: OPENBSD_2_0_BASE
# 1.13 02-Sep-1996 deraadt

shmdt link


# 1.12 25-Aug-1996 deraadt

and a man page


# 1.11 18-Jun-1996 deraadt

build poll.o


# 1.10 19-May-1996 pefo

Changes for mips.


# 1.9 18-May-1996 deraadt

poll() as a system call


# 1.8 08-May-1996 deraadt

install rfork man page


# 1.7 01-May-1996 deraadt

add futimes


# 1.6 25-Mar-1996 tholo

Add support for building lint(1) library


# 1.5 29-Jan-1996 tholo

Add kernel PLL for system clock
Add ntp_adjtime() and ntp_gettime() system calls
Mostly stolen from FreeBSD


# 1.4 08-Jan-1996 deraadt

add rfork.o and minherit.o


# 1.3 07-Jan-1996 deraadt

add minherit() system call


# 1.2 14-Dec-1995 deraadt

from netbsd:
add & fix a bunch of system call pages


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.167 19-Dec-2022 guenther

Add waitid(2) manpage, based on a first pass by espie@ and bits
from FreeBSD and NetBSD.

ok kettenis@ jmc@ espie@


# 1.166 26-Oct-2022 kettenis

Add waitid(2) syscall stub.

Minor bump to both libc and libpthread: make sure you install a new kernel!

ok millert@, deraadt@


# 1.165 07-Oct-2022 deraadt

Add mimmutable(2) libc stub, add & adjust manual pages, and crank the minor.
ok kettenis


Revision tags: OPENBSD_7_2_BASE
# 1.164 09-Sep-2022 mbuhl

Add libc wrappers for the new sendmmsg and recvmmsg system calls.
Feedback tb@, miod@, jca@
OK jca@


# 1.163 17-Jul-2022 deraadt

Add ypconnect(2) stub inside libc so that libc functions can use it,
but do not export it.


# 1.162 17-Jul-2022 deraadt

add ypconnect(2) manual page


Revision tags: OPENBSD_7_1_BASE
# 1.161 23-Dec-2021 guenther

Roll the syscalls that have an off_t argument to remove the explicit padding.
Switch libc and ld.so to the generic stubs for these calls.
WARNING: reboot to updated kernel before installing libc or ld.so!

Time for a story...

When gcc (back in 1.x days) first implemented long long, it didn't (always)
pass 64bit arguments in 'aligned' registers/stack slots, with the result that
argument offsets didn't match structure offsets. This affected the nine system
calls that pass off_t arguments:
ftruncate lseek mmap mquery pread preadv pwrite pwritev truncate

To avoid having to do custom ASM wrappers for those, BSD put an explicit pad
argument in so that the off_t argument would always start on a even slot and
thus be naturally aligned. Thus those odd wrappers in lib/libc/sys/ that use
__syscall() and pass an extra '0' argument.

The ABIs for different CPUs eventually settled how things should be passed on
each and gcc 2.x followed them. The only arch now where it helps is landisk,
which needs to skip the last argument register if it would be the first half of
a 64bit argument. So: add new syscalls without the pad argument and on landisk
do that skipping directly in the syscall handler in the kernel. Keep compat
support for the existing syscalls long enough for the transition.

ok deraadt@


Revision tags: OPENBSD_7_0_BASE
# 1.160 11-Jun-2021 kettenis

Since futex(2) can fail, it needs a full syscall stub. This should fixes
issues on powerpc64 and sparc64.

Note that this makes the lib/libpthread/errno test fail since that test
detects that we are touching errno now. This will be addressed in a
future diff as it is not entirely clear whether the test is correct.

ok mpi@, bluhm@


Revision tags: OPENBSD_6_8_BASE OPENBSD_6_9_BASE
# 1.159 06-Jul-2020 pirofti

Add support for timeconting in userland.

This diff exposes parts of clock_gettime(2) and gettimeofday(2) to
userland via libc eliberating processes from the need for a context
switch everytime they want to count the passage of time.

If a timecounter clock can be exposed to userland than it needs to set
its tc_user member to a non-zero value. Tested with one or multiple
counters per architecture.

The timing data is shared through a pointer found in the new ELF
auxiliary vector AUX_openbsd_timekeep containing timehands information
that is frequently updated by the kernel.

Timing differences between the last kernel update and the current time
are adjusted in userland by the tc_get_timecount() function inside the
MD usertc.c file.

This permits a much more responsive environment, quite visible in
browsers, office programs and gaming (apparently one is are able to fly
in Minecraft now).

Tested by robert@, sthen@, naddy@, kmos@, phessler@, and many others!

OK from at least kettenis@, cheloha@, naddy@, sthen@


Revision tags: OPENBSD_6_7_BASE
# 1.158 27-Nov-2019 deraadt

Document msyscall(2): ld.so can use this (once only) to tell the kernel
where libc.so's text segment is, thereby allowing invocation of system
calls from that region. An upcoming change will kill the process if a
system call is invoked from addresses not explicitly permitted.
ok guenther kettenis mortimer


Revision tags: OPENBSD_6_6_BASE
# 1.157 28-May-2019 beck

Enable the use of the kernel __realpath() system call in the libc wrapper.

For now, this also still uses the existing realpath implmentation
and emits a syslog if we see differening results. Once we have run
with that for a little while we will remove the old code

ok deraadt@


Revision tags: OPENBSD_6_5_BASE
# 1.156 11-Jan-2019 deraadt

mincore() is a relic from the past, exposing physical machine information
about shared resources which no program should see. only a few pieces of
software use it, generally poorly thought out. they are being fixed, so
mincore() can be deleted.
ok guenther tedu jca sthen, others


Revision tags: OPENBSD_6_4_BASE
# 1.155 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.154 12-Jan-2018 deraadt

sysctl(3) can now be renamed to sysctl(2)


# 1.153 28-Nov-2017 guenther

Delete fktrace(2). The consequences of it were not thought through
sufficiently and at least one horrific security hole was the result.

ok deraadt@ beck@


Revision tags: OPENBSD_6_2_BASE
# 1.152 13-Aug-2017 tedu

add fktrace to libc


# 1.151 12-Aug-2017 guenther

Instead of hardcoding a partial dependency list for the syscall stub objects,
calculate them as done for other objects


# 1.150 31-May-2017 sthen

install futex(2), ok mpi


# 1.149 30-Apr-2017 mpi

Add futex(2) shim, bump minor.

Inputs from guenther@, ok kettenis@, visa@


Revision tags: OPENBSD_6_1_BASE
# 1.148 29-Mar-2017 deraadt

The hppa version of as(1) requires whitespace before a .file directive,
it may not be in column 0. This kind of thing is very common in GNU
and Linux software because the software was written from the start to
be 'compatible replacements' of vendor software.
ok jsing guenther


# 1.147 26-Mar-2017 guenther

Use .file to convince 'as' to generate proper FILE symbols in the syscall
stubs that aren't actually in files, so that syspatch can figure out what
order the syscall stub objects are in the .so. Use -P to suppress to #line
directives that would override that. Tested with both gcc/gas and clang.

ok deraadt@


Revision tags: OPENBSD_6_0_BASE
# 1.146 04-Jul-2016 guenther

DEBUGLIBS has been broken since the gcc4 switch, so delete it. CFLAGS
contains -g by default anyway

problem noted by Edgar Pettijohn (edgar (at) pettijohn-web.com)
ok millert@ kettenis@ deraadt@


# 1.145 30-May-2016 guenther

Move __getcwd from ASM to HIDDEN: we don't want the literal __getcwd symbol

ok millert@ deraadt@


# 1.144 19-May-2016 guenther

Add ASM_NOERR for syscalls that never fail and thus don't need the errno
setting logic...which can significantly reduce the size of the stub on
some archs; 20 syscalls get a trim with this.

in snaps for a bit and ok deraadt@


# 1.143 09-May-2016 guenther

Remove sigreturn declaration and the now-unused libc syscall stub


# 1.142 07-May-2016 guenther

Use a Thread Information Block in both single and multi-threaded programs.
This stores errno, the cancelation flags, and related bits for each thread
and is allocated by ld.so or libc.a. This is an ABI break from 5.9-stable!

Make libpthread dlopen'able by moving the cancelation wrappers into libc
and doing locking and fork/errno handling via callbacks that libpthread
registers when it first initializes. 'errno' *must* be declared via
<errno.h> now!

Clean up libpthread's symbol exports like libc.

On powerpc, offset the TIB/TCB/TLS data from the register per the ELF spec.

Testing by various, particularly sthen@ and patrick@
ok kettenis@


# 1.141 30-Mar-2016 guenther

Turd polish: use HIDDEN= instead of PSEUDO= for ptrace syscall stub, to
make its underlying symbol name look like others.


# 1.140 30-Mar-2016 guenther

Eliminate userspace caching by getlogin_r/setlogin; make the getlogin
syscall behave exactly like userspace getlogin_r() and rename it to
match. Eliminate the reduced-to-no-op wrappers of the syscalls.
Eliminate the unnecessary per-thread static buffering by getlogin().

ok kettenis@ deraadt@


# 1.139 30-Mar-2016 jmc

for some time now mandoc has not required MLINKS to function
correctly - logically complete that now by removing MLINKS from base;

authors need only to ensure there is an entry in NAME for any function/
util being added. MLINKS will still work, and remain for perl to ease
upgrades;

ok nicm (curses) bcook (ssl)
ok schwarze, who provided a lot of feedback and assistance
ok tb natano jung


# 1.138 21-Mar-2016 bluhm

Rename the system call sendsyslog2 to sendsyslog. Keep the old one
as osendsyslog for a while. The three argument variant is the only
one that will stay.
input kettenis@; OK deraadt@


Revision tags: OPENBSD_5_9_BASE
# 1.137 25-Nov-2015 deraadt

Add a syscall stub for sendsyslog2(2), and use it in syslog_r(3), passing
LOG_CONS to the kernel. As a result, the /dev/console opening code can
be removed.
ok kettenis millert beck


# 1.136 10-Nov-2015 guenther

Split the intra-thread functionality from kill(2) into its own syscall
thrkill(2), rolling the kill(2) syscall number with the ABI change to
avoid breaking binaries during during the transition. thrkill(2) includes
a 'tcb' argument that eliminates the need for locking in pthread_kill()
and simplifies pthread_cancel(). Switch __stack_smash_handler() to use
thrkill(2) and explicitly unblock SIGABRT.

Minor bump to both libc and libpthread: make sure you install a new kernel!

ok semarie@


# 1.135 23-Oct-2015 guenther

Merge the sigaction() and sigprocmask() overloads/wrappers from libpthread
into libc, and move pthread_sigmask() as well (just a trivial wrapper).
This provides consistent handling of SIGTHR between single- and multi-threaded
programs and is a step in the merge of all the libpthread overloads, providing
some ASM and Makefile bits that the other wrappers will need.

ok deraadt@ millert@


# 1.134 23-Oct-2015 deraadt

Remove dnssocket() and dnsconnect(), since we decided to use a SOCK_DNS
flag instead.
ok guenther tedu semarie


# 1.133 19-Oct-2015 deraadt

Remove old tame() stub


# 1.132 18-Oct-2015 deraadt

create libc stubs for dnssocket() and dnsconnect()


# 1.131 09-Oct-2015 deraadt

tame -> pledge conversion, in libc. I should crank libc, but am cheating
hoping things go well. The old symbol is faked via a stupid stub function,
until next major crank when it can be removed. I am expecting guenther
to scream at me.


# 1.130 13-Sep-2015 guenther

Rename __sysctl syscall to just sysctl, as the userland wrapper is no longer
necessary

ok deraadt@ jsing@


# 1.129 09-Sep-2015 guenther

Simplify makefile rules for building the ASM stubs into "pick something
from column A and something from column B".

ok miod@ deraadt@


# 1.128 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@


# 1.127 25-Aug-2015 guenther

Document kbind(2)


Revision tags: OPENBSD_5_8_BASE
# 1.126 19-Jul-2015 deraadt

manual page for tame(2). not very good, so i will be hearing from jmc


# 1.125 07-Apr-2015 guenther

Make pthread_atfork() track the DSO that called it like atexit() does,
unregistering callbacks if the DSO is unloaded. Move the callback
handling from libpthread to libc, though libpthread still overrides the
inner call to handle locking and thread-library reinitialization.
Major version bump for both libc and libpthread.

verification that this fixes various ports ajacoutot@
asm assistance miod@; ok millert@ deraadt@


Revision tags: OPENBSD_5_7_BASE
# 1.124 08-Dec-2014 guenther

Add chflagsat(), modeled on fchmodat() with name to match FreeBSD.


# 1.123 14-Nov-2014 guenther

Add sched_yield(2) manpage


# 1.122 31-Aug-2014 guenther

Declare and document getthrid()

indirectly prodded by krw@


# 1.121 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@


# 1.120 14-Aug-2014 tobias

fixed overrid(d)en typo

millert@ and jmc@ agree that "overriden" is wrong


Revision tags: OPENBSD_5_6_BASE
# 1.119 12-Jul-2014 deraadt

document sendsyslog(2); ok guenther tedu matthew


# 1.118 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.117 18-Mar-2014 miod

Retire hp300, mvme68k and mvme88k ports. These ports have no users, keeping
this hardware alive is becoming increasingly difficult, and I should heed the
message sent by the three disks which have died on me over the last few days.

Noone sane will mourn these ports anyway. So long, and thanks for the fish.


Revision tags: OPENBSD_5_5_BASE
# 1.116 13-Oct-2013 guenther

Make it possible to build to reduced version of a library, including
just specific objects that are compiled with additional options to
reduce their size. For use by distrib/ and crunchgen.

style and naming assistance from espie@


# 1.115 07-Oct-2013 guenther

getdirentries(2) is dead; long live getdents(2)!

confirmation that getdirentries(2) is unused by ports from sthen@ and naddy@


# 1.114 13-Aug-2013 guenther

Switch time_t, ino_t, clock_t, and struct kevent's ident and data
members to 64bit types. Assign new syscall numbers for (almost
all) the syscalls that involve the affected types, including anything
with time_t, timeval, itimerval, timespec, rusage, dirent, stat,
or kevent arguments. Add a d_off member to struct dirent and replace
getdirentries() with getdents(), thus immensely simplifying and
accelerating telldir/seekdir. Build perl with -DBIG_TIME.

Bump the major on every single base library: the compat bits included
here are only good enough to make the transition; the T32 compat
option will be burned as soon as we've reached the new world are
are happy with the snapshots for all architectures.

DANGER: ABI incompatibility. Updating to this kernel requires extra
work or you won't be able to login: install a snapshot instead.

Much assistance in fixing userland issues from deraadt@ and tedu@
and build assistance from todd@ and otto@


Revision tags: OPENBSD_5_4_BASE
# 1.113 05-Jun-2013 guenther

Move _Exit() from the exit() manpage to the _exit() manpage, as it's
just an alias of the latter.

ok matthew@ tedu@


# 1.112 01-Jun-2013 miod

Add utrace(2), a system call allowing for userland to send its own ktrace
records. From FreeBSD via otto@, with tweaks suggested by guenther@.
Commite on behalf of otto@ who is not around, to ride the libc minor bump.
Causes a librthread minor bump as well (new syscall).


# 1.111 29-Apr-2013 matthew

Extend P_SIGSUSPEND handling in userret() to properly restore the
sigmask even if there are no pending signals under the temporary
sigmask.

Refactor existing select() and poll() system calls to introduce the
pselect() and ppoll() system calls.

Add rthread wrappers for pselect() and ppoll(). While there, update
cancellation point comments to reflect recent fdatasync() addition.

Minor bumps for libc and librthread due to new symbols.

ok guenther, millert, deraadt, jmc


# 1.110 15-Apr-2013 matthew

Implement fdatasync() as a wrapper around fsync()

ok guenther, deraadt, jmc


Revision tags: OPENBSD_5_3_BASE
# 1.109 03-Feb-2013 miod

gremlin crept in


# 1.108 02-Feb-2013 miod

Userland bits for m68k/ELF. Mostly addition of register prefixes to the
assembler instructions, and cope with the few changes in return values
location.


# 1.107 04-Sep-2012 okan

remove lint leftovers; ok guenther@


# 1.106 23-Aug-2012 deraadt

no more nnpfspioctl() system call; ok guenther


# 1.105 22-Aug-2012 pascal

Convert cpp | as rules in bsd.lib.mk and lib/libc/sys/Makefile.inc to pure cc
invocations. This allows us to use the compiler builtin define __PIC__ to check
for PIC/PIEness rather than passing -DPIC. Simplifies PIE work a lot.

ok matthew@, conceptually ok kurt@


# 1.104 21-Aug-2012 pascal

Kill an old mips workaround; we don't support mips, just mips64.

ok deraadt@ kettenis@


Revision tags: OPENBSD_5_2_BASE
# 1.103 19-Jun-2012 deraadt

oops, forgot to install getdtablecount(2); noted by tedu


# 1.102 12-Apr-2012 deraadt

remove rfork(); ok guenther miod


# 1.101 12-Apr-2012 deraadt

kill lfs system call lines and libc stubs


# 1.100 12-Apr-2012 deraadt

New system call: getdtablecount(2) returns the number of file
descriptors the process currently has open.
ok guenther miod gilles ...


# 1.99 22-Mar-2012 guenther

Move __tfork_thread() from rthreads (libpthread) to libc so that
it can be used for not-strictly-threading purposes

ok matthew@ kurt@


# 1.98 13-Mar-2012 guenther

Add manpages for __thrsigdivert, __thrsleep, and __thrwakeup. Various
syntax and grammar fixes from jmc@


Revision tags: OPENBSD_5_1_BASE
# 1.97 17-Jan-2012 guenther

Reimplement mutexes, condvars, and rwlocks to eliminate bugs,
particularly the "consume the signal you just sent" hang, and putting
the wait queues in userspace.

Do cancellation handling in pthread_cond_*wait(), pthread_join(),
and sem_wait().

Add __ prefix to thr{sleep,wakeup,exit,sigdivert}() syscalls; add
'abort" argument to thrsleep to close cancellation race; make
thr{sleep,wakeup} return errno values via *retval to avoid touching
userspace errno.


# 1.96 22-Nov-2011 guenther

sigstack() is long dead, and the compat sigaltstack syscall is gone too.
Correct the namespace protections for sigreturn(), sigwait(), and psignal()

ok millert@


# 1.95 16-Oct-2011 guenther

Add stubs and manpage for __{get,set}_tcb

ok deraadt@


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

Add (rough draft) documentation for fdopendir(3) and the 15 new
XXXat(2) system calls from POSIX 2008. Editing will be done in tree.

General style discussed with jmc@, schwarze@, and deraadt@
ok jmc@


# 1.93 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@


Revision tags: OPENBSD_4_8_BASE OPENBSD_4_9_BASE
# 1.92 03-Jul-2010 guenther

Fix the naming of interfaces and variables for rdomains and rtables
and make it possible to bind sockets (including listening sockets!)
to rtables and not just rdomains. This changes the name of the
system calls, socket option, and ioctl. After building with this
you should remove the files /usr/share/man/cat2/[gs]etrdomain.0.

Since this removes the existing [gs]etrdomain() system calls, the
libc major is bumped.

Written by claudio@, criticized^Wcritiqued by me


# 1.91 01-Jul-2010 deraadt

getpeereid() can now be a library routine using getsockopt() with
SOL_SOCKET and SO_PEERCRED, only issue being that it cannot return
EFAULT for a page fault. The kernel code will soon be put into
compat, and then in 10 years or so tedu will delete it.
ok guenther millert


# 1.90 18-May-2010 tedu

add posix_madvise, posix_memalign, strndup, and strnlen. mostly from
brad and millert, with hints from guenther, jmc, and otto I think.
ok previous.


Revision tags: OPENBSD_4_7_BASE
# 1.89 03-Feb-2010 miod

Use MACHINE_CPU instead of MACHINE_ARCH to pick the correct machine dependent
files or directories when applicable.
The inspiration and name of MACHINE_CPU come from NetBSD, although the way to
provide it to Makefiles is completely different.
ok kettenis@


# 1.88 27-Nov-2009 guenther

Add setrdomain() and getrdomain() system calls. Committing now to
catch the libc major bump per request from deraadt@

Diff by reyk.

ok guenther@


# 1.87 13-Aug-2009 jmc

various MLINK fixes from Alan R. S. Bueno;


Revision tags: OPENBSD_4_6_BASE
# 1.86 03-Jun-2009 jj

Arla client rename from xfs to nnpfs for later upgrades. Tested on various arches. ok todd@ beck@


Revision tags: OPENBSD_4_4_BASE OPENBSD_4_5_BASE
# 1.85 22-Mar-2008 otto

move statvfs.c to gen, since it is not a syscall; ok deraadt@


# 1.84 16-Mar-2008 otto

statvfs support


Revision tags: OPENBSD_4_3_BASE
# 1.83 05-Jan-2008 deraadt

no more need for vadvise.o


# 1.82 09-Sep-2007 otto

Add lint stubs for the longjmp family of functions which are defined in
assembly on all platforms. ok deraadt@


# 1.81 09-Sep-2007 otto

Silence erroneous "environ used, but not defined" lint warning by
providing a stub. ok deraadt@


Revision tags: OPENBSD_4_1_BASE OPENBSD_4_2_BASE
# 1.80 24-Oct-2006 tedu

add rthread syscalls and bump minor.
rthreads are hardly done, but if just trying it out is too much of a hassle,
we'll never make more progress.
ok brad marc marco mbalmer


# 1.79 10-Oct-2006 deraadt

MLINKS to macros described in stat(2)


Revision tags: OPENBSD_4_0_BASE
# 1.78 14-Jun-2006 otto

Introducing adjfreq(2), to adjust the clock frequency.
Loosely based on dragonfly code. Man page help fro jmc@; ok deraadt@


# 1.77 27-May-2006 pedro

Make libc's getcwd() use the new __getcwd() system call
Hacked by marius@ at c2k5, okay miod@ krw@ deraadt@


# 1.76 13-Mar-2006 moritz

Clean the correct file. ok deraadt@


Revision tags: OPENBSD_3_9_BASE
# 1.75 29-Nov-2005 deraadt

Provide stubs for things which are supplied by crt0. I don't think we
want a crt0.ln, at least, not yet. We may reconsider later.


# 1.74 03-Oct-2005 jmc

add missing MLINK for WEXITSTATUS.2


Revision tags: OPENBSD_3_8_BASE
# 1.73 17-Jun-2005 drahn

Extended Attributes was a piece to get to ACLs, however ACLs have not
been worked on, so EA is pointless to maintain.


# 1.72 17-Jun-2005 millert

remove undelete syscall


Revision tags: OPENBSD_3_7_BASE
# 1.71 18-Sep-2004 deraadt

MLINK to macros provided in wait.2


# 1.70 16-Sep-2004 deraadt

add files missing for building a proper lint library


Revision tags: OPENBSD_3_5_BASE OPENBSD_3_6_BASE
# 1.69 13-Feb-2004 tedu

death to osigaltstack. ok deraadt@


# 1.68 15-Jan-2004 deraadt

ABI breakage happened with the sigaltstack replacement. It is too late,
now we just have to cope. Since setjmp uses it, the alpha and sparc64 are
unhappy with the structure change. In a few days, we will make the second
hop here, for now, use the old system call until all binaries have the new
struct in them.


# 1.67 12-Jan-2004 tedu

new syscall closefrom(2). ok deraadt millert


Revision tags: OPENBSD_3_4_BASE
# 1.66 10-May-2003 miod

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


# 1.65 14-Apr-2003 art

There are two related changes.

The first one is an mquery(2) syscall. It's for asking the VM system
about where to map things. It will be used by ld.so, read the man page
for details.

The second change is related and is a centralization of uvm_map hint
that all callers of uvm_map calculated. This will allow us to adjust
this hint on architectures that have segments for non-exec mappings.

deraadt@ drahn@ ok.


Revision tags: OPENBSD_3_3_BASE
# 1.64 31-Jan-2003 millert

Replace emulated versions of setreuid() and setregid() with real syscalls.
These are spec'd by POSIX as of 1003.1-2001; deraadt@ OK


# 1.63 02-Dec-2002 millert

Document getlogin_r()


# 1.62 02-Dec-2002 miod

Import propolice (http://www.trl.ibm.com/projects/security/ssp), a stack
attack protection scheme, into gcc.

This protection is enabled by default. It can be turned off by using the
-fno-stack-protector flag.

Code by Hiroaki Etoh (etoh at jp dot ibm dot com); work on openbsd-specific
integration by fgsch@, deraadt@ and myself; tests by fgsch@, naddy@ and
myself; beer drinking by myself.

Please note that system upgrades with this new code will require a new
libc and ld.so to be build and installed before the propolice-enabled
compiler can be installed.


# 1.61 10-Nov-2002 fgsch

missing MLINKs for setresuid(2). millert ok.


# 1.60 05-Nov-2002 marc

thread safe libc -- 2nd try. OK miod@, millert@
Thanks to miod@ for m68k and vax fixes


# 1.59 03-Nov-2002 marc

back out previous patch.. there are still some vax/m68k issues


# 1.58 03-Nov-2002 marc

libc changes for thread safety. Tested on:
alpha (millert@), i386 (marc@), m68k (millert@ and miod@),
powerpc (drahn@ and dhartmei@), sparc (millert@ and marc@),
sparc64 (marc@), and vax (millert@ and miod@).
Thanks to millert@, miod@, and mickey@ for fixes along the way.


# 1.57 30-Oct-2002 millert

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


Revision tags: OPENBSD_3_2_BASE
# 1.56 05-Aug-2002 art

Fix brain blackout.
Pointed out byb miod@.


# 1.55 05-Aug-2002 art

One more ELF_TOOLCHAIN.


# 1.54 06-Jul-2002 nordin

Remove kernel support for NTP. ok deraadt@ and tholo@


# 1.53 10-Jun-2002 fgsch

correct comment.


# 1.52 08-Jun-2002 drahn

ELF architectures all support weak aliases, enable them for this part.
ok fgsch@


Revision tags: OPENBSD_3_1_BASE
# 1.51 22-Feb-2002 drahn

Extended Attribute support, from FreeBSD/TrustedBSD. ok art@ deraadt@
libc support pieces


# 1.50 21-Feb-2002 art

remove rfork.o from the auto-generated assembler stubs


# 1.49 17-Feb-2002 deraadt

rfork() needs a fork.S-like stub as well; ok art


Revision tags: OPENBSD_3_0_BASE
# 1.48 25-Sep-2001 niklas

Forgotten DEBUGLIBS stuff


# 1.47 25-Sep-2001 drahn

Add an ASPICFLAG variable to bsd.own.mk which a platform use to pass flags
to 'as' to make it compile pic. add defaults for sparc64 which needs picflags
set to -fPIC and ASPICFLAGS to -KPIC.
Also simplifies the systemcall generation for sparc64 PIC mode.
ok epsie@.


# 1.46 20-Sep-2001 millert

Add PSEUDO_NOERROR similar to that used by NetBSD.
Some ports were setting errno in PSEUDO and some were not. Now errno
is set for all in PSEUDO and PSEUDO_NOERROR is provided for the
non-errno case (only used by _exit).

Needs testing on vax and m88k.
XXX - hppa and powerpc still lack a real PSEUDO_NOERROR implementation.
Currently PSEUDO_NOERROR and PSEUDO are the same (so builds don't
break on those platforms).


# 1.45 09-Jul-2001 fgsch

Install getpeereid(2) manpage.


# 1.44 26-Jun-2001 dugsong

implement djb's getpeereid(2), to allow local-domain servers to determine client credentials. mostly from superscript.com. deraadt@ ok


Revision tags: OPENBSD_2_9_BASE
# 1.43 14-Mar-2001 aaron

Move description of exect() to execve(2) man page. Add a note about exect() not
being portable.


# 1.42 09-Mar-2001 art

Add mlockall and munlockall. man-page from NetBSD.


# 1.41 10-Jan-2001 deraadt

put up FD_* manual pages, in section 3


# 1.40 23-Dec-2000 deraadt

create proper docs for timer{add,clear,sub,isset,cmp}


# 1.39 16-Nov-2000 provos

kqueue and kevent system calls


Revision tags: OPENBSD_2_8_BASE
# 1.38 17-Oct-2000 deraadt

damn it, i have had it with this untested weak shit


# 1.37 16-Oct-2000 deraadt

re-add weak sparc support; d@


# 1.36 15-May-2000 niklas

Add support for building libraries with debugging information in them.
Enable by setting DEBUGLIBS=yes in /etc/mk.conf, then -g libraries will get
installed in /usr/lib/debug. This directory will be searched first if
gcc is given the -g flag during the link stage.


Revision tags: OPENBSD_2_7_BASE
# 1.35 01-May-2000 deraadt

bye bye semconfig(2)


# 1.34 20-Apr-2000 deraadt

p{read,write}{,v} man pages


# 1.33 07-Feb-2000 assar

add fhopen, fhstat, fhstatfs system calls. largely from NetBSD


# 1.32 06-Jan-2000 d

for now, disable weak aliases for all archs except i386


# 1.31 14-Dec-1999 millert

Install swapctl.2, not swapon.2. swapon.2 should probably go away.


Revision tags: OPENBSD_2_6_BASE
# 1.30 07-Jun-1999 deraadt

replacement pipe() system call; copies data into place inside kernel, so
that EFAULT return value is possible


# 1.29 22-May-1999 weingart

Add swapctl(2), and crank shlib minor.


Revision tags: OPENBSD_2_5_BASE
# 1.28 01-Feb-1999 d

mi ptrace


# 1.27 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


Revision tags: OPENBSD_2_4_BASE
# 1.26 18-Sep-1998 art

make use of xfspioctl


Revision tags: OPENBSD_2_3_BASE
# 1.25 08-Feb-1998 tholo

Better lint(1) framework. Mostly from cgd@NetBSD


# 1.24 13-Nov-1997 deraadt

add getsid(2), XPG4


Revision tags: OPENBSD_2_2_BASE
# 1.23 30-May-1997 kstailey

add getpgrp(2) from NetBSD


Revision tags: OPENBSD_2_1_BASE
# 1.22 08-May-1997 kstailey

add tag


# 1.21 08-May-1997 kstailey

make clock_gettime.cat2


# 1.20 20-Apr-1997 tholo

New POSIX 1003.1b syscalls; from pk@NetBSD


# 1.19 04-Apr-1997 deraadt

seek(2) is not needed


# 1.18 29-Mar-1997 deraadt

futimes link; nakayosh@kcn.or.jp


# 1.17 26-Mar-1997 deraadt

install ktrace(2)


# 1.16 26-Jan-1997 downsj

Add a link for lchown.2


# 1.15 26-Jan-1997 downsj

Add lchown(), increment minor number.


# 1.14 11-Dec-1996 deraadt

generate reboot.o like other system calls


Revision tags: OPENBSD_2_0_BASE
# 1.13 02-Sep-1996 deraadt

shmdt link


# 1.12 25-Aug-1996 deraadt

and a man page


# 1.11 18-Jun-1996 deraadt

build poll.o


# 1.10 19-May-1996 pefo

Changes for mips.


# 1.9 18-May-1996 deraadt

poll() as a system call


# 1.8 08-May-1996 deraadt

install rfork man page


# 1.7 01-May-1996 deraadt

add futimes


# 1.6 25-Mar-1996 tholo

Add support for building lint(1) library


# 1.5 29-Jan-1996 tholo

Add kernel PLL for system clock
Add ntp_adjtime() and ntp_gettime() system calls
Mostly stolen from FreeBSD


# 1.4 08-Jan-1996 deraadt

add rfork.o and minherit.o


# 1.3 07-Jan-1996 deraadt

add minherit() system call


# 1.2 14-Dec-1995 deraadt

from netbsd:
add & fix a bunch of system call pages


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.166 26-Oct-2022 kettenis

Add waitid(2) syscall stub.

Minor bump to both libc and libpthread: make sure you install a new kernel!

ok millert@, deraadt@


# 1.165 07-Oct-2022 deraadt

Add mimmutable(2) libc stub, add & adjust manual pages, and crank the minor.
ok kettenis


Revision tags: OPENBSD_7_2_BASE
# 1.164 09-Sep-2022 mbuhl

Add libc wrappers for the new sendmmsg and recvmmsg system calls.
Feedback tb@, miod@, jca@
OK jca@


# 1.163 17-Jul-2022 deraadt

Add ypconnect(2) stub inside libc so that libc functions can use it,
but do not export it.


# 1.162 17-Jul-2022 deraadt

add ypconnect(2) manual page


Revision tags: OPENBSD_7_1_BASE
# 1.161 23-Dec-2021 guenther

Roll the syscalls that have an off_t argument to remove the explicit padding.
Switch libc and ld.so to the generic stubs for these calls.
WARNING: reboot to updated kernel before installing libc or ld.so!

Time for a story...

When gcc (back in 1.x days) first implemented long long, it didn't (always)
pass 64bit arguments in 'aligned' registers/stack slots, with the result that
argument offsets didn't match structure offsets. This affected the nine system
calls that pass off_t arguments:
ftruncate lseek mmap mquery pread preadv pwrite pwritev truncate

To avoid having to do custom ASM wrappers for those, BSD put an explicit pad
argument in so that the off_t argument would always start on a even slot and
thus be naturally aligned. Thus those odd wrappers in lib/libc/sys/ that use
__syscall() and pass an extra '0' argument.

The ABIs for different CPUs eventually settled how things should be passed on
each and gcc 2.x followed them. The only arch now where it helps is landisk,
which needs to skip the last argument register if it would be the first half of
a 64bit argument. So: add new syscalls without the pad argument and on landisk
do that skipping directly in the syscall handler in the kernel. Keep compat
support for the existing syscalls long enough for the transition.

ok deraadt@


Revision tags: OPENBSD_7_0_BASE
# 1.160 11-Jun-2021 kettenis

Since futex(2) can fail, it needs a full syscall stub. This should fixes
issues on powerpc64 and sparc64.

Note that this makes the lib/libpthread/errno test fail since that test
detects that we are touching errno now. This will be addressed in a
future diff as it is not entirely clear whether the test is correct.

ok mpi@, bluhm@


Revision tags: OPENBSD_6_8_BASE OPENBSD_6_9_BASE
# 1.159 06-Jul-2020 pirofti

Add support for timeconting in userland.

This diff exposes parts of clock_gettime(2) and gettimeofday(2) to
userland via libc eliberating processes from the need for a context
switch everytime they want to count the passage of time.

If a timecounter clock can be exposed to userland than it needs to set
its tc_user member to a non-zero value. Tested with one or multiple
counters per architecture.

The timing data is shared through a pointer found in the new ELF
auxiliary vector AUX_openbsd_timekeep containing timehands information
that is frequently updated by the kernel.

Timing differences between the last kernel update and the current time
are adjusted in userland by the tc_get_timecount() function inside the
MD usertc.c file.

This permits a much more responsive environment, quite visible in
browsers, office programs and gaming (apparently one is are able to fly
in Minecraft now).

Tested by robert@, sthen@, naddy@, kmos@, phessler@, and many others!

OK from at least kettenis@, cheloha@, naddy@, sthen@


Revision tags: OPENBSD_6_7_BASE
# 1.158 27-Nov-2019 deraadt

Document msyscall(2): ld.so can use this (once only) to tell the kernel
where libc.so's text segment is, thereby allowing invocation of system
calls from that region. An upcoming change will kill the process if a
system call is invoked from addresses not explicitly permitted.
ok guenther kettenis mortimer


Revision tags: OPENBSD_6_6_BASE
# 1.157 28-May-2019 beck

Enable the use of the kernel __realpath() system call in the libc wrapper.

For now, this also still uses the existing realpath implmentation
and emits a syslog if we see differening results. Once we have run
with that for a little while we will remove the old code

ok deraadt@


Revision tags: OPENBSD_6_5_BASE
# 1.156 11-Jan-2019 deraadt

mincore() is a relic from the past, exposing physical machine information
about shared resources which no program should see. only a few pieces of
software use it, generally poorly thought out. they are being fixed, so
mincore() can be deleted.
ok guenther tedu jca sthen, others


Revision tags: OPENBSD_6_4_BASE
# 1.155 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.154 12-Jan-2018 deraadt

sysctl(3) can now be renamed to sysctl(2)


# 1.153 28-Nov-2017 guenther

Delete fktrace(2). The consequences of it were not thought through
sufficiently and at least one horrific security hole was the result.

ok deraadt@ beck@


Revision tags: OPENBSD_6_2_BASE
# 1.152 13-Aug-2017 tedu

add fktrace to libc


# 1.151 12-Aug-2017 guenther

Instead of hardcoding a partial dependency list for the syscall stub objects,
calculate them as done for other objects


# 1.150 31-May-2017 sthen

install futex(2), ok mpi


# 1.149 30-Apr-2017 mpi

Add futex(2) shim, bump minor.

Inputs from guenther@, ok kettenis@, visa@


Revision tags: OPENBSD_6_1_BASE
# 1.148 29-Mar-2017 deraadt

The hppa version of as(1) requires whitespace before a .file directive,
it may not be in column 0. This kind of thing is very common in GNU
and Linux software because the software was written from the start to
be 'compatible replacements' of vendor software.
ok jsing guenther


# 1.147 26-Mar-2017 guenther

Use .file to convince 'as' to generate proper FILE symbols in the syscall
stubs that aren't actually in files, so that syspatch can figure out what
order the syscall stub objects are in the .so. Use -P to suppress to #line
directives that would override that. Tested with both gcc/gas and clang.

ok deraadt@


Revision tags: OPENBSD_6_0_BASE
# 1.146 04-Jul-2016 guenther

DEBUGLIBS has been broken since the gcc4 switch, so delete it. CFLAGS
contains -g by default anyway

problem noted by Edgar Pettijohn (edgar (at) pettijohn-web.com)
ok millert@ kettenis@ deraadt@


# 1.145 30-May-2016 guenther

Move __getcwd from ASM to HIDDEN: we don't want the literal __getcwd symbol

ok millert@ deraadt@


# 1.144 19-May-2016 guenther

Add ASM_NOERR for syscalls that never fail and thus don't need the errno
setting logic...which can significantly reduce the size of the stub on
some archs; 20 syscalls get a trim with this.

in snaps for a bit and ok deraadt@


# 1.143 09-May-2016 guenther

Remove sigreturn declaration and the now-unused libc syscall stub


# 1.142 07-May-2016 guenther

Use a Thread Information Block in both single and multi-threaded programs.
This stores errno, the cancelation flags, and related bits for each thread
and is allocated by ld.so or libc.a. This is an ABI break from 5.9-stable!

Make libpthread dlopen'able by moving the cancelation wrappers into libc
and doing locking and fork/errno handling via callbacks that libpthread
registers when it first initializes. 'errno' *must* be declared via
<errno.h> now!

Clean up libpthread's symbol exports like libc.

On powerpc, offset the TIB/TCB/TLS data from the register per the ELF spec.

Testing by various, particularly sthen@ and patrick@
ok kettenis@


# 1.141 30-Mar-2016 guenther

Turd polish: use HIDDEN= instead of PSEUDO= for ptrace syscall stub, to
make its underlying symbol name look like others.


# 1.140 30-Mar-2016 guenther

Eliminate userspace caching by getlogin_r/setlogin; make the getlogin
syscall behave exactly like userspace getlogin_r() and rename it to
match. Eliminate the reduced-to-no-op wrappers of the syscalls.
Eliminate the unnecessary per-thread static buffering by getlogin().

ok kettenis@ deraadt@


# 1.139 30-Mar-2016 jmc

for some time now mandoc has not required MLINKS to function
correctly - logically complete that now by removing MLINKS from base;

authors need only to ensure there is an entry in NAME for any function/
util being added. MLINKS will still work, and remain for perl to ease
upgrades;

ok nicm (curses) bcook (ssl)
ok schwarze, who provided a lot of feedback and assistance
ok tb natano jung


# 1.138 21-Mar-2016 bluhm

Rename the system call sendsyslog2 to sendsyslog. Keep the old one
as osendsyslog for a while. The three argument variant is the only
one that will stay.
input kettenis@; OK deraadt@


Revision tags: OPENBSD_5_9_BASE
# 1.137 25-Nov-2015 deraadt

Add a syscall stub for sendsyslog2(2), and use it in syslog_r(3), passing
LOG_CONS to the kernel. As a result, the /dev/console opening code can
be removed.
ok kettenis millert beck


# 1.136 10-Nov-2015 guenther

Split the intra-thread functionality from kill(2) into its own syscall
thrkill(2), rolling the kill(2) syscall number with the ABI change to
avoid breaking binaries during during the transition. thrkill(2) includes
a 'tcb' argument that eliminates the need for locking in pthread_kill()
and simplifies pthread_cancel(). Switch __stack_smash_handler() to use
thrkill(2) and explicitly unblock SIGABRT.

Minor bump to both libc and libpthread: make sure you install a new kernel!

ok semarie@


# 1.135 23-Oct-2015 guenther

Merge the sigaction() and sigprocmask() overloads/wrappers from libpthread
into libc, and move pthread_sigmask() as well (just a trivial wrapper).
This provides consistent handling of SIGTHR between single- and multi-threaded
programs and is a step in the merge of all the libpthread overloads, providing
some ASM and Makefile bits that the other wrappers will need.

ok deraadt@ millert@


# 1.134 23-Oct-2015 deraadt

Remove dnssocket() and dnsconnect(), since we decided to use a SOCK_DNS
flag instead.
ok guenther tedu semarie


# 1.133 19-Oct-2015 deraadt

Remove old tame() stub


# 1.132 18-Oct-2015 deraadt

create libc stubs for dnssocket() and dnsconnect()


# 1.131 09-Oct-2015 deraadt

tame -> pledge conversion, in libc. I should crank libc, but am cheating
hoping things go well. The old symbol is faked via a stupid stub function,
until next major crank when it can be removed. I am expecting guenther
to scream at me.


# 1.130 13-Sep-2015 guenther

Rename __sysctl syscall to just sysctl, as the userland wrapper is no longer
necessary

ok deraadt@ jsing@


# 1.129 09-Sep-2015 guenther

Simplify makefile rules for building the ASM stubs into "pick something
from column A and something from column B".

ok miod@ deraadt@


# 1.128 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@


# 1.127 25-Aug-2015 guenther

Document kbind(2)


Revision tags: OPENBSD_5_8_BASE
# 1.126 19-Jul-2015 deraadt

manual page for tame(2). not very good, so i will be hearing from jmc


# 1.125 07-Apr-2015 guenther

Make pthread_atfork() track the DSO that called it like atexit() does,
unregistering callbacks if the DSO is unloaded. Move the callback
handling from libpthread to libc, though libpthread still overrides the
inner call to handle locking and thread-library reinitialization.
Major version bump for both libc and libpthread.

verification that this fixes various ports ajacoutot@
asm assistance miod@; ok millert@ deraadt@


Revision tags: OPENBSD_5_7_BASE
# 1.124 08-Dec-2014 guenther

Add chflagsat(), modeled on fchmodat() with name to match FreeBSD.


# 1.123 14-Nov-2014 guenther

Add sched_yield(2) manpage


# 1.122 31-Aug-2014 guenther

Declare and document getthrid()

indirectly prodded by krw@


# 1.121 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@


# 1.120 14-Aug-2014 tobias

fixed overrid(d)en typo

millert@ and jmc@ agree that "overriden" is wrong


Revision tags: OPENBSD_5_6_BASE
# 1.119 12-Jul-2014 deraadt

document sendsyslog(2); ok guenther tedu matthew


# 1.118 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.117 18-Mar-2014 miod

Retire hp300, mvme68k and mvme88k ports. These ports have no users, keeping
this hardware alive is becoming increasingly difficult, and I should heed the
message sent by the three disks which have died on me over the last few days.

Noone sane will mourn these ports anyway. So long, and thanks for the fish.


Revision tags: OPENBSD_5_5_BASE
# 1.116 13-Oct-2013 guenther

Make it possible to build to reduced version of a library, including
just specific objects that are compiled with additional options to
reduce their size. For use by distrib/ and crunchgen.

style and naming assistance from espie@


# 1.115 07-Oct-2013 guenther

getdirentries(2) is dead; long live getdents(2)!

confirmation that getdirentries(2) is unused by ports from sthen@ and naddy@


# 1.114 13-Aug-2013 guenther

Switch time_t, ino_t, clock_t, and struct kevent's ident and data
members to 64bit types. Assign new syscall numbers for (almost
all) the syscalls that involve the affected types, including anything
with time_t, timeval, itimerval, timespec, rusage, dirent, stat,
or kevent arguments. Add a d_off member to struct dirent and replace
getdirentries() with getdents(), thus immensely simplifying and
accelerating telldir/seekdir. Build perl with -DBIG_TIME.

Bump the major on every single base library: the compat bits included
here are only good enough to make the transition; the T32 compat
option will be burned as soon as we've reached the new world are
are happy with the snapshots for all architectures.

DANGER: ABI incompatibility. Updating to this kernel requires extra
work or you won't be able to login: install a snapshot instead.

Much assistance in fixing userland issues from deraadt@ and tedu@
and build assistance from todd@ and otto@


Revision tags: OPENBSD_5_4_BASE
# 1.113 05-Jun-2013 guenther

Move _Exit() from the exit() manpage to the _exit() manpage, as it's
just an alias of the latter.

ok matthew@ tedu@


# 1.112 01-Jun-2013 miod

Add utrace(2), a system call allowing for userland to send its own ktrace
records. From FreeBSD via otto@, with tweaks suggested by guenther@.
Commite on behalf of otto@ who is not around, to ride the libc minor bump.
Causes a librthread minor bump as well (new syscall).


# 1.111 29-Apr-2013 matthew

Extend P_SIGSUSPEND handling in userret() to properly restore the
sigmask even if there are no pending signals under the temporary
sigmask.

Refactor existing select() and poll() system calls to introduce the
pselect() and ppoll() system calls.

Add rthread wrappers for pselect() and ppoll(). While there, update
cancellation point comments to reflect recent fdatasync() addition.

Minor bumps for libc and librthread due to new symbols.

ok guenther, millert, deraadt, jmc


# 1.110 15-Apr-2013 matthew

Implement fdatasync() as a wrapper around fsync()

ok guenther, deraadt, jmc


Revision tags: OPENBSD_5_3_BASE
# 1.109 03-Feb-2013 miod

gremlin crept in


# 1.108 02-Feb-2013 miod

Userland bits for m68k/ELF. Mostly addition of register prefixes to the
assembler instructions, and cope with the few changes in return values
location.


# 1.107 04-Sep-2012 okan

remove lint leftovers; ok guenther@


# 1.106 23-Aug-2012 deraadt

no more nnpfspioctl() system call; ok guenther


# 1.105 22-Aug-2012 pascal

Convert cpp | as rules in bsd.lib.mk and lib/libc/sys/Makefile.inc to pure cc
invocations. This allows us to use the compiler builtin define __PIC__ to check
for PIC/PIEness rather than passing -DPIC. Simplifies PIE work a lot.

ok matthew@, conceptually ok kurt@


# 1.104 21-Aug-2012 pascal

Kill an old mips workaround; we don't support mips, just mips64.

ok deraadt@ kettenis@


Revision tags: OPENBSD_5_2_BASE
# 1.103 19-Jun-2012 deraadt

oops, forgot to install getdtablecount(2); noted by tedu


# 1.102 12-Apr-2012 deraadt

remove rfork(); ok guenther miod


# 1.101 12-Apr-2012 deraadt

kill lfs system call lines and libc stubs


# 1.100 12-Apr-2012 deraadt

New system call: getdtablecount(2) returns the number of file
descriptors the process currently has open.
ok guenther miod gilles ...


# 1.99 22-Mar-2012 guenther

Move __tfork_thread() from rthreads (libpthread) to libc so that
it can be used for not-strictly-threading purposes

ok matthew@ kurt@


# 1.98 13-Mar-2012 guenther

Add manpages for __thrsigdivert, __thrsleep, and __thrwakeup. Various
syntax and grammar fixes from jmc@


Revision tags: OPENBSD_5_1_BASE
# 1.97 17-Jan-2012 guenther

Reimplement mutexes, condvars, and rwlocks to eliminate bugs,
particularly the "consume the signal you just sent" hang, and putting
the wait queues in userspace.

Do cancellation handling in pthread_cond_*wait(), pthread_join(),
and sem_wait().

Add __ prefix to thr{sleep,wakeup,exit,sigdivert}() syscalls; add
'abort" argument to thrsleep to close cancellation race; make
thr{sleep,wakeup} return errno values via *retval to avoid touching
userspace errno.


# 1.96 22-Nov-2011 guenther

sigstack() is long dead, and the compat sigaltstack syscall is gone too.
Correct the namespace protections for sigreturn(), sigwait(), and psignal()

ok millert@


# 1.95 16-Oct-2011 guenther

Add stubs and manpage for __{get,set}_tcb

ok deraadt@


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

Add (rough draft) documentation for fdopendir(3) and the 15 new
XXXat(2) system calls from POSIX 2008. Editing will be done in tree.

General style discussed with jmc@, schwarze@, and deraadt@
ok jmc@


# 1.93 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@


Revision tags: OPENBSD_4_8_BASE OPENBSD_4_9_BASE
# 1.92 03-Jul-2010 guenther

Fix the naming of interfaces and variables for rdomains and rtables
and make it possible to bind sockets (including listening sockets!)
to rtables and not just rdomains. This changes the name of the
system calls, socket option, and ioctl. After building with this
you should remove the files /usr/share/man/cat2/[gs]etrdomain.0.

Since this removes the existing [gs]etrdomain() system calls, the
libc major is bumped.

Written by claudio@, criticized^Wcritiqued by me


# 1.91 01-Jul-2010 deraadt

getpeereid() can now be a library routine using getsockopt() with
SOL_SOCKET and SO_PEERCRED, only issue being that it cannot return
EFAULT for a page fault. The kernel code will soon be put into
compat, and then in 10 years or so tedu will delete it.
ok guenther millert


# 1.90 18-May-2010 tedu

add posix_madvise, posix_memalign, strndup, and strnlen. mostly from
brad and millert, with hints from guenther, jmc, and otto I think.
ok previous.


Revision tags: OPENBSD_4_7_BASE
# 1.89 03-Feb-2010 miod

Use MACHINE_CPU instead of MACHINE_ARCH to pick the correct machine dependent
files or directories when applicable.
The inspiration and name of MACHINE_CPU come from NetBSD, although the way to
provide it to Makefiles is completely different.
ok kettenis@


# 1.88 27-Nov-2009 guenther

Add setrdomain() and getrdomain() system calls. Committing now to
catch the libc major bump per request from deraadt@

Diff by reyk.

ok guenther@


# 1.87 13-Aug-2009 jmc

various MLINK fixes from Alan R. S. Bueno;


Revision tags: OPENBSD_4_6_BASE
# 1.86 03-Jun-2009 jj

Arla client rename from xfs to nnpfs for later upgrades. Tested on various arches. ok todd@ beck@


Revision tags: OPENBSD_4_4_BASE OPENBSD_4_5_BASE
# 1.85 22-Mar-2008 otto

move statvfs.c to gen, since it is not a syscall; ok deraadt@


# 1.84 16-Mar-2008 otto

statvfs support


Revision tags: OPENBSD_4_3_BASE
# 1.83 05-Jan-2008 deraadt

no more need for vadvise.o


# 1.82 09-Sep-2007 otto

Add lint stubs for the longjmp family of functions which are defined in
assembly on all platforms. ok deraadt@


# 1.81 09-Sep-2007 otto

Silence erroneous "environ used, but not defined" lint warning by
providing a stub. ok deraadt@


Revision tags: OPENBSD_4_1_BASE OPENBSD_4_2_BASE
# 1.80 24-Oct-2006 tedu

add rthread syscalls and bump minor.
rthreads are hardly done, but if just trying it out is too much of a hassle,
we'll never make more progress.
ok brad marc marco mbalmer


# 1.79 10-Oct-2006 deraadt

MLINKS to macros described in stat(2)


Revision tags: OPENBSD_4_0_BASE
# 1.78 14-Jun-2006 otto

Introducing adjfreq(2), to adjust the clock frequency.
Loosely based on dragonfly code. Man page help fro jmc@; ok deraadt@


# 1.77 27-May-2006 pedro

Make libc's getcwd() use the new __getcwd() system call
Hacked by marius@ at c2k5, okay miod@ krw@ deraadt@


# 1.76 13-Mar-2006 moritz

Clean the correct file. ok deraadt@


Revision tags: OPENBSD_3_9_BASE
# 1.75 29-Nov-2005 deraadt

Provide stubs for things which are supplied by crt0. I don't think we
want a crt0.ln, at least, not yet. We may reconsider later.


# 1.74 03-Oct-2005 jmc

add missing MLINK for WEXITSTATUS.2


Revision tags: OPENBSD_3_8_BASE
# 1.73 17-Jun-2005 drahn

Extended Attributes was a piece to get to ACLs, however ACLs have not
been worked on, so EA is pointless to maintain.


# 1.72 17-Jun-2005 millert

remove undelete syscall


Revision tags: OPENBSD_3_7_BASE
# 1.71 18-Sep-2004 deraadt

MLINK to macros provided in wait.2


# 1.70 16-Sep-2004 deraadt

add files missing for building a proper lint library


Revision tags: OPENBSD_3_5_BASE OPENBSD_3_6_BASE
# 1.69 13-Feb-2004 tedu

death to osigaltstack. ok deraadt@


# 1.68 15-Jan-2004 deraadt

ABI breakage happened with the sigaltstack replacement. It is too late,
now we just have to cope. Since setjmp uses it, the alpha and sparc64 are
unhappy with the structure change. In a few days, we will make the second
hop here, for now, use the old system call until all binaries have the new
struct in them.


# 1.67 12-Jan-2004 tedu

new syscall closefrom(2). ok deraadt millert


Revision tags: OPENBSD_3_4_BASE
# 1.66 10-May-2003 miod

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


# 1.65 14-Apr-2003 art

There are two related changes.

The first one is an mquery(2) syscall. It's for asking the VM system
about where to map things. It will be used by ld.so, read the man page
for details.

The second change is related and is a centralization of uvm_map hint
that all callers of uvm_map calculated. This will allow us to adjust
this hint on architectures that have segments for non-exec mappings.

deraadt@ drahn@ ok.


Revision tags: OPENBSD_3_3_BASE
# 1.64 31-Jan-2003 millert

Replace emulated versions of setreuid() and setregid() with real syscalls.
These are spec'd by POSIX as of 1003.1-2001; deraadt@ OK


# 1.63 02-Dec-2002 millert

Document getlogin_r()


# 1.62 02-Dec-2002 miod

Import propolice (http://www.trl.ibm.com/projects/security/ssp), a stack
attack protection scheme, into gcc.

This protection is enabled by default. It can be turned off by using the
-fno-stack-protector flag.

Code by Hiroaki Etoh (etoh at jp dot ibm dot com); work on openbsd-specific
integration by fgsch@, deraadt@ and myself; tests by fgsch@, naddy@ and
myself; beer drinking by myself.

Please note that system upgrades with this new code will require a new
libc and ld.so to be build and installed before the propolice-enabled
compiler can be installed.


# 1.61 10-Nov-2002 fgsch

missing MLINKs for setresuid(2). millert ok.


# 1.60 05-Nov-2002 marc

thread safe libc -- 2nd try. OK miod@, millert@
Thanks to miod@ for m68k and vax fixes


# 1.59 03-Nov-2002 marc

back out previous patch.. there are still some vax/m68k issues


# 1.58 03-Nov-2002 marc

libc changes for thread safety. Tested on:
alpha (millert@), i386 (marc@), m68k (millert@ and miod@),
powerpc (drahn@ and dhartmei@), sparc (millert@ and marc@),
sparc64 (marc@), and vax (millert@ and miod@).
Thanks to millert@, miod@, and mickey@ for fixes along the way.


# 1.57 30-Oct-2002 millert

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


Revision tags: OPENBSD_3_2_BASE
# 1.56 05-Aug-2002 art

Fix brain blackout.
Pointed out byb miod@.


# 1.55 05-Aug-2002 art

One more ELF_TOOLCHAIN.


# 1.54 06-Jul-2002 nordin

Remove kernel support for NTP. ok deraadt@ and tholo@


# 1.53 10-Jun-2002 fgsch

correct comment.


# 1.52 08-Jun-2002 drahn

ELF architectures all support weak aliases, enable them for this part.
ok fgsch@


Revision tags: OPENBSD_3_1_BASE
# 1.51 22-Feb-2002 drahn

Extended Attribute support, from FreeBSD/TrustedBSD. ok art@ deraadt@
libc support pieces


# 1.50 21-Feb-2002 art

remove rfork.o from the auto-generated assembler stubs


# 1.49 17-Feb-2002 deraadt

rfork() needs a fork.S-like stub as well; ok art


Revision tags: OPENBSD_3_0_BASE
# 1.48 25-Sep-2001 niklas

Forgotten DEBUGLIBS stuff


# 1.47 25-Sep-2001 drahn

Add an ASPICFLAG variable to bsd.own.mk which a platform use to pass flags
to 'as' to make it compile pic. add defaults for sparc64 which needs picflags
set to -fPIC and ASPICFLAGS to -KPIC.
Also simplifies the systemcall generation for sparc64 PIC mode.
ok epsie@.


# 1.46 20-Sep-2001 millert

Add PSEUDO_NOERROR similar to that used by NetBSD.
Some ports were setting errno in PSEUDO and some were not. Now errno
is set for all in PSEUDO and PSEUDO_NOERROR is provided for the
non-errno case (only used by _exit).

Needs testing on vax and m88k.
XXX - hppa and powerpc still lack a real PSEUDO_NOERROR implementation.
Currently PSEUDO_NOERROR and PSEUDO are the same (so builds don't
break on those platforms).


# 1.45 09-Jul-2001 fgsch

Install getpeereid(2) manpage.


# 1.44 26-Jun-2001 dugsong

implement djb's getpeereid(2), to allow local-domain servers to determine client credentials. mostly from superscript.com. deraadt@ ok


Revision tags: OPENBSD_2_9_BASE
# 1.43 14-Mar-2001 aaron

Move description of exect() to execve(2) man page. Add a note about exect() not
being portable.


# 1.42 09-Mar-2001 art

Add mlockall and munlockall. man-page from NetBSD.


# 1.41 10-Jan-2001 deraadt

put up FD_* manual pages, in section 3


# 1.40 23-Dec-2000 deraadt

create proper docs for timer{add,clear,sub,isset,cmp}


# 1.39 16-Nov-2000 provos

kqueue and kevent system calls


Revision tags: OPENBSD_2_8_BASE
# 1.38 17-Oct-2000 deraadt

damn it, i have had it with this untested weak shit


# 1.37 16-Oct-2000 deraadt

re-add weak sparc support; d@


# 1.36 15-May-2000 niklas

Add support for building libraries with debugging information in them.
Enable by setting DEBUGLIBS=yes in /etc/mk.conf, then -g libraries will get
installed in /usr/lib/debug. This directory will be searched first if
gcc is given the -g flag during the link stage.


Revision tags: OPENBSD_2_7_BASE
# 1.35 01-May-2000 deraadt

bye bye semconfig(2)


# 1.34 20-Apr-2000 deraadt

p{read,write}{,v} man pages


# 1.33 07-Feb-2000 assar

add fhopen, fhstat, fhstatfs system calls. largely from NetBSD


# 1.32 06-Jan-2000 d

for now, disable weak aliases for all archs except i386


# 1.31 14-Dec-1999 millert

Install swapctl.2, not swapon.2. swapon.2 should probably go away.


Revision tags: OPENBSD_2_6_BASE
# 1.30 07-Jun-1999 deraadt

replacement pipe() system call; copies data into place inside kernel, so
that EFAULT return value is possible


# 1.29 22-May-1999 weingart

Add swapctl(2), and crank shlib minor.


Revision tags: OPENBSD_2_5_BASE
# 1.28 01-Feb-1999 d

mi ptrace


# 1.27 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


Revision tags: OPENBSD_2_4_BASE
# 1.26 18-Sep-1998 art

make use of xfspioctl


Revision tags: OPENBSD_2_3_BASE
# 1.25 08-Feb-1998 tholo

Better lint(1) framework. Mostly from cgd@NetBSD


# 1.24 13-Nov-1997 deraadt

add getsid(2), XPG4


Revision tags: OPENBSD_2_2_BASE
# 1.23 30-May-1997 kstailey

add getpgrp(2) from NetBSD


Revision tags: OPENBSD_2_1_BASE
# 1.22 08-May-1997 kstailey

add tag


# 1.21 08-May-1997 kstailey

make clock_gettime.cat2


# 1.20 20-Apr-1997 tholo

New POSIX 1003.1b syscalls; from pk@NetBSD


# 1.19 04-Apr-1997 deraadt

seek(2) is not needed


# 1.18 29-Mar-1997 deraadt

futimes link; nakayosh@kcn.or.jp


# 1.17 26-Mar-1997 deraadt

install ktrace(2)


# 1.16 26-Jan-1997 downsj

Add a link for lchown.2


# 1.15 26-Jan-1997 downsj

Add lchown(), increment minor number.


# 1.14 11-Dec-1996 deraadt

generate reboot.o like other system calls


Revision tags: OPENBSD_2_0_BASE
# 1.13 02-Sep-1996 deraadt

shmdt link


# 1.12 25-Aug-1996 deraadt

and a man page


# 1.11 18-Jun-1996 deraadt

build poll.o


# 1.10 19-May-1996 pefo

Changes for mips.


# 1.9 18-May-1996 deraadt

poll() as a system call


# 1.8 08-May-1996 deraadt

install rfork man page


# 1.7 01-May-1996 deraadt

add futimes


# 1.6 25-Mar-1996 tholo

Add support for building lint(1) library


# 1.5 29-Jan-1996 tholo

Add kernel PLL for system clock
Add ntp_adjtime() and ntp_gettime() system calls
Mostly stolen from FreeBSD


# 1.4 08-Jan-1996 deraadt

add rfork.o and minherit.o


# 1.3 07-Jan-1996 deraadt

add minherit() system call


# 1.2 14-Dec-1995 deraadt

from netbsd:
add & fix a bunch of system call pages


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.165 07-Oct-2022 deraadt

Add mimmutable(2) libc stub, add & adjust manual pages, and crank the minor.
ok kettenis


Revision tags: OPENBSD_7_2_BASE
# 1.164 09-Sep-2022 mbuhl

Add libc wrappers for the new sendmmsg and recvmmsg system calls.
Feedback tb@, miod@, jca@
OK jca@


# 1.163 17-Jul-2022 deraadt

Add ypconnect(2) stub inside libc so that libc functions can use it,
but do not export it.


# 1.162 17-Jul-2022 deraadt

add ypconnect(2) manual page


Revision tags: OPENBSD_7_1_BASE
# 1.161 23-Dec-2021 guenther

Roll the syscalls that have an off_t argument to remove the explicit padding.
Switch libc and ld.so to the generic stubs for these calls.
WARNING: reboot to updated kernel before installing libc or ld.so!

Time for a story...

When gcc (back in 1.x days) first implemented long long, it didn't (always)
pass 64bit arguments in 'aligned' registers/stack slots, with the result that
argument offsets didn't match structure offsets. This affected the nine system
calls that pass off_t arguments:
ftruncate lseek mmap mquery pread preadv pwrite pwritev truncate

To avoid having to do custom ASM wrappers for those, BSD put an explicit pad
argument in so that the off_t argument would always start on a even slot and
thus be naturally aligned. Thus those odd wrappers in lib/libc/sys/ that use
__syscall() and pass an extra '0' argument.

The ABIs for different CPUs eventually settled how things should be passed on
each and gcc 2.x followed them. The only arch now where it helps is landisk,
which needs to skip the last argument register if it would be the first half of
a 64bit argument. So: add new syscalls without the pad argument and on landisk
do that skipping directly in the syscall handler in the kernel. Keep compat
support for the existing syscalls long enough for the transition.

ok deraadt@


Revision tags: OPENBSD_7_0_BASE
# 1.160 11-Jun-2021 kettenis

Since futex(2) can fail, it needs a full syscall stub. This should fixes
issues on powerpc64 and sparc64.

Note that this makes the lib/libpthread/errno test fail since that test
detects that we are touching errno now. This will be addressed in a
future diff as it is not entirely clear whether the test is correct.

ok mpi@, bluhm@


Revision tags: OPENBSD_6_8_BASE OPENBSD_6_9_BASE
# 1.159 06-Jul-2020 pirofti

Add support for timeconting in userland.

This diff exposes parts of clock_gettime(2) and gettimeofday(2) to
userland via libc eliberating processes from the need for a context
switch everytime they want to count the passage of time.

If a timecounter clock can be exposed to userland than it needs to set
its tc_user member to a non-zero value. Tested with one or multiple
counters per architecture.

The timing data is shared through a pointer found in the new ELF
auxiliary vector AUX_openbsd_timekeep containing timehands information
that is frequently updated by the kernel.

Timing differences between the last kernel update and the current time
are adjusted in userland by the tc_get_timecount() function inside the
MD usertc.c file.

This permits a much more responsive environment, quite visible in
browsers, office programs and gaming (apparently one is are able to fly
in Minecraft now).

Tested by robert@, sthen@, naddy@, kmos@, phessler@, and many others!

OK from at least kettenis@, cheloha@, naddy@, sthen@


Revision tags: OPENBSD_6_7_BASE
# 1.158 27-Nov-2019 deraadt

Document msyscall(2): ld.so can use this (once only) to tell the kernel
where libc.so's text segment is, thereby allowing invocation of system
calls from that region. An upcoming change will kill the process if a
system call is invoked from addresses not explicitly permitted.
ok guenther kettenis mortimer


Revision tags: OPENBSD_6_6_BASE
# 1.157 28-May-2019 beck

Enable the use of the kernel __realpath() system call in the libc wrapper.

For now, this also still uses the existing realpath implmentation
and emits a syslog if we see differening results. Once we have run
with that for a little while we will remove the old code

ok deraadt@


Revision tags: OPENBSD_6_5_BASE
# 1.156 11-Jan-2019 deraadt

mincore() is a relic from the past, exposing physical machine information
about shared resources which no program should see. only a few pieces of
software use it, generally poorly thought out. they are being fixed, so
mincore() can be deleted.
ok guenther tedu jca sthen, others


Revision tags: OPENBSD_6_4_BASE
# 1.155 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.154 12-Jan-2018 deraadt

sysctl(3) can now be renamed to sysctl(2)


# 1.153 28-Nov-2017 guenther

Delete fktrace(2). The consequences of it were not thought through
sufficiently and at least one horrific security hole was the result.

ok deraadt@ beck@


Revision tags: OPENBSD_6_2_BASE
# 1.152 13-Aug-2017 tedu

add fktrace to libc


# 1.151 12-Aug-2017 guenther

Instead of hardcoding a partial dependency list for the syscall stub objects,
calculate them as done for other objects


# 1.150 31-May-2017 sthen

install futex(2), ok mpi


# 1.149 30-Apr-2017 mpi

Add futex(2) shim, bump minor.

Inputs from guenther@, ok kettenis@, visa@


Revision tags: OPENBSD_6_1_BASE
# 1.148 29-Mar-2017 deraadt

The hppa version of as(1) requires whitespace before a .file directive,
it may not be in column 0. This kind of thing is very common in GNU
and Linux software because the software was written from the start to
be 'compatible replacements' of vendor software.
ok jsing guenther


# 1.147 26-Mar-2017 guenther

Use .file to convince 'as' to generate proper FILE symbols in the syscall
stubs that aren't actually in files, so that syspatch can figure out what
order the syscall stub objects are in the .so. Use -P to suppress to #line
directives that would override that. Tested with both gcc/gas and clang.

ok deraadt@


Revision tags: OPENBSD_6_0_BASE
# 1.146 04-Jul-2016 guenther

DEBUGLIBS has been broken since the gcc4 switch, so delete it. CFLAGS
contains -g by default anyway

problem noted by Edgar Pettijohn (edgar (at) pettijohn-web.com)
ok millert@ kettenis@ deraadt@


# 1.145 30-May-2016 guenther

Move __getcwd from ASM to HIDDEN: we don't want the literal __getcwd symbol

ok millert@ deraadt@


# 1.144 19-May-2016 guenther

Add ASM_NOERR for syscalls that never fail and thus don't need the errno
setting logic...which can significantly reduce the size of the stub on
some archs; 20 syscalls get a trim with this.

in snaps for a bit and ok deraadt@


# 1.143 09-May-2016 guenther

Remove sigreturn declaration and the now-unused libc syscall stub


# 1.142 07-May-2016 guenther

Use a Thread Information Block in both single and multi-threaded programs.
This stores errno, the cancelation flags, and related bits for each thread
and is allocated by ld.so or libc.a. This is an ABI break from 5.9-stable!

Make libpthread dlopen'able by moving the cancelation wrappers into libc
and doing locking and fork/errno handling via callbacks that libpthread
registers when it first initializes. 'errno' *must* be declared via
<errno.h> now!

Clean up libpthread's symbol exports like libc.

On powerpc, offset the TIB/TCB/TLS data from the register per the ELF spec.

Testing by various, particularly sthen@ and patrick@
ok kettenis@


# 1.141 30-Mar-2016 guenther

Turd polish: use HIDDEN= instead of PSEUDO= for ptrace syscall stub, to
make its underlying symbol name look like others.


# 1.140 30-Mar-2016 guenther

Eliminate userspace caching by getlogin_r/setlogin; make the getlogin
syscall behave exactly like userspace getlogin_r() and rename it to
match. Eliminate the reduced-to-no-op wrappers of the syscalls.
Eliminate the unnecessary per-thread static buffering by getlogin().

ok kettenis@ deraadt@


# 1.139 30-Mar-2016 jmc

for some time now mandoc has not required MLINKS to function
correctly - logically complete that now by removing MLINKS from base;

authors need only to ensure there is an entry in NAME for any function/
util being added. MLINKS will still work, and remain for perl to ease
upgrades;

ok nicm (curses) bcook (ssl)
ok schwarze, who provided a lot of feedback and assistance
ok tb natano jung


# 1.138 21-Mar-2016 bluhm

Rename the system call sendsyslog2 to sendsyslog. Keep the old one
as osendsyslog for a while. The three argument variant is the only
one that will stay.
input kettenis@; OK deraadt@


Revision tags: OPENBSD_5_9_BASE
# 1.137 25-Nov-2015 deraadt

Add a syscall stub for sendsyslog2(2), and use it in syslog_r(3), passing
LOG_CONS to the kernel. As a result, the /dev/console opening code can
be removed.
ok kettenis millert beck


# 1.136 10-Nov-2015 guenther

Split the intra-thread functionality from kill(2) into its own syscall
thrkill(2), rolling the kill(2) syscall number with the ABI change to
avoid breaking binaries during during the transition. thrkill(2) includes
a 'tcb' argument that eliminates the need for locking in pthread_kill()
and simplifies pthread_cancel(). Switch __stack_smash_handler() to use
thrkill(2) and explicitly unblock SIGABRT.

Minor bump to both libc and libpthread: make sure you install a new kernel!

ok semarie@


# 1.135 23-Oct-2015 guenther

Merge the sigaction() and sigprocmask() overloads/wrappers from libpthread
into libc, and move pthread_sigmask() as well (just a trivial wrapper).
This provides consistent handling of SIGTHR between single- and multi-threaded
programs and is a step in the merge of all the libpthread overloads, providing
some ASM and Makefile bits that the other wrappers will need.

ok deraadt@ millert@


# 1.134 23-Oct-2015 deraadt

Remove dnssocket() and dnsconnect(), since we decided to use a SOCK_DNS
flag instead.
ok guenther tedu semarie


# 1.133 19-Oct-2015 deraadt

Remove old tame() stub


# 1.132 18-Oct-2015 deraadt

create libc stubs for dnssocket() and dnsconnect()


# 1.131 09-Oct-2015 deraadt

tame -> pledge conversion, in libc. I should crank libc, but am cheating
hoping things go well. The old symbol is faked via a stupid stub function,
until next major crank when it can be removed. I am expecting guenther
to scream at me.


# 1.130 13-Sep-2015 guenther

Rename __sysctl syscall to just sysctl, as the userland wrapper is no longer
necessary

ok deraadt@ jsing@


# 1.129 09-Sep-2015 guenther

Simplify makefile rules for building the ASM stubs into "pick something
from column A and something from column B".

ok miod@ deraadt@


# 1.128 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@


# 1.127 25-Aug-2015 guenther

Document kbind(2)


Revision tags: OPENBSD_5_8_BASE
# 1.126 19-Jul-2015 deraadt

manual page for tame(2). not very good, so i will be hearing from jmc


# 1.125 07-Apr-2015 guenther

Make pthread_atfork() track the DSO that called it like atexit() does,
unregistering callbacks if the DSO is unloaded. Move the callback
handling from libpthread to libc, though libpthread still overrides the
inner call to handle locking and thread-library reinitialization.
Major version bump for both libc and libpthread.

verification that this fixes various ports ajacoutot@
asm assistance miod@; ok millert@ deraadt@


Revision tags: OPENBSD_5_7_BASE
# 1.124 08-Dec-2014 guenther

Add chflagsat(), modeled on fchmodat() with name to match FreeBSD.


# 1.123 14-Nov-2014 guenther

Add sched_yield(2) manpage


# 1.122 31-Aug-2014 guenther

Declare and document getthrid()

indirectly prodded by krw@


# 1.121 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@


# 1.120 14-Aug-2014 tobias

fixed overrid(d)en typo

millert@ and jmc@ agree that "overriden" is wrong


Revision tags: OPENBSD_5_6_BASE
# 1.119 12-Jul-2014 deraadt

document sendsyslog(2); ok guenther tedu matthew


# 1.118 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.117 18-Mar-2014 miod

Retire hp300, mvme68k and mvme88k ports. These ports have no users, keeping
this hardware alive is becoming increasingly difficult, and I should heed the
message sent by the three disks which have died on me over the last few days.

Noone sane will mourn these ports anyway. So long, and thanks for the fish.


Revision tags: OPENBSD_5_5_BASE
# 1.116 13-Oct-2013 guenther

Make it possible to build to reduced version of a library, including
just specific objects that are compiled with additional options to
reduce their size. For use by distrib/ and crunchgen.

style and naming assistance from espie@


# 1.115 07-Oct-2013 guenther

getdirentries(2) is dead; long live getdents(2)!

confirmation that getdirentries(2) is unused by ports from sthen@ and naddy@


# 1.114 13-Aug-2013 guenther

Switch time_t, ino_t, clock_t, and struct kevent's ident and data
members to 64bit types. Assign new syscall numbers for (almost
all) the syscalls that involve the affected types, including anything
with time_t, timeval, itimerval, timespec, rusage, dirent, stat,
or kevent arguments. Add a d_off member to struct dirent and replace
getdirentries() with getdents(), thus immensely simplifying and
accelerating telldir/seekdir. Build perl with -DBIG_TIME.

Bump the major on every single base library: the compat bits included
here are only good enough to make the transition; the T32 compat
option will be burned as soon as we've reached the new world are
are happy with the snapshots for all architectures.

DANGER: ABI incompatibility. Updating to this kernel requires extra
work or you won't be able to login: install a snapshot instead.

Much assistance in fixing userland issues from deraadt@ and tedu@
and build assistance from todd@ and otto@


Revision tags: OPENBSD_5_4_BASE
# 1.113 05-Jun-2013 guenther

Move _Exit() from the exit() manpage to the _exit() manpage, as it's
just an alias of the latter.

ok matthew@ tedu@


# 1.112 01-Jun-2013 miod

Add utrace(2), a system call allowing for userland to send its own ktrace
records. From FreeBSD via otto@, with tweaks suggested by guenther@.
Commite on behalf of otto@ who is not around, to ride the libc minor bump.
Causes a librthread minor bump as well (new syscall).


# 1.111 29-Apr-2013 matthew

Extend P_SIGSUSPEND handling in userret() to properly restore the
sigmask even if there are no pending signals under the temporary
sigmask.

Refactor existing select() and poll() system calls to introduce the
pselect() and ppoll() system calls.

Add rthread wrappers for pselect() and ppoll(). While there, update
cancellation point comments to reflect recent fdatasync() addition.

Minor bumps for libc and librthread due to new symbols.

ok guenther, millert, deraadt, jmc


# 1.110 15-Apr-2013 matthew

Implement fdatasync() as a wrapper around fsync()

ok guenther, deraadt, jmc


Revision tags: OPENBSD_5_3_BASE
# 1.109 03-Feb-2013 miod

gremlin crept in


# 1.108 02-Feb-2013 miod

Userland bits for m68k/ELF. Mostly addition of register prefixes to the
assembler instructions, and cope with the few changes in return values
location.


# 1.107 04-Sep-2012 okan

remove lint leftovers; ok guenther@


# 1.106 23-Aug-2012 deraadt

no more nnpfspioctl() system call; ok guenther


# 1.105 22-Aug-2012 pascal

Convert cpp | as rules in bsd.lib.mk and lib/libc/sys/Makefile.inc to pure cc
invocations. This allows us to use the compiler builtin define __PIC__ to check
for PIC/PIEness rather than passing -DPIC. Simplifies PIE work a lot.

ok matthew@, conceptually ok kurt@


# 1.104 21-Aug-2012 pascal

Kill an old mips workaround; we don't support mips, just mips64.

ok deraadt@ kettenis@


Revision tags: OPENBSD_5_2_BASE
# 1.103 19-Jun-2012 deraadt

oops, forgot to install getdtablecount(2); noted by tedu


# 1.102 12-Apr-2012 deraadt

remove rfork(); ok guenther miod


# 1.101 12-Apr-2012 deraadt

kill lfs system call lines and libc stubs


# 1.100 12-Apr-2012 deraadt

New system call: getdtablecount(2) returns the number of file
descriptors the process currently has open.
ok guenther miod gilles ...


# 1.99 22-Mar-2012 guenther

Move __tfork_thread() from rthreads (libpthread) to libc so that
it can be used for not-strictly-threading purposes

ok matthew@ kurt@


# 1.98 13-Mar-2012 guenther

Add manpages for __thrsigdivert, __thrsleep, and __thrwakeup. Various
syntax and grammar fixes from jmc@


Revision tags: OPENBSD_5_1_BASE
# 1.97 17-Jan-2012 guenther

Reimplement mutexes, condvars, and rwlocks to eliminate bugs,
particularly the "consume the signal you just sent" hang, and putting
the wait queues in userspace.

Do cancellation handling in pthread_cond_*wait(), pthread_join(),
and sem_wait().

Add __ prefix to thr{sleep,wakeup,exit,sigdivert}() syscalls; add
'abort" argument to thrsleep to close cancellation race; make
thr{sleep,wakeup} return errno values via *retval to avoid touching
userspace errno.


# 1.96 22-Nov-2011 guenther

sigstack() is long dead, and the compat sigaltstack syscall is gone too.
Correct the namespace protections for sigreturn(), sigwait(), and psignal()

ok millert@


# 1.95 16-Oct-2011 guenther

Add stubs and manpage for __{get,set}_tcb

ok deraadt@


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

Add (rough draft) documentation for fdopendir(3) and the 15 new
XXXat(2) system calls from POSIX 2008. Editing will be done in tree.

General style discussed with jmc@, schwarze@, and deraadt@
ok jmc@


# 1.93 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@


Revision tags: OPENBSD_4_8_BASE OPENBSD_4_9_BASE
# 1.92 03-Jul-2010 guenther

Fix the naming of interfaces and variables for rdomains and rtables
and make it possible to bind sockets (including listening sockets!)
to rtables and not just rdomains. This changes the name of the
system calls, socket option, and ioctl. After building with this
you should remove the files /usr/share/man/cat2/[gs]etrdomain.0.

Since this removes the existing [gs]etrdomain() system calls, the
libc major is bumped.

Written by claudio@, criticized^Wcritiqued by me


# 1.91 01-Jul-2010 deraadt

getpeereid() can now be a library routine using getsockopt() with
SOL_SOCKET and SO_PEERCRED, only issue being that it cannot return
EFAULT for a page fault. The kernel code will soon be put into
compat, and then in 10 years or so tedu will delete it.
ok guenther millert


# 1.90 18-May-2010 tedu

add posix_madvise, posix_memalign, strndup, and strnlen. mostly from
brad and millert, with hints from guenther, jmc, and otto I think.
ok previous.


Revision tags: OPENBSD_4_7_BASE
# 1.89 03-Feb-2010 miod

Use MACHINE_CPU instead of MACHINE_ARCH to pick the correct machine dependent
files or directories when applicable.
The inspiration and name of MACHINE_CPU come from NetBSD, although the way to
provide it to Makefiles is completely different.
ok kettenis@


# 1.88 27-Nov-2009 guenther

Add setrdomain() and getrdomain() system calls. Committing now to
catch the libc major bump per request from deraadt@

Diff by reyk.

ok guenther@


# 1.87 13-Aug-2009 jmc

various MLINK fixes from Alan R. S. Bueno;


Revision tags: OPENBSD_4_6_BASE
# 1.86 03-Jun-2009 jj

Arla client rename from xfs to nnpfs for later upgrades. Tested on various arches. ok todd@ beck@


Revision tags: OPENBSD_4_4_BASE OPENBSD_4_5_BASE
# 1.85 22-Mar-2008 otto

move statvfs.c to gen, since it is not a syscall; ok deraadt@


# 1.84 16-Mar-2008 otto

statvfs support


Revision tags: OPENBSD_4_3_BASE
# 1.83 05-Jan-2008 deraadt

no more need for vadvise.o


# 1.82 09-Sep-2007 otto

Add lint stubs for the longjmp family of functions which are defined in
assembly on all platforms. ok deraadt@


# 1.81 09-Sep-2007 otto

Silence erroneous "environ used, but not defined" lint warning by
providing a stub. ok deraadt@


Revision tags: OPENBSD_4_1_BASE OPENBSD_4_2_BASE
# 1.80 24-Oct-2006 tedu

add rthread syscalls and bump minor.
rthreads are hardly done, but if just trying it out is too much of a hassle,
we'll never make more progress.
ok brad marc marco mbalmer


# 1.79 10-Oct-2006 deraadt

MLINKS to macros described in stat(2)


Revision tags: OPENBSD_4_0_BASE
# 1.78 14-Jun-2006 otto

Introducing adjfreq(2), to adjust the clock frequency.
Loosely based on dragonfly code. Man page help fro jmc@; ok deraadt@


# 1.77 27-May-2006 pedro

Make libc's getcwd() use the new __getcwd() system call
Hacked by marius@ at c2k5, okay miod@ krw@ deraadt@


# 1.76 13-Mar-2006 moritz

Clean the correct file. ok deraadt@


Revision tags: OPENBSD_3_9_BASE
# 1.75 29-Nov-2005 deraadt

Provide stubs for things which are supplied by crt0. I don't think we
want a crt0.ln, at least, not yet. We may reconsider later.


# 1.74 03-Oct-2005 jmc

add missing MLINK for WEXITSTATUS.2


Revision tags: OPENBSD_3_8_BASE
# 1.73 17-Jun-2005 drahn

Extended Attributes was a piece to get to ACLs, however ACLs have not
been worked on, so EA is pointless to maintain.


# 1.72 17-Jun-2005 millert

remove undelete syscall


Revision tags: OPENBSD_3_7_BASE
# 1.71 18-Sep-2004 deraadt

MLINK to macros provided in wait.2


# 1.70 16-Sep-2004 deraadt

add files missing for building a proper lint library


Revision tags: OPENBSD_3_5_BASE OPENBSD_3_6_BASE
# 1.69 13-Feb-2004 tedu

death to osigaltstack. ok deraadt@


# 1.68 15-Jan-2004 deraadt

ABI breakage happened with the sigaltstack replacement. It is too late,
now we just have to cope. Since setjmp uses it, the alpha and sparc64 are
unhappy with the structure change. In a few days, we will make the second
hop here, for now, use the old system call until all binaries have the new
struct in them.


# 1.67 12-Jan-2004 tedu

new syscall closefrom(2). ok deraadt millert


Revision tags: OPENBSD_3_4_BASE
# 1.66 10-May-2003 miod

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


# 1.65 14-Apr-2003 art

There are two related changes.

The first one is an mquery(2) syscall. It's for asking the VM system
about where to map things. It will be used by ld.so, read the man page
for details.

The second change is related and is a centralization of uvm_map hint
that all callers of uvm_map calculated. This will allow us to adjust
this hint on architectures that have segments for non-exec mappings.

deraadt@ drahn@ ok.


Revision tags: OPENBSD_3_3_BASE
# 1.64 31-Jan-2003 millert

Replace emulated versions of setreuid() and setregid() with real syscalls.
These are spec'd by POSIX as of 1003.1-2001; deraadt@ OK


# 1.63 02-Dec-2002 millert

Document getlogin_r()


# 1.62 02-Dec-2002 miod

Import propolice (http://www.trl.ibm.com/projects/security/ssp), a stack
attack protection scheme, into gcc.

This protection is enabled by default. It can be turned off by using the
-fno-stack-protector flag.

Code by Hiroaki Etoh (etoh at jp dot ibm dot com); work on openbsd-specific
integration by fgsch@, deraadt@ and myself; tests by fgsch@, naddy@ and
myself; beer drinking by myself.

Please note that system upgrades with this new code will require a new
libc and ld.so to be build and installed before the propolice-enabled
compiler can be installed.


# 1.61 10-Nov-2002 fgsch

missing MLINKs for setresuid(2). millert ok.


# 1.60 05-Nov-2002 marc

thread safe libc -- 2nd try. OK miod@, millert@
Thanks to miod@ for m68k and vax fixes


# 1.59 03-Nov-2002 marc

back out previous patch.. there are still some vax/m68k issues


# 1.58 03-Nov-2002 marc

libc changes for thread safety. Tested on:
alpha (millert@), i386 (marc@), m68k (millert@ and miod@),
powerpc (drahn@ and dhartmei@), sparc (millert@ and marc@),
sparc64 (marc@), and vax (millert@ and miod@).
Thanks to millert@, miod@, and mickey@ for fixes along the way.


# 1.57 30-Oct-2002 millert

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


Revision tags: OPENBSD_3_2_BASE
# 1.56 05-Aug-2002 art

Fix brain blackout.
Pointed out byb miod@.


# 1.55 05-Aug-2002 art

One more ELF_TOOLCHAIN.


# 1.54 06-Jul-2002 nordin

Remove kernel support for NTP. ok deraadt@ and tholo@


# 1.53 10-Jun-2002 fgsch

correct comment.


# 1.52 08-Jun-2002 drahn

ELF architectures all support weak aliases, enable them for this part.
ok fgsch@


Revision tags: OPENBSD_3_1_BASE
# 1.51 22-Feb-2002 drahn

Extended Attribute support, from FreeBSD/TrustedBSD. ok art@ deraadt@
libc support pieces


# 1.50 21-Feb-2002 art

remove rfork.o from the auto-generated assembler stubs


# 1.49 17-Feb-2002 deraadt

rfork() needs a fork.S-like stub as well; ok art


Revision tags: OPENBSD_3_0_BASE
# 1.48 25-Sep-2001 niklas

Forgotten DEBUGLIBS stuff


# 1.47 25-Sep-2001 drahn

Add an ASPICFLAG variable to bsd.own.mk which a platform use to pass flags
to 'as' to make it compile pic. add defaults for sparc64 which needs picflags
set to -fPIC and ASPICFLAGS to -KPIC.
Also simplifies the systemcall generation for sparc64 PIC mode.
ok epsie@.


# 1.46 20-Sep-2001 millert

Add PSEUDO_NOERROR similar to that used by NetBSD.
Some ports were setting errno in PSEUDO and some were not. Now errno
is set for all in PSEUDO and PSEUDO_NOERROR is provided for the
non-errno case (only used by _exit).

Needs testing on vax and m88k.
XXX - hppa and powerpc still lack a real PSEUDO_NOERROR implementation.
Currently PSEUDO_NOERROR and PSEUDO are the same (so builds don't
break on those platforms).


# 1.45 09-Jul-2001 fgsch

Install getpeereid(2) manpage.


# 1.44 26-Jun-2001 dugsong

implement djb's getpeereid(2), to allow local-domain servers to determine client credentials. mostly from superscript.com. deraadt@ ok


Revision tags: OPENBSD_2_9_BASE
# 1.43 14-Mar-2001 aaron

Move description of exect() to execve(2) man page. Add a note about exect() not
being portable.


# 1.42 09-Mar-2001 art

Add mlockall and munlockall. man-page from NetBSD.


# 1.41 10-Jan-2001 deraadt

put up FD_* manual pages, in section 3


# 1.40 23-Dec-2000 deraadt

create proper docs for timer{add,clear,sub,isset,cmp}


# 1.39 16-Nov-2000 provos

kqueue and kevent system calls


Revision tags: OPENBSD_2_8_BASE
# 1.38 17-Oct-2000 deraadt

damn it, i have had it with this untested weak shit


# 1.37 16-Oct-2000 deraadt

re-add weak sparc support; d@


# 1.36 15-May-2000 niklas

Add support for building libraries with debugging information in them.
Enable by setting DEBUGLIBS=yes in /etc/mk.conf, then -g libraries will get
installed in /usr/lib/debug. This directory will be searched first if
gcc is given the -g flag during the link stage.


Revision tags: OPENBSD_2_7_BASE
# 1.35 01-May-2000 deraadt

bye bye semconfig(2)


# 1.34 20-Apr-2000 deraadt

p{read,write}{,v} man pages


# 1.33 07-Feb-2000 assar

add fhopen, fhstat, fhstatfs system calls. largely from NetBSD


# 1.32 06-Jan-2000 d

for now, disable weak aliases for all archs except i386


# 1.31 14-Dec-1999 millert

Install swapctl.2, not swapon.2. swapon.2 should probably go away.


Revision tags: OPENBSD_2_6_BASE
# 1.30 07-Jun-1999 deraadt

replacement pipe() system call; copies data into place inside kernel, so
that EFAULT return value is possible


# 1.29 22-May-1999 weingart

Add swapctl(2), and crank shlib minor.


Revision tags: OPENBSD_2_5_BASE
# 1.28 01-Feb-1999 d

mi ptrace


# 1.27 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


Revision tags: OPENBSD_2_4_BASE
# 1.26 18-Sep-1998 art

make use of xfspioctl


Revision tags: OPENBSD_2_3_BASE
# 1.25 08-Feb-1998 tholo

Better lint(1) framework. Mostly from cgd@NetBSD


# 1.24 13-Nov-1997 deraadt

add getsid(2), XPG4


Revision tags: OPENBSD_2_2_BASE
# 1.23 30-May-1997 kstailey

add getpgrp(2) from NetBSD


Revision tags: OPENBSD_2_1_BASE
# 1.22 08-May-1997 kstailey

add tag


# 1.21 08-May-1997 kstailey

make clock_gettime.cat2


# 1.20 20-Apr-1997 tholo

New POSIX 1003.1b syscalls; from pk@NetBSD


# 1.19 04-Apr-1997 deraadt

seek(2) is not needed


# 1.18 29-Mar-1997 deraadt

futimes link; nakayosh@kcn.or.jp


# 1.17 26-Mar-1997 deraadt

install ktrace(2)


# 1.16 26-Jan-1997 downsj

Add a link for lchown.2


# 1.15 26-Jan-1997 downsj

Add lchown(), increment minor number.


# 1.14 11-Dec-1996 deraadt

generate reboot.o like other system calls


Revision tags: OPENBSD_2_0_BASE
# 1.13 02-Sep-1996 deraadt

shmdt link


# 1.12 25-Aug-1996 deraadt

and a man page


# 1.11 18-Jun-1996 deraadt

build poll.o


# 1.10 19-May-1996 pefo

Changes for mips.


# 1.9 18-May-1996 deraadt

poll() as a system call


# 1.8 08-May-1996 deraadt

install rfork man page


# 1.7 01-May-1996 deraadt

add futimes


# 1.6 25-Mar-1996 tholo

Add support for building lint(1) library


# 1.5 29-Jan-1996 tholo

Add kernel PLL for system clock
Add ntp_adjtime() and ntp_gettime() system calls
Mostly stolen from FreeBSD


# 1.4 08-Jan-1996 deraadt

add rfork.o and minherit.o


# 1.3 07-Jan-1996 deraadt

add minherit() system call


# 1.2 14-Dec-1995 deraadt

from netbsd:
add & fix a bunch of system call pages


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.164 09-Sep-2022 mbuhl

Add libc wrappers for the new sendmmsg and recvmmsg system calls.
Feedback tb@, miod@, jca@
OK jca@


# 1.163 17-Jul-2022 deraadt

Add ypconnect(2) stub inside libc so that libc functions can use it,
but do not export it.


# 1.162 17-Jul-2022 deraadt

add ypconnect(2) manual page


Revision tags: OPENBSD_7_1_BASE
# 1.161 23-Dec-2021 guenther

Roll the syscalls that have an off_t argument to remove the explicit padding.
Switch libc and ld.so to the generic stubs for these calls.
WARNING: reboot to updated kernel before installing libc or ld.so!

Time for a story...

When gcc (back in 1.x days) first implemented long long, it didn't (always)
pass 64bit arguments in 'aligned' registers/stack slots, with the result that
argument offsets didn't match structure offsets. This affected the nine system
calls that pass off_t arguments:
ftruncate lseek mmap mquery pread preadv pwrite pwritev truncate

To avoid having to do custom ASM wrappers for those, BSD put an explicit pad
argument in so that the off_t argument would always start on a even slot and
thus be naturally aligned. Thus those odd wrappers in lib/libc/sys/ that use
__syscall() and pass an extra '0' argument.

The ABIs for different CPUs eventually settled how things should be passed on
each and gcc 2.x followed them. The only arch now where it helps is landisk,
which needs to skip the last argument register if it would be the first half of
a 64bit argument. So: add new syscalls without the pad argument and on landisk
do that skipping directly in the syscall handler in the kernel. Keep compat
support for the existing syscalls long enough for the transition.

ok deraadt@


Revision tags: OPENBSD_7_0_BASE
# 1.160 11-Jun-2021 kettenis

Since futex(2) can fail, it needs a full syscall stub. This should fixes
issues on powerpc64 and sparc64.

Note that this makes the lib/libpthread/errno test fail since that test
detects that we are touching errno now. This will be addressed in a
future diff as it is not entirely clear whether the test is correct.

ok mpi@, bluhm@


Revision tags: OPENBSD_6_8_BASE OPENBSD_6_9_BASE
# 1.159 06-Jul-2020 pirofti

Add support for timeconting in userland.

This diff exposes parts of clock_gettime(2) and gettimeofday(2) to
userland via libc eliberating processes from the need for a context
switch everytime they want to count the passage of time.

If a timecounter clock can be exposed to userland than it needs to set
its tc_user member to a non-zero value. Tested with one or multiple
counters per architecture.

The timing data is shared through a pointer found in the new ELF
auxiliary vector AUX_openbsd_timekeep containing timehands information
that is frequently updated by the kernel.

Timing differences between the last kernel update and the current time
are adjusted in userland by the tc_get_timecount() function inside the
MD usertc.c file.

This permits a much more responsive environment, quite visible in
browsers, office programs and gaming (apparently one is are able to fly
in Minecraft now).

Tested by robert@, sthen@, naddy@, kmos@, phessler@, and many others!

OK from at least kettenis@, cheloha@, naddy@, sthen@


Revision tags: OPENBSD_6_7_BASE
# 1.158 27-Nov-2019 deraadt

Document msyscall(2): ld.so can use this (once only) to tell the kernel
where libc.so's text segment is, thereby allowing invocation of system
calls from that region. An upcoming change will kill the process if a
system call is invoked from addresses not explicitly permitted.
ok guenther kettenis mortimer


Revision tags: OPENBSD_6_6_BASE
# 1.157 28-May-2019 beck

Enable the use of the kernel __realpath() system call in the libc wrapper.

For now, this also still uses the existing realpath implmentation
and emits a syslog if we see differening results. Once we have run
with that for a little while we will remove the old code

ok deraadt@


Revision tags: OPENBSD_6_5_BASE
# 1.156 11-Jan-2019 deraadt

mincore() is a relic from the past, exposing physical machine information
about shared resources which no program should see. only a few pieces of
software use it, generally poorly thought out. they are being fixed, so
mincore() can be deleted.
ok guenther tedu jca sthen, others


Revision tags: OPENBSD_6_4_BASE
# 1.155 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.154 12-Jan-2018 deraadt

sysctl(3) can now be renamed to sysctl(2)


# 1.153 28-Nov-2017 guenther

Delete fktrace(2). The consequences of it were not thought through
sufficiently and at least one horrific security hole was the result.

ok deraadt@ beck@


Revision tags: OPENBSD_6_2_BASE
# 1.152 13-Aug-2017 tedu

add fktrace to libc


# 1.151 12-Aug-2017 guenther

Instead of hardcoding a partial dependency list for the syscall stub objects,
calculate them as done for other objects


# 1.150 31-May-2017 sthen

install futex(2), ok mpi


# 1.149 30-Apr-2017 mpi

Add futex(2) shim, bump minor.

Inputs from guenther@, ok kettenis@, visa@


Revision tags: OPENBSD_6_1_BASE
# 1.148 29-Mar-2017 deraadt

The hppa version of as(1) requires whitespace before a .file directive,
it may not be in column 0. This kind of thing is very common in GNU
and Linux software because the software was written from the start to
be 'compatible replacements' of vendor software.
ok jsing guenther


# 1.147 26-Mar-2017 guenther

Use .file to convince 'as' to generate proper FILE symbols in the syscall
stubs that aren't actually in files, so that syspatch can figure out what
order the syscall stub objects are in the .so. Use -P to suppress to #line
directives that would override that. Tested with both gcc/gas and clang.

ok deraadt@


Revision tags: OPENBSD_6_0_BASE
# 1.146 04-Jul-2016 guenther

DEBUGLIBS has been broken since the gcc4 switch, so delete it. CFLAGS
contains -g by default anyway

problem noted by Edgar Pettijohn (edgar (at) pettijohn-web.com)
ok millert@ kettenis@ deraadt@


# 1.145 30-May-2016 guenther

Move __getcwd from ASM to HIDDEN: we don't want the literal __getcwd symbol

ok millert@ deraadt@


# 1.144 19-May-2016 guenther

Add ASM_NOERR for syscalls that never fail and thus don't need the errno
setting logic...which can significantly reduce the size of the stub on
some archs; 20 syscalls get a trim with this.

in snaps for a bit and ok deraadt@


# 1.143 09-May-2016 guenther

Remove sigreturn declaration and the now-unused libc syscall stub


# 1.142 07-May-2016 guenther

Use a Thread Information Block in both single and multi-threaded programs.
This stores errno, the cancelation flags, and related bits for each thread
and is allocated by ld.so or libc.a. This is an ABI break from 5.9-stable!

Make libpthread dlopen'able by moving the cancelation wrappers into libc
and doing locking and fork/errno handling via callbacks that libpthread
registers when it first initializes. 'errno' *must* be declared via
<errno.h> now!

Clean up libpthread's symbol exports like libc.

On powerpc, offset the TIB/TCB/TLS data from the register per the ELF spec.

Testing by various, particularly sthen@ and patrick@
ok kettenis@


# 1.141 30-Mar-2016 guenther

Turd polish: use HIDDEN= instead of PSEUDO= for ptrace syscall stub, to
make its underlying symbol name look like others.


# 1.140 30-Mar-2016 guenther

Eliminate userspace caching by getlogin_r/setlogin; make the getlogin
syscall behave exactly like userspace getlogin_r() and rename it to
match. Eliminate the reduced-to-no-op wrappers of the syscalls.
Eliminate the unnecessary per-thread static buffering by getlogin().

ok kettenis@ deraadt@


# 1.139 30-Mar-2016 jmc

for some time now mandoc has not required MLINKS to function
correctly - logically complete that now by removing MLINKS from base;

authors need only to ensure there is an entry in NAME for any function/
util being added. MLINKS will still work, and remain for perl to ease
upgrades;

ok nicm (curses) bcook (ssl)
ok schwarze, who provided a lot of feedback and assistance
ok tb natano jung


# 1.138 21-Mar-2016 bluhm

Rename the system call sendsyslog2 to sendsyslog. Keep the old one
as osendsyslog for a while. The three argument variant is the only
one that will stay.
input kettenis@; OK deraadt@


Revision tags: OPENBSD_5_9_BASE
# 1.137 25-Nov-2015 deraadt

Add a syscall stub for sendsyslog2(2), and use it in syslog_r(3), passing
LOG_CONS to the kernel. As a result, the /dev/console opening code can
be removed.
ok kettenis millert beck


# 1.136 10-Nov-2015 guenther

Split the intra-thread functionality from kill(2) into its own syscall
thrkill(2), rolling the kill(2) syscall number with the ABI change to
avoid breaking binaries during during the transition. thrkill(2) includes
a 'tcb' argument that eliminates the need for locking in pthread_kill()
and simplifies pthread_cancel(). Switch __stack_smash_handler() to use
thrkill(2) and explicitly unblock SIGABRT.

Minor bump to both libc and libpthread: make sure you install a new kernel!

ok semarie@


# 1.135 23-Oct-2015 guenther

Merge the sigaction() and sigprocmask() overloads/wrappers from libpthread
into libc, and move pthread_sigmask() as well (just a trivial wrapper).
This provides consistent handling of SIGTHR between single- and multi-threaded
programs and is a step in the merge of all the libpthread overloads, providing
some ASM and Makefile bits that the other wrappers will need.

ok deraadt@ millert@


# 1.134 23-Oct-2015 deraadt

Remove dnssocket() and dnsconnect(), since we decided to use a SOCK_DNS
flag instead.
ok guenther tedu semarie


# 1.133 19-Oct-2015 deraadt

Remove old tame() stub


# 1.132 18-Oct-2015 deraadt

create libc stubs for dnssocket() and dnsconnect()


# 1.131 09-Oct-2015 deraadt

tame -> pledge conversion, in libc. I should crank libc, but am cheating
hoping things go well. The old symbol is faked via a stupid stub function,
until next major crank when it can be removed. I am expecting guenther
to scream at me.


# 1.130 13-Sep-2015 guenther

Rename __sysctl syscall to just sysctl, as the userland wrapper is no longer
necessary

ok deraadt@ jsing@


# 1.129 09-Sep-2015 guenther

Simplify makefile rules for building the ASM stubs into "pick something
from column A and something from column B".

ok miod@ deraadt@


# 1.128 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@


# 1.127 25-Aug-2015 guenther

Document kbind(2)


Revision tags: OPENBSD_5_8_BASE
# 1.126 19-Jul-2015 deraadt

manual page for tame(2). not very good, so i will be hearing from jmc


# 1.125 07-Apr-2015 guenther

Make pthread_atfork() track the DSO that called it like atexit() does,
unregistering callbacks if the DSO is unloaded. Move the callback
handling from libpthread to libc, though libpthread still overrides the
inner call to handle locking and thread-library reinitialization.
Major version bump for both libc and libpthread.

verification that this fixes various ports ajacoutot@
asm assistance miod@; ok millert@ deraadt@


Revision tags: OPENBSD_5_7_BASE
# 1.124 08-Dec-2014 guenther

Add chflagsat(), modeled on fchmodat() with name to match FreeBSD.


# 1.123 14-Nov-2014 guenther

Add sched_yield(2) manpage


# 1.122 31-Aug-2014 guenther

Declare and document getthrid()

indirectly prodded by krw@


# 1.121 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@


# 1.120 14-Aug-2014 tobias

fixed overrid(d)en typo

millert@ and jmc@ agree that "overriden" is wrong


Revision tags: OPENBSD_5_6_BASE
# 1.119 12-Jul-2014 deraadt

document sendsyslog(2); ok guenther tedu matthew


# 1.118 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.117 18-Mar-2014 miod

Retire hp300, mvme68k and mvme88k ports. These ports have no users, keeping
this hardware alive is becoming increasingly difficult, and I should heed the
message sent by the three disks which have died on me over the last few days.

Noone sane will mourn these ports anyway. So long, and thanks for the fish.


Revision tags: OPENBSD_5_5_BASE
# 1.116 13-Oct-2013 guenther

Make it possible to build to reduced version of a library, including
just specific objects that are compiled with additional options to
reduce their size. For use by distrib/ and crunchgen.

style and naming assistance from espie@


# 1.115 07-Oct-2013 guenther

getdirentries(2) is dead; long live getdents(2)!

confirmation that getdirentries(2) is unused by ports from sthen@ and naddy@


# 1.114 13-Aug-2013 guenther

Switch time_t, ino_t, clock_t, and struct kevent's ident and data
members to 64bit types. Assign new syscall numbers for (almost
all) the syscalls that involve the affected types, including anything
with time_t, timeval, itimerval, timespec, rusage, dirent, stat,
or kevent arguments. Add a d_off member to struct dirent and replace
getdirentries() with getdents(), thus immensely simplifying and
accelerating telldir/seekdir. Build perl with -DBIG_TIME.

Bump the major on every single base library: the compat bits included
here are only good enough to make the transition; the T32 compat
option will be burned as soon as we've reached the new world are
are happy with the snapshots for all architectures.

DANGER: ABI incompatibility. Updating to this kernel requires extra
work or you won't be able to login: install a snapshot instead.

Much assistance in fixing userland issues from deraadt@ and tedu@
and build assistance from todd@ and otto@


Revision tags: OPENBSD_5_4_BASE
# 1.113 05-Jun-2013 guenther

Move _Exit() from the exit() manpage to the _exit() manpage, as it's
just an alias of the latter.

ok matthew@ tedu@


# 1.112 01-Jun-2013 miod

Add utrace(2), a system call allowing for userland to send its own ktrace
records. From FreeBSD via otto@, with tweaks suggested by guenther@.
Commite on behalf of otto@ who is not around, to ride the libc minor bump.
Causes a librthread minor bump as well (new syscall).


# 1.111 29-Apr-2013 matthew

Extend P_SIGSUSPEND handling in userret() to properly restore the
sigmask even if there are no pending signals under the temporary
sigmask.

Refactor existing select() and poll() system calls to introduce the
pselect() and ppoll() system calls.

Add rthread wrappers for pselect() and ppoll(). While there, update
cancellation point comments to reflect recent fdatasync() addition.

Minor bumps for libc and librthread due to new symbols.

ok guenther, millert, deraadt, jmc


# 1.110 15-Apr-2013 matthew

Implement fdatasync() as a wrapper around fsync()

ok guenther, deraadt, jmc


Revision tags: OPENBSD_5_3_BASE
# 1.109 03-Feb-2013 miod

gremlin crept in


# 1.108 02-Feb-2013 miod

Userland bits for m68k/ELF. Mostly addition of register prefixes to the
assembler instructions, and cope with the few changes in return values
location.


# 1.107 04-Sep-2012 okan

remove lint leftovers; ok guenther@


# 1.106 23-Aug-2012 deraadt

no more nnpfspioctl() system call; ok guenther


# 1.105 22-Aug-2012 pascal

Convert cpp | as rules in bsd.lib.mk and lib/libc/sys/Makefile.inc to pure cc
invocations. This allows us to use the compiler builtin define __PIC__ to check
for PIC/PIEness rather than passing -DPIC. Simplifies PIE work a lot.

ok matthew@, conceptually ok kurt@


# 1.104 21-Aug-2012 pascal

Kill an old mips workaround; we don't support mips, just mips64.

ok deraadt@ kettenis@


Revision tags: OPENBSD_5_2_BASE
# 1.103 19-Jun-2012 deraadt

oops, forgot to install getdtablecount(2); noted by tedu


# 1.102 12-Apr-2012 deraadt

remove rfork(); ok guenther miod


# 1.101 12-Apr-2012 deraadt

kill lfs system call lines and libc stubs


# 1.100 12-Apr-2012 deraadt

New system call: getdtablecount(2) returns the number of file
descriptors the process currently has open.
ok guenther miod gilles ...


# 1.99 22-Mar-2012 guenther

Move __tfork_thread() from rthreads (libpthread) to libc so that
it can be used for not-strictly-threading purposes

ok matthew@ kurt@


# 1.98 13-Mar-2012 guenther

Add manpages for __thrsigdivert, __thrsleep, and __thrwakeup. Various
syntax and grammar fixes from jmc@


Revision tags: OPENBSD_5_1_BASE
# 1.97 17-Jan-2012 guenther

Reimplement mutexes, condvars, and rwlocks to eliminate bugs,
particularly the "consume the signal you just sent" hang, and putting
the wait queues in userspace.

Do cancellation handling in pthread_cond_*wait(), pthread_join(),
and sem_wait().

Add __ prefix to thr{sleep,wakeup,exit,sigdivert}() syscalls; add
'abort" argument to thrsleep to close cancellation race; make
thr{sleep,wakeup} return errno values via *retval to avoid touching
userspace errno.


# 1.96 22-Nov-2011 guenther

sigstack() is long dead, and the compat sigaltstack syscall is gone too.
Correct the namespace protections for sigreturn(), sigwait(), and psignal()

ok millert@


# 1.95 16-Oct-2011 guenther

Add stubs and manpage for __{get,set}_tcb

ok deraadt@


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

Add (rough draft) documentation for fdopendir(3) and the 15 new
XXXat(2) system calls from POSIX 2008. Editing will be done in tree.

General style discussed with jmc@, schwarze@, and deraadt@
ok jmc@


# 1.93 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@


Revision tags: OPENBSD_4_8_BASE OPENBSD_4_9_BASE
# 1.92 03-Jul-2010 guenther

Fix the naming of interfaces and variables for rdomains and rtables
and make it possible to bind sockets (including listening sockets!)
to rtables and not just rdomains. This changes the name of the
system calls, socket option, and ioctl. After building with this
you should remove the files /usr/share/man/cat2/[gs]etrdomain.0.

Since this removes the existing [gs]etrdomain() system calls, the
libc major is bumped.

Written by claudio@, criticized^Wcritiqued by me


# 1.91 01-Jul-2010 deraadt

getpeereid() can now be a library routine using getsockopt() with
SOL_SOCKET and SO_PEERCRED, only issue being that it cannot return
EFAULT for a page fault. The kernel code will soon be put into
compat, and then in 10 years or so tedu will delete it.
ok guenther millert


# 1.90 18-May-2010 tedu

add posix_madvise, posix_memalign, strndup, and strnlen. mostly from
brad and millert, with hints from guenther, jmc, and otto I think.
ok previous.


Revision tags: OPENBSD_4_7_BASE
# 1.89 03-Feb-2010 miod

Use MACHINE_CPU instead of MACHINE_ARCH to pick the correct machine dependent
files or directories when applicable.
The inspiration and name of MACHINE_CPU come from NetBSD, although the way to
provide it to Makefiles is completely different.
ok kettenis@


# 1.88 27-Nov-2009 guenther

Add setrdomain() and getrdomain() system calls. Committing now to
catch the libc major bump per request from deraadt@

Diff by reyk.

ok guenther@


# 1.87 13-Aug-2009 jmc

various MLINK fixes from Alan R. S. Bueno;


Revision tags: OPENBSD_4_6_BASE
# 1.86 03-Jun-2009 jj

Arla client rename from xfs to nnpfs for later upgrades. Tested on various arches. ok todd@ beck@


Revision tags: OPENBSD_4_4_BASE OPENBSD_4_5_BASE
# 1.85 22-Mar-2008 otto

move statvfs.c to gen, since it is not a syscall; ok deraadt@


# 1.84 16-Mar-2008 otto

statvfs support


Revision tags: OPENBSD_4_3_BASE
# 1.83 05-Jan-2008 deraadt

no more need for vadvise.o


# 1.82 09-Sep-2007 otto

Add lint stubs for the longjmp family of functions which are defined in
assembly on all platforms. ok deraadt@


# 1.81 09-Sep-2007 otto

Silence erroneous "environ used, but not defined" lint warning by
providing a stub. ok deraadt@


Revision tags: OPENBSD_4_1_BASE OPENBSD_4_2_BASE
# 1.80 24-Oct-2006 tedu

add rthread syscalls and bump minor.
rthreads are hardly done, but if just trying it out is too much of a hassle,
we'll never make more progress.
ok brad marc marco mbalmer


# 1.79 10-Oct-2006 deraadt

MLINKS to macros described in stat(2)


Revision tags: OPENBSD_4_0_BASE
# 1.78 14-Jun-2006 otto

Introducing adjfreq(2), to adjust the clock frequency.
Loosely based on dragonfly code. Man page help fro jmc@; ok deraadt@


# 1.77 27-May-2006 pedro

Make libc's getcwd() use the new __getcwd() system call
Hacked by marius@ at c2k5, okay miod@ krw@ deraadt@


# 1.76 13-Mar-2006 moritz

Clean the correct file. ok deraadt@


Revision tags: OPENBSD_3_9_BASE
# 1.75 29-Nov-2005 deraadt

Provide stubs for things which are supplied by crt0. I don't think we
want a crt0.ln, at least, not yet. We may reconsider later.


# 1.74 03-Oct-2005 jmc

add missing MLINK for WEXITSTATUS.2


Revision tags: OPENBSD_3_8_BASE
# 1.73 17-Jun-2005 drahn

Extended Attributes was a piece to get to ACLs, however ACLs have not
been worked on, so EA is pointless to maintain.


# 1.72 17-Jun-2005 millert

remove undelete syscall


Revision tags: OPENBSD_3_7_BASE
# 1.71 18-Sep-2004 deraadt

MLINK to macros provided in wait.2


# 1.70 16-Sep-2004 deraadt

add files missing for building a proper lint library


Revision tags: OPENBSD_3_5_BASE OPENBSD_3_6_BASE
# 1.69 13-Feb-2004 tedu

death to osigaltstack. ok deraadt@


# 1.68 15-Jan-2004 deraadt

ABI breakage happened with the sigaltstack replacement. It is too late,
now we just have to cope. Since setjmp uses it, the alpha and sparc64 are
unhappy with the structure change. In a few days, we will make the second
hop here, for now, use the old system call until all binaries have the new
struct in them.


# 1.67 12-Jan-2004 tedu

new syscall closefrom(2). ok deraadt millert


Revision tags: OPENBSD_3_4_BASE
# 1.66 10-May-2003 miod

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


# 1.65 14-Apr-2003 art

There are two related changes.

The first one is an mquery(2) syscall. It's for asking the VM system
about where to map things. It will be used by ld.so, read the man page
for details.

The second change is related and is a centralization of uvm_map hint
that all callers of uvm_map calculated. This will allow us to adjust
this hint on architectures that have segments for non-exec mappings.

deraadt@ drahn@ ok.


Revision tags: OPENBSD_3_3_BASE
# 1.64 31-Jan-2003 millert

Replace emulated versions of setreuid() and setregid() with real syscalls.
These are spec'd by POSIX as of 1003.1-2001; deraadt@ OK


# 1.63 02-Dec-2002 millert

Document getlogin_r()


# 1.62 02-Dec-2002 miod

Import propolice (http://www.trl.ibm.com/projects/security/ssp), a stack
attack protection scheme, into gcc.

This protection is enabled by default. It can be turned off by using the
-fno-stack-protector flag.

Code by Hiroaki Etoh (etoh at jp dot ibm dot com); work on openbsd-specific
integration by fgsch@, deraadt@ and myself; tests by fgsch@, naddy@ and
myself; beer drinking by myself.

Please note that system upgrades with this new code will require a new
libc and ld.so to be build and installed before the propolice-enabled
compiler can be installed.


# 1.61 10-Nov-2002 fgsch

missing MLINKs for setresuid(2). millert ok.


# 1.60 05-Nov-2002 marc

thread safe libc -- 2nd try. OK miod@, millert@
Thanks to miod@ for m68k and vax fixes


# 1.59 03-Nov-2002 marc

back out previous patch.. there are still some vax/m68k issues


# 1.58 03-Nov-2002 marc

libc changes for thread safety. Tested on:
alpha (millert@), i386 (marc@), m68k (millert@ and miod@),
powerpc (drahn@ and dhartmei@), sparc (millert@ and marc@),
sparc64 (marc@), and vax (millert@ and miod@).
Thanks to millert@, miod@, and mickey@ for fixes along the way.


# 1.57 30-Oct-2002 millert

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


Revision tags: OPENBSD_3_2_BASE
# 1.56 05-Aug-2002 art

Fix brain blackout.
Pointed out byb miod@.


# 1.55 05-Aug-2002 art

One more ELF_TOOLCHAIN.


# 1.54 06-Jul-2002 nordin

Remove kernel support for NTP. ok deraadt@ and tholo@


# 1.53 10-Jun-2002 fgsch

correct comment.


# 1.52 08-Jun-2002 drahn

ELF architectures all support weak aliases, enable them for this part.
ok fgsch@


Revision tags: OPENBSD_3_1_BASE
# 1.51 22-Feb-2002 drahn

Extended Attribute support, from FreeBSD/TrustedBSD. ok art@ deraadt@
libc support pieces


# 1.50 21-Feb-2002 art

remove rfork.o from the auto-generated assembler stubs


# 1.49 17-Feb-2002 deraadt

rfork() needs a fork.S-like stub as well; ok art


Revision tags: OPENBSD_3_0_BASE
# 1.48 25-Sep-2001 niklas

Forgotten DEBUGLIBS stuff


# 1.47 25-Sep-2001 drahn

Add an ASPICFLAG variable to bsd.own.mk which a platform use to pass flags
to 'as' to make it compile pic. add defaults for sparc64 which needs picflags
set to -fPIC and ASPICFLAGS to -KPIC.
Also simplifies the systemcall generation for sparc64 PIC mode.
ok epsie@.


# 1.46 20-Sep-2001 millert

Add PSEUDO_NOERROR similar to that used by NetBSD.
Some ports were setting errno in PSEUDO and some were not. Now errno
is set for all in PSEUDO and PSEUDO_NOERROR is provided for the
non-errno case (only used by _exit).

Needs testing on vax and m88k.
XXX - hppa and powerpc still lack a real PSEUDO_NOERROR implementation.
Currently PSEUDO_NOERROR and PSEUDO are the same (so builds don't
break on those platforms).


# 1.45 09-Jul-2001 fgsch

Install getpeereid(2) manpage.


# 1.44 26-Jun-2001 dugsong

implement djb's getpeereid(2), to allow local-domain servers to determine client credentials. mostly from superscript.com. deraadt@ ok


Revision tags: OPENBSD_2_9_BASE
# 1.43 14-Mar-2001 aaron

Move description of exect() to execve(2) man page. Add a note about exect() not
being portable.


# 1.42 09-Mar-2001 art

Add mlockall and munlockall. man-page from NetBSD.


# 1.41 10-Jan-2001 deraadt

put up FD_* manual pages, in section 3


# 1.40 23-Dec-2000 deraadt

create proper docs for timer{add,clear,sub,isset,cmp}


# 1.39 16-Nov-2000 provos

kqueue and kevent system calls


Revision tags: OPENBSD_2_8_BASE
# 1.38 17-Oct-2000 deraadt

damn it, i have had it with this untested weak shit


# 1.37 16-Oct-2000 deraadt

re-add weak sparc support; d@


# 1.36 15-May-2000 niklas

Add support for building libraries with debugging information in them.
Enable by setting DEBUGLIBS=yes in /etc/mk.conf, then -g libraries will get
installed in /usr/lib/debug. This directory will be searched first if
gcc is given the -g flag during the link stage.


Revision tags: OPENBSD_2_7_BASE
# 1.35 01-May-2000 deraadt

bye bye semconfig(2)


# 1.34 20-Apr-2000 deraadt

p{read,write}{,v} man pages


# 1.33 07-Feb-2000 assar

add fhopen, fhstat, fhstatfs system calls. largely from NetBSD


# 1.32 06-Jan-2000 d

for now, disable weak aliases for all archs except i386


# 1.31 14-Dec-1999 millert

Install swapctl.2, not swapon.2. swapon.2 should probably go away.


Revision tags: OPENBSD_2_6_BASE
# 1.30 07-Jun-1999 deraadt

replacement pipe() system call; copies data into place inside kernel, so
that EFAULT return value is possible


# 1.29 22-May-1999 weingart

Add swapctl(2), and crank shlib minor.


Revision tags: OPENBSD_2_5_BASE
# 1.28 01-Feb-1999 d

mi ptrace


# 1.27 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


Revision tags: OPENBSD_2_4_BASE
# 1.26 18-Sep-1998 art

make use of xfspioctl


Revision tags: OPENBSD_2_3_BASE
# 1.25 08-Feb-1998 tholo

Better lint(1) framework. Mostly from cgd@NetBSD


# 1.24 13-Nov-1997 deraadt

add getsid(2), XPG4


Revision tags: OPENBSD_2_2_BASE
# 1.23 30-May-1997 kstailey

add getpgrp(2) from NetBSD


Revision tags: OPENBSD_2_1_BASE
# 1.22 08-May-1997 kstailey

add tag


# 1.21 08-May-1997 kstailey

make clock_gettime.cat2


# 1.20 20-Apr-1997 tholo

New POSIX 1003.1b syscalls; from pk@NetBSD


# 1.19 04-Apr-1997 deraadt

seek(2) is not needed


# 1.18 29-Mar-1997 deraadt

futimes link; nakayosh@kcn.or.jp


# 1.17 26-Mar-1997 deraadt

install ktrace(2)


# 1.16 26-Jan-1997 downsj

Add a link for lchown.2


# 1.15 26-Jan-1997 downsj

Add lchown(), increment minor number.


# 1.14 11-Dec-1996 deraadt

generate reboot.o like other system calls


Revision tags: OPENBSD_2_0_BASE
# 1.13 02-Sep-1996 deraadt

shmdt link


# 1.12 25-Aug-1996 deraadt

and a man page


# 1.11 18-Jun-1996 deraadt

build poll.o


# 1.10 19-May-1996 pefo

Changes for mips.


# 1.9 18-May-1996 deraadt

poll() as a system call


# 1.8 08-May-1996 deraadt

install rfork man page


# 1.7 01-May-1996 deraadt

add futimes


# 1.6 25-Mar-1996 tholo

Add support for building lint(1) library


# 1.5 29-Jan-1996 tholo

Add kernel PLL for system clock
Add ntp_adjtime() and ntp_gettime() system calls
Mostly stolen from FreeBSD


# 1.4 08-Jan-1996 deraadt

add rfork.o and minherit.o


# 1.3 07-Jan-1996 deraadt

add minherit() system call


# 1.2 14-Dec-1995 deraadt

from netbsd:
add & fix a bunch of system call pages


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.163 17-Jul-2022 deraadt

Add ypconnect(2) stub inside libc so that libc functions can use it,
but do not export it.


# 1.162 17-Jul-2022 deraadt

add ypconnect(2) manual page


Revision tags: OPENBSD_7_1_BASE
# 1.161 23-Dec-2021 guenther

Roll the syscalls that have an off_t argument to remove the explicit padding.
Switch libc and ld.so to the generic stubs for these calls.
WARNING: reboot to updated kernel before installing libc or ld.so!

Time for a story...

When gcc (back in 1.x days) first implemented long long, it didn't (always)
pass 64bit arguments in 'aligned' registers/stack slots, with the result that
argument offsets didn't match structure offsets. This affected the nine system
calls that pass off_t arguments:
ftruncate lseek mmap mquery pread preadv pwrite pwritev truncate

To avoid having to do custom ASM wrappers for those, BSD put an explicit pad
argument in so that the off_t argument would always start on a even slot and
thus be naturally aligned. Thus those odd wrappers in lib/libc/sys/ that use
__syscall() and pass an extra '0' argument.

The ABIs for different CPUs eventually settled how things should be passed on
each and gcc 2.x followed them. The only arch now where it helps is landisk,
which needs to skip the last argument register if it would be the first half of
a 64bit argument. So: add new syscalls without the pad argument and on landisk
do that skipping directly in the syscall handler in the kernel. Keep compat
support for the existing syscalls long enough for the transition.

ok deraadt@


Revision tags: OPENBSD_7_0_BASE
# 1.160 11-Jun-2021 kettenis

Since futex(2) can fail, it needs a full syscall stub. This should fixes
issues on powerpc64 and sparc64.

Note that this makes the lib/libpthread/errno test fail since that test
detects that we are touching errno now. This will be addressed in a
future diff as it is not entirely clear whether the test is correct.

ok mpi@, bluhm@


Revision tags: OPENBSD_6_8_BASE OPENBSD_6_9_BASE
# 1.159 06-Jul-2020 pirofti

Add support for timeconting in userland.

This diff exposes parts of clock_gettime(2) and gettimeofday(2) to
userland via libc eliberating processes from the need for a context
switch everytime they want to count the passage of time.

If a timecounter clock can be exposed to userland than it needs to set
its tc_user member to a non-zero value. Tested with one or multiple
counters per architecture.

The timing data is shared through a pointer found in the new ELF
auxiliary vector AUX_openbsd_timekeep containing timehands information
that is frequently updated by the kernel.

Timing differences between the last kernel update and the current time
are adjusted in userland by the tc_get_timecount() function inside the
MD usertc.c file.

This permits a much more responsive environment, quite visible in
browsers, office programs and gaming (apparently one is are able to fly
in Minecraft now).

Tested by robert@, sthen@, naddy@, kmos@, phessler@, and many others!

OK from at least kettenis@, cheloha@, naddy@, sthen@


Revision tags: OPENBSD_6_7_BASE
# 1.158 27-Nov-2019 deraadt

Document msyscall(2): ld.so can use this (once only) to tell the kernel
where libc.so's text segment is, thereby allowing invocation of system
calls from that region. An upcoming change will kill the process if a
system call is invoked from addresses not explicitly permitted.
ok guenther kettenis mortimer


Revision tags: OPENBSD_6_6_BASE
# 1.157 28-May-2019 beck

Enable the use of the kernel __realpath() system call in the libc wrapper.

For now, this also still uses the existing realpath implmentation
and emits a syslog if we see differening results. Once we have run
with that for a little while we will remove the old code

ok deraadt@


Revision tags: OPENBSD_6_5_BASE
# 1.156 11-Jan-2019 deraadt

mincore() is a relic from the past, exposing physical machine information
about shared resources which no program should see. only a few pieces of
software use it, generally poorly thought out. they are being fixed, so
mincore() can be deleted.
ok guenther tedu jca sthen, others


Revision tags: OPENBSD_6_4_BASE
# 1.155 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.154 12-Jan-2018 deraadt

sysctl(3) can now be renamed to sysctl(2)


# 1.153 28-Nov-2017 guenther

Delete fktrace(2). The consequences of it were not thought through
sufficiently and at least one horrific security hole was the result.

ok deraadt@ beck@


Revision tags: OPENBSD_6_2_BASE
# 1.152 13-Aug-2017 tedu

add fktrace to libc


# 1.151 12-Aug-2017 guenther

Instead of hardcoding a partial dependency list for the syscall stub objects,
calculate them as done for other objects


# 1.150 31-May-2017 sthen

install futex(2), ok mpi


# 1.149 30-Apr-2017 mpi

Add futex(2) shim, bump minor.

Inputs from guenther@, ok kettenis@, visa@


Revision tags: OPENBSD_6_1_BASE
# 1.148 29-Mar-2017 deraadt

The hppa version of as(1) requires whitespace before a .file directive,
it may not be in column 0. This kind of thing is very common in GNU
and Linux software because the software was written from the start to
be 'compatible replacements' of vendor software.
ok jsing guenther


# 1.147 26-Mar-2017 guenther

Use .file to convince 'as' to generate proper FILE symbols in the syscall
stubs that aren't actually in files, so that syspatch can figure out what
order the syscall stub objects are in the .so. Use -P to suppress to #line
directives that would override that. Tested with both gcc/gas and clang.

ok deraadt@


Revision tags: OPENBSD_6_0_BASE
# 1.146 04-Jul-2016 guenther

DEBUGLIBS has been broken since the gcc4 switch, so delete it. CFLAGS
contains -g by default anyway

problem noted by Edgar Pettijohn (edgar (at) pettijohn-web.com)
ok millert@ kettenis@ deraadt@


# 1.145 30-May-2016 guenther

Move __getcwd from ASM to HIDDEN: we don't want the literal __getcwd symbol

ok millert@ deraadt@


# 1.144 19-May-2016 guenther

Add ASM_NOERR for syscalls that never fail and thus don't need the errno
setting logic...which can significantly reduce the size of the stub on
some archs; 20 syscalls get a trim with this.

in snaps for a bit and ok deraadt@


# 1.143 09-May-2016 guenther

Remove sigreturn declaration and the now-unused libc syscall stub


# 1.142 07-May-2016 guenther

Use a Thread Information Block in both single and multi-threaded programs.
This stores errno, the cancelation flags, and related bits for each thread
and is allocated by ld.so or libc.a. This is an ABI break from 5.9-stable!

Make libpthread dlopen'able by moving the cancelation wrappers into libc
and doing locking and fork/errno handling via callbacks that libpthread
registers when it first initializes. 'errno' *must* be declared via
<errno.h> now!

Clean up libpthread's symbol exports like libc.

On powerpc, offset the TIB/TCB/TLS data from the register per the ELF spec.

Testing by various, particularly sthen@ and patrick@
ok kettenis@


# 1.141 30-Mar-2016 guenther

Turd polish: use HIDDEN= instead of PSEUDO= for ptrace syscall stub, to
make its underlying symbol name look like others.


# 1.140 30-Mar-2016 guenther

Eliminate userspace caching by getlogin_r/setlogin; make the getlogin
syscall behave exactly like userspace getlogin_r() and rename it to
match. Eliminate the reduced-to-no-op wrappers of the syscalls.
Eliminate the unnecessary per-thread static buffering by getlogin().

ok kettenis@ deraadt@


# 1.139 30-Mar-2016 jmc

for some time now mandoc has not required MLINKS to function
correctly - logically complete that now by removing MLINKS from base;

authors need only to ensure there is an entry in NAME for any function/
util being added. MLINKS will still work, and remain for perl to ease
upgrades;

ok nicm (curses) bcook (ssl)
ok schwarze, who provided a lot of feedback and assistance
ok tb natano jung


# 1.138 21-Mar-2016 bluhm

Rename the system call sendsyslog2 to sendsyslog. Keep the old one
as osendsyslog for a while. The three argument variant is the only
one that will stay.
input kettenis@; OK deraadt@


Revision tags: OPENBSD_5_9_BASE
# 1.137 25-Nov-2015 deraadt

Add a syscall stub for sendsyslog2(2), and use it in syslog_r(3), passing
LOG_CONS to the kernel. As a result, the /dev/console opening code can
be removed.
ok kettenis millert beck


# 1.136 10-Nov-2015 guenther

Split the intra-thread functionality from kill(2) into its own syscall
thrkill(2), rolling the kill(2) syscall number with the ABI change to
avoid breaking binaries during during the transition. thrkill(2) includes
a 'tcb' argument that eliminates the need for locking in pthread_kill()
and simplifies pthread_cancel(). Switch __stack_smash_handler() to use
thrkill(2) and explicitly unblock SIGABRT.

Minor bump to both libc and libpthread: make sure you install a new kernel!

ok semarie@


# 1.135 23-Oct-2015 guenther

Merge the sigaction() and sigprocmask() overloads/wrappers from libpthread
into libc, and move pthread_sigmask() as well (just a trivial wrapper).
This provides consistent handling of SIGTHR between single- and multi-threaded
programs and is a step in the merge of all the libpthread overloads, providing
some ASM and Makefile bits that the other wrappers will need.

ok deraadt@ millert@


# 1.134 23-Oct-2015 deraadt

Remove dnssocket() and dnsconnect(), since we decided to use a SOCK_DNS
flag instead.
ok guenther tedu semarie


# 1.133 19-Oct-2015 deraadt

Remove old tame() stub


# 1.132 18-Oct-2015 deraadt

create libc stubs for dnssocket() and dnsconnect()


# 1.131 09-Oct-2015 deraadt

tame -> pledge conversion, in libc. I should crank libc, but am cheating
hoping things go well. The old symbol is faked via a stupid stub function,
until next major crank when it can be removed. I am expecting guenther
to scream at me.


# 1.130 13-Sep-2015 guenther

Rename __sysctl syscall to just sysctl, as the userland wrapper is no longer
necessary

ok deraadt@ jsing@


# 1.129 09-Sep-2015 guenther

Simplify makefile rules for building the ASM stubs into "pick something
from column A and something from column B".

ok miod@ deraadt@


# 1.128 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@


# 1.127 25-Aug-2015 guenther

Document kbind(2)


Revision tags: OPENBSD_5_8_BASE
# 1.126 19-Jul-2015 deraadt

manual page for tame(2). not very good, so i will be hearing from jmc


# 1.125 07-Apr-2015 guenther

Make pthread_atfork() track the DSO that called it like atexit() does,
unregistering callbacks if the DSO is unloaded. Move the callback
handling from libpthread to libc, though libpthread still overrides the
inner call to handle locking and thread-library reinitialization.
Major version bump for both libc and libpthread.

verification that this fixes various ports ajacoutot@
asm assistance miod@; ok millert@ deraadt@


Revision tags: OPENBSD_5_7_BASE
# 1.124 08-Dec-2014 guenther

Add chflagsat(), modeled on fchmodat() with name to match FreeBSD.


# 1.123 14-Nov-2014 guenther

Add sched_yield(2) manpage


# 1.122 31-Aug-2014 guenther

Declare and document getthrid()

indirectly prodded by krw@


# 1.121 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@


# 1.120 14-Aug-2014 tobias

fixed overrid(d)en typo

millert@ and jmc@ agree that "overriden" is wrong


Revision tags: OPENBSD_5_6_BASE
# 1.119 12-Jul-2014 deraadt

document sendsyslog(2); ok guenther tedu matthew


# 1.118 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.117 18-Mar-2014 miod

Retire hp300, mvme68k and mvme88k ports. These ports have no users, keeping
this hardware alive is becoming increasingly difficult, and I should heed the
message sent by the three disks which have died on me over the last few days.

Noone sane will mourn these ports anyway. So long, and thanks for the fish.


Revision tags: OPENBSD_5_5_BASE
# 1.116 13-Oct-2013 guenther

Make it possible to build to reduced version of a library, including
just specific objects that are compiled with additional options to
reduce their size. For use by distrib/ and crunchgen.

style and naming assistance from espie@


# 1.115 07-Oct-2013 guenther

getdirentries(2) is dead; long live getdents(2)!

confirmation that getdirentries(2) is unused by ports from sthen@ and naddy@


# 1.114 13-Aug-2013 guenther

Switch time_t, ino_t, clock_t, and struct kevent's ident and data
members to 64bit types. Assign new syscall numbers for (almost
all) the syscalls that involve the affected types, including anything
with time_t, timeval, itimerval, timespec, rusage, dirent, stat,
or kevent arguments. Add a d_off member to struct dirent and replace
getdirentries() with getdents(), thus immensely simplifying and
accelerating telldir/seekdir. Build perl with -DBIG_TIME.

Bump the major on every single base library: the compat bits included
here are only good enough to make the transition; the T32 compat
option will be burned as soon as we've reached the new world are
are happy with the snapshots for all architectures.

DANGER: ABI incompatibility. Updating to this kernel requires extra
work or you won't be able to login: install a snapshot instead.

Much assistance in fixing userland issues from deraadt@ and tedu@
and build assistance from todd@ and otto@


Revision tags: OPENBSD_5_4_BASE
# 1.113 05-Jun-2013 guenther

Move _Exit() from the exit() manpage to the _exit() manpage, as it's
just an alias of the latter.

ok matthew@ tedu@


# 1.112 01-Jun-2013 miod

Add utrace(2), a system call allowing for userland to send its own ktrace
records. From FreeBSD via otto@, with tweaks suggested by guenther@.
Commite on behalf of otto@ who is not around, to ride the libc minor bump.
Causes a librthread minor bump as well (new syscall).


# 1.111 29-Apr-2013 matthew

Extend P_SIGSUSPEND handling in userret() to properly restore the
sigmask even if there are no pending signals under the temporary
sigmask.

Refactor existing select() and poll() system calls to introduce the
pselect() and ppoll() system calls.

Add rthread wrappers for pselect() and ppoll(). While there, update
cancellation point comments to reflect recent fdatasync() addition.

Minor bumps for libc and librthread due to new symbols.

ok guenther, millert, deraadt, jmc


# 1.110 15-Apr-2013 matthew

Implement fdatasync() as a wrapper around fsync()

ok guenther, deraadt, jmc


Revision tags: OPENBSD_5_3_BASE
# 1.109 03-Feb-2013 miod

gremlin crept in


# 1.108 02-Feb-2013 miod

Userland bits for m68k/ELF. Mostly addition of register prefixes to the
assembler instructions, and cope with the few changes in return values
location.


# 1.107 04-Sep-2012 okan

remove lint leftovers; ok guenther@


# 1.106 23-Aug-2012 deraadt

no more nnpfspioctl() system call; ok guenther


# 1.105 22-Aug-2012 pascal

Convert cpp | as rules in bsd.lib.mk and lib/libc/sys/Makefile.inc to pure cc
invocations. This allows us to use the compiler builtin define __PIC__ to check
for PIC/PIEness rather than passing -DPIC. Simplifies PIE work a lot.

ok matthew@, conceptually ok kurt@


# 1.104 21-Aug-2012 pascal

Kill an old mips workaround; we don't support mips, just mips64.

ok deraadt@ kettenis@


Revision tags: OPENBSD_5_2_BASE
# 1.103 19-Jun-2012 deraadt

oops, forgot to install getdtablecount(2); noted by tedu


# 1.102 12-Apr-2012 deraadt

remove rfork(); ok guenther miod


# 1.101 12-Apr-2012 deraadt

kill lfs system call lines and libc stubs


# 1.100 12-Apr-2012 deraadt

New system call: getdtablecount(2) returns the number of file
descriptors the process currently has open.
ok guenther miod gilles ...


# 1.99 22-Mar-2012 guenther

Move __tfork_thread() from rthreads (libpthread) to libc so that
it can be used for not-strictly-threading purposes

ok matthew@ kurt@


# 1.98 13-Mar-2012 guenther

Add manpages for __thrsigdivert, __thrsleep, and __thrwakeup. Various
syntax and grammar fixes from jmc@


Revision tags: OPENBSD_5_1_BASE
# 1.97 17-Jan-2012 guenther

Reimplement mutexes, condvars, and rwlocks to eliminate bugs,
particularly the "consume the signal you just sent" hang, and putting
the wait queues in userspace.

Do cancellation handling in pthread_cond_*wait(), pthread_join(),
and sem_wait().

Add __ prefix to thr{sleep,wakeup,exit,sigdivert}() syscalls; add
'abort" argument to thrsleep to close cancellation race; make
thr{sleep,wakeup} return errno values via *retval to avoid touching
userspace errno.


# 1.96 22-Nov-2011 guenther

sigstack() is long dead, and the compat sigaltstack syscall is gone too.
Correct the namespace protections for sigreturn(), sigwait(), and psignal()

ok millert@


# 1.95 16-Oct-2011 guenther

Add stubs and manpage for __{get,set}_tcb

ok deraadt@


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

Add (rough draft) documentation for fdopendir(3) and the 15 new
XXXat(2) system calls from POSIX 2008. Editing will be done in tree.

General style discussed with jmc@, schwarze@, and deraadt@
ok jmc@


# 1.93 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@


Revision tags: OPENBSD_4_8_BASE OPENBSD_4_9_BASE
# 1.92 03-Jul-2010 guenther

Fix the naming of interfaces and variables for rdomains and rtables
and make it possible to bind sockets (including listening sockets!)
to rtables and not just rdomains. This changes the name of the
system calls, socket option, and ioctl. After building with this
you should remove the files /usr/share/man/cat2/[gs]etrdomain.0.

Since this removes the existing [gs]etrdomain() system calls, the
libc major is bumped.

Written by claudio@, criticized^Wcritiqued by me


# 1.91 01-Jul-2010 deraadt

getpeereid() can now be a library routine using getsockopt() with
SOL_SOCKET and SO_PEERCRED, only issue being that it cannot return
EFAULT for a page fault. The kernel code will soon be put into
compat, and then in 10 years or so tedu will delete it.
ok guenther millert


# 1.90 18-May-2010 tedu

add posix_madvise, posix_memalign, strndup, and strnlen. mostly from
brad and millert, with hints from guenther, jmc, and otto I think.
ok previous.


Revision tags: OPENBSD_4_7_BASE
# 1.89 03-Feb-2010 miod

Use MACHINE_CPU instead of MACHINE_ARCH to pick the correct machine dependent
files or directories when applicable.
The inspiration and name of MACHINE_CPU come from NetBSD, although the way to
provide it to Makefiles is completely different.
ok kettenis@


# 1.88 27-Nov-2009 guenther

Add setrdomain() and getrdomain() system calls. Committing now to
catch the libc major bump per request from deraadt@

Diff by reyk.

ok guenther@


# 1.87 13-Aug-2009 jmc

various MLINK fixes from Alan R. S. Bueno;


Revision tags: OPENBSD_4_6_BASE
# 1.86 03-Jun-2009 jj

Arla client rename from xfs to nnpfs for later upgrades. Tested on various arches. ok todd@ beck@


Revision tags: OPENBSD_4_4_BASE OPENBSD_4_5_BASE
# 1.85 22-Mar-2008 otto

move statvfs.c to gen, since it is not a syscall; ok deraadt@


# 1.84 16-Mar-2008 otto

statvfs support


Revision tags: OPENBSD_4_3_BASE
# 1.83 05-Jan-2008 deraadt

no more need for vadvise.o


# 1.82 09-Sep-2007 otto

Add lint stubs for the longjmp family of functions which are defined in
assembly on all platforms. ok deraadt@


# 1.81 09-Sep-2007 otto

Silence erroneous "environ used, but not defined" lint warning by
providing a stub. ok deraadt@


Revision tags: OPENBSD_4_1_BASE OPENBSD_4_2_BASE
# 1.80 24-Oct-2006 tedu

add rthread syscalls and bump minor.
rthreads are hardly done, but if just trying it out is too much of a hassle,
we'll never make more progress.
ok brad marc marco mbalmer


# 1.79 10-Oct-2006 deraadt

MLINKS to macros described in stat(2)


Revision tags: OPENBSD_4_0_BASE
# 1.78 14-Jun-2006 otto

Introducing adjfreq(2), to adjust the clock frequency.
Loosely based on dragonfly code. Man page help fro jmc@; ok deraadt@


# 1.77 27-May-2006 pedro

Make libc's getcwd() use the new __getcwd() system call
Hacked by marius@ at c2k5, okay miod@ krw@ deraadt@


# 1.76 13-Mar-2006 moritz

Clean the correct file. ok deraadt@


Revision tags: OPENBSD_3_9_BASE
# 1.75 29-Nov-2005 deraadt

Provide stubs for things which are supplied by crt0. I don't think we
want a crt0.ln, at least, not yet. We may reconsider later.


# 1.74 03-Oct-2005 jmc

add missing MLINK for WEXITSTATUS.2


Revision tags: OPENBSD_3_8_BASE
# 1.73 17-Jun-2005 drahn

Extended Attributes was a piece to get to ACLs, however ACLs have not
been worked on, so EA is pointless to maintain.


# 1.72 17-Jun-2005 millert

remove undelete syscall


Revision tags: OPENBSD_3_7_BASE
# 1.71 18-Sep-2004 deraadt

MLINK to macros provided in wait.2


# 1.70 16-Sep-2004 deraadt

add files missing for building a proper lint library


Revision tags: OPENBSD_3_5_BASE OPENBSD_3_6_BASE
# 1.69 13-Feb-2004 tedu

death to osigaltstack. ok deraadt@


# 1.68 15-Jan-2004 deraadt

ABI breakage happened with the sigaltstack replacement. It is too late,
now we just have to cope. Since setjmp uses it, the alpha and sparc64 are
unhappy with the structure change. In a few days, we will make the second
hop here, for now, use the old system call until all binaries have the new
struct in them.


# 1.67 12-Jan-2004 tedu

new syscall closefrom(2). ok deraadt millert


Revision tags: OPENBSD_3_4_BASE
# 1.66 10-May-2003 miod

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


# 1.65 14-Apr-2003 art

There are two related changes.

The first one is an mquery(2) syscall. It's for asking the VM system
about where to map things. It will be used by ld.so, read the man page
for details.

The second change is related and is a centralization of uvm_map hint
that all callers of uvm_map calculated. This will allow us to adjust
this hint on architectures that have segments for non-exec mappings.

deraadt@ drahn@ ok.


Revision tags: OPENBSD_3_3_BASE
# 1.64 31-Jan-2003 millert

Replace emulated versions of setreuid() and setregid() with real syscalls.
These are spec'd by POSIX as of 1003.1-2001; deraadt@ OK


# 1.63 02-Dec-2002 millert

Document getlogin_r()


# 1.62 02-Dec-2002 miod

Import propolice (http://www.trl.ibm.com/projects/security/ssp), a stack
attack protection scheme, into gcc.

This protection is enabled by default. It can be turned off by using the
-fno-stack-protector flag.

Code by Hiroaki Etoh (etoh at jp dot ibm dot com); work on openbsd-specific
integration by fgsch@, deraadt@ and myself; tests by fgsch@, naddy@ and
myself; beer drinking by myself.

Please note that system upgrades with this new code will require a new
libc and ld.so to be build and installed before the propolice-enabled
compiler can be installed.


# 1.61 10-Nov-2002 fgsch

missing MLINKs for setresuid(2). millert ok.


# 1.60 05-Nov-2002 marc

thread safe libc -- 2nd try. OK miod@, millert@
Thanks to miod@ for m68k and vax fixes


# 1.59 03-Nov-2002 marc

back out previous patch.. there are still some vax/m68k issues


# 1.58 03-Nov-2002 marc

libc changes for thread safety. Tested on:
alpha (millert@), i386 (marc@), m68k (millert@ and miod@),
powerpc (drahn@ and dhartmei@), sparc (millert@ and marc@),
sparc64 (marc@), and vax (millert@ and miod@).
Thanks to millert@, miod@, and mickey@ for fixes along the way.


# 1.57 30-Oct-2002 millert

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


Revision tags: OPENBSD_3_2_BASE
# 1.56 05-Aug-2002 art

Fix brain blackout.
Pointed out byb miod@.


# 1.55 05-Aug-2002 art

One more ELF_TOOLCHAIN.


# 1.54 06-Jul-2002 nordin

Remove kernel support for NTP. ok deraadt@ and tholo@


# 1.53 10-Jun-2002 fgsch

correct comment.


# 1.52 08-Jun-2002 drahn

ELF architectures all support weak aliases, enable them for this part.
ok fgsch@


Revision tags: OPENBSD_3_1_BASE
# 1.51 22-Feb-2002 drahn

Extended Attribute support, from FreeBSD/TrustedBSD. ok art@ deraadt@
libc support pieces


# 1.50 21-Feb-2002 art

remove rfork.o from the auto-generated assembler stubs


# 1.49 17-Feb-2002 deraadt

rfork() needs a fork.S-like stub as well; ok art


Revision tags: OPENBSD_3_0_BASE
# 1.48 25-Sep-2001 niklas

Forgotten DEBUGLIBS stuff


# 1.47 25-Sep-2001 drahn

Add an ASPICFLAG variable to bsd.own.mk which a platform use to pass flags
to 'as' to make it compile pic. add defaults for sparc64 which needs picflags
set to -fPIC and ASPICFLAGS to -KPIC.
Also simplifies the systemcall generation for sparc64 PIC mode.
ok epsie@.


# 1.46 20-Sep-2001 millert

Add PSEUDO_NOERROR similar to that used by NetBSD.
Some ports were setting errno in PSEUDO and some were not. Now errno
is set for all in PSEUDO and PSEUDO_NOERROR is provided for the
non-errno case (only used by _exit).

Needs testing on vax and m88k.
XXX - hppa and powerpc still lack a real PSEUDO_NOERROR implementation.
Currently PSEUDO_NOERROR and PSEUDO are the same (so builds don't
break on those platforms).


# 1.45 09-Jul-2001 fgsch

Install getpeereid(2) manpage.


# 1.44 26-Jun-2001 dugsong

implement djb's getpeereid(2), to allow local-domain servers to determine client credentials. mostly from superscript.com. deraadt@ ok


Revision tags: OPENBSD_2_9_BASE
# 1.43 14-Mar-2001 aaron

Move description of exect() to execve(2) man page. Add a note about exect() not
being portable.


# 1.42 09-Mar-2001 art

Add mlockall and munlockall. man-page from NetBSD.


# 1.41 10-Jan-2001 deraadt

put up FD_* manual pages, in section 3


# 1.40 23-Dec-2000 deraadt

create proper docs for timer{add,clear,sub,isset,cmp}


# 1.39 16-Nov-2000 provos

kqueue and kevent system calls


Revision tags: OPENBSD_2_8_BASE
# 1.38 17-Oct-2000 deraadt

damn it, i have had it with this untested weak shit


# 1.37 16-Oct-2000 deraadt

re-add weak sparc support; d@


# 1.36 15-May-2000 niklas

Add support for building libraries with debugging information in them.
Enable by setting DEBUGLIBS=yes in /etc/mk.conf, then -g libraries will get
installed in /usr/lib/debug. This directory will be searched first if
gcc is given the -g flag during the link stage.


Revision tags: OPENBSD_2_7_BASE
# 1.35 01-May-2000 deraadt

bye bye semconfig(2)


# 1.34 20-Apr-2000 deraadt

p{read,write}{,v} man pages


# 1.33 07-Feb-2000 assar

add fhopen, fhstat, fhstatfs system calls. largely from NetBSD


# 1.32 06-Jan-2000 d

for now, disable weak aliases for all archs except i386


# 1.31 14-Dec-1999 millert

Install swapctl.2, not swapon.2. swapon.2 should probably go away.


Revision tags: OPENBSD_2_6_BASE
# 1.30 07-Jun-1999 deraadt

replacement pipe() system call; copies data into place inside kernel, so
that EFAULT return value is possible


# 1.29 22-May-1999 weingart

Add swapctl(2), and crank shlib minor.


Revision tags: OPENBSD_2_5_BASE
# 1.28 01-Feb-1999 d

mi ptrace


# 1.27 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


Revision tags: OPENBSD_2_4_BASE
# 1.26 18-Sep-1998 art

make use of xfspioctl


Revision tags: OPENBSD_2_3_BASE
# 1.25 08-Feb-1998 tholo

Better lint(1) framework. Mostly from cgd@NetBSD


# 1.24 13-Nov-1997 deraadt

add getsid(2), XPG4


Revision tags: OPENBSD_2_2_BASE
# 1.23 30-May-1997 kstailey

add getpgrp(2) from NetBSD


Revision tags: OPENBSD_2_1_BASE
# 1.22 08-May-1997 kstailey

add tag


# 1.21 08-May-1997 kstailey

make clock_gettime.cat2


# 1.20 20-Apr-1997 tholo

New POSIX 1003.1b syscalls; from pk@NetBSD


# 1.19 04-Apr-1997 deraadt

seek(2) is not needed


# 1.18 29-Mar-1997 deraadt

futimes link; nakayosh@kcn.or.jp


# 1.17 26-Mar-1997 deraadt

install ktrace(2)


# 1.16 26-Jan-1997 downsj

Add a link for lchown.2


# 1.15 26-Jan-1997 downsj

Add lchown(), increment minor number.


# 1.14 11-Dec-1996 deraadt

generate reboot.o like other system calls


Revision tags: OPENBSD_2_0_BASE
# 1.13 02-Sep-1996 deraadt

shmdt link


# 1.12 25-Aug-1996 deraadt

and a man page


# 1.11 18-Jun-1996 deraadt

build poll.o


# 1.10 19-May-1996 pefo

Changes for mips.


# 1.9 18-May-1996 deraadt

poll() as a system call


# 1.8 08-May-1996 deraadt

install rfork man page


# 1.7 01-May-1996 deraadt

add futimes


# 1.6 25-Mar-1996 tholo

Add support for building lint(1) library


# 1.5 29-Jan-1996 tholo

Add kernel PLL for system clock
Add ntp_adjtime() and ntp_gettime() system calls
Mostly stolen from FreeBSD


# 1.4 08-Jan-1996 deraadt

add rfork.o and minherit.o


# 1.3 07-Jan-1996 deraadt

add minherit() system call


# 1.2 14-Dec-1995 deraadt

from netbsd:
add & fix a bunch of system call pages


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.161 23-Dec-2021 guenther

Roll the syscalls that have an off_t argument to remove the explicit padding.
Switch libc and ld.so to the generic stubs for these calls.
WARNING: reboot to updated kernel before installing libc or ld.so!

Time for a story...

When gcc (back in 1.x days) first implemented long long, it didn't (always)
pass 64bit arguments in 'aligned' registers/stack slots, with the result that
argument offsets didn't match structure offsets. This affected the nine system
calls that pass off_t arguments:
ftruncate lseek mmap mquery pread preadv pwrite pwritev truncate

To avoid having to do custom ASM wrappers for those, BSD put an explicit pad
argument in so that the off_t argument would always start on a even slot and
thus be naturally aligned. Thus those odd wrappers in lib/libc/sys/ that use
__syscall() and pass an extra '0' argument.

The ABIs for different CPUs eventually settled how things should be passed on
each and gcc 2.x followed them. The only arch now where it helps is landisk,
which needs to skip the last argument register if it would be the first half of
a 64bit argument. So: add new syscalls without the pad argument and on landisk
do that skipping directly in the syscall handler in the kernel. Keep compat
support for the existing syscalls long enough for the transition.

ok deraadt@


Revision tags: OPENBSD_7_0_BASE
# 1.160 11-Jun-2021 kettenis

Since futex(2) can fail, it needs a full syscall stub. This should fixes
issues on powerpc64 and sparc64.

Note that this makes the lib/libpthread/errno test fail since that test
detects that we are touching errno now. This will be addressed in a
future diff as it is not entirely clear whether the test is correct.

ok mpi@, bluhm@


Revision tags: OPENBSD_6_8_BASE OPENBSD_6_9_BASE
# 1.159 06-Jul-2020 pirofti

Add support for timeconting in userland.

This diff exposes parts of clock_gettime(2) and gettimeofday(2) to
userland via libc eliberating processes from the need for a context
switch everytime they want to count the passage of time.

If a timecounter clock can be exposed to userland than it needs to set
its tc_user member to a non-zero value. Tested with one or multiple
counters per architecture.

The timing data is shared through a pointer found in the new ELF
auxiliary vector AUX_openbsd_timekeep containing timehands information
that is frequently updated by the kernel.

Timing differences between the last kernel update and the current time
are adjusted in userland by the tc_get_timecount() function inside the
MD usertc.c file.

This permits a much more responsive environment, quite visible in
browsers, office programs and gaming (apparently one is are able to fly
in Minecraft now).

Tested by robert@, sthen@, naddy@, kmos@, phessler@, and many others!

OK from at least kettenis@, cheloha@, naddy@, sthen@


Revision tags: OPENBSD_6_7_BASE
# 1.158 27-Nov-2019 deraadt

Document msyscall(2): ld.so can use this (once only) to tell the kernel
where libc.so's text segment is, thereby allowing invocation of system
calls from that region. An upcoming change will kill the process if a
system call is invoked from addresses not explicitly permitted.
ok guenther kettenis mortimer


Revision tags: OPENBSD_6_6_BASE
# 1.157 28-May-2019 beck

Enable the use of the kernel __realpath() system call in the libc wrapper.

For now, this also still uses the existing realpath implmentation
and emits a syslog if we see differening results. Once we have run
with that for a little while we will remove the old code

ok deraadt@


Revision tags: OPENBSD_6_5_BASE
# 1.156 11-Jan-2019 deraadt

mincore() is a relic from the past, exposing physical machine information
about shared resources which no program should see. only a few pieces of
software use it, generally poorly thought out. they are being fixed, so
mincore() can be deleted.
ok guenther tedu jca sthen, others


Revision tags: OPENBSD_6_4_BASE
# 1.155 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.154 12-Jan-2018 deraadt

sysctl(3) can now be renamed to sysctl(2)


# 1.153 28-Nov-2017 guenther

Delete fktrace(2). The consequences of it were not thought through
sufficiently and at least one horrific security hole was the result.

ok deraadt@ beck@


Revision tags: OPENBSD_6_2_BASE
# 1.152 13-Aug-2017 tedu

add fktrace to libc


# 1.151 12-Aug-2017 guenther

Instead of hardcoding a partial dependency list for the syscall stub objects,
calculate them as done for other objects


# 1.150 31-May-2017 sthen

install futex(2), ok mpi


# 1.149 30-Apr-2017 mpi

Add futex(2) shim, bump minor.

Inputs from guenther@, ok kettenis@, visa@


Revision tags: OPENBSD_6_1_BASE
# 1.148 29-Mar-2017 deraadt

The hppa version of as(1) requires whitespace before a .file directive,
it may not be in column 0. This kind of thing is very common in GNU
and Linux software because the software was written from the start to
be 'compatible replacements' of vendor software.
ok jsing guenther


# 1.147 26-Mar-2017 guenther

Use .file to convince 'as' to generate proper FILE symbols in the syscall
stubs that aren't actually in files, so that syspatch can figure out what
order the syscall stub objects are in the .so. Use -P to suppress to #line
directives that would override that. Tested with both gcc/gas and clang.

ok deraadt@


Revision tags: OPENBSD_6_0_BASE
# 1.146 04-Jul-2016 guenther

DEBUGLIBS has been broken since the gcc4 switch, so delete it. CFLAGS
contains -g by default anyway

problem noted by Edgar Pettijohn (edgar (at) pettijohn-web.com)
ok millert@ kettenis@ deraadt@


# 1.145 30-May-2016 guenther

Move __getcwd from ASM to HIDDEN: we don't want the literal __getcwd symbol

ok millert@ deraadt@


# 1.144 19-May-2016 guenther

Add ASM_NOERR for syscalls that never fail and thus don't need the errno
setting logic...which can significantly reduce the size of the stub on
some archs; 20 syscalls get a trim with this.

in snaps for a bit and ok deraadt@


# 1.143 09-May-2016 guenther

Remove sigreturn declaration and the now-unused libc syscall stub


# 1.142 07-May-2016 guenther

Use a Thread Information Block in both single and multi-threaded programs.
This stores errno, the cancelation flags, and related bits for each thread
and is allocated by ld.so or libc.a. This is an ABI break from 5.9-stable!

Make libpthread dlopen'able by moving the cancelation wrappers into libc
and doing locking and fork/errno handling via callbacks that libpthread
registers when it first initializes. 'errno' *must* be declared via
<errno.h> now!

Clean up libpthread's symbol exports like libc.

On powerpc, offset the TIB/TCB/TLS data from the register per the ELF spec.

Testing by various, particularly sthen@ and patrick@
ok kettenis@


# 1.141 30-Mar-2016 guenther

Turd polish: use HIDDEN= instead of PSEUDO= for ptrace syscall stub, to
make its underlying symbol name look like others.


# 1.140 30-Mar-2016 guenther

Eliminate userspace caching by getlogin_r/setlogin; make the getlogin
syscall behave exactly like userspace getlogin_r() and rename it to
match. Eliminate the reduced-to-no-op wrappers of the syscalls.
Eliminate the unnecessary per-thread static buffering by getlogin().

ok kettenis@ deraadt@


# 1.139 30-Mar-2016 jmc

for some time now mandoc has not required MLINKS to function
correctly - logically complete that now by removing MLINKS from base;

authors need only to ensure there is an entry in NAME for any function/
util being added. MLINKS will still work, and remain for perl to ease
upgrades;

ok nicm (curses) bcook (ssl)
ok schwarze, who provided a lot of feedback and assistance
ok tb natano jung


# 1.138 21-Mar-2016 bluhm

Rename the system call sendsyslog2 to sendsyslog. Keep the old one
as osendsyslog for a while. The three argument variant is the only
one that will stay.
input kettenis@; OK deraadt@


Revision tags: OPENBSD_5_9_BASE
# 1.137 25-Nov-2015 deraadt

Add a syscall stub for sendsyslog2(2), and use it in syslog_r(3), passing
LOG_CONS to the kernel. As a result, the /dev/console opening code can
be removed.
ok kettenis millert beck


# 1.136 10-Nov-2015 guenther

Split the intra-thread functionality from kill(2) into its own syscall
thrkill(2), rolling the kill(2) syscall number with the ABI change to
avoid breaking binaries during during the transition. thrkill(2) includes
a 'tcb' argument that eliminates the need for locking in pthread_kill()
and simplifies pthread_cancel(). Switch __stack_smash_handler() to use
thrkill(2) and explicitly unblock SIGABRT.

Minor bump to both libc and libpthread: make sure you install a new kernel!

ok semarie@


# 1.135 23-Oct-2015 guenther

Merge the sigaction() and sigprocmask() overloads/wrappers from libpthread
into libc, and move pthread_sigmask() as well (just a trivial wrapper).
This provides consistent handling of SIGTHR between single- and multi-threaded
programs and is a step in the merge of all the libpthread overloads, providing
some ASM and Makefile bits that the other wrappers will need.

ok deraadt@ millert@


# 1.134 23-Oct-2015 deraadt

Remove dnssocket() and dnsconnect(), since we decided to use a SOCK_DNS
flag instead.
ok guenther tedu semarie


# 1.133 19-Oct-2015 deraadt

Remove old tame() stub


# 1.132 18-Oct-2015 deraadt

create libc stubs for dnssocket() and dnsconnect()


# 1.131 09-Oct-2015 deraadt

tame -> pledge conversion, in libc. I should crank libc, but am cheating
hoping things go well. The old symbol is faked via a stupid stub function,
until next major crank when it can be removed. I am expecting guenther
to scream at me.


# 1.130 13-Sep-2015 guenther

Rename __sysctl syscall to just sysctl, as the userland wrapper is no longer
necessary

ok deraadt@ jsing@


# 1.129 09-Sep-2015 guenther

Simplify makefile rules for building the ASM stubs into "pick something
from column A and something from column B".

ok miod@ deraadt@


# 1.128 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@


# 1.127 25-Aug-2015 guenther

Document kbind(2)


Revision tags: OPENBSD_5_8_BASE
# 1.126 19-Jul-2015 deraadt

manual page for tame(2). not very good, so i will be hearing from jmc


# 1.125 07-Apr-2015 guenther

Make pthread_atfork() track the DSO that called it like atexit() does,
unregistering callbacks if the DSO is unloaded. Move the callback
handling from libpthread to libc, though libpthread still overrides the
inner call to handle locking and thread-library reinitialization.
Major version bump for both libc and libpthread.

verification that this fixes various ports ajacoutot@
asm assistance miod@; ok millert@ deraadt@


Revision tags: OPENBSD_5_7_BASE
# 1.124 08-Dec-2014 guenther

Add chflagsat(), modeled on fchmodat() with name to match FreeBSD.


# 1.123 14-Nov-2014 guenther

Add sched_yield(2) manpage


# 1.122 31-Aug-2014 guenther

Declare and document getthrid()

indirectly prodded by krw@


# 1.121 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@


# 1.120 14-Aug-2014 tobias

fixed overrid(d)en typo

millert@ and jmc@ agree that "overriden" is wrong


Revision tags: OPENBSD_5_6_BASE
# 1.119 12-Jul-2014 deraadt

document sendsyslog(2); ok guenther tedu matthew


# 1.118 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.117 18-Mar-2014 miod

Retire hp300, mvme68k and mvme88k ports. These ports have no users, keeping
this hardware alive is becoming increasingly difficult, and I should heed the
message sent by the three disks which have died on me over the last few days.

Noone sane will mourn these ports anyway. So long, and thanks for the fish.


Revision tags: OPENBSD_5_5_BASE
# 1.116 13-Oct-2013 guenther

Make it possible to build to reduced version of a library, including
just specific objects that are compiled with additional options to
reduce their size. For use by distrib/ and crunchgen.

style and naming assistance from espie@


# 1.115 07-Oct-2013 guenther

getdirentries(2) is dead; long live getdents(2)!

confirmation that getdirentries(2) is unused by ports from sthen@ and naddy@


# 1.114 13-Aug-2013 guenther

Switch time_t, ino_t, clock_t, and struct kevent's ident and data
members to 64bit types. Assign new syscall numbers for (almost
all) the syscalls that involve the affected types, including anything
with time_t, timeval, itimerval, timespec, rusage, dirent, stat,
or kevent arguments. Add a d_off member to struct dirent and replace
getdirentries() with getdents(), thus immensely simplifying and
accelerating telldir/seekdir. Build perl with -DBIG_TIME.

Bump the major on every single base library: the compat bits included
here are only good enough to make the transition; the T32 compat
option will be burned as soon as we've reached the new world are
are happy with the snapshots for all architectures.

DANGER: ABI incompatibility. Updating to this kernel requires extra
work or you won't be able to login: install a snapshot instead.

Much assistance in fixing userland issues from deraadt@ and tedu@
and build assistance from todd@ and otto@


Revision tags: OPENBSD_5_4_BASE
# 1.113 05-Jun-2013 guenther

Move _Exit() from the exit() manpage to the _exit() manpage, as it's
just an alias of the latter.

ok matthew@ tedu@


# 1.112 01-Jun-2013 miod

Add utrace(2), a system call allowing for userland to send its own ktrace
records. From FreeBSD via otto@, with tweaks suggested by guenther@.
Commite on behalf of otto@ who is not around, to ride the libc minor bump.
Causes a librthread minor bump as well (new syscall).


# 1.111 29-Apr-2013 matthew

Extend P_SIGSUSPEND handling in userret() to properly restore the
sigmask even if there are no pending signals under the temporary
sigmask.

Refactor existing select() and poll() system calls to introduce the
pselect() and ppoll() system calls.

Add rthread wrappers for pselect() and ppoll(). While there, update
cancellation point comments to reflect recent fdatasync() addition.

Minor bumps for libc and librthread due to new symbols.

ok guenther, millert, deraadt, jmc


# 1.110 15-Apr-2013 matthew

Implement fdatasync() as a wrapper around fsync()

ok guenther, deraadt, jmc


Revision tags: OPENBSD_5_3_BASE
# 1.109 03-Feb-2013 miod

gremlin crept in


# 1.108 02-Feb-2013 miod

Userland bits for m68k/ELF. Mostly addition of register prefixes to the
assembler instructions, and cope with the few changes in return values
location.


# 1.107 04-Sep-2012 okan

remove lint leftovers; ok guenther@


# 1.106 23-Aug-2012 deraadt

no more nnpfspioctl() system call; ok guenther


# 1.105 22-Aug-2012 pascal

Convert cpp | as rules in bsd.lib.mk and lib/libc/sys/Makefile.inc to pure cc
invocations. This allows us to use the compiler builtin define __PIC__ to check
for PIC/PIEness rather than passing -DPIC. Simplifies PIE work a lot.

ok matthew@, conceptually ok kurt@


# 1.104 21-Aug-2012 pascal

Kill an old mips workaround; we don't support mips, just mips64.

ok deraadt@ kettenis@


Revision tags: OPENBSD_5_2_BASE
# 1.103 19-Jun-2012 deraadt

oops, forgot to install getdtablecount(2); noted by tedu


# 1.102 12-Apr-2012 deraadt

remove rfork(); ok guenther miod


# 1.101 12-Apr-2012 deraadt

kill lfs system call lines and libc stubs


# 1.100 12-Apr-2012 deraadt

New system call: getdtablecount(2) returns the number of file
descriptors the process currently has open.
ok guenther miod gilles ...


# 1.99 22-Mar-2012 guenther

Move __tfork_thread() from rthreads (libpthread) to libc so that
it can be used for not-strictly-threading purposes

ok matthew@ kurt@


# 1.98 13-Mar-2012 guenther

Add manpages for __thrsigdivert, __thrsleep, and __thrwakeup. Various
syntax and grammar fixes from jmc@


Revision tags: OPENBSD_5_1_BASE
# 1.97 17-Jan-2012 guenther

Reimplement mutexes, condvars, and rwlocks to eliminate bugs,
particularly the "consume the signal you just sent" hang, and putting
the wait queues in userspace.

Do cancellation handling in pthread_cond_*wait(), pthread_join(),
and sem_wait().

Add __ prefix to thr{sleep,wakeup,exit,sigdivert}() syscalls; add
'abort" argument to thrsleep to close cancellation race; make
thr{sleep,wakeup} return errno values via *retval to avoid touching
userspace errno.


# 1.96 22-Nov-2011 guenther

sigstack() is long dead, and the compat sigaltstack syscall is gone too.
Correct the namespace protections for sigreturn(), sigwait(), and psignal()

ok millert@


# 1.95 16-Oct-2011 guenther

Add stubs and manpage for __{get,set}_tcb

ok deraadt@


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

Add (rough draft) documentation for fdopendir(3) and the 15 new
XXXat(2) system calls from POSIX 2008. Editing will be done in tree.

General style discussed with jmc@, schwarze@, and deraadt@
ok jmc@


# 1.93 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@


Revision tags: OPENBSD_4_8_BASE OPENBSD_4_9_BASE
# 1.92 03-Jul-2010 guenther

Fix the naming of interfaces and variables for rdomains and rtables
and make it possible to bind sockets (including listening sockets!)
to rtables and not just rdomains. This changes the name of the
system calls, socket option, and ioctl. After building with this
you should remove the files /usr/share/man/cat2/[gs]etrdomain.0.

Since this removes the existing [gs]etrdomain() system calls, the
libc major is bumped.

Written by claudio@, criticized^Wcritiqued by me


# 1.91 01-Jul-2010 deraadt

getpeereid() can now be a library routine using getsockopt() with
SOL_SOCKET and SO_PEERCRED, only issue being that it cannot return
EFAULT for a page fault. The kernel code will soon be put into
compat, and then in 10 years or so tedu will delete it.
ok guenther millert


# 1.90 18-May-2010 tedu

add posix_madvise, posix_memalign, strndup, and strnlen. mostly from
brad and millert, with hints from guenther, jmc, and otto I think.
ok previous.


Revision tags: OPENBSD_4_7_BASE
# 1.89 03-Feb-2010 miod

Use MACHINE_CPU instead of MACHINE_ARCH to pick the correct machine dependent
files or directories when applicable.
The inspiration and name of MACHINE_CPU come from NetBSD, although the way to
provide it to Makefiles is completely different.
ok kettenis@


# 1.88 27-Nov-2009 guenther

Add setrdomain() and getrdomain() system calls. Committing now to
catch the libc major bump per request from deraadt@

Diff by reyk.

ok guenther@


# 1.87 13-Aug-2009 jmc

various MLINK fixes from Alan R. S. Bueno;


Revision tags: OPENBSD_4_6_BASE
# 1.86 03-Jun-2009 jj

Arla client rename from xfs to nnpfs for later upgrades. Tested on various arches. ok todd@ beck@


Revision tags: OPENBSD_4_4_BASE OPENBSD_4_5_BASE
# 1.85 22-Mar-2008 otto

move statvfs.c to gen, since it is not a syscall; ok deraadt@


# 1.84 16-Mar-2008 otto

statvfs support


Revision tags: OPENBSD_4_3_BASE
# 1.83 05-Jan-2008 deraadt

no more need for vadvise.o


# 1.82 09-Sep-2007 otto

Add lint stubs for the longjmp family of functions which are defined in
assembly on all platforms. ok deraadt@


# 1.81 09-Sep-2007 otto

Silence erroneous "environ used, but not defined" lint warning by
providing a stub. ok deraadt@


Revision tags: OPENBSD_4_1_BASE OPENBSD_4_2_BASE
# 1.80 24-Oct-2006 tedu

add rthread syscalls and bump minor.
rthreads are hardly done, but if just trying it out is too much of a hassle,
we'll never make more progress.
ok brad marc marco mbalmer


# 1.79 10-Oct-2006 deraadt

MLINKS to macros described in stat(2)


Revision tags: OPENBSD_4_0_BASE
# 1.78 14-Jun-2006 otto

Introducing adjfreq(2), to adjust the clock frequency.
Loosely based on dragonfly code. Man page help fro jmc@; ok deraadt@


# 1.77 27-May-2006 pedro

Make libc's getcwd() use the new __getcwd() system call
Hacked by marius@ at c2k5, okay miod@ krw@ deraadt@


# 1.76 13-Mar-2006 moritz

Clean the correct file. ok deraadt@


Revision tags: OPENBSD_3_9_BASE
# 1.75 29-Nov-2005 deraadt

Provide stubs for things which are supplied by crt0. I don't think we
want a crt0.ln, at least, not yet. We may reconsider later.


# 1.74 03-Oct-2005 jmc

add missing MLINK for WEXITSTATUS.2


Revision tags: OPENBSD_3_8_BASE
# 1.73 17-Jun-2005 drahn

Extended Attributes was a piece to get to ACLs, however ACLs have not
been worked on, so EA is pointless to maintain.


# 1.72 17-Jun-2005 millert

remove undelete syscall


Revision tags: OPENBSD_3_7_BASE
# 1.71 18-Sep-2004 deraadt

MLINK to macros provided in wait.2


# 1.70 16-Sep-2004 deraadt

add files missing for building a proper lint library


Revision tags: OPENBSD_3_5_BASE OPENBSD_3_6_BASE
# 1.69 13-Feb-2004 tedu

death to osigaltstack. ok deraadt@


# 1.68 15-Jan-2004 deraadt

ABI breakage happened with the sigaltstack replacement. It is too late,
now we just have to cope. Since setjmp uses it, the alpha and sparc64 are
unhappy with the structure change. In a few days, we will make the second
hop here, for now, use the old system call until all binaries have the new
struct in them.


# 1.67 12-Jan-2004 tedu

new syscall closefrom(2). ok deraadt millert


Revision tags: OPENBSD_3_4_BASE
# 1.66 10-May-2003 miod

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


# 1.65 14-Apr-2003 art

There are two related changes.

The first one is an mquery(2) syscall. It's for asking the VM system
about where to map things. It will be used by ld.so, read the man page
for details.

The second change is related and is a centralization of uvm_map hint
that all callers of uvm_map calculated. This will allow us to adjust
this hint on architectures that have segments for non-exec mappings.

deraadt@ drahn@ ok.


Revision tags: OPENBSD_3_3_BASE
# 1.64 31-Jan-2003 millert

Replace emulated versions of setreuid() and setregid() with real syscalls.
These are spec'd by POSIX as of 1003.1-2001; deraadt@ OK


# 1.63 02-Dec-2002 millert

Document getlogin_r()


# 1.62 02-Dec-2002 miod

Import propolice (http://www.trl.ibm.com/projects/security/ssp), a stack
attack protection scheme, into gcc.

This protection is enabled by default. It can be turned off by using the
-fno-stack-protector flag.

Code by Hiroaki Etoh (etoh at jp dot ibm dot com); work on openbsd-specific
integration by fgsch@, deraadt@ and myself; tests by fgsch@, naddy@ and
myself; beer drinking by myself.

Please note that system upgrades with this new code will require a new
libc and ld.so to be build and installed before the propolice-enabled
compiler can be installed.


# 1.61 10-Nov-2002 fgsch

missing MLINKs for setresuid(2). millert ok.


# 1.60 05-Nov-2002 marc

thread safe libc -- 2nd try. OK miod@, millert@
Thanks to miod@ for m68k and vax fixes


# 1.59 03-Nov-2002 marc

back out previous patch.. there are still some vax/m68k issues


# 1.58 03-Nov-2002 marc

libc changes for thread safety. Tested on:
alpha (millert@), i386 (marc@), m68k (millert@ and miod@),
powerpc (drahn@ and dhartmei@), sparc (millert@ and marc@),
sparc64 (marc@), and vax (millert@ and miod@).
Thanks to millert@, miod@, and mickey@ for fixes along the way.


# 1.57 30-Oct-2002 millert

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


Revision tags: OPENBSD_3_2_BASE
# 1.56 05-Aug-2002 art

Fix brain blackout.
Pointed out byb miod@.


# 1.55 05-Aug-2002 art

One more ELF_TOOLCHAIN.


# 1.54 06-Jul-2002 nordin

Remove kernel support for NTP. ok deraadt@ and tholo@


# 1.53 10-Jun-2002 fgsch

correct comment.


# 1.52 08-Jun-2002 drahn

ELF architectures all support weak aliases, enable them for this part.
ok fgsch@


Revision tags: OPENBSD_3_1_BASE
# 1.51 22-Feb-2002 drahn

Extended Attribute support, from FreeBSD/TrustedBSD. ok art@ deraadt@
libc support pieces


# 1.50 21-Feb-2002 art

remove rfork.o from the auto-generated assembler stubs


# 1.49 17-Feb-2002 deraadt

rfork() needs a fork.S-like stub as well; ok art


Revision tags: OPENBSD_3_0_BASE
# 1.48 25-Sep-2001 niklas

Forgotten DEBUGLIBS stuff


# 1.47 25-Sep-2001 drahn

Add an ASPICFLAG variable to bsd.own.mk which a platform use to pass flags
to 'as' to make it compile pic. add defaults for sparc64 which needs picflags
set to -fPIC and ASPICFLAGS to -KPIC.
Also simplifies the systemcall generation for sparc64 PIC mode.
ok epsie@.


# 1.46 20-Sep-2001 millert

Add PSEUDO_NOERROR similar to that used by NetBSD.
Some ports were setting errno in PSEUDO and some were not. Now errno
is set for all in PSEUDO and PSEUDO_NOERROR is provided for the
non-errno case (only used by _exit).

Needs testing on vax and m88k.
XXX - hppa and powerpc still lack a real PSEUDO_NOERROR implementation.
Currently PSEUDO_NOERROR and PSEUDO are the same (so builds don't
break on those platforms).


# 1.45 09-Jul-2001 fgsch

Install getpeereid(2) manpage.


# 1.44 26-Jun-2001 dugsong

implement djb's getpeereid(2), to allow local-domain servers to determine client credentials. mostly from superscript.com. deraadt@ ok


Revision tags: OPENBSD_2_9_BASE
# 1.43 14-Mar-2001 aaron

Move description of exect() to execve(2) man page. Add a note about exect() not
being portable.


# 1.42 09-Mar-2001 art

Add mlockall and munlockall. man-page from NetBSD.


# 1.41 10-Jan-2001 deraadt

put up FD_* manual pages, in section 3


# 1.40 23-Dec-2000 deraadt

create proper docs for timer{add,clear,sub,isset,cmp}


# 1.39 16-Nov-2000 provos

kqueue and kevent system calls


Revision tags: OPENBSD_2_8_BASE
# 1.38 17-Oct-2000 deraadt

damn it, i have had it with this untested weak shit


# 1.37 16-Oct-2000 deraadt

re-add weak sparc support; d@


# 1.36 15-May-2000 niklas

Add support for building libraries with debugging information in them.
Enable by setting DEBUGLIBS=yes in /etc/mk.conf, then -g libraries will get
installed in /usr/lib/debug. This directory will be searched first if
gcc is given the -g flag during the link stage.


Revision tags: OPENBSD_2_7_BASE
# 1.35 01-May-2000 deraadt

bye bye semconfig(2)


# 1.34 20-Apr-2000 deraadt

p{read,write}{,v} man pages


# 1.33 07-Feb-2000 assar

add fhopen, fhstat, fhstatfs system calls. largely from NetBSD


# 1.32 06-Jan-2000 d

for now, disable weak aliases for all archs except i386


# 1.31 14-Dec-1999 millert

Install swapctl.2, not swapon.2. swapon.2 should probably go away.


Revision tags: OPENBSD_2_6_BASE
# 1.30 07-Jun-1999 deraadt

replacement pipe() system call; copies data into place inside kernel, so
that EFAULT return value is possible


# 1.29 22-May-1999 weingart

Add swapctl(2), and crank shlib minor.


Revision tags: OPENBSD_2_5_BASE
# 1.28 01-Feb-1999 d

mi ptrace


# 1.27 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


Revision tags: OPENBSD_2_4_BASE
# 1.26 18-Sep-1998 art

make use of xfspioctl


Revision tags: OPENBSD_2_3_BASE
# 1.25 08-Feb-1998 tholo

Better lint(1) framework. Mostly from cgd@NetBSD


# 1.24 13-Nov-1997 deraadt

add getsid(2), XPG4


Revision tags: OPENBSD_2_2_BASE
# 1.23 30-May-1997 kstailey

add getpgrp(2) from NetBSD


Revision tags: OPENBSD_2_1_BASE
# 1.22 08-May-1997 kstailey

add tag


# 1.21 08-May-1997 kstailey

make clock_gettime.cat2


# 1.20 20-Apr-1997 tholo

New POSIX 1003.1b syscalls; from pk@NetBSD


# 1.19 04-Apr-1997 deraadt

seek(2) is not needed


# 1.18 29-Mar-1997 deraadt

futimes link; nakayosh@kcn.or.jp


# 1.17 26-Mar-1997 deraadt

install ktrace(2)


# 1.16 26-Jan-1997 downsj

Add a link for lchown.2


# 1.15 26-Jan-1997 downsj

Add lchown(), increment minor number.


# 1.14 11-Dec-1996 deraadt

generate reboot.o like other system calls


Revision tags: OPENBSD_2_0_BASE
# 1.13 02-Sep-1996 deraadt

shmdt link


# 1.12 25-Aug-1996 deraadt

and a man page


# 1.11 18-Jun-1996 deraadt

build poll.o


# 1.10 19-May-1996 pefo

Changes for mips.


# 1.9 18-May-1996 deraadt

poll() as a system call


# 1.8 08-May-1996 deraadt

install rfork man page


# 1.7 01-May-1996 deraadt

add futimes


# 1.6 25-Mar-1996 tholo

Add support for building lint(1) library


# 1.5 29-Jan-1996 tholo

Add kernel PLL for system clock
Add ntp_adjtime() and ntp_gettime() system calls
Mostly stolen from FreeBSD


# 1.4 08-Jan-1996 deraadt

add rfork.o and minherit.o


# 1.3 07-Jan-1996 deraadt

add minherit() system call


# 1.2 14-Dec-1995 deraadt

from netbsd:
add & fix a bunch of system call pages


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.160 11-Jun-2021 kettenis

Since futex(2) can fail, it needs a full syscall stub. This should fixes
issues on powerpc64 and sparc64.

Note that this makes the lib/libpthread/errno test fail since that test
detects that we are touching errno now. This will be addressed in a
future diff as it is not entirely clear whether the test is correct.

ok mpi@, bluhm@


Revision tags: OPENBSD_6_8_BASE OPENBSD_6_9_BASE
# 1.159 06-Jul-2020 pirofti

Add support for timeconting in userland.

This diff exposes parts of clock_gettime(2) and gettimeofday(2) to
userland via libc eliberating processes from the need for a context
switch everytime they want to count the passage of time.

If a timecounter clock can be exposed to userland than it needs to set
its tc_user member to a non-zero value. Tested with one or multiple
counters per architecture.

The timing data is shared through a pointer found in the new ELF
auxiliary vector AUX_openbsd_timekeep containing timehands information
that is frequently updated by the kernel.

Timing differences between the last kernel update and the current time
are adjusted in userland by the tc_get_timecount() function inside the
MD usertc.c file.

This permits a much more responsive environment, quite visible in
browsers, office programs and gaming (apparently one is are able to fly
in Minecraft now).

Tested by robert@, sthen@, naddy@, kmos@, phessler@, and many others!

OK from at least kettenis@, cheloha@, naddy@, sthen@


Revision tags: OPENBSD_6_7_BASE
# 1.158 27-Nov-2019 deraadt

Document msyscall(2): ld.so can use this (once only) to tell the kernel
where libc.so's text segment is, thereby allowing invocation of system
calls from that region. An upcoming change will kill the process if a
system call is invoked from addresses not explicitly permitted.
ok guenther kettenis mortimer


Revision tags: OPENBSD_6_6_BASE
# 1.157 28-May-2019 beck

Enable the use of the kernel __realpath() system call in the libc wrapper.

For now, this also still uses the existing realpath implmentation
and emits a syslog if we see differening results. Once we have run
with that for a little while we will remove the old code

ok deraadt@


Revision tags: OPENBSD_6_5_BASE
# 1.156 11-Jan-2019 deraadt

mincore() is a relic from the past, exposing physical machine information
about shared resources which no program should see. only a few pieces of
software use it, generally poorly thought out. they are being fixed, so
mincore() can be deleted.
ok guenther tedu jca sthen, others


Revision tags: OPENBSD_6_4_BASE
# 1.155 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.154 12-Jan-2018 deraadt

sysctl(3) can now be renamed to sysctl(2)


# 1.153 28-Nov-2017 guenther

Delete fktrace(2). The consequences of it were not thought through
sufficiently and at least one horrific security hole was the result.

ok deraadt@ beck@


Revision tags: OPENBSD_6_2_BASE
# 1.152 13-Aug-2017 tedu

add fktrace to libc


# 1.151 12-Aug-2017 guenther

Instead of hardcoding a partial dependency list for the syscall stub objects,
calculate them as done for other objects


# 1.150 31-May-2017 sthen

install futex(2), ok mpi


# 1.149 30-Apr-2017 mpi

Add futex(2) shim, bump minor.

Inputs from guenther@, ok kettenis@, visa@


Revision tags: OPENBSD_6_1_BASE
# 1.148 29-Mar-2017 deraadt

The hppa version of as(1) requires whitespace before a .file directive,
it may not be in column 0. This kind of thing is very common in GNU
and Linux software because the software was written from the start to
be 'compatible replacements' of vendor software.
ok jsing guenther


# 1.147 26-Mar-2017 guenther

Use .file to convince 'as' to generate proper FILE symbols in the syscall
stubs that aren't actually in files, so that syspatch can figure out what
order the syscall stub objects are in the .so. Use -P to suppress to #line
directives that would override that. Tested with both gcc/gas and clang.

ok deraadt@


Revision tags: OPENBSD_6_0_BASE
# 1.146 04-Jul-2016 guenther

DEBUGLIBS has been broken since the gcc4 switch, so delete it. CFLAGS
contains -g by default anyway

problem noted by Edgar Pettijohn (edgar (at) pettijohn-web.com)
ok millert@ kettenis@ deraadt@


# 1.145 30-May-2016 guenther

Move __getcwd from ASM to HIDDEN: we don't want the literal __getcwd symbol

ok millert@ deraadt@


# 1.144 19-May-2016 guenther

Add ASM_NOERR for syscalls that never fail and thus don't need the errno
setting logic...which can significantly reduce the size of the stub on
some archs; 20 syscalls get a trim with this.

in snaps for a bit and ok deraadt@


# 1.143 09-May-2016 guenther

Remove sigreturn declaration and the now-unused libc syscall stub


# 1.142 07-May-2016 guenther

Use a Thread Information Block in both single and multi-threaded programs.
This stores errno, the cancelation flags, and related bits for each thread
and is allocated by ld.so or libc.a. This is an ABI break from 5.9-stable!

Make libpthread dlopen'able by moving the cancelation wrappers into libc
and doing locking and fork/errno handling via callbacks that libpthread
registers when it first initializes. 'errno' *must* be declared via
<errno.h> now!

Clean up libpthread's symbol exports like libc.

On powerpc, offset the TIB/TCB/TLS data from the register per the ELF spec.

Testing by various, particularly sthen@ and patrick@
ok kettenis@


# 1.141 30-Mar-2016 guenther

Turd polish: use HIDDEN= instead of PSEUDO= for ptrace syscall stub, to
make its underlying symbol name look like others.


# 1.140 30-Mar-2016 guenther

Eliminate userspace caching by getlogin_r/setlogin; make the getlogin
syscall behave exactly like userspace getlogin_r() and rename it to
match. Eliminate the reduced-to-no-op wrappers of the syscalls.
Eliminate the unnecessary per-thread static buffering by getlogin().

ok kettenis@ deraadt@


# 1.139 30-Mar-2016 jmc

for some time now mandoc has not required MLINKS to function
correctly - logically complete that now by removing MLINKS from base;

authors need only to ensure there is an entry in NAME for any function/
util being added. MLINKS will still work, and remain for perl to ease
upgrades;

ok nicm (curses) bcook (ssl)
ok schwarze, who provided a lot of feedback and assistance
ok tb natano jung


# 1.138 21-Mar-2016 bluhm

Rename the system call sendsyslog2 to sendsyslog. Keep the old one
as osendsyslog for a while. The three argument variant is the only
one that will stay.
input kettenis@; OK deraadt@


Revision tags: OPENBSD_5_9_BASE
# 1.137 25-Nov-2015 deraadt

Add a syscall stub for sendsyslog2(2), and use it in syslog_r(3), passing
LOG_CONS to the kernel. As a result, the /dev/console opening code can
be removed.
ok kettenis millert beck


# 1.136 10-Nov-2015 guenther

Split the intra-thread functionality from kill(2) into its own syscall
thrkill(2), rolling the kill(2) syscall number with the ABI change to
avoid breaking binaries during during the transition. thrkill(2) includes
a 'tcb' argument that eliminates the need for locking in pthread_kill()
and simplifies pthread_cancel(). Switch __stack_smash_handler() to use
thrkill(2) and explicitly unblock SIGABRT.

Minor bump to both libc and libpthread: make sure you install a new kernel!

ok semarie@


# 1.135 23-Oct-2015 guenther

Merge the sigaction() and sigprocmask() overloads/wrappers from libpthread
into libc, and move pthread_sigmask() as well (just a trivial wrapper).
This provides consistent handling of SIGTHR between single- and multi-threaded
programs and is a step in the merge of all the libpthread overloads, providing
some ASM and Makefile bits that the other wrappers will need.

ok deraadt@ millert@


# 1.134 23-Oct-2015 deraadt

Remove dnssocket() and dnsconnect(), since we decided to use a SOCK_DNS
flag instead.
ok guenther tedu semarie


# 1.133 19-Oct-2015 deraadt

Remove old tame() stub


# 1.132 18-Oct-2015 deraadt

create libc stubs for dnssocket() and dnsconnect()


# 1.131 09-Oct-2015 deraadt

tame -> pledge conversion, in libc. I should crank libc, but am cheating
hoping things go well. The old symbol is faked via a stupid stub function,
until next major crank when it can be removed. I am expecting guenther
to scream at me.


# 1.130 13-Sep-2015 guenther

Rename __sysctl syscall to just sysctl, as the userland wrapper is no longer
necessary

ok deraadt@ jsing@


# 1.129 09-Sep-2015 guenther

Simplify makefile rules for building the ASM stubs into "pick something
from column A and something from column B".

ok miod@ deraadt@


# 1.128 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@


# 1.127 25-Aug-2015 guenther

Document kbind(2)


Revision tags: OPENBSD_5_8_BASE
# 1.126 19-Jul-2015 deraadt

manual page for tame(2). not very good, so i will be hearing from jmc


# 1.125 07-Apr-2015 guenther

Make pthread_atfork() track the DSO that called it like atexit() does,
unregistering callbacks if the DSO is unloaded. Move the callback
handling from libpthread to libc, though libpthread still overrides the
inner call to handle locking and thread-library reinitialization.
Major version bump for both libc and libpthread.

verification that this fixes various ports ajacoutot@
asm assistance miod@; ok millert@ deraadt@


Revision tags: OPENBSD_5_7_BASE
# 1.124 08-Dec-2014 guenther

Add chflagsat(), modeled on fchmodat() with name to match FreeBSD.


# 1.123 14-Nov-2014 guenther

Add sched_yield(2) manpage


# 1.122 31-Aug-2014 guenther

Declare and document getthrid()

indirectly prodded by krw@


# 1.121 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@


# 1.120 14-Aug-2014 tobias

fixed overrid(d)en typo

millert@ and jmc@ agree that "overriden" is wrong


Revision tags: OPENBSD_5_6_BASE
# 1.119 12-Jul-2014 deraadt

document sendsyslog(2); ok guenther tedu matthew


# 1.118 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.117 18-Mar-2014 miod

Retire hp300, mvme68k and mvme88k ports. These ports have no users, keeping
this hardware alive is becoming increasingly difficult, and I should heed the
message sent by the three disks which have died on me over the last few days.

Noone sane will mourn these ports anyway. So long, and thanks for the fish.


Revision tags: OPENBSD_5_5_BASE
# 1.116 13-Oct-2013 guenther

Make it possible to build to reduced version of a library, including
just specific objects that are compiled with additional options to
reduce their size. For use by distrib/ and crunchgen.

style and naming assistance from espie@


# 1.115 07-Oct-2013 guenther

getdirentries(2) is dead; long live getdents(2)!

confirmation that getdirentries(2) is unused by ports from sthen@ and naddy@


# 1.114 13-Aug-2013 guenther

Switch time_t, ino_t, clock_t, and struct kevent's ident and data
members to 64bit types. Assign new syscall numbers for (almost
all) the syscalls that involve the affected types, including anything
with time_t, timeval, itimerval, timespec, rusage, dirent, stat,
or kevent arguments. Add a d_off member to struct dirent and replace
getdirentries() with getdents(), thus immensely simplifying and
accelerating telldir/seekdir. Build perl with -DBIG_TIME.

Bump the major on every single base library: the compat bits included
here are only good enough to make the transition; the T32 compat
option will be burned as soon as we've reached the new world are
are happy with the snapshots for all architectures.

DANGER: ABI incompatibility. Updating to this kernel requires extra
work or you won't be able to login: install a snapshot instead.

Much assistance in fixing userland issues from deraadt@ and tedu@
and build assistance from todd@ and otto@


Revision tags: OPENBSD_5_4_BASE
# 1.113 05-Jun-2013 guenther

Move _Exit() from the exit() manpage to the _exit() manpage, as it's
just an alias of the latter.

ok matthew@ tedu@


# 1.112 01-Jun-2013 miod

Add utrace(2), a system call allowing for userland to send its own ktrace
records. From FreeBSD via otto@, with tweaks suggested by guenther@.
Commite on behalf of otto@ who is not around, to ride the libc minor bump.
Causes a librthread minor bump as well (new syscall).


# 1.111 29-Apr-2013 matthew

Extend P_SIGSUSPEND handling in userret() to properly restore the
sigmask even if there are no pending signals under the temporary
sigmask.

Refactor existing select() and poll() system calls to introduce the
pselect() and ppoll() system calls.

Add rthread wrappers for pselect() and ppoll(). While there, update
cancellation point comments to reflect recent fdatasync() addition.

Minor bumps for libc and librthread due to new symbols.

ok guenther, millert, deraadt, jmc


# 1.110 15-Apr-2013 matthew

Implement fdatasync() as a wrapper around fsync()

ok guenther, deraadt, jmc


Revision tags: OPENBSD_5_3_BASE
# 1.109 03-Feb-2013 miod

gremlin crept in


# 1.108 02-Feb-2013 miod

Userland bits for m68k/ELF. Mostly addition of register prefixes to the
assembler instructions, and cope with the few changes in return values
location.


# 1.107 04-Sep-2012 okan

remove lint leftovers; ok guenther@


# 1.106 23-Aug-2012 deraadt

no more nnpfspioctl() system call; ok guenther


# 1.105 22-Aug-2012 pascal

Convert cpp | as rules in bsd.lib.mk and lib/libc/sys/Makefile.inc to pure cc
invocations. This allows us to use the compiler builtin define __PIC__ to check
for PIC/PIEness rather than passing -DPIC. Simplifies PIE work a lot.

ok matthew@, conceptually ok kurt@


# 1.104 21-Aug-2012 pascal

Kill an old mips workaround; we don't support mips, just mips64.

ok deraadt@ kettenis@


Revision tags: OPENBSD_5_2_BASE
# 1.103 19-Jun-2012 deraadt

oops, forgot to install getdtablecount(2); noted by tedu


# 1.102 12-Apr-2012 deraadt

remove rfork(); ok guenther miod


# 1.101 12-Apr-2012 deraadt

kill lfs system call lines and libc stubs


# 1.100 12-Apr-2012 deraadt

New system call: getdtablecount(2) returns the number of file
descriptors the process currently has open.
ok guenther miod gilles ...


# 1.99 22-Mar-2012 guenther

Move __tfork_thread() from rthreads (libpthread) to libc so that
it can be used for not-strictly-threading purposes

ok matthew@ kurt@


# 1.98 13-Mar-2012 guenther

Add manpages for __thrsigdivert, __thrsleep, and __thrwakeup. Various
syntax and grammar fixes from jmc@


Revision tags: OPENBSD_5_1_BASE
# 1.97 17-Jan-2012 guenther

Reimplement mutexes, condvars, and rwlocks to eliminate bugs,
particularly the "consume the signal you just sent" hang, and putting
the wait queues in userspace.

Do cancellation handling in pthread_cond_*wait(), pthread_join(),
and sem_wait().

Add __ prefix to thr{sleep,wakeup,exit,sigdivert}() syscalls; add
'abort" argument to thrsleep to close cancellation race; make
thr{sleep,wakeup} return errno values via *retval to avoid touching
userspace errno.


# 1.96 22-Nov-2011 guenther

sigstack() is long dead, and the compat sigaltstack syscall is gone too.
Correct the namespace protections for sigreturn(), sigwait(), and psignal()

ok millert@


# 1.95 16-Oct-2011 guenther

Add stubs and manpage for __{get,set}_tcb

ok deraadt@


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

Add (rough draft) documentation for fdopendir(3) and the 15 new
XXXat(2) system calls from POSIX 2008. Editing will be done in tree.

General style discussed with jmc@, schwarze@, and deraadt@
ok jmc@


# 1.93 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@


Revision tags: OPENBSD_4_8_BASE OPENBSD_4_9_BASE
# 1.92 03-Jul-2010 guenther

Fix the naming of interfaces and variables for rdomains and rtables
and make it possible to bind sockets (including listening sockets!)
to rtables and not just rdomains. This changes the name of the
system calls, socket option, and ioctl. After building with this
you should remove the files /usr/share/man/cat2/[gs]etrdomain.0.

Since this removes the existing [gs]etrdomain() system calls, the
libc major is bumped.

Written by claudio@, criticized^Wcritiqued by me


# 1.91 01-Jul-2010 deraadt

getpeereid() can now be a library routine using getsockopt() with
SOL_SOCKET and SO_PEERCRED, only issue being that it cannot return
EFAULT for a page fault. The kernel code will soon be put into
compat, and then in 10 years or so tedu will delete it.
ok guenther millert


# 1.90 18-May-2010 tedu

add posix_madvise, posix_memalign, strndup, and strnlen. mostly from
brad and millert, with hints from guenther, jmc, and otto I think.
ok previous.


Revision tags: OPENBSD_4_7_BASE
# 1.89 03-Feb-2010 miod

Use MACHINE_CPU instead of MACHINE_ARCH to pick the correct machine dependent
files or directories when applicable.
The inspiration and name of MACHINE_CPU come from NetBSD, although the way to
provide it to Makefiles is completely different.
ok kettenis@


# 1.88 27-Nov-2009 guenther

Add setrdomain() and getrdomain() system calls. Committing now to
catch the libc major bump per request from deraadt@

Diff by reyk.

ok guenther@


# 1.87 13-Aug-2009 jmc

various MLINK fixes from Alan R. S. Bueno;


Revision tags: OPENBSD_4_6_BASE
# 1.86 03-Jun-2009 jj

Arla client rename from xfs to nnpfs for later upgrades. Tested on various arches. ok todd@ beck@


Revision tags: OPENBSD_4_4_BASE OPENBSD_4_5_BASE
# 1.85 22-Mar-2008 otto

move statvfs.c to gen, since it is not a syscall; ok deraadt@


# 1.84 16-Mar-2008 otto

statvfs support


Revision tags: OPENBSD_4_3_BASE
# 1.83 05-Jan-2008 deraadt

no more need for vadvise.o


# 1.82 09-Sep-2007 otto

Add lint stubs for the longjmp family of functions which are defined in
assembly on all platforms. ok deraadt@


# 1.81 09-Sep-2007 otto

Silence erroneous "environ used, but not defined" lint warning by
providing a stub. ok deraadt@


Revision tags: OPENBSD_4_1_BASE OPENBSD_4_2_BASE
# 1.80 24-Oct-2006 tedu

add rthread syscalls and bump minor.
rthreads are hardly done, but if just trying it out is too much of a hassle,
we'll never make more progress.
ok brad marc marco mbalmer


# 1.79 10-Oct-2006 deraadt

MLINKS to macros described in stat(2)


Revision tags: OPENBSD_4_0_BASE
# 1.78 14-Jun-2006 otto

Introducing adjfreq(2), to adjust the clock frequency.
Loosely based on dragonfly code. Man page help fro jmc@; ok deraadt@


# 1.77 27-May-2006 pedro

Make libc's getcwd() use the new __getcwd() system call
Hacked by marius@ at c2k5, okay miod@ krw@ deraadt@


# 1.76 13-Mar-2006 moritz

Clean the correct file. ok deraadt@


Revision tags: OPENBSD_3_9_BASE
# 1.75 29-Nov-2005 deraadt

Provide stubs for things which are supplied by crt0. I don't think we
want a crt0.ln, at least, not yet. We may reconsider later.


# 1.74 03-Oct-2005 jmc

add missing MLINK for WEXITSTATUS.2


Revision tags: OPENBSD_3_8_BASE
# 1.73 17-Jun-2005 drahn

Extended Attributes was a piece to get to ACLs, however ACLs have not
been worked on, so EA is pointless to maintain.


# 1.72 17-Jun-2005 millert

remove undelete syscall


Revision tags: OPENBSD_3_7_BASE
# 1.71 18-Sep-2004 deraadt

MLINK to macros provided in wait.2


# 1.70 16-Sep-2004 deraadt

add files missing for building a proper lint library


Revision tags: OPENBSD_3_5_BASE OPENBSD_3_6_BASE
# 1.69 13-Feb-2004 tedu

death to osigaltstack. ok deraadt@


# 1.68 15-Jan-2004 deraadt

ABI breakage happened with the sigaltstack replacement. It is too late,
now we just have to cope. Since setjmp uses it, the alpha and sparc64 are
unhappy with the structure change. In a few days, we will make the second
hop here, for now, use the old system call until all binaries have the new
struct in them.


# 1.67 12-Jan-2004 tedu

new syscall closefrom(2). ok deraadt millert


Revision tags: OPENBSD_3_4_BASE
# 1.66 10-May-2003 miod

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


# 1.65 14-Apr-2003 art

There are two related changes.

The first one is an mquery(2) syscall. It's for asking the VM system
about where to map things. It will be used by ld.so, read the man page
for details.

The second change is related and is a centralization of uvm_map hint
that all callers of uvm_map calculated. This will allow us to adjust
this hint on architectures that have segments for non-exec mappings.

deraadt@ drahn@ ok.


Revision tags: OPENBSD_3_3_BASE
# 1.64 31-Jan-2003 millert

Replace emulated versions of setreuid() and setregid() with real syscalls.
These are spec'd by POSIX as of 1003.1-2001; deraadt@ OK


# 1.63 02-Dec-2002 millert

Document getlogin_r()


# 1.62 02-Dec-2002 miod

Import propolice (http://www.trl.ibm.com/projects/security/ssp), a stack
attack protection scheme, into gcc.

This protection is enabled by default. It can be turned off by using the
-fno-stack-protector flag.

Code by Hiroaki Etoh (etoh at jp dot ibm dot com); work on openbsd-specific
integration by fgsch@, deraadt@ and myself; tests by fgsch@, naddy@ and
myself; beer drinking by myself.

Please note that system upgrades with this new code will require a new
libc and ld.so to be build and installed before the propolice-enabled
compiler can be installed.


# 1.61 10-Nov-2002 fgsch

missing MLINKs for setresuid(2). millert ok.


# 1.60 05-Nov-2002 marc

thread safe libc -- 2nd try. OK miod@, millert@
Thanks to miod@ for m68k and vax fixes


# 1.59 03-Nov-2002 marc

back out previous patch.. there are still some vax/m68k issues


# 1.58 03-Nov-2002 marc

libc changes for thread safety. Tested on:
alpha (millert@), i386 (marc@), m68k (millert@ and miod@),
powerpc (drahn@ and dhartmei@), sparc (millert@ and marc@),
sparc64 (marc@), and vax (millert@ and miod@).
Thanks to millert@, miod@, and mickey@ for fixes along the way.


# 1.57 30-Oct-2002 millert

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


Revision tags: OPENBSD_3_2_BASE
# 1.56 05-Aug-2002 art

Fix brain blackout.
Pointed out byb miod@.


# 1.55 05-Aug-2002 art

One more ELF_TOOLCHAIN.


# 1.54 06-Jul-2002 nordin

Remove kernel support for NTP. ok deraadt@ and tholo@


# 1.53 10-Jun-2002 fgsch

correct comment.


# 1.52 08-Jun-2002 drahn

ELF architectures all support weak aliases, enable them for this part.
ok fgsch@


Revision tags: OPENBSD_3_1_BASE
# 1.51 22-Feb-2002 drahn

Extended Attribute support, from FreeBSD/TrustedBSD. ok art@ deraadt@
libc support pieces


# 1.50 21-Feb-2002 art

remove rfork.o from the auto-generated assembler stubs


# 1.49 17-Feb-2002 deraadt

rfork() needs a fork.S-like stub as well; ok art


Revision tags: OPENBSD_3_0_BASE
# 1.48 25-Sep-2001 niklas

Forgotten DEBUGLIBS stuff


# 1.47 25-Sep-2001 drahn

Add an ASPICFLAG variable to bsd.own.mk which a platform use to pass flags
to 'as' to make it compile pic. add defaults for sparc64 which needs picflags
set to -fPIC and ASPICFLAGS to -KPIC.
Also simplifies the systemcall generation for sparc64 PIC mode.
ok epsie@.


# 1.46 20-Sep-2001 millert

Add PSEUDO_NOERROR similar to that used by NetBSD.
Some ports were setting errno in PSEUDO and some were not. Now errno
is set for all in PSEUDO and PSEUDO_NOERROR is provided for the
non-errno case (only used by _exit).

Needs testing on vax and m88k.
XXX - hppa and powerpc still lack a real PSEUDO_NOERROR implementation.
Currently PSEUDO_NOERROR and PSEUDO are the same (so builds don't
break on those platforms).


# 1.45 09-Jul-2001 fgsch

Install getpeereid(2) manpage.


# 1.44 26-Jun-2001 dugsong

implement djb's getpeereid(2), to allow local-domain servers to determine client credentials. mostly from superscript.com. deraadt@ ok


Revision tags: OPENBSD_2_9_BASE
# 1.43 14-Mar-2001 aaron

Move description of exect() to execve(2) man page. Add a note about exect() not
being portable.


# 1.42 09-Mar-2001 art

Add mlockall and munlockall. man-page from NetBSD.


# 1.41 10-Jan-2001 deraadt

put up FD_* manual pages, in section 3


# 1.40 23-Dec-2000 deraadt

create proper docs for timer{add,clear,sub,isset,cmp}


# 1.39 16-Nov-2000 provos

kqueue and kevent system calls


Revision tags: OPENBSD_2_8_BASE
# 1.38 17-Oct-2000 deraadt

damn it, i have had it with this untested weak shit


# 1.37 16-Oct-2000 deraadt

re-add weak sparc support; d@


# 1.36 15-May-2000 niklas

Add support for building libraries with debugging information in them.
Enable by setting DEBUGLIBS=yes in /etc/mk.conf, then -g libraries will get
installed in /usr/lib/debug. This directory will be searched first if
gcc is given the -g flag during the link stage.


Revision tags: OPENBSD_2_7_BASE
# 1.35 01-May-2000 deraadt

bye bye semconfig(2)


# 1.34 20-Apr-2000 deraadt

p{read,write}{,v} man pages


# 1.33 07-Feb-2000 assar

add fhopen, fhstat, fhstatfs system calls. largely from NetBSD


# 1.32 06-Jan-2000 d

for now, disable weak aliases for all archs except i386


# 1.31 14-Dec-1999 millert

Install swapctl.2, not swapon.2. swapon.2 should probably go away.


Revision tags: OPENBSD_2_6_BASE
# 1.30 07-Jun-1999 deraadt

replacement pipe() system call; copies data into place inside kernel, so
that EFAULT return value is possible


# 1.29 22-May-1999 weingart

Add swapctl(2), and crank shlib minor.


Revision tags: OPENBSD_2_5_BASE
# 1.28 01-Feb-1999 d

mi ptrace


# 1.27 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


Revision tags: OPENBSD_2_4_BASE
# 1.26 18-Sep-1998 art

make use of xfspioctl


Revision tags: OPENBSD_2_3_BASE
# 1.25 08-Feb-1998 tholo

Better lint(1) framework. Mostly from cgd@NetBSD


# 1.24 13-Nov-1997 deraadt

add getsid(2), XPG4


Revision tags: OPENBSD_2_2_BASE
# 1.23 30-May-1997 kstailey

add getpgrp(2) from NetBSD


Revision tags: OPENBSD_2_1_BASE
# 1.22 08-May-1997 kstailey

add tag


# 1.21 08-May-1997 kstailey

make clock_gettime.cat2


# 1.20 20-Apr-1997 tholo

New POSIX 1003.1b syscalls; from pk@NetBSD


# 1.19 04-Apr-1997 deraadt

seek(2) is not needed


# 1.18 29-Mar-1997 deraadt

futimes link; nakayosh@kcn.or.jp


# 1.17 26-Mar-1997 deraadt

install ktrace(2)


# 1.16 26-Jan-1997 downsj

Add a link for lchown.2


# 1.15 26-Jan-1997 downsj

Add lchown(), increment minor number.


# 1.14 11-Dec-1996 deraadt

generate reboot.o like other system calls


Revision tags: OPENBSD_2_0_BASE
# 1.13 02-Sep-1996 deraadt

shmdt link


# 1.12 25-Aug-1996 deraadt

and a man page


# 1.11 18-Jun-1996 deraadt

build poll.o


# 1.10 19-May-1996 pefo

Changes for mips.


# 1.9 18-May-1996 deraadt

poll() as a system call


# 1.8 08-May-1996 deraadt

install rfork man page


# 1.7 01-May-1996 deraadt

add futimes


# 1.6 25-Mar-1996 tholo

Add support for building lint(1) library


# 1.5 29-Jan-1996 tholo

Add kernel PLL for system clock
Add ntp_adjtime() and ntp_gettime() system calls
Mostly stolen from FreeBSD


# 1.4 08-Jan-1996 deraadt

add rfork.o and minherit.o


# 1.3 07-Jan-1996 deraadt

add minherit() system call


# 1.2 14-Dec-1995 deraadt

from netbsd:
add & fix a bunch of system call pages


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.159 06-Jul-2020 pirofti

Add support for timeconting in userland.

This diff exposes parts of clock_gettime(2) and gettimeofday(2) to
userland via libc eliberating processes from the need for a context
switch everytime they want to count the passage of time.

If a timecounter clock can be exposed to userland than it needs to set
its tc_user member to a non-zero value. Tested with one or multiple
counters per architecture.

The timing data is shared through a pointer found in the new ELF
auxiliary vector AUX_openbsd_timekeep containing timehands information
that is frequently updated by the kernel.

Timing differences between the last kernel update and the current time
are adjusted in userland by the tc_get_timecount() function inside the
MD usertc.c file.

This permits a much more responsive environment, quite visible in
browsers, office programs and gaming (apparently one is are able to fly
in Minecraft now).

Tested by robert@, sthen@, naddy@, kmos@, phessler@, and many others!

OK from at least kettenis@, cheloha@, naddy@, sthen@


Revision tags: OPENBSD_6_7_BASE
# 1.158 27-Nov-2019 deraadt

Document msyscall(2): ld.so can use this (once only) to tell the kernel
where libc.so's text segment is, thereby allowing invocation of system
calls from that region. An upcoming change will kill the process if a
system call is invoked from addresses not explicitly permitted.
ok guenther kettenis mortimer


Revision tags: OPENBSD_6_6_BASE
# 1.157 28-May-2019 beck

Enable the use of the kernel __realpath() system call in the libc wrapper.

For now, this also still uses the existing realpath implmentation
and emits a syslog if we see differening results. Once we have run
with that for a little while we will remove the old code

ok deraadt@


Revision tags: OPENBSD_6_5_BASE
# 1.156 11-Jan-2019 deraadt

mincore() is a relic from the past, exposing physical machine information
about shared resources which no program should see. only a few pieces of
software use it, generally poorly thought out. they are being fixed, so
mincore() can be deleted.
ok guenther tedu jca sthen, others


Revision tags: OPENBSD_6_4_BASE
# 1.155 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.154 12-Jan-2018 deraadt

sysctl(3) can now be renamed to sysctl(2)


# 1.153 28-Nov-2017 guenther

Delete fktrace(2). The consequences of it were not thought through
sufficiently and at least one horrific security hole was the result.

ok deraadt@ beck@


Revision tags: OPENBSD_6_2_BASE
# 1.152 13-Aug-2017 tedu

add fktrace to libc


# 1.151 12-Aug-2017 guenther

Instead of hardcoding a partial dependency list for the syscall stub objects,
calculate them as done for other objects


# 1.150 31-May-2017 sthen

install futex(2), ok mpi


# 1.149 30-Apr-2017 mpi

Add futex(2) shim, bump minor.

Inputs from guenther@, ok kettenis@, visa@


Revision tags: OPENBSD_6_1_BASE
# 1.148 29-Mar-2017 deraadt

The hppa version of as(1) requires whitespace before a .file directive,
it may not be in column 0. This kind of thing is very common in GNU
and Linux software because the software was written from the start to
be 'compatible replacements' of vendor software.
ok jsing guenther


# 1.147 26-Mar-2017 guenther

Use .file to convince 'as' to generate proper FILE symbols in the syscall
stubs that aren't actually in files, so that syspatch can figure out what
order the syscall stub objects are in the .so. Use -P to suppress to #line
directives that would override that. Tested with both gcc/gas and clang.

ok deraadt@


Revision tags: OPENBSD_6_0_BASE
# 1.146 04-Jul-2016 guenther

DEBUGLIBS has been broken since the gcc4 switch, so delete it. CFLAGS
contains -g by default anyway

problem noted by Edgar Pettijohn (edgar (at) pettijohn-web.com)
ok millert@ kettenis@ deraadt@


# 1.145 30-May-2016 guenther

Move __getcwd from ASM to HIDDEN: we don't want the literal __getcwd symbol

ok millert@ deraadt@


# 1.144 19-May-2016 guenther

Add ASM_NOERR for syscalls that never fail and thus don't need the errno
setting logic...which can significantly reduce the size of the stub on
some archs; 20 syscalls get a trim with this.

in snaps for a bit and ok deraadt@


# 1.143 09-May-2016 guenther

Remove sigreturn declaration and the now-unused libc syscall stub


# 1.142 07-May-2016 guenther

Use a Thread Information Block in both single and multi-threaded programs.
This stores errno, the cancelation flags, and related bits for each thread
and is allocated by ld.so or libc.a. This is an ABI break from 5.9-stable!

Make libpthread dlopen'able by moving the cancelation wrappers into libc
and doing locking and fork/errno handling via callbacks that libpthread
registers when it first initializes. 'errno' *must* be declared via
<errno.h> now!

Clean up libpthread's symbol exports like libc.

On powerpc, offset the TIB/TCB/TLS data from the register per the ELF spec.

Testing by various, particularly sthen@ and patrick@
ok kettenis@


# 1.141 30-Mar-2016 guenther

Turd polish: use HIDDEN= instead of PSEUDO= for ptrace syscall stub, to
make its underlying symbol name look like others.


# 1.140 30-Mar-2016 guenther

Eliminate userspace caching by getlogin_r/setlogin; make the getlogin
syscall behave exactly like userspace getlogin_r() and rename it to
match. Eliminate the reduced-to-no-op wrappers of the syscalls.
Eliminate the unnecessary per-thread static buffering by getlogin().

ok kettenis@ deraadt@


# 1.139 30-Mar-2016 jmc

for some time now mandoc has not required MLINKS to function
correctly - logically complete that now by removing MLINKS from base;

authors need only to ensure there is an entry in NAME for any function/
util being added. MLINKS will still work, and remain for perl to ease
upgrades;

ok nicm (curses) bcook (ssl)
ok schwarze, who provided a lot of feedback and assistance
ok tb natano jung


# 1.138 21-Mar-2016 bluhm

Rename the system call sendsyslog2 to sendsyslog. Keep the old one
as osendsyslog for a while. The three argument variant is the only
one that will stay.
input kettenis@; OK deraadt@


Revision tags: OPENBSD_5_9_BASE
# 1.137 25-Nov-2015 deraadt

Add a syscall stub for sendsyslog2(2), and use it in syslog_r(3), passing
LOG_CONS to the kernel. As a result, the /dev/console opening code can
be removed.
ok kettenis millert beck


# 1.136 10-Nov-2015 guenther

Split the intra-thread functionality from kill(2) into its own syscall
thrkill(2), rolling the kill(2) syscall number with the ABI change to
avoid breaking binaries during during the transition. thrkill(2) includes
a 'tcb' argument that eliminates the need for locking in pthread_kill()
and simplifies pthread_cancel(). Switch __stack_smash_handler() to use
thrkill(2) and explicitly unblock SIGABRT.

Minor bump to both libc and libpthread: make sure you install a new kernel!

ok semarie@


# 1.135 23-Oct-2015 guenther

Merge the sigaction() and sigprocmask() overloads/wrappers from libpthread
into libc, and move pthread_sigmask() as well (just a trivial wrapper).
This provides consistent handling of SIGTHR between single- and multi-threaded
programs and is a step in the merge of all the libpthread overloads, providing
some ASM and Makefile bits that the other wrappers will need.

ok deraadt@ millert@


# 1.134 23-Oct-2015 deraadt

Remove dnssocket() and dnsconnect(), since we decided to use a SOCK_DNS
flag instead.
ok guenther tedu semarie


# 1.133 19-Oct-2015 deraadt

Remove old tame() stub


# 1.132 18-Oct-2015 deraadt

create libc stubs for dnssocket() and dnsconnect()


# 1.131 09-Oct-2015 deraadt

tame -> pledge conversion, in libc. I should crank libc, but am cheating
hoping things go well. The old symbol is faked via a stupid stub function,
until next major crank when it can be removed. I am expecting guenther
to scream at me.


# 1.130 13-Sep-2015 guenther

Rename __sysctl syscall to just sysctl, as the userland wrapper is no longer
necessary

ok deraadt@ jsing@


# 1.129 09-Sep-2015 guenther

Simplify makefile rules for building the ASM stubs into "pick something
from column A and something from column B".

ok miod@ deraadt@


# 1.128 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@


# 1.127 25-Aug-2015 guenther

Document kbind(2)


Revision tags: OPENBSD_5_8_BASE
# 1.126 19-Jul-2015 deraadt

manual page for tame(2). not very good, so i will be hearing from jmc


# 1.125 07-Apr-2015 guenther

Make pthread_atfork() track the DSO that called it like atexit() does,
unregistering callbacks if the DSO is unloaded. Move the callback
handling from libpthread to libc, though libpthread still overrides the
inner call to handle locking and thread-library reinitialization.
Major version bump for both libc and libpthread.

verification that this fixes various ports ajacoutot@
asm assistance miod@; ok millert@ deraadt@


Revision tags: OPENBSD_5_7_BASE
# 1.124 08-Dec-2014 guenther

Add chflagsat(), modeled on fchmodat() with name to match FreeBSD.


# 1.123 14-Nov-2014 guenther

Add sched_yield(2) manpage


# 1.122 31-Aug-2014 guenther

Declare and document getthrid()

indirectly prodded by krw@


# 1.121 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@


# 1.120 14-Aug-2014 tobias

fixed overrid(d)en typo

millert@ and jmc@ agree that "overriden" is wrong


Revision tags: OPENBSD_5_6_BASE
# 1.119 12-Jul-2014 deraadt

document sendsyslog(2); ok guenther tedu matthew


# 1.118 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.117 18-Mar-2014 miod

Retire hp300, mvme68k and mvme88k ports. These ports have no users, keeping
this hardware alive is becoming increasingly difficult, and I should heed the
message sent by the three disks which have died on me over the last few days.

Noone sane will mourn these ports anyway. So long, and thanks for the fish.


Revision tags: OPENBSD_5_5_BASE
# 1.116 13-Oct-2013 guenther

Make it possible to build to reduced version of a library, including
just specific objects that are compiled with additional options to
reduce their size. For use by distrib/ and crunchgen.

style and naming assistance from espie@


# 1.115 07-Oct-2013 guenther

getdirentries(2) is dead; long live getdents(2)!

confirmation that getdirentries(2) is unused by ports from sthen@ and naddy@


# 1.114 13-Aug-2013 guenther

Switch time_t, ino_t, clock_t, and struct kevent's ident and data
members to 64bit types. Assign new syscall numbers for (almost
all) the syscalls that involve the affected types, including anything
with time_t, timeval, itimerval, timespec, rusage, dirent, stat,
or kevent arguments. Add a d_off member to struct dirent and replace
getdirentries() with getdents(), thus immensely simplifying and
accelerating telldir/seekdir. Build perl with -DBIG_TIME.

Bump the major on every single base library: the compat bits included
here are only good enough to make the transition; the T32 compat
option will be burned as soon as we've reached the new world are
are happy with the snapshots for all architectures.

DANGER: ABI incompatibility. Updating to this kernel requires extra
work or you won't be able to login: install a snapshot instead.

Much assistance in fixing userland issues from deraadt@ and tedu@
and build assistance from todd@ and otto@


Revision tags: OPENBSD_5_4_BASE
# 1.113 05-Jun-2013 guenther

Move _Exit() from the exit() manpage to the _exit() manpage, as it's
just an alias of the latter.

ok matthew@ tedu@


# 1.112 01-Jun-2013 miod

Add utrace(2), a system call allowing for userland to send its own ktrace
records. From FreeBSD via otto@, with tweaks suggested by guenther@.
Commite on behalf of otto@ who is not around, to ride the libc minor bump.
Causes a librthread minor bump as well (new syscall).


# 1.111 29-Apr-2013 matthew

Extend P_SIGSUSPEND handling in userret() to properly restore the
sigmask even if there are no pending signals under the temporary
sigmask.

Refactor existing select() and poll() system calls to introduce the
pselect() and ppoll() system calls.

Add rthread wrappers for pselect() and ppoll(). While there, update
cancellation point comments to reflect recent fdatasync() addition.

Minor bumps for libc and librthread due to new symbols.

ok guenther, millert, deraadt, jmc


# 1.110 15-Apr-2013 matthew

Implement fdatasync() as a wrapper around fsync()

ok guenther, deraadt, jmc


Revision tags: OPENBSD_5_3_BASE
# 1.109 03-Feb-2013 miod

gremlin crept in


# 1.108 02-Feb-2013 miod

Userland bits for m68k/ELF. Mostly addition of register prefixes to the
assembler instructions, and cope with the few changes in return values
location.


# 1.107 04-Sep-2012 okan

remove lint leftovers; ok guenther@


# 1.106 23-Aug-2012 deraadt

no more nnpfspioctl() system call; ok guenther


# 1.105 22-Aug-2012 pascal

Convert cpp | as rules in bsd.lib.mk and lib/libc/sys/Makefile.inc to pure cc
invocations. This allows us to use the compiler builtin define __PIC__ to check
for PIC/PIEness rather than passing -DPIC. Simplifies PIE work a lot.

ok matthew@, conceptually ok kurt@


# 1.104 21-Aug-2012 pascal

Kill an old mips workaround; we don't support mips, just mips64.

ok deraadt@ kettenis@


Revision tags: OPENBSD_5_2_BASE
# 1.103 19-Jun-2012 deraadt

oops, forgot to install getdtablecount(2); noted by tedu


# 1.102 12-Apr-2012 deraadt

remove rfork(); ok guenther miod


# 1.101 12-Apr-2012 deraadt

kill lfs system call lines and libc stubs


# 1.100 12-Apr-2012 deraadt

New system call: getdtablecount(2) returns the number of file
descriptors the process currently has open.
ok guenther miod gilles ...


# 1.99 22-Mar-2012 guenther

Move __tfork_thread() from rthreads (libpthread) to libc so that
it can be used for not-strictly-threading purposes

ok matthew@ kurt@


# 1.98 13-Mar-2012 guenther

Add manpages for __thrsigdivert, __thrsleep, and __thrwakeup. Various
syntax and grammar fixes from jmc@


Revision tags: OPENBSD_5_1_BASE
# 1.97 17-Jan-2012 guenther

Reimplement mutexes, condvars, and rwlocks to eliminate bugs,
particularly the "consume the signal you just sent" hang, and putting
the wait queues in userspace.

Do cancellation handling in pthread_cond_*wait(), pthread_join(),
and sem_wait().

Add __ prefix to thr{sleep,wakeup,exit,sigdivert}() syscalls; add
'abort" argument to thrsleep to close cancellation race; make
thr{sleep,wakeup} return errno values via *retval to avoid touching
userspace errno.


# 1.96 22-Nov-2011 guenther

sigstack() is long dead, and the compat sigaltstack syscall is gone too.
Correct the namespace protections for sigreturn(), sigwait(), and psignal()

ok millert@


# 1.95 16-Oct-2011 guenther

Add stubs and manpage for __{get,set}_tcb

ok deraadt@


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

Add (rough draft) documentation for fdopendir(3) and the 15 new
XXXat(2) system calls from POSIX 2008. Editing will be done in tree.

General style discussed with jmc@, schwarze@, and deraadt@
ok jmc@


# 1.93 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@


Revision tags: OPENBSD_4_8_BASE OPENBSD_4_9_BASE
# 1.92 03-Jul-2010 guenther

Fix the naming of interfaces and variables for rdomains and rtables
and make it possible to bind sockets (including listening sockets!)
to rtables and not just rdomains. This changes the name of the
system calls, socket option, and ioctl. After building with this
you should remove the files /usr/share/man/cat2/[gs]etrdomain.0.

Since this removes the existing [gs]etrdomain() system calls, the
libc major is bumped.

Written by claudio@, criticized^Wcritiqued by me


# 1.91 01-Jul-2010 deraadt

getpeereid() can now be a library routine using getsockopt() with
SOL_SOCKET and SO_PEERCRED, only issue being that it cannot return
EFAULT for a page fault. The kernel code will soon be put into
compat, and then in 10 years or so tedu will delete it.
ok guenther millert


# 1.90 18-May-2010 tedu

add posix_madvise, posix_memalign, strndup, and strnlen. mostly from
brad and millert, with hints from guenther, jmc, and otto I think.
ok previous.


Revision tags: OPENBSD_4_7_BASE
# 1.89 03-Feb-2010 miod

Use MACHINE_CPU instead of MACHINE_ARCH to pick the correct machine dependent
files or directories when applicable.
The inspiration and name of MACHINE_CPU come from NetBSD, although the way to
provide it to Makefiles is completely different.
ok kettenis@


# 1.88 27-Nov-2009 guenther

Add setrdomain() and getrdomain() system calls. Committing now to
catch the libc major bump per request from deraadt@

Diff by reyk.

ok guenther@


# 1.87 13-Aug-2009 jmc

various MLINK fixes from Alan R. S. Bueno;


Revision tags: OPENBSD_4_6_BASE
# 1.86 03-Jun-2009 jj

Arla client rename from xfs to nnpfs for later upgrades. Tested on various arches. ok todd@ beck@


Revision tags: OPENBSD_4_4_BASE OPENBSD_4_5_BASE
# 1.85 22-Mar-2008 otto

move statvfs.c to gen, since it is not a syscall; ok deraadt@


# 1.84 16-Mar-2008 otto

statvfs support


Revision tags: OPENBSD_4_3_BASE
# 1.83 05-Jan-2008 deraadt

no more need for vadvise.o


# 1.82 09-Sep-2007 otto

Add lint stubs for the longjmp family of functions which are defined in
assembly on all platforms. ok deraadt@


# 1.81 09-Sep-2007 otto

Silence erroneous "environ used, but not defined" lint warning by
providing a stub. ok deraadt@


Revision tags: OPENBSD_4_1_BASE OPENBSD_4_2_BASE
# 1.80 24-Oct-2006 tedu

add rthread syscalls and bump minor.
rthreads are hardly done, but if just trying it out is too much of a hassle,
we'll never make more progress.
ok brad marc marco mbalmer


# 1.79 10-Oct-2006 deraadt

MLINKS to macros described in stat(2)


Revision tags: OPENBSD_4_0_BASE
# 1.78 14-Jun-2006 otto

Introducing adjfreq(2), to adjust the clock frequency.
Loosely based on dragonfly code. Man page help fro jmc@; ok deraadt@


# 1.77 27-May-2006 pedro

Make libc's getcwd() use the new __getcwd() system call
Hacked by marius@ at c2k5, okay miod@ krw@ deraadt@


# 1.76 13-Mar-2006 moritz

Clean the correct file. ok deraadt@


Revision tags: OPENBSD_3_9_BASE
# 1.75 29-Nov-2005 deraadt

Provide stubs for things which are supplied by crt0. I don't think we
want a crt0.ln, at least, not yet. We may reconsider later.


# 1.74 03-Oct-2005 jmc

add missing MLINK for WEXITSTATUS.2


Revision tags: OPENBSD_3_8_BASE
# 1.73 17-Jun-2005 drahn

Extended Attributes was a piece to get to ACLs, however ACLs have not
been worked on, so EA is pointless to maintain.


# 1.72 17-Jun-2005 millert

remove undelete syscall


Revision tags: OPENBSD_3_7_BASE
# 1.71 18-Sep-2004 deraadt

MLINK to macros provided in wait.2


# 1.70 16-Sep-2004 deraadt

add files missing for building a proper lint library


Revision tags: OPENBSD_3_5_BASE OPENBSD_3_6_BASE
# 1.69 13-Feb-2004 tedu

death to osigaltstack. ok deraadt@


# 1.68 15-Jan-2004 deraadt

ABI breakage happened with the sigaltstack replacement. It is too late,
now we just have to cope. Since setjmp uses it, the alpha and sparc64 are
unhappy with the structure change. In a few days, we will make the second
hop here, for now, use the old system call until all binaries have the new
struct in them.


# 1.67 12-Jan-2004 tedu

new syscall closefrom(2). ok deraadt millert


Revision tags: OPENBSD_3_4_BASE
# 1.66 10-May-2003 miod

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


# 1.65 14-Apr-2003 art

There are two related changes.

The first one is an mquery(2) syscall. It's for asking the VM system
about where to map things. It will be used by ld.so, read the man page
for details.

The second change is related and is a centralization of uvm_map hint
that all callers of uvm_map calculated. This will allow us to adjust
this hint on architectures that have segments for non-exec mappings.

deraadt@ drahn@ ok.


Revision tags: OPENBSD_3_3_BASE
# 1.64 31-Jan-2003 millert

Replace emulated versions of setreuid() and setregid() with real syscalls.
These are spec'd by POSIX as of 1003.1-2001; deraadt@ OK


# 1.63 02-Dec-2002 millert

Document getlogin_r()


# 1.62 02-Dec-2002 miod

Import propolice (http://www.trl.ibm.com/projects/security/ssp), a stack
attack protection scheme, into gcc.

This protection is enabled by default. It can be turned off by using the
-fno-stack-protector flag.

Code by Hiroaki Etoh (etoh at jp dot ibm dot com); work on openbsd-specific
integration by fgsch@, deraadt@ and myself; tests by fgsch@, naddy@ and
myself; beer drinking by myself.

Please note that system upgrades with this new code will require a new
libc and ld.so to be build and installed before the propolice-enabled
compiler can be installed.


# 1.61 10-Nov-2002 fgsch

missing MLINKs for setresuid(2). millert ok.


# 1.60 05-Nov-2002 marc

thread safe libc -- 2nd try. OK miod@, millert@
Thanks to miod@ for m68k and vax fixes


# 1.59 03-Nov-2002 marc

back out previous patch.. there are still some vax/m68k issues


# 1.58 03-Nov-2002 marc

libc changes for thread safety. Tested on:
alpha (millert@), i386 (marc@), m68k (millert@ and miod@),
powerpc (drahn@ and dhartmei@), sparc (millert@ and marc@),
sparc64 (marc@), and vax (millert@ and miod@).
Thanks to millert@, miod@, and mickey@ for fixes along the way.


# 1.57 30-Oct-2002 millert

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


Revision tags: OPENBSD_3_2_BASE
# 1.56 05-Aug-2002 art

Fix brain blackout.
Pointed out byb miod@.


# 1.55 05-Aug-2002 art

One more ELF_TOOLCHAIN.


# 1.54 06-Jul-2002 nordin

Remove kernel support for NTP. ok deraadt@ and tholo@


# 1.53 10-Jun-2002 fgsch

correct comment.


# 1.52 08-Jun-2002 drahn

ELF architectures all support weak aliases, enable them for this part.
ok fgsch@


Revision tags: OPENBSD_3_1_BASE
# 1.51 22-Feb-2002 drahn

Extended Attribute support, from FreeBSD/TrustedBSD. ok art@ deraadt@
libc support pieces


# 1.50 21-Feb-2002 art

remove rfork.o from the auto-generated assembler stubs


# 1.49 17-Feb-2002 deraadt

rfork() needs a fork.S-like stub as well; ok art


Revision tags: OPENBSD_3_0_BASE
# 1.48 25-Sep-2001 niklas

Forgotten DEBUGLIBS stuff


# 1.47 25-Sep-2001 drahn

Add an ASPICFLAG variable to bsd.own.mk which a platform use to pass flags
to 'as' to make it compile pic. add defaults for sparc64 which needs picflags
set to -fPIC and ASPICFLAGS to -KPIC.
Also simplifies the systemcall generation for sparc64 PIC mode.
ok epsie@.


# 1.46 20-Sep-2001 millert

Add PSEUDO_NOERROR similar to that used by NetBSD.
Some ports were setting errno in PSEUDO and some were not. Now errno
is set for all in PSEUDO and PSEUDO_NOERROR is provided for the
non-errno case (only used by _exit).

Needs testing on vax and m88k.
XXX - hppa and powerpc still lack a real PSEUDO_NOERROR implementation.
Currently PSEUDO_NOERROR and PSEUDO are the same (so builds don't
break on those platforms).


# 1.45 09-Jul-2001 fgsch

Install getpeereid(2) manpage.


# 1.44 26-Jun-2001 dugsong

implement djb's getpeereid(2), to allow local-domain servers to determine client credentials. mostly from superscript.com. deraadt@ ok


Revision tags: OPENBSD_2_9_BASE
# 1.43 14-Mar-2001 aaron

Move description of exect() to execve(2) man page. Add a note about exect() not
being portable.


# 1.42 09-Mar-2001 art

Add mlockall and munlockall. man-page from NetBSD.


# 1.41 10-Jan-2001 deraadt

put up FD_* manual pages, in section 3


# 1.40 23-Dec-2000 deraadt

create proper docs for timer{add,clear,sub,isset,cmp}


# 1.39 16-Nov-2000 provos

kqueue and kevent system calls


Revision tags: OPENBSD_2_8_BASE
# 1.38 17-Oct-2000 deraadt

damn it, i have had it with this untested weak shit


# 1.37 16-Oct-2000 deraadt

re-add weak sparc support; d@


# 1.36 15-May-2000 niklas

Add support for building libraries with debugging information in them.
Enable by setting DEBUGLIBS=yes in /etc/mk.conf, then -g libraries will get
installed in /usr/lib/debug. This directory will be searched first if
gcc is given the -g flag during the link stage.


Revision tags: OPENBSD_2_7_BASE
# 1.35 01-May-2000 deraadt

bye bye semconfig(2)


# 1.34 20-Apr-2000 deraadt

p{read,write}{,v} man pages


# 1.33 07-Feb-2000 assar

add fhopen, fhstat, fhstatfs system calls. largely from NetBSD


# 1.32 06-Jan-2000 d

for now, disable weak aliases for all archs except i386


# 1.31 14-Dec-1999 millert

Install swapctl.2, not swapon.2. swapon.2 should probably go away.


Revision tags: OPENBSD_2_6_BASE
# 1.30 07-Jun-1999 deraadt

replacement pipe() system call; copies data into place inside kernel, so
that EFAULT return value is possible


# 1.29 22-May-1999 weingart

Add swapctl(2), and crank shlib minor.


Revision tags: OPENBSD_2_5_BASE
# 1.28 01-Feb-1999 d

mi ptrace


# 1.27 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


Revision tags: OPENBSD_2_4_BASE
# 1.26 18-Sep-1998 art

make use of xfspioctl


Revision tags: OPENBSD_2_3_BASE
# 1.25 08-Feb-1998 tholo

Better lint(1) framework. Mostly from cgd@NetBSD


# 1.24 13-Nov-1997 deraadt

add getsid(2), XPG4


Revision tags: OPENBSD_2_2_BASE
# 1.23 30-May-1997 kstailey

add getpgrp(2) from NetBSD


Revision tags: OPENBSD_2_1_BASE
# 1.22 08-May-1997 kstailey

add tag


# 1.21 08-May-1997 kstailey

make clock_gettime.cat2


# 1.20 20-Apr-1997 tholo

New POSIX 1003.1b syscalls; from pk@NetBSD


# 1.19 04-Apr-1997 deraadt

seek(2) is not needed


# 1.18 29-Mar-1997 deraadt

futimes link; nakayosh@kcn.or.jp


# 1.17 26-Mar-1997 deraadt

install ktrace(2)


# 1.16 26-Jan-1997 downsj

Add a link for lchown.2


# 1.15 26-Jan-1997 downsj

Add lchown(), increment minor number.


# 1.14 11-Dec-1996 deraadt

generate reboot.o like other system calls


Revision tags: OPENBSD_2_0_BASE
# 1.13 02-Sep-1996 deraadt

shmdt link


# 1.12 25-Aug-1996 deraadt

and a man page


# 1.11 18-Jun-1996 deraadt

build poll.o


# 1.10 19-May-1996 pefo

Changes for mips.


# 1.9 18-May-1996 deraadt

poll() as a system call


# 1.8 08-May-1996 deraadt

install rfork man page


# 1.7 01-May-1996 deraadt

add futimes


# 1.6 25-Mar-1996 tholo

Add support for building lint(1) library


# 1.5 29-Jan-1996 tholo

Add kernel PLL for system clock
Add ntp_adjtime() and ntp_gettime() system calls
Mostly stolen from FreeBSD


# 1.4 08-Jan-1996 deraadt

add rfork.o and minherit.o


# 1.3 07-Jan-1996 deraadt

add minherit() system call


# 1.2 14-Dec-1995 deraadt

from netbsd:
add & fix a bunch of system call pages


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.158 27-Nov-2019 deraadt

Document msyscall(2): ld.so can use this (once only) to tell the kernel
where libc.so's text segment is, thereby allowing invocation of system
calls from that region. An upcoming change will kill the process if a
system call is invoked from addresses not explicitly permitted.
ok guenther kettenis mortimer


Revision tags: OPENBSD_6_6_BASE
# 1.157 28-May-2019 beck

Enable the use of the kernel __realpath() system call in the libc wrapper.

For now, this also still uses the existing realpath implmentation
and emits a syslog if we see differening results. Once we have run
with that for a little while we will remove the old code

ok deraadt@


Revision tags: OPENBSD_6_5_BASE
# 1.156 11-Jan-2019 deraadt

mincore() is a relic from the past, exposing physical machine information
about shared resources which no program should see. only a few pieces of
software use it, generally poorly thought out. they are being fixed, so
mincore() can be deleted.
ok guenther tedu jca sthen, others


Revision tags: OPENBSD_6_4_BASE
# 1.155 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.154 12-Jan-2018 deraadt

sysctl(3) can now be renamed to sysctl(2)


# 1.153 28-Nov-2017 guenther

Delete fktrace(2). The consequences of it were not thought through
sufficiently and at least one horrific security hole was the result.

ok deraadt@ beck@


Revision tags: OPENBSD_6_2_BASE
# 1.152 13-Aug-2017 tedu

add fktrace to libc


# 1.151 12-Aug-2017 guenther

Instead of hardcoding a partial dependency list for the syscall stub objects,
calculate them as done for other objects


# 1.150 31-May-2017 sthen

install futex(2), ok mpi


# 1.149 30-Apr-2017 mpi

Add futex(2) shim, bump minor.

Inputs from guenther@, ok kettenis@, visa@


Revision tags: OPENBSD_6_1_BASE
# 1.148 29-Mar-2017 deraadt

The hppa version of as(1) requires whitespace before a .file directive,
it may not be in column 0. This kind of thing is very common in GNU
and Linux software because the software was written from the start to
be 'compatible replacements' of vendor software.
ok jsing guenther


# 1.147 26-Mar-2017 guenther

Use .file to convince 'as' to generate proper FILE symbols in the syscall
stubs that aren't actually in files, so that syspatch can figure out what
order the syscall stub objects are in the .so. Use -P to suppress to #line
directives that would override that. Tested with both gcc/gas and clang.

ok deraadt@


Revision tags: OPENBSD_6_0_BASE
# 1.146 04-Jul-2016 guenther

DEBUGLIBS has been broken since the gcc4 switch, so delete it. CFLAGS
contains -g by default anyway

problem noted by Edgar Pettijohn (edgar (at) pettijohn-web.com)
ok millert@ kettenis@ deraadt@


# 1.145 30-May-2016 guenther

Move __getcwd from ASM to HIDDEN: we don't want the literal __getcwd symbol

ok millert@ deraadt@


# 1.144 19-May-2016 guenther

Add ASM_NOERR for syscalls that never fail and thus don't need the errno
setting logic...which can significantly reduce the size of the stub on
some archs; 20 syscalls get a trim with this.

in snaps for a bit and ok deraadt@


# 1.143 09-May-2016 guenther

Remove sigreturn declaration and the now-unused libc syscall stub


# 1.142 07-May-2016 guenther

Use a Thread Information Block in both single and multi-threaded programs.
This stores errno, the cancelation flags, and related bits for each thread
and is allocated by ld.so or libc.a. This is an ABI break from 5.9-stable!

Make libpthread dlopen'able by moving the cancelation wrappers into libc
and doing locking and fork/errno handling via callbacks that libpthread
registers when it first initializes. 'errno' *must* be declared via
<errno.h> now!

Clean up libpthread's symbol exports like libc.

On powerpc, offset the TIB/TCB/TLS data from the register per the ELF spec.

Testing by various, particularly sthen@ and patrick@
ok kettenis@


# 1.141 30-Mar-2016 guenther

Turd polish: use HIDDEN= instead of PSEUDO= for ptrace syscall stub, to
make its underlying symbol name look like others.


# 1.140 30-Mar-2016 guenther

Eliminate userspace caching by getlogin_r/setlogin; make the getlogin
syscall behave exactly like userspace getlogin_r() and rename it to
match. Eliminate the reduced-to-no-op wrappers of the syscalls.
Eliminate the unnecessary per-thread static buffering by getlogin().

ok kettenis@ deraadt@


# 1.139 30-Mar-2016 jmc

for some time now mandoc has not required MLINKS to function
correctly - logically complete that now by removing MLINKS from base;

authors need only to ensure there is an entry in NAME for any function/
util being added. MLINKS will still work, and remain for perl to ease
upgrades;

ok nicm (curses) bcook (ssl)
ok schwarze, who provided a lot of feedback and assistance
ok tb natano jung


# 1.138 21-Mar-2016 bluhm

Rename the system call sendsyslog2 to sendsyslog. Keep the old one
as osendsyslog for a while. The three argument variant is the only
one that will stay.
input kettenis@; OK deraadt@


Revision tags: OPENBSD_5_9_BASE
# 1.137 25-Nov-2015 deraadt

Add a syscall stub for sendsyslog2(2), and use it in syslog_r(3), passing
LOG_CONS to the kernel. As a result, the /dev/console opening code can
be removed.
ok kettenis millert beck


# 1.136 10-Nov-2015 guenther

Split the intra-thread functionality from kill(2) into its own syscall
thrkill(2), rolling the kill(2) syscall number with the ABI change to
avoid breaking binaries during during the transition. thrkill(2) includes
a 'tcb' argument that eliminates the need for locking in pthread_kill()
and simplifies pthread_cancel(). Switch __stack_smash_handler() to use
thrkill(2) and explicitly unblock SIGABRT.

Minor bump to both libc and libpthread: make sure you install a new kernel!

ok semarie@


# 1.135 23-Oct-2015 guenther

Merge the sigaction() and sigprocmask() overloads/wrappers from libpthread
into libc, and move pthread_sigmask() as well (just a trivial wrapper).
This provides consistent handling of SIGTHR between single- and multi-threaded
programs and is a step in the merge of all the libpthread overloads, providing
some ASM and Makefile bits that the other wrappers will need.

ok deraadt@ millert@


# 1.134 23-Oct-2015 deraadt

Remove dnssocket() and dnsconnect(), since we decided to use a SOCK_DNS
flag instead.
ok guenther tedu semarie


# 1.133 19-Oct-2015 deraadt

Remove old tame() stub


# 1.132 18-Oct-2015 deraadt

create libc stubs for dnssocket() and dnsconnect()


# 1.131 09-Oct-2015 deraadt

tame -> pledge conversion, in libc. I should crank libc, but am cheating
hoping things go well. The old symbol is faked via a stupid stub function,
until next major crank when it can be removed. I am expecting guenther
to scream at me.


# 1.130 13-Sep-2015 guenther

Rename __sysctl syscall to just sysctl, as the userland wrapper is no longer
necessary

ok deraadt@ jsing@


# 1.129 09-Sep-2015 guenther

Simplify makefile rules for building the ASM stubs into "pick something
from column A and something from column B".

ok miod@ deraadt@


# 1.128 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@


# 1.127 25-Aug-2015 guenther

Document kbind(2)


Revision tags: OPENBSD_5_8_BASE
# 1.126 19-Jul-2015 deraadt

manual page for tame(2). not very good, so i will be hearing from jmc


# 1.125 07-Apr-2015 guenther

Make pthread_atfork() track the DSO that called it like atexit() does,
unregistering callbacks if the DSO is unloaded. Move the callback
handling from libpthread to libc, though libpthread still overrides the
inner call to handle locking and thread-library reinitialization.
Major version bump for both libc and libpthread.

verification that this fixes various ports ajacoutot@
asm assistance miod@; ok millert@ deraadt@


Revision tags: OPENBSD_5_7_BASE
# 1.124 08-Dec-2014 guenther

Add chflagsat(), modeled on fchmodat() with name to match FreeBSD.


# 1.123 14-Nov-2014 guenther

Add sched_yield(2) manpage


# 1.122 31-Aug-2014 guenther

Declare and document getthrid()

indirectly prodded by krw@


# 1.121 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@


# 1.120 14-Aug-2014 tobias

fixed overrid(d)en typo

millert@ and jmc@ agree that "overriden" is wrong


Revision tags: OPENBSD_5_6_BASE
# 1.119 12-Jul-2014 deraadt

document sendsyslog(2); ok guenther tedu matthew


# 1.118 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.117 18-Mar-2014 miod

Retire hp300, mvme68k and mvme88k ports. These ports have no users, keeping
this hardware alive is becoming increasingly difficult, and I should heed the
message sent by the three disks which have died on me over the last few days.

Noone sane will mourn these ports anyway. So long, and thanks for the fish.


Revision tags: OPENBSD_5_5_BASE
# 1.116 13-Oct-2013 guenther

Make it possible to build to reduced version of a library, including
just specific objects that are compiled with additional options to
reduce their size. For use by distrib/ and crunchgen.

style and naming assistance from espie@


# 1.115 07-Oct-2013 guenther

getdirentries(2) is dead; long live getdents(2)!

confirmation that getdirentries(2) is unused by ports from sthen@ and naddy@


# 1.114 13-Aug-2013 guenther

Switch time_t, ino_t, clock_t, and struct kevent's ident and data
members to 64bit types. Assign new syscall numbers for (almost
all) the syscalls that involve the affected types, including anything
with time_t, timeval, itimerval, timespec, rusage, dirent, stat,
or kevent arguments. Add a d_off member to struct dirent and replace
getdirentries() with getdents(), thus immensely simplifying and
accelerating telldir/seekdir. Build perl with -DBIG_TIME.

Bump the major on every single base library: the compat bits included
here are only good enough to make the transition; the T32 compat
option will be burned as soon as we've reached the new world are
are happy with the snapshots for all architectures.

DANGER: ABI incompatibility. Updating to this kernel requires extra
work or you won't be able to login: install a snapshot instead.

Much assistance in fixing userland issues from deraadt@ and tedu@
and build assistance from todd@ and otto@


Revision tags: OPENBSD_5_4_BASE
# 1.113 05-Jun-2013 guenther

Move _Exit() from the exit() manpage to the _exit() manpage, as it's
just an alias of the latter.

ok matthew@ tedu@


# 1.112 01-Jun-2013 miod

Add utrace(2), a system call allowing for userland to send its own ktrace
records. From FreeBSD via otto@, with tweaks suggested by guenther@.
Commite on behalf of otto@ who is not around, to ride the libc minor bump.
Causes a librthread minor bump as well (new syscall).


# 1.111 29-Apr-2013 matthew

Extend P_SIGSUSPEND handling in userret() to properly restore the
sigmask even if there are no pending signals under the temporary
sigmask.

Refactor existing select() and poll() system calls to introduce the
pselect() and ppoll() system calls.

Add rthread wrappers for pselect() and ppoll(). While there, update
cancellation point comments to reflect recent fdatasync() addition.

Minor bumps for libc and librthread due to new symbols.

ok guenther, millert, deraadt, jmc


# 1.110 15-Apr-2013 matthew

Implement fdatasync() as a wrapper around fsync()

ok guenther, deraadt, jmc


Revision tags: OPENBSD_5_3_BASE
# 1.109 03-Feb-2013 miod

gremlin crept in


# 1.108 02-Feb-2013 miod

Userland bits for m68k/ELF. Mostly addition of register prefixes to the
assembler instructions, and cope with the few changes in return values
location.


# 1.107 04-Sep-2012 okan

remove lint leftovers; ok guenther@


# 1.106 23-Aug-2012 deraadt

no more nnpfspioctl() system call; ok guenther


# 1.105 22-Aug-2012 pascal

Convert cpp | as rules in bsd.lib.mk and lib/libc/sys/Makefile.inc to pure cc
invocations. This allows us to use the compiler builtin define __PIC__ to check
for PIC/PIEness rather than passing -DPIC. Simplifies PIE work a lot.

ok matthew@, conceptually ok kurt@


# 1.104 21-Aug-2012 pascal

Kill an old mips workaround; we don't support mips, just mips64.

ok deraadt@ kettenis@


Revision tags: OPENBSD_5_2_BASE
# 1.103 19-Jun-2012 deraadt

oops, forgot to install getdtablecount(2); noted by tedu


# 1.102 12-Apr-2012 deraadt

remove rfork(); ok guenther miod


# 1.101 12-Apr-2012 deraadt

kill lfs system call lines and libc stubs


# 1.100 12-Apr-2012 deraadt

New system call: getdtablecount(2) returns the number of file
descriptors the process currently has open.
ok guenther miod gilles ...


# 1.99 22-Mar-2012 guenther

Move __tfork_thread() from rthreads (libpthread) to libc so that
it can be used for not-strictly-threading purposes

ok matthew@ kurt@


# 1.98 13-Mar-2012 guenther

Add manpages for __thrsigdivert, __thrsleep, and __thrwakeup. Various
syntax and grammar fixes from jmc@


Revision tags: OPENBSD_5_1_BASE
# 1.97 17-Jan-2012 guenther

Reimplement mutexes, condvars, and rwlocks to eliminate bugs,
particularly the "consume the signal you just sent" hang, and putting
the wait queues in userspace.

Do cancellation handling in pthread_cond_*wait(), pthread_join(),
and sem_wait().

Add __ prefix to thr{sleep,wakeup,exit,sigdivert}() syscalls; add
'abort" argument to thrsleep to close cancellation race; make
thr{sleep,wakeup} return errno values via *retval to avoid touching
userspace errno.


# 1.96 22-Nov-2011 guenther

sigstack() is long dead, and the compat sigaltstack syscall is gone too.
Correct the namespace protections for sigreturn(), sigwait(), and psignal()

ok millert@


# 1.95 16-Oct-2011 guenther

Add stubs and manpage for __{get,set}_tcb

ok deraadt@


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

Add (rough draft) documentation for fdopendir(3) and the 15 new
XXXat(2) system calls from POSIX 2008. Editing will be done in tree.

General style discussed with jmc@, schwarze@, and deraadt@
ok jmc@


# 1.93 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@


Revision tags: OPENBSD_4_8_BASE OPENBSD_4_9_BASE
# 1.92 03-Jul-2010 guenther

Fix the naming of interfaces and variables for rdomains and rtables
and make it possible to bind sockets (including listening sockets!)
to rtables and not just rdomains. This changes the name of the
system calls, socket option, and ioctl. After building with this
you should remove the files /usr/share/man/cat2/[gs]etrdomain.0.

Since this removes the existing [gs]etrdomain() system calls, the
libc major is bumped.

Written by claudio@, criticized^Wcritiqued by me


# 1.91 01-Jul-2010 deraadt

getpeereid() can now be a library routine using getsockopt() with
SOL_SOCKET and SO_PEERCRED, only issue being that it cannot return
EFAULT for a page fault. The kernel code will soon be put into
compat, and then in 10 years or so tedu will delete it.
ok guenther millert


# 1.90 18-May-2010 tedu

add posix_madvise, posix_memalign, strndup, and strnlen. mostly from
brad and millert, with hints from guenther, jmc, and otto I think.
ok previous.


Revision tags: OPENBSD_4_7_BASE
# 1.89 03-Feb-2010 miod

Use MACHINE_CPU instead of MACHINE_ARCH to pick the correct machine dependent
files or directories when applicable.
The inspiration and name of MACHINE_CPU come from NetBSD, although the way to
provide it to Makefiles is completely different.
ok kettenis@


# 1.88 27-Nov-2009 guenther

Add setrdomain() and getrdomain() system calls. Committing now to
catch the libc major bump per request from deraadt@

Diff by reyk.

ok guenther@


# 1.87 13-Aug-2009 jmc

various MLINK fixes from Alan R. S. Bueno;


Revision tags: OPENBSD_4_6_BASE
# 1.86 03-Jun-2009 jj

Arla client rename from xfs to nnpfs for later upgrades. Tested on various arches. ok todd@ beck@


Revision tags: OPENBSD_4_4_BASE OPENBSD_4_5_BASE
# 1.85 22-Mar-2008 otto

move statvfs.c to gen, since it is not a syscall; ok deraadt@


# 1.84 16-Mar-2008 otto

statvfs support


Revision tags: OPENBSD_4_3_BASE
# 1.83 05-Jan-2008 deraadt

no more need for vadvise.o


# 1.82 09-Sep-2007 otto

Add lint stubs for the longjmp family of functions which are defined in
assembly on all platforms. ok deraadt@


# 1.81 09-Sep-2007 otto

Silence erroneous "environ used, but not defined" lint warning by
providing a stub. ok deraadt@


Revision tags: OPENBSD_4_1_BASE OPENBSD_4_2_BASE
# 1.80 24-Oct-2006 tedu

add rthread syscalls and bump minor.
rthreads are hardly done, but if just trying it out is too much of a hassle,
we'll never make more progress.
ok brad marc marco mbalmer


# 1.79 10-Oct-2006 deraadt

MLINKS to macros described in stat(2)


Revision tags: OPENBSD_4_0_BASE
# 1.78 14-Jun-2006 otto

Introducing adjfreq(2), to adjust the clock frequency.
Loosely based on dragonfly code. Man page help fro jmc@; ok deraadt@


# 1.77 27-May-2006 pedro

Make libc's getcwd() use the new __getcwd() system call
Hacked by marius@ at c2k5, okay miod@ krw@ deraadt@


# 1.76 13-Mar-2006 moritz

Clean the correct file. ok deraadt@


Revision tags: OPENBSD_3_9_BASE
# 1.75 29-Nov-2005 deraadt

Provide stubs for things which are supplied by crt0. I don't think we
want a crt0.ln, at least, not yet. We may reconsider later.


# 1.74 03-Oct-2005 jmc

add missing MLINK for WEXITSTATUS.2


Revision tags: OPENBSD_3_8_BASE
# 1.73 17-Jun-2005 drahn

Extended Attributes was a piece to get to ACLs, however ACLs have not
been worked on, so EA is pointless to maintain.


# 1.72 17-Jun-2005 millert

remove undelete syscall


Revision tags: OPENBSD_3_7_BASE
# 1.71 18-Sep-2004 deraadt

MLINK to macros provided in wait.2


# 1.70 16-Sep-2004 deraadt

add files missing for building a proper lint library


Revision tags: OPENBSD_3_5_BASE OPENBSD_3_6_BASE
# 1.69 13-Feb-2004 tedu

death to osigaltstack. ok deraadt@


# 1.68 15-Jan-2004 deraadt

ABI breakage happened with the sigaltstack replacement. It is too late,
now we just have to cope. Since setjmp uses it, the alpha and sparc64 are
unhappy with the structure change. In a few days, we will make the second
hop here, for now, use the old system call until all binaries have the new
struct in them.


# 1.67 12-Jan-2004 tedu

new syscall closefrom(2). ok deraadt millert


Revision tags: OPENBSD_3_4_BASE
# 1.66 10-May-2003 miod

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


# 1.65 14-Apr-2003 art

There are two related changes.

The first one is an mquery(2) syscall. It's for asking the VM system
about where to map things. It will be used by ld.so, read the man page
for details.

The second change is related and is a centralization of uvm_map hint
that all callers of uvm_map calculated. This will allow us to adjust
this hint on architectures that have segments for non-exec mappings.

deraadt@ drahn@ ok.


Revision tags: OPENBSD_3_3_BASE
# 1.64 31-Jan-2003 millert

Replace emulated versions of setreuid() and setregid() with real syscalls.
These are spec'd by POSIX as of 1003.1-2001; deraadt@ OK


# 1.63 02-Dec-2002 millert

Document getlogin_r()


# 1.62 02-Dec-2002 miod

Import propolice (http://www.trl.ibm.com/projects/security/ssp), a stack
attack protection scheme, into gcc.

This protection is enabled by default. It can be turned off by using the
-fno-stack-protector flag.

Code by Hiroaki Etoh (etoh at jp dot ibm dot com); work on openbsd-specific
integration by fgsch@, deraadt@ and myself; tests by fgsch@, naddy@ and
myself; beer drinking by myself.

Please note that system upgrades with this new code will require a new
libc and ld.so to be build and installed before the propolice-enabled
compiler can be installed.


# 1.61 10-Nov-2002 fgsch

missing MLINKs for setresuid(2). millert ok.


# 1.60 05-Nov-2002 marc

thread safe libc -- 2nd try. OK miod@, millert@
Thanks to miod@ for m68k and vax fixes


# 1.59 03-Nov-2002 marc

back out previous patch.. there are still some vax/m68k issues


# 1.58 03-Nov-2002 marc

libc changes for thread safety. Tested on:
alpha (millert@), i386 (marc@), m68k (millert@ and miod@),
powerpc (drahn@ and dhartmei@), sparc (millert@ and marc@),
sparc64 (marc@), and vax (millert@ and miod@).
Thanks to millert@, miod@, and mickey@ for fixes along the way.


# 1.57 30-Oct-2002 millert

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


Revision tags: OPENBSD_3_2_BASE
# 1.56 05-Aug-2002 art

Fix brain blackout.
Pointed out byb miod@.


# 1.55 05-Aug-2002 art

One more ELF_TOOLCHAIN.


# 1.54 06-Jul-2002 nordin

Remove kernel support for NTP. ok deraadt@ and tholo@


# 1.53 10-Jun-2002 fgsch

correct comment.


# 1.52 08-Jun-2002 drahn

ELF architectures all support weak aliases, enable them for this part.
ok fgsch@


Revision tags: OPENBSD_3_1_BASE
# 1.51 22-Feb-2002 drahn

Extended Attribute support, from FreeBSD/TrustedBSD. ok art@ deraadt@
libc support pieces


# 1.50 21-Feb-2002 art

remove rfork.o from the auto-generated assembler stubs


# 1.49 17-Feb-2002 deraadt

rfork() needs a fork.S-like stub as well; ok art


Revision tags: OPENBSD_3_0_BASE
# 1.48 25-Sep-2001 niklas

Forgotten DEBUGLIBS stuff


# 1.47 25-Sep-2001 drahn

Add an ASPICFLAG variable to bsd.own.mk which a platform use to pass flags
to 'as' to make it compile pic. add defaults for sparc64 which needs picflags
set to -fPIC and ASPICFLAGS to -KPIC.
Also simplifies the systemcall generation for sparc64 PIC mode.
ok epsie@.


# 1.46 20-Sep-2001 millert

Add PSEUDO_NOERROR similar to that used by NetBSD.
Some ports were setting errno in PSEUDO and some were not. Now errno
is set for all in PSEUDO and PSEUDO_NOERROR is provided for the
non-errno case (only used by _exit).

Needs testing on vax and m88k.
XXX - hppa and powerpc still lack a real PSEUDO_NOERROR implementation.
Currently PSEUDO_NOERROR and PSEUDO are the same (so builds don't
break on those platforms).


# 1.45 09-Jul-2001 fgsch

Install getpeereid(2) manpage.


# 1.44 26-Jun-2001 dugsong

implement djb's getpeereid(2), to allow local-domain servers to determine client credentials. mostly from superscript.com. deraadt@ ok


Revision tags: OPENBSD_2_9_BASE
# 1.43 14-Mar-2001 aaron

Move description of exect() to execve(2) man page. Add a note about exect() not
being portable.


# 1.42 09-Mar-2001 art

Add mlockall and munlockall. man-page from NetBSD.


# 1.41 10-Jan-2001 deraadt

put up FD_* manual pages, in section 3


# 1.40 23-Dec-2000 deraadt

create proper docs for timer{add,clear,sub,isset,cmp}


# 1.39 16-Nov-2000 provos

kqueue and kevent system calls


Revision tags: OPENBSD_2_8_BASE
# 1.38 17-Oct-2000 deraadt

damn it, i have had it with this untested weak shit


# 1.37 16-Oct-2000 deraadt

re-add weak sparc support; d@


# 1.36 15-May-2000 niklas

Add support for building libraries with debugging information in them.
Enable by setting DEBUGLIBS=yes in /etc/mk.conf, then -g libraries will get
installed in /usr/lib/debug. This directory will be searched first if
gcc is given the -g flag during the link stage.


Revision tags: OPENBSD_2_7_BASE
# 1.35 01-May-2000 deraadt

bye bye semconfig(2)


# 1.34 20-Apr-2000 deraadt

p{read,write}{,v} man pages


# 1.33 07-Feb-2000 assar

add fhopen, fhstat, fhstatfs system calls. largely from NetBSD


# 1.32 06-Jan-2000 d

for now, disable weak aliases for all archs except i386


# 1.31 14-Dec-1999 millert

Install swapctl.2, not swapon.2. swapon.2 should probably go away.


Revision tags: OPENBSD_2_6_BASE
# 1.30 07-Jun-1999 deraadt

replacement pipe() system call; copies data into place inside kernel, so
that EFAULT return value is possible


# 1.29 22-May-1999 weingart

Add swapctl(2), and crank shlib minor.


Revision tags: OPENBSD_2_5_BASE
# 1.28 01-Feb-1999 d

mi ptrace


# 1.27 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


Revision tags: OPENBSD_2_4_BASE
# 1.26 18-Sep-1998 art

make use of xfspioctl


Revision tags: OPENBSD_2_3_BASE
# 1.25 08-Feb-1998 tholo

Better lint(1) framework. Mostly from cgd@NetBSD


# 1.24 13-Nov-1997 deraadt

add getsid(2), XPG4


Revision tags: OPENBSD_2_2_BASE
# 1.23 30-May-1997 kstailey

add getpgrp(2) from NetBSD


Revision tags: OPENBSD_2_1_BASE
# 1.22 08-May-1997 kstailey

add tag


# 1.21 08-May-1997 kstailey

make clock_gettime.cat2


# 1.20 20-Apr-1997 tholo

New POSIX 1003.1b syscalls; from pk@NetBSD


# 1.19 04-Apr-1997 deraadt

seek(2) is not needed


# 1.18 29-Mar-1997 deraadt

futimes link; nakayosh@kcn.or.jp


# 1.17 26-Mar-1997 deraadt

install ktrace(2)


# 1.16 26-Jan-1997 downsj

Add a link for lchown.2


# 1.15 26-Jan-1997 downsj

Add lchown(), increment minor number.


# 1.14 11-Dec-1996 deraadt

generate reboot.o like other system calls


Revision tags: OPENBSD_2_0_BASE
# 1.13 02-Sep-1996 deraadt

shmdt link


# 1.12 25-Aug-1996 deraadt

and a man page


# 1.11 18-Jun-1996 deraadt

build poll.o


# 1.10 19-May-1996 pefo

Changes for mips.


# 1.9 18-May-1996 deraadt

poll() as a system call


# 1.8 08-May-1996 deraadt

install rfork man page


# 1.7 01-May-1996 deraadt

add futimes


# 1.6 25-Mar-1996 tholo

Add support for building lint(1) library


# 1.5 29-Jan-1996 tholo

Add kernel PLL for system clock
Add ntp_adjtime() and ntp_gettime() system calls
Mostly stolen from FreeBSD


# 1.4 08-Jan-1996 deraadt

add rfork.o and minherit.o


# 1.3 07-Jan-1996 deraadt

add minherit() system call


# 1.2 14-Dec-1995 deraadt

from netbsd:
add & fix a bunch of system call pages


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.157 28-May-2019 beck

Enable the use of the kernel __realpath() system call in the libc wrapper.

For now, this also still uses the existing realpath implmentation
and emits a syslog if we see differening results. Once we have run
with that for a little while we will remove the old code

ok deraadt@


Revision tags: OPENBSD_6_5_BASE
# 1.156 11-Jan-2019 deraadt

mincore() is a relic from the past, exposing physical machine information
about shared resources which no program should see. only a few pieces of
software use it, generally poorly thought out. they are being fixed, so
mincore() can be deleted.
ok guenther tedu jca sthen, others


Revision tags: OPENBSD_6_4_BASE
# 1.155 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.154 12-Jan-2018 deraadt

sysctl(3) can now be renamed to sysctl(2)


# 1.153 28-Nov-2017 guenther

Delete fktrace(2). The consequences of it were not thought through
sufficiently and at least one horrific security hole was the result.

ok deraadt@ beck@


Revision tags: OPENBSD_6_2_BASE
# 1.152 13-Aug-2017 tedu

add fktrace to libc


# 1.151 12-Aug-2017 guenther

Instead of hardcoding a partial dependency list for the syscall stub objects,
calculate them as done for other objects


# 1.150 31-May-2017 sthen

install futex(2), ok mpi


# 1.149 30-Apr-2017 mpi

Add futex(2) shim, bump minor.

Inputs from guenther@, ok kettenis@, visa@


Revision tags: OPENBSD_6_1_BASE
# 1.148 29-Mar-2017 deraadt

The hppa version of as(1) requires whitespace before a .file directive,
it may not be in column 0. This kind of thing is very common in GNU
and Linux software because the software was written from the start to
be 'compatible replacements' of vendor software.
ok jsing guenther


# 1.147 26-Mar-2017 guenther

Use .file to convince 'as' to generate proper FILE symbols in the syscall
stubs that aren't actually in files, so that syspatch can figure out what
order the syscall stub objects are in the .so. Use -P to suppress to #line
directives that would override that. Tested with both gcc/gas and clang.

ok deraadt@


Revision tags: OPENBSD_6_0_BASE
# 1.146 04-Jul-2016 guenther

DEBUGLIBS has been broken since the gcc4 switch, so delete it. CFLAGS
contains -g by default anyway

problem noted by Edgar Pettijohn (edgar (at) pettijohn-web.com)
ok millert@ kettenis@ deraadt@


# 1.145 30-May-2016 guenther

Move __getcwd from ASM to HIDDEN: we don't want the literal __getcwd symbol

ok millert@ deraadt@


# 1.144 19-May-2016 guenther

Add ASM_NOERR for syscalls that never fail and thus don't need the errno
setting logic...which can significantly reduce the size of the stub on
some archs; 20 syscalls get a trim with this.

in snaps for a bit and ok deraadt@


# 1.143 09-May-2016 guenther

Remove sigreturn declaration and the now-unused libc syscall stub


# 1.142 07-May-2016 guenther

Use a Thread Information Block in both single and multi-threaded programs.
This stores errno, the cancelation flags, and related bits for each thread
and is allocated by ld.so or libc.a. This is an ABI break from 5.9-stable!

Make libpthread dlopen'able by moving the cancelation wrappers into libc
and doing locking and fork/errno handling via callbacks that libpthread
registers when it first initializes. 'errno' *must* be declared via
<errno.h> now!

Clean up libpthread's symbol exports like libc.

On powerpc, offset the TIB/TCB/TLS data from the register per the ELF spec.

Testing by various, particularly sthen@ and patrick@
ok kettenis@


# 1.141 30-Mar-2016 guenther

Turd polish: use HIDDEN= instead of PSEUDO= for ptrace syscall stub, to
make its underlying symbol name look like others.


# 1.140 30-Mar-2016 guenther

Eliminate userspace caching by getlogin_r/setlogin; make the getlogin
syscall behave exactly like userspace getlogin_r() and rename it to
match. Eliminate the reduced-to-no-op wrappers of the syscalls.
Eliminate the unnecessary per-thread static buffering by getlogin().

ok kettenis@ deraadt@


# 1.139 30-Mar-2016 jmc

for some time now mandoc has not required MLINKS to function
correctly - logically complete that now by removing MLINKS from base;

authors need only to ensure there is an entry in NAME for any function/
util being added. MLINKS will still work, and remain for perl to ease
upgrades;

ok nicm (curses) bcook (ssl)
ok schwarze, who provided a lot of feedback and assistance
ok tb natano jung


# 1.138 21-Mar-2016 bluhm

Rename the system call sendsyslog2 to sendsyslog. Keep the old one
as osendsyslog for a while. The three argument variant is the only
one that will stay.
input kettenis@; OK deraadt@


Revision tags: OPENBSD_5_9_BASE
# 1.137 25-Nov-2015 deraadt

Add a syscall stub for sendsyslog2(2), and use it in syslog_r(3), passing
LOG_CONS to the kernel. As a result, the /dev/console opening code can
be removed.
ok kettenis millert beck


# 1.136 10-Nov-2015 guenther

Split the intra-thread functionality from kill(2) into its own syscall
thrkill(2), rolling the kill(2) syscall number with the ABI change to
avoid breaking binaries during during the transition. thrkill(2) includes
a 'tcb' argument that eliminates the need for locking in pthread_kill()
and simplifies pthread_cancel(). Switch __stack_smash_handler() to use
thrkill(2) and explicitly unblock SIGABRT.

Minor bump to both libc and libpthread: make sure you install a new kernel!

ok semarie@


# 1.135 23-Oct-2015 guenther

Merge the sigaction() and sigprocmask() overloads/wrappers from libpthread
into libc, and move pthread_sigmask() as well (just a trivial wrapper).
This provides consistent handling of SIGTHR between single- and multi-threaded
programs and is a step in the merge of all the libpthread overloads, providing
some ASM and Makefile bits that the other wrappers will need.

ok deraadt@ millert@


# 1.134 23-Oct-2015 deraadt

Remove dnssocket() and dnsconnect(), since we decided to use a SOCK_DNS
flag instead.
ok guenther tedu semarie


# 1.133 19-Oct-2015 deraadt

Remove old tame() stub


# 1.132 18-Oct-2015 deraadt

create libc stubs for dnssocket() and dnsconnect()


# 1.131 09-Oct-2015 deraadt

tame -> pledge conversion, in libc. I should crank libc, but am cheating
hoping things go well. The old symbol is faked via a stupid stub function,
until next major crank when it can be removed. I am expecting guenther
to scream at me.


# 1.130 13-Sep-2015 guenther

Rename __sysctl syscall to just sysctl, as the userland wrapper is no longer
necessary

ok deraadt@ jsing@


# 1.129 09-Sep-2015 guenther

Simplify makefile rules for building the ASM stubs into "pick something
from column A and something from column B".

ok miod@ deraadt@


# 1.128 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@


# 1.127 25-Aug-2015 guenther

Document kbind(2)


Revision tags: OPENBSD_5_8_BASE
# 1.126 19-Jul-2015 deraadt

manual page for tame(2). not very good, so i will be hearing from jmc


# 1.125 07-Apr-2015 guenther

Make pthread_atfork() track the DSO that called it like atexit() does,
unregistering callbacks if the DSO is unloaded. Move the callback
handling from libpthread to libc, though libpthread still overrides the
inner call to handle locking and thread-library reinitialization.
Major version bump for both libc and libpthread.

verification that this fixes various ports ajacoutot@
asm assistance miod@; ok millert@ deraadt@


Revision tags: OPENBSD_5_7_BASE
# 1.124 08-Dec-2014 guenther

Add chflagsat(), modeled on fchmodat() with name to match FreeBSD.


# 1.123 14-Nov-2014 guenther

Add sched_yield(2) manpage


# 1.122 31-Aug-2014 guenther

Declare and document getthrid()

indirectly prodded by krw@


# 1.121 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@


# 1.120 14-Aug-2014 tobias

fixed overrid(d)en typo

millert@ and jmc@ agree that "overriden" is wrong


Revision tags: OPENBSD_5_6_BASE
# 1.119 12-Jul-2014 deraadt

document sendsyslog(2); ok guenther tedu matthew


# 1.118 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.117 18-Mar-2014 miod

Retire hp300, mvme68k and mvme88k ports. These ports have no users, keeping
this hardware alive is becoming increasingly difficult, and I should heed the
message sent by the three disks which have died on me over the last few days.

Noone sane will mourn these ports anyway. So long, and thanks for the fish.


Revision tags: OPENBSD_5_5_BASE
# 1.116 13-Oct-2013 guenther

Make it possible to build to reduced version of a library, including
just specific objects that are compiled with additional options to
reduce their size. For use by distrib/ and crunchgen.

style and naming assistance from espie@


# 1.115 07-Oct-2013 guenther

getdirentries(2) is dead; long live getdents(2)!

confirmation that getdirentries(2) is unused by ports from sthen@ and naddy@


# 1.114 13-Aug-2013 guenther

Switch time_t, ino_t, clock_t, and struct kevent's ident and data
members to 64bit types. Assign new syscall numbers for (almost
all) the syscalls that involve the affected types, including anything
with time_t, timeval, itimerval, timespec, rusage, dirent, stat,
or kevent arguments. Add a d_off member to struct dirent and replace
getdirentries() with getdents(), thus immensely simplifying and
accelerating telldir/seekdir. Build perl with -DBIG_TIME.

Bump the major on every single base library: the compat bits included
here are only good enough to make the transition; the T32 compat
option will be burned as soon as we've reached the new world are
are happy with the snapshots for all architectures.

DANGER: ABI incompatibility. Updating to this kernel requires extra
work or you won't be able to login: install a snapshot instead.

Much assistance in fixing userland issues from deraadt@ and tedu@
and build assistance from todd@ and otto@


Revision tags: OPENBSD_5_4_BASE
# 1.113 05-Jun-2013 guenther

Move _Exit() from the exit() manpage to the _exit() manpage, as it's
just an alias of the latter.

ok matthew@ tedu@


# 1.112 01-Jun-2013 miod

Add utrace(2), a system call allowing for userland to send its own ktrace
records. From FreeBSD via otto@, with tweaks suggested by guenther@.
Commite on behalf of otto@ who is not around, to ride the libc minor bump.
Causes a librthread minor bump as well (new syscall).


# 1.111 29-Apr-2013 matthew

Extend P_SIGSUSPEND handling in userret() to properly restore the
sigmask even if there are no pending signals under the temporary
sigmask.

Refactor existing select() and poll() system calls to introduce the
pselect() and ppoll() system calls.

Add rthread wrappers for pselect() and ppoll(). While there, update
cancellation point comments to reflect recent fdatasync() addition.

Minor bumps for libc and librthread due to new symbols.

ok guenther, millert, deraadt, jmc


# 1.110 15-Apr-2013 matthew

Implement fdatasync() as a wrapper around fsync()

ok guenther, deraadt, jmc


Revision tags: OPENBSD_5_3_BASE
# 1.109 03-Feb-2013 miod

gremlin crept in


# 1.108 02-Feb-2013 miod

Userland bits for m68k/ELF. Mostly addition of register prefixes to the
assembler instructions, and cope with the few changes in return values
location.


# 1.107 04-Sep-2012 okan

remove lint leftovers; ok guenther@


# 1.106 23-Aug-2012 deraadt

no more nnpfspioctl() system call; ok guenther


# 1.105 22-Aug-2012 pascal

Convert cpp | as rules in bsd.lib.mk and lib/libc/sys/Makefile.inc to pure cc
invocations. This allows us to use the compiler builtin define __PIC__ to check
for PIC/PIEness rather than passing -DPIC. Simplifies PIE work a lot.

ok matthew@, conceptually ok kurt@


# 1.104 21-Aug-2012 pascal

Kill an old mips workaround; we don't support mips, just mips64.

ok deraadt@ kettenis@


Revision tags: OPENBSD_5_2_BASE
# 1.103 19-Jun-2012 deraadt

oops, forgot to install getdtablecount(2); noted by tedu


# 1.102 12-Apr-2012 deraadt

remove rfork(); ok guenther miod


# 1.101 12-Apr-2012 deraadt

kill lfs system call lines and libc stubs


# 1.100 12-Apr-2012 deraadt

New system call: getdtablecount(2) returns the number of file
descriptors the process currently has open.
ok guenther miod gilles ...


# 1.99 22-Mar-2012 guenther

Move __tfork_thread() from rthreads (libpthread) to libc so that
it can be used for not-strictly-threading purposes

ok matthew@ kurt@


# 1.98 13-Mar-2012 guenther

Add manpages for __thrsigdivert, __thrsleep, and __thrwakeup. Various
syntax and grammar fixes from jmc@


Revision tags: OPENBSD_5_1_BASE
# 1.97 17-Jan-2012 guenther

Reimplement mutexes, condvars, and rwlocks to eliminate bugs,
particularly the "consume the signal you just sent" hang, and putting
the wait queues in userspace.

Do cancellation handling in pthread_cond_*wait(), pthread_join(),
and sem_wait().

Add __ prefix to thr{sleep,wakeup,exit,sigdivert}() syscalls; add
'abort" argument to thrsleep to close cancellation race; make
thr{sleep,wakeup} return errno values via *retval to avoid touching
userspace errno.


# 1.96 22-Nov-2011 guenther

sigstack() is long dead, and the compat sigaltstack syscall is gone too.
Correct the namespace protections for sigreturn(), sigwait(), and psignal()

ok millert@


# 1.95 16-Oct-2011 guenther

Add stubs and manpage for __{get,set}_tcb

ok deraadt@


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

Add (rough draft) documentation for fdopendir(3) and the 15 new
XXXat(2) system calls from POSIX 2008. Editing will be done in tree.

General style discussed with jmc@, schwarze@, and deraadt@
ok jmc@


# 1.93 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@


Revision tags: OPENBSD_4_8_BASE OPENBSD_4_9_BASE
# 1.92 03-Jul-2010 guenther

Fix the naming of interfaces and variables for rdomains and rtables
and make it possible to bind sockets (including listening sockets!)
to rtables and not just rdomains. This changes the name of the
system calls, socket option, and ioctl. After building with this
you should remove the files /usr/share/man/cat2/[gs]etrdomain.0.

Since this removes the existing [gs]etrdomain() system calls, the
libc major is bumped.

Written by claudio@, criticized^Wcritiqued by me


# 1.91 01-Jul-2010 deraadt

getpeereid() can now be a library routine using getsockopt() with
SOL_SOCKET and SO_PEERCRED, only issue being that it cannot return
EFAULT for a page fault. The kernel code will soon be put into
compat, and then in 10 years or so tedu will delete it.
ok guenther millert


# 1.90 18-May-2010 tedu

add posix_madvise, posix_memalign, strndup, and strnlen. mostly from
brad and millert, with hints from guenther, jmc, and otto I think.
ok previous.


Revision tags: OPENBSD_4_7_BASE
# 1.89 03-Feb-2010 miod

Use MACHINE_CPU instead of MACHINE_ARCH to pick the correct machine dependent
files or directories when applicable.
The inspiration and name of MACHINE_CPU come from NetBSD, although the way to
provide it to Makefiles is completely different.
ok kettenis@


# 1.88 27-Nov-2009 guenther

Add setrdomain() and getrdomain() system calls. Committing now to
catch the libc major bump per request from deraadt@

Diff by reyk.

ok guenther@


# 1.87 13-Aug-2009 jmc

various MLINK fixes from Alan R. S. Bueno;


Revision tags: OPENBSD_4_6_BASE
# 1.86 03-Jun-2009 jj

Arla client rename from xfs to nnpfs for later upgrades. Tested on various arches. ok todd@ beck@


Revision tags: OPENBSD_4_4_BASE OPENBSD_4_5_BASE
# 1.85 22-Mar-2008 otto

move statvfs.c to gen, since it is not a syscall; ok deraadt@


# 1.84 16-Mar-2008 otto

statvfs support


Revision tags: OPENBSD_4_3_BASE
# 1.83 05-Jan-2008 deraadt

no more need for vadvise.o


# 1.82 09-Sep-2007 otto

Add lint stubs for the longjmp family of functions which are defined in
assembly on all platforms. ok deraadt@


# 1.81 09-Sep-2007 otto

Silence erroneous "environ used, but not defined" lint warning by
providing a stub. ok deraadt@


Revision tags: OPENBSD_4_1_BASE OPENBSD_4_2_BASE
# 1.80 24-Oct-2006 tedu

add rthread syscalls and bump minor.
rthreads are hardly done, but if just trying it out is too much of a hassle,
we'll never make more progress.
ok brad marc marco mbalmer


# 1.79 10-Oct-2006 deraadt

MLINKS to macros described in stat(2)


Revision tags: OPENBSD_4_0_BASE
# 1.78 14-Jun-2006 otto

Introducing adjfreq(2), to adjust the clock frequency.
Loosely based on dragonfly code. Man page help fro jmc@; ok deraadt@


# 1.77 27-May-2006 pedro

Make libc's getcwd() use the new __getcwd() system call
Hacked by marius@ at c2k5, okay miod@ krw@ deraadt@


# 1.76 13-Mar-2006 moritz

Clean the correct file. ok deraadt@


Revision tags: OPENBSD_3_9_BASE
# 1.75 29-Nov-2005 deraadt

Provide stubs for things which are supplied by crt0. I don't think we
want a crt0.ln, at least, not yet. We may reconsider later.


# 1.74 03-Oct-2005 jmc

add missing MLINK for WEXITSTATUS.2


Revision tags: OPENBSD_3_8_BASE
# 1.73 17-Jun-2005 drahn

Extended Attributes was a piece to get to ACLs, however ACLs have not
been worked on, so EA is pointless to maintain.


# 1.72 17-Jun-2005 millert

remove undelete syscall


Revision tags: OPENBSD_3_7_BASE
# 1.71 18-Sep-2004 deraadt

MLINK to macros provided in wait.2


# 1.70 16-Sep-2004 deraadt

add files missing for building a proper lint library


Revision tags: OPENBSD_3_5_BASE OPENBSD_3_6_BASE
# 1.69 13-Feb-2004 tedu

death to osigaltstack. ok deraadt@


# 1.68 15-Jan-2004 deraadt

ABI breakage happened with the sigaltstack replacement. It is too late,
now we just have to cope. Since setjmp uses it, the alpha and sparc64 are
unhappy with the structure change. In a few days, we will make the second
hop here, for now, use the old system call until all binaries have the new
struct in them.


# 1.67 12-Jan-2004 tedu

new syscall closefrom(2). ok deraadt millert


Revision tags: OPENBSD_3_4_BASE
# 1.66 10-May-2003 miod

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


# 1.65 14-Apr-2003 art

There are two related changes.

The first one is an mquery(2) syscall. It's for asking the VM system
about where to map things. It will be used by ld.so, read the man page
for details.

The second change is related and is a centralization of uvm_map hint
that all callers of uvm_map calculated. This will allow us to adjust
this hint on architectures that have segments for non-exec mappings.

deraadt@ drahn@ ok.


Revision tags: OPENBSD_3_3_BASE
# 1.64 31-Jan-2003 millert

Replace emulated versions of setreuid() and setregid() with real syscalls.
These are spec'd by POSIX as of 1003.1-2001; deraadt@ OK


# 1.63 02-Dec-2002 millert

Document getlogin_r()


# 1.62 02-Dec-2002 miod

Import propolice (http://www.trl.ibm.com/projects/security/ssp), a stack
attack protection scheme, into gcc.

This protection is enabled by default. It can be turned off by using the
-fno-stack-protector flag.

Code by Hiroaki Etoh (etoh at jp dot ibm dot com); work on openbsd-specific
integration by fgsch@, deraadt@ and myself; tests by fgsch@, naddy@ and
myself; beer drinking by myself.

Please note that system upgrades with this new code will require a new
libc and ld.so to be build and installed before the propolice-enabled
compiler can be installed.


# 1.61 10-Nov-2002 fgsch

missing MLINKs for setresuid(2). millert ok.


# 1.60 05-Nov-2002 marc

thread safe libc -- 2nd try. OK miod@, millert@
Thanks to miod@ for m68k and vax fixes


# 1.59 03-Nov-2002 marc

back out previous patch.. there are still some vax/m68k issues


# 1.58 03-Nov-2002 marc

libc changes for thread safety. Tested on:
alpha (millert@), i386 (marc@), m68k (millert@ and miod@),
powerpc (drahn@ and dhartmei@), sparc (millert@ and marc@),
sparc64 (marc@), and vax (millert@ and miod@).
Thanks to millert@, miod@, and mickey@ for fixes along the way.


# 1.57 30-Oct-2002 millert

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


Revision tags: OPENBSD_3_2_BASE
# 1.56 05-Aug-2002 art

Fix brain blackout.
Pointed out byb miod@.


# 1.55 05-Aug-2002 art

One more ELF_TOOLCHAIN.


# 1.54 06-Jul-2002 nordin

Remove kernel support for NTP. ok deraadt@ and tholo@


# 1.53 10-Jun-2002 fgsch

correct comment.


# 1.52 08-Jun-2002 drahn

ELF architectures all support weak aliases, enable them for this part.
ok fgsch@


Revision tags: OPENBSD_3_1_BASE
# 1.51 22-Feb-2002 drahn

Extended Attribute support, from FreeBSD/TrustedBSD. ok art@ deraadt@
libc support pieces


# 1.50 21-Feb-2002 art

remove rfork.o from the auto-generated assembler stubs


# 1.49 17-Feb-2002 deraadt

rfork() needs a fork.S-like stub as well; ok art


Revision tags: OPENBSD_3_0_BASE
# 1.48 25-Sep-2001 niklas

Forgotten DEBUGLIBS stuff


# 1.47 25-Sep-2001 drahn

Add an ASPICFLAG variable to bsd.own.mk which a platform use to pass flags
to 'as' to make it compile pic. add defaults for sparc64 which needs picflags
set to -fPIC and ASPICFLAGS to -KPIC.
Also simplifies the systemcall generation for sparc64 PIC mode.
ok epsie@.


# 1.46 20-Sep-2001 millert

Add PSEUDO_NOERROR similar to that used by NetBSD.
Some ports were setting errno in PSEUDO and some were not. Now errno
is set for all in PSEUDO and PSEUDO_NOERROR is provided for the
non-errno case (only used by _exit).

Needs testing on vax and m88k.
XXX - hppa and powerpc still lack a real PSEUDO_NOERROR implementation.
Currently PSEUDO_NOERROR and PSEUDO are the same (so builds don't
break on those platforms).


# 1.45 09-Jul-2001 fgsch

Install getpeereid(2) manpage.


# 1.44 26-Jun-2001 dugsong

implement djb's getpeereid(2), to allow local-domain servers to determine client credentials. mostly from superscript.com. deraadt@ ok


Revision tags: OPENBSD_2_9_BASE
# 1.43 14-Mar-2001 aaron

Move description of exect() to execve(2) man page. Add a note about exect() not
being portable.


# 1.42 09-Mar-2001 art

Add mlockall and munlockall. man-page from NetBSD.


# 1.41 10-Jan-2001 deraadt

put up FD_* manual pages, in section 3


# 1.40 23-Dec-2000 deraadt

create proper docs for timer{add,clear,sub,isset,cmp}


# 1.39 16-Nov-2000 provos

kqueue and kevent system calls


Revision tags: OPENBSD_2_8_BASE
# 1.38 17-Oct-2000 deraadt

damn it, i have had it with this untested weak shit


# 1.37 16-Oct-2000 deraadt

re-add weak sparc support; d@


# 1.36 15-May-2000 niklas

Add support for building libraries with debugging information in them.
Enable by setting DEBUGLIBS=yes in /etc/mk.conf, then -g libraries will get
installed in /usr/lib/debug. This directory will be searched first if
gcc is given the -g flag during the link stage.


Revision tags: OPENBSD_2_7_BASE
# 1.35 01-May-2000 deraadt

bye bye semconfig(2)


# 1.34 20-Apr-2000 deraadt

p{read,write}{,v} man pages


# 1.33 07-Feb-2000 assar

add fhopen, fhstat, fhstatfs system calls. largely from NetBSD


# 1.32 06-Jan-2000 d

for now, disable weak aliases for all archs except i386


# 1.31 14-Dec-1999 millert

Install swapctl.2, not swapon.2. swapon.2 should probably go away.


Revision tags: OPENBSD_2_6_BASE
# 1.30 07-Jun-1999 deraadt

replacement pipe() system call; copies data into place inside kernel, so
that EFAULT return value is possible


# 1.29 22-May-1999 weingart

Add swapctl(2), and crank shlib minor.


Revision tags: OPENBSD_2_5_BASE
# 1.28 01-Feb-1999 d

mi ptrace


# 1.27 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


Revision tags: OPENBSD_2_4_BASE
# 1.26 18-Sep-1998 art

make use of xfspioctl


Revision tags: OPENBSD_2_3_BASE
# 1.25 08-Feb-1998 tholo

Better lint(1) framework. Mostly from cgd@NetBSD


# 1.24 13-Nov-1997 deraadt

add getsid(2), XPG4


Revision tags: OPENBSD_2_2_BASE
# 1.23 30-May-1997 kstailey

add getpgrp(2) from NetBSD


Revision tags: OPENBSD_2_1_BASE
# 1.22 08-May-1997 kstailey

add tag


# 1.21 08-May-1997 kstailey

make clock_gettime.cat2


# 1.20 20-Apr-1997 tholo

New POSIX 1003.1b syscalls; from pk@NetBSD


# 1.19 04-Apr-1997 deraadt

seek(2) is not needed


# 1.18 29-Mar-1997 deraadt

futimes link; nakayosh@kcn.or.jp


# 1.17 26-Mar-1997 deraadt

install ktrace(2)


# 1.16 26-Jan-1997 downsj

Add a link for lchown.2


# 1.15 26-Jan-1997 downsj

Add lchown(), increment minor number.


# 1.14 11-Dec-1996 deraadt

generate reboot.o like other system calls


Revision tags: OPENBSD_2_0_BASE
# 1.13 02-Sep-1996 deraadt

shmdt link


# 1.12 25-Aug-1996 deraadt

and a man page


# 1.11 18-Jun-1996 deraadt

build poll.o


# 1.10 19-May-1996 pefo

Changes for mips.


# 1.9 18-May-1996 deraadt

poll() as a system call


# 1.8 08-May-1996 deraadt

install rfork man page


# 1.7 01-May-1996 deraadt

add futimes


# 1.6 25-Mar-1996 tholo

Add support for building lint(1) library


# 1.5 29-Jan-1996 tholo

Add kernel PLL for system clock
Add ntp_adjtime() and ntp_gettime() system calls
Mostly stolen from FreeBSD


# 1.4 08-Jan-1996 deraadt

add rfork.o and minherit.o


# 1.3 07-Jan-1996 deraadt

add minherit() system call


# 1.2 14-Dec-1995 deraadt

from netbsd:
add & fix a bunch of system call pages


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.156 11-Jan-2019 deraadt

mincore() is a relic from the past, exposing physical machine information
about shared resources which no program should see. only a few pieces of
software use it, generally poorly thought out. they are being fixed, so
mincore() can be deleted.
ok guenther tedu jca sthen, others


Revision tags: OPENBSD_6_4_BASE
# 1.155 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.154 12-Jan-2018 deraadt

sysctl(3) can now be renamed to sysctl(2)


# 1.153 28-Nov-2017 guenther

Delete fktrace(2). The consequences of it were not thought through
sufficiently and at least one horrific security hole was the result.

ok deraadt@ beck@


Revision tags: OPENBSD_6_2_BASE
# 1.152 13-Aug-2017 tedu

add fktrace to libc


# 1.151 12-Aug-2017 guenther

Instead of hardcoding a partial dependency list for the syscall stub objects,
calculate them as done for other objects


# 1.150 31-May-2017 sthen

install futex(2), ok mpi


# 1.149 30-Apr-2017 mpi

Add futex(2) shim, bump minor.

Inputs from guenther@, ok kettenis@, visa@


Revision tags: OPENBSD_6_1_BASE
# 1.148 29-Mar-2017 deraadt

The hppa version of as(1) requires whitespace before a .file directive,
it may not be in column 0. This kind of thing is very common in GNU
and Linux software because the software was written from the start to
be 'compatible replacements' of vendor software.
ok jsing guenther


# 1.147 26-Mar-2017 guenther

Use .file to convince 'as' to generate proper FILE symbols in the syscall
stubs that aren't actually in files, so that syspatch can figure out what
order the syscall stub objects are in the .so. Use -P to suppress to #line
directives that would override that. Tested with both gcc/gas and clang.

ok deraadt@


Revision tags: OPENBSD_6_0_BASE
# 1.146 04-Jul-2016 guenther

DEBUGLIBS has been broken since the gcc4 switch, so delete it. CFLAGS
contains -g by default anyway

problem noted by Edgar Pettijohn (edgar (at) pettijohn-web.com)
ok millert@ kettenis@ deraadt@


# 1.145 30-May-2016 guenther

Move __getcwd from ASM to HIDDEN: we don't want the literal __getcwd symbol

ok millert@ deraadt@


# 1.144 19-May-2016 guenther

Add ASM_NOERR for syscalls that never fail and thus don't need the errno
setting logic...which can significantly reduce the size of the stub on
some archs; 20 syscalls get a trim with this.

in snaps for a bit and ok deraadt@


# 1.143 09-May-2016 guenther

Remove sigreturn declaration and the now-unused libc syscall stub


# 1.142 07-May-2016 guenther

Use a Thread Information Block in both single and multi-threaded programs.
This stores errno, the cancelation flags, and related bits for each thread
and is allocated by ld.so or libc.a. This is an ABI break from 5.9-stable!

Make libpthread dlopen'able by moving the cancelation wrappers into libc
and doing locking and fork/errno handling via callbacks that libpthread
registers when it first initializes. 'errno' *must* be declared via
<errno.h> now!

Clean up libpthread's symbol exports like libc.

On powerpc, offset the TIB/TCB/TLS data from the register per the ELF spec.

Testing by various, particularly sthen@ and patrick@
ok kettenis@


# 1.141 30-Mar-2016 guenther

Turd polish: use HIDDEN= instead of PSEUDO= for ptrace syscall stub, to
make its underlying symbol name look like others.


# 1.140 30-Mar-2016 guenther

Eliminate userspace caching by getlogin_r/setlogin; make the getlogin
syscall behave exactly like userspace getlogin_r() and rename it to
match. Eliminate the reduced-to-no-op wrappers of the syscalls.
Eliminate the unnecessary per-thread static buffering by getlogin().

ok kettenis@ deraadt@


# 1.139 30-Mar-2016 jmc

for some time now mandoc has not required MLINKS to function
correctly - logically complete that now by removing MLINKS from base;

authors need only to ensure there is an entry in NAME for any function/
util being added. MLINKS will still work, and remain for perl to ease
upgrades;

ok nicm (curses) bcook (ssl)
ok schwarze, who provided a lot of feedback and assistance
ok tb natano jung


# 1.138 21-Mar-2016 bluhm

Rename the system call sendsyslog2 to sendsyslog. Keep the old one
as osendsyslog for a while. The three argument variant is the only
one that will stay.
input kettenis@; OK deraadt@


Revision tags: OPENBSD_5_9_BASE
# 1.137 25-Nov-2015 deraadt

Add a syscall stub for sendsyslog2(2), and use it in syslog_r(3), passing
LOG_CONS to the kernel. As a result, the /dev/console opening code can
be removed.
ok kettenis millert beck


# 1.136 10-Nov-2015 guenther

Split the intra-thread functionality from kill(2) into its own syscall
thrkill(2), rolling the kill(2) syscall number with the ABI change to
avoid breaking binaries during during the transition. thrkill(2) includes
a 'tcb' argument that eliminates the need for locking in pthread_kill()
and simplifies pthread_cancel(). Switch __stack_smash_handler() to use
thrkill(2) and explicitly unblock SIGABRT.

Minor bump to both libc and libpthread: make sure you install a new kernel!

ok semarie@


# 1.135 23-Oct-2015 guenther

Merge the sigaction() and sigprocmask() overloads/wrappers from libpthread
into libc, and move pthread_sigmask() as well (just a trivial wrapper).
This provides consistent handling of SIGTHR between single- and multi-threaded
programs and is a step in the merge of all the libpthread overloads, providing
some ASM and Makefile bits that the other wrappers will need.

ok deraadt@ millert@


# 1.134 23-Oct-2015 deraadt

Remove dnssocket() and dnsconnect(), since we decided to use a SOCK_DNS
flag instead.
ok guenther tedu semarie


# 1.133 19-Oct-2015 deraadt

Remove old tame() stub


# 1.132 18-Oct-2015 deraadt

create libc stubs for dnssocket() and dnsconnect()


# 1.131 09-Oct-2015 deraadt

tame -> pledge conversion, in libc. I should crank libc, but am cheating
hoping things go well. The old symbol is faked via a stupid stub function,
until next major crank when it can be removed. I am expecting guenther
to scream at me.


# 1.130 13-Sep-2015 guenther

Rename __sysctl syscall to just sysctl, as the userland wrapper is no longer
necessary

ok deraadt@ jsing@


# 1.129 09-Sep-2015 guenther

Simplify makefile rules for building the ASM stubs into "pick something
from column A and something from column B".

ok miod@ deraadt@


# 1.128 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@


# 1.127 25-Aug-2015 guenther

Document kbind(2)


Revision tags: OPENBSD_5_8_BASE
# 1.126 19-Jul-2015 deraadt

manual page for tame(2). not very good, so i will be hearing from jmc


# 1.125 07-Apr-2015 guenther

Make pthread_atfork() track the DSO that called it like atexit() does,
unregistering callbacks if the DSO is unloaded. Move the callback
handling from libpthread to libc, though libpthread still overrides the
inner call to handle locking and thread-library reinitialization.
Major version bump for both libc and libpthread.

verification that this fixes various ports ajacoutot@
asm assistance miod@; ok millert@ deraadt@


Revision tags: OPENBSD_5_7_BASE
# 1.124 08-Dec-2014 guenther

Add chflagsat(), modeled on fchmodat() with name to match FreeBSD.


# 1.123 14-Nov-2014 guenther

Add sched_yield(2) manpage


# 1.122 31-Aug-2014 guenther

Declare and document getthrid()

indirectly prodded by krw@


# 1.121 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@


# 1.120 14-Aug-2014 tobias

fixed overrid(d)en typo

millert@ and jmc@ agree that "overriden" is wrong


Revision tags: OPENBSD_5_6_BASE
# 1.119 12-Jul-2014 deraadt

document sendsyslog(2); ok guenther tedu matthew


# 1.118 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.117 18-Mar-2014 miod

Retire hp300, mvme68k and mvme88k ports. These ports have no users, keeping
this hardware alive is becoming increasingly difficult, and I should heed the
message sent by the three disks which have died on me over the last few days.

Noone sane will mourn these ports anyway. So long, and thanks for the fish.


Revision tags: OPENBSD_5_5_BASE
# 1.116 13-Oct-2013 guenther

Make it possible to build to reduced version of a library, including
just specific objects that are compiled with additional options to
reduce their size. For use by distrib/ and crunchgen.

style and naming assistance from espie@


# 1.115 07-Oct-2013 guenther

getdirentries(2) is dead; long live getdents(2)!

confirmation that getdirentries(2) is unused by ports from sthen@ and naddy@


# 1.114 13-Aug-2013 guenther

Switch time_t, ino_t, clock_t, and struct kevent's ident and data
members to 64bit types. Assign new syscall numbers for (almost
all) the syscalls that involve the affected types, including anything
with time_t, timeval, itimerval, timespec, rusage, dirent, stat,
or kevent arguments. Add a d_off member to struct dirent and replace
getdirentries() with getdents(), thus immensely simplifying and
accelerating telldir/seekdir. Build perl with -DBIG_TIME.

Bump the major on every single base library: the compat bits included
here are only good enough to make the transition; the T32 compat
option will be burned as soon as we've reached the new world are
are happy with the snapshots for all architectures.

DANGER: ABI incompatibility. Updating to this kernel requires extra
work or you won't be able to login: install a snapshot instead.

Much assistance in fixing userland issues from deraadt@ and tedu@
and build assistance from todd@ and otto@


Revision tags: OPENBSD_5_4_BASE
# 1.113 05-Jun-2013 guenther

Move _Exit() from the exit() manpage to the _exit() manpage, as it's
just an alias of the latter.

ok matthew@ tedu@


# 1.112 01-Jun-2013 miod

Add utrace(2), a system call allowing for userland to send its own ktrace
records. From FreeBSD via otto@, with tweaks suggested by guenther@.
Commite on behalf of otto@ who is not around, to ride the libc minor bump.
Causes a librthread minor bump as well (new syscall).


# 1.111 29-Apr-2013 matthew

Extend P_SIGSUSPEND handling in userret() to properly restore the
sigmask even if there are no pending signals under the temporary
sigmask.

Refactor existing select() and poll() system calls to introduce the
pselect() and ppoll() system calls.

Add rthread wrappers for pselect() and ppoll(). While there, update
cancellation point comments to reflect recent fdatasync() addition.

Minor bumps for libc and librthread due to new symbols.

ok guenther, millert, deraadt, jmc


# 1.110 15-Apr-2013 matthew

Implement fdatasync() as a wrapper around fsync()

ok guenther, deraadt, jmc


Revision tags: OPENBSD_5_3_BASE
# 1.109 03-Feb-2013 miod

gremlin crept in


# 1.108 02-Feb-2013 miod

Userland bits for m68k/ELF. Mostly addition of register prefixes to the
assembler instructions, and cope with the few changes in return values
location.


# 1.107 04-Sep-2012 okan

remove lint leftovers; ok guenther@


# 1.106 23-Aug-2012 deraadt

no more nnpfspioctl() system call; ok guenther


# 1.105 22-Aug-2012 pascal

Convert cpp | as rules in bsd.lib.mk and lib/libc/sys/Makefile.inc to pure cc
invocations. This allows us to use the compiler builtin define __PIC__ to check
for PIC/PIEness rather than passing -DPIC. Simplifies PIE work a lot.

ok matthew@, conceptually ok kurt@


# 1.104 21-Aug-2012 pascal

Kill an old mips workaround; we don't support mips, just mips64.

ok deraadt@ kettenis@


Revision tags: OPENBSD_5_2_BASE
# 1.103 19-Jun-2012 deraadt

oops, forgot to install getdtablecount(2); noted by tedu


# 1.102 12-Apr-2012 deraadt

remove rfork(); ok guenther miod


# 1.101 12-Apr-2012 deraadt

kill lfs system call lines and libc stubs


# 1.100 12-Apr-2012 deraadt

New system call: getdtablecount(2) returns the number of file
descriptors the process currently has open.
ok guenther miod gilles ...


# 1.99 22-Mar-2012 guenther

Move __tfork_thread() from rthreads (libpthread) to libc so that
it can be used for not-strictly-threading purposes

ok matthew@ kurt@


# 1.98 13-Mar-2012 guenther

Add manpages for __thrsigdivert, __thrsleep, and __thrwakeup. Various
syntax and grammar fixes from jmc@


Revision tags: OPENBSD_5_1_BASE
# 1.97 17-Jan-2012 guenther

Reimplement mutexes, condvars, and rwlocks to eliminate bugs,
particularly the "consume the signal you just sent" hang, and putting
the wait queues in userspace.

Do cancellation handling in pthread_cond_*wait(), pthread_join(),
and sem_wait().

Add __ prefix to thr{sleep,wakeup,exit,sigdivert}() syscalls; add
'abort" argument to thrsleep to close cancellation race; make
thr{sleep,wakeup} return errno values via *retval to avoid touching
userspace errno.


# 1.96 22-Nov-2011 guenther

sigstack() is long dead, and the compat sigaltstack syscall is gone too.
Correct the namespace protections for sigreturn(), sigwait(), and psignal()

ok millert@


# 1.95 16-Oct-2011 guenther

Add stubs and manpage for __{get,set}_tcb

ok deraadt@


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

Add (rough draft) documentation for fdopendir(3) and the 15 new
XXXat(2) system calls from POSIX 2008. Editing will be done in tree.

General style discussed with jmc@, schwarze@, and deraadt@
ok jmc@


# 1.93 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@


Revision tags: OPENBSD_4_8_BASE OPENBSD_4_9_BASE
# 1.92 03-Jul-2010 guenther

Fix the naming of interfaces and variables for rdomains and rtables
and make it possible to bind sockets (including listening sockets!)
to rtables and not just rdomains. This changes the name of the
system calls, socket option, and ioctl. After building with this
you should remove the files /usr/share/man/cat2/[gs]etrdomain.0.

Since this removes the existing [gs]etrdomain() system calls, the
libc major is bumped.

Written by claudio@, criticized^Wcritiqued by me


# 1.91 01-Jul-2010 deraadt

getpeereid() can now be a library routine using getsockopt() with
SOL_SOCKET and SO_PEERCRED, only issue being that it cannot return
EFAULT for a page fault. The kernel code will soon be put into
compat, and then in 10 years or so tedu will delete it.
ok guenther millert


# 1.90 18-May-2010 tedu

add posix_madvise, posix_memalign, strndup, and strnlen. mostly from
brad and millert, with hints from guenther, jmc, and otto I think.
ok previous.


Revision tags: OPENBSD_4_7_BASE
# 1.89 03-Feb-2010 miod

Use MACHINE_CPU instead of MACHINE_ARCH to pick the correct machine dependent
files or directories when applicable.
The inspiration and name of MACHINE_CPU come from NetBSD, although the way to
provide it to Makefiles is completely different.
ok kettenis@


# 1.88 27-Nov-2009 guenther

Add setrdomain() and getrdomain() system calls. Committing now to
catch the libc major bump per request from deraadt@

Diff by reyk.

ok guenther@


# 1.87 13-Aug-2009 jmc

various MLINK fixes from Alan R. S. Bueno;


Revision tags: OPENBSD_4_6_BASE
# 1.86 03-Jun-2009 jj

Arla client rename from xfs to nnpfs for later upgrades. Tested on various arches. ok todd@ beck@


Revision tags: OPENBSD_4_4_BASE OPENBSD_4_5_BASE
# 1.85 22-Mar-2008 otto

move statvfs.c to gen, since it is not a syscall; ok deraadt@


# 1.84 16-Mar-2008 otto

statvfs support


Revision tags: OPENBSD_4_3_BASE
# 1.83 05-Jan-2008 deraadt

no more need for vadvise.o


# 1.82 09-Sep-2007 otto

Add lint stubs for the longjmp family of functions which are defined in
assembly on all platforms. ok deraadt@


# 1.81 09-Sep-2007 otto

Silence erroneous "environ used, but not defined" lint warning by
providing a stub. ok deraadt@


Revision tags: OPENBSD_4_1_BASE OPENBSD_4_2_BASE
# 1.80 24-Oct-2006 tedu

add rthread syscalls and bump minor.
rthreads are hardly done, but if just trying it out is too much of a hassle,
we'll never make more progress.
ok brad marc marco mbalmer


# 1.79 10-Oct-2006 deraadt

MLINKS to macros described in stat(2)


Revision tags: OPENBSD_4_0_BASE
# 1.78 14-Jun-2006 otto

Introducing adjfreq(2), to adjust the clock frequency.
Loosely based on dragonfly code. Man page help fro jmc@; ok deraadt@


# 1.77 27-May-2006 pedro

Make libc's getcwd() use the new __getcwd() system call
Hacked by marius@ at c2k5, okay miod@ krw@ deraadt@


# 1.76 13-Mar-2006 moritz

Clean the correct file. ok deraadt@


Revision tags: OPENBSD_3_9_BASE
# 1.75 29-Nov-2005 deraadt

Provide stubs for things which are supplied by crt0. I don't think we
want a crt0.ln, at least, not yet. We may reconsider later.


# 1.74 03-Oct-2005 jmc

add missing MLINK for WEXITSTATUS.2


Revision tags: OPENBSD_3_8_BASE
# 1.73 17-Jun-2005 drahn

Extended Attributes was a piece to get to ACLs, however ACLs have not
been worked on, so EA is pointless to maintain.


# 1.72 17-Jun-2005 millert

remove undelete syscall


Revision tags: OPENBSD_3_7_BASE
# 1.71 18-Sep-2004 deraadt

MLINK to macros provided in wait.2


# 1.70 16-Sep-2004 deraadt

add files missing for building a proper lint library


Revision tags: OPENBSD_3_5_BASE OPENBSD_3_6_BASE
# 1.69 13-Feb-2004 tedu

death to osigaltstack. ok deraadt@


# 1.68 15-Jan-2004 deraadt

ABI breakage happened with the sigaltstack replacement. It is too late,
now we just have to cope. Since setjmp uses it, the alpha and sparc64 are
unhappy with the structure change. In a few days, we will make the second
hop here, for now, use the old system call until all binaries have the new
struct in them.


# 1.67 12-Jan-2004 tedu

new syscall closefrom(2). ok deraadt millert


Revision tags: OPENBSD_3_4_BASE
# 1.66 10-May-2003 miod

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


# 1.65 14-Apr-2003 art

There are two related changes.

The first one is an mquery(2) syscall. It's for asking the VM system
about where to map things. It will be used by ld.so, read the man page
for details.

The second change is related and is a centralization of uvm_map hint
that all callers of uvm_map calculated. This will allow us to adjust
this hint on architectures that have segments for non-exec mappings.

deraadt@ drahn@ ok.


Revision tags: OPENBSD_3_3_BASE
# 1.64 31-Jan-2003 millert

Replace emulated versions of setreuid() and setregid() with real syscalls.
These are spec'd by POSIX as of 1003.1-2001; deraadt@ OK


# 1.63 02-Dec-2002 millert

Document getlogin_r()


# 1.62 02-Dec-2002 miod

Import propolice (http://www.trl.ibm.com/projects/security/ssp), a stack
attack protection scheme, into gcc.

This protection is enabled by default. It can be turned off by using the
-fno-stack-protector flag.

Code by Hiroaki Etoh (etoh at jp dot ibm dot com); work on openbsd-specific
integration by fgsch@, deraadt@ and myself; tests by fgsch@, naddy@ and
myself; beer drinking by myself.

Please note that system upgrades with this new code will require a new
libc and ld.so to be build and installed before the propolice-enabled
compiler can be installed.


# 1.61 10-Nov-2002 fgsch

missing MLINKs for setresuid(2). millert ok.


# 1.60 05-Nov-2002 marc

thread safe libc -- 2nd try. OK miod@, millert@
Thanks to miod@ for m68k and vax fixes


# 1.59 03-Nov-2002 marc

back out previous patch.. there are still some vax/m68k issues


# 1.58 03-Nov-2002 marc

libc changes for thread safety. Tested on:
alpha (millert@), i386 (marc@), m68k (millert@ and miod@),
powerpc (drahn@ and dhartmei@), sparc (millert@ and marc@),
sparc64 (marc@), and vax (millert@ and miod@).
Thanks to millert@, miod@, and mickey@ for fixes along the way.


# 1.57 30-Oct-2002 millert

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


Revision tags: OPENBSD_3_2_BASE
# 1.56 05-Aug-2002 art

Fix brain blackout.
Pointed out byb miod@.


# 1.55 05-Aug-2002 art

One more ELF_TOOLCHAIN.


# 1.54 06-Jul-2002 nordin

Remove kernel support for NTP. ok deraadt@ and tholo@


# 1.53 10-Jun-2002 fgsch

correct comment.


# 1.52 08-Jun-2002 drahn

ELF architectures all support weak aliases, enable them for this part.
ok fgsch@


Revision tags: OPENBSD_3_1_BASE
# 1.51 22-Feb-2002 drahn

Extended Attribute support, from FreeBSD/TrustedBSD. ok art@ deraadt@
libc support pieces


# 1.50 21-Feb-2002 art

remove rfork.o from the auto-generated assembler stubs


# 1.49 17-Feb-2002 deraadt

rfork() needs a fork.S-like stub as well; ok art


Revision tags: OPENBSD_3_0_BASE
# 1.48 25-Sep-2001 niklas

Forgotten DEBUGLIBS stuff


# 1.47 25-Sep-2001 drahn

Add an ASPICFLAG variable to bsd.own.mk which a platform use to pass flags
to 'as' to make it compile pic. add defaults for sparc64 which needs picflags
set to -fPIC and ASPICFLAGS to -KPIC.
Also simplifies the systemcall generation for sparc64 PIC mode.
ok epsie@.


# 1.46 20-Sep-2001 millert

Add PSEUDO_NOERROR similar to that used by NetBSD.
Some ports were setting errno in PSEUDO and some were not. Now errno
is set for all in PSEUDO and PSEUDO_NOERROR is provided for the
non-errno case (only used by _exit).

Needs testing on vax and m88k.
XXX - hppa and powerpc still lack a real PSEUDO_NOERROR implementation.
Currently PSEUDO_NOERROR and PSEUDO are the same (so builds don't
break on those platforms).


# 1.45 09-Jul-2001 fgsch

Install getpeereid(2) manpage.


# 1.44 26-Jun-2001 dugsong

implement djb's getpeereid(2), to allow local-domain servers to determine client credentials. mostly from superscript.com. deraadt@ ok


Revision tags: OPENBSD_2_9_BASE
# 1.43 14-Mar-2001 aaron

Move description of exect() to execve(2) man page. Add a note about exect() not
being portable.


# 1.42 09-Mar-2001 art

Add mlockall and munlockall. man-page from NetBSD.


# 1.41 10-Jan-2001 deraadt

put up FD_* manual pages, in section 3


# 1.40 23-Dec-2000 deraadt

create proper docs for timer{add,clear,sub,isset,cmp}


# 1.39 16-Nov-2000 provos

kqueue and kevent system calls


Revision tags: OPENBSD_2_8_BASE
# 1.38 17-Oct-2000 deraadt

damn it, i have had it with this untested weak shit


# 1.37 16-Oct-2000 deraadt

re-add weak sparc support; d@


# 1.36 15-May-2000 niklas

Add support for building libraries with debugging information in them.
Enable by setting DEBUGLIBS=yes in /etc/mk.conf, then -g libraries will get
installed in /usr/lib/debug. This directory will be searched first if
gcc is given the -g flag during the link stage.


Revision tags: OPENBSD_2_7_BASE
# 1.35 01-May-2000 deraadt

bye bye semconfig(2)


# 1.34 20-Apr-2000 deraadt

p{read,write}{,v} man pages


# 1.33 07-Feb-2000 assar

add fhopen, fhstat, fhstatfs system calls. largely from NetBSD


# 1.32 06-Jan-2000 d

for now, disable weak aliases for all archs except i386


# 1.31 14-Dec-1999 millert

Install swapctl.2, not swapon.2. swapon.2 should probably go away.


Revision tags: OPENBSD_2_6_BASE
# 1.30 07-Jun-1999 deraadt

replacement pipe() system call; copies data into place inside kernel, so
that EFAULT return value is possible


# 1.29 22-May-1999 weingart

Add swapctl(2), and crank shlib minor.


Revision tags: OPENBSD_2_5_BASE
# 1.28 01-Feb-1999 d

mi ptrace


# 1.27 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


Revision tags: OPENBSD_2_4_BASE
# 1.26 18-Sep-1998 art

make use of xfspioctl


Revision tags: OPENBSD_2_3_BASE
# 1.25 08-Feb-1998 tholo

Better lint(1) framework. Mostly from cgd@NetBSD


# 1.24 13-Nov-1997 deraadt

add getsid(2), XPG4


Revision tags: OPENBSD_2_2_BASE
# 1.23 30-May-1997 kstailey

add getpgrp(2) from NetBSD


Revision tags: OPENBSD_2_1_BASE
# 1.22 08-May-1997 kstailey

add tag


# 1.21 08-May-1997 kstailey

make clock_gettime.cat2


# 1.20 20-Apr-1997 tholo

New POSIX 1003.1b syscalls; from pk@NetBSD


# 1.19 04-Apr-1997 deraadt

seek(2) is not needed


# 1.18 29-Mar-1997 deraadt

futimes link; nakayosh@kcn.or.jp


# 1.17 26-Mar-1997 deraadt

install ktrace(2)


# 1.16 26-Jan-1997 downsj

Add a link for lchown.2


# 1.15 26-Jan-1997 downsj

Add lchown(), increment minor number.


# 1.14 11-Dec-1996 deraadt

generate reboot.o like other system calls


Revision tags: OPENBSD_2_0_BASE
# 1.13 02-Sep-1996 deraadt

shmdt link


# 1.12 25-Aug-1996 deraadt

and a man page


# 1.11 18-Jun-1996 deraadt

build poll.o


# 1.10 19-May-1996 pefo

Changes for mips.


# 1.9 18-May-1996 deraadt

poll() as a system call


# 1.8 08-May-1996 deraadt

install rfork man page


# 1.7 01-May-1996 deraadt

add futimes


# 1.6 25-Mar-1996 tholo

Add support for building lint(1) library


# 1.5 29-Jan-1996 tholo

Add kernel PLL for system clock
Add ntp_adjtime() and ntp_gettime() system calls
Mostly stolen from FreeBSD


# 1.4 08-Jan-1996 deraadt

add rfork.o and minherit.o


# 1.3 07-Jan-1996 deraadt

add minherit() system call


# 1.2 14-Dec-1995 deraadt

from netbsd:
add & fix a bunch of system call pages


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.155 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.154 12-Jan-2018 deraadt

sysctl(3) can now be renamed to sysctl(2)


# 1.153 28-Nov-2017 guenther

Delete fktrace(2). The consequences of it were not thought through
sufficiently and at least one horrific security hole was the result.

ok deraadt@ beck@


Revision tags: OPENBSD_6_2_BASE
# 1.152 13-Aug-2017 tedu

add fktrace to libc


# 1.151 12-Aug-2017 guenther

Instead of hardcoding a partial dependency list for the syscall stub objects,
calculate them as done for other objects


# 1.150 31-May-2017 sthen

install futex(2), ok mpi


# 1.149 30-Apr-2017 mpi

Add futex(2) shim, bump minor.

Inputs from guenther@, ok kettenis@, visa@


Revision tags: OPENBSD_6_1_BASE
# 1.148 29-Mar-2017 deraadt

The hppa version of as(1) requires whitespace before a .file directive,
it may not be in column 0. This kind of thing is very common in GNU
and Linux software because the software was written from the start to
be 'compatible replacements' of vendor software.
ok jsing guenther


# 1.147 26-Mar-2017 guenther

Use .file to convince 'as' to generate proper FILE symbols in the syscall
stubs that aren't actually in files, so that syspatch can figure out what
order the syscall stub objects are in the .so. Use -P to suppress to #line
directives that would override that. Tested with both gcc/gas and clang.

ok deraadt@


Revision tags: OPENBSD_6_0_BASE
# 1.146 04-Jul-2016 guenther

DEBUGLIBS has been broken since the gcc4 switch, so delete it. CFLAGS
contains -g by default anyway

problem noted by Edgar Pettijohn (edgar (at) pettijohn-web.com)
ok millert@ kettenis@ deraadt@


# 1.145 30-May-2016 guenther

Move __getcwd from ASM to HIDDEN: we don't want the literal __getcwd symbol

ok millert@ deraadt@


# 1.144 19-May-2016 guenther

Add ASM_NOERR for syscalls that never fail and thus don't need the errno
setting logic...which can significantly reduce the size of the stub on
some archs; 20 syscalls get a trim with this.

in snaps for a bit and ok deraadt@


# 1.143 09-May-2016 guenther

Remove sigreturn declaration and the now-unused libc syscall stub


# 1.142 07-May-2016 guenther

Use a Thread Information Block in both single and multi-threaded programs.
This stores errno, the cancelation flags, and related bits for each thread
and is allocated by ld.so or libc.a. This is an ABI break from 5.9-stable!

Make libpthread dlopen'able by moving the cancelation wrappers into libc
and doing locking and fork/errno handling via callbacks that libpthread
registers when it first initializes. 'errno' *must* be declared via
<errno.h> now!

Clean up libpthread's symbol exports like libc.

On powerpc, offset the TIB/TCB/TLS data from the register per the ELF spec.

Testing by various, particularly sthen@ and patrick@
ok kettenis@


# 1.141 30-Mar-2016 guenther

Turd polish: use HIDDEN= instead of PSEUDO= for ptrace syscall stub, to
make its underlying symbol name look like others.


# 1.140 30-Mar-2016 guenther

Eliminate userspace caching by getlogin_r/setlogin; make the getlogin
syscall behave exactly like userspace getlogin_r() and rename it to
match. Eliminate the reduced-to-no-op wrappers of the syscalls.
Eliminate the unnecessary per-thread static buffering by getlogin().

ok kettenis@ deraadt@


# 1.139 30-Mar-2016 jmc

for some time now mandoc has not required MLINKS to function
correctly - logically complete that now by removing MLINKS from base;

authors need only to ensure there is an entry in NAME for any function/
util being added. MLINKS will still work, and remain for perl to ease
upgrades;

ok nicm (curses) bcook (ssl)
ok schwarze, who provided a lot of feedback and assistance
ok tb natano jung


# 1.138 21-Mar-2016 bluhm

Rename the system call sendsyslog2 to sendsyslog. Keep the old one
as osendsyslog for a while. The three argument variant is the only
one that will stay.
input kettenis@; OK deraadt@


Revision tags: OPENBSD_5_9_BASE
# 1.137 25-Nov-2015 deraadt

Add a syscall stub for sendsyslog2(2), and use it in syslog_r(3), passing
LOG_CONS to the kernel. As a result, the /dev/console opening code can
be removed.
ok kettenis millert beck


# 1.136 10-Nov-2015 guenther

Split the intra-thread functionality from kill(2) into its own syscall
thrkill(2), rolling the kill(2) syscall number with the ABI change to
avoid breaking binaries during during the transition. thrkill(2) includes
a 'tcb' argument that eliminates the need for locking in pthread_kill()
and simplifies pthread_cancel(). Switch __stack_smash_handler() to use
thrkill(2) and explicitly unblock SIGABRT.

Minor bump to both libc and libpthread: make sure you install a new kernel!

ok semarie@


# 1.135 23-Oct-2015 guenther

Merge the sigaction() and sigprocmask() overloads/wrappers from libpthread
into libc, and move pthread_sigmask() as well (just a trivial wrapper).
This provides consistent handling of SIGTHR between single- and multi-threaded
programs and is a step in the merge of all the libpthread overloads, providing
some ASM and Makefile bits that the other wrappers will need.

ok deraadt@ millert@


# 1.134 23-Oct-2015 deraadt

Remove dnssocket() and dnsconnect(), since we decided to use a SOCK_DNS
flag instead.
ok guenther tedu semarie


# 1.133 19-Oct-2015 deraadt

Remove old tame() stub


# 1.132 18-Oct-2015 deraadt

create libc stubs for dnssocket() and dnsconnect()


# 1.131 09-Oct-2015 deraadt

tame -> pledge conversion, in libc. I should crank libc, but am cheating
hoping things go well. The old symbol is faked via a stupid stub function,
until next major crank when it can be removed. I am expecting guenther
to scream at me.


# 1.130 13-Sep-2015 guenther

Rename __sysctl syscall to just sysctl, as the userland wrapper is no longer
necessary

ok deraadt@ jsing@


# 1.129 09-Sep-2015 guenther

Simplify makefile rules for building the ASM stubs into "pick something
from column A and something from column B".

ok miod@ deraadt@


# 1.128 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@


# 1.127 25-Aug-2015 guenther

Document kbind(2)


Revision tags: OPENBSD_5_8_BASE
# 1.126 19-Jul-2015 deraadt

manual page for tame(2). not very good, so i will be hearing from jmc


# 1.125 07-Apr-2015 guenther

Make pthread_atfork() track the DSO that called it like atexit() does,
unregistering callbacks if the DSO is unloaded. Move the callback
handling from libpthread to libc, though libpthread still overrides the
inner call to handle locking and thread-library reinitialization.
Major version bump for both libc and libpthread.

verification that this fixes various ports ajacoutot@
asm assistance miod@; ok millert@ deraadt@


Revision tags: OPENBSD_5_7_BASE
# 1.124 08-Dec-2014 guenther

Add chflagsat(), modeled on fchmodat() with name to match FreeBSD.


# 1.123 14-Nov-2014 guenther

Add sched_yield(2) manpage


# 1.122 31-Aug-2014 guenther

Declare and document getthrid()

indirectly prodded by krw@


# 1.121 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@


# 1.120 14-Aug-2014 tobias

fixed overrid(d)en typo

millert@ and jmc@ agree that "overriden" is wrong


Revision tags: OPENBSD_5_6_BASE
# 1.119 12-Jul-2014 deraadt

document sendsyslog(2); ok guenther tedu matthew


# 1.118 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.117 18-Mar-2014 miod

Retire hp300, mvme68k and mvme88k ports. These ports have no users, keeping
this hardware alive is becoming increasingly difficult, and I should heed the
message sent by the three disks which have died on me over the last few days.

Noone sane will mourn these ports anyway. So long, and thanks for the fish.


Revision tags: OPENBSD_5_5_BASE
# 1.116 13-Oct-2013 guenther

Make it possible to build to reduced version of a library, including
just specific objects that are compiled with additional options to
reduce their size. For use by distrib/ and crunchgen.

style and naming assistance from espie@


# 1.115 07-Oct-2013 guenther

getdirentries(2) is dead; long live getdents(2)!

confirmation that getdirentries(2) is unused by ports from sthen@ and naddy@


# 1.114 13-Aug-2013 guenther

Switch time_t, ino_t, clock_t, and struct kevent's ident and data
members to 64bit types. Assign new syscall numbers for (almost
all) the syscalls that involve the affected types, including anything
with time_t, timeval, itimerval, timespec, rusage, dirent, stat,
or kevent arguments. Add a d_off member to struct dirent and replace
getdirentries() with getdents(), thus immensely simplifying and
accelerating telldir/seekdir. Build perl with -DBIG_TIME.

Bump the major on every single base library: the compat bits included
here are only good enough to make the transition; the T32 compat
option will be burned as soon as we've reached the new world are
are happy with the snapshots for all architectures.

DANGER: ABI incompatibility. Updating to this kernel requires extra
work or you won't be able to login: install a snapshot instead.

Much assistance in fixing userland issues from deraadt@ and tedu@
and build assistance from todd@ and otto@


Revision tags: OPENBSD_5_4_BASE
# 1.113 05-Jun-2013 guenther

Move _Exit() from the exit() manpage to the _exit() manpage, as it's
just an alias of the latter.

ok matthew@ tedu@


# 1.112 01-Jun-2013 miod

Add utrace(2), a system call allowing for userland to send its own ktrace
records. From FreeBSD via otto@, with tweaks suggested by guenther@.
Commite on behalf of otto@ who is not around, to ride the libc minor bump.
Causes a librthread minor bump as well (new syscall).


# 1.111 29-Apr-2013 matthew

Extend P_SIGSUSPEND handling in userret() to properly restore the
sigmask even if there are no pending signals under the temporary
sigmask.

Refactor existing select() and poll() system calls to introduce the
pselect() and ppoll() system calls.

Add rthread wrappers for pselect() and ppoll(). While there, update
cancellation point comments to reflect recent fdatasync() addition.

Minor bumps for libc and librthread due to new symbols.

ok guenther, millert, deraadt, jmc


# 1.110 15-Apr-2013 matthew

Implement fdatasync() as a wrapper around fsync()

ok guenther, deraadt, jmc


Revision tags: OPENBSD_5_3_BASE
# 1.109 03-Feb-2013 miod

gremlin crept in


# 1.108 02-Feb-2013 miod

Userland bits for m68k/ELF. Mostly addition of register prefixes to the
assembler instructions, and cope with the few changes in return values
location.


# 1.107 04-Sep-2012 okan

remove lint leftovers; ok guenther@


# 1.106 23-Aug-2012 deraadt

no more nnpfspioctl() system call; ok guenther


# 1.105 22-Aug-2012 pascal

Convert cpp | as rules in bsd.lib.mk and lib/libc/sys/Makefile.inc to pure cc
invocations. This allows us to use the compiler builtin define __PIC__ to check
for PIC/PIEness rather than passing -DPIC. Simplifies PIE work a lot.

ok matthew@, conceptually ok kurt@


# 1.104 21-Aug-2012 pascal

Kill an old mips workaround; we don't support mips, just mips64.

ok deraadt@ kettenis@


Revision tags: OPENBSD_5_2_BASE
# 1.103 19-Jun-2012 deraadt

oops, forgot to install getdtablecount(2); noted by tedu


# 1.102 12-Apr-2012 deraadt

remove rfork(); ok guenther miod


# 1.101 12-Apr-2012 deraadt

kill lfs system call lines and libc stubs


# 1.100 12-Apr-2012 deraadt

New system call: getdtablecount(2) returns the number of file
descriptors the process currently has open.
ok guenther miod gilles ...


# 1.99 22-Mar-2012 guenther

Move __tfork_thread() from rthreads (libpthread) to libc so that
it can be used for not-strictly-threading purposes

ok matthew@ kurt@


# 1.98 13-Mar-2012 guenther

Add manpages for __thrsigdivert, __thrsleep, and __thrwakeup. Various
syntax and grammar fixes from jmc@


Revision tags: OPENBSD_5_1_BASE
# 1.97 17-Jan-2012 guenther

Reimplement mutexes, condvars, and rwlocks to eliminate bugs,
particularly the "consume the signal you just sent" hang, and putting
the wait queues in userspace.

Do cancellation handling in pthread_cond_*wait(), pthread_join(),
and sem_wait().

Add __ prefix to thr{sleep,wakeup,exit,sigdivert}() syscalls; add
'abort" argument to thrsleep to close cancellation race; make
thr{sleep,wakeup} return errno values via *retval to avoid touching
userspace errno.


# 1.96 22-Nov-2011 guenther

sigstack() is long dead, and the compat sigaltstack syscall is gone too.
Correct the namespace protections for sigreturn(), sigwait(), and psignal()

ok millert@


# 1.95 16-Oct-2011 guenther

Add stubs and manpage for __{get,set}_tcb

ok deraadt@


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

Add (rough draft) documentation for fdopendir(3) and the 15 new
XXXat(2) system calls from POSIX 2008. Editing will be done in tree.

General style discussed with jmc@, schwarze@, and deraadt@
ok jmc@


# 1.93 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@


Revision tags: OPENBSD_4_8_BASE OPENBSD_4_9_BASE
# 1.92 03-Jul-2010 guenther

Fix the naming of interfaces and variables for rdomains and rtables
and make it possible to bind sockets (including listening sockets!)
to rtables and not just rdomains. This changes the name of the
system calls, socket option, and ioctl. After building with this
you should remove the files /usr/share/man/cat2/[gs]etrdomain.0.

Since this removes the existing [gs]etrdomain() system calls, the
libc major is bumped.

Written by claudio@, criticized^Wcritiqued by me


# 1.91 01-Jul-2010 deraadt

getpeereid() can now be a library routine using getsockopt() with
SOL_SOCKET and SO_PEERCRED, only issue being that it cannot return
EFAULT for a page fault. The kernel code will soon be put into
compat, and then in 10 years or so tedu will delete it.
ok guenther millert


# 1.90 18-May-2010 tedu

add posix_madvise, posix_memalign, strndup, and strnlen. mostly from
brad and millert, with hints from guenther, jmc, and otto I think.
ok previous.


Revision tags: OPENBSD_4_7_BASE
# 1.89 03-Feb-2010 miod

Use MACHINE_CPU instead of MACHINE_ARCH to pick the correct machine dependent
files or directories when applicable.
The inspiration and name of MACHINE_CPU come from NetBSD, although the way to
provide it to Makefiles is completely different.
ok kettenis@


# 1.88 27-Nov-2009 guenther

Add setrdomain() and getrdomain() system calls. Committing now to
catch the libc major bump per request from deraadt@

Diff by reyk.

ok guenther@


# 1.87 13-Aug-2009 jmc

various MLINK fixes from Alan R. S. Bueno;


Revision tags: OPENBSD_4_6_BASE
# 1.86 03-Jun-2009 jj

Arla client rename from xfs to nnpfs for later upgrades. Tested on various arches. ok todd@ beck@


Revision tags: OPENBSD_4_4_BASE OPENBSD_4_5_BASE
# 1.85 22-Mar-2008 otto

move statvfs.c to gen, since it is not a syscall; ok deraadt@


# 1.84 16-Mar-2008 otto

statvfs support


Revision tags: OPENBSD_4_3_BASE
# 1.83 05-Jan-2008 deraadt

no more need for vadvise.o


# 1.82 09-Sep-2007 otto

Add lint stubs for the longjmp family of functions which are defined in
assembly on all platforms. ok deraadt@


# 1.81 09-Sep-2007 otto

Silence erroneous "environ used, but not defined" lint warning by
providing a stub. ok deraadt@


Revision tags: OPENBSD_4_1_BASE OPENBSD_4_2_BASE
# 1.80 24-Oct-2006 tedu

add rthread syscalls and bump minor.
rthreads are hardly done, but if just trying it out is too much of a hassle,
we'll never make more progress.
ok brad marc marco mbalmer


# 1.79 10-Oct-2006 deraadt

MLINKS to macros described in stat(2)


Revision tags: OPENBSD_4_0_BASE
# 1.78 14-Jun-2006 otto

Introducing adjfreq(2), to adjust the clock frequency.
Loosely based on dragonfly code. Man page help fro jmc@; ok deraadt@


# 1.77 27-May-2006 pedro

Make libc's getcwd() use the new __getcwd() system call
Hacked by marius@ at c2k5, okay miod@ krw@ deraadt@


# 1.76 13-Mar-2006 moritz

Clean the correct file. ok deraadt@


Revision tags: OPENBSD_3_9_BASE
# 1.75 29-Nov-2005 deraadt

Provide stubs for things which are supplied by crt0. I don't think we
want a crt0.ln, at least, not yet. We may reconsider later.


# 1.74 03-Oct-2005 jmc

add missing MLINK for WEXITSTATUS.2


Revision tags: OPENBSD_3_8_BASE
# 1.73 17-Jun-2005 drahn

Extended Attributes was a piece to get to ACLs, however ACLs have not
been worked on, so EA is pointless to maintain.


# 1.72 17-Jun-2005 millert

remove undelete syscall


Revision tags: OPENBSD_3_7_BASE
# 1.71 18-Sep-2004 deraadt

MLINK to macros provided in wait.2


# 1.70 16-Sep-2004 deraadt

add files missing for building a proper lint library


Revision tags: OPENBSD_3_5_BASE OPENBSD_3_6_BASE
# 1.69 13-Feb-2004 tedu

death to osigaltstack. ok deraadt@


# 1.68 15-Jan-2004 deraadt

ABI breakage happened with the sigaltstack replacement. It is too late,
now we just have to cope. Since setjmp uses it, the alpha and sparc64 are
unhappy with the structure change. In a few days, we will make the second
hop here, for now, use the old system call until all binaries have the new
struct in them.


# 1.67 12-Jan-2004 tedu

new syscall closefrom(2). ok deraadt millert


Revision tags: OPENBSD_3_4_BASE
# 1.66 10-May-2003 miod

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


# 1.65 14-Apr-2003 art

There are two related changes.

The first one is an mquery(2) syscall. It's for asking the VM system
about where to map things. It will be used by ld.so, read the man page
for details.

The second change is related and is a centralization of uvm_map hint
that all callers of uvm_map calculated. This will allow us to adjust
this hint on architectures that have segments for non-exec mappings.

deraadt@ drahn@ ok.


Revision tags: OPENBSD_3_3_BASE
# 1.64 31-Jan-2003 millert

Replace emulated versions of setreuid() and setregid() with real syscalls.
These are spec'd by POSIX as of 1003.1-2001; deraadt@ OK


# 1.63 02-Dec-2002 millert

Document getlogin_r()


# 1.62 02-Dec-2002 miod

Import propolice (http://www.trl.ibm.com/projects/security/ssp), a stack
attack protection scheme, into gcc.

This protection is enabled by default. It can be turned off by using the
-fno-stack-protector flag.

Code by Hiroaki Etoh (etoh at jp dot ibm dot com); work on openbsd-specific
integration by fgsch@, deraadt@ and myself; tests by fgsch@, naddy@ and
myself; beer drinking by myself.

Please note that system upgrades with this new code will require a new
libc and ld.so to be build and installed before the propolice-enabled
compiler can be installed.


# 1.61 10-Nov-2002 fgsch

missing MLINKs for setresuid(2). millert ok.


# 1.60 05-Nov-2002 marc

thread safe libc -- 2nd try. OK miod@, millert@
Thanks to miod@ for m68k and vax fixes


# 1.59 03-Nov-2002 marc

back out previous patch.. there are still some vax/m68k issues


# 1.58 03-Nov-2002 marc

libc changes for thread safety. Tested on:
alpha (millert@), i386 (marc@), m68k (millert@ and miod@),
powerpc (drahn@ and dhartmei@), sparc (millert@ and marc@),
sparc64 (marc@), and vax (millert@ and miod@).
Thanks to millert@, miod@, and mickey@ for fixes along the way.


# 1.57 30-Oct-2002 millert

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


Revision tags: OPENBSD_3_2_BASE
# 1.56 05-Aug-2002 art

Fix brain blackout.
Pointed out byb miod@.


# 1.55 05-Aug-2002 art

One more ELF_TOOLCHAIN.


# 1.54 06-Jul-2002 nordin

Remove kernel support for NTP. ok deraadt@ and tholo@


# 1.53 10-Jun-2002 fgsch

correct comment.


# 1.52 08-Jun-2002 drahn

ELF architectures all support weak aliases, enable them for this part.
ok fgsch@


Revision tags: OPENBSD_3_1_BASE
# 1.51 22-Feb-2002 drahn

Extended Attribute support, from FreeBSD/TrustedBSD. ok art@ deraadt@
libc support pieces


# 1.50 21-Feb-2002 art

remove rfork.o from the auto-generated assembler stubs


# 1.49 17-Feb-2002 deraadt

rfork() needs a fork.S-like stub as well; ok art


Revision tags: OPENBSD_3_0_BASE
# 1.48 25-Sep-2001 niklas

Forgotten DEBUGLIBS stuff


# 1.47 25-Sep-2001 drahn

Add an ASPICFLAG variable to bsd.own.mk which a platform use to pass flags
to 'as' to make it compile pic. add defaults for sparc64 which needs picflags
set to -fPIC and ASPICFLAGS to -KPIC.
Also simplifies the systemcall generation for sparc64 PIC mode.
ok epsie@.


# 1.46 20-Sep-2001 millert

Add PSEUDO_NOERROR similar to that used by NetBSD.
Some ports were setting errno in PSEUDO and some were not. Now errno
is set for all in PSEUDO and PSEUDO_NOERROR is provided for the
non-errno case (only used by _exit).

Needs testing on vax and m88k.
XXX - hppa and powerpc still lack a real PSEUDO_NOERROR implementation.
Currently PSEUDO_NOERROR and PSEUDO are the same (so builds don't
break on those platforms).


# 1.45 09-Jul-2001 fgsch

Install getpeereid(2) manpage.


# 1.44 26-Jun-2001 dugsong

implement djb's getpeereid(2), to allow local-domain servers to determine client credentials. mostly from superscript.com. deraadt@ ok


Revision tags: OPENBSD_2_9_BASE
# 1.43 14-Mar-2001 aaron

Move description of exect() to execve(2) man page. Add a note about exect() not
being portable.


# 1.42 09-Mar-2001 art

Add mlockall and munlockall. man-page from NetBSD.


# 1.41 10-Jan-2001 deraadt

put up FD_* manual pages, in section 3


# 1.40 23-Dec-2000 deraadt

create proper docs for timer{add,clear,sub,isset,cmp}


# 1.39 16-Nov-2000 provos

kqueue and kevent system calls


Revision tags: OPENBSD_2_8_BASE
# 1.38 17-Oct-2000 deraadt

damn it, i have had it with this untested weak shit


# 1.37 16-Oct-2000 deraadt

re-add weak sparc support; d@


# 1.36 15-May-2000 niklas

Add support for building libraries with debugging information in them.
Enable by setting DEBUGLIBS=yes in /etc/mk.conf, then -g libraries will get
installed in /usr/lib/debug. This directory will be searched first if
gcc is given the -g flag during the link stage.


Revision tags: OPENBSD_2_7_BASE
# 1.35 01-May-2000 deraadt

bye bye semconfig(2)


# 1.34 20-Apr-2000 deraadt

p{read,write}{,v} man pages


# 1.33 07-Feb-2000 assar

add fhopen, fhstat, fhstatfs system calls. largely from NetBSD


# 1.32 06-Jan-2000 d

for now, disable weak aliases for all archs except i386


# 1.31 14-Dec-1999 millert

Install swapctl.2, not swapon.2. swapon.2 should probably go away.


Revision tags: OPENBSD_2_6_BASE
# 1.30 07-Jun-1999 deraadt

replacement pipe() system call; copies data into place inside kernel, so
that EFAULT return value is possible


# 1.29 22-May-1999 weingart

Add swapctl(2), and crank shlib minor.


Revision tags: OPENBSD_2_5_BASE
# 1.28 01-Feb-1999 d

mi ptrace


# 1.27 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


Revision tags: OPENBSD_2_4_BASE
# 1.26 18-Sep-1998 art

make use of xfspioctl


Revision tags: OPENBSD_2_3_BASE
# 1.25 08-Feb-1998 tholo

Better lint(1) framework. Mostly from cgd@NetBSD


# 1.24 13-Nov-1997 deraadt

add getsid(2), XPG4


Revision tags: OPENBSD_2_2_BASE
# 1.23 30-May-1997 kstailey

add getpgrp(2) from NetBSD


Revision tags: OPENBSD_2_1_BASE
# 1.22 08-May-1997 kstailey

add tag


# 1.21 08-May-1997 kstailey

make clock_gettime.cat2


# 1.20 20-Apr-1997 tholo

New POSIX 1003.1b syscalls; from pk@NetBSD


# 1.19 04-Apr-1997 deraadt

seek(2) is not needed


# 1.18 29-Mar-1997 deraadt

futimes link; nakayosh@kcn.or.jp


# 1.17 26-Mar-1997 deraadt

install ktrace(2)


# 1.16 26-Jan-1997 downsj

Add a link for lchown.2


# 1.15 26-Jan-1997 downsj

Add lchown(), increment minor number.


# 1.14 11-Dec-1996 deraadt

generate reboot.o like other system calls


Revision tags: OPENBSD_2_0_BASE
# 1.13 02-Sep-1996 deraadt

shmdt link


# 1.12 25-Aug-1996 deraadt

and a man page


# 1.11 18-Jun-1996 deraadt

build poll.o


# 1.10 19-May-1996 pefo

Changes for mips.


# 1.9 18-May-1996 deraadt

poll() as a system call


# 1.8 08-May-1996 deraadt

install rfork man page


# 1.7 01-May-1996 deraadt

add futimes


# 1.6 25-Mar-1996 tholo

Add support for building lint(1) library


# 1.5 29-Jan-1996 tholo

Add kernel PLL for system clock
Add ntp_adjtime() and ntp_gettime() system calls
Mostly stolen from FreeBSD


# 1.4 08-Jan-1996 deraadt

add rfork.o and minherit.o


# 1.3 07-Jan-1996 deraadt

add minherit() system call


# 1.2 14-Dec-1995 deraadt

from netbsd:
add & fix a bunch of system call pages


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.154 12-Jan-2018 deraadt

sysctl(3) can now be renamed to sysctl(2)


# 1.153 28-Nov-2017 guenther

Delete fktrace(2). The consequences of it were not thought through
sufficiently and at least one horrific security hole was the result.

ok deraadt@ beck@


Revision tags: OPENBSD_6_2_BASE
# 1.152 13-Aug-2017 tedu

add fktrace to libc


# 1.151 12-Aug-2017 guenther

Instead of hardcoding a partial dependency list for the syscall stub objects,
calculate them as done for other objects


# 1.150 31-May-2017 sthen

install futex(2), ok mpi


# 1.149 30-Apr-2017 mpi

Add futex(2) shim, bump minor.

Inputs from guenther@, ok kettenis@, visa@


Revision tags: OPENBSD_6_1_BASE
# 1.148 29-Mar-2017 deraadt

The hppa version of as(1) requires whitespace before a .file directive,
it may not be in column 0. This kind of thing is very common in GNU
and Linux software because the software was written from the start to
be 'compatible replacements' of vendor software.
ok jsing guenther


# 1.147 26-Mar-2017 guenther

Use .file to convince 'as' to generate proper FILE symbols in the syscall
stubs that aren't actually in files, so that syspatch can figure out what
order the syscall stub objects are in the .so. Use -P to suppress to #line
directives that would override that. Tested with both gcc/gas and clang.

ok deraadt@


Revision tags: OPENBSD_6_0_BASE
# 1.146 04-Jul-2016 guenther

DEBUGLIBS has been broken since the gcc4 switch, so delete it. CFLAGS
contains -g by default anyway

problem noted by Edgar Pettijohn (edgar (at) pettijohn-web.com)
ok millert@ kettenis@ deraadt@


# 1.145 30-May-2016 guenther

Move __getcwd from ASM to HIDDEN: we don't want the literal __getcwd symbol

ok millert@ deraadt@


# 1.144 19-May-2016 guenther

Add ASM_NOERR for syscalls that never fail and thus don't need the errno
setting logic...which can significantly reduce the size of the stub on
some archs; 20 syscalls get a trim with this.

in snaps for a bit and ok deraadt@


# 1.143 09-May-2016 guenther

Remove sigreturn declaration and the now-unused libc syscall stub


# 1.142 07-May-2016 guenther

Use a Thread Information Block in both single and multi-threaded programs.
This stores errno, the cancelation flags, and related bits for each thread
and is allocated by ld.so or libc.a. This is an ABI break from 5.9-stable!

Make libpthread dlopen'able by moving the cancelation wrappers into libc
and doing locking and fork/errno handling via callbacks that libpthread
registers when it first initializes. 'errno' *must* be declared via
<errno.h> now!

Clean up libpthread's symbol exports like libc.

On powerpc, offset the TIB/TCB/TLS data from the register per the ELF spec.

Testing by various, particularly sthen@ and patrick@
ok kettenis@


# 1.141 30-Mar-2016 guenther

Turd polish: use HIDDEN= instead of PSEUDO= for ptrace syscall stub, to
make its underlying symbol name look like others.


# 1.140 30-Mar-2016 guenther

Eliminate userspace caching by getlogin_r/setlogin; make the getlogin
syscall behave exactly like userspace getlogin_r() and rename it to
match. Eliminate the reduced-to-no-op wrappers of the syscalls.
Eliminate the unnecessary per-thread static buffering by getlogin().

ok kettenis@ deraadt@


# 1.139 30-Mar-2016 jmc

for some time now mandoc has not required MLINKS to function
correctly - logically complete that now by removing MLINKS from base;

authors need only to ensure there is an entry in NAME for any function/
util being added. MLINKS will still work, and remain for perl to ease
upgrades;

ok nicm (curses) bcook (ssl)
ok schwarze, who provided a lot of feedback and assistance
ok tb natano jung


# 1.138 21-Mar-2016 bluhm

Rename the system call sendsyslog2 to sendsyslog. Keep the old one
as osendsyslog for a while. The three argument variant is the only
one that will stay.
input kettenis@; OK deraadt@


Revision tags: OPENBSD_5_9_BASE
# 1.137 25-Nov-2015 deraadt

Add a syscall stub for sendsyslog2(2), and use it in syslog_r(3), passing
LOG_CONS to the kernel. As a result, the /dev/console opening code can
be removed.
ok kettenis millert beck


# 1.136 10-Nov-2015 guenther

Split the intra-thread functionality from kill(2) into its own syscall
thrkill(2), rolling the kill(2) syscall number with the ABI change to
avoid breaking binaries during during the transition. thrkill(2) includes
a 'tcb' argument that eliminates the need for locking in pthread_kill()
and simplifies pthread_cancel(). Switch __stack_smash_handler() to use
thrkill(2) and explicitly unblock SIGABRT.

Minor bump to both libc and libpthread: make sure you install a new kernel!

ok semarie@


# 1.135 23-Oct-2015 guenther

Merge the sigaction() and sigprocmask() overloads/wrappers from libpthread
into libc, and move pthread_sigmask() as well (just a trivial wrapper).
This provides consistent handling of SIGTHR between single- and multi-threaded
programs and is a step in the merge of all the libpthread overloads, providing
some ASM and Makefile bits that the other wrappers will need.

ok deraadt@ millert@


# 1.134 23-Oct-2015 deraadt

Remove dnssocket() and dnsconnect(), since we decided to use a SOCK_DNS
flag instead.
ok guenther tedu semarie


# 1.133 19-Oct-2015 deraadt

Remove old tame() stub


# 1.132 18-Oct-2015 deraadt

create libc stubs for dnssocket() and dnsconnect()


# 1.131 09-Oct-2015 deraadt

tame -> pledge conversion, in libc. I should crank libc, but am cheating
hoping things go well. The old symbol is faked via a stupid stub function,
until next major crank when it can be removed. I am expecting guenther
to scream at me.


# 1.130 13-Sep-2015 guenther

Rename __sysctl syscall to just sysctl, as the userland wrapper is no longer
necessary

ok deraadt@ jsing@


# 1.129 09-Sep-2015 guenther

Simplify makefile rules for building the ASM stubs into "pick something
from column A and something from column B".

ok miod@ deraadt@


# 1.128 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@


# 1.127 25-Aug-2015 guenther

Document kbind(2)


Revision tags: OPENBSD_5_8_BASE
# 1.126 19-Jul-2015 deraadt

manual page for tame(2). not very good, so i will be hearing from jmc


# 1.125 07-Apr-2015 guenther

Make pthread_atfork() track the DSO that called it like atexit() does,
unregistering callbacks if the DSO is unloaded. Move the callback
handling from libpthread to libc, though libpthread still overrides the
inner call to handle locking and thread-library reinitialization.
Major version bump for both libc and libpthread.

verification that this fixes various ports ajacoutot@
asm assistance miod@; ok millert@ deraadt@


Revision tags: OPENBSD_5_7_BASE
# 1.124 08-Dec-2014 guenther

Add chflagsat(), modeled on fchmodat() with name to match FreeBSD.


# 1.123 14-Nov-2014 guenther

Add sched_yield(2) manpage


# 1.122 31-Aug-2014 guenther

Declare and document getthrid()

indirectly prodded by krw@


# 1.121 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@


# 1.120 14-Aug-2014 tobias

fixed overrid(d)en typo

millert@ and jmc@ agree that "overriden" is wrong


Revision tags: OPENBSD_5_6_BASE
# 1.119 12-Jul-2014 deraadt

document sendsyslog(2); ok guenther tedu matthew


# 1.118 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.117 18-Mar-2014 miod

Retire hp300, mvme68k and mvme88k ports. These ports have no users, keeping
this hardware alive is becoming increasingly difficult, and I should heed the
message sent by the three disks which have died on me over the last few days.

Noone sane will mourn these ports anyway. So long, and thanks for the fish.


Revision tags: OPENBSD_5_5_BASE
# 1.116 13-Oct-2013 guenther

Make it possible to build to reduced version of a library, including
just specific objects that are compiled with additional options to
reduce their size. For use by distrib/ and crunchgen.

style and naming assistance from espie@


# 1.115 07-Oct-2013 guenther

getdirentries(2) is dead; long live getdents(2)!

confirmation that getdirentries(2) is unused by ports from sthen@ and naddy@


# 1.114 13-Aug-2013 guenther

Switch time_t, ino_t, clock_t, and struct kevent's ident and data
members to 64bit types. Assign new syscall numbers for (almost
all) the syscalls that involve the affected types, including anything
with time_t, timeval, itimerval, timespec, rusage, dirent, stat,
or kevent arguments. Add a d_off member to struct dirent and replace
getdirentries() with getdents(), thus immensely simplifying and
accelerating telldir/seekdir. Build perl with -DBIG_TIME.

Bump the major on every single base library: the compat bits included
here are only good enough to make the transition; the T32 compat
option will be burned as soon as we've reached the new world are
are happy with the snapshots for all architectures.

DANGER: ABI incompatibility. Updating to this kernel requires extra
work or you won't be able to login: install a snapshot instead.

Much assistance in fixing userland issues from deraadt@ and tedu@
and build assistance from todd@ and otto@


Revision tags: OPENBSD_5_4_BASE
# 1.113 05-Jun-2013 guenther

Move _Exit() from the exit() manpage to the _exit() manpage, as it's
just an alias of the latter.

ok matthew@ tedu@


# 1.112 01-Jun-2013 miod

Add utrace(2), a system call allowing for userland to send its own ktrace
records. From FreeBSD via otto@, with tweaks suggested by guenther@.
Commite on behalf of otto@ who is not around, to ride the libc minor bump.
Causes a librthread minor bump as well (new syscall).


# 1.111 29-Apr-2013 matthew

Extend P_SIGSUSPEND handling in userret() to properly restore the
sigmask even if there are no pending signals under the temporary
sigmask.

Refactor existing select() and poll() system calls to introduce the
pselect() and ppoll() system calls.

Add rthread wrappers for pselect() and ppoll(). While there, update
cancellation point comments to reflect recent fdatasync() addition.

Minor bumps for libc and librthread due to new symbols.

ok guenther, millert, deraadt, jmc


# 1.110 15-Apr-2013 matthew

Implement fdatasync() as a wrapper around fsync()

ok guenther, deraadt, jmc


Revision tags: OPENBSD_5_3_BASE
# 1.109 03-Feb-2013 miod

gremlin crept in


# 1.108 02-Feb-2013 miod

Userland bits for m68k/ELF. Mostly addition of register prefixes to the
assembler instructions, and cope with the few changes in return values
location.


# 1.107 04-Sep-2012 okan

remove lint leftovers; ok guenther@


# 1.106 23-Aug-2012 deraadt

no more nnpfspioctl() system call; ok guenther


# 1.105 22-Aug-2012 pascal

Convert cpp | as rules in bsd.lib.mk and lib/libc/sys/Makefile.inc to pure cc
invocations. This allows us to use the compiler builtin define __PIC__ to check
for PIC/PIEness rather than passing -DPIC. Simplifies PIE work a lot.

ok matthew@, conceptually ok kurt@


# 1.104 21-Aug-2012 pascal

Kill an old mips workaround; we don't support mips, just mips64.

ok deraadt@ kettenis@


Revision tags: OPENBSD_5_2_BASE
# 1.103 19-Jun-2012 deraadt

oops, forgot to install getdtablecount(2); noted by tedu


# 1.102 12-Apr-2012 deraadt

remove rfork(); ok guenther miod


# 1.101 12-Apr-2012 deraadt

kill lfs system call lines and libc stubs


# 1.100 12-Apr-2012 deraadt

New system call: getdtablecount(2) returns the number of file
descriptors the process currently has open.
ok guenther miod gilles ...


# 1.99 22-Mar-2012 guenther

Move __tfork_thread() from rthreads (libpthread) to libc so that
it can be used for not-strictly-threading purposes

ok matthew@ kurt@


# 1.98 13-Mar-2012 guenther

Add manpages for __thrsigdivert, __thrsleep, and __thrwakeup. Various
syntax and grammar fixes from jmc@


Revision tags: OPENBSD_5_1_BASE
# 1.97 17-Jan-2012 guenther

Reimplement mutexes, condvars, and rwlocks to eliminate bugs,
particularly the "consume the signal you just sent" hang, and putting
the wait queues in userspace.

Do cancellation handling in pthread_cond_*wait(), pthread_join(),
and sem_wait().

Add __ prefix to thr{sleep,wakeup,exit,sigdivert}() syscalls; add
'abort" argument to thrsleep to close cancellation race; make
thr{sleep,wakeup} return errno values via *retval to avoid touching
userspace errno.


# 1.96 22-Nov-2011 guenther

sigstack() is long dead, and the compat sigaltstack syscall is gone too.
Correct the namespace protections for sigreturn(), sigwait(), and psignal()

ok millert@


# 1.95 16-Oct-2011 guenther

Add stubs and manpage for __{get,set}_tcb

ok deraadt@


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

Add (rough draft) documentation for fdopendir(3) and the 15 new
XXXat(2) system calls from POSIX 2008. Editing will be done in tree.

General style discussed with jmc@, schwarze@, and deraadt@
ok jmc@


# 1.93 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@


Revision tags: OPENBSD_4_8_BASE OPENBSD_4_9_BASE
# 1.92 03-Jul-2010 guenther

Fix the naming of interfaces and variables for rdomains and rtables
and make it possible to bind sockets (including listening sockets!)
to rtables and not just rdomains. This changes the name of the
system calls, socket option, and ioctl. After building with this
you should remove the files /usr/share/man/cat2/[gs]etrdomain.0.

Since this removes the existing [gs]etrdomain() system calls, the
libc major is bumped.

Written by claudio@, criticized^Wcritiqued by me


# 1.91 01-Jul-2010 deraadt

getpeereid() can now be a library routine using getsockopt() with
SOL_SOCKET and SO_PEERCRED, only issue being that it cannot return
EFAULT for a page fault. The kernel code will soon be put into
compat, and then in 10 years or so tedu will delete it.
ok guenther millert


# 1.90 18-May-2010 tedu

add posix_madvise, posix_memalign, strndup, and strnlen. mostly from
brad and millert, with hints from guenther, jmc, and otto I think.
ok previous.


Revision tags: OPENBSD_4_7_BASE
# 1.89 03-Feb-2010 miod

Use MACHINE_CPU instead of MACHINE_ARCH to pick the correct machine dependent
files or directories when applicable.
The inspiration and name of MACHINE_CPU come from NetBSD, although the way to
provide it to Makefiles is completely different.
ok kettenis@


# 1.88 27-Nov-2009 guenther

Add setrdomain() and getrdomain() system calls. Committing now to
catch the libc major bump per request from deraadt@

Diff by reyk.

ok guenther@


# 1.87 13-Aug-2009 jmc

various MLINK fixes from Alan R. S. Bueno;


Revision tags: OPENBSD_4_6_BASE
# 1.86 03-Jun-2009 jj

Arla client rename from xfs to nnpfs for later upgrades. Tested on various arches. ok todd@ beck@


Revision tags: OPENBSD_4_4_BASE OPENBSD_4_5_BASE
# 1.85 22-Mar-2008 otto

move statvfs.c to gen, since it is not a syscall; ok deraadt@


# 1.84 16-Mar-2008 otto

statvfs support


Revision tags: OPENBSD_4_3_BASE
# 1.83 05-Jan-2008 deraadt

no more need for vadvise.o


# 1.82 09-Sep-2007 otto

Add lint stubs for the longjmp family of functions which are defined in
assembly on all platforms. ok deraadt@


# 1.81 09-Sep-2007 otto

Silence erroneous "environ used, but not defined" lint warning by
providing a stub. ok deraadt@


Revision tags: OPENBSD_4_1_BASE OPENBSD_4_2_BASE
# 1.80 24-Oct-2006 tedu

add rthread syscalls and bump minor.
rthreads are hardly done, but if just trying it out is too much of a hassle,
we'll never make more progress.
ok brad marc marco mbalmer


# 1.79 10-Oct-2006 deraadt

MLINKS to macros described in stat(2)


Revision tags: OPENBSD_4_0_BASE
# 1.78 14-Jun-2006 otto

Introducing adjfreq(2), to adjust the clock frequency.
Loosely based on dragonfly code. Man page help fro jmc@; ok deraadt@


# 1.77 27-May-2006 pedro

Make libc's getcwd() use the new __getcwd() system call
Hacked by marius@ at c2k5, okay miod@ krw@ deraadt@


# 1.76 13-Mar-2006 moritz

Clean the correct file. ok deraadt@


Revision tags: OPENBSD_3_9_BASE
# 1.75 29-Nov-2005 deraadt

Provide stubs for things which are supplied by crt0. I don't think we
want a crt0.ln, at least, not yet. We may reconsider later.


# 1.74 03-Oct-2005 jmc

add missing MLINK for WEXITSTATUS.2


Revision tags: OPENBSD_3_8_BASE
# 1.73 17-Jun-2005 drahn

Extended Attributes was a piece to get to ACLs, however ACLs have not
been worked on, so EA is pointless to maintain.


# 1.72 17-Jun-2005 millert

remove undelete syscall


Revision tags: OPENBSD_3_7_BASE
# 1.71 18-Sep-2004 deraadt

MLINK to macros provided in wait.2


# 1.70 16-Sep-2004 deraadt

add files missing for building a proper lint library


Revision tags: OPENBSD_3_5_BASE OPENBSD_3_6_BASE
# 1.69 13-Feb-2004 tedu

death to osigaltstack. ok deraadt@


# 1.68 15-Jan-2004 deraadt

ABI breakage happened with the sigaltstack replacement. It is too late,
now we just have to cope. Since setjmp uses it, the alpha and sparc64 are
unhappy with the structure change. In a few days, we will make the second
hop here, for now, use the old system call until all binaries have the new
struct in them.


# 1.67 12-Jan-2004 tedu

new syscall closefrom(2). ok deraadt millert


Revision tags: OPENBSD_3_4_BASE
# 1.66 10-May-2003 miod

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


# 1.65 14-Apr-2003 art

There are two related changes.

The first one is an mquery(2) syscall. It's for asking the VM system
about where to map things. It will be used by ld.so, read the man page
for details.

The second change is related and is a centralization of uvm_map hint
that all callers of uvm_map calculated. This will allow us to adjust
this hint on architectures that have segments for non-exec mappings.

deraadt@ drahn@ ok.


Revision tags: OPENBSD_3_3_BASE
# 1.64 31-Jan-2003 millert

Replace emulated versions of setreuid() and setregid() with real syscalls.
These are spec'd by POSIX as of 1003.1-2001; deraadt@ OK


# 1.63 02-Dec-2002 millert

Document getlogin_r()


# 1.62 02-Dec-2002 miod

Import propolice (http://www.trl.ibm.com/projects/security/ssp), a stack
attack protection scheme, into gcc.

This protection is enabled by default. It can be turned off by using the
-fno-stack-protector flag.

Code by Hiroaki Etoh (etoh at jp dot ibm dot com); work on openbsd-specific
integration by fgsch@, deraadt@ and myself; tests by fgsch@, naddy@ and
myself; beer drinking by myself.

Please note that system upgrades with this new code will require a new
libc and ld.so to be build and installed before the propolice-enabled
compiler can be installed.


# 1.61 10-Nov-2002 fgsch

missing MLINKs for setresuid(2). millert ok.


# 1.60 05-Nov-2002 marc

thread safe libc -- 2nd try. OK miod@, millert@
Thanks to miod@ for m68k and vax fixes


# 1.59 03-Nov-2002 marc

back out previous patch.. there are still some vax/m68k issues


# 1.58 03-Nov-2002 marc

libc changes for thread safety. Tested on:
alpha (millert@), i386 (marc@), m68k (millert@ and miod@),
powerpc (drahn@ and dhartmei@), sparc (millert@ and marc@),
sparc64 (marc@), and vax (millert@ and miod@).
Thanks to millert@, miod@, and mickey@ for fixes along the way.


# 1.57 30-Oct-2002 millert

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


Revision tags: OPENBSD_3_2_BASE
# 1.56 05-Aug-2002 art

Fix brain blackout.
Pointed out byb miod@.


# 1.55 05-Aug-2002 art

One more ELF_TOOLCHAIN.


# 1.54 06-Jul-2002 nordin

Remove kernel support for NTP. ok deraadt@ and tholo@


# 1.53 10-Jun-2002 fgsch

correct comment.


# 1.52 08-Jun-2002 drahn

ELF architectures all support weak aliases, enable them for this part.
ok fgsch@


Revision tags: OPENBSD_3_1_BASE
# 1.51 22-Feb-2002 drahn

Extended Attribute support, from FreeBSD/TrustedBSD. ok art@ deraadt@
libc support pieces


# 1.50 21-Feb-2002 art

remove rfork.o from the auto-generated assembler stubs


# 1.49 17-Feb-2002 deraadt

rfork() needs a fork.S-like stub as well; ok art


Revision tags: OPENBSD_3_0_BASE
# 1.48 25-Sep-2001 niklas

Forgotten DEBUGLIBS stuff


# 1.47 25-Sep-2001 drahn

Add an ASPICFLAG variable to bsd.own.mk which a platform use to pass flags
to 'as' to make it compile pic. add defaults for sparc64 which needs picflags
set to -fPIC and ASPICFLAGS to -KPIC.
Also simplifies the systemcall generation for sparc64 PIC mode.
ok epsie@.


# 1.46 20-Sep-2001 millert

Add PSEUDO_NOERROR similar to that used by NetBSD.
Some ports were setting errno in PSEUDO and some were not. Now errno
is set for all in PSEUDO and PSEUDO_NOERROR is provided for the
non-errno case (only used by _exit).

Needs testing on vax and m88k.
XXX - hppa and powerpc still lack a real PSEUDO_NOERROR implementation.
Currently PSEUDO_NOERROR and PSEUDO are the same (so builds don't
break on those platforms).


# 1.45 09-Jul-2001 fgsch

Install getpeereid(2) manpage.


# 1.44 26-Jun-2001 dugsong

implement djb's getpeereid(2), to allow local-domain servers to determine client credentials. mostly from superscript.com. deraadt@ ok


Revision tags: OPENBSD_2_9_BASE
# 1.43 14-Mar-2001 aaron

Move description of exect() to execve(2) man page. Add a note about exect() not
being portable.


# 1.42 09-Mar-2001 art

Add mlockall and munlockall. man-page from NetBSD.


# 1.41 10-Jan-2001 deraadt

put up FD_* manual pages, in section 3


# 1.40 23-Dec-2000 deraadt

create proper docs for timer{add,clear,sub,isset,cmp}


# 1.39 16-Nov-2000 provos

kqueue and kevent system calls


Revision tags: OPENBSD_2_8_BASE
# 1.38 17-Oct-2000 deraadt

damn it, i have had it with this untested weak shit


# 1.37 16-Oct-2000 deraadt

re-add weak sparc support; d@


# 1.36 15-May-2000 niklas

Add support for building libraries with debugging information in them.
Enable by setting DEBUGLIBS=yes in /etc/mk.conf, then -g libraries will get
installed in /usr/lib/debug. This directory will be searched first if
gcc is given the -g flag during the link stage.


Revision tags: OPENBSD_2_7_BASE
# 1.35 01-May-2000 deraadt

bye bye semconfig(2)


# 1.34 20-Apr-2000 deraadt

p{read,write}{,v} man pages


# 1.33 07-Feb-2000 assar

add fhopen, fhstat, fhstatfs system calls. largely from NetBSD


# 1.32 06-Jan-2000 d

for now, disable weak aliases for all archs except i386


# 1.31 14-Dec-1999 millert

Install swapctl.2, not swapon.2. swapon.2 should probably go away.


Revision tags: OPENBSD_2_6_BASE
# 1.30 07-Jun-1999 deraadt

replacement pipe() system call; copies data into place inside kernel, so
that EFAULT return value is possible


# 1.29 22-May-1999 weingart

Add swapctl(2), and crank shlib minor.


Revision tags: OPENBSD_2_5_BASE
# 1.28 01-Feb-1999 d

mi ptrace


# 1.27 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


Revision tags: OPENBSD_2_4_BASE
# 1.26 18-Sep-1998 art

make use of xfspioctl


Revision tags: OPENBSD_2_3_BASE
# 1.25 08-Feb-1998 tholo

Better lint(1) framework. Mostly from cgd@NetBSD


# 1.24 13-Nov-1997 deraadt

add getsid(2), XPG4


Revision tags: OPENBSD_2_2_BASE
# 1.23 30-May-1997 kstailey

add getpgrp(2) from NetBSD


Revision tags: OPENBSD_2_1_BASE
# 1.22 08-May-1997 kstailey

add tag


# 1.21 08-May-1997 kstailey

make clock_gettime.cat2


# 1.20 20-Apr-1997 tholo

New POSIX 1003.1b syscalls; from pk@NetBSD


# 1.19 04-Apr-1997 deraadt

seek(2) is not needed


# 1.18 29-Mar-1997 deraadt

futimes link; nakayosh@kcn.or.jp


# 1.17 26-Mar-1997 deraadt

install ktrace(2)


# 1.16 26-Jan-1997 downsj

Add a link for lchown.2


# 1.15 26-Jan-1997 downsj

Add lchown(), increment minor number.


# 1.14 11-Dec-1996 deraadt

generate reboot.o like other system calls


Revision tags: OPENBSD_2_0_BASE
# 1.13 02-Sep-1996 deraadt

shmdt link


# 1.12 25-Aug-1996 deraadt

and a man page


# 1.11 18-Jun-1996 deraadt

build poll.o


# 1.10 19-May-1996 pefo

Changes for mips.


# 1.9 18-May-1996 deraadt

poll() as a system call


# 1.8 08-May-1996 deraadt

install rfork man page


# 1.7 01-May-1996 deraadt

add futimes


# 1.6 25-Mar-1996 tholo

Add support for building lint(1) library


# 1.5 29-Jan-1996 tholo

Add kernel PLL for system clock
Add ntp_adjtime() and ntp_gettime() system calls
Mostly stolen from FreeBSD


# 1.4 08-Jan-1996 deraadt

add rfork.o and minherit.o


# 1.3 07-Jan-1996 deraadt

add minherit() system call


# 1.2 14-Dec-1995 deraadt

from netbsd:
add & fix a bunch of system call pages


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision