1
0
mirror of https://github.com/openbsd/src.git synced 2025-01-04 23:35:36 -08:00
Commit Graph

111 Commits

Author SHA1 Message Date
guenther
04933f16a0 The {get,set}res[ug]id(2) family are in POSIX-2024's XSI option,
so adjust the #include visibility and update the manpage.

ok millert@
2024-08-02 22:14:54 +00:00
guenther
c1d8b5d1f7 getentropy(2) is in POSIX-2024, so adjust the #include visibility,
change the "too much" error to EINVAL, add GETENTROPY_MAX to
<limits.h> (via sys/syslimits.h), and update the manpage.

ok deraadt@
2024-08-02 01:53:21 +00:00
guenther
5f31b145b2 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@
2024-05-18 05:20:22 +00:00
deraadt
cafeb892b1 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
2023-12-12 15:30:55 +00:00
guenther
cef5a146e6 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@
2023-01-07 05:24:58 +00:00
beck
8b23add8c7 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@
2018-07-13 09:25:22 +00:00
deraadt
4ea7ed56bd pledge()'s 2nd argument becomes char *execpromises, which becomes the
pledge for a new execve image immediately upon start.  Also introduces
"error" which makes violations return -1 ENOSYS instead of killing the
program ("error" may not be handed to a setuid/setgid program, which
may be missing/ignoring syscall return values and would continue with
inconsistant state)
Discussion with many
florian has used this to improve the strictness of a daemon
2017-12-12 01:12:34 +00:00
fcambus
15afe4d600 As per style.9, prototypes should not have variable names associated
with the types.

OK jca@
2017-03-09 10:13:03 +00:00
guenther
9e9a60b097 Don't declare select() in <unistd.h>
ok deraadt@ millert@
2016-09-12 19:36:26 +00:00
millert
6ecde746de Move the 10 (!) defintions of NULL to their own mini header file and
update the NULL definition for C++11.  OK deraadt@ guenther@ kettenis@
2016-09-09 18:12:37 +00:00
guenther
df1557eb24 Remove iruserok(_sa)? and __ivaliduser(sa)?
ok millert@ deraadt@
2016-05-23 00:12:58 +00:00
deraadt
58857ab480 tame -> pledge. 2015-10-09 01:26:40 +00:00
deraadt
2868cab32a Move to next tame() API. The flags are now passed as a very simple string,
which results in tame() code placements being much more recognizeable.
tame() can be moved to unistd.h and does not need cpp symbols to turn the
bits on and off.  The resulting API is a bit unexpected, but simplifies the
mapping to enabling bits in the kernel substantially.
vague ok's from various including guenther doug semarie
2015-09-09 17:56:59 +00:00
guenther
b3b7ef2e4e 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@
2015-08-26 01:54:08 +00:00
tedu
7f91f42385 claim posix 2008 compat. apparently people look at this and get scared
when it's really old. but no actual ports fallout in espie's build.
ok deraadt
2014-12-13 20:42:41 +00:00
tedu
0a2869cb84 update swab() to match the current posix definition. "rationale: none."
rewrite the function to be simpler as well. the compiler can unroll the
loop for us if necessary.
ok schwarze
2014-12-11 23:05:38 +00:00
tedu
80dc78aa39 header changes for recent libc changes:
add siphash
delete setkey, encrypt, cfree
2014-12-08 20:39:56 +00:00
tedu
817d1ee3be change prototype for crypt_newhash. the login_cap_t is a holdover from its
pwd_gensalt origins, but a string argument works equally work and is more
friendly to consumers beyond local user accounts.
ok deraadt
2014-11-21 05:13:44 +00:00
guenther
9f295d469e Our setpgrp() is the BSD version with two args and not the XSI
version with zero args, so it should only be visible if __BSD_VISIBLE
(and not also for __XPG_VISIBLE).  Contrawise, readlink() has been
part of base POSIX since 1995, so move to proper #if area for that.
Move crypt_checkpass() to the pure-BSD section of the file.

setpgrp() issue noted by Matti Karnaattu (mkarnaattu (at) gmail.com)
ok millert@
2014-09-18 04:37:56 +00:00
doug
e6ff12da83 Sync readlink(2) with IEEE Std 1003.1-2008.
discussion, help and ok guenther@
2014-09-01 05:09:52 +00:00
guenther
cbcba4176a Declare and document getthrid()
indirectly prodded by krw@
2014-08-31 04:02:08 +00:00
guenther
b65639bd21 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@
2014-08-31 01:42:36 +00:00
tedu
5f651b4a12 update _POSIX2_FORT_RUN, so that sysconf(_SC_2_FORT_RUN) remains correct.
because you care. reminded by matthew.
2014-07-08 21:35:39 +00:00
deraadt
bbb6b66290 Change return value of getentropy() to int 0 for success. Maximum
buffersize is enforced strictly, this supplies sufficient entropy
payload to act as seed material.  Discourage general use of this
API, but lock down this function name as the go-to for userland
PRNG seeding.  Improve documentation.
ok miod matthew
2014-06-14 18:01:41 +00:00
deraadt
eacbc5b32c 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
2014-06-13 08:26:09 +00:00
tedu
5f7129452b add prototypes for new crypt functions 2014-05-16 21:28:15 +00:00
guenther
ece79e109f Use internal '__' names for __attributes__ in public headers 2014-04-21 11:27:34 +00:00
matthew
d5aa66952d Define intptr_t in <unistd.h> as specified by POSIX
ok millert
2014-04-01 05:04:50 +00:00
martynas
0ad647d636 Annotate a few more bounded functions: realpath(3) needs a buffer
of size at least PATH_MAX.  pread(2), pwrite(2) and readlinkat(2)
also take the buffer and the bound.  OK theo.
2013-12-28 01:51:53 +00:00
deraadt
6c13836a7e express final disapproval of the interfaces in libcompat, such as
them ftime(), gtty(), stty(), re_comp(), cuserid() and others.
Discussion and ongoing work to fix the ports tree from many, especially
naddy.
ok naddy
[There is a bit more cleanup possible after that, but this is considered
the current safe step]
2013-12-04 22:58:24 +00:00
millert
6290d6dbce The getopt() prototype and externs don't belong in stdlib.h. Berkeley
moved them to unistd.h to match POSIX in 1995 but we never did.
The exception to this is getsubopt() which POSIX says should be in
stdlib.h.  The non-standard suboptarg extern remains in the BSD-only
section of stdlib.h.  Neither getsubopt() nor suboptarg belong in
unistd.h or getopt.h.  They were only there to allow us to protect
all the getopt() bits from being multiply defined.  OK guenther@
2013-11-22 21:32:49 +00:00
guenther
d24b5030bc Align suseconds_t with POSIX: it's the type of the tv_usec member of timeval.
Use useconds_t in the ualarm() declaration.
Bump libstdc++ major to be sure there isn't ABI issues.

ok deraadt@ jca@ jmc@ millert@
ports testing by landry@
2013-10-24 07:34:56 +00:00
guenther
7b36c281ba Add support for the _POSIX_CPUTIME and _POSIX_THREAD_CPUTIME options,
including CLOCK_{PROCESS,THREAD}_CPUTIME_ID constants and
{clock,pthread}_getcpuclockid() functions.

Worked out at t2k13 with help from tedu@ and matthew@ and testing by aja@
ok matthew@
2013-06-17 19:11:54 +00:00
brad
fa6f007d14 Enable the _POSIX_SHARED_MEMORY_OBJECTS option group now that we have shm_open / shm_unlink.
ok guenther@
2013-06-04 23:01:07 +00:00
matthew
aa96fc3dc0 Implement fdatasync() as a wrapper around fsync()
ok guenther, deraadt, jmc
2013-04-15 16:38:21 +00:00
guenther
76e45efd19 getpgid() and getsid() were rolled into POSIX in 2008
ok millert@
2013-04-11 03:09:16 +00:00
guenther
e0e73bdf40 Adds the (somewhat silly) _CS_V[67]_ENV and _CS_POSIX_V[67]_* defines
to <unistd.h> and confstr(3) per POSIX 1003.1-2008

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

ports build tested by espie@
2013-03-01 21:19:41 +00:00
deraadt
4a39ccd02c Remove excessive sys/cdefs.h inclusion
ok guenther millert kettenis
2012-12-05 23:19:48 +00:00
guenther
16b62b6a0b __tfork() needs to set the stack address of the new thread in the kernel,
so that it can't get a signal while still running on the parent thread's
stack.  Also, pass in sizeof(struct __tfork) to provide forward compat
when more members are added.  This is an ABI change, so switch syscall
numbers and bump lib majors this time.

ok deraadt@ matthew@
2012-06-21 00:56:59 +00:00
matthew
90d0aeda4f Move the _SC_* and _CS_* configurable system variables and strings
from sys/unistd.h to unistd.h.

From Brad; ok millert and me
2012-05-30 19:34:30 +00:00
matthew
020d9bd9a2 More sysconf(3)-y and pathconf(3)-y goodness from Brad.
ok guenther, millert (and me); bulk build test by naddy
2012-05-14 23:21:35 +00:00
deraadt
78f78c26c3 remove rfork(); ok guenther miod 2012-04-12 12:33:03 +00:00
deraadt
e1eb7ae046 prototype getdtablecount() 2012-04-12 11:19:34 +00:00
matthew
5365c52e49 Implement execvpe(3) and posix_spawn(3) and family. Based on
FreeBSD's implementation via Frank Denis, with various cleanups and
tweaks by me.

ok deraadt@, guenther@; discussions and tweaks from many others
jmc@ promises to help me further with the man pages in tree
2012-03-21 23:20:35 +00:00
nigel
8803123df2 Replace _SELECT_DECLARED with _SELECT_DEFINED_
Ok sthen@, millert@, dcoppa@
2012-01-13 13:16:44 +00:00
fgsch
3ebeadf023 getcwd() buffer's length can be smaller than 1024. In that case it will
fail with errno set to ERANGE if not enough room is provided. Similar for
getlogin_r() so remove minbytes enforcement attribute.
ok kettenis@ guenther@ deraadt@ on getcwd, deraadt@ on getlogin_r.
2011-11-09 15:34:18 +00:00
matthew
f02fac78d1 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@
2011-07-18 17:29:49 +00:00
jsg
c4ff7bee63 As pointed out by Richard Guenther our definition
of NULL was incorrect for c++ compilers that aren't
gcc (or pretend to be gcc like clang).

ok miod@
2011-07-03 18:51:01 +00:00
miod
0c2a5da7f0 Define NULL as a void * instead of a long integer, as required by Single Unix.
Kernel and bootblocks still use the old 0L value until all the NULL abuses
in the code are fixed.
2011-04-06 11:39:42 +00:00
millert
4ab37d14b5 Move _POSIX_THREAD_SAFE_FUNCTIONS into unistd.h and set it to 200112
now that we support all the _r functions required by POSIX 1003.1-2001.
Also define _POSIX_REENTRANT_FUNCTIONS.  OK kurt@ deraadt@
2008-06-25 14:58:54 +00:00