* Updating common/lib * Updating lib/csu * Updating lib/libc * Updating libexec/ld.elf_so * Corrected test on __minix in featuretest to actually follow the meaning of the comment. * Cleaned up _REENTRANT-related defintions. * Disabled -D_REENTRANT for libfetch * Removing some unneeded __NBSD_LIBC defines and tests Change-Id: Ic1394baef74d11b9f86b312f5ff4bbc3cbf72ce2
		
			
				
	
	
		
			44 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			44 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
#ifndef __SPINLOCK_H__
 | 
						|
#define __SPINLOCK_H__
 | 
						|
 | 
						|
#include "kernel/kernel.h"
 | 
						|
 | 
						|
typedef struct spinlock {
 | 
						|
	atomic_t val;
 | 
						|
} spinlock_t;
 | 
						|
 | 
						|
#ifndef CONFIG_SMP
 | 
						|
 | 
						|
#define SPINLOCK_DEFINE(name)
 | 
						|
#define PRIVATE_SPINLOCK_DEFINE(name)
 | 
						|
#define SPINLOCK_DECLARE(name)
 | 
						|
#define spinlock_init(sl)
 | 
						|
#define spinlock_lock(sl)
 | 
						|
#define spinlock_unlock(sl)
 | 
						|
 | 
						|
#else
 | 
						|
 | 
						|
/* SMP */
 | 
						|
#define SPINLOCK_DEFINE(name)	spinlock_t name;
 | 
						|
#define PRIVATE_SPINLOCK_DEFINE(name)	PRIVATE SPINLOCK_DEFINE(name)
 | 
						|
#define SPINLOCK_DECLARE(name)	extern SPINLOCK_DEFINE(name)
 | 
						|
#define spinlock_init(sl) do { (sl)->val = 0; } while (0)
 | 
						|
 | 
						|
#if CONFIG_MAX_CPUS == 1
 | 
						|
#define spinlock_lock(sl)
 | 
						|
#define spinlock_unlock(sl)
 | 
						|
#else
 | 
						|
void arch_spinlock_lock(atomic_t * sl);
 | 
						|
void arch_spinlock_unlock(atomic_t * sl);
 | 
						|
#define spinlock_lock(sl)	arch_spinlock_lock((atomic_t*) sl)
 | 
						|
#define spinlock_unlock(sl)	arch_spinlock_unlock((atomic_t*) sl)
 | 
						|
#endif
 | 
						|
 | 
						|
 | 
						|
#endif /* CONFIG_SMP */
 | 
						|
 | 
						|
#define BKL_LOCK()	spinlock_lock(&big_kernel_lock)
 | 
						|
#define BKL_UNLOCK()	spinlock_unlock(&big_kernel_lock)
 | 
						|
 | 
						|
#endif /* __SPINLOCK_H__ */
 |