Commit Graph

10052 Commits

Author SHA1 Message Date
Andrew Turner
6eeedf35c3 libc: Replace armv6 with armv7 in a comment
Armv6 is being removed from the treem and the comment applies to armv7.

Reviewed by:	manu, imp, emaste
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D45645
2024-06-20 09:26:22 +00:00
Andrew Turner
b8a496dfb6 lib: Remove __ARM_ARCH checks that are always true
Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D45559
2024-06-12 11:49:05 +00:00
Mark Johnston
da925fcebf libc/tests: Further refine the condition for installing h_raw
See 8164d511d6 ("libc/tests: Fix installation without MK_TOOLCHAIN")
for some background.  Here we should really be testing MK_CLANG instead,
since that's what gates compilation of libclang_rt.

Fixes:	8164d511d6 ("libc/tests: Fix installation without MK_TOOLCHAIN")
2024-06-09 10:08:31 -04:00
Mark Johnston
8164d511d6 libc/tests: Fix installation without MK_TOOLCHAIN
There is some exotic conditional logic here to avoid building a
particular test if a certain UBSAN library isn't present in the
toolchain sysroot.  This causes build failures for me when doing an
"installworld WITHOUT_TOOLCHAIN=", which I do frequently during tests.

I believe the problem is that SYSROOT is unset during installworld, so
the build sees the host's copy of libclang_rt.ubsan_standalone.a and
then tries to install a binary that wasn't built during buildworld.  Try
to make the check a bit less fragile.

Reviewed by:	dim
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D45035
2024-05-28 08:24:43 -04:00
Ed Maste
61639bb3fc libc: move NIS xdr_* symbols from rpc's to yp's Symbol.map
To fix WITHOUT_NIS build.  Building yp_xdr.c is gated by MK_NIS.

PR:		279270
Reported by:	peterj
Reported by:	matteo
Reported by:	Michael Dexter's Build Option Survey run
Reviewed by:	brooks
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D45347
2024-05-24 16:47:37 -04:00
Tom Hukins
2ce32ab21a Fix "version introduced" in two manual pages
Signed-off-by: Tom Hukins <tom@FreeBSD.org>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1252
2024-05-23 10:30:32 -06:00
Alexander Ziaee
1a720cbec5 man filesystems: fix xrefs after move to section 4
Reviewed by: des, imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1077
2024-05-16 10:25:29 -06:00
Kyle Evans
8b0682644e Fix the GCC build after _FORTIFY_SOURCE import
We haven't exposed gets(3) in a long time, rip out __gets_chk before
it's too late and something builds a gets(3) user with it enabled.
2024-05-13 11:21:38 -05:00
Kyle Evans
e55512504d Prepare the system for _FORTIFY_SOURCE
Notably:
- libc needs to #undef some of the macros from ssp/* for underlying
  implementations
- ssp/* wants a __RENAME() macro (snatched more or less from NetBSD)

There's some extra hinkiness included for read(), since libc spells it
as "_read" while the rest of the world spells it "read."

Reviewed by:	imp, ngie
Sponsored by:	Stormshield
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D32307
2024-05-13 00:23:50 -05:00
Kyle Evans
be04fec426 Import _FORTIFY_SOURCE implementation from NetBSD
This is a mostly-unmodified copy of the various *_chk implementations
and headers from NetBSD, without yet modifying system headers to start
actually including them.  A future commit will also apply the needed
bits to fix ssp/unistd.h.

Reviewed by:	imp, pauamma_gundo.com (both previous versions), kib
Sponsored by:	Stormshield
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D32306
2024-05-13 00:23:49 -05:00
Simon J. Gerraty
f77b5b295d Allow -DNO_STRICT_REGEX to restore historic regex behavior
Allow restoring the behavior of '{' as described in regex(3).
Ie. only treat it as start of bounds if followed by a digit.

If NO_STRICT_REGEX is not defined, the behavior introduced by
commit a4a801688c is retained,
otherwise the previous behavior is restored.

Differential Revision:	https://reviews.freebsd.org/D45134
2024-05-09 18:29:43 -07:00
Ed Maste
d84fd89ecd dlopen(3): mention fdlopen for capsicum(4)
Capsicum-sandboxed applications generally cannot use dlopen, as absolute
and cwd-relative paths cannot be accessed.  Mention that fdlopen is
useful for sandboxed applications.

PR:		277169
Reviewed by:	markj, oshogbo
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D45108
2024-05-07 09:09:59 -04:00
Konstantin Belousov
b27eb9ce96 __cxa_thread_call_dtors(3): fix dtor pointer validity check
When checking for the destructor pointer belonging to some still
loaded dso, do not limit the possible dso to the one instantiated the
destructor. For instance, dso could set up the dtr pointer to a function
from libcxx.

PR:	278701
Reported by:	vd
Reviewed by:	dim, emaste, markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D45074
2024-05-04 02:23:15 +03:00
Michael Tuexen
eee88ef45f sctp: document sctp_recvmsg as implemented
PR:		275990
MFC after:	3 days
2024-05-02 15:17:43 +02:00
Konstantin Belousov
aa66995b4c libc printf_render_errno(): do not use strerror()
Reviewed by:	imp
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D44916
2024-04-23 22:44:07 +03:00
Konstantin Belousov
bac9d7e8f2 libc: minor style, wrap long lines
Reviewed by:	imp
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D44916
2024-04-23 22:44:07 +03:00
Konstantin Belousov
f887667694 __vprintf(): switch from strerror() to strerror_rl()
This eliminates the use of non-thread-safe function in printf*() family,
and make the call locale-aware.  Also, it stops obliterating the
strerror() static buffer, which aligns with the POSIX requirement that
implementations must behave as if no standard-mandated functions call
strerror().

PR:	278556
Reported by:	Jonathan Gruber <jonathan.gruber.jg@gmail.com>
Reviewed by:	imp
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D44916
2024-04-23 22:43:01 +03:00
Konstantin Belousov
92771bc00a libc: make strerror_rl() usable for libc
Reviewed by:	imp
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D44916
2024-04-23 22:40:29 +03:00
Christopher Davidson
96a2e036b7 Update manual page references and macros to align to mandoc syntax
xlocale.3: Comment out reference to atof_l(3), atoi_l(3), atol_l(3), atoll_l(3)
  These manual page references do not exist.

lagg.4: Change the reference for /etc/rc.conf from a reference link
  .Xr -> .Pa based on the context within the manual page it is used.

buf.9: Remove .Xr entries from the file
  The buf.9 manual page contains a commented out .Xr reference.
  The <filmmein> 9 entry is a placeholder and has been removed for
  clarity.

Reviewed by:	mhorne
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1114
2024-04-23 12:50:54 -03:00
rilysh
bac2eea13a swab.c(libc): use a simplified version of byte swapping
This version of swab function simplifies the logic of swapping adjacent
bytes. Previous version of swab() used an arbitrary unrolling, which was
relevant back in the day but unnecessary for modern compilers, as if the
input size is known at compile time, they can do it automatically.

This version of swab() is inspired by musl.
A similar version can be found at: https://github.com/openbsd/src/blob/master/lib/libc/string/swab.c

Signed-off-by: rilysh <nightquick@proton.me>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1086
2024-04-22 23:01:54 -06:00
Brooks Davis
f0bd655a61 libc/quad: further narrow list of i386 symbols
It's unclear to me why lld didn't complain about these are they aren't
present and haven't been.  Instead ld.bfd complained.

Reviewed by:	dim
Fixes:		6e6cd03c91 libc/quad: narrow list of symbols exposed on i386
Differential Revision:	https://reviews.freebsd.org/D44879
2024-04-19 22:56:13 +01:00
Brooks Davis
6e83504c60 Revert "lib{c,sys}: normalize export of openat, setcontext, and swapcontext"
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.
2024-04-19 22:25:04 +01:00
Brooks Davis
ee632fb9eb lib{c,sys}: normalize export of openat, setcontext, and swapcontext
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
2024-04-17 23:39:46 +01:00
Brooks Davis
e0919a4bac libc/arm: export __signalcontext not _signalcontext
The former exists and architectures other than aarch64 and riscv provide
it.  The later does not exist.

Differential Revision:	https://reviews.freebsd.org/D44329
2024-04-16 22:14:21 +01:00
Brooks Davis
63b179b68d libc: don't try to export __sF
This symbol has been static since 2008 (commit 1e98f88776).

Differential Revision:	https://reviews.freebsd.org/D44188
2024-04-16 22:14:20 +01:00
Brooks Davis
88fcb61799 libc: don't try to export _nsdbtdump
It is only present when compiling nsdispatch.c with -D_NSS_DEBUG and we
provide no mechanism to do so.

Differential Revision:	https://reviews.freebsd.org/D44187
2024-04-16 22:14:20 +01:00
Brooks Davis
4d6722ec69 libc: don't try to export mexitcount
This requires that mcount.c be compiled with -DGUPROF and we provide no
mechanism to do so.

Differential Revision:	https://reviews.freebsd.org/D44186
2024-04-16 22:14:20 +01:00
Brooks Davis
1b10a30539 libc: don't try to export mpool_stat
This requires that mpool.c be compiled with -DSTATISTICS and we provide
no mechanism to do this.

Differential Revision:	https://reviews.freebsd.org/D44185
2024-04-16 22:14:20 +01:00
Brooks Davis
0dd2f4a0cc libc: only export hesiod symbols when enabled
Create a seperate symbol file for hesiod and conditionally include it.
This allows linkage with --no-undefined-version.

Differential Revision:	https://reviews.freebsd.org/D44184
2024-04-16 22:14:20 +01:00
Brooks Davis
7dd9070e44 libc: INTERPOS_SYS macro for interposed syscalls
This macro makes uses the __sys_<foo>_t typedefs from libsys.h to
greatly simplify calling functions in the interposing table.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D44389
2024-04-16 17:48:08 +01:00
Brooks Davis
792081a730 lib{c,rt}: use libsys.h for __sys_* declerations
Use the genreated source of truth for system call declerations.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D44388
2024-04-16 17:48:07 +01:00
Brooks Davis
418b4c2a80 acl_to_text: include sys/param.h for MAXLOGNAME
Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D44474
2024-04-15 21:35:41 +01:00
rilysh
f362c952a5 libc(bt_utils.c): fix "contiguous" spelling
From "contigous" to "contiguous".

Signed-off-by: rilysh <nightquick@proton.me>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1119
2024-04-12 16:34:55 -06:00
rilysh
0fc1fb1491 libc(bt_seq.c): fix "uninitialized" spelling
From "unitialized" to "uninitialized".

Signed-off-by: rilysh <nightquick@proton.me>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1119
2024-04-12 16:34:54 -06:00
rilysh
bdf5675a49 libc(xdr_reference.c): fix "referenced" spelling
From "referneced" to referenced".

Signed-off-by: rilysh <nightquick@proton.me>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1119
2024-04-12 16:34:53 -06:00
rilysh
84970eab6a libc(xdr.c): fix "discriminated" spelling
From "descriminated" to "discriminated".

Signed-off-by: rilysh <nightquick@proton.me>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1119
2024-04-12 16:34:52 -06:00
rilysh
9a7f7b2480 libc(inet_net_pton.c): fix "Fiery" spelling
From "Firey" to "Fiery".

Signed-off-by: rilysh <nightquick@proton.me>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1119
2024-04-12 16:34:51 -06:00
rilysh
2f1da80f21 libc(localeconv.c): fix "appropriate" spelling
From "approprate" to "appropriate".

Signed-off-by: rilysh <nightquick@proton.me>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1119
2024-04-12 16:34:51 -06:00
Minsoo Choo
7c7299df76 libc: Remove support for pre-C99 C standards
Reviewed by:	jhb
Differential Revision:	https://reviews.freebsd.org/D43254
2024-04-12 12:05:09 -07:00
rilysh
2a3d453049 exit.3: add the comma after an empty space
exit(3) man page shows __cxa_atexit(3,) instead of __cxa_atexit(3), in a
particular section. It seems the comma gets inside the parenthesis and
with an extra space, it can be viewed as expected.

Signed-off-by: rilysh <nightquick@proton.me>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1006
2024-04-09 21:38:01 -06:00
Dag-Erling Smørgrav
7534109d13 libc: Improve description of mktime() / timegm().
* Mention that mktime() and timegm() set errno on failure.
* Correctly determining whether mktime() / timegm() succeeded with
  arbitrary input (where -1 can be a valid result) is non-trivial.
  Document the recommended procedure.

PR:		277863
MFC after:	1 week
Reviewed by:	pauamma_gundo.com, gbe
Differential Revision:	https://reviews.freebsd.org/D44503
2024-03-27 11:03:37 +01:00
Gordon Bergling
577a721d05 xdr(3): Fix a few typos in source code comments
- s/reoutines/routines/
- s/paraemters/parameters/

Obtained from:	NetBSD
MFC after:	3 days
2024-03-23 08:43:41 +01:00
Brooks Davis
312a05c39e riscv: remove more riscv64sf support
Remove a few more bits of riscv64sf support in libc and libm.

Reduce floating point ABI checks to requiring double hard float.

Reviewed by:	imp, jhb
Fixes:		1ca12bd927 Remove the riscv64sf architecture.
Differential Revision:	https://reviews.freebsd.org/D44334
2024-03-21 23:48:37 +00:00
Andrew Turner
5202ca77aa libc/aarch64: Add a non-trivial getcontextx
Add support for extra registers to the arm64 getcontextx. As no
registers are defined this just adds the extra register list and an end
context.

Reviewed by:	kib
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D44255
2024-03-21 10:13:24 +00:00
Andrew Turner
fd6b1cc34e libc/aarch64: Copy the trivial getcontextx
This will be used as the base of a non-trivial implementation.

Reviewed by:	kib
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D44254
2024-03-21 10:13:24 +00:00
Konstantin Belousov
69d5783ae8 wmemchr(3): fix prototypes for wcpcpy() and wcpncpy()
PR:	277855
Reported by:	Paul Floyd <pjfloyd@wanadoo.fr>
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2024-03-21 10:40:08 +02:00
Baptiste Daroussin
3a9ddfa1ab pkgbase: install all libc test files into the tests package 2024-03-20 17:13:56 +01:00
Brooks Davis
d0efabdf15 syscalls.master: make __sys_fcntl take an intptr_t
The (optional) third argument of fcntl is sometimes a pointer so change
the type to intptr_t.  Update the libc-internal defintion (actually used
by libthr) to take a fixed intptr_t argument rather than pretending it's
a variadic function.  (That worked because all supported architectures
pass variadic arguments as though the function was declared with those
types.  In CheriBSD that changes because variadic arguments are passed
via a bounded array.)

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D44381
2024-03-19 23:13:26 +00:00
Brooks Davis
b12090676c lib{c,sys}: correctly expose sched_getcpu
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
2024-03-15 22:52:07 +00:00
David E. O'Brien
c4ff9276a9 strnlen(3): add HISTORY
Complete 4b7f35db's HISTORY's train of thought
2024-03-15 14:52:47 -07:00