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

1009 Commits

Author SHA1 Message Date
ratchov
49f67e12e9 Add a new SIOCTL_SEL control type to select one of a predefined set of
mutually exclusive values. It's the same as SIOCTL_LIST except that
exactly one list element may be selected.
2020-06-28 05:17:25 +00:00
ratchov
433bc80544 Fix comments about sioctl_desc's maxval field 2020-06-18 04:44:11 +00:00
guenther
2981a53a80 Use a double-underscore prefix for local variables declared in macros
that have arguments.  Document this requirement/recommendation in style(9)

prompted by mpi@
ok deraadt@
2020-05-10 00:56:06 +00:00
ratchov
d07fece68e Add API to control audio device parameters exposed by sndiod.
The API exposes controls of modern audio hardware and sndiod software
volume knobs in a uniform way.  Hardware knobs are exposed through
sndiod.  Multiple programs may use the controls at the same time
without the need to continuously scan the controls.

For now sndiod exposes only its own controls and the master output and
input volumes of the underlying hardware (if any), i.e. those
typically exposed by acpi volume keys.

ok deraadt
2020-02-26 13:53:58 +00:00
djm
5ec7511bc5 RDIRS for libcbor and libfido2 2019-11-14 21:14:53 +00:00
otto
af4d66b37c Allow the caller of asr functions to create and use a specific context.
Diff from eric@ and florian@, commiting on their behalf since they are absent
and we want to ride the minor shlib bump.
2019-10-24 05:57:41 +00:00
tedu
9a9933b793 add /usr/local/sbin. ok deraadt millert 2019-07-11 03:54:17 +00:00
jca
e748cc96c5 Include pthread.h to make this header standalone (needs pthread_t and others)
Will get us rid of pointless patches in the ports tree.  ok guenther@
2019-05-28 10:33:03 +00:00
otto
e03a31515f Inroduce malloc_conceal() and calloc_conceal(). Similar to their
counterparts but return memory in pages marked MAP_CONCEAL and on
free() freezero() is actually called.
2019-05-10 15:03:24 +00:00
guenther
c0197e40dd ld.so boot cleanup support:
- put functions and data which are only used before calling the executable's
   start function into their own page-aligned segments for unmapping
   (only done on amd64, arm64, armv7, powerpc, and sparc64 so far)
 - pass .init_array and .preinit_array functions an addition argument which
   is a callback to get a structure which includes a function that frees
   the boot text and data
 - sometimes delay doing RELRO processing: for a shared-object marked
   DF_1_INITFIRST do it after the object's .init_array, for the executable
   do it after the .preinit_array
 - improve test-ld.so to link against libpthread and trigger its initialization
   late
libc changes to use this will come later

ok kettenis@
2019-05-10 13:29:21 +00:00
jsg
cc1fc28705 unbreak make includes on non-clang archs after libobjc removal
found the hard way by nayden@ ok deraadt@
2019-04-06 02:56:16 +00:00
jsg
2584ca0b0c Build and install a shared libLLVM, llvm-config and llvm includes.
This is required to build the radeonsi Mesa driver.

ok patrick@
2019-03-05 09:44:38 +00:00
jsg
ba3116c2a5 enable libelf 2019-02-04 23:23:18 +00:00
tedu
295117693e add a pthread_get_name_np to match pthread_set_name_np.
could be useful in ports.
initial diff by David Carlier some time ago.
ok jca
2019-02-04 17:18:08 +00:00
millert
b59f966dd4 Make gl_pathc, gl_matchc and gl_offs size_t in glob_t to match POSIX.
This requires a libc major version bump.  OK deraadt@
2019-02-04 16:45:40 +00:00
millert
bf198cc6eb I am retiring my old email address; replace it with my OpenBSD one. 2019-01-25 00:19:25 +00:00
otto
3d657e16d4 There are cases where a program doing dns requests wants to set the
Checking Disabled flag. Introduce a RES flag to do so. ok krw@
deraadt@ eric@
2019-01-14 06:23:06 +00:00
guenther
d320821e29 Our *int_fast{8,16}_t types are int/unsigned int, so SCN*FAST{8,16}
shouldn't include 'hh' or 'h'.

problem noted by Andreas Kusalananda Kähäri (andreas.kahari(at)abc.se)
ok deraadt@ martijn@
2018-11-22 21:20:38 +00:00
otto
acb3f83f5f Introducing malloc_usable_size() was a mistake. While some other
libs have it, it is a function that is considered harmful, so:

Delete malloc_usable_size(). It is a function that blurs the line
between malloc managed memory and application managed memory and
exposes some of the internal workings of malloc.  If an application
relies on that, it is likely to break using another implementation
of malloc.  If you want usable size x, just allocate x bytes. ok
deraadt@ and other devs
2018-11-21 06:57:04 +00:00
otto
f5c5425b42 Implement malloc_usable_size(); ok millert@ deraadt@ and jmc@ for the man page 2018-11-18 16:15:18 +00:00
otto
7a9442eb01 Implement C11's aligned_alloc(3). ok guenther@ 2018-11-05 08:23:40 +00:00
guenther
6151004e8c Add C11's timespec_get(3); minor bump for libc.
Tweaked diff from brad@
manpage tweaks florian@ and jmc@
ok deraadt@ millert@
2018-10-30 16:28:42 +00:00
millert
5a122e6e86 Add uid_from_user() and gid_from_group(), derived from pax's cache.c.
It replaces the existing pwcache.c functions user_from_uid(3) and
group_from_gid(3) with the pax equivalents.  Adapted from NetBSD
(mycroft) changes from our own pax's cache.c.  OK guenther@
2018-09-13 12:31:15 +00:00
deraadt
2b699e5cc7 Add _PATH_AUTHPROGDIR = "/usr/libexec/auth", this path will be used
to unveil. Unfortunately the auth subsystem uses _PATH_AUTHPROG =
"/usr/libexec/auth/login_", which it auth-program is appended to -- a
rather gross idea which now shows lack of wisdom.
2018-07-29 19:40:41 +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
bluhm
3ea600eb29 The open POSIX test suite reveals that sigpause(int sigmask) from
4.2 BSD takes a signal mask as argument while POSIX sigpause(int
sig) expects a single signal.  Do not expose our traditional BSD
sigpause(3) to XPG/POSIX sources.
OK guenther@
2018-05-30 13:20:38 +00:00
mpi
44c85a19f1 Consistently spell "IPsec" in comments and debug outputs.
From Raf Czlonka, ok sthen@
2018-03-16 12:31:09 +00:00
kettenis
6c6408334d Implement sicos(3), sincosf(3) and sincosl(3). These functions are common
extensions and modern compilers (such as clang) will use them to optimize
separate calculations of sine and cosine.

ok tom@, patrick@, deraadt@, jmc@
2018-03-10 20:52:58 +00:00
deraadt
ea0d1f1fdb #define _MAX_PAGE_SHIFT in MD _types.h as the maximum pagesize an arch
needs (looking at you sgi, but others required this before).  This is for
the circumstances we need pagesize known at compile time, not getpagesize()
runtime. Use it for malloc storage sizes, for shm, and to set pthread stack
default sizes.  The stack sizes were a mess, and pushing them towards
page-aligned is healthy move (which will also be needed by the coming
stack register checker)
ok guenther kettenis, discussion with stefan
2018-03-05 01:15:24 +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
kettenis
53213268fe Add a member to be used by __cxa_thread_atexit(). Remove padding which would
now misalign things.

ok guenther@
2017-11-28 18:57:02 +00:00
kettenis
a0d792cdd9 Implement a DL_REFERENCE dlctl. To be used by the upcoming
__cxa_thread_atexit() implementation.

ok guenther@
2017-11-28 17:19:47 +00:00
jca
a318b99d5f Revert recent changes to unbreak ports/net/samba
While it is not clear (to me) why that ports ends up with corrupted
shared libs, reverting those changes fixes the issue and should allow us
to close p2k17 more smoothly.

Discussed with a bunch, ok ajacoutot@ guenther@
2017-11-04 22:53:57 +00:00
guenther
1047ef5966 Change pthread_cleanup_{push,pop} to macros that store the cleanup info
on the stack instead of mallocing the list and move the APIs from libpthread
to libc so that they can be used inside libc.

Note: the standard was explicitly written to permit/support this
"macro with unmatched brace" style and it's what basically everyone
else already does.  We xor the info with random cookies with a
random magic to detect/trip-up overwrites.

Major bump to both libc and libpthread due to the API move.

ok mpi@
2017-10-28 21:23:14 +00:00
mpi
7c8f01ebb0 <elf.h> should make it easier to port our ELF-related tools to other Unices.
For the moment it only includes <sys/exec_elf.h> but the goal is to
stop pulling it directly and also replace <elf_abi.h> at least for
base applications.

ok deraadt@, jasper@, naddy@
2017-10-17 09:34:52 +00:00
guenther
249f38f2da Move the thread-related .h files to /usr/src/include/, since the
implementation is now spread between libc and librthread.  No changes
to the content

ok mpi@
2017-10-15 23:40:33 +00:00
naddy
0cb6afd912 Use the modern POSIX idiom "-exec ... {} +" instead of find|xargs and
combine the two find(1) invocations into one.
From Klemens Nanni; ok tb@
2017-10-06 19:58:37 +00:00
schwarze
091ba0ade1 str[n]casecmp_l(3) appeared in POSIX 2008, not in XPG 4;
phessler@ reported that this oversight broke an armv7 bulk build;
OK guenther@
2017-09-10 21:50:36 +00:00
schwarze
3a628b46e7 New POSIX xlocale implementation written from scratch.
Complete in the sense that all POSIX *locale(3) and *_l(3) functions
are included, but in OpenBSD, we of course only really care about
LC_CTYPE and we only support ASCII and UTF-8.

With important help from kettenis@, guenther@, and jca@.
Repeated testing in ports bulk builds by naddy@.
Additional testing by jca@, sebastia@, dcoppa@, and others.
OK kettenis@ dcoppa@, and guenther@ on an earlier version.
Riding guenther@'s libc/librthread major bump.
2017-09-05 03:16:13 +00:00
guenther
18cf7fd763 fix typo in comment 2017-08-10 13:35:18 +00:00
guenther
6e13c3b6d7 ___errno (three underbars) is long gone 2017-08-10 13:34:46 +00:00
tom
c1664c6851 arc4random_buf should be bounded buffer, not bounded string
ok millert@
2017-05-11 11:52:18 +00:00
millert
6a20801c60 Add bounded attribute to freezero(). OK tom@ 2017-05-10 21:48:29 +00:00
visa
29879bdc83 Get TCB address using the RDHWR instruction instead of __get_tcb().
This gives fast access to the address on systems that implement
the UserLocal register. TCB caching is still used when running
in the single-threaded mode in order not to penalize old systems.

The kernel counterpart of this change must be in place before
using this diff!

With guenther@
2017-04-20 16:07:52 +00:00
kettenis
d8ee3b1570 Change build infrastructure to allow building both gcc and clang. This
doesn't actually flip the switch yet, so aarch64 continues to be the only
architecture for which we build clang.

ok jsg@, deraadt@
2017-04-17 15:53:21 +00:00
otto
c0e0c2a5d0 Introducing freezero(3) a version of free that guarantees the process
no longer has access to the content of a memmory object. It does
this by either clearing (if the object memory remains cached) or
by calling munmap(2). ok millert@, deraadt@, guenther@
2017-04-10 05:45:02 +00:00
guenther
f2704730e3 <struct.h> is unused and should not be used. Delete it.
ok millert@ deraadt@ kettenis@
2017-03-12 23:28:13 +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
otto
14537fffc1 Introducing recallocarray(3), a blend of calloc(3) and reallocarray(3)
with the added feature that released memory is cleared. Much input from various
developers. ok deraadt@ tom@
2017-03-06 18:50:28 +00:00
guenther
02a6e1c4ea The macro versions of htonl et al don't require them, but POSIX says
<arpa/inet.h> needs to provide uint16_t and uint32_t.

ok millert@ krw@ naddy@
2017-02-04 19:16:25 +00:00
guenther
828e760f53 Move the typedefs for in_{addr,port}_t from <sys/types.h> to
<netinet/in.h> and <arpa/inet.h>

ok and ports test naddy@ (thanks!)
ok krw@ beck@ millert@
2017-02-04 02:54:33 +00:00
jsg
cc65dc7ef9 install libcxxabi and libcxx headers when COMPILER_VERSION is clang
ok patrick@
2017-01-27 13:30:39 +00:00
kettenis
c9b8f0a24d Add max_align_t.
ok millert@
2017-01-06 14:36:50 +00:00
jca
afa5894845 Kill the /usr/include/ssl symlink
Proposed some time ago by tedu@, builk build by ajacoutot@
2016-11-12 03:04:27 +00:00
tb
76c3425b36 Set owners and permissions only after all headers are installed. Add the -P
flag to chown to change the symlinks themselves instead of their targets.
Also change permissions of all symlinks, so they don't depend on the umask
during make build.

ok millert
2016-11-08 19:56:56 +00:00
tb
b718d5d406 Move libcrypto, librpcsvc and gnu/usr.bin/cc/include from RDIRS to PRDIRS,
and add prereq targets, so some header files are generated by BUILDUSER
during 'make prereq' instead of by root during 'make includes'.

Switch the order of 'make cleandir' and 'make includes' during 'make build'
so we don't generate many files twice.

Except for some machine@ symlinks from ${MACHINE}/stand, /usr/obj is now
clean from files generated by root during 'make build'. Those will be
cleaned up in a second step.

help, testing & ok deraadt, input from natano, further testing rpe
2016-10-16 19:28:44 +00:00
sthen
2b5055b02e Unhook sqlite3. 2016-09-23 09:18:05 +00:00
fcambus
7742623a4c Remove duplicated includes in stdlib.h and termios.h
OK guenther@
2016-09-20 21:10:22 +00:00
kettenis
e2d18ed965 Add dl_unwind_find_exidx prototype.
ok guenther@
2016-09-20 18:24:55 +00:00
guenther
9e9a60b097 Don't declare select() in <unistd.h>
ok deraadt@ millert@
2016-09-12 19:36:26 +00:00
guenther
407745eaed Change the (unused) restimespec member of __res_state from a timespec
to a local equivalent to eliminate a dependency on <sys/time.h> being
included

ok deraadt@ millert@
2016-09-12 19:35:31 +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
nicm
77abaea03f Make the key sizes and offsets arrays const, ok tedu 2016-09-04 14:51:39 +00:00
nicm
bcaff74cc4 Add the usual header stuff (#ifdef _ICDB_H_ etc) to icdb.h, ok tedu 2016-09-04 11:53:23 +00:00
tedu
f6bf8f90c0 i forgot to commit sha2.h changes for SHA512/256 2016-09-03 17:00:29 +00:00
guenther
937c6c5fe0 Pull in <sys/select.h> for fd_set
ok deraadt@
2016-08-27 04:28:28 +00:00
guenther
8ae7fd5a8b Stop publicly declaring _yp_dobind() and struct dom_binding, closing out
a rant Theo wrote 24 years ago.  Mark __ypexclude_{add,is,free}() as hidden

"get off my lawn!" deraadt@
2016-05-30 02:53:29 +00:00
guenther
fbe95b3563 Stop supporting longjmperror(); it's not used, not portable, and the checks
longjmp performs can't really be relied upon, even after we got rid of the
false positives...

ok millert@ deraadt@
2016-05-23 00:18:56 +00:00
guenther
df1557eb24 Remove iruserok(_sa)? and __ivaliduser(sa)?
ok millert@ deraadt@
2016-05-23 00:12:58 +00:00
guenther
2032f1fe08 Remove sigreturn declaration and the now-unused libc syscall stub 2016-05-09 23:55:52 +00:00
tedu
3d8a654b1a remove dbm.h 2016-05-07 21:58:24 +00:00
guenther
fe38b55cb0 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@
2016-05-07 19:05:21 +00:00
guenther
157c34b356 Prepare for future ld.so/libc bump: update <tib.h> with the definitions
that will be needed and make libpthread work when ld.so/libc.a provide an
initial TIB.
2016-03-20 02:30:28 +00:00
jca
574dde883c Remove #ifdef __vax__ bits
ok deraadt@ tb@ (who had the same diff)
2016-03-17 20:55:35 +00:00
deraadt
c6c30f45cd remove cpp version of __sputc, since the inline version is all we have
ever used.
ok jsg
2016-03-16 04:56:08 +00:00
millert
abd93d17ae Expose snprintf() and vsnprintf() for XPG 5. It predates C99 but
still specified snprintf() and vsnprintf() based on earlier drafts.
Allows snprintf() and vsnprintf() to be used when _XOPEN_SOURCE is
defined as 500.  OK guenther@
2016-03-14 20:43:03 +00:00
deraadt
696cd27b24 We are done providing support for the vax.
lots of agreement.
2016-03-09 16:28:44 +00:00
millert
1647db04b3 Convert sigemptyset and sigfillset to inline functions to avoid
warnings with newer gcc versions and -Werror=unused-value.
OK guenther@
2016-02-04 22:04:34 +00:00
jca
7519139380 Remove decls #if'0ed since rev. 1.1
POSIX used to specify those declarations, but later removed them.

ok guenther@
2016-01-25 12:17:48 +00:00
jasper
d88f57029e After nearly 20 years of warning that malloc.h is obsolete, it's about time we
actually remove this header. It was originally added for ports, which is
malloc.h-free now.

additional ports bulk by aja@
ok bently@ dcoppa@ millert@ sthen@
2016-01-20 19:09:52 +00:00
ratchov
bde5d16205 Expose internal functions necessary to open audio devices and midi
ports using existing file descriptors.
2015-12-20 11:29:29 +00:00
millert
e7fbb21cb1 POSIX says that ffs(), strcasecmp(), strncasecmp(), r?index() and
the b* byte functions belong in strings.h, not string.h so break
them out of string.h into a new strings.h.  As long as there is no
POSIX or X/OPEN define in use string.h will pull in strings.h.
OK naddy@ deraadt@
2015-11-20 23:40:32 +00:00
tedu
025678fa0f add a version field to prevent mayhem if different data gets stored 2015-11-18 17:59:56 +00:00
tedu
e55899f04c add icdb.h here (this header may go away entirely, but the functions
need to live somewhere in the meantime.)
2015-11-18 16:48:34 +00:00
tedu
46d82e2ec0 Add icdb, the internal c database. A simpler replacement for the old
Berzerkeley DB code.
2015-11-18 16:46:49 +00:00
tedu
8a63353a77 Add _shadow variants to the two popular getpw functions (uid and nam).
This version of the function will always open the secure/shadow/master
password files. Soon, the regular variants of these functions will not.
(Intermixing shadow and regular gets a little weird; don't do that.)
Not using struct spwd and getspwnam functions to reduce churn in callers.
Should just be a one line diff in most places.
ok deraadt
2015-11-18 16:44:46 +00:00
deraadt
e9ff445ba1 libocurses can go to the Attic. last consumer of it was ramdisk more(1)
conceptual ok guenther millert nicm
2015-11-14 23:56:48 +00:00
guenther
60d4950662 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@
2015-11-10 04:30:59 +00:00
guenther
d994eebbf7 Move the last of the __DBINTERFACE_PRIVATE bits from <db.h> to libc's wrapper
and eliminate the now superfluous -D option

ok kettenis@ millert@
2015-10-17 21:48:42 +00:00
deraadt
58857ab480 tame -> pledge. 2015-10-09 01:26:40 +00:00
deraadt
4b9ea9621a delete xdr_ypresp_all_seq prototype 2015-09-28 20:49:24 +00:00
kettenis
1042567dd9 Stop installing any header files in /usr/include/dev/pci/drm.
Userland should get these from /usr/X11R6/include/libdrm.

ok deraadt@ (and suggested by jsg@)
2015-09-27 14:52:47 +00:00
guenther
261d695547 Trim symbols that aren't part of our new resolver
OK semarie@
2015-09-25 23:32:51 +00:00
guenther
c261d7e9a9 Revert: finger slip 2015-09-14 08:24:37 +00:00
guenther
f09ad35c18 Prefer the standardized <poll.h> over <sys/poll.h> 2015-09-14 08:16:14 +00:00
guenther
85858ec2de Wrap <rpc/*.h> so that calls go direct and the symbols are all weak.
Hide __xprt_register() and _authenticate(); truncate <rpc/svc_auth.h>

ok deraadt@
2015-09-13 15:36:56 +00:00
guenther
af44c6e45d authdes_create() was never implemented 2015-09-13 12:29:03 +00:00
deraadt
bf89e9b125 Hide netgroup internals inside libc. The parts that netgroup_mkdb
wants to use, well.... copy them there.
ok guenther
2015-09-10 18:59:34 +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
061188c8bf Stop exporting from libc the <mpool.h> and the mpool_* API
ports scan by sthen@
2015-09-09 15:35:24 +00:00