xref: /freebsd/lib/libc/gen/_spinlock_stub.c (revision 9fd9d097aab4e369244ee67564c28467136a6b7f)
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.
137dcf45c0SWarner Losh  * 3. Neither the name of the author nor the names of any co-contributors
141b5fef40SJohn Birrell  *    may be used to endorse or promote products derived from this software
151b5fef40SJohn Birrell  *    without specific prior written permission.
161b5fef40SJohn Birrell  *
171b5fef40SJohn Birrell  * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
181b5fef40SJohn Birrell  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
191b5fef40SJohn Birrell  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
201b5fef40SJohn Birrell  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
211b5fef40SJohn Birrell  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
221b5fef40SJohn Birrell  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
231b5fef40SJohn Birrell  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
241b5fef40SJohn Birrell  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
251b5fef40SJohn Birrell  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
261b5fef40SJohn Birrell  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
271b5fef40SJohn Birrell  * SUCH DAMAGE.
281b5fef40SJohn Birrell  */
291b5fef40SJohn Birrell 
30ea8d448aSDavid E. O'Brien #include <sys/cdefs.h>
31ea8d448aSDavid E. O'Brien __FBSDID("$FreeBSD$");
32ea8d448aSDavid E. O'Brien 
331b5fef40SJohn Birrell #include <stdio.h>
34f0f62729SJohn Birrell 
351b5fef40SJohn Birrell #include "spinlock.h"
361b5fef40SJohn Birrell 
379fd9d097SXin LI long _atomic_lock_stub(volatile long *);
389fd9d097SXin LI void _spinlock_stub(spinlock_t *);
399fd9d097SXin LI void _spinunlock_stub(spinlock_t *);
409fd9d097SXin LI void _spinlock_debug_stub(spinlock_t *, char *, int);
419fd9d097SXin LI 
421b5fef40SJohn Birrell /*
43d201fe46SDaniel Eischen  * Declare weak definitions in case the application is not linked
441b5fef40SJohn Birrell  * with libpthread.
451b5fef40SJohn Birrell  */
4654fd7f68SDaniel Eischen __weak_reference(_atomic_lock_stub, _atomic_lock);
4754fd7f68SDaniel Eischen __weak_reference(_spinlock_stub, _spinlock);
48e6f18831SDaniel Eischen __weak_reference(_spinunlock_stub, _spinunlock);
4954fd7f68SDaniel Eischen __weak_reference(_spinlock_debug_stub, _spinlock_debug);
5054fd7f68SDaniel Eischen 
511b5fef40SJohn Birrell /*
52d201fe46SDaniel Eischen  * This function is a stub for the _atomic_lock function in libpthread.
53d201fe46SDaniel Eischen  */
54d201fe46SDaniel Eischen long
559fd9d097SXin LI _atomic_lock_stub(volatile long *lck __unused)
56d201fe46SDaniel Eischen {
57d201fe46SDaniel Eischen 	return (0L);
58d201fe46SDaniel Eischen }
59d201fe46SDaniel Eischen 
60d201fe46SDaniel Eischen 
61d201fe46SDaniel Eischen /*
621b5fef40SJohn Birrell  * This function is a stub for the spinlock function in libpthread.
631b5fef40SJohn Birrell  */
641b5fef40SJohn Birrell void
659fd9d097SXin LI _spinlock_stub(spinlock_t *lck __unused)
661b5fef40SJohn Birrell {
671b5fef40SJohn Birrell }
681b5fef40SJohn Birrell 
691b5fef40SJohn Birrell /*
70cc3521d6SJeff Roberson  * This function is a stub for the spinunlock function in libpthread.
71cc3521d6SJeff Roberson  */
72cc3521d6SJeff Roberson void
739fd9d097SXin LI _spinunlock_stub(spinlock_t *lck __unused)
74cc3521d6SJeff Roberson {
75cc3521d6SJeff Roberson }
76cc3521d6SJeff Roberson 
77cc3521d6SJeff Roberson /*
7886af3ff9SJohn Birrell  * This function is a stub for the debug spinlock function in libpthread.
791b5fef40SJohn Birrell  */
801b5fef40SJohn Birrell void
819fd9d097SXin LI _spinlock_debug_stub(spinlock_t *lck __unused, char *fname __unused, int lineno __unused)
821b5fef40SJohn Birrell {
831b5fef40SJohn Birrell }
84