Deleted Added
full compact
lockmgr.h (70141) lockmgr.h (71576)
1/*
2 * Copyright (c) 1995
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code contains ideas from software contributed to Berkeley by
6 * Avadis Tevanian, Jr., Michael Wayne Young, and the Mach Operating
7 * System project at Carnegie-Mellon University.
8 *

--- 21 unchanged lines hidden (view full) ---

30 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
31 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
34 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35 * SUCH DAMAGE.
36 *
37 * @(#)lock.h 8.12 (Berkeley) 5/19/95
1/*
2 * Copyright (c) 1995
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code contains ideas from software contributed to Berkeley by
6 * Avadis Tevanian, Jr., Michael Wayne Young, and the Mach Operating
7 * System project at Carnegie-Mellon University.
8 *

--- 21 unchanged lines hidden (view full) ---

30 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
31 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
34 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35 * SUCH DAMAGE.
36 *
37 * @(#)lock.h 8.12 (Berkeley) 5/19/95
38 * $FreeBSD: head/sys/sys/lockmgr.h 70140 2000-12-18 05:50:31Z jake $
38 * $FreeBSD: head/sys/sys/lockmgr.h 71576 2001-01-24 12:35:55Z jasone $
39 */
40
41#ifndef _LOCK_H_
42#define _LOCK_H_
43
44#include <machine/lock.h>
45
46struct mtx;
47
48/*
49 * The general lock structure. Provides for multiple shared locks,
50 * upgrading from shared to exclusive, and sleeping until the lock
39 */
40
41#ifndef _LOCK_H_
42#define _LOCK_H_
43
44#include <machine/lock.h>
45
46struct mtx;
47
48/*
49 * The general lock structure. Provides for multiple shared locks,
50 * upgrading from shared to exclusive, and sleeping until the lock
51 * can be gained. The simple locks are defined in <machine/param.h>.
51 * can be gained.
52 */
53struct lock {
54 struct mtx *lk_interlock; /* lock on remaining fields */
55 u_int lk_flags; /* see below */
56 int lk_sharecount; /* # of accepted shared locks */
57 int lk_waitcount; /* # of processes sleeping for lock */
58 short lk_exclusivecount; /* # of recursive exclusive locks */
59 short lk_prio; /* priority at which to sleep */

--- 156 unchanged lines hidden (view full) ---

216#else
217int lockmgr __P((struct lock *, u_int flags,
218 struct mtx *, struct proc *p));
219#endif
220void lockmgr_printinfo __P((struct lock *));
221int lockstatus __P((struct lock *, struct proc *));
222int lockcount __P((struct lock *));
223
52 */
53struct lock {
54 struct mtx *lk_interlock; /* lock on remaining fields */
55 u_int lk_flags; /* see below */
56 int lk_sharecount; /* # of accepted shared locks */
57 int lk_waitcount; /* # of processes sleeping for lock */
58 short lk_exclusivecount; /* # of recursive exclusive locks */
59 short lk_prio; /* priority at which to sleep */

--- 156 unchanged lines hidden (view full) ---

216#else
217int lockmgr __P((struct lock *, u_int flags,
218 struct mtx *, struct proc *p));
219#endif
220void lockmgr_printinfo __P((struct lock *));
221int lockstatus __P((struct lock *, struct proc *));
222int lockcount __P((struct lock *));
223
224#ifdef SIMPLELOCK_DEBUG
225void _simple_unlock __P((struct simplelock *alp, const char *, int));
226#define simple_unlock(alp) _simple_unlock(alp, __FILE__, __LINE__)
227int _simple_lock_try __P((struct simplelock *alp, const char *, int));
228#define simple_lock_try(alp) _simple_lock_try(alp, __FILE__, __LINE__)
229void _simple_lock __P((struct simplelock *alp, const char *, int));
230#define simple_lock(alp) _simple_lock(alp, __FILE__, __LINE__)
231void simple_lock_init __P((struct simplelock *alp));
232#else /* !SIMPLELOCK_DEBUG */
233#if MAXCPU == 1 /* no multiprocessor locking is necessary */
234#define NULL_SIMPLELOCKS
235#define simple_lock_init(alp)
236#define simple_lock(alp)
237#define simple_lock_try(alp) (1) /* always succeeds */
238#define simple_unlock(alp)
239#endif /* MAXCPU == 1 */
240#endif /* !SIMPLELOCK_DEBUG */
241
242#endif /* !_LOCK_H_ */
224#endif /* !_LOCK_H_ */