git: ef5fddd3440c - main - libsys: make __libsys_interposing static

From: Brooks Davis <brooks_at_FreeBSD.org>
Date: Wed, 13 Mar 2024 18:36:33 UTC
The branch main has been updated by brooks:

URL: https://cgit.FreeBSD.org/src/commit/?id=ef5fddd3440cc726db2acb85ca55fdc9c996ea64

commit ef5fddd3440cc726db2acb85ca55fdc9c996ea64
Author:     Brooks Davis <brooks@FreeBSD.org>
AuthorDate: 2024-03-13 17:31:48 +0000
Commit:     Brooks Davis <brooks@FreeBSD.org>
CommitDate: 2024-03-13 17:31:48 +0000

    libsys: make __libsys_interposing static
    
    Access __libsys_interposing with __libc_interposing_slot() in all
    cases to support a move of these wrappers back to libc.
    
    Reviewed by:    kib
    Differential Revision:  https://reviews.freebsd.org/D44239
---
 lib/libc/gen/libc_interposing_table.c | 1 -
 lib/libc/gen/sleep.c                  | 2 +-
 lib/libc/gen/usleep.c                 | 2 +-
 lib/libc/include/libc_private.h       | 1 -
 lib/libsys/accept.c                   | 2 +-
 lib/libsys/accept4.c                  | 3 ++-
 lib/libsys/aio_suspend.c              | 3 ++-
 lib/libsys/clock_nanosleep.c          | 4 ++--
 lib/libsys/close.c                    | 2 +-
 lib/libsys/connect.c                  | 2 +-
 lib/libsys/creat.c                    | 4 ++--
 lib/libsys/fcntl.c                    | 2 +-
 lib/libsys/fdatasync.c                | 3 ++-
 lib/libsys/fork.c                     | 2 +-
 lib/libsys/fsync.c                    | 2 +-
 lib/libsys/interposing_table.c        | 2 +-
 lib/libsys/kevent.c                   | 4 ++--
 lib/libsys/lockf.c                    | 6 +++---
 lib/libsys/msync.c                    | 2 +-
 lib/libsys/nanosleep.c                | 2 +-
 lib/libsys/open.c                     | 4 ++--
 lib/libsys/openat.c                   | 3 ++-
 lib/libsys/pdfork.c                   | 3 ++-
 lib/libsys/poll.c                     | 2 +-
 lib/libsys/ppoll.c                    | 4 ++--
 lib/libsys/pselect.c                  | 2 +-
 lib/libsys/read.c                     | 2 +-
 lib/libsys/readv.c                    | 2 +-
 lib/libsys/recv.c                     | 4 ++--
 lib/libsys/recvfrom.c                 | 4 ++--
 lib/libsys/recvmsg.c                  | 2 +-
 lib/libsys/select.c                   | 2 +-
 lib/libsys/send.c                     | 2 +-
 lib/libsys/sendmsg.c                  | 2 +-
 lib/libsys/sendto.c                   | 4 ++--
 lib/libsys/setcontext.c               | 2 +-
 lib/libsys/sigaction.c                | 2 +-
 lib/libsys/sigprocmask.c              | 2 +-
 lib/libsys/sigsuspend.c               | 2 +-
 lib/libsys/sigtimedwait.c             | 2 +-
 lib/libsys/sigwait.c                  | 2 +-
 lib/libsys/sigwaitinfo.c              | 2 +-
 lib/libsys/swapcontext.c              | 2 +-
 lib/libsys/wait.c                     | 3 ++-
 lib/libsys/wait3.c                    | 4 ++--
 lib/libsys/wait4.c                    | 3 ++-
 lib/libsys/wait6.c                    | 4 ++--
 lib/libsys/waitid.c                   | 4 ++--
 lib/libsys/waitpid.c                  | 3 ++-
 lib/libsys/write.c                    | 2 +-
 lib/libsys/writev.c                   | 2 +-
 51 files changed, 70 insertions(+), 64 deletions(-)

diff --git a/lib/libc/gen/libc_interposing_table.c b/lib/libc/gen/libc_interposing_table.c
index 6997dce86569..d15d32711910 100644
--- a/lib/libc/gen/libc_interposing_table.c
+++ b/lib/libc/gen/libc_interposing_table.c
@@ -49,7 +49,6 @@ interpos_func_t __libc_interposing[INTERPOS_MAX] = {
 interpos_func_t *
 __libc_interposing_slot(int interposno)
 {
-	/* XXX: forward compat. Remove after 15.0-RELEASE. */
 	if (__libc_interposing[interposno] == NULL)
 		return (__libsys_interposing_slot(interposno));
 	return (&__libc_interposing[interposno]);
diff --git a/lib/libc/gen/sleep.c b/lib/libc/gen/sleep.c
index 46a7dcc4dbca..7b6e80353c6e 100644
--- a/lib/libc/gen/sleep.c
+++ b/lib/libc/gen/sleep.c
@@ -56,7 +56,7 @@ __sleep(unsigned int seconds)
 	time_to_sleep.tv_sec = seconds;
 	time_to_sleep.tv_nsec = 0;
 	if (((int (*)(const struct timespec *, struct timespec *))
-	    (*__libsys_interposing_slot(INTERPOS_nanosleep)))(
+	    (*__libc_interposing_slot(INTERPOS_nanosleep)))(
 	    &time_to_sleep, &time_remaining) != -1)
 		return (0);
 	if (errno != EINTR)
diff --git a/lib/libc/gen/usleep.c b/lib/libc/gen/usleep.c
index e312e55c6541..f58d81d978e3 100644
--- a/lib/libc/gen/usleep.c
+++ b/lib/libc/gen/usleep.c
@@ -46,7 +46,7 @@ __usleep(useconds_t useconds)
 	time_to_sleep.tv_nsec = (useconds % 1000000) * 1000;
 	time_to_sleep.tv_sec = useconds / 1000000;
 	return (((int (*)(const struct timespec *, struct timespec *))
-	    (*__libsys_interposing_slot(INTERPOS_nanosleep)))(&time_to_sleep,
+	    (*__libc_interposing_slot(INTERPOS_nanosleep)))(&time_to_sleep,
 	    NULL));
 }
 
diff --git a/lib/libc/include/libc_private.h b/lib/libc/include/libc_private.h
index 6a6de5b5645d..b3f31f6e4e87 100644
--- a/lib/libc/include/libc_private.h
+++ b/lib/libc/include/libc_private.h
@@ -201,7 +201,6 @@ typedef int (*interpos_func_t)(void);
 interpos_func_t *__libc_interposing_slot(int interposno);
 extern interpos_func_t __libc_interposing[] __hidden;
 interpos_func_t *__libsys_interposing_slot(int interposno);
-extern interpos_func_t __libsys_interposing[] __hidden;
 
 enum {
 	INTERPOS_accept,
diff --git a/lib/libsys/accept.c b/lib/libsys/accept.c
index 974d26eeaa6b..609cb31b140e 100644
--- a/lib/libsys/accept.c
+++ b/lib/libsys/accept.c
@@ -41,5 +41,5 @@ int
 accept(int s, struct sockaddr *addr, socklen_t *addrlen)
 {
 	return (((int (*)(int, struct sockaddr *, socklen_t *))
-	    __libsys_interposing[INTERPOS_accept])(s, addr, addrlen));
+	    *(__libc_interposing_slot(INTERPOS_accept)))(s, addr, addrlen));
 }
diff --git a/lib/libsys/accept4.c b/lib/libsys/accept4.c
index d69e843e28e6..c789d0a63250 100644
--- a/lib/libsys/accept4.c
+++ b/lib/libsys/accept4.c
@@ -41,5 +41,6 @@ int
 accept4(int s, struct sockaddr *addr, socklen_t *addrlen, int flags)
 {
 	return (((int (*)(int, struct sockaddr *, socklen_t *, int))
-	    __libsys_interposing[INTERPOS_accept4])(s, addr, addrlen, flags));
+	    *(__libc_interposing_slot(INTERPOS_accept4)))
+	    (s, addr, addrlen, flags));
 }
diff --git a/lib/libsys/aio_suspend.c b/lib/libsys/aio_suspend.c
index 41872fbdd049..499d2a349c3c 100644
--- a/lib/libsys/aio_suspend.c
+++ b/lib/libsys/aio_suspend.c
@@ -42,5 +42,6 @@ aio_suspend(const struct aiocb * const iocbs[], int niocb,
 {
 	return (((int (*)(const struct aiocb * const[], int,
 	    const struct timespec *))
-	    __libsys_interposing[INTERPOS_aio_suspend])(iocbs, niocb, timeout));
+	    *(__libc_interposing_slot(INTERPOS_aio_suspend)))
+	    (iocbs, niocb, timeout));
 }
diff --git a/lib/libsys/clock_nanosleep.c b/lib/libsys/clock_nanosleep.c
index 58d76243f42c..ad996220d19f 100644
--- a/lib/libsys/clock_nanosleep.c
+++ b/lib/libsys/clock_nanosleep.c
@@ -43,6 +43,6 @@ clock_nanosleep(clockid_t clock_id, int flags, const struct timespec *rqtp,
 {
 	return (((int (*)(clockid_t, int, const struct timespec *,
 	    struct timespec *))
-	    __libsys_interposing[INTERPOS_clock_nanosleep])(clock_id, flags,
-	    rqtp, rmtp));
+	    *(__libc_interposing_slot(INTERPOS_clock_nanosleep)))
+	    (clock_id, flags, rqtp, rmtp));
 }
diff --git a/lib/libsys/close.c b/lib/libsys/close.c
index 923339f06e71..5017f6e3d745 100644
--- a/lib/libsys/close.c
+++ b/lib/libsys/close.c
@@ -40,5 +40,5 @@ __weak_reference(__sys_close, __close);
 int
 close(int fd)
 {
-	return (((int (*)(int))__libsys_interposing[INTERPOS_close])(fd));
+	return (((int (*)(int))*(__libc_interposing_slot(INTERPOS_close)))(fd));
 }
diff --git a/lib/libsys/connect.c b/lib/libsys/connect.c
index c908ec5dc493..70fc4682b06d 100644
--- a/lib/libsys/connect.c
+++ b/lib/libsys/connect.c
@@ -41,5 +41,5 @@ int
 connect(int s, const struct sockaddr *addr, socklen_t addrlen)
 {
 	return (((int (*)(int, const struct sockaddr *, socklen_t))
-	    __libsys_interposing[INTERPOS_connect])(s, addr, addrlen));
+	    *(__libc_interposing_slot(INTERPOS_connect)))(s, addr, addrlen));
 }
diff --git a/lib/libsys/creat.c b/lib/libsys/creat.c
index 9bc1db19de1d..bcb750e93d38 100644
--- a/lib/libsys/creat.c
+++ b/lib/libsys/creat.c
@@ -44,7 +44,7 @@ int
 __creat(const char *path, mode_t mode)
 {
 	return (((int (*)(int, const char *, int, ...))
-	    __libsys_interposing[INTERPOS_openat])(AT_FDCWD, path, O_WRONLY |
-	    O_CREAT | O_TRUNC, mode));
+	    *(__libc_interposing_slot(INTERPOS_openat)))
+	    (AT_FDCWD, path, O_WRONLY | O_CREAT | O_TRUNC, mode));
 }
 
diff --git a/lib/libsys/fcntl.c b/lib/libsys/fcntl.c
index 52e041003b4d..308d144a4426 100644
--- a/lib/libsys/fcntl.c
+++ b/lib/libsys/fcntl.c
@@ -50,5 +50,5 @@ fcntl(int fd, int cmd, ...)
 	va_end(args);
 
 	return (((int (*)(int, int, ...))
-	    __libsys_interposing[INTERPOS_fcntl])(fd, cmd, arg));
+	    *(__libc_interposing_slot(INTERPOS_fcntl)))(fd, cmd, arg));
 }
diff --git a/lib/libsys/fdatasync.c b/lib/libsys/fdatasync.c
index dc6927eae324..2dd81ec1a215 100644
--- a/lib/libsys/fdatasync.c
+++ b/lib/libsys/fdatasync.c
@@ -37,5 +37,6 @@
 int
 fdatasync(int fd)
 {
-	return (((int (*)(int))__libsys_interposing[INTERPOS_fdatasync])(fd));
+	return (((int (*)(int))*(__libc_interposing_slot(INTERPOS_fdatasync)))
+	    (fd));
 }
diff --git a/lib/libsys/fork.c b/lib/libsys/fork.c
index 4feecb355a56..1c70c2587c32 100644
--- a/lib/libsys/fork.c
+++ b/lib/libsys/fork.c
@@ -39,5 +39,5 @@ __weak_reference(__sys_fork, __fork);
 pid_t
 fork(void)
 {
-	return (((pid_t (*)(void))__libsys_interposing[INTERPOS_fork])());
+	return (((pid_t (*)(void))*(__libc_interposing_slot(INTERPOS_fork)))());
 }
diff --git a/lib/libsys/fsync.c b/lib/libsys/fsync.c
index 92e3ae89bccc..aa33bbdf69e7 100644
--- a/lib/libsys/fsync.c
+++ b/lib/libsys/fsync.c
@@ -39,5 +39,5 @@ __weak_reference(__sys_fsync, __fsync);
 int
 fsync(int fd)
 {
-	return (((int (*)(int))__libsys_interposing[INTERPOS_fsync])(fd));
+	return (((int (*)(int))*(__libc_interposing_slot(INTERPOS_fsync)))(fd));
 }
diff --git a/lib/libsys/interposing_table.c b/lib/libsys/interposing_table.c
index e285def70fad..31cdb1511ab8 100644
--- a/lib/libsys/interposing_table.c
+++ b/lib/libsys/interposing_table.c
@@ -34,7 +34,7 @@
 
 #define	SLOT(a, b) \
 	[INTERPOS_##a] = (interpos_func_t)b
-interpos_func_t __libsys_interposing[INTERPOS_MAX] = {
+static interpos_func_t __libsys_interposing[INTERPOS_MAX] = {
 	SLOT(accept, __sys_accept),
 	SLOT(accept4, __sys_accept4),
 	SLOT(aio_suspend, __sys_aio_suspend),
diff --git a/lib/libsys/kevent.c b/lib/libsys/kevent.c
index 4be825e5c078..e81bcabc568a 100644
--- a/lib/libsys/kevent.c
+++ b/lib/libsys/kevent.c
@@ -43,6 +43,6 @@ kevent(int kq, const struct kevent *changelist, int nchanges,
 {
 	return (((int (*)(int, const struct kevent *, int,
 	    struct kevent *, int, const struct timespec *))
-	    __libsys_interposing[INTERPOS_kevent])(kq, changelist, nchanges,
-	   eventlist, nevents, timeout));
+	    *(__libc_interposing_slot(INTERPOS_kevent)))
+	    (kq, changelist, nchanges, eventlist, nevents, timeout));
 }
diff --git a/lib/libsys/lockf.c b/lib/libsys/lockf.c
index bb98ebc1be82..3701cebbc190 100644
--- a/lib/libsys/lockf.c
+++ b/lib/libsys/lockf.c
@@ -63,8 +63,8 @@ lockf(int filedes, int function, off_t size)
 	case F_TEST:
 		fl.l_type = F_WRLCK;
 		if (((int (*)(int, int, ...))
-		    __libsys_interposing[INTERPOS_fcntl])(filedes, F_GETLK, &fl)
-		    == -1)
+		    *(__libc_interposing_slot(INTERPOS_fcntl)))
+		    (filedes, F_GETLK, &fl) == -1)
 			return (-1);
 		if (fl.l_type == F_UNLCK || (fl.l_sysid == 0 &&
 		    fl.l_pid == getpid()))
@@ -79,5 +79,5 @@ lockf(int filedes, int function, off_t size)
 	}
 
 	return (((int (*)(int, int, ...))
-	    __libsys_interposing[INTERPOS_fcntl])(filedes, cmd, &fl));
+	    *(__libc_interposing_slot(INTERPOS_fcntl)))(filedes, cmd, &fl));
 }
diff --git a/lib/libsys/msync.c b/lib/libsys/msync.c
index 6836d4db265c..bda60db5c333 100644
--- a/lib/libsys/msync.c
+++ b/lib/libsys/msync.c
@@ -41,5 +41,5 @@ int
 msync(void *addr, size_t len, int flags)
 {
 	return (((int (*)(void *, size_t, int))
-	    __libsys_interposing[INTERPOS_msync])(addr, len, flags));
+	    *(__libc_interposing_slot(INTERPOS_msync)))(addr, len, flags));
 }
diff --git a/lib/libsys/nanosleep.c b/lib/libsys/nanosleep.c
index 83d54a1ca04a..daa4784363db 100644
--- a/lib/libsys/nanosleep.c
+++ b/lib/libsys/nanosleep.c
@@ -40,5 +40,5 @@ int
 nanosleep(const struct timespec *rqtp, struct timespec *rmtp)
 {
 	return (((int (*)(const struct timespec *, struct timespec *))
-	    __libsys_interposing[INTERPOS_nanosleep])(rqtp, rmtp));
+	    *(__libc_interposing_slot(INTERPOS_nanosleep)))(rqtp, rmtp));
 }
diff --git a/lib/libsys/open.c b/lib/libsys/open.c
index 0ab3e9c4501e..6ea18727c876 100644
--- a/lib/libsys/open.c
+++ b/lib/libsys/open.c
@@ -51,6 +51,6 @@ open(const char *path, int flags, ...)
 		mode = 0;
 	}
 	return (((int (*)(int, const char *, int, ...))
-	    __libsys_interposing[INTERPOS_openat])(AT_FDCWD, path, flags,
-	    mode));
+	    *(__libc_interposing_slot(INTERPOS_openat)))
+	    (AT_FDCWD, path, flags, mode));
 }
diff --git a/lib/libsys/openat.c b/lib/libsys/openat.c
index 4d8a0fc627cb..d49aafe35e62 100644
--- a/lib/libsys/openat.c
+++ b/lib/libsys/openat.c
@@ -54,5 +54,6 @@ openat(int fd, const char *path, int flags, ...)
 		mode = 0;
 	}
 	return (((int (*)(int, const char *, int, ...))
-	    __libsys_interposing[INTERPOS_openat])(fd, path, flags, mode));
+	    *(__libc_interposing_slot(INTERPOS_openat)))
+	    (fd, path, flags, mode));
 }
diff --git a/lib/libsys/pdfork.c b/lib/libsys/pdfork.c
index 12cf6d858826..6830d878b414 100644
--- a/lib/libsys/pdfork.c
+++ b/lib/libsys/pdfork.c
@@ -37,6 +37,7 @@
 pid_t
 pdfork(int *fdp, int flags)
 {
-	return (((pid_t (*)(int *, int))__libsys_interposing[INTERPOS_pdfork])
+	return (((pid_t (*)(int *, int))
+	    *(__libc_interposing_slot(INTERPOS_pdfork)))
 	    (fdp, flags));
 }
diff --git a/lib/libsys/poll.c b/lib/libsys/poll.c
index 58fbb64fdda5..93b0e1b3c8ed 100644
--- a/lib/libsys/poll.c
+++ b/lib/libsys/poll.c
@@ -40,5 +40,5 @@ int
 poll(struct pollfd pfd[], nfds_t nfds, int timeout)
 {
 	return (((int (*)(struct pollfd *, nfds_t, int))
-	    __libsys_interposing[INTERPOS_poll])(pfd, nfds, timeout));
+	    *(__libc_interposing_slot(INTERPOS_poll)))(pfd, nfds, timeout));
 }
diff --git a/lib/libsys/ppoll.c b/lib/libsys/ppoll.c
index 2ff693fc5b19..50e83975da2a 100644
--- a/lib/libsys/ppoll.c
+++ b/lib/libsys/ppoll.c
@@ -41,6 +41,6 @@ ppoll(struct pollfd pfd[], nfds_t nfds, const struct timespec *__restrict
     timeout, const sigset_t *__restrict newsigmask)
 {
 	return (((int (*)(struct pollfd *, nfds_t, const struct timespec *,
-	    const sigset_t *)) __libsys_interposing[INTERPOS_ppoll])(pfd, nfds,
-	    timeout, newsigmask));
+	    const sigset_t *))*(__libc_interposing_slot(INTERPOS_ppoll)))
+	    (pfd, nfds, timeout, newsigmask));
 }
diff --git a/lib/libsys/pselect.c b/lib/libsys/pselect.c
index dfd918b4c6d2..a7776049013f 100644
--- a/lib/libsys/pselect.c
+++ b/lib/libsys/pselect.c
@@ -42,5 +42,5 @@ pselect(int n, fd_set *rs, fd_set *ws, fd_set *es, const struct timespec *t,
 {
 	return (((int (*)(int, fd_set *, fd_set *, fd_set *,
 	    const struct timespec *, const sigset_t *))
-	    __libsys_interposing[INTERPOS_pselect])(n, rs, ws, es, t, s));
+	    *(__libc_interposing_slot(INTERPOS_pselect)))(n, rs, ws, es, t, s));
 }
diff --git a/lib/libsys/read.c b/lib/libsys/read.c
index 846e7185bc02..2b8185975a6a 100644
--- a/lib/libsys/read.c
+++ b/lib/libsys/read.c
@@ -41,5 +41,5 @@ ssize_t
 read(int fd, void *buf, size_t nbytes)
 {
 	return (((ssize_t (*)(int, void *, size_t))
-	    __libsys_interposing[INTERPOS_read])(fd, buf, nbytes));
+	    *(__libc_interposing_slot(INTERPOS_read)))(fd, buf, nbytes));
 }
diff --git a/lib/libsys/readv.c b/lib/libsys/readv.c
index 5493f7964098..62a8fa976e2b 100644
--- a/lib/libsys/readv.c
+++ b/lib/libsys/readv.c
@@ -42,5 +42,5 @@ ssize_t
 readv(int fd, const struct iovec *iov, int iovcnt)
 {
 	return (((ssize_t (*)(int, const struct iovec *, int))
-	    __libsys_interposing[INTERPOS_readv])(fd, iov, iovcnt));
+	    *(__libc_interposing_slot(INTERPOS_readv)))(fd, iov, iovcnt));
 }
diff --git a/lib/libsys/recv.c b/lib/libsys/recv.c
index db3d6216ed61..21caf2f841f6 100644
--- a/lib/libsys/recv.c
+++ b/lib/libsys/recv.c
@@ -44,6 +44,6 @@ recv(int s, void *buf, size_t len, int flags)
 	 */
 	return (((ssize_t (*)(int, void *, size_t, int,
 	    struct sockaddr *, socklen_t *))
-	    __libsys_interposing[INTERPOS_recvfrom])(s, buf, len, flags,
-	   NULL, NULL));
+	    *(__libc_interposing_slot(INTERPOS_recvfrom)))
+	    (s, buf, len, flags, NULL, NULL));
 }
diff --git a/lib/libsys/recvfrom.c b/lib/libsys/recvfrom.c
index 630b27404b7a..0bb3c4c3b719 100644
--- a/lib/libsys/recvfrom.c
+++ b/lib/libsys/recvfrom.c
@@ -43,6 +43,6 @@ recvfrom(int s, void *buf, size_t len, int flags,
 {
 	return (((ssize_t (*)(int, void *, size_t, int,
 	    struct sockaddr *, socklen_t *))
-	    __libsys_interposing[INTERPOS_recvfrom])(s, buf, len, flags,
-	   from, fromlen));
+	    *(__libc_interposing_slot(INTERPOS_recvfrom)))
+	    (s, buf, len, flags, from, fromlen));
 }
diff --git a/lib/libsys/recvmsg.c b/lib/libsys/recvmsg.c
index 69b71c54e636..c8d631ebe56e 100644
--- a/lib/libsys/recvmsg.c
+++ b/lib/libsys/recvmsg.c
@@ -41,5 +41,5 @@ ssize_t
 recvmsg(int s, struct msghdr *msg, int flags)
 {
 	return (((int (*)(int, struct msghdr *, int))
-	    __libsys_interposing[INTERPOS_recvmsg])(s, msg, flags));
+	    *(__libc_interposing_slot(INTERPOS_recvmsg)))(s, msg, flags));
 }
diff --git a/lib/libsys/select.c b/lib/libsys/select.c
index 4b5862f72100..27f4ff10a1bb 100644
--- a/lib/libsys/select.c
+++ b/lib/libsys/select.c
@@ -40,5 +40,5 @@ int
 select(int n, fd_set *rs, fd_set *ws, fd_set *es, struct timeval *t)
 {
 	return (((int (*)(int, fd_set *, fd_set *, fd_set *, struct timeval *))
-	    __libsys_interposing[INTERPOS_select])(n, rs, ws, es, t));
+	    *(__libc_interposing_slot(INTERPOS_select)))(n, rs, ws, es, t));
 }
diff --git a/lib/libsys/send.c b/lib/libsys/send.c
index 94983553b1c3..4e945f969a65 100644
--- a/lib/libsys/send.c
+++ b/lib/libsys/send.c
@@ -44,6 +44,6 @@ send(int s, const void *msg, size_t len, int flags)
 	 */
 	return (((ssize_t (*)(int, const void *, size_t, int,
 	    const struct sockaddr *, socklen_t))
-	    __libsys_interposing[INTERPOS_sendto])(s, msg, len, flags,
+	    *__libc_interposing_slot(INTERPOS_sendto))(s, msg, len, flags,
 	    NULL, 0));
 }
diff --git a/lib/libsys/sendmsg.c b/lib/libsys/sendmsg.c
index 769bb4d2d136..488e0c736801 100644
--- a/lib/libsys/sendmsg.c
+++ b/lib/libsys/sendmsg.c
@@ -41,5 +41,5 @@ ssize_t
 sendmsg(int s, const struct msghdr *msg, int flags)
 {
 	return (((int (*)(int, const struct msghdr *, int))
-	    __libsys_interposing[INTERPOS_sendmsg])(s, msg, flags));
+	    *(__libc_interposing_slot(INTERPOS_sendmsg)))(s, msg, flags));
 }
diff --git a/lib/libsys/sendto.c b/lib/libsys/sendto.c
index 60104ba2e5c7..93d336cfca11 100644
--- a/lib/libsys/sendto.c
+++ b/lib/libsys/sendto.c
@@ -43,6 +43,6 @@ sendto(int s, const void *msg, size_t len, int flags,
 {
 	return (((ssize_t (*)(int, const void *, size_t, int,
 	    const struct sockaddr *, socklen_t))
-	    __libsys_interposing[INTERPOS_sendto])(s, msg, len, flags,
-	    to, tolen));
+	    *(__libc_interposing_slot(INTERPOS_sendto)))
+	    (s, msg, len, flags, to, tolen));
 }
diff --git a/lib/libsys/setcontext.c b/lib/libsys/setcontext.c
index 734bd9c186fe..e54d4ba82395 100644
--- a/lib/libsys/setcontext.c
+++ b/lib/libsys/setcontext.c
@@ -43,5 +43,5 @@ int
 setcontext(const ucontext_t *uc)
 {
 	return (((int (*)(const ucontext_t *))
-	    __libsys_interposing[INTERPOS_setcontext])(uc));
+	    *(__libc_interposing_slot(INTERPOS_setcontext)))(uc));
 }
diff --git a/lib/libsys/sigaction.c b/lib/libsys/sigaction.c
index 4fa7b5d8699b..07593a4e540d 100644
--- a/lib/libsys/sigaction.c
+++ b/lib/libsys/sigaction.c
@@ -41,5 +41,5 @@ int
 sigaction(int sig, const struct sigaction *act, struct sigaction *oact)
 {
 	return (((int (*)(int, const struct sigaction *, struct sigaction *))
-	    __libsys_interposing[INTERPOS_sigaction])(sig, act, oact));
+	    *(__libc_interposing_slot(INTERPOS_sigaction)))(sig, act, oact));
 }
diff --git a/lib/libsys/sigprocmask.c b/lib/libsys/sigprocmask.c
index c0d86de4b156..6b20065ff6d1 100644
--- a/lib/libsys/sigprocmask.c
+++ b/lib/libsys/sigprocmask.c
@@ -41,5 +41,5 @@ int
 sigprocmask(int how, const sigset_t *set, sigset_t *oset)
 {
 	return (((int (*)(int, const sigset_t *, sigset_t *))
-	    __libsys_interposing[INTERPOS_sigprocmask])(how, set, oset));
+	    *(__libc_interposing_slot(INTERPOS_sigprocmask)))(how, set, oset));
 }
diff --git a/lib/libsys/sigsuspend.c b/lib/libsys/sigsuspend.c
index de57d645354d..32125eb846be 100644
--- a/lib/libsys/sigsuspend.c
+++ b/lib/libsys/sigsuspend.c
@@ -41,5 +41,5 @@ int
 sigsuspend(const sigset_t *set)
 {
 	return (((int (*)(const sigset_t *))
-	    __libsys_interposing[INTERPOS_sigsuspend])(set));
+	    *(__libc_interposing_slot(INTERPOS_sigsuspend)))(set));
 }
diff --git a/lib/libsys/sigtimedwait.c b/lib/libsys/sigtimedwait.c
index 0cfcbb9811bc..4b449407e754 100644
--- a/lib/libsys/sigtimedwait.c
+++ b/lib/libsys/sigtimedwait.c
@@ -42,5 +42,5 @@ sigtimedwait(const sigset_t * __restrict set, siginfo_t * __restrict info,
 {
 	return (((int (*)(const sigset_t *, siginfo_t *,
 	    const struct timespec *))
-	    __libsys_interposing[INTERPOS_sigtimedwait])(set, info, t));
+	    *(__libc_interposing_slot(INTERPOS_sigtimedwait)))(set, info, t));
 }
diff --git a/lib/libsys/sigwait.c b/lib/libsys/sigwait.c
index 412a9206b821..23c341461639 100644
--- a/lib/libsys/sigwait.c
+++ b/lib/libsys/sigwait.c
@@ -33,5 +33,5 @@ int
 sigwait(const sigset_t *set, int *sig)
 {
 	return (((int (*)(const sigset_t *, int *))
-	    __libsys_interposing[INTERPOS_sigwait])(set, sig));
+	    *(__libc_interposing_slot(INTERPOS_sigwait)))(set, sig));
 }
diff --git a/lib/libsys/sigwaitinfo.c b/lib/libsys/sigwaitinfo.c
index 277bd96a06a1..d8a0780441d1 100644
--- a/lib/libsys/sigwaitinfo.c
+++ b/lib/libsys/sigwaitinfo.c
@@ -40,5 +40,5 @@ int
 sigwaitinfo(const sigset_t * __restrict set, siginfo_t * __restrict info)
 {
 	return (((int (*)(const sigset_t *, siginfo_t *))
-	    __libsys_interposing[INTERPOS_sigwaitinfo])(set, info));
+	    *(__libc_interposing_slot(INTERPOS_sigwaitinfo)))(set, info));
 }
diff --git a/lib/libsys/swapcontext.c b/lib/libsys/swapcontext.c
index 28f7c9f769a7..0793dd838526 100644
--- a/lib/libsys/swapcontext.c
+++ b/lib/libsys/swapcontext.c
@@ -45,5 +45,5 @@ int
 swapcontext(ucontext_t *oucp, const ucontext_t *ucp)
 {
 	return (((int (*)(ucontext_t *, const ucontext_t *))
-	    __libsys_interposing[INTERPOS_swapcontext])(oucp, ucp));
+	    *(__libc_interposing_slot(INTERPOS_swapcontext)))(oucp, ucp));
 }
diff --git a/lib/libsys/wait.c b/lib/libsys/wait.c
index c400d07f9dd5..7c847a616003 100644
--- a/lib/libsys/wait.c
+++ b/lib/libsys/wait.c
@@ -44,7 +44,8 @@ pid_t
 __wait(int *istat)
 {
 	return (((pid_t (*)(pid_t, int *, int, struct rusage *))
-	    __libsys_interposing[INTERPOS_wait4])(WAIT_ANY, istat, 0, NULL));
+	    *(__libc_interposing_slot(INTERPOS_wait4)))
+	    (WAIT_ANY, istat, 0, NULL));
 }
 
 __weak_reference(__wait, wait);
diff --git a/lib/libsys/wait3.c b/lib/libsys/wait3.c
index 40baf70ac6e6..5d7d7bc22a67 100644
--- a/lib/libsys/wait3.c
+++ b/lib/libsys/wait3.c
@@ -44,8 +44,8 @@ pid_t
 __wait3(int *istat, int options, struct rusage *rup)
 {
 	return (((pid_t (*)(pid_t, int *, int, struct rusage *))
-	    __libsys_interposing[INTERPOS_wait4])(WAIT_ANY, istat, options,
-	    rup));
+	    *(__libc_interposing_slot(INTERPOS_wait4)))
+	    (WAIT_ANY, istat, options, rup));
 }
 
 __weak_reference(__wait3, wait3);
diff --git a/lib/libsys/wait4.c b/lib/libsys/wait4.c
index bbd866a8bb16..eab2e9b6e2c0 100644
--- a/lib/libsys/wait4.c
+++ b/lib/libsys/wait4.c
@@ -40,5 +40,6 @@ pid_t
 wait4(pid_t pid, int *status, int options, struct rusage *ru)
 {
 	return (((pid_t (*)(pid_t, int *, int, struct rusage *))
-	    __libsys_interposing[INTERPOS_wait4])(pid, status, options, ru));
+	    *(__libc_interposing_slot(INTERPOS_wait4)))
+	    (pid, status, options, ru));
 }
diff --git a/lib/libsys/wait6.c b/lib/libsys/wait6.c
index eab11d4a6212..eff40eae3b76 100644
--- a/lib/libsys/wait6.c
+++ b/lib/libsys/wait6.c
@@ -42,6 +42,6 @@ wait6(idtype_t idtype, id_t id, int *status, int options, struct __wrusage *ru,
     siginfo_t *infop)
 {
 	return (((pid_t (*)(idtype_t, id_t, int *, int, struct __wrusage *,
-	    siginfo_t *))__libsys_interposing[INTERPOS_wait6])(idtype, id,
-	    status, options, ru, infop));
+	    siginfo_t *))*(__libc_interposing_slot(INTERPOS_wait6)))
+	    (idtype, id, status, options, ru, infop));
 }
diff --git a/lib/libsys/waitid.c b/lib/libsys/waitid.c
index b6e5ca33eed3..f885e8f55912 100644
--- a/lib/libsys/waitid.c
+++ b/lib/libsys/waitid.c
@@ -47,8 +47,8 @@ __waitid(idtype_t idtype, id_t id, siginfo_t *info, int flags)
 	pid_t ret;
 
 	ret = ((pid_t (*)(idtype_t, id_t, int *, int, struct __wrusage *,
-	    siginfo_t *))__libsys_interposing[INTERPOS_wait6])(idtype, id,
-	    &status, flags, NULL, info);
+	    siginfo_t *))*(__libc_interposing_slot(INTERPOS_wait6)))
+	    (idtype, id, &status, flags, NULL, info);
 
 	/*
 	 * According to SUSv4, waitid() shall not return a PID when a
diff --git a/lib/libsys/waitpid.c b/lib/libsys/waitpid.c
index ba7e667218cf..971c598d6a93 100644
--- a/lib/libsys/waitpid.c
+++ b/lib/libsys/waitpid.c
@@ -44,7 +44,8 @@ pid_t
 __waitpid(pid_t pid, int *istat, int options)
 {
 	return (((pid_t (*)(pid_t, int *, int, struct rusage *))
-	    __libsys_interposing[INTERPOS_wait4])(pid, istat, options, NULL));
+	    *(__libc_interposing_slot(INTERPOS_wait4)))
+	    (pid, istat, options, NULL));
 }
 
 __weak_reference(__waitpid, waitpid);
diff --git a/lib/libsys/write.c b/lib/libsys/write.c
index 5bb372c2b8f4..c2050374431b 100644
--- a/lib/libsys/write.c
+++ b/lib/libsys/write.c
@@ -41,5 +41,5 @@ ssize_t
 write(int fd, const void *buf, size_t nbytes)
 {
 	return (((ssize_t (*)(int, const void *, size_t))
-	    __libsys_interposing[INTERPOS_write])(fd, buf, nbytes));
+	    *(__libc_interposing_slot(INTERPOS_write)))(fd, buf, nbytes));
 }
diff --git a/lib/libsys/writev.c b/lib/libsys/writev.c
index d311cb075e3c..40f6f2f211ae 100644
--- a/lib/libsys/writev.c
+++ b/lib/libsys/writev.c
@@ -42,5 +42,5 @@ ssize_t
 writev(int fd, const struct iovec *iov, int iovcnt)
 {
 	return (((ssize_t (*)(int, const struct iovec *, int))
-	    __libsys_interposing[INTERPOS_writev])(fd, iov, iovcnt));
+	    *(__libc_interposing_slot(INTERPOS_writev)))(fd, iov, iovcnt));
 }