134378Sjb/* 234378Sjb * Copyright (c) 1998 John Birrell <jb@cimlogic.com.au>. 334378Sjb * All rights reserved. 434378Sjb * 534378Sjb * Redistribution and use in source and binary forms, with or without 634378Sjb * modification, are permitted provided that the following conditions 734378Sjb * are met: 834378Sjb * 1. Redistributions of source code must retain the above copyright 934378Sjb * notice, this list of conditions and the following disclaimer. 1034378Sjb * 2. Redistributions in binary form must reproduce the above copyright 1134378Sjb * notice, this list of conditions and the following disclaimer in the 1234378Sjb * documentation and/or other materials provided with the distribution. 13165968Simp * 3. Neither the name of the author nor the names of any co-contributors 1434378Sjb * may be used to endorse or promote products derived from this software 1534378Sjb * without specific prior written permission. 1634378Sjb * 1734378Sjb * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND 1834378Sjb * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1934378Sjb * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2034378Sjb * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 2134378Sjb * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2234378Sjb * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2334378Sjb * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2434378Sjb * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2534378Sjb * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2634378Sjb * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2734378Sjb * SUCH DAMAGE. 2834378Sjb */ 2934378Sjb 3090039Sobrien#include <sys/cdefs.h> 3190039Sobrien__FBSDID("$FreeBSD$"); 3290039Sobrien 3334378Sjb#include <stdio.h> 3435500Sjb 3534378Sjb#include "spinlock.h" 3634378Sjb 37205996Sdelphijlong _atomic_lock_stub(volatile long *); 38205996Sdelphijvoid _spinlock_stub(spinlock_t *); 39205996Sdelphijvoid _spinunlock_stub(spinlock_t *); 40205996Sdelphijvoid _spinlock_debug_stub(spinlock_t *, char *, int); 41205996Sdelphij 4234378Sjb/* 4371579Sdeischen * Declare weak definitions in case the application is not linked 4434378Sjb * with libpthread. 4534378Sjb */ 4675368Sdeischen__weak_reference(_atomic_lock_stub, _atomic_lock); 4775368Sdeischen__weak_reference(_spinlock_stub, _spinlock); 48156614Sdeischen__weak_reference(_spinunlock_stub, _spinunlock); 4975368Sdeischen__weak_reference(_spinlock_debug_stub, _spinlock_debug); 5034378Sjb 5134378Sjb/* 5271579Sdeischen * This function is a stub for the _atomic_lock function in libpthread. 5371579Sdeischen */ 5471579Sdeischenlong 55205996Sdelphij_atomic_lock_stub(volatile long *lck __unused) 5671579Sdeischen{ 5771579Sdeischen return (0L); 5871579Sdeischen} 5971579Sdeischen 6071579Sdeischen 6171579Sdeischen/* 6234378Sjb * This function is a stub for the spinlock function in libpthread. 6334378Sjb */ 6434378Sjbvoid 65205996Sdelphij_spinlock_stub(spinlock_t *lck __unused) 6634378Sjb{ 6734378Sjb} 6834378Sjb 6934378Sjb/* 70112665Sjeff * This function is a stub for the spinunlock function in libpthread. 71112665Sjeff */ 72112665Sjeffvoid 73205996Sdelphij_spinunlock_stub(spinlock_t *lck __unused) 74112665Sjeff{ 75112665Sjeff} 76112665Sjeff 77112665Sjeff/* 7836805Sjb * This function is a stub for the debug spinlock function in libpthread. 7934378Sjb */ 8034378Sjbvoid 81205996Sdelphij_spinlock_debug_stub(spinlock_t *lck __unused, char *fname __unused, int lineno __unused) 8234378Sjb{ 8334378Sjb} 84