summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Leonard <d@cvs.openbsd.org>1998-12-18 05:59:19 +0000
committerDavid Leonard <d@cvs.openbsd.org>1998-12-18 05:59:19 +0000
commit771cd4d45afd115c066de4b2682205453eac6929 (patch)
treee2ae5cb642c37fae767bd3a272e68c5a19df7cfa
parente5f6128f61a9a572c57cf04778f5616489f2e752 (diff)
add md _atomic_is_locked; clean
-rw-r--r--lib/libc/include/spinlock.h5
-rw-r--r--lib/libc_r/arch/alpha/_atomic_lock.c13
-rw-r--r--lib/libc_r/arch/i386/_atomic_lock.c11
-rw-r--r--lib/libc_r/arch/m68k/_atomic_lock.c10
-rw-r--r--lib/libc_r/arch/mips/_atomic_lock.c10
-rw-r--r--lib/libc_r/arch/sparc/_atomic_lock.c13
-rw-r--r--lib/libpthread/arch/alpha/_atomic_lock.c13
-rw-r--r--lib/libpthread/arch/i386/_atomic_lock.c11
-rw-r--r--lib/libpthread/arch/m68k/_atomic_lock.c10
-rw-r--r--lib/libpthread/arch/mips/_atomic_lock.c10
-rw-r--r--lib/libpthread/arch/sparc/_atomic_lock.c13
11 files changed, 101 insertions, 18 deletions
diff --git a/lib/libc/include/spinlock.h b/lib/libc/include/spinlock.h
index e4871f9aede..31e7744f0af 100644
--- a/lib/libc/include/spinlock.h
+++ b/lib/libc/include/spinlock.h
@@ -29,8 +29,8 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: spinlock.h,v 1.1 1998/11/20 11:18:41 d Exp $
- * $OpenBSD: spinlock.h,v 1.1 1998/11/20 11:18:41 d Exp $
+ * $Id: spinlock.h,v 1.2 1998/12/18 05:59:17 d Exp $
+ * $OpenBSD: spinlock.h,v 1.2 1998/12/18 05:59:17 d Exp $
*
* Lock definitions used in both libc and libpthread.
*
@@ -65,6 +65,7 @@ typedef struct {
*/
__BEGIN_DECLS
register_t _atomic_lock __P((volatile register_t *));
+int _atomic_is_locked __P((volatile register_t *));
register_t _thread_slow_atomic_lock __P((volatile register_t *));
void _spinlock __P((spinlock_t *));
void _spinlock_debug __P((spinlock_t *, const char *, int));
diff --git a/lib/libc_r/arch/alpha/_atomic_lock.c b/lib/libc_r/arch/alpha/_atomic_lock.c
index 74575fc11d7..b12bc32d94a 100644
--- a/lib/libc_r/arch/alpha/_atomic_lock.c
+++ b/lib/libc_r/arch/alpha/_atomic_lock.c
@@ -1,5 +1,7 @@
-/* $OpenBSD: _atomic_lock.c,v 1.1 1998/11/20 11:15:35 d Exp $ */
-/* Atomic lock for alpha */
+/* $OpenBSD: _atomic_lock.c,v 1.2 1998/12/18 05:59:17 d Exp $ */
+/*
+ * Atomic lock for alpha
+ */
#include "spinlock.h"
@@ -31,3 +33,10 @@ _atomic_lock(volatile register_t * lock)
return old;
}
+
+int
+_atomic_is_locked(volatile register_t * lock)
+{
+
+ return *lock;
+}
diff --git a/lib/libc_r/arch/i386/_atomic_lock.c b/lib/libc_r/arch/i386/_atomic_lock.c
index 609dc42fb01..8ddcb33068e 100644
--- a/lib/libc_r/arch/i386/_atomic_lock.c
+++ b/lib/libc_r/arch/i386/_atomic_lock.c
@@ -1,6 +1,6 @@
-/* $OpenBSD: _atomic_lock.c,v 1.1 1998/11/20 11:15:36 d Exp $ */
+/* $OpenBSD: _atomic_lock.c,v 1.2 1998/12/18 05:59:17 d Exp $ */
/*
- * Atomic lock aquire for i386.
+ * Atomic lock for i386
*/
#include "spinlock.h"
@@ -24,3 +24,10 @@ _atomic_lock(volatile register_t *lock)
*/
return old;
}
+
+int
+_atomic_is_locked(volatile register_t *lock)
+{
+
+ return *lock;
+}
diff --git a/lib/libc_r/arch/m68k/_atomic_lock.c b/lib/libc_r/arch/m68k/_atomic_lock.c
index be874ad2892..d0e2ddbe2d6 100644
--- a/lib/libc_r/arch/m68k/_atomic_lock.c
+++ b/lib/libc_r/arch/m68k/_atomic_lock.c
@@ -1,7 +1,8 @@
-/* $OpenBSD: _atomic_lock.c,v 1.1 1998/11/20 11:15:36 d Exp $ */
+/* $OpenBSD: _atomic_lock.c,v 1.2 1998/12/18 05:59:17 d Exp $ */
/*
* Atomic lock for m68k
*/
+
#include "spinlock.h"
register_t
@@ -25,3 +26,10 @@ _atomic_lock(volatile register_t *lock)
: "d"(1), "0"(old));
return old;
}
+
+int
+_atomic_lock(volatile register_t *lock)
+{
+
+ return *lock;
+}
diff --git a/lib/libc_r/arch/mips/_atomic_lock.c b/lib/libc_r/arch/mips/_atomic_lock.c
index 088d4a7a643..4df2a99ad85 100644
--- a/lib/libc_r/arch/mips/_atomic_lock.c
+++ b/lib/libc_r/arch/mips/_atomic_lock.c
@@ -1,7 +1,8 @@
-/* $OpenBSD: _atomic_lock.c,v 1.1 1998/11/20 11:15:37 d Exp $ */
+/* $OpenBSD: _atomic_lock.c,v 1.2 1998/12/18 05:59:18 d Exp $ */
/*
* Atomic lock for mips
*/
+
#include "pthread_private.h"
#include "spinlock.h"
#include <signal.h>
@@ -49,3 +50,10 @@ _atomic_lock(volatile register_t *lock)
#endif
return old;
}
+
+int
+_atomic_is_locked(volatile register_t * lock)
+{
+
+ return *lock;
+}
diff --git a/lib/libc_r/arch/sparc/_atomic_lock.c b/lib/libc_r/arch/sparc/_atomic_lock.c
index 35b50e3ada5..530c86b4805 100644
--- a/lib/libc_r/arch/sparc/_atomic_lock.c
+++ b/lib/libc_r/arch/sparc/_atomic_lock.c
@@ -1,5 +1,7 @@
-/* $OpenBSD */
-/* atomic lock for sparc */
+/* $OpenBSD: _atomic_lock.c,v 1.2 1998/12/18 05:59:18 d Exp $ */
+/*
+ * Atomic lock for sparc
+ */
#include "spinlock.h"
@@ -8,3 +10,10 @@ _atomic_lock(volatile register_t * lock)
{
return _thread_slow_atomic_lock(lock);
}
+
+int
+_atomic_is_locked(volatile register_t * lock)
+{
+
+ return *lock;
+}
diff --git a/lib/libpthread/arch/alpha/_atomic_lock.c b/lib/libpthread/arch/alpha/_atomic_lock.c
index 74575fc11d7..b12bc32d94a 100644
--- a/lib/libpthread/arch/alpha/_atomic_lock.c
+++ b/lib/libpthread/arch/alpha/_atomic_lock.c
@@ -1,5 +1,7 @@
-/* $OpenBSD: _atomic_lock.c,v 1.1 1998/11/20 11:15:35 d Exp $ */
-/* Atomic lock for alpha */
+/* $OpenBSD: _atomic_lock.c,v 1.2 1998/12/18 05:59:17 d Exp $ */
+/*
+ * Atomic lock for alpha
+ */
#include "spinlock.h"
@@ -31,3 +33,10 @@ _atomic_lock(volatile register_t * lock)
return old;
}
+
+int
+_atomic_is_locked(volatile register_t * lock)
+{
+
+ return *lock;
+}
diff --git a/lib/libpthread/arch/i386/_atomic_lock.c b/lib/libpthread/arch/i386/_atomic_lock.c
index 609dc42fb01..8ddcb33068e 100644
--- a/lib/libpthread/arch/i386/_atomic_lock.c
+++ b/lib/libpthread/arch/i386/_atomic_lock.c
@@ -1,6 +1,6 @@
-/* $OpenBSD: _atomic_lock.c,v 1.1 1998/11/20 11:15:36 d Exp $ */
+/* $OpenBSD: _atomic_lock.c,v 1.2 1998/12/18 05:59:17 d Exp $ */
/*
- * Atomic lock aquire for i386.
+ * Atomic lock for i386
*/
#include "spinlock.h"
@@ -24,3 +24,10 @@ _atomic_lock(volatile register_t *lock)
*/
return old;
}
+
+int
+_atomic_is_locked(volatile register_t *lock)
+{
+
+ return *lock;
+}
diff --git a/lib/libpthread/arch/m68k/_atomic_lock.c b/lib/libpthread/arch/m68k/_atomic_lock.c
index be874ad2892..d0e2ddbe2d6 100644
--- a/lib/libpthread/arch/m68k/_atomic_lock.c
+++ b/lib/libpthread/arch/m68k/_atomic_lock.c
@@ -1,7 +1,8 @@
-/* $OpenBSD: _atomic_lock.c,v 1.1 1998/11/20 11:15:36 d Exp $ */
+/* $OpenBSD: _atomic_lock.c,v 1.2 1998/12/18 05:59:17 d Exp $ */
/*
* Atomic lock for m68k
*/
+
#include "spinlock.h"
register_t
@@ -25,3 +26,10 @@ _atomic_lock(volatile register_t *lock)
: "d"(1), "0"(old));
return old;
}
+
+int
+_atomic_lock(volatile register_t *lock)
+{
+
+ return *lock;
+}
diff --git a/lib/libpthread/arch/mips/_atomic_lock.c b/lib/libpthread/arch/mips/_atomic_lock.c
index 088d4a7a643..4df2a99ad85 100644
--- a/lib/libpthread/arch/mips/_atomic_lock.c
+++ b/lib/libpthread/arch/mips/_atomic_lock.c
@@ -1,7 +1,8 @@
-/* $OpenBSD: _atomic_lock.c,v 1.1 1998/11/20 11:15:37 d Exp $ */
+/* $OpenBSD: _atomic_lock.c,v 1.2 1998/12/18 05:59:18 d Exp $ */
/*
* Atomic lock for mips
*/
+
#include "pthread_private.h"
#include "spinlock.h"
#include <signal.h>
@@ -49,3 +50,10 @@ _atomic_lock(volatile register_t *lock)
#endif
return old;
}
+
+int
+_atomic_is_locked(volatile register_t * lock)
+{
+
+ return *lock;
+}
diff --git a/lib/libpthread/arch/sparc/_atomic_lock.c b/lib/libpthread/arch/sparc/_atomic_lock.c
index 35b50e3ada5..530c86b4805 100644
--- a/lib/libpthread/arch/sparc/_atomic_lock.c
+++ b/lib/libpthread/arch/sparc/_atomic_lock.c
@@ -1,5 +1,7 @@
-/* $OpenBSD */
-/* atomic lock for sparc */
+/* $OpenBSD: _atomic_lock.c,v 1.2 1998/12/18 05:59:18 d Exp $ */
+/*
+ * Atomic lock for sparc
+ */
#include "spinlock.h"
@@ -8,3 +10,10 @@ _atomic_lock(volatile register_t * lock)
{
return _thread_slow_atomic_lock(lock);
}
+
+int
+_atomic_is_locked(volatile register_t * lock)
+{
+
+ return *lock;
+}