I put the symbols in the wrong file (should have been
lib/libc/sys/Symbol.map), added a duplicate pdfork entry due to a botch
rebase, and there seems to be a issue with gcc13/binutils not exposing
the symbols so revert the whole thing while I debug.
This reverts commit ee632fb9eb.
List them in the symbol map rather than using the __sym_default to
expose them. This will allow later improvements in the stub
implementations in libc.so.
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D44113
These private symbols are used by libc so expose as we do with
auxargs bits rather then relying on duplicate implementations in libc.
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D44114
This declares an API for libsys which currently consists of
__sys_<foo>() declarations for system call stubs and function pointer
typedefs of the form __sys_<foo>_t. The vast majority of the
implementation resides in a generated _libsys.h which ensures that all
system call stub declarations match syscalls.master.
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D44387
When moving the implementation, I failed to move the symbol entry.
Reviewed by: kib
Fixes: 84dd0c080b libc: libc/gen/sched_getcpu_gen.c -> libsys/
Differential Revision: https://reviews.freebsd.org/D44112
These provide standard APIs, but are implemented using another system
call (e.g., pipe implemented in terms of pipe2) or are interposed by the
threading library to support cancelation.
After discussion with kib (see D44111), I've concluded that it is
better to keep most public interfaces in libc with as little
as possible in libsys.
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D44241
Access __libsys_interposing with __libc_interposing_slot() in all
cases to support a move of these wrappers back to libc.
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D44239
Long ago (e129c18a83) __sys_sigwait was wrapped to prevent sigwait()
from returning with EINTR. Through a series of changes this wrapper
become __libc_sigwait which was internal to libc and used solely in the
interposing table. To support a move of sigwait back to libc, move this
wrapper into libsys and rename it with an __libsys_ prefix.
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D44238
__init_elf_aux_vector is now complied statically so don't try to export
it from the dynamic library.
Fixes: 8271d9b99a libsys: remove usage of pthread_once and _once_stub
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D44237
The undocumented yield system call has never been implemented via libc
or libsys (except accidentally for <15 minutes in 1998 between commits
abd529ceba and 0db2fac06a). Avoid trying to export it now to avoid
failures when linking with --no-undefined-version.
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D44236
Unlike other architectures, i386 only defined syscall() and not
_syscall() or __sys_syscall(). The syscall() function then invoked the
desired system call directly rather than invoking syscall(2). Keep the
latter as it's marginally more efficent, but also create the
conventional _syscall() and __sys_syscall() stubs.
This avoids the need to special case syscall(2) in the symbol list
generation in libsys.
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D44235
This file is functionally identical to the stub generated by
Makefile.sys once the MD version is removed.
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D44234
This file is functionally identical to the stub generated by
Makefile.sys once the MD version is removed.
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D44233
This file is functionally identical to the stub generated by
Makefile.sys once the MD version is removed.
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D44232
Historically we exposed _getlogin as a private symbol on a per-arch basis
(except on aarch64 and riscv) for no obvious reason. We now need to
expose it for libc's use so remove the special case from
makesyscalls.lua and expose it in the generated syscalls.map.
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D44116
Rather than having PSEUDO be a list of object files when all consumers
want syscall names or source files, make it a list of bare syscall
names like INTERPOSED (which is built on PSEUDO).
Improve document of variables developers can set.
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D44108
Consolidate in preparation for further cleanup.
Also relocate the sole NOASM entry.
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D44107
Every PSEUDO entry (_foo.o) has a corresponding NOASM entry (foo.o) to
suppress its addition to ASM. Check PSEUDO instead when adding entries
to ASM. No functional change.
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D44106
It's a thin wrapper on cap_getmode() implemented in libc, not a system
call so the symbol should have been exposed by libc/gen/Symbol.map
alongside the implementation.
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D44110
Move functions back to libc/gen sources; they are only versioned from
libc and not libsys.
Access libsys interposing slots using __libsys_interposing_slot()
instead of direct __libsys_interposing array dereference, which cannot
work from libc.
Reported by: glebius
Reviewed by: brooks
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D44042
so that libc/libthr do not preempt libsys symbols, esp. errno-related.
The issue is, if libsys is linked with DT_BIND_NOW flag, and then loaded
as filter, rtld tries to relocate its PLT symbols immediately, not as
filter. There, during symbol lookup, rtld finds filtering symbols in
libc, and since libc is in loading filters mode, the resolution stops
there. The end result is that libsys links to libc.
Reviewed by: brooks
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D44027
Before, the 'errno' itself was defined in libc and was referenced by
libsys, causing undesired dependency.
Reviewed by: brooks, imp
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D43985
that existed in auxv.c, use simple bool gate instead. This leaves a
small window if two threads try to call _elf_aux_info(3) simultaneously.
The situation is safe because auxv parsing is really idempotent. The
parsed data is the same, and we store atomic types (int/long/ptr) so
double-init does not matter.
Reviewed by: brooks, imp
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D43985
Continue to filter the public interface (elf_aux_info()), but entierly
relocate the private interfaces (_elf_aux_info(),
__init_elf_aux_vector(), and __elf_aux_vector) to libsys.
This ensures that rtld updates the correct (only) copy of
__elf_aux_vector. After 968a18975a
updates were confused and __getosreldate was failing, causing
the system to fall back to compat compat12 syscalls in some cases.
Return to explicitly linking libc to libsys and link libthr with libc
and libsys (in that order).
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D43910
and use the current file offset instead.
Requested by: Vinícius dos Santos Oliveira <vini.ipsmaker@gmail.com>
Reviewed by: jhb
Discussed with: asomers
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D43448
In initial hacking I'd bluntly disabled manpage installation in libsys,
then later disabled them for libc, but forgot to fix the former leading
to no syscall manapages.
PR: 276887
Reported by: Martin Birgmeier <d8zNeCFG@aon.at>
Declare in sys/umtx.h and implement in libsys. Explicitly link libthr
with libsys.
When building libthr static include _umtx_op_err so we don't break static
linkage with -lpthread.
Reviewed by: kib, emaste, imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/908
libsys provides the FreeBSD kernel interface (auxargs, system calls,
vdso). It can be linked directly for programs using a non-standard
libc and will later be linked as a filter library to libc providing
the actual system call implementation.
Reviewed by: kib, emaste, imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/908
We now export all _ and __sys_ prefixed syscalls stubs from libc and
libsys so that libsys can replace them.
Reviewed by: kib, emaste, imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/908
This is part of the interface to the kernel and some syscall wrappers
depend on it so move it there.
Reviewed by: kib, emaste, imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/908
auxv support requires _once(), but we don't want the libsys version
stomping on the libc version should they diverge in the future. We
could rename it entierly, but for now just hook it in via Makefile.sys.
Reviewed by: kib, emaste, imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/908
rfork_thread(3) is assembly that makes syscalls directly and uses
cerror so it belongs in libsys.
Reviewed by: kib, emaste, imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/908