diff --git a/lib/libc_r/uthread/uthread_accept.c b/lib/libc_r/uthread/uthread_accept.c index c703b8cf932d..9d1bcd8fc327 100644 --- a/lib/libc_r/uthread/uthread_accept.c +++ b/lib/libc_r/uthread/uthread_accept.c @@ -41,7 +41,7 @@ #include "pthread_private.h" int -accept(int fd, struct sockaddr * name, socklen_t *namelen) +_libc_accept(int fd, struct sockaddr * name, socklen_t *namelen) { int ret; @@ -106,4 +106,6 @@ accept(int fd, struct sockaddr * name, socklen_t *namelen) /* Return the socket file descriptor or -1 on error: */ return (ret); } + +__weak_reference(_libc_accept, accept); #endif diff --git a/lib/libc_r/uthread/uthread_attr_setdetachstate.c b/lib/libc_r/uthread/uthread_attr_setdetachstate.c index 36a846a34abf..6be3e4ee73b3 100644 --- a/lib/libc_r/uthread/uthread_attr_setdetachstate.c +++ b/lib/libc_r/uthread/uthread_attr_setdetachstate.c @@ -36,7 +36,8 @@ #include #include "pthread_private.h" -int pthread_attr_setdetachstate(pthread_attr_t *attr, int detachstate) +int +pthread_attr_setdetachstate(pthread_attr_t *attr, int detachstate) { int ret; diff --git a/lib/libc_r/uthread/uthread_attr_setprio.c b/lib/libc_r/uthread/uthread_attr_setprio.c index 4bd6b6699874..98ed0298354d 100644 --- a/lib/libc_r/uthread/uthread_attr_setprio.c +++ b/lib/libc_r/uthread/uthread_attr_setprio.c @@ -36,7 +36,8 @@ #include #include "pthread_private.h" -int pthread_attr_setprio(pthread_attr_t *attr, int priority) +int +pthread_attr_setprio(pthread_attr_t *attr, int priority) { int ret; if (attr == NULL || *attr == NULL) { diff --git a/lib/libc_r/uthread/uthread_attr_setstackaddr.c b/lib/libc_r/uthread/uthread_attr_setstackaddr.c index 7eb8c5d1319c..46469e4faf87 100644 --- a/lib/libc_r/uthread/uthread_attr_setstackaddr.c +++ b/lib/libc_r/uthread/uthread_attr_setstackaddr.c @@ -36,7 +36,8 @@ #include #include "pthread_private.h" -int pthread_attr_setstackaddr(pthread_attr_t *attr, void *stackaddr) +int +pthread_attr_setstackaddr(pthread_attr_t *attr, void *stackaddr) { int ret; diff --git a/lib/libc_r/uthread/uthread_attr_setstacksize.c b/lib/libc_r/uthread/uthread_attr_setstacksize.c index 2a2d85482e0a..3897811bb436 100644 --- a/lib/libc_r/uthread/uthread_attr_setstacksize.c +++ b/lib/libc_r/uthread/uthread_attr_setstacksize.c @@ -36,7 +36,8 @@ #include #include "pthread_private.h" -int pthread_attr_setstacksize(pthread_attr_t *attr, size_t stacksize) +int +pthread_attr_setstacksize(pthread_attr_t *attr, size_t stacksize) { int ret; diff --git a/lib/libc_r/uthread/uthread_bind.c b/lib/libc_r/uthread/uthread_bind.c index e6989a09e3b5..7cb3028cfd39 100644 --- a/lib/libc_r/uthread/uthread_bind.c +++ b/lib/libc_r/uthread/uthread_bind.c @@ -38,7 +38,7 @@ #include "pthread_private.h" int -bind(int fd, const struct sockaddr * name, socklen_t namelen) +_libc_bind(int fd, const struct sockaddr * name, socklen_t namelen) { int ret; @@ -48,4 +48,6 @@ bind(int fd, const struct sockaddr * name, socklen_t namelen) } return (ret); } + +__weak_reference(_libc_bind, bind); #endif diff --git a/lib/libc_r/uthread/uthread_close.c b/lib/libc_r/uthread/uthread_close.c index 2580fcef02c5..fe2d9e2a4622 100644 --- a/lib/libc_r/uthread/uthread_close.c +++ b/lib/libc_r/uthread/uthread_close.c @@ -41,7 +41,7 @@ #include "pthread_private.h" int -close(int fd) +_libc_close(int fd) { int flags; int ret; @@ -102,4 +102,6 @@ close(int fd) _thread_leave_cancellation_point(); return (ret); } + +__weak_reference(_libc_close, close); #endif diff --git a/lib/libc_r/uthread/uthread_connect.c b/lib/libc_r/uthread/uthread_connect.c index 7c60f63ca771..03fea27b53cc 100644 --- a/lib/libc_r/uthread/uthread_connect.c +++ b/lib/libc_r/uthread/uthread_connect.c @@ -40,7 +40,7 @@ #include "pthread_private.h" int -connect(int fd, const struct sockaddr * name, socklen_t namelen) +_libc_connect(int fd, const struct sockaddr * name, socklen_t namelen) { struct sockaddr tmpname; int errnolen, ret, tmpnamelen; @@ -75,4 +75,6 @@ connect(int fd, const struct sockaddr * name, socklen_t namelen) } return (ret); } + +__weak_reference(_libc_connect, connect); #endif diff --git a/lib/libc_r/uthread/uthread_dup.c b/lib/libc_r/uthread/uthread_dup.c index e32751a73dc0..63bd9bff8e7c 100644 --- a/lib/libc_r/uthread/uthread_dup.c +++ b/lib/libc_r/uthread/uthread_dup.c @@ -37,7 +37,7 @@ #include "pthread_private.h" int -dup(int fd) +_libc_dup(int fd) { int ret; @@ -67,4 +67,6 @@ dup(int fd) /* Return the completion status: */ return (ret); } + +__weak_reference(_libc_dup, dup); #endif diff --git a/lib/libc_r/uthread/uthread_dup2.c b/lib/libc_r/uthread/uthread_dup2.c index 2c9e9de6705b..b8b8a731a793 100644 --- a/lib/libc_r/uthread/uthread_dup2.c +++ b/lib/libc_r/uthread/uthread_dup2.c @@ -38,7 +38,7 @@ #include "pthread_private.h" int -dup2(int fd, int newfd) +_libc_dup2(int fd, int newfd) { int ret; int newfd_opened; @@ -83,4 +83,6 @@ dup2(int fd, int newfd) /* Return the completion status: */ return (ret); } + +__weak_reference(_libc_dup2, dup2); #endif diff --git a/lib/libc_r/uthread/uthread_execve.c b/lib/libc_r/uthread/uthread_execve.c index 32b9e2ebdeb7..af42e39a7650 100644 --- a/lib/libc_r/uthread/uthread_execve.c +++ b/lib/libc_r/uthread/uthread_execve.c @@ -39,7 +39,7 @@ #include "pthread_private.h" int -execve(const char *name, char *const * argv, char *const * envp) +_libc_execve(const char *name, char *const * argv, char *const * envp) { int flags; int i; @@ -110,4 +110,6 @@ execve(const char *name, char *const * argv, char *const * envp) /* Return the completion status: */ return (ret); } + +__weak_reference(_libc_execve, execve); #endif diff --git a/lib/libc_r/uthread/uthread_exit.c b/lib/libc_r/uthread/uthread_exit.c index abe4b278861d..57ac1141e251 100644 --- a/lib/libc_r/uthread/uthread_exit.c +++ b/lib/libc_r/uthread/uthread_exit.c @@ -41,7 +41,7 @@ #include #include "pthread_private.h" -void _exit(int status) +void _libc__exit(int status) { int flags; int i; @@ -77,6 +77,8 @@ void _exit(int status) _thread_sys__exit(status); } +__weak_reference(_libc__exit, _exit); + void _thread_exit(char *fname, int lineno, char *string) { diff --git a/lib/libc_r/uthread/uthread_fchflags.c b/lib/libc_r/uthread/uthread_fchflags.c index ec4e74748281..3334b56e8431 100644 --- a/lib/libc_r/uthread/uthread_fchflags.c +++ b/lib/libc_r/uthread/uthread_fchflags.c @@ -12,7 +12,7 @@ #include "pthread_private.h" int -fchflags(int fd, u_long flags) +_libc_fchflags(int fd, u_long flags) { int ret; @@ -22,4 +22,6 @@ fchflags(int fd, u_long flags) } return (ret); } + +__weak_reference(_libc_fchflags, fchflags); #endif diff --git a/lib/libc_r/uthread/uthread_fchmod.c b/lib/libc_r/uthread/uthread_fchmod.c index 536c4b86d275..1f8763798c47 100644 --- a/lib/libc_r/uthread/uthread_fchmod.c +++ b/lib/libc_r/uthread/uthread_fchmod.c @@ -38,7 +38,7 @@ #include "pthread_private.h" int -fchmod(int fd, mode_t mode) +_libc_fchmod(int fd, mode_t mode) { int ret; @@ -48,4 +48,6 @@ fchmod(int fd, mode_t mode) } return (ret); } + +__weak_reference(_libc_fchmod, fchmod); #endif diff --git a/lib/libc_r/uthread/uthread_fchown.c b/lib/libc_r/uthread/uthread_fchown.c index 185fb257bc80..d49d7d165553 100644 --- a/lib/libc_r/uthread/uthread_fchown.c +++ b/lib/libc_r/uthread/uthread_fchown.c @@ -39,7 +39,7 @@ #include "pthread_private.h" int -fchown(int fd, uid_t owner, gid_t group) +_libc_fchown(int fd, uid_t owner, gid_t group) { int ret; @@ -49,4 +49,6 @@ fchown(int fd, uid_t owner, gid_t group) } return (ret); } + +__weak_reference(_libc_fchown, fchown); #endif diff --git a/lib/libc_r/uthread/uthread_fcntl.c b/lib/libc_r/uthread/uthread_fcntl.c index 878554cdbc1d..6cd2b12dd5cd 100644 --- a/lib/libc_r/uthread/uthread_fcntl.c +++ b/lib/libc_r/uthread/uthread_fcntl.c @@ -39,7 +39,7 @@ #include "pthread_private.h" int -fcntl(int fd, int cmd,...) +_libc_fcntl(int fd, int cmd,...) { int flags = 0; int nonblock; @@ -142,4 +142,6 @@ fcntl(int fd, int cmd,...) /* Return the completion status: */ return (ret); } + +__weak_reference(_libc_fcntl, fcntl); #endif diff --git a/lib/libc_r/uthread/uthread_flock.c b/lib/libc_r/uthread/uthread_flock.c index 901ab9d0740c..20de6dc42796 100644 --- a/lib/libc_r/uthread/uthread_flock.c +++ b/lib/libc_r/uthread/uthread_flock.c @@ -37,7 +37,7 @@ #include "pthread_private.h" int -flock(int fd, int operation) +_libc_flock(int fd, int operation) { int ret; @@ -47,4 +47,6 @@ flock(int fd, int operation) } return (ret); } + +__weak_reference(_libc_flock, flock); #endif diff --git a/lib/libc_r/uthread/uthread_fork.c b/lib/libc_r/uthread/uthread_fork.c index 08ea8129ea71..8c112e8b2796 100644 --- a/lib/libc_r/uthread/uthread_fork.c +++ b/lib/libc_r/uthread/uthread_fork.c @@ -41,7 +41,7 @@ #include "pthread_private.h" pid_t -fork(void) +_libc_fork(void) { int i, flags; pid_t ret; @@ -220,4 +220,6 @@ fork(void) /* Return the process ID: */ return (ret); } + +__weak_reference(_libc_fork, fork); #endif diff --git a/lib/libc_r/uthread/uthread_fstat.c b/lib/libc_r/uthread/uthread_fstat.c index 8e9e7a4bdcec..3f182c366078 100644 --- a/lib/libc_r/uthread/uthread_fstat.c +++ b/lib/libc_r/uthread/uthread_fstat.c @@ -42,7 +42,7 @@ #include "pthread_private.h" int -fstat(int fd, struct stat * buf) +_libc_fstat(int fd, struct stat * buf) { int ret; @@ -55,4 +55,6 @@ fstat(int fd, struct stat * buf) } return (ret); } + +__weak_reference(_libc_fstat, fstat); #endif diff --git a/lib/libc_r/uthread/uthread_fstatfs.c b/lib/libc_r/uthread/uthread_fstatfs.c index d7a8a21863b9..84ef0bd85998 100644 --- a/lib/libc_r/uthread/uthread_fstatfs.c +++ b/lib/libc_r/uthread/uthread_fstatfs.c @@ -42,7 +42,7 @@ #include "pthread_private.h" int -fstatfs(int fd, struct statfs * buf) +_libc_fstatfs(int fd, struct statfs * buf) { int ret; @@ -55,4 +55,6 @@ fstatfs(int fd, struct statfs * buf) } return (ret); } + +__weak_reference(_libc_fstatfs, fstatfs); #endif diff --git a/lib/libc_r/uthread/uthread_fsync.c b/lib/libc_r/uthread/uthread_fsync.c index 21c3b568b44e..048e60b0a91a 100644 --- a/lib/libc_r/uthread/uthread_fsync.c +++ b/lib/libc_r/uthread/uthread_fsync.c @@ -37,7 +37,7 @@ #include "pthread_private.h" int -fsync(int fd) +_libc_fsync(int fd) { int ret; @@ -49,4 +49,6 @@ fsync(int fd) _thread_leave_cancellation_point(); return (ret); } + +__weak_reference(_libc_fsync, fsync); #endif diff --git a/lib/libc_r/uthread/uthread_getdirentries.c b/lib/libc_r/uthread/uthread_getdirentries.c index e3c5c7637122..0bd4c8581bd8 100644 --- a/lib/libc_r/uthread/uthread_getdirentries.c +++ b/lib/libc_r/uthread/uthread_getdirentries.c @@ -38,7 +38,7 @@ #include "pthread_private.h" int -getdirentries(int fd, char *buf, int nbytes, long *basep) +_libc_getdirentries(int fd, char *buf, int nbytes, long *basep) { int ret; @@ -48,4 +48,6 @@ getdirentries(int fd, char *buf, int nbytes, long *basep) } return (ret); } + +__weak_reference(_libc_getdirentries, getdirentries); #endif diff --git a/lib/libc_r/uthread/uthread_getpeername.c b/lib/libc_r/uthread/uthread_getpeername.c index 4e972a6d499b..94c87d6e001a 100644 --- a/lib/libc_r/uthread/uthread_getpeername.c +++ b/lib/libc_r/uthread/uthread_getpeername.c @@ -38,7 +38,7 @@ #include "pthread_private.h" int -getpeername(int fd, struct sockaddr * peer, socklen_t *paddrlen) +_libc_getpeername(int fd, struct sockaddr * peer, socklen_t *paddrlen) { int ret; @@ -48,4 +48,6 @@ getpeername(int fd, struct sockaddr * peer, socklen_t *paddrlen) } return ret; } + +__weak_reference(_libc_getpeername, getpeername); #endif diff --git a/lib/libc_r/uthread/uthread_getsockname.c b/lib/libc_r/uthread/uthread_getsockname.c index 691394c8b27e..91d11fe4cfe7 100644 --- a/lib/libc_r/uthread/uthread_getsockname.c +++ b/lib/libc_r/uthread/uthread_getsockname.c @@ -38,7 +38,7 @@ #include "pthread_private.h" int -getsockname(int s, struct sockaddr * name, socklen_t *namelen) +_libc_getsockname(int s, struct sockaddr * name, socklen_t *namelen) { int ret; @@ -48,4 +48,6 @@ getsockname(int s, struct sockaddr * name, socklen_t *namelen) } return ret; } + +__weak_reference(_libc_getsockname, getsockname); #endif diff --git a/lib/libc_r/uthread/uthread_getsockopt.c b/lib/libc_r/uthread/uthread_getsockopt.c index ad293fab6600..a698c2bac27c 100644 --- a/lib/libc_r/uthread/uthread_getsockopt.c +++ b/lib/libc_r/uthread/uthread_getsockopt.c @@ -38,7 +38,8 @@ #include "pthread_private.h" int -getsockopt(int fd, int level, int optname, void *optval, socklen_t *optlen) +_libc_getsockopt(int fd, int level, int optname, void *optval, socklen_t + *optlen) { int ret; @@ -48,4 +49,6 @@ getsockopt(int fd, int level, int optname, void *optval, socklen_t *optlen) } return ret; } + +__weak_reference(_libc_getsockopt, getsockopt); #endif diff --git a/lib/libc_r/uthread/uthread_ioctl.c b/lib/libc_r/uthread/uthread_ioctl.c index f2c4531a2a70..185764307878 100644 --- a/lib/libc_r/uthread/uthread_ioctl.c +++ b/lib/libc_r/uthread/uthread_ioctl.c @@ -39,7 +39,7 @@ #include "pthread_private.h" int -ioctl(int fd, unsigned long request,...) +_libc_ioctl(int fd, unsigned long request,...) { int ret; int *op; @@ -76,4 +76,6 @@ ioctl(int fd, unsigned long request,...) /* Return the completion status: */ return (ret); } + +__weak_reference(_libc_ioctl, ioctl); #endif diff --git a/lib/libc_r/uthread/uthread_listen.c b/lib/libc_r/uthread/uthread_listen.c index dc901072243c..00ffe5b924e9 100644 --- a/lib/libc_r/uthread/uthread_listen.c +++ b/lib/libc_r/uthread/uthread_listen.c @@ -38,7 +38,7 @@ #include "pthread_private.h" int -listen(int fd, int backlog) +_libc_listen(int fd, int backlog) { int ret; @@ -48,4 +48,6 @@ listen(int fd, int backlog) } return (ret); } + +__weak_reference(_libc_listen, listen); #endif diff --git a/lib/libc_r/uthread/uthread_msync.c b/lib/libc_r/uthread/uthread_msync.c index 209286d2d1a6..9559ec416291 100644 --- a/lib/libc_r/uthread/uthread_msync.c +++ b/lib/libc_r/uthread/uthread_msync.c @@ -13,7 +13,7 @@ #include "pthread_private.h" int -msync(addr, len, flags) +_libc_msync(addr, len, flags) void *addr; size_t len; int flags; @@ -37,4 +37,6 @@ msync(addr, len, flags) return (ret); } + +__weak_reference(_libc_msync, msync); #endif diff --git a/lib/libc_r/uthread/uthread_multi_np.c b/lib/libc_r/uthread/uthread_multi_np.c index 39dd948cbc4f..9a2f7c1ece49 100644 --- a/lib/libc_r/uthread/uthread_multi_np.c +++ b/lib/libc_r/uthread/uthread_multi_np.c @@ -36,7 +36,8 @@ #include #include "pthread_private.h" -int pthread_multi_np() +int +pthread_multi_np() { /* Return to multi-threaded scheduling mode: */ _thread_single = NULL; diff --git a/lib/libc_r/uthread/uthread_mutex.c b/lib/libc_r/uthread/uthread_mutex.c index c625ef26e900..6526a3579c8b 100644 --- a/lib/libc_r/uthread/uthread_mutex.c +++ b/lib/libc_r/uthread/uthread_mutex.c @@ -243,7 +243,7 @@ pthread_mutex_destroy(pthread_mutex_t * mutex) } static int -init_static (pthread_mutex_t *mutex) +init_static(pthread_mutex_t *mutex) { int ret; @@ -1219,7 +1219,7 @@ mutex_priority_adjust(pthread_mutex_t mutex) } static void -mutex_rescan_owned (pthread_t pthread, pthread_mutex_t mutex) +mutex_rescan_owned(pthread_t pthread, pthread_mutex_t mutex) { int active_prio, inherited_prio; pthread_mutex_t m; diff --git a/lib/libc_r/uthread/uthread_mutexattr_destroy.c b/lib/libc_r/uthread/uthread_mutexattr_destroy.c index 9afebad917d2..6eed2a256019 100644 --- a/lib/libc_r/uthread/uthread_mutexattr_destroy.c +++ b/lib/libc_r/uthread/uthread_mutexattr_destroy.c @@ -37,7 +37,8 @@ #include #include "pthread_private.h" -int pthread_mutexattr_destroy(pthread_mutexattr_t *attr) +int +pthread_mutexattr_destroy(pthread_mutexattr_t *attr) { int ret; if (attr == NULL || *attr == NULL) { diff --git a/lib/libc_r/uthread/uthread_nanosleep.c b/lib/libc_r/uthread/uthread_nanosleep.c index e4772b4fe2a9..e9052f983480 100644 --- a/lib/libc_r/uthread/uthread_nanosleep.c +++ b/lib/libc_r/uthread/uthread_nanosleep.c @@ -38,8 +38,8 @@ #include "pthread_private.h" int -nanosleep(const struct timespec * time_to_sleep, - struct timespec * time_remaining) +_libc_nanosleep(const struct timespec * time_to_sleep, + struct timespec * time_remaining) { int ret = 0; struct timespec current_time; @@ -120,4 +120,6 @@ nanosleep(const struct timespec * time_to_sleep, _thread_leave_cancellation_point(); return (ret); } + +__weak_reference(_libc_nanosleep, nanosleep); #endif diff --git a/lib/libc_r/uthread/uthread_open.c b/lib/libc_r/uthread/uthread_open.c index 4e9993eb6585..4bc2f1a513e3 100644 --- a/lib/libc_r/uthread/uthread_open.c +++ b/lib/libc_r/uthread/uthread_open.c @@ -42,7 +42,7 @@ #include "pthread_private.h" int -open(const char *path, int flags,...) +_libc_open(const char *path, int flags,...) { int fd; int mode = 0; @@ -74,4 +74,6 @@ open(const char *path, int flags,...) /* Return the file descriptor or -1 on error: */ return (fd); } + +__weak_reference(_libc_open, open); #endif diff --git a/lib/libc_r/uthread/uthread_pipe.c b/lib/libc_r/uthread/uthread_pipe.c index 72ed6c9f095a..b815e1af4879 100644 --- a/lib/libc_r/uthread/uthread_pipe.c +++ b/lib/libc_r/uthread/uthread_pipe.c @@ -38,7 +38,7 @@ #include "pthread_private.h" int -pipe(int fds[2]) +_libc_pipe(int fds[2]) { int ret; if ((ret = _thread_sys_pipe(fds)) >= 0) { @@ -51,4 +51,6 @@ pipe(int fds[2]) } return (ret); } + +__weak_reference(_libc_pipe, pipe); #endif diff --git a/lib/libc_r/uthread/uthread_poll.c b/lib/libc_r/uthread/uthread_poll.c index 10a9db74e359..ce2b7af56bc1 100644 --- a/lib/libc_r/uthread/uthread_poll.c +++ b/lib/libc_r/uthread/uthread_poll.c @@ -44,7 +44,7 @@ int -poll(struct pollfd *fds, unsigned int nfds, int timeout) +_libc_poll(struct pollfd *fds, unsigned int nfds, int timeout) { struct timespec ts; int numfds = nfds; @@ -96,4 +96,6 @@ poll(struct pollfd *fds, unsigned int nfds, int timeout) return (ret); } + +__weak_reference(_libc_poll, poll); #endif diff --git a/lib/libc_r/uthread/uthread_read.c b/lib/libc_r/uthread/uthread_read.c index 8cbb5be7b7b0..ad66df368c25 100644 --- a/lib/libc_r/uthread/uthread_read.c +++ b/lib/libc_r/uthread/uthread_read.c @@ -42,7 +42,7 @@ #include "pthread_private.h" ssize_t -read(int fd, void *buf, size_t nbytes) +_libc_read(int fd, void *buf, size_t nbytes) { int ret; int type; @@ -100,4 +100,6 @@ read(int fd, void *buf, size_t nbytes) _thread_leave_cancellation_point(); return (ret); } + +__weak_reference(_libc_read, read); #endif diff --git a/lib/libc_r/uthread/uthread_readv.c b/lib/libc_r/uthread/uthread_readv.c index a1a862d42490..c1965d834f8a 100644 --- a/lib/libc_r/uthread/uthread_readv.c +++ b/lib/libc_r/uthread/uthread_readv.c @@ -42,7 +42,7 @@ #include "pthread_private.h" ssize_t -readv(int fd, const struct iovec * iov, int iovcnt) +_libc_readv(int fd, const struct iovec * iov, int iovcnt) { int ret; int type; @@ -90,4 +90,6 @@ readv(int fd, const struct iovec * iov, int iovcnt) } return (ret); } + +__weak_reference(_libc_readv, readv); #endif diff --git a/lib/libc_r/uthread/uthread_recvfrom.c b/lib/libc_r/uthread/uthread_recvfrom.c index 3130dfdf7247..897e218a4a95 100644 --- a/lib/libc_r/uthread/uthread_recvfrom.c +++ b/lib/libc_r/uthread/uthread_recvfrom.c @@ -40,7 +40,8 @@ #include "pthread_private.h" ssize_t -recvfrom(int fd, void *buf, size_t len, int flags, struct sockaddr * from, socklen_t *from_len) +_libc_recvfrom(int fd, void *buf, size_t len, int flags, struct sockaddr * from, + socklen_t *from_len) { int ret; @@ -70,4 +71,6 @@ recvfrom(int fd, void *buf, size_t len, int flags, struct sockaddr * from, sockl } return (ret); } + +__weak_reference(_libc_recvfrom, recvfrom); #endif diff --git a/lib/libc_r/uthread/uthread_recvmsg.c b/lib/libc_r/uthread/uthread_recvmsg.c index dff8941eb401..d89c963a083f 100644 --- a/lib/libc_r/uthread/uthread_recvmsg.c +++ b/lib/libc_r/uthread/uthread_recvmsg.c @@ -40,7 +40,7 @@ #include "pthread_private.h" ssize_t -recvmsg(int fd, struct msghdr *msg, int flags) +_libc_recvmsg(int fd, struct msghdr *msg, int flags) { int ret; @@ -70,4 +70,6 @@ recvmsg(int fd, struct msghdr *msg, int flags) } return (ret); } + +__weak_reference(_libc_recvmsg, recvmsg); #endif diff --git a/lib/libc_r/uthread/uthread_rwlockattr.c b/lib/libc_r/uthread/uthread_rwlockattr.c index 7a56bca7d4ba..37eb3eae66a9 100644 --- a/lib/libc_r/uthread/uthread_rwlockattr.c +++ b/lib/libc_r/uthread/uthread_rwlockattr.c @@ -34,7 +34,7 @@ #include "pthread_private.h" int -pthread_rwlockattr_destroy (pthread_rwlockattr_t *rwlockattr) +pthread_rwlockattr_destroy(pthread_rwlockattr_t *rwlockattr) { pthread_rwlockattr_t prwlockattr; @@ -52,7 +52,7 @@ pthread_rwlockattr_destroy (pthread_rwlockattr_t *rwlockattr) } int -pthread_rwlockattr_getpshared (const pthread_rwlockattr_t *rwlockattr, +pthread_rwlockattr_getpshared(const pthread_rwlockattr_t *rwlockattr, int *pshared) { *pshared = (*rwlockattr)->pshared; @@ -61,7 +61,7 @@ pthread_rwlockattr_getpshared (const pthread_rwlockattr_t *rwlockattr, } int -pthread_rwlockattr_init (pthread_rwlockattr_t *rwlockattr) +pthread_rwlockattr_init(pthread_rwlockattr_t *rwlockattr) { pthread_rwlockattr_t prwlockattr; @@ -81,7 +81,7 @@ pthread_rwlockattr_init (pthread_rwlockattr_t *rwlockattr) } int -pthread_rwlockattr_setpshared (pthread_rwlockattr_t *rwlockattr, int pshared) +pthread_rwlockattr_setpshared(pthread_rwlockattr_t *rwlockattr, int pshared) { /* Only PTHREAD_PROCESS_PRIVATE is supported. */ if (pshared != PTHREAD_PROCESS_PRIVATE) diff --git a/lib/libc_r/uthread/uthread_select.c b/lib/libc_r/uthread/uthread_select.c index 9bfae89be374..a7ceeccfe8ae 100644 --- a/lib/libc_r/uthread/uthread_select.c +++ b/lib/libc_r/uthread/uthread_select.c @@ -45,8 +45,8 @@ #include "pthread_private.h" int -select(int numfds, fd_set * readfds, fd_set * writefds, - fd_set * exceptfds, struct timeval * timeout) +_libc_select(int numfds, fd_set * readfds, fd_set * writefds, fd_set * + exceptfds, struct timeval * timeout) { struct timespec ts; int i, ret = 0, f_wait = 1; @@ -203,4 +203,6 @@ select(int numfds, fd_set * readfds, fd_set * writefds, return (ret); } + +__weak_reference(_libc_select, select); #endif diff --git a/lib/libc_r/uthread/uthread_sendmsg.c b/lib/libc_r/uthread/uthread_sendmsg.c index 6834104a15dd..d280519978b3 100644 --- a/lib/libc_r/uthread/uthread_sendmsg.c +++ b/lib/libc_r/uthread/uthread_sendmsg.c @@ -40,7 +40,7 @@ #include "pthread_private.h" ssize_t -sendmsg(int fd, const struct msghdr *msg, int flags) +_libc_sendmsg(int fd, const struct msghdr *msg, int flags) { int ret; @@ -69,4 +69,6 @@ sendmsg(int fd, const struct msghdr *msg, int flags) } return (ret); } + +__weak_reference(_libc_sendmsg, sendmsg); #endif diff --git a/lib/libc_r/uthread/uthread_sendto.c b/lib/libc_r/uthread/uthread_sendto.c index 348affc14b1d..dc134bc1524c 100644 --- a/lib/libc_r/uthread/uthread_sendto.c +++ b/lib/libc_r/uthread/uthread_sendto.c @@ -40,7 +40,8 @@ #include "pthread_private.h" ssize_t -sendto(int fd, const void *msg, size_t len, int flags, const struct sockaddr * to, socklen_t to_len) +_libc_sendto(int fd, const void *msg, size_t len, int flags, const struct + sockaddr * to, socklen_t to_len) { int ret; @@ -69,4 +70,6 @@ sendto(int fd, const void *msg, size_t len, int flags, const struct sockaddr * t } return (ret); } + +__weak_reference(_libc_sendto, sendto); #endif diff --git a/lib/libc_r/uthread/uthread_setsockopt.c b/lib/libc_r/uthread/uthread_setsockopt.c index ed1155b31ecc..eb917f50c730 100644 --- a/lib/libc_r/uthread/uthread_setsockopt.c +++ b/lib/libc_r/uthread/uthread_setsockopt.c @@ -38,7 +38,8 @@ #include "pthread_private.h" int -setsockopt(int fd, int level, int optname, const void *optval, socklen_t optlen) +_libc_setsockopt(int fd, int level, int optname, const void *optval, socklen_t + optlen) { int ret; @@ -48,4 +49,6 @@ setsockopt(int fd, int level, int optname, const void *optval, socklen_t optlen) } return ret; } + +__weak_reference(_libc_setsockopt, setsockopt); #endif diff --git a/lib/libc_r/uthread/uthread_shutdown.c b/lib/libc_r/uthread/uthread_shutdown.c index ccb087de81fd..cffe4b6d7868 100644 --- a/lib/libc_r/uthread/uthread_shutdown.c +++ b/lib/libc_r/uthread/uthread_shutdown.c @@ -39,7 +39,7 @@ #include "pthread_private.h" int -shutdown(int fd, int how) +_libc_shutdown(int fd, int how) { int ret; @@ -69,4 +69,6 @@ shutdown(int fd, int how) } return (ret); } + +__weak_reference(_libc_shutdown, shutdown); #endif diff --git a/lib/libc_r/uthread/uthread_sigaction.c b/lib/libc_r/uthread/uthread_sigaction.c index 7fa8ebff330d..f2f728685ec3 100644 --- a/lib/libc_r/uthread/uthread_sigaction.c +++ b/lib/libc_r/uthread/uthread_sigaction.c @@ -38,7 +38,7 @@ #include "pthread_private.h" int -sigaction(int sig, const struct sigaction * act, struct sigaction * oact) +_libc_sigaction(int sig, const struct sigaction * act, struct sigaction * oact) { int ret = 0; struct sigaction gact; @@ -105,4 +105,6 @@ sigaction(int sig, const struct sigaction * act, struct sigaction * oact) /* Return the completion status: */ return (ret); } + +__weak_reference(_libc_sigaction, sigaction); #endif diff --git a/lib/libc_r/uthread/uthread_sigpending.c b/lib/libc_r/uthread/uthread_sigpending.c index 2d61e2104788..feb430011c4b 100644 --- a/lib/libc_r/uthread/uthread_sigpending.c +++ b/lib/libc_r/uthread/uthread_sigpending.c @@ -38,7 +38,7 @@ #include "pthread_private.h" int -sigpending(sigset_t * set) +_libc_sigpending(sigset_t * set) { int ret = 0; @@ -53,4 +53,6 @@ sigpending(sigset_t * set) /* Return the completion status: */ return (ret); } + +__weak_reference(_libc_sigpending, sigpending); #endif diff --git a/lib/libc_r/uthread/uthread_sigprocmask.c b/lib/libc_r/uthread/uthread_sigprocmask.c index 592a61e865eb..28ab4fab7d7d 100644 --- a/lib/libc_r/uthread/uthread_sigprocmask.c +++ b/lib/libc_r/uthread/uthread_sigprocmask.c @@ -41,7 +41,7 @@ #include "pthread_private.h" int -sigprocmask(int how, const sigset_t * set, sigset_t * oset) +_libc_sigprocmask(int how, const sigset_t * set, sigset_t * oset) { int ret = 0; @@ -89,4 +89,6 @@ sigprocmask(int how, const sigset_t * set, sigset_t * oset) /* Return the completion status: */ return (ret); } + +__weak_reference(_libc_sigprocmask, sigprocmask); #endif diff --git a/lib/libc_r/uthread/uthread_sigsuspend.c b/lib/libc_r/uthread/uthread_sigsuspend.c index ac06ff71ba46..b64897a6f3a1 100644 --- a/lib/libc_r/uthread/uthread_sigsuspend.c +++ b/lib/libc_r/uthread/uthread_sigsuspend.c @@ -38,7 +38,7 @@ #include "pthread_private.h" int -sigsuspend(const sigset_t * set) +_libc_sigsuspend(const sigset_t * set) { int ret = -1; sigset_t oset; @@ -67,4 +67,6 @@ sigsuspend(const sigset_t * set) /* Return the completion status: */ return (ret); } + +__weak_reference(_libc_sigsuspend, sigsuspend); #endif diff --git a/lib/libc_r/uthread/uthread_socket.c b/lib/libc_r/uthread/uthread_socket.c index 5772bc835eee..bab70dfd2106 100644 --- a/lib/libc_r/uthread/uthread_socket.c +++ b/lib/libc_r/uthread/uthread_socket.c @@ -40,7 +40,7 @@ #include "pthread_private.h" int -socket(int af, int type, int protocol) +_libc_socket(int af, int type, int protocol) { int fd; @@ -55,4 +55,6 @@ socket(int af, int type, int protocol) } return (fd); } + +__weak_reference(_libc_socket, socket); #endif diff --git a/lib/libc_r/uthread/uthread_socketpair.c b/lib/libc_r/uthread/uthread_socketpair.c index 47386d33a6ff..f35ab94f94c9 100644 --- a/lib/libc_r/uthread/uthread_socketpair.c +++ b/lib/libc_r/uthread/uthread_socketpair.c @@ -41,7 +41,7 @@ #include "pthread_private.h" int -socketpair(int af, int type, int protocol, int pair[2]) +_libc_socketpair(int af, int type, int protocol, int pair[2]) { int ret; if (!((ret = _thread_sys_socketpair(af, type, protocol, pair)) < 0)) @@ -53,4 +53,6 @@ socketpair(int af, int type, int protocol, int pair[2]) } return (ret); } + +__weak_reference(_libc_socketpair, socketpair); #endif diff --git a/lib/libc_r/uthread/uthread_wait4.c b/lib/libc_r/uthread/uthread_wait4.c index 4a58a70faf6f..4c3f1dee1a20 100644 --- a/lib/libc_r/uthread/uthread_wait4.c +++ b/lib/libc_r/uthread/uthread_wait4.c @@ -38,7 +38,7 @@ #include "pthread_private.h" pid_t -wait4(pid_t pid, int *istat, int options, struct rusage * rusage) +_libc_wait4(pid_t pid, int *istat, int options, struct rusage * rusage) { pid_t ret; @@ -66,4 +66,6 @@ wait4(pid_t pid, int *istat, int options, struct rusage * rusage) return (ret); } + +__weak_reference(_libc_wait4, wait4); #endif diff --git a/lib/libc_r/uthread/uthread_write.c b/lib/libc_r/uthread/uthread_write.c index 40c4cc574241..f25c6065b911 100644 --- a/lib/libc_r/uthread/uthread_write.c +++ b/lib/libc_r/uthread/uthread_write.c @@ -42,7 +42,7 @@ #include "pthread_private.h" ssize_t -write(int fd, const void *buf, size_t nbytes) +_libc_write(int fd, const void *buf, size_t nbytes) { int blocking; int type; @@ -136,4 +136,6 @@ write(int fd, const void *buf, size_t nbytes) _thread_leave_cancellation_point(); return (ret); } + +__weak_reference(_libc_write, write); #endif diff --git a/lib/libc_r/uthread/uthread_writev.c b/lib/libc_r/uthread/uthread_writev.c index 375f59912b6f..74da5219ff92 100644 --- a/lib/libc_r/uthread/uthread_writev.c +++ b/lib/libc_r/uthread/uthread_writev.c @@ -44,7 +44,7 @@ #include "pthread_private.h" ssize_t -writev(int fd, const struct iovec * iov, int iovcnt) +_libc_writev(int fd, const struct iovec * iov, int iovcnt) { int blocking; int idx = 0; @@ -200,4 +200,6 @@ writev(int fd, const struct iovec * iov, int iovcnt) return (ret); } + +__weak_reference(_libc_writev, writev); #endif diff --git a/lib/libkse/thread/thr_attr_setdetachstate.c b/lib/libkse/thread/thr_attr_setdetachstate.c index 36a846a34abf..6be3e4ee73b3 100644 --- a/lib/libkse/thread/thr_attr_setdetachstate.c +++ b/lib/libkse/thread/thr_attr_setdetachstate.c @@ -36,7 +36,8 @@ #include #include "pthread_private.h" -int pthread_attr_setdetachstate(pthread_attr_t *attr, int detachstate) +int +pthread_attr_setdetachstate(pthread_attr_t *attr, int detachstate) { int ret; diff --git a/lib/libkse/thread/thr_attr_setstackaddr.c b/lib/libkse/thread/thr_attr_setstackaddr.c index 7eb8c5d1319c..46469e4faf87 100644 --- a/lib/libkse/thread/thr_attr_setstackaddr.c +++ b/lib/libkse/thread/thr_attr_setstackaddr.c @@ -36,7 +36,8 @@ #include #include "pthread_private.h" -int pthread_attr_setstackaddr(pthread_attr_t *attr, void *stackaddr) +int +pthread_attr_setstackaddr(pthread_attr_t *attr, void *stackaddr) { int ret; diff --git a/lib/libkse/thread/thr_attr_setstacksize.c b/lib/libkse/thread/thr_attr_setstacksize.c index 2a2d85482e0a..3897811bb436 100644 --- a/lib/libkse/thread/thr_attr_setstacksize.c +++ b/lib/libkse/thread/thr_attr_setstacksize.c @@ -36,7 +36,8 @@ #include #include "pthread_private.h" -int pthread_attr_setstacksize(pthread_attr_t *attr, size_t stacksize) +int +pthread_attr_setstacksize(pthread_attr_t *attr, size_t stacksize) { int ret; diff --git a/lib/libkse/thread/thr_close.c b/lib/libkse/thread/thr_close.c index 2580fcef02c5..fe2d9e2a4622 100644 --- a/lib/libkse/thread/thr_close.c +++ b/lib/libkse/thread/thr_close.c @@ -41,7 +41,7 @@ #include "pthread_private.h" int -close(int fd) +_libc_close(int fd) { int flags; int ret; @@ -102,4 +102,6 @@ close(int fd) _thread_leave_cancellation_point(); return (ret); } + +__weak_reference(_libc_close, close); #endif diff --git a/lib/libkse/thread/thr_exit.c b/lib/libkse/thread/thr_exit.c index abe4b278861d..57ac1141e251 100644 --- a/lib/libkse/thread/thr_exit.c +++ b/lib/libkse/thread/thr_exit.c @@ -41,7 +41,7 @@ #include #include "pthread_private.h" -void _exit(int status) +void _libc__exit(int status) { int flags; int i; @@ -77,6 +77,8 @@ void _exit(int status) _thread_sys__exit(status); } +__weak_reference(_libc__exit, _exit); + void _thread_exit(char *fname, int lineno, char *string) { diff --git a/lib/libkse/thread/thr_fcntl.c b/lib/libkse/thread/thr_fcntl.c index 878554cdbc1d..6cd2b12dd5cd 100644 --- a/lib/libkse/thread/thr_fcntl.c +++ b/lib/libkse/thread/thr_fcntl.c @@ -39,7 +39,7 @@ #include "pthread_private.h" int -fcntl(int fd, int cmd,...) +_libc_fcntl(int fd, int cmd,...) { int flags = 0; int nonblock; @@ -142,4 +142,6 @@ fcntl(int fd, int cmd,...) /* Return the completion status: */ return (ret); } + +__weak_reference(_libc_fcntl, fcntl); #endif diff --git a/lib/libkse/thread/thr_fork.c b/lib/libkse/thread/thr_fork.c index 08ea8129ea71..8c112e8b2796 100644 --- a/lib/libkse/thread/thr_fork.c +++ b/lib/libkse/thread/thr_fork.c @@ -41,7 +41,7 @@ #include "pthread_private.h" pid_t -fork(void) +_libc_fork(void) { int i, flags; pid_t ret; @@ -220,4 +220,6 @@ fork(void) /* Return the process ID: */ return (ret); } + +__weak_reference(_libc_fork, fork); #endif diff --git a/lib/libkse/thread/thr_fsync.c b/lib/libkse/thread/thr_fsync.c index 21c3b568b44e..048e60b0a91a 100644 --- a/lib/libkse/thread/thr_fsync.c +++ b/lib/libkse/thread/thr_fsync.c @@ -37,7 +37,7 @@ #include "pthread_private.h" int -fsync(int fd) +_libc_fsync(int fd) { int ret; @@ -49,4 +49,6 @@ fsync(int fd) _thread_leave_cancellation_point(); return (ret); } + +__weak_reference(_libc_fsync, fsync); #endif diff --git a/lib/libkse/thread/thr_msync.c b/lib/libkse/thread/thr_msync.c index 209286d2d1a6..9559ec416291 100644 --- a/lib/libkse/thread/thr_msync.c +++ b/lib/libkse/thread/thr_msync.c @@ -13,7 +13,7 @@ #include "pthread_private.h" int -msync(addr, len, flags) +_libc_msync(addr, len, flags) void *addr; size_t len; int flags; @@ -37,4 +37,6 @@ msync(addr, len, flags) return (ret); } + +__weak_reference(_libc_msync, msync); #endif diff --git a/lib/libkse/thread/thr_multi_np.c b/lib/libkse/thread/thr_multi_np.c index 39dd948cbc4f..9a2f7c1ece49 100644 --- a/lib/libkse/thread/thr_multi_np.c +++ b/lib/libkse/thread/thr_multi_np.c @@ -36,7 +36,8 @@ #include #include "pthread_private.h" -int pthread_multi_np() +int +pthread_multi_np() { /* Return to multi-threaded scheduling mode: */ _thread_single = NULL; diff --git a/lib/libkse/thread/thr_mutex.c b/lib/libkse/thread/thr_mutex.c index c625ef26e900..6526a3579c8b 100644 --- a/lib/libkse/thread/thr_mutex.c +++ b/lib/libkse/thread/thr_mutex.c @@ -243,7 +243,7 @@ pthread_mutex_destroy(pthread_mutex_t * mutex) } static int -init_static (pthread_mutex_t *mutex) +init_static(pthread_mutex_t *mutex) { int ret; @@ -1219,7 +1219,7 @@ mutex_priority_adjust(pthread_mutex_t mutex) } static void -mutex_rescan_owned (pthread_t pthread, pthread_mutex_t mutex) +mutex_rescan_owned(pthread_t pthread, pthread_mutex_t mutex) { int active_prio, inherited_prio; pthread_mutex_t m; diff --git a/lib/libkse/thread/thr_mutexattr_destroy.c b/lib/libkse/thread/thr_mutexattr_destroy.c index 9afebad917d2..6eed2a256019 100644 --- a/lib/libkse/thread/thr_mutexattr_destroy.c +++ b/lib/libkse/thread/thr_mutexattr_destroy.c @@ -37,7 +37,8 @@ #include #include "pthread_private.h" -int pthread_mutexattr_destroy(pthread_mutexattr_t *attr) +int +pthread_mutexattr_destroy(pthread_mutexattr_t *attr) { int ret; if (attr == NULL || *attr == NULL) { diff --git a/lib/libkse/thread/thr_nanosleep.c b/lib/libkse/thread/thr_nanosleep.c index e4772b4fe2a9..e9052f983480 100644 --- a/lib/libkse/thread/thr_nanosleep.c +++ b/lib/libkse/thread/thr_nanosleep.c @@ -38,8 +38,8 @@ #include "pthread_private.h" int -nanosleep(const struct timespec * time_to_sleep, - struct timespec * time_remaining) +_libc_nanosleep(const struct timespec * time_to_sleep, + struct timespec * time_remaining) { int ret = 0; struct timespec current_time; @@ -120,4 +120,6 @@ nanosleep(const struct timespec * time_to_sleep, _thread_leave_cancellation_point(); return (ret); } + +__weak_reference(_libc_nanosleep, nanosleep); #endif diff --git a/lib/libkse/thread/thr_open.c b/lib/libkse/thread/thr_open.c index 4e9993eb6585..4bc2f1a513e3 100644 --- a/lib/libkse/thread/thr_open.c +++ b/lib/libkse/thread/thr_open.c @@ -42,7 +42,7 @@ #include "pthread_private.h" int -open(const char *path, int flags,...) +_libc_open(const char *path, int flags,...) { int fd; int mode = 0; @@ -74,4 +74,6 @@ open(const char *path, int flags,...) /* Return the file descriptor or -1 on error: */ return (fd); } + +__weak_reference(_libc_open, open); #endif diff --git a/lib/libkse/thread/thr_poll.c b/lib/libkse/thread/thr_poll.c index 10a9db74e359..ce2b7af56bc1 100644 --- a/lib/libkse/thread/thr_poll.c +++ b/lib/libkse/thread/thr_poll.c @@ -44,7 +44,7 @@ int -poll(struct pollfd *fds, unsigned int nfds, int timeout) +_libc_poll(struct pollfd *fds, unsigned int nfds, int timeout) { struct timespec ts; int numfds = nfds; @@ -96,4 +96,6 @@ poll(struct pollfd *fds, unsigned int nfds, int timeout) return (ret); } + +__weak_reference(_libc_poll, poll); #endif diff --git a/lib/libkse/thread/thr_read.c b/lib/libkse/thread/thr_read.c index 8cbb5be7b7b0..ad66df368c25 100644 --- a/lib/libkse/thread/thr_read.c +++ b/lib/libkse/thread/thr_read.c @@ -42,7 +42,7 @@ #include "pthread_private.h" ssize_t -read(int fd, void *buf, size_t nbytes) +_libc_read(int fd, void *buf, size_t nbytes) { int ret; int type; @@ -100,4 +100,6 @@ read(int fd, void *buf, size_t nbytes) _thread_leave_cancellation_point(); return (ret); } + +__weak_reference(_libc_read, read); #endif diff --git a/lib/libkse/thread/thr_readv.c b/lib/libkse/thread/thr_readv.c index a1a862d42490..c1965d834f8a 100644 --- a/lib/libkse/thread/thr_readv.c +++ b/lib/libkse/thread/thr_readv.c @@ -42,7 +42,7 @@ #include "pthread_private.h" ssize_t -readv(int fd, const struct iovec * iov, int iovcnt) +_libc_readv(int fd, const struct iovec * iov, int iovcnt) { int ret; int type; @@ -90,4 +90,6 @@ readv(int fd, const struct iovec * iov, int iovcnt) } return (ret); } + +__weak_reference(_libc_readv, readv); #endif diff --git a/lib/libkse/thread/thr_rwlockattr.c b/lib/libkse/thread/thr_rwlockattr.c index 7a56bca7d4ba..37eb3eae66a9 100644 --- a/lib/libkse/thread/thr_rwlockattr.c +++ b/lib/libkse/thread/thr_rwlockattr.c @@ -34,7 +34,7 @@ #include "pthread_private.h" int -pthread_rwlockattr_destroy (pthread_rwlockattr_t *rwlockattr) +pthread_rwlockattr_destroy(pthread_rwlockattr_t *rwlockattr) { pthread_rwlockattr_t prwlockattr; @@ -52,7 +52,7 @@ pthread_rwlockattr_destroy (pthread_rwlockattr_t *rwlockattr) } int -pthread_rwlockattr_getpshared (const pthread_rwlockattr_t *rwlockattr, +pthread_rwlockattr_getpshared(const pthread_rwlockattr_t *rwlockattr, int *pshared) { *pshared = (*rwlockattr)->pshared; @@ -61,7 +61,7 @@ pthread_rwlockattr_getpshared (const pthread_rwlockattr_t *rwlockattr, } int -pthread_rwlockattr_init (pthread_rwlockattr_t *rwlockattr) +pthread_rwlockattr_init(pthread_rwlockattr_t *rwlockattr) { pthread_rwlockattr_t prwlockattr; @@ -81,7 +81,7 @@ pthread_rwlockattr_init (pthread_rwlockattr_t *rwlockattr) } int -pthread_rwlockattr_setpshared (pthread_rwlockattr_t *rwlockattr, int pshared) +pthread_rwlockattr_setpshared(pthread_rwlockattr_t *rwlockattr, int pshared) { /* Only PTHREAD_PROCESS_PRIVATE is supported. */ if (pshared != PTHREAD_PROCESS_PRIVATE) diff --git a/lib/libkse/thread/thr_select.c b/lib/libkse/thread/thr_select.c index 9bfae89be374..a7ceeccfe8ae 100644 --- a/lib/libkse/thread/thr_select.c +++ b/lib/libkse/thread/thr_select.c @@ -45,8 +45,8 @@ #include "pthread_private.h" int -select(int numfds, fd_set * readfds, fd_set * writefds, - fd_set * exceptfds, struct timeval * timeout) +_libc_select(int numfds, fd_set * readfds, fd_set * writefds, fd_set * + exceptfds, struct timeval * timeout) { struct timespec ts; int i, ret = 0, f_wait = 1; @@ -203,4 +203,6 @@ select(int numfds, fd_set * readfds, fd_set * writefds, return (ret); } + +__weak_reference(_libc_select, select); #endif diff --git a/lib/libkse/thread/thr_sigaction.c b/lib/libkse/thread/thr_sigaction.c index 7fa8ebff330d..f2f728685ec3 100644 --- a/lib/libkse/thread/thr_sigaction.c +++ b/lib/libkse/thread/thr_sigaction.c @@ -38,7 +38,7 @@ #include "pthread_private.h" int -sigaction(int sig, const struct sigaction * act, struct sigaction * oact) +_libc_sigaction(int sig, const struct sigaction * act, struct sigaction * oact) { int ret = 0; struct sigaction gact; @@ -105,4 +105,6 @@ sigaction(int sig, const struct sigaction * act, struct sigaction * oact) /* Return the completion status: */ return (ret); } + +__weak_reference(_libc_sigaction, sigaction); #endif diff --git a/lib/libkse/thread/thr_sigpending.c b/lib/libkse/thread/thr_sigpending.c index 2d61e2104788..feb430011c4b 100644 --- a/lib/libkse/thread/thr_sigpending.c +++ b/lib/libkse/thread/thr_sigpending.c @@ -38,7 +38,7 @@ #include "pthread_private.h" int -sigpending(sigset_t * set) +_libc_sigpending(sigset_t * set) { int ret = 0; @@ -53,4 +53,6 @@ sigpending(sigset_t * set) /* Return the completion status: */ return (ret); } + +__weak_reference(_libc_sigpending, sigpending); #endif diff --git a/lib/libkse/thread/thr_sigprocmask.c b/lib/libkse/thread/thr_sigprocmask.c index 592a61e865eb..28ab4fab7d7d 100644 --- a/lib/libkse/thread/thr_sigprocmask.c +++ b/lib/libkse/thread/thr_sigprocmask.c @@ -41,7 +41,7 @@ #include "pthread_private.h" int -sigprocmask(int how, const sigset_t * set, sigset_t * oset) +_libc_sigprocmask(int how, const sigset_t * set, sigset_t * oset) { int ret = 0; @@ -89,4 +89,6 @@ sigprocmask(int how, const sigset_t * set, sigset_t * oset) /* Return the completion status: */ return (ret); } + +__weak_reference(_libc_sigprocmask, sigprocmask); #endif diff --git a/lib/libkse/thread/thr_sigsuspend.c b/lib/libkse/thread/thr_sigsuspend.c index ac06ff71ba46..b64897a6f3a1 100644 --- a/lib/libkse/thread/thr_sigsuspend.c +++ b/lib/libkse/thread/thr_sigsuspend.c @@ -38,7 +38,7 @@ #include "pthread_private.h" int -sigsuspend(const sigset_t * set) +_libc_sigsuspend(const sigset_t * set) { int ret = -1; sigset_t oset; @@ -67,4 +67,6 @@ sigsuspend(const sigset_t * set) /* Return the completion status: */ return (ret); } + +__weak_reference(_libc_sigsuspend, sigsuspend); #endif diff --git a/lib/libkse/thread/thr_wait4.c b/lib/libkse/thread/thr_wait4.c index 4a58a70faf6f..4c3f1dee1a20 100644 --- a/lib/libkse/thread/thr_wait4.c +++ b/lib/libkse/thread/thr_wait4.c @@ -38,7 +38,7 @@ #include "pthread_private.h" pid_t -wait4(pid_t pid, int *istat, int options, struct rusage * rusage) +_libc_wait4(pid_t pid, int *istat, int options, struct rusage * rusage) { pid_t ret; @@ -66,4 +66,6 @@ wait4(pid_t pid, int *istat, int options, struct rusage * rusage) return (ret); } + +__weak_reference(_libc_wait4, wait4); #endif diff --git a/lib/libkse/thread/thr_write.c b/lib/libkse/thread/thr_write.c index 40c4cc574241..f25c6065b911 100644 --- a/lib/libkse/thread/thr_write.c +++ b/lib/libkse/thread/thr_write.c @@ -42,7 +42,7 @@ #include "pthread_private.h" ssize_t -write(int fd, const void *buf, size_t nbytes) +_libc_write(int fd, const void *buf, size_t nbytes) { int blocking; int type; @@ -136,4 +136,6 @@ write(int fd, const void *buf, size_t nbytes) _thread_leave_cancellation_point(); return (ret); } + +__weak_reference(_libc_write, write); #endif diff --git a/lib/libkse/thread/thr_writev.c b/lib/libkse/thread/thr_writev.c index 375f59912b6f..74da5219ff92 100644 --- a/lib/libkse/thread/thr_writev.c +++ b/lib/libkse/thread/thr_writev.c @@ -44,7 +44,7 @@ #include "pthread_private.h" ssize_t -writev(int fd, const struct iovec * iov, int iovcnt) +_libc_writev(int fd, const struct iovec * iov, int iovcnt) { int blocking; int idx = 0; @@ -200,4 +200,6 @@ writev(int fd, const struct iovec * iov, int iovcnt) return (ret); } + +__weak_reference(_libc_writev, writev); #endif diff --git a/lib/libpthread/thread/thr_attr_setdetachstate.c b/lib/libpthread/thread/thr_attr_setdetachstate.c index 36a846a34abf..6be3e4ee73b3 100644 --- a/lib/libpthread/thread/thr_attr_setdetachstate.c +++ b/lib/libpthread/thread/thr_attr_setdetachstate.c @@ -36,7 +36,8 @@ #include #include "pthread_private.h" -int pthread_attr_setdetachstate(pthread_attr_t *attr, int detachstate) +int +pthread_attr_setdetachstate(pthread_attr_t *attr, int detachstate) { int ret; diff --git a/lib/libpthread/thread/thr_attr_setstackaddr.c b/lib/libpthread/thread/thr_attr_setstackaddr.c index 7eb8c5d1319c..46469e4faf87 100644 --- a/lib/libpthread/thread/thr_attr_setstackaddr.c +++ b/lib/libpthread/thread/thr_attr_setstackaddr.c @@ -36,7 +36,8 @@ #include #include "pthread_private.h" -int pthread_attr_setstackaddr(pthread_attr_t *attr, void *stackaddr) +int +pthread_attr_setstackaddr(pthread_attr_t *attr, void *stackaddr) { int ret; diff --git a/lib/libpthread/thread/thr_attr_setstacksize.c b/lib/libpthread/thread/thr_attr_setstacksize.c index 2a2d85482e0a..3897811bb436 100644 --- a/lib/libpthread/thread/thr_attr_setstacksize.c +++ b/lib/libpthread/thread/thr_attr_setstacksize.c @@ -36,7 +36,8 @@ #include #include "pthread_private.h" -int pthread_attr_setstacksize(pthread_attr_t *attr, size_t stacksize) +int +pthread_attr_setstacksize(pthread_attr_t *attr, size_t stacksize) { int ret; diff --git a/lib/libpthread/thread/thr_close.c b/lib/libpthread/thread/thr_close.c index 2580fcef02c5..fe2d9e2a4622 100644 --- a/lib/libpthread/thread/thr_close.c +++ b/lib/libpthread/thread/thr_close.c @@ -41,7 +41,7 @@ #include "pthread_private.h" int -close(int fd) +_libc_close(int fd) { int flags; int ret; @@ -102,4 +102,6 @@ close(int fd) _thread_leave_cancellation_point(); return (ret); } + +__weak_reference(_libc_close, close); #endif diff --git a/lib/libpthread/thread/thr_exit.c b/lib/libpthread/thread/thr_exit.c index abe4b278861d..57ac1141e251 100644 --- a/lib/libpthread/thread/thr_exit.c +++ b/lib/libpthread/thread/thr_exit.c @@ -41,7 +41,7 @@ #include #include "pthread_private.h" -void _exit(int status) +void _libc__exit(int status) { int flags; int i; @@ -77,6 +77,8 @@ void _exit(int status) _thread_sys__exit(status); } +__weak_reference(_libc__exit, _exit); + void _thread_exit(char *fname, int lineno, char *string) { diff --git a/lib/libpthread/thread/thr_fcntl.c b/lib/libpthread/thread/thr_fcntl.c index 878554cdbc1d..6cd2b12dd5cd 100644 --- a/lib/libpthread/thread/thr_fcntl.c +++ b/lib/libpthread/thread/thr_fcntl.c @@ -39,7 +39,7 @@ #include "pthread_private.h" int -fcntl(int fd, int cmd,...) +_libc_fcntl(int fd, int cmd,...) { int flags = 0; int nonblock; @@ -142,4 +142,6 @@ fcntl(int fd, int cmd,...) /* Return the completion status: */ return (ret); } + +__weak_reference(_libc_fcntl, fcntl); #endif diff --git a/lib/libpthread/thread/thr_fork.c b/lib/libpthread/thread/thr_fork.c index 08ea8129ea71..8c112e8b2796 100644 --- a/lib/libpthread/thread/thr_fork.c +++ b/lib/libpthread/thread/thr_fork.c @@ -41,7 +41,7 @@ #include "pthread_private.h" pid_t -fork(void) +_libc_fork(void) { int i, flags; pid_t ret; @@ -220,4 +220,6 @@ fork(void) /* Return the process ID: */ return (ret); } + +__weak_reference(_libc_fork, fork); #endif diff --git a/lib/libpthread/thread/thr_fsync.c b/lib/libpthread/thread/thr_fsync.c index 21c3b568b44e..048e60b0a91a 100644 --- a/lib/libpthread/thread/thr_fsync.c +++ b/lib/libpthread/thread/thr_fsync.c @@ -37,7 +37,7 @@ #include "pthread_private.h" int -fsync(int fd) +_libc_fsync(int fd) { int ret; @@ -49,4 +49,6 @@ fsync(int fd) _thread_leave_cancellation_point(); return (ret); } + +__weak_reference(_libc_fsync, fsync); #endif diff --git a/lib/libpthread/thread/thr_msync.c b/lib/libpthread/thread/thr_msync.c index 209286d2d1a6..9559ec416291 100644 --- a/lib/libpthread/thread/thr_msync.c +++ b/lib/libpthread/thread/thr_msync.c @@ -13,7 +13,7 @@ #include "pthread_private.h" int -msync(addr, len, flags) +_libc_msync(addr, len, flags) void *addr; size_t len; int flags; @@ -37,4 +37,6 @@ msync(addr, len, flags) return (ret); } + +__weak_reference(_libc_msync, msync); #endif diff --git a/lib/libpthread/thread/thr_multi_np.c b/lib/libpthread/thread/thr_multi_np.c index 39dd948cbc4f..9a2f7c1ece49 100644 --- a/lib/libpthread/thread/thr_multi_np.c +++ b/lib/libpthread/thread/thr_multi_np.c @@ -36,7 +36,8 @@ #include #include "pthread_private.h" -int pthread_multi_np() +int +pthread_multi_np() { /* Return to multi-threaded scheduling mode: */ _thread_single = NULL; diff --git a/lib/libpthread/thread/thr_mutex.c b/lib/libpthread/thread/thr_mutex.c index c625ef26e900..6526a3579c8b 100644 --- a/lib/libpthread/thread/thr_mutex.c +++ b/lib/libpthread/thread/thr_mutex.c @@ -243,7 +243,7 @@ pthread_mutex_destroy(pthread_mutex_t * mutex) } static int -init_static (pthread_mutex_t *mutex) +init_static(pthread_mutex_t *mutex) { int ret; @@ -1219,7 +1219,7 @@ mutex_priority_adjust(pthread_mutex_t mutex) } static void -mutex_rescan_owned (pthread_t pthread, pthread_mutex_t mutex) +mutex_rescan_owned(pthread_t pthread, pthread_mutex_t mutex) { int active_prio, inherited_prio; pthread_mutex_t m; diff --git a/lib/libpthread/thread/thr_mutexattr_destroy.c b/lib/libpthread/thread/thr_mutexattr_destroy.c index 9afebad917d2..6eed2a256019 100644 --- a/lib/libpthread/thread/thr_mutexattr_destroy.c +++ b/lib/libpthread/thread/thr_mutexattr_destroy.c @@ -37,7 +37,8 @@ #include #include "pthread_private.h" -int pthread_mutexattr_destroy(pthread_mutexattr_t *attr) +int +pthread_mutexattr_destroy(pthread_mutexattr_t *attr) { int ret; if (attr == NULL || *attr == NULL) { diff --git a/lib/libpthread/thread/thr_nanosleep.c b/lib/libpthread/thread/thr_nanosleep.c index e4772b4fe2a9..e9052f983480 100644 --- a/lib/libpthread/thread/thr_nanosleep.c +++ b/lib/libpthread/thread/thr_nanosleep.c @@ -38,8 +38,8 @@ #include "pthread_private.h" int -nanosleep(const struct timespec * time_to_sleep, - struct timespec * time_remaining) +_libc_nanosleep(const struct timespec * time_to_sleep, + struct timespec * time_remaining) { int ret = 0; struct timespec current_time; @@ -120,4 +120,6 @@ nanosleep(const struct timespec * time_to_sleep, _thread_leave_cancellation_point(); return (ret); } + +__weak_reference(_libc_nanosleep, nanosleep); #endif diff --git a/lib/libpthread/thread/thr_open.c b/lib/libpthread/thread/thr_open.c index 4e9993eb6585..4bc2f1a513e3 100644 --- a/lib/libpthread/thread/thr_open.c +++ b/lib/libpthread/thread/thr_open.c @@ -42,7 +42,7 @@ #include "pthread_private.h" int -open(const char *path, int flags,...) +_libc_open(const char *path, int flags,...) { int fd; int mode = 0; @@ -74,4 +74,6 @@ open(const char *path, int flags,...) /* Return the file descriptor or -1 on error: */ return (fd); } + +__weak_reference(_libc_open, open); #endif diff --git a/lib/libpthread/thread/thr_poll.c b/lib/libpthread/thread/thr_poll.c index 10a9db74e359..ce2b7af56bc1 100644 --- a/lib/libpthread/thread/thr_poll.c +++ b/lib/libpthread/thread/thr_poll.c @@ -44,7 +44,7 @@ int -poll(struct pollfd *fds, unsigned int nfds, int timeout) +_libc_poll(struct pollfd *fds, unsigned int nfds, int timeout) { struct timespec ts; int numfds = nfds; @@ -96,4 +96,6 @@ poll(struct pollfd *fds, unsigned int nfds, int timeout) return (ret); } + +__weak_reference(_libc_poll, poll); #endif diff --git a/lib/libpthread/thread/thr_read.c b/lib/libpthread/thread/thr_read.c index 8cbb5be7b7b0..ad66df368c25 100644 --- a/lib/libpthread/thread/thr_read.c +++ b/lib/libpthread/thread/thr_read.c @@ -42,7 +42,7 @@ #include "pthread_private.h" ssize_t -read(int fd, void *buf, size_t nbytes) +_libc_read(int fd, void *buf, size_t nbytes) { int ret; int type; @@ -100,4 +100,6 @@ read(int fd, void *buf, size_t nbytes) _thread_leave_cancellation_point(); return (ret); } + +__weak_reference(_libc_read, read); #endif diff --git a/lib/libpthread/thread/thr_readv.c b/lib/libpthread/thread/thr_readv.c index a1a862d42490..c1965d834f8a 100644 --- a/lib/libpthread/thread/thr_readv.c +++ b/lib/libpthread/thread/thr_readv.c @@ -42,7 +42,7 @@ #include "pthread_private.h" ssize_t -readv(int fd, const struct iovec * iov, int iovcnt) +_libc_readv(int fd, const struct iovec * iov, int iovcnt) { int ret; int type; @@ -90,4 +90,6 @@ readv(int fd, const struct iovec * iov, int iovcnt) } return (ret); } + +__weak_reference(_libc_readv, readv); #endif diff --git a/lib/libpthread/thread/thr_rwlockattr.c b/lib/libpthread/thread/thr_rwlockattr.c index 7a56bca7d4ba..37eb3eae66a9 100644 --- a/lib/libpthread/thread/thr_rwlockattr.c +++ b/lib/libpthread/thread/thr_rwlockattr.c @@ -34,7 +34,7 @@ #include "pthread_private.h" int -pthread_rwlockattr_destroy (pthread_rwlockattr_t *rwlockattr) +pthread_rwlockattr_destroy(pthread_rwlockattr_t *rwlockattr) { pthread_rwlockattr_t prwlockattr; @@ -52,7 +52,7 @@ pthread_rwlockattr_destroy (pthread_rwlockattr_t *rwlockattr) } int -pthread_rwlockattr_getpshared (const pthread_rwlockattr_t *rwlockattr, +pthread_rwlockattr_getpshared(const pthread_rwlockattr_t *rwlockattr, int *pshared) { *pshared = (*rwlockattr)->pshared; @@ -61,7 +61,7 @@ pthread_rwlockattr_getpshared (const pthread_rwlockattr_t *rwlockattr, } int -pthread_rwlockattr_init (pthread_rwlockattr_t *rwlockattr) +pthread_rwlockattr_init(pthread_rwlockattr_t *rwlockattr) { pthread_rwlockattr_t prwlockattr; @@ -81,7 +81,7 @@ pthread_rwlockattr_init (pthread_rwlockattr_t *rwlockattr) } int -pthread_rwlockattr_setpshared (pthread_rwlockattr_t *rwlockattr, int pshared) +pthread_rwlockattr_setpshared(pthread_rwlockattr_t *rwlockattr, int pshared) { /* Only PTHREAD_PROCESS_PRIVATE is supported. */ if (pshared != PTHREAD_PROCESS_PRIVATE) diff --git a/lib/libpthread/thread/thr_select.c b/lib/libpthread/thread/thr_select.c index 9bfae89be374..a7ceeccfe8ae 100644 --- a/lib/libpthread/thread/thr_select.c +++ b/lib/libpthread/thread/thr_select.c @@ -45,8 +45,8 @@ #include "pthread_private.h" int -select(int numfds, fd_set * readfds, fd_set * writefds, - fd_set * exceptfds, struct timeval * timeout) +_libc_select(int numfds, fd_set * readfds, fd_set * writefds, fd_set * + exceptfds, struct timeval * timeout) { struct timespec ts; int i, ret = 0, f_wait = 1; @@ -203,4 +203,6 @@ select(int numfds, fd_set * readfds, fd_set * writefds, return (ret); } + +__weak_reference(_libc_select, select); #endif diff --git a/lib/libpthread/thread/thr_sigaction.c b/lib/libpthread/thread/thr_sigaction.c index 7fa8ebff330d..f2f728685ec3 100644 --- a/lib/libpthread/thread/thr_sigaction.c +++ b/lib/libpthread/thread/thr_sigaction.c @@ -38,7 +38,7 @@ #include "pthread_private.h" int -sigaction(int sig, const struct sigaction * act, struct sigaction * oact) +_libc_sigaction(int sig, const struct sigaction * act, struct sigaction * oact) { int ret = 0; struct sigaction gact; @@ -105,4 +105,6 @@ sigaction(int sig, const struct sigaction * act, struct sigaction * oact) /* Return the completion status: */ return (ret); } + +__weak_reference(_libc_sigaction, sigaction); #endif diff --git a/lib/libpthread/thread/thr_sigpending.c b/lib/libpthread/thread/thr_sigpending.c index 2d61e2104788..feb430011c4b 100644 --- a/lib/libpthread/thread/thr_sigpending.c +++ b/lib/libpthread/thread/thr_sigpending.c @@ -38,7 +38,7 @@ #include "pthread_private.h" int -sigpending(sigset_t * set) +_libc_sigpending(sigset_t * set) { int ret = 0; @@ -53,4 +53,6 @@ sigpending(sigset_t * set) /* Return the completion status: */ return (ret); } + +__weak_reference(_libc_sigpending, sigpending); #endif diff --git a/lib/libpthread/thread/thr_sigprocmask.c b/lib/libpthread/thread/thr_sigprocmask.c index 592a61e865eb..28ab4fab7d7d 100644 --- a/lib/libpthread/thread/thr_sigprocmask.c +++ b/lib/libpthread/thread/thr_sigprocmask.c @@ -41,7 +41,7 @@ #include "pthread_private.h" int -sigprocmask(int how, const sigset_t * set, sigset_t * oset) +_libc_sigprocmask(int how, const sigset_t * set, sigset_t * oset) { int ret = 0; @@ -89,4 +89,6 @@ sigprocmask(int how, const sigset_t * set, sigset_t * oset) /* Return the completion status: */ return (ret); } + +__weak_reference(_libc_sigprocmask, sigprocmask); #endif diff --git a/lib/libpthread/thread/thr_sigsuspend.c b/lib/libpthread/thread/thr_sigsuspend.c index ac06ff71ba46..b64897a6f3a1 100644 --- a/lib/libpthread/thread/thr_sigsuspend.c +++ b/lib/libpthread/thread/thr_sigsuspend.c @@ -38,7 +38,7 @@ #include "pthread_private.h" int -sigsuspend(const sigset_t * set) +_libc_sigsuspend(const sigset_t * set) { int ret = -1; sigset_t oset; @@ -67,4 +67,6 @@ sigsuspend(const sigset_t * set) /* Return the completion status: */ return (ret); } + +__weak_reference(_libc_sigsuspend, sigsuspend); #endif diff --git a/lib/libpthread/thread/thr_wait4.c b/lib/libpthread/thread/thr_wait4.c index 4a58a70faf6f..4c3f1dee1a20 100644 --- a/lib/libpthread/thread/thr_wait4.c +++ b/lib/libpthread/thread/thr_wait4.c @@ -38,7 +38,7 @@ #include "pthread_private.h" pid_t -wait4(pid_t pid, int *istat, int options, struct rusage * rusage) +_libc_wait4(pid_t pid, int *istat, int options, struct rusage * rusage) { pid_t ret; @@ -66,4 +66,6 @@ wait4(pid_t pid, int *istat, int options, struct rusage * rusage) return (ret); } + +__weak_reference(_libc_wait4, wait4); #endif diff --git a/lib/libpthread/thread/thr_write.c b/lib/libpthread/thread/thr_write.c index 40c4cc574241..f25c6065b911 100644 --- a/lib/libpthread/thread/thr_write.c +++ b/lib/libpthread/thread/thr_write.c @@ -42,7 +42,7 @@ #include "pthread_private.h" ssize_t -write(int fd, const void *buf, size_t nbytes) +_libc_write(int fd, const void *buf, size_t nbytes) { int blocking; int type; @@ -136,4 +136,6 @@ write(int fd, const void *buf, size_t nbytes) _thread_leave_cancellation_point(); return (ret); } + +__weak_reference(_libc_write, write); #endif diff --git a/lib/libpthread/thread/thr_writev.c b/lib/libpthread/thread/thr_writev.c index 375f59912b6f..74da5219ff92 100644 --- a/lib/libpthread/thread/thr_writev.c +++ b/lib/libpthread/thread/thr_writev.c @@ -44,7 +44,7 @@ #include "pthread_private.h" ssize_t -writev(int fd, const struct iovec * iov, int iovcnt) +_libc_writev(int fd, const struct iovec * iov, int iovcnt) { int blocking; int idx = 0; @@ -200,4 +200,6 @@ writev(int fd, const struct iovec * iov, int iovcnt) return (ret); } + +__weak_reference(_libc_writev, writev); #endif