mirror_zfs/lib/libspl/include/sys
Rob Norris 4d451bae8a libspl: hide global data objects
Currently libspl is a static archive that is linked into multiple shared
objects, which then re-export its symbols. We intend to fix this soon.

For the moment though, most programs shipped with OpenZFS depend on two
or more of these shared objects, and see the same symbols twice. For
functions this is not a problem, as they do not have any mutable state
and so the linker can simply select the first one and use that for all.

For global data objects however, each shared object will have direct
(non-relocatable) references to its own instance of the symbol, such
that changes on one will not necessarily be seen by the other. While
this shouldn't be a problem in practice as these reexported interfaces
are not supposed to be used, they are technically undefined behaviour in
C (C17 6.9.2) and are reported by ASAN as a violation of C++'s "One
Definition Rule".

To fix this, we hide these globals inside their compilation units, and
add access functions and macros as appropriate to preserve the existing
API (though not ABI).

Sponsored-by: https://despairlabs.com/sponsor/
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Rob Norris <robn@despairlabs.com>
Closes #17861
2025-11-12 10:04:22 -08:00
..
dktp SPDX: license tags: CDDL-1.0 2025-03-13 17:56:27 -07:00
acl_impl.h SPDX: license tags: CDDL-1.0 2025-03-13 17:56:27 -07:00
acl.h zfs_context: remove duplicated access control stuff; remove kernel gate 2025-11-12 10:00:52 -08:00
asm_linkage.h SPDX: license tags: CDDL-1.0 2025-03-13 17:56:27 -07:00
backtrace.h SPDX: license tags: CDDL-1.0 2025-03-13 17:56:27 -07:00
callb.h libspl: move callb stubs from zfs_context.h 2025-11-12 10:01:44 -08:00
cmn_err.h libspl: move cmn_err definitions from zfs_context.h 2025-11-12 09:59:09 -08:00
condvar.h libspl: move condvar definitions from zfs_context.h 2025-11-12 09:58:59 -08:00
cred.h libspl: move cred definitions from zfs_context.h 2025-11-12 09:59:51 -08:00
debug.h zfs_context: move empty __init/__exit macros to sys/debug.h 2025-11-12 10:02:42 -08:00
dkio.h SPDX: license tags: CDDL-1.0 2025-03-13 17:56:27 -07:00
dklabel.h SPDX: license tags: CDDL-1.0 2025-03-13 17:56:27 -07:00
feature_tests.h SPDX: license tags: CDDL-1.0 2025-03-13 17:56:27 -07:00
inttypes.h SPDX: license tags: CDDL-1.0 2025-03-13 17:56:27 -07:00
isa_defs.h SPDX: license tags: CDDL-1.0 2025-03-13 17:56:27 -07:00
kmem.h libspl: move kmem definitions from zfs_context.h 2025-11-12 10:00:17 -08:00
kstat.h libspl: move kstat definitions from zfs_context.h, slim down to basics 2025-11-12 10:00:03 -08:00
list_impl.h SPDX: license tags: CDDL-1.0 2025-03-13 17:56:27 -07:00
list.h SPDX: license tags: CDDL-1.0 2025-03-13 17:56:27 -07:00
mhd.h SPDX: license tags: CDDL-1.0 2025-03-13 17:56:27 -07:00
misc.h libspl: hide global data objects 2025-11-12 10:04:22 -08:00
mkdev.h SPDX: license tags: CDDL-1.0 2025-03-13 17:56:27 -07:00
mod.h libspl: implement ZFS_MODULE_PARAM for userspace 2025-07-15 15:46:51 -07:00
mutex.h libspl: move mutex headers from zfs_context.h 2025-11-12 09:58:37 -08:00
policy.h SPDX: license tags: CDDL-1.0 2025-03-13 17:56:27 -07:00
poll.h SPDX: license tags: CDDL-1.0 2025-03-13 17:56:27 -07:00
priv.h SPDX: license tags: CDDL-1.0 2025-03-13 17:56:27 -07:00
processor.h SPDX: license tags: CDDL-1.0 2025-03-13 17:56:27 -07:00
procfs_list.h libspl: move procfs_list definitions from zfs_context.h 2025-11-12 10:00:10 -08:00
random.h libspl: move random definitions from zfs_context.h 2025-11-12 10:01:32 -08:00
rwlock.h libspl: move rwlock definitions from zfs_context.h 2025-11-12 09:58:50 -08:00
sid.h libspl: move SID definitions from zfs_context.h; remove kernel gate 2025-11-12 10:01:48 -08:00
simd.h Backport AVX2 AES-GCM implementation from BoringSSL 2025-08-13 14:51:20 -07:00
stack.h SPDX: license tags: CDDL-1.0 2025-03-13 17:56:27 -07:00
stdtypes.h SPDX: license tags: CDDL-1.0 2025-03-13 17:56:27 -07:00
string.h libspl: add include guards for sys/string.h 2025-11-12 10:00:41 -08:00
sunddi.h libspl: move remaining ddi_* prototypes from zfs_context.h 2025-11-12 10:02:12 -08:00
sysmacros.h libspl: common sysmacros.h 2025-11-12 10:02:25 -08:00
systeminfo.h SPDX: license tags: CDDL-1.0 2025-03-13 17:56:27 -07:00
systm.h libspl: hide global data objects 2025-11-12 10:04:22 -08:00
taskq.h libspl: hide global data objects 2025-11-12 10:04:22 -08:00
thread.h libspl: hide global data objects 2025-11-12 10:04:22 -08:00
time.h Detect a slow raidz child during reads 2025-09-10 15:25:03 -07:00
timer.h libspl: move time definitions from zfs_context_os.h 2025-11-12 09:58:31 -08:00
trace.h libspl: move DTRACE_PROBE macros from zfs_context.h 2025-11-12 10:02:20 -08:00
tsd.h libspl: move tsd definitions from zfs_context.h 2025-11-12 09:59:59 -08:00
tunables.h libspl: hide zfs_tunable_* symbols 2025-11-12 09:38:54 -08:00
types32.h SPDX: license tags: CDDL-1.0 2025-03-13 17:56:27 -07:00
types.h libspl: move loff_t declaration from zfs_context.h 2025-11-12 10:02:46 -08:00
uio.h Add missing include statement 2025-10-07 09:21:03 -07:00
vnode.h libspl: move vattr and xvattr definitions from zfs_context.h 2025-11-12 10:00:24 -08:00
wmsum.h SPDX: license tags: CDDL-1.0 2025-03-13 17:56:27 -07:00
zone.h libspl: move zone definitions from zfs_context.h 2025-11-12 10:02:00 -08:00