11b5fef40SJohn Birrell /* 21b5fef40SJohn Birrell * Copyright (c) 1998 John Birrell <jb@cimlogic.com.au>. 31b5fef40SJohn Birrell * All rights reserved. 41b5fef40SJohn Birrell * 51b5fef40SJohn Birrell * Redistribution and use in source and binary forms, with or without 61b5fef40SJohn Birrell * modification, are permitted provided that the following conditions 71b5fef40SJohn Birrell * are met: 81b5fef40SJohn Birrell * 1. Redistributions of source code must retain the above copyright 91b5fef40SJohn Birrell * notice, this list of conditions and the following disclaimer. 101b5fef40SJohn Birrell * 2. Redistributions in binary form must reproduce the above copyright 111b5fef40SJohn Birrell * notice, this list of conditions and the following disclaimer in the 121b5fef40SJohn Birrell * documentation and/or other materials provided with the distribution. 131b5fef40SJohn Birrell * 3. All advertising materials mentioning features or use of this software 141b5fef40SJohn Birrell * must display the following acknowledgement: 151b5fef40SJohn Birrell * This product includes software developed by John Birrell. 161b5fef40SJohn Birrell * 4. Neither the name of the author nor the names of any co-contributors 171b5fef40SJohn Birrell * may be used to endorse or promote products derived from this software 181b5fef40SJohn Birrell * without specific prior written permission. 191b5fef40SJohn Birrell * 201b5fef40SJohn Birrell * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND 211b5fef40SJohn Birrell * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 221b5fef40SJohn Birrell * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 231b5fef40SJohn Birrell * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 241b5fef40SJohn Birrell * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 251b5fef40SJohn Birrell * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 261b5fef40SJohn Birrell * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 271b5fef40SJohn Birrell * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 281b5fef40SJohn Birrell * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 291b5fef40SJohn Birrell * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 301b5fef40SJohn Birrell * SUCH DAMAGE. 311b5fef40SJohn Birrell * 327f3dea24SPeter Wemm * $FreeBSD$ 331b5fef40SJohn Birrell * 341b5fef40SJohn Birrell */ 351b5fef40SJohn Birrell 361b5fef40SJohn Birrell #include <stdio.h> 37f0f62729SJohn Birrell 381b5fef40SJohn Birrell #include "spinlock.h" 391b5fef40SJohn Birrell 401b5fef40SJohn Birrell /* 41d201fe46SDaniel Eischen * Declare weak definitions in case the application is not linked 421b5fef40SJohn Birrell * with libpthread. 431b5fef40SJohn Birrell */ 44d201fe46SDaniel Eischen #pragma weak _atomic_lock=_atomic_lock_stub 451b5fef40SJohn Birrell #pragma weak _spinlock=_spinlock_stub 4686af3ff9SJohn Birrell #pragma weak _spinlock_debug=_spinlock_debug_stub 471b5fef40SJohn Birrell 481b5fef40SJohn Birrell /* 49d201fe46SDaniel Eischen * This function is a stub for the _atomic_lock function in libpthread. 50d201fe46SDaniel Eischen */ 51d201fe46SDaniel Eischen long 52d201fe46SDaniel Eischen _atomic_lock_stub(volatile long *lck) 53d201fe46SDaniel Eischen { 54d201fe46SDaniel Eischen return (0L); 55d201fe46SDaniel Eischen } 56d201fe46SDaniel Eischen 57d201fe46SDaniel Eischen 58d201fe46SDaniel Eischen /* 591b5fef40SJohn Birrell * This function is a stub for the spinlock function in libpthread. 601b5fef40SJohn Birrell */ 611b5fef40SJohn Birrell void 6286af3ff9SJohn Birrell _spinlock_stub(spinlock_t *lck) 631b5fef40SJohn Birrell { 641b5fef40SJohn Birrell } 651b5fef40SJohn Birrell 661b5fef40SJohn Birrell /* 6786af3ff9SJohn Birrell * This function is a stub for the debug spinlock function in libpthread. 681b5fef40SJohn Birrell */ 691b5fef40SJohn Birrell void 7086af3ff9SJohn Birrell _spinlock_debug_stub(spinlock_t *lck, char *fname, int lineno) 711b5fef40SJohn Birrell { 721b5fef40SJohn Birrell } 73