aboutsummaryrefslogtreecommitdiff
path: root/lib/libc/include/libc_private.h
diff options
context:
space:
mode:
authorBrooks Davis <brooks@FreeBSD.org>2024-04-16 16:48:08 +0000
committerBrooks Davis <brooks@FreeBSD.org>2024-04-16 16:48:08 +0000
commit7dd9070e4425a1c2e2418694fd632425a283d558 (patch)
tree9daed2966241b87920e4c23347acb7dfa1af9f57 /lib/libc/include/libc_private.h
parent792081a7300ecf368a1cf6a2f8ddb198d86abe55 (diff)
downloadsrc-7dd9070e4425a1c2e2418694fd632425a283d558.tar.gz
src-7dd9070e4425a1c2e2418694fd632425a283d558.zip
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
Diffstat (limited to 'lib/libc/include/libc_private.h')
-rw-r--r--lib/libc/include/libc_private.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/libc/include/libc_private.h b/lib/libc/include/libc_private.h
index b38603b59a88..73b22beffe88 100644
--- a/lib/libc/include/libc_private.h
+++ b/lib/libc/include/libc_private.h
@@ -252,6 +252,12 @@ enum {
INTERPOS_MAX
};
+#define _INTERPOS_SYS(type, idx, ...) \
+ ((type *)*(__libc_interposing_slot(idx)))(__VA_ARGS__)
+#define INTERPOS_SYS(syscall, ...) \
+ _INTERPOS_SYS(__sys_## syscall ##_t, INTERPOS_## syscall \
+ __VA_OPT__(,) __VA_ARGS__)
+
/*
* yplib internal interfaces
*/