aboutsummaryrefslogtreecommitdiff
path: root/include
Commit message (Collapse)AuthorAgeFilesLines
* sys: add renameat2(2) syscallKonstantin Belousov2026-03-051-0/+1
| | | | | | | | Reviewed by: markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D55539
* stddef.h: centralize definition of offsetof()Brooks Davis2026-02-191-4/+1
| | | | | | | | | | | | | Move to sys/_offsetof.h and use __builtin_offsetof() instead of __offsetof to avoid reintroducing sys/cdefs.h polution in stddef.h. This has the side effect of allowing sys/stddef.h to be included after stddef.h which can happen in compatability headers. Effort: CHERI upstreaming Sponsored by: DARPA, AFRL Reviewed by: imp, kib Differential Revision: https://reviews.freebsd.org/D55307
* stddef.h: add ptraddr_tBrooks Davis2026-02-191-0/+7
| | | | | | | | | | | I'd missed that stddef.h is standalone and isn't a copy of sys/stddef.h in my initial merge. Effort: CHERI upstreaming Reviewed by: kib Sponsored by: Innovate UK Fixes: dca634d1544b ("new type: ptraddr_t") Differential Revision: https://reviews.freebsd.org/D55305
* libc: improve include usage for exterror sourcesKonstantin Belousov2026-02-181-2/+1
| | | | | | | | | | | Include sys/types.h by exterr.h, since size_t is used. Drop include of sys/exterr_cat.h, it is useless for the only prototype provided. Reviewed by: mckusick Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D55337
* rpc: correct resultproc_t's typeBrooks Davis2026-02-021-1/+2
| | | | | | | | | | | | It takes exactly three arguments of known type. Tweak the types of various resultproc_t functions to match the type (mostly added const to struct pointers) allowing us to drop casts. Effort: CHERI upstreaming Reviewed by: vangyzen, glebius Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D54941
* clnt_broadcast(3): fix eachresult argument typeBrooks Davis2026-02-021-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | The `eachresult` argument is documented to take a function pointer of type: bool_t (*)(caddr_t, struct sockaddr_in *) It was declared to take a resultproc_t which has historically been declared to be: bool_t (*resultproc_t)(caddr_t, ...); This overlapped well enough for currently supported ABIs where variadic arguments are passed in registers, but this declaration is misaligned with the documentation (resultproc_t takes three arguments) and will be fixed in a followup commit. Fix the type to be non-variadic, matching callbacks, and define a convenience type of as most callbacks take something other than a char * as their first argument and need to be cast. Effort: CHERI upstreaming Reviewed by: ngie, glebius, jhb Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D54940
* libc: add posix_spawnattr_{get,set}procdescp_npKonstantin Belousov2026-01-261-0/+4
| | | | | | | Reviewed by: asomers Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D54879
* libc: add posix_spawnattr_{get,set}execfd_np(3)Konstantin Belousov2026-01-251-0/+7
| | | | | | | | | | If execfd is set, the fexecve(2) is used by posix_spawn() instead of the provided path. Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D54862
* rpc/xdr.h: make xdrproc_t always take two argumentsBrooks Davis2026-01-231-8/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The type of xdrproc_t is clearly defined in the comments as a function with two arguments, an XDR * and a void * (sometimes spelled caddr_t). It was initialy defined as: typedef bool_t (*xdrproc_t)(); At some point people started giving it a non-empty argument list. Unfortunatly, there has been widespread disagreement about how arguments are passed. There seems to have been a widespread view that it should be allowed to pass three argument function pointer to xdrproc_t. Most notable is xdr_string which takes a maximum length parameter. This lead to all sorts of prototypes (all of which have been present in the FreeBSD source tree): FreeBSD userspace (nominally from tirpc, but seemingly local): typedef bool_t (*xdrproc_t)(XDR *, ...); FreeBSD kernel, glibc: typedef bool_t (*xdrproc_t)(XDR *, void *, ...); rcp/xdr.h with _KERNEL defined (not used?): typedef bool_t (*xdrproc_t)(XDR *, void *, u_int); gssrpc (in krb5) and Linux kernel: typedef bool_t (*xdrproc_t)(XDR *, void *); For two argument functions on current ABIs, these all equivalent as these arguments are passed in registers regardless of decleration and definition, but we end up with two problems: - xdr_free((xdrproc_t)xdr_string, ...) calls xdr_string with no third argument and (at least on FreeBSD) may fail to free memory if the string is shorter than the value lying around in the third argument register. There are no instance of this in tree, but I found some with Debian code search, in particular in OpenAFS. - Under CheriABI, variadic arguments are passed in a separate, bounded array so theses prototypes aren't equilvalent to the non-variadic calling convention of the functions. The reality is that that xdr_string should not be cast to xdrproc_t and xdr_wrapstring should be used instead so we do not need to support this case. Instances of the former behavior are now extremely rare. With this change we bring FreeBSD in line with gssrpc and the Linux Kernel. Warnings about casts should now be correct and should be fixed. Bump __FreeBSD_version as some software required adaptation if it is declaring functions to cast to xdrproc_t. Update OpenZFS's workaround of this historic mess accordingly. Effort: CHERI upstreaming Sponsored by: Innovate UK Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D54824
* libthr: add pthread_tryjoin_np()Konstantin Belousov2026-01-191-0/+1
| | | | | | | | | Similar to the same glibc function. Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D54766
* libc/stdlib: Port strtonumx() from IllumosHans Rosenfeld2026-01-151-0/+2
| | | | | | | | | | | 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
* Makefile*: remove powerpcspeMinsoo Choo2026-01-091-1/+1
| | | | | | | | | | | | 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
* stdbool.h: Update for C23Minsoo Choo2026-01-071-2/+6
| | | | | | | | 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
* libc: add glibc-compatible tdestroy(3)Konstantin Belousov2025-12-291-0/+1
| | | | | | | | | | | 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
* Add sys/_align.h replacing machine/_align.hBrooks Davis2025-12-101-2/+1
| | | | | | | | | | | | | | | | 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
* libc/string: add strdupa(3) and strndupa(3)Konstantin Belousov2025-12-081-0/+28
| | | | | | | Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D54066
* Revert "stddef.h: add unreachable() for C23 compliance"Robert Clausecker2025-12-041-4/+0
| | | | | | | | | | | | 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.
* libc: implement C23 <stdbit.h> functionsRobert Clausecker2025-11-302-2/+126
| | | | | | | | | | | | | | 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
* stddef.h: add unreachable() for C23 complianceRobert Clausecker2025-11-281-0/+4
| | | | | | | | | | 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
* uchar.h: add char8_tRobert Clausecker2025-11-281-0/+5
| | | | | | | | | | | | 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
* time.h: add timegm() to the C23 namespaceRobert Clausecker2025-11-281-1/+1
| | | | | | | | | | | 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
* Use ZFSTOP more broadlyJohn Baldwin2025-11-241-1/+1
| | | | | | Reviewed by: brooks Obtained from: CheriBSD Differential Revision: https://reviews.freebsd.org/D53791
* lib/libc: implement C23 memalignment()Robert Clausecker2025-11-121-0/+8
| | | | | | | | | | | | | | | | | | 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
* include/stdckdint.h: make the header compatible with C++Konstantin Belousov2025-10-171-3/+3
| | | | | | | | | | | | | | | | 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
* libc/resolv: get rid of MD5Robert Clausecker2025-10-041-3/+1
| | | | | | | | | | | | | 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
* lib/libc: add recallocarray()Robert Clausecker2025-10-031-0/+2
| | | | | | | | | | | | 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
* libbsm: Rename package to audit-libLexi Winter2025-09-301-2/+2
| | | | | | | | | | 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
* tzcode: Expose and document offtime() and offtime_r()Dag-Erling Smørgrav2025-09-231-0/+2
| | | | | | | | | 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
* Revert "libc: Remove readdir_r(3)"Dag-Erling Smørgrav2025-09-111-0/+4
| | | | This reverts commit d549de769055ae6116601e54e4c86dfb3e17f4c4.
* libc: Remove readdir_r(3)Dag-Erling Smørgrav2025-09-101-4/+0
| | | | | | | | | | | 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
* Remove MK_GSSAPILexi Winter2025-08-201-1/+1
| | | | | | | | | | | | | | | 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
* Revert "Remove Secure RPC DES authentication"Lexi Winter2025-08-151-1/+78
| | | | | | This reverts commit 7ac276298b72982189ac1a5b17461936dc00163e. Requested by: kib
* Remove Secure RPC DES authenticationLexi Winter2025-08-101-78/+1
| | | | | | | | | | | | | | | | | | | 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
* gssapi,krb5: Replace libgssapi with the MIT versionCy Schubert2025-08-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | 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
* libc: Deprecate readdir_r()Dag-Erling Smørgrav2025-08-011-1/+2
| | | | | | | | | | 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
* rpc.h: Remove reference to unimplemented DES ioctlsEd Maste2025-07-231-20/+0
| | | | | | | We won't be adding support for hardware DES. Remove the #ifdef notdef block. Sponsored by: The FreeBSD Foundation
* libc: Rename fscandir{,_b}() to fdscandir{,_b}().Dag-Erling Smørgrav2025-06-231-2/+2
| | | | | | | | | | | | | 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
* libc: Add fscandir(), fscandir_b(), scandirat_b().Dag-Erling Smørgrav2025-06-201-0/+13
| | | | | | | | | 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
* arm64: lib32: Don't try to install removed <machine/runq.h>Olivier Certner2025-06-181-1/+0
| | | | | | | | 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
* ssp: Protect sig2str with proper visibility markersWarner Losh2025-06-121-0/+2
| | | | | | | | | | 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
* include: ssp: fortify <signal.h>Ricardo Branco2025-06-113-1/+55
| | | | | | | | 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
* Add the POSIX sig2str(3) & str2sig(3) callsRicardo Branco2025-06-111-0/+9
| | | | | | Signed-off-by: Ricardo Branco <rbranco@suse.de> Reviewed by: imp, kib, des, jilles Pull Request: https://github.com/freebsd/freebsd-src/pull/1696
* Add POSIX NSIG_MAX & _SC_NSIGRicardo Branco2025-06-112-0/+5
| | | | | | | 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
* Add sys/stdarg.hBrooks Davis2025-06-111-2/+2
| | | | | | | | | | | | | 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
* sys/_stdarg.h: drop cdefs.h and _types.h polutionBrooks Davis2025-06-112-2/+2
| | | | | | | | | 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
* stddef.h: don't include sys/cdefs.hBrooks Davis2025-06-111-2/+4
| | | | | | | | | | | | | | | | | | | 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
* Don't rely on sys/_types.h including sys/cdefs.hBrooks Davis2025-06-111-0/+1
| | | | | | | | | | 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
* glob.h: Limit glob_b prototype visibilityBojan Novković2025-06-031-1/+1
| | | | | | | | | 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
* glob: Add blocks supportBojan Novković2025-06-021-2/+14
| | | | | | | | | | 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
* Provide user interface to retrieve reported extended errorsKonstantin Belousov2025-05-312-1/+23
| | | | | | | Reviewed by: brooks Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D50483