summaryrefslogtreecommitdiff
path: root/include
AgeCommit message (Collapse)Author
4 dayslibc/stdlib: Port strtonumx() from IllumosHans Rosenfeld
Add strtonumx(), a companion to strtonum(3) that preserves its safety and error-reporting semantics while allowing the caller to specify a conversion base, similar to the strtol(3) family of functions. Reviewed by: emaste, kib, ziaee Obtained from: https://www.illumos.org/issues/15365 Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D54270
10 daysMakefile*: remove powerpcspeMinsoo Choo
As reported on the freebsd-announce mailing list[1] FreeBSD is continuing to retire 32-bit support. Remove powerpcspe from build infrastructure. [1] https://lists.freebsd.org/archives/freebsd-announce/2024-February/000117.html Signed-off-by: Minsoo Choo <minsoochoo0122@proton.me> Reviewed by: jhibbits, emaste Pull request: https://github.com/freebsd/freebsd-src/pull/1914
12 daysstdbool.h: Update for C23Minsoo Choo
When a compiler with C23 or higher is detected, builtin bool, true, and false are used to conform the C23 standard. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D44664
2025-12-29libc: add glibc-compatible tdestroy(3)Konstantin Belousov
The function clears the whole tree. Relnotes: yes Reviewed by: alc, emaste Discussed with: dougm Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D54365
2025-12-10Add sys/_align.h replacing machine/_align.hBrooks Davis
Define _ALIGNBYTES using sizeof(void *) (no functional change on any existing architecture) which will allow it to work with CHERI were we must align things up to capability alignment. In _ALIGN, replace integer manipulation which does not preserve pointer provenance with a type and provenance preserving builtin. This requires modest changes in code which assumes _ALIGN returns an integer, but those are relatively rare. Reviewed by: kib, markj Effort: CHERI upstreaming Sponsored by: Innovate UK Differential Revision: https://reviews.freebsd.org/D53947
2025-12-09libc/string: add strdupa(3) and strndupa(3)Konstantin Belousov
Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D54066
2025-12-05Revert "stddef.h: add unreachable() for C23 compliance"Robert Clausecker
Seems like a number of ports are *really* unhappy with this new macro. These ports will have to be fixed and the patch reworked to perhaps not affect C++ (see D54041). A general discussion on how we expose new language features may also need to take place. Reported by: many people Approved by: markj (mentor) This reverts commit b381d0980221b476cadbef862a8e5973d675fb7a.
2025-11-30libc: implement C23 <stdbit.h> functionsRobert Clausecker
This new header complies with ISO/IEC 9899:2024 (C23). Contrary to glibc, we do not provide inline definitions in <stdbit.h> as we expect our system compiler to soon recognise these as builtins anyway. Relnotes: yes MFC after: 1 month Reviewed by: adrian Approved by: markj (mentor) Differential Revision: https://reviews.freebsd.org/D53657
2025-11-28stddef.h: add unreachable() for C23 complianceRobert Clausecker
unreachable() is a hint to the compiler that it is unreachable. Add a new man page unreachable(3) to document this macro. Reviewed by: imp Approved by: markj (mentor) MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D53967
2025-11-28uchar.h: add char8_tRobert Clausecker
A type similar to char16 and char32_t, for compliance with C23. The related type atomic_char8_t is added to stdatomic.h. As char8_t is always unsigned char, I've skipped adding __char8_t. This can be added, too, if desired. Reviewed by: imp Approved by: markj (mentor) MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D53952
2025-11-28time.h: add timegm() to the C23 namespaceRobert Clausecker
This function is part of ISO/IEC 9899:2024 (C23) and was forgotten in D47856. Reviewed by: imp Approved by: markj (mentor) See also: D47856 Fixes: 59677aecb67bbedcfa2ee5d7d2b189193cdc4af7 MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D53951
2025-11-24Use ZFSTOP more broadlyJohn Baldwin
Reviewed by: brooks Obtained from: CheriBSD Differential Revision: https://reviews.freebsd.org/D53791
2025-11-12lib/libc: implement C23 memalignment()Robert Clausecker
This new function computes the alignment of a pointer. It is part of ISO/IEC 9899:2024, the new C standard. If the pointer is a null pointer, null is returned. I have tried to write an implementation that can cope with traditional address-based architectures, even if size_t and uintptr_t are of different length. Adjustments may be needed for CHERI though. A man page is provided, too. No unit test for now. Reviewed by: kib, imp, ziaee (manpages), pauamma@gundo.com Approved by: markj (mentor) MFC after: 1 month Relnotes: yes Differential Revision: https://reviews.freebsd.org/D53673
2025-10-18include/stdckdint.h: make the header compatible with C++Konstantin Belousov
by removing the cast to _Bool. The _Bool type is not defined for C++, and the specification from the gcc info doc states that the return type of the __builtin_{add,sub,mul}_overflow() is bool already. This is done instead of including stdbool.h to avoid namespace pollution, since defining bool from stdckdint.h simingly is not sanctioned by ISO/IEC 9899:2024. PR: 290299 Reviewed by: des Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D53149
2025-10-04libc/resolv: get rid of MD5Robert Clausecker
MD5 is used by libc/resolv to generate a random sequence id from a current time stamp. Replace this convoluted mechanism with a call to arc4random(). This permits us to entirely drop MD5 from libc, simplifying the MD5 rework proposed in D45670. Approved by: markj Reviewed by: kevans, markj See also: D45670 Event: EuroBSDcon 2025 Differential Revision: https://reviews.freebsd.org/D52784
2025-10-03lib/libc: add recallocarray()Robert Clausecker
This function from OpenBSD is a hybrid of reallocarray() and calloc(). It reallocates an array, clearing any newly allocated items. reallocarray() ultimately originates from OpenBSD. The source is taken from lib/libopenbsd, which now no longer has the function unless when bootstrapping (needed for mandoc). Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D52863
2025-09-30libbsm: Rename package to audit-libLexi Winter
This is part of audit, so use the new LIB_PACKAGE feature to name the package audit-lib, rather than libbsm. MFC after: 1 day Reviewed by: bapt Sponsored by: https://www.patreon.com/bsdivy Differential Revision: https://reviews.freebsd.org/D52789
2025-09-23tzcode: Expose and document offtime() and offtime_r()Dag-Erling Smørgrav
Includes diff reduction to upstream version of this patch. MFC after: 3 days Sponsored by: Klara, Inc. Reviewed by: philip Differential Revision: https://reviews.freebsd.org/D39715
2025-09-11Revert "libc: Remove readdir_r(3)"Dag-Erling Smørgrav
This reverts commit d549de769055ae6116601e54e4c86dfb3e17f4c4.
2025-09-10libc: Remove readdir_r(3)Dag-Erling Smørgrav
This function was never safe to use. We marked it deprecated in the manual page in 2016, and it is marked obsolete in POSIX 2024. We previously added a linker warning and annotated the prototype; now that stable/15 has been branched, we can remove it from main. Relnotes: yes Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D52474
2025-08-20Remove MK_GSSAPILexi Winter
For MIT Kerberos, MK_GSSAPI has no meaning: GSSAPI is a required part of Kerberos and is always built if MK_KERBEROS is enabled. Backport this behaviour to Heimdal so it works the same way. While here, change Heimdal's libcom_err and compile_et to be selected by MK_KERBEROS, not MK_KERBEROS_SUPPORT, since these are part of Kerberos and third-party users might need it even if Kerberos support is disabled in the base system. This means MK_KERBEROS_SUPPORT installs the same files with both MIT and Heimdal. Reviewed by: cy Differential Revision: https://reviews.freebsd.org/D51859
2025-08-15Revert "Remove Secure RPC DES authentication"Lexi Winter
This reverts commit 7ac276298b72982189ac1a5b17461936dc00163e. Requested by: kib
2025-08-10Remove Secure RPC DES authenticationLexi Winter
Following the earlier removal of keyserv, none of this functionality works since it requires keyserv. Remove the relevant symbols from libc's Symbol.map. Leave compatibility symbols for existing applications, but since the functions don't work without keyserv, stub them out to return an error. Remove some private symbols that were only used by keyserv; these don't get compatibility symbols. Remove the documentation for the old functions. Remove rpc.ypupdated since it requires DES authentication. Reviewed by: manu, des, emaste Differential Revision: https://reviews.freebsd.org/D50442
2025-08-07gssapi,krb5: Replace libgssapi with the MIT versionCy Schubert
lib/libgssapi is based on Heimdal. As on Linux systems, the MIT libgssapi_krb5 replaces it. With both gssapi libraries and header files installed results in broken buildworld (gssd) and ports that will not build without modifications to support the MIT gssapi in an alternate location. 73ed0c7992fd removed the MIT GSSAPI headers from /usr/include. Apps using MIT KRB5 gssapi functions and structures will fail to build without this patch. This patch includes a temporary patch to usr.sbin/gssd to allow it to build with this patch. rmacklem@ has a patch for this and for kgssapi that uses this patch to resolve kgssapi issues for NFS with Kerberos. This patch is an updated version of D51661 to allow it to build following additional patchs to the tree. This should have been implmented with 7e35117eb07f. Fixes: 7e35117eb07f, 73ed0c7992fd Differential Revision: https://reviews.freebsd.org/D51661
2025-08-02libc: Deprecate readdir_r()Dag-Erling Smørgrav
This function was never safe to use. We marked it deprecated in the manual page in 2016, and it is marked obsolete in POSIX 2024. Add a linker warning and annotate the prototype. Sponsored by: Klara, Inc. Reviewed by: imp, markj Differential Revision: https://reviews.freebsd.org/D51681
2025-07-23rpc.h: Remove reference to unimplemented DES ioctlsEd Maste
We won't be adding support for hardware DES. Remove the #ifdef notdef block. Sponsored by: The FreeBSD Foundation
2025-06-23libc: Rename fscandir{,_b}() to fdscandir{,_b}().Dag-Erling Smørgrav
This seems to fit the pattern better (e.g. fdopendir()). I've added weak references to ease the transition, but since it's only been a few days, we can remove them (and the ObsoleteFiles entries for the manual pages) before we branch stable/15. Fixes: deeebfdecab5 Sponsored by: Klara, Inc. Reviewed by: kevans Differential Revision: https://reviews.freebsd.org/D50980
2025-06-20libc: Add fscandir(), fscandir_b(), scandirat_b().Dag-Erling Smørgrav
While here, clean up scandir() a bit and improve the documentation. MFC after: never Sponsored by: Klara, Inc. Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D50935
2025-06-18arm64: lib32: Don't try to install removed <machine/runq.h>Olivier Certner
Reported by: Herbert J. Skuhra (herbert gojira.at) Fixes: 79d8a99ee583 ("runq: Deduce most parameters, remove machine headers") MFC after: 1 month Event: Kitchener-Waterloo Hackathon 202506 Sponsored by: The FreeBSD Foundation
2025-06-11ssp: Protect sig2str with proper visibility markersWarner Losh
We only define SIG2STR_MAX with careful visibility, but define the fortified version unconditionally. It needs to have the same visibility both places. Fixes: 3d12567133bf Reviewed by: jrtc27, kevans Sponsored by: Netflix
2025-06-11include: ssp: fortify <signal.h>Ricardo Branco
sig2str(3) Reviewed by: imp, kib, des, jilles Pull Request: https://github.com/freebsd/freebsd-src/pull/1696 Closes: https://github.com/freebsd/freebsd-src/pull/1696
2025-06-11Add the POSIX sig2str(3) & str2sig(3) callsRicardo Branco
Signed-off-by: Ricardo Branco <rbranco@suse.de> Reviewed by: imp, kib, des, jilles Pull Request: https://github.com/freebsd/freebsd-src/pull/1696
2025-06-11Add POSIX NSIG_MAX & _SC_NSIGRicardo Branco
Signed-off-by: Ricardo Branco <rbranco@suse.de> Reviewed by: imp, kib Pull Request: https://github.com/freebsd/freebsd-src/pull/1710 Closes: https://github.com/freebsd/freebsd-src/pull/1710
2025-06-11Add sys/stdarg.hBrooks Davis
While the type of va_list and implementation of va_*() psuedo functions varies (sometimes greatly) by architecture, they will always be defined by the compiler in a consistant way that does not require machine dependent handling. MFC after: 1 week Reviewed by: imp Exp-run by: antoine (PR 286274) Pull Request: https://github.com/freebsd/freebsd-src/pull/1595
2025-06-11sys/_stdarg.h: drop cdefs.h and _types.h polutionBrooks Davis
Rely in sys/_visible for visibility macros and use __buitin_va_list instead of __va_list everywere we declare va_list. Reviewed by: imp Exp-run by: antoine (PR 286274) Pull Request: https://github.com/freebsd/freebsd-src/pull/1595
2025-06-11stddef.h: don't include sys/cdefs.hBrooks Davis
Switch to sys/_visible.h for visibility macros. Prefer __builtin_offsetof over __offset. sys/cdefs.h always defines __offsetof to __builtin_offsetof so just use the latter to remove a dependency on sys/cdefs.h. Realistically, we're never going to care about a compiler that doesn't supply this builtin. Add a somewhat questionable guard around the offsetof() definition because the compiler no longer thinks it the same as a number of other redundent definitions scattered around (e.g., in the openzfs codebase). It is actually the same and those defintions likely shouldn't exist at all, but it's easy to add a guard for now. Reviewed by: imp Exp-run by: antoine (PR 286274) Pull Request: https://github.com/freebsd/freebsd-src/pull/1595
2025-06-11Don't rely on sys/_types.h including sys/cdefs.hBrooks Davis
These headers relied in __BEGIN_DECS/__END_DECLS being defined when sys/_types.h was included, but there's not a requirement that this be the case. Reviewed by: imp Exp-run by: antoine (PR 286274) Pull Request: https://github.com/freebsd/freebsd-src/pull/1595
2025-06-03glob.h: Limit glob_b prototype visibilityBojan Novković
Hide glob_b behind __BSD_VISIBLE as it is not a POSIX function. Reported by: kib Reviewed by: kib Fixes: 1e0743f54d2d ("glob: Add blocks support") Differential Revision: https://reviews.freebsd.org/D50670
2025-06-02glob: Add blocks supportBojan Novković
This change introduces the `glob_b` function which takes a block instead of a function pointer. Relnotes: yes Sponsored by: Klara, Inc. Inspired by: https://github.com/apple-oss-distributions/Libc Differential Revision: https://reviews.freebsd.org/D50485
2025-05-31Provide user interface to retrieve reported extended errorsKonstantin Belousov
Reviewed by: brooks Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D50483
2025-05-31sysconf(3): add _SC_UEXTERR_LEN, the max length of the extended error stringKonstantin Belousov
Reviewed by: brooks Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D50483
2025-05-19libthr: add stable user interface for sigfastblock(2)Konstantin Belousov
Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D50377
2025-05-19pthread_switch_add_np(3): removeKonstantin Belousov
The interface is not functional with libthr and returns not supported error always. There is no point in providing it to userspace or document. The symbols are kept for ABI compatibility, of course. Reviewed by: emaste, markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D50376
2025-05-08fts: Add FTS_COMFOLLOWDIR and FTS_NOSTAT_TYPE.Dag-Erling Smørgrav
MFC after: never Relnotes: yes Sponsored by: Klara, Inc. Reviewed by: kevans, imp Differential Revision: https://reviews.freebsd.org/D50233
2025-05-05include/paths.h: add _PATH_NOSHUTDOWNKonstantin Belousov
Reviewed by: bapt, kevans, olce Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D50166
2025-04-27libc: Add getenv_r() function.Dag-Erling Smørgrav
This is a calque of the NetBSD function of the same name. MFC after: never Relontes: yes Sponsored by: Klara, Inc. Reviewed by: kevans Differential Revision: https://reviews.freebsd.org/D49979
2025-04-22fts: Add blocks support.Dag-Erling Smørgrav
This adds an `fts_open_b()` variant of `fts_open()` which takes a block instead of a function pointer. This was inspired by, and is intended to be compatible with, Apple's implementation; however, although our FTS and theirs share a common ancestor, they have diverged significantly. That and the fact that we still target compilers which don't support blocks means Apple's implementation was not directly reusable. This is the second use case for blocks in FreeBSD (the first being `qsort_b()`, which we use here). This suggest we might want to add a `COMPILER_FEATURE` for blocks to avoid hardcoding any further `COMPILER_TYPE` checks. MFC after: never Relnotes: yes Sponsored by: Klara, Inc. Reviewed by: kevans, theraven, imp Differential Revision: https://reviews.freebsd.org/D49877
2025-04-17Add POSIX psiginfo(3) callRicardo Branco
Signed-off-by: Ricardo Branco <rbranco@suse.de> PR: 286133 MFC after: 1 week Github PR: https://github.com/freebsd/freebsd-src/pull/1666
2025-04-10fts: Move private flags away from public ones.Dag-Erling Smørgrav
Renumber the private flags so there is a sizeable gap between them and the public flags, making it easier to add public flags in the future. These private flags are only ever set or read by FTS itself, so there is no compatibility issue. MFC after: 1 week Sponsored by: Klara, Inc. Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D49711
2025-03-20Revert Make newly POSIX functions visibleStephen Hurd
Summary: This reverts commit d7efac1be1441c122f7fb9de51a409172f21326c. This reverts commit 9d0eea9422d075c8a6924b33161d2d5abfb4072a. Some ports (specifically Python) define __BSD_VISIBLE themselves, so the change from __BSD_VISIBLE to __POSIX_VISIBLE >= 202405 makes them fail. Reported by: jrtc27, cperciva