From owner-freebsd-arch Fri Mar 15 8:31: 8 2002 Delivered-To: freebsd-arch@freebsd.org Received: from smtp.bsdhome.com (rdu25-2-113.nc.rr.com [24.25.2.113]) by hub.freebsd.org (Postfix) with ESMTP id 46BB137B402 for ; Fri, 15 Mar 2002 08:31:00 -0800 (PST) Received: from neutrino.bsdhome.com (jupiter [192.168.220.13]) by smtp.bsdhome.com (8.11.3nb1/8.11.4) with ESMTP id g2FGUxd03503 for ; Fri, 15 Mar 2002 11:30:59 -0500 (EST) Received: (from bsd@localhost) by neutrino.bsdhome.com (8.11.6/8.11.6) id g2FGUro48766; Fri, 15 Mar 2002 11:30:53 -0500 (EST) (envelope-from bsd) Date: Fri, 15 Mar 2002 11:30:53 -0500 From: Brian Dean To: freebsd-arch@freebsd.org Subject: uthread patch to correct the return code for pthread_rwlock_tryXXlock() Message-ID: <20020315113053.A48681@neutrino.bsdhome.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5.1i Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Hi, The man pages for pthread_rwlock_trywrlock() and pthread_rwlock_tryrdlock() say that EBUSY is returned when the calling thread is not able to aquire the lock without blocking. However, the actual functions return EWOULDBLOCK. I believe the man page is correct (Solaris and others, at least, return EBUSY). Unless there are objections, I plan on committing the attached patch to correct the code. Thanks, -Brian -- Brian Dean bsd@FreeBSD.org bsd@bsdhome.com Index: uthread_rwlock.c =================================================================== RCS file: /home/ncvs/src/lib/libc_r/uthread/uthread_rwlock.c,v retrieving revision 1.6 diff -u -r1.6 uthread_rwlock.c --- uthread_rwlock.c 10 Apr 2001 04:19:20 -0000 1.6 +++ uthread_rwlock.c 15 Mar 2002 16:21:54 -0000 @@ -209,7 +209,7 @@ /* give writers priority over readers */ if (prwlock->blocked_writers || prwlock->state < 0) - ret = EWOULDBLOCK; + ret = EBUSY; else if (prwlock->state == MAX_READ_LOCKS) ret = EAGAIN; /* too many read locks acquired */ else @@ -245,7 +245,7 @@ return(ret); if (prwlock->state != 0) - ret = EWOULDBLOCK; + ret = EBUSY; else /* indicate we are locked for writing */ prwlock->state = -1; To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message