smbfs_rwlock.c revision 4bff34e37def8a90f9194d81bc345c52ba20086a
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * CDDL HEADER START
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * The contents of this file are subject to the terms of the
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * Common Development and Distribution License (the "License").
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * You may not use this file except in compliance with the License.
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * See the License for the specific language governing permissions
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * and limitations under the License.
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * When distributing Covered Code, include this CDDL HEADER in each
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * If applicable, add the following below this CDDL HEADER, with the
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * fields enclosed by brackets "[]" replaced with your own identifying
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * information: Portions Copyright [yyyy] [name of copyright owner]
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * CDDL HEADER END
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * Use is subject to license terms.
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * Copyright (c) 1983,1984,1985,1986,1987,1988,1989 AT&T.
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * All rights reserved.
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync#pragma ident "%Z%%M% %I% %E% SMI"
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * A homegrown reader/writer lock implementation. It addresses
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * two requirements not addressed by the system primitives. They
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * are that the `enter" operation is optionally interruptible and
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * that that they can be re`enter'ed by writers without deadlock.
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * All of this was borrowed from NFS.
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * XXX: Could we make this serve our needs instead?
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * (and then use it for NFS too)
l->count--;
if (intr) {
return (EINTR);
#ifdef SMBDEBUG
l->count++;
l->waiters++;
if (intr) {
l->waiters--;
return (EINTR);
l->waiters--;
l->count--;
l->count--;
l->count++;
l->count--;
l->count++;
if (l->count == 0) {
l->count--;
return (l->count > 0);
return (l->count < 0);
l->count = 0;
l->waiters = 0;