From e1153c3e071d32c9511753780aa3821407bc3c9d Mon Sep 17 00:00:00 2001 From: Doug Rabson Date: Fri, 6 Jun 2008 09:09:37 +0000 Subject: [PATCH] MFC: r179358,179434 - make libc's fcntl symbol weak and extend the limited forward ABI compatibility for fcntl to the thread libraries. --- lib/libc/sys/Symbol.map | 1 + lib/libc/sys/fcntl.c | 4 +++- lib/libc_r/uthread/uthread_fcntl.c | 4 +++- lib/libkse/thread/thr_fcntl.c | 3 ++- lib/libthr/thread/thr_syscalls.c | 3 ++- 5 files changed, 11 insertions(+), 4 deletions(-) diff --git a/lib/libc/sys/Symbol.map b/lib/libc/sys/Symbol.map index 6823e64cecec..dfe1b38f5af2 100644 --- a/lib/libc/sys/Symbol.map +++ b/lib/libc/sys/Symbol.map @@ -494,6 +494,7 @@ FBSDprivate_1.0 { __sys_fchown; _fcntl; __sys_fcntl; + __fcntl_compat; _fhopen; __sys_fhopen; _fhstat; diff --git a/lib/libc/sys/fcntl.c b/lib/libc/sys/fcntl.c index 16956db8656d..ca2a4cc1516a 100644 --- a/lib/libc/sys/fcntl.c +++ b/lib/libc/sys/fcntl.c @@ -34,8 +34,10 @@ __FBSDID("$FreeBSD$"); #include #include "libc_private.h" +__weak_reference(__fcntl_compat, fcntl); + int -fcntl(int fd, int cmd, ...) +__fcntl_compat(int fd, int cmd, ...) { va_list args; long arg; diff --git a/lib/libc_r/uthread/uthread_fcntl.c b/lib/libc_r/uthread/uthread_fcntl.c index eaf02e9de10b..81c5d7fa1f49 100644 --- a/lib/libc_r/uthread/uthread_fcntl.c +++ b/lib/libc_r/uthread/uthread_fcntl.c @@ -36,6 +36,8 @@ __weak_reference(__fcntl, fcntl); +extern int __fcntl_compat(int fd, int cmd, ...); + int _fcntl(int fd, int cmd,...) { @@ -124,7 +126,7 @@ _fcntl(int fd, int cmd,...) break; default: /* Might want to make va_arg use a union */ - ret = __sys_fcntl(fd, cmd, va_arg(ap, void *)); + ret = __fcntl_compat(fd, cmd, va_arg(ap, void *)); break; } diff --git a/lib/libkse/thread/thr_fcntl.c b/lib/libkse/thread/thr_fcntl.c index af531b32aac5..c1a7ae98df7d 100644 --- a/lib/libkse/thread/thr_fcntl.c +++ b/lib/libkse/thread/thr_fcntl.c @@ -37,6 +37,7 @@ LT10_COMPAT_PRIVATE(__fcntl); LT10_COMPAT_DEFAULT(fcntl); +extern int __fcntl_compat(int fd, int cmd,...); __weak_reference(__fcntl, fcntl); @@ -68,7 +69,7 @@ __fcntl(int fd, int cmd,...) ret = __sys_fcntl(fd, cmd); break; default: - ret = __sys_fcntl(fd, cmd, va_arg(ap, void *)); + ret = __fcntl_compat(fd, cmd, va_arg(ap, void *)); } va_end(ap); diff --git a/lib/libthr/thread/thr_syscalls.c b/lib/libthr/thread/thr_syscalls.c index 74a095010029..386d159ed1dd 100644 --- a/lib/libthr/thread/thr_syscalls.c +++ b/lib/libthr/thread/thr_syscalls.c @@ -132,6 +132,7 @@ int __aio_suspend(const struct aiocb * const iocbs[], int, int __close(int); int __connect(int, const struct sockaddr *, socklen_t); int __fcntl(int, int,...); +extern int __fcntl_compat(int, int,...); int __fsync(int); int __msync(void *, size_t, int); int __nanosleep(const struct timespec *, struct timespec *); @@ -253,7 +254,7 @@ __fcntl(int fd, int cmd,...) ret = __sys_fcntl(fd, cmd); break; default: - ret = __sys_fcntl(fd, cmd, va_arg(ap, void *)); + ret = __fcntl_compat(fd, cmd, va_arg(ap, void *)); } va_end(ap);