From 3a581d5e76c368bf4de0ee9c6188aa3f951dd1ef Mon Sep 17 00:00:00 2001 From: Kurt Miller Date: Fri, 27 Apr 2007 18:04:09 +0000 Subject: Remove unused function _thread_fd_unlock_owned() and merge _thread_fd_unlock_thread() into _thread_fd_unlock(). okay marc@ --- lib/libpthread/uthread/pthread_private.h | 4 +-- lib/libpthread/uthread/uthread_fd.c | 48 +++----------------------------- 2 files changed, 5 insertions(+), 47 deletions(-) (limited to 'lib/libpthread') diff --git a/lib/libpthread/uthread/pthread_private.h b/lib/libpthread/uthread/pthread_private.h index 1607525dfeb..15dedb454ca 100644 --- a/lib/libpthread/uthread/pthread_private.h +++ b/lib/libpthread/uthread/pthread_private.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pthread_private.h,v 1.61 2007/04/27 12:59:24 kurt Exp $ */ +/* $OpenBSD: pthread_private.h,v 1.62 2007/04/27 18:04:08 kurt Exp $ */ /* * Copyright (c) 1995-1998 John Birrell . * All rights reserved. @@ -1160,8 +1160,6 @@ void _thread_fs_flags_replace(int, struct fs_flags *); void _thread_fd_init(void); int _thread_fd_table_init(int, enum fd_entry_mode, struct fs_flags *); void _thread_fd_entry_close(int); -void _thread_fd_unlock_owned(pthread_t); -void _thread_fd_unlock_thread(struct pthread *, int, int); pthread_addr_t _thread_gc(pthread_addr_t); void _thread_enter_cancellation_point(void); void _thread_leave_cancellation_point(void); diff --git a/lib/libpthread/uthread/uthread_fd.c b/lib/libpthread/uthread/uthread_fd.c index 632eadcc968..6b22bafd6ec 100644 --- a/lib/libpthread/uthread/uthread_fd.c +++ b/lib/libpthread/uthread/uthread_fd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uthread_fd.c,v 1.28 2007/04/27 12:59:24 kurt Exp $ */ +/* $OpenBSD: uthread_fd.c,v 1.29 2007/04/27 18:04:08 kurt Exp $ */ /* * Copyright (c) 1995-1998 John Birrell * All rights reserved. @@ -488,11 +488,12 @@ _thread_fd_entry_close(int fd) } /* - * Unlock the fd table entry for a given thread, fd, and lock type. + * Unlock an fd table entry for the given fd and lock type. */ void -_thread_fd_unlock_thread(struct pthread *thread, int fd, int lock_type) +_thread_fd_unlock(int fd, int lock_type) { + struct pthread *thread = _get_curthread(); struct fd_table_entry *entry; /* @@ -599,47 +600,6 @@ _thread_fd_unlock_thread(struct pthread *thread, int fd, int lock_type) } } -/* - * Unlock an fd table entry for the given fd and lock type. - */ -void -_thread_fd_unlock(int fd, int lock_type) -{ - struct pthread *curthread = _get_curthread(); - _thread_fd_unlock_thread(curthread, fd, lock_type); -} - -/* - * Unlock all fd table entries owned by the given thread - */ -void -_thread_fd_unlock_owned(pthread_t pthread) -{ - struct fd_table_entry *entry; - int do_unlock; - int fd; - - for (fd = 0; fd < _thread_max_fdtsize; fd++) { - entry = _thread_fd_table[fd]; - if (entry) { - _SPINLOCK(&entry->lock); - do_unlock = 0; - /* force an unlock regardless of the recursion level */ - if (entry->r_owner == pthread) { - entry->r_lockcount = 1; - do_unlock++; - } - if (entry->w_owner == pthread) { - entry->w_lockcount = 1; - do_unlock++; - } - _SPINUNLOCK(&entry->lock); - if (do_unlock) - _thread_fd_unlock_thread(pthread, fd, FD_RDWR); - } - } -} - /* * Lock an fd table entry for the given fd and lock type. */ -- cgit v1.2.3