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
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
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 b381d09802.
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
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
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
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: 59677aecb6
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D53951
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
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
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
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
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
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
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
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
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.
73ed0c7992 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 7e35117eb0.
Fixes: 7e35117eb0, 73ed0c7992
Differential Revision: https://reviews.freebsd.org/D51661
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
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: deeebfdeca
Sponsored by: Klara, Inc.
Reviewed by: kevans
Differential Revision: https://reviews.freebsd.org/D50980
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
We only define SIG2STR_MAX with careful visibility, but define the
fortified version unconditionally. It needs to have the same visibility
both places.
Fixes: 3d12567133
Reviewed by: jrtc27, kevans
Sponsored by: Netflix
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
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
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
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
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
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
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
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
Summary:
This reverts commit d7efac1be1.
This reverts commit 9d0eea9422.
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