From 05385aab221ae2f336cb1a11fca17e94d1f03a79 Mon Sep 17 00:00:00 2001 From: jb Date: Tue, 9 Jun 1998 08:32:23 +0000 Subject: Implement compile time debug mode for thread locks. --- lib/libc/gen/_spinlock_stub.c | 10 +++++----- lib/libc/gen/isatty.c | 4 ++-- lib/libc/gen/ttyname.c | 8 ++++---- 3 files changed, 11 insertions(+), 11 deletions(-) (limited to 'lib/libc') diff --git a/lib/libc/gen/_spinlock_stub.c b/lib/libc/gen/_spinlock_stub.c index 5314d85..a189eef 100644 --- a/lib/libc/gen/_spinlock_stub.c +++ b/lib/libc/gen/_spinlock_stub.c @@ -29,7 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: _spinlock_stub.c,v 1.1 1998/03/09 06:46:21 jb Exp $ + * $Id: _spinlock_stub.c,v 1.2 1998/04/29 09:02:16 jb Exp $ * */ @@ -44,21 +44,21 @@ * with libpthread. */ #pragma weak _spinlock=_spinlock_stub -#pragma weak _atomic_unlock=_atomic_unlock_stub +#pragma weak _spinlock_debug=_spinlock_debug_stub /* * This function is a stub for the spinlock function in libpthread. */ void -_spinlock_stub(long *lck) +_spinlock_stub(spinlock_t *lck) { } /* - * This function is a stub for the _atomic_unlock function in libpthread. + * This function is a stub for the debug spinlock function in libpthread. */ void -_atomic_unlock_stub(long *lck) +_spinlock_debug_stub(spinlock_t *lck, char *fname, int lineno) { } #endif diff --git a/lib/libc/gen/isatty.c b/lib/libc/gen/isatty.c index c8356c7..f14f470 100644 --- a/lib/libc/gen/isatty.c +++ b/lib/libc/gen/isatty.c @@ -50,11 +50,11 @@ isatty(fd) struct termios t; #ifdef _THREAD_SAFE - if (_thread_fd_lock(fd, FD_READ, NULL,__FILE__,__LINE__) == 0) { + if (_FD_LOCK(fd, FD_READ, NULL) == 0) { #endif retval = (tcgetattr(fd, &t) != -1); #ifdef _THREAD_SAFE - _thread_fd_unlock(fd, FD_READ); + _FD_UNLOCK(fd, FD_READ); } else { retval = 0; } diff --git a/lib/libc/gen/ttyname.c b/lib/libc/gen/ttyname.c index c768f59..cb01870 100644 --- a/lib/libc/gen/ttyname.c +++ b/lib/libc/gen/ttyname.c @@ -59,9 +59,9 @@ ttyname(int fd) { char *ret; - if (_thread_fd_lock(fd, FD_READ, NULL, __FILE__, __LINE__) == 0) { + if (_FD_LOCK(fd, FD_READ, NULL) == 0) { ret = __ttyname_basic(fd); - _thread_fd_unlock(fd, FD_READ); + _FD_UNLOCK(fd, FD_READ); } else { ret = NULL; } @@ -144,9 +144,9 @@ ttyname_r(int fd, char *buf, size_t len) { char *ret; - if (_thread_fd_lock(fd, FD_READ, NULL, __FILE__, __LINE__) == 0) { + if (_FD_LOCK(fd, FD_READ, NULL) == 0) { ret = __ttyname_r_basic(fd, buf, len); - _thread_fd_unlock(fd, FD_READ); + _FD_UNLOCK(fd, FD_READ); } else { ret = NULL; } -- cgit v1.1