| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: mutex_impl.h,v 1.1 2010/02/21 01:46:36 darran Exp $ */ | | 1 | /* $NetBSD: mutex_impl.h,v 1.2 2021/03/29 01:43:18 simonb Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 2010 The NetBSD Foundation, Inc. | | 4 | * Copyright (c) 2010 The NetBSD Foundation, Inc. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * This code is derived from software contributed to The NetBSD Foundation | | 7 | * This code is derived from software contributed to The NetBSD Foundation |
8 | * by Jason R. Thorpe and Andrew Doran. | | 8 | * by Jason R. Thorpe and Andrew Doran. |
9 | * | | 9 | * |
10 | * Redistribution and use in source and binary forms, with or without | | 10 | * Redistribution and use in source and binary forms, with or without |
11 | * modification, are permitted provided that the following conditions | | 11 | * modification, are permitted provided that the following conditions |
12 | * are met: | | 12 | * are met: |
13 | * 1. Redistributions of source code must retain the above copyright | | 13 | * 1. Redistributions of source code must retain the above copyright |
14 | * notice, this list of conditions and the following disclaimer. | | 14 | * notice, this list of conditions and the following disclaimer. |
| @@ -25,24 +25,23 @@ | | | @@ -25,24 +25,23 @@ |
25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | | 25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | | 26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | | 27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | | 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
29 | * POSSIBILITY OF SUCH DAMAGE. | | 29 | * POSSIBILITY OF SUCH DAMAGE. |
30 | */ | | 30 | */ |
31 | | | 31 | |
32 | #ifndef _COMPAT_OPENSOLARIS_SYS_MUTEX_IMPL_H | | 32 | #ifndef _COMPAT_OPENSOLARIS_SYS_MUTEX_IMPL_H |
33 | #define _COMPAT_OPENSOLARIS_SYS_MUTEX_IMPL_H | | 33 | #define _COMPAT_OPENSOLARIS_SYS_MUTEX_IMPL_H |
34 | | | 34 | |
35 | #define __MUTEX_PRIVATE | | 35 | #define __MUTEX_PRIVATE |
36 | #include <sys/mutex.h> | | 36 | #include <sys/mutex.h> |
37 | | | 37 | |
38 | #define mtx_owner u.mtxa_owner | | | |
39 | #define MUTEX_THREAD ((uintptr_t)-16L) | | 38 | #define MUTEX_THREAD ((uintptr_t)-16L) |
40 | #define MUTEX_OWNER(mtx) \ | | 39 | #define MUTEX_OWNER(mtx) \ |
41 | ((mtx)->mtx_owner & MUTEX_THREAD) | | 40 | ((mtx)->mtx_owner & MUTEX_THREAD) |
42 | #define MUTEX_NO_OWNER 0 | | 41 | #define MUTEX_NO_OWNER 0 |
43 | | | 42 | |
44 | #define MUTEX_BIT_SPIN 0x01 | | 43 | #define MUTEX_BIT_SPIN 0x01 |
45 | #define MUTEX_TYPE_ADAPTIVE(mtx) (((mtx)->mtx_owner & MUTEX_BIT_SPIN) == 0) | | 44 | #define MUTEX_TYPE_ADAPTIVE(mtx) (((mtx)->mtx_owner & MUTEX_BIT_SPIN) == 0) |
46 | #define MUTEX_TYPE_SPIN(mtx) (((mtx)->mtx_owner & MUTEX_BIT_SPIN) != 0) | | 45 | #define MUTEX_TYPE_SPIN(mtx) (((mtx)->mtx_owner & MUTEX_BIT_SPIN) != 0) |
47 | | | 46 | |
48 | #endif | | 47 | #endif |