libpthread: Move namespacing include to top of .c files. Stuff like libc's namespace.h, or atomic_op_namespace.h, which does namespacing tricks like `#define atomic_cas_uint _atomic_cas_uint', has to go at the top of each .c file. If it goes in the middle, it might be too late to affect the declarations, and result in compile errors. I tripped over this by including <sys/atomic.h> in mips <machine/lock.h>. (Maybe we should create a new pthread_namespace.h file for the purpose, but this'll do for now.)diff -r1.179 -r1.180 src/lib/libpthread/pthread.c
(riastradh)
--- src/lib/libpthread/pthread.c 2021/04/13 00:31:54 1.179
+++ src/lib/libpthread/pthread.c 2022/02/12 14:59:32 1.180
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: pthread.c,v 1.179 2021/04/13 00:31:54 mrg Exp $ */ | 1 | /* $NetBSD: pthread.c,v 1.180 2022/02/12 14:59:32 riastradh Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 2001, 2002, 2003, 2006, 2007, 2008, 2020 | 4 | * Copyright (c) 2001, 2002, 2003, 2006, 2007, 2008, 2020 | |
5 | * The NetBSD Foundation, Inc. | 5 | * The NetBSD Foundation, Inc. | |
6 | * All rights reserved. | 6 | * All rights reserved. | |
7 | * | 7 | * | |
8 | * This code is derived from software contributed to The NetBSD Foundation | 8 | * This code is derived from software contributed to The NetBSD Foundation | |
9 | * by Nathan J. Williams and Andrew Doran. | 9 | * by Nathan J. Williams and Andrew Doran. | |
10 | * | 10 | * | |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without | |
12 | * modification, are permitted provided that the following conditions | 12 | * modification, are permitted provided that the following conditions | |
13 | * are met: | 13 | * are met: | |
14 | * 1. Redistributions of source code must retain the above copyright | 14 | * 1. Redistributions of source code must retain the above copyright | |
@@ -21,30 +21,33 @@ | @@ -21,30 +21,33 @@ | |||
21 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | 21 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | |
22 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 22 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
23 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | 23 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | |
24 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | 24 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
25 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | 25 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
26 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | 26 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
27 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | 27 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
28 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 28 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
29 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | 29 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
30 | * POSSIBILITY OF SUCH DAMAGE. | 30 | * POSSIBILITY OF SUCH DAMAGE. | |
31 | */ | 31 | */ | |
32 | 32 | |||
33 | #include <sys/cdefs.h> | 33 | #include <sys/cdefs.h> | |
34 | __RCSID("$NetBSD: pthread.c,v 1.179 2021/04/13 00:31:54 mrg Exp $"); | 34 | __RCSID("$NetBSD: pthread.c,v 1.180 2022/02/12 14:59:32 riastradh Exp $"); | |
35 | 35 | |||
36 | #define __EXPOSE_STACK 1 | 36 | #define __EXPOSE_STACK 1 | |
37 | 37 | |||
38 | /* Need to use libc-private names for atomic operations. */ | |||
39 | #include "../../common/lib/libc/atomic/atomic_op_namespace.h" | |||
40 | ||||
38 | #include <sys/param.h> | 41 | #include <sys/param.h> | |
39 | #include <sys/exec_elf.h> | 42 | #include <sys/exec_elf.h> | |
40 | #include <sys/mman.h> | 43 | #include <sys/mman.h> | |
41 | #include <sys/lwp.h> | 44 | #include <sys/lwp.h> | |
42 | #include <sys/lwpctl.h> | 45 | #include <sys/lwpctl.h> | |
43 | #include <sys/resource.h> | 46 | #include <sys/resource.h> | |
44 | #include <sys/sysctl.h> | 47 | #include <sys/sysctl.h> | |
45 | #include <sys/tls.h> | 48 | #include <sys/tls.h> | |
46 | #include <uvm/uvm_param.h> | 49 | #include <uvm/uvm_param.h> | |
47 | 50 | |||
48 | #include <assert.h> | 51 | #include <assert.h> | |
49 | #include <dlfcn.h> | 52 | #include <dlfcn.h> | |
50 | #include <err.h> | 53 | #include <err.h> |
--- src/lib/libpthread/pthread_attr.c 2020/01/29 13:47:31 1.19
+++ src/lib/libpthread/pthread_attr.c 2022/02/12 14:59:32 1.20
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: pthread_attr.c,v 1.19 2020/01/29 13:47:31 kamil Exp $ */ | 1 | /* $NetBSD: pthread_attr.c,v 1.20 2022/02/12 14:59:32 riastradh Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 2001, 2002, 2003, 2008 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 2001, 2002, 2003, 2008 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 Nathan J. Williams. | 8 | * by Nathan J. Williams. | |
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. | |
@@ -20,27 +20,30 @@ | @@ -20,27 +20,30 @@ | |||
20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | 20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | |
21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | 22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | |
23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | 23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | 24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
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 | #include <sys/cdefs.h> | 32 | #include <sys/cdefs.h> | |
33 | __RCSID("$NetBSD: pthread_attr.c,v 1.19 2020/01/29 13:47:31 kamil Exp $"); | 33 | __RCSID("$NetBSD: pthread_attr.c,v 1.20 2022/02/12 14:59:32 riastradh Exp $"); | |
34 | ||||
35 | /* Need to use libc-private names for atomic operations. */ | |||
36 | #include "../../common/lib/libc/atomic/atomic_op_namespace.h" | |||
34 | 37 | |||
35 | #include <errno.h> | 38 | #include <errno.h> | |
36 | #include <stdio.h> | 39 | #include <stdio.h> | |
37 | #include <stdlib.h> | 40 | #include <stdlib.h> | |
38 | #include <string.h> | 41 | #include <string.h> | |
39 | #include <unistd.h> | 42 | #include <unistd.h> | |
40 | 43 | |||
41 | #ifndef __lint__ | 44 | #ifndef __lint__ | |
42 | #define pthread_attr_get_np _pthread_attr_get_np | 45 | #define pthread_attr_get_np _pthread_attr_get_np | |
43 | #endif | 46 | #endif | |
44 | 47 | |||
45 | #include "pthread.h" | 48 | #include "pthread.h" | |
46 | #include "pthread_int.h" | 49 | #include "pthread_int.h" |
--- src/lib/libpthread/pthread_barrier.c 2020/05/16 22:53:37 1.22
+++ src/lib/libpthread/pthread_barrier.c 2022/02/12 14:59:32 1.23
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: pthread_barrier.c,v 1.22 2020/05/16 22:53:37 ad Exp $ */ | 1 | /* $NetBSD: pthread_barrier.c,v 1.23 2022/02/12 14:59:32 riastradh Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 2001, 2003, 2006, 2007, 2009, 2020 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 2001, 2003, 2006, 2007, 2009, 2020 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 Nathan J. Williams, by Jason R. Thorpe, and by Andrew Doran. | 8 | * by Nathan J. Williams, by Jason R. Thorpe, and by 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. | |
@@ -20,27 +20,30 @@ | @@ -20,27 +20,30 @@ | |||
20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | 20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | |
21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | 22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | |
23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | 23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | 24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
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 | #include <sys/cdefs.h> | 32 | #include <sys/cdefs.h> | |
33 | __RCSID("$NetBSD: pthread_barrier.c,v 1.22 2020/05/16 22:53:37 ad Exp $"); | 33 | __RCSID("$NetBSD: pthread_barrier.c,v 1.23 2022/02/12 14:59:32 riastradh Exp $"); | |
34 | ||||
35 | /* Need to use libc-private names for atomic operations. */ | |||
36 | #include "../../common/lib/libc/atomic/atomic_op_namespace.h" | |||
34 | 37 | |||
35 | #include <errno.h> | 38 | #include <errno.h> | |
36 | 39 | |||
37 | #include "pthread.h" | 40 | #include "pthread.h" | |
38 | #include "pthread_int.h" | 41 | #include "pthread_int.h" | |
39 | 42 | |||
40 | int | 43 | int | |
41 | pthread_barrier_init(pthread_barrier_t *barrier, | 44 | pthread_barrier_init(pthread_barrier_t *barrier, | |
42 | const pthread_barrierattr_t *attr, unsigned int count) | 45 | const pthread_barrierattr_t *attr, unsigned int count) | |
43 | { | 46 | { | |
44 | 47 | |||
45 | pthread__error(EINVAL, "Invalid barrier attribute", | 48 | pthread__error(EINVAL, "Invalid barrier attribute", | |
46 | attr == NULL || attr->ptba_magic == _PT_BARRIERATTR_MAGIC); | 49 | attr == NULL || attr->ptba_magic == _PT_BARRIERATTR_MAGIC); |
--- src/lib/libpthread/pthread_cancelstub.c 2021/10/01 20:13:38 1.40
+++ src/lib/libpthread/pthread_cancelstub.c 2022/02/12 14:59:32 1.41
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: pthread_cancelstub.c,v 1.40 2021/10/01 20:13:38 christos Exp $ */ | 1 | /* $NetBSD: pthread_cancelstub.c,v 1.41 2022/02/12 14:59:32 riastradh Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 2002, 2007 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 2002, 2007 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 Nathan J. Williams and Andrew Doran. | 8 | * by Nathan J. Williams 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. | |
@@ -23,27 +23,30 @@ | @@ -23,27 +23,30 @@ | |||
23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | 23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | 24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
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 | /* Disable namespace mangling, Fortification is useless here anyway. */ | 32 | /* Disable namespace mangling, Fortification is useless here anyway. */ | |
33 | #undef _FORTIFY_SOURCE | 33 | #undef _FORTIFY_SOURCE | |
34 | 34 | |||
35 | #include <sys/cdefs.h> | 35 | #include <sys/cdefs.h> | |
36 | __RCSID("$NetBSD: pthread_cancelstub.c,v 1.40 2021/10/01 20:13:38 christos Exp $"); | 36 | __RCSID("$NetBSD: pthread_cancelstub.c,v 1.41 2022/02/12 14:59:32 riastradh Exp $"); | |
37 | ||||
38 | /* Need to use libc-private names for atomic operations. */ | |||
39 | #include "../../common/lib/libc/atomic/atomic_op_namespace.h" | |||
37 | 40 | |||
38 | #ifndef lint | 41 | #ifndef lint | |
39 | 42 | |||
40 | 43 | |||
41 | /* | 44 | /* | |
42 | * This is necessary because the names are always weak (they are not | 45 | * This is necessary because the names are always weak (they are not | |
43 | * POSIX functions). | 46 | * POSIX functions). | |
44 | */ | 47 | */ | |
45 | #define fsync_range _fsync_range | 48 | #define fsync_range _fsync_range | |
46 | #define pollts _pollts | 49 | #define pollts _pollts | |
47 | 50 | |||
48 | /* | 51 | /* | |
49 | * XXX this is necessary to get the prototypes for the __sigsuspend14 | 52 | * XXX this is necessary to get the prototypes for the __sigsuspend14 |
--- src/lib/libpthread/pthread_compat.c 2017/12/08 09:59:26 1.6
+++ src/lib/libpthread/pthread_compat.c 2022/02/12 14:59:32 1.7
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: pthread_compat.c,v 1.6 2017/12/08 09:59:26 kre Exp $ */ | 1 | /* $NetBSD: pthread_compat.c,v 1.7 2022/02/12 14:59:32 riastradh Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 2008 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 2008 The NetBSD Foundation, Inc. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * This code is derived from software developed for The NetBSD Foundation | 7 | * This code is derived from software developed for The NetBSD Foundation | |
8 | * by Andrew Doran. | 8 | * by 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. | |
@@ -24,27 +24,30 @@ | @@ -24,27 +24,30 @@ | |||
24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | 24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
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 | /* | 32 | /* | |
33 | * libc symbols that are not present before NetBSD 5.0. | 33 | * libc symbols that are not present before NetBSD 5.0. | |
34 | */ | 34 | */ | |
35 | 35 | |||
36 | #include <sys/cdefs.h> | 36 | #include <sys/cdefs.h> | |
37 | __RCSID("$NetBSD: pthread_compat.c,v 1.6 2017/12/08 09:59:26 kre Exp $"); | 37 | __RCSID("$NetBSD: pthread_compat.c,v 1.7 2022/02/12 14:59:32 riastradh Exp $"); | |
38 | ||||
39 | /* Need to use libc-private names for atomic operations. */ | |||
40 | #include "../../common/lib/libc/atomic/atomic_op_namespace.h" | |||
38 | 41 | |||
39 | #include <sys/param.h> | 42 | #include <sys/param.h> | |
40 | #include <sys/syscall.h> | 43 | #include <sys/syscall.h> | |
41 | #include <sys/aio.h> | 44 | #include <sys/aio.h> | |
42 | 45 | |||
43 | #include <lwp.h> | 46 | #include <lwp.h> | |
44 | #include <unistd.h> | 47 | #include <unistd.h> | |
45 | #include <sched.h> | 48 | #include <sched.h> | |
46 | 49 | |||
47 | #include "pthread.h" | 50 | #include "pthread.h" | |
48 | #include "pthread_int.h" | 51 | #include "pthread_int.h" | |
49 | 52 | |||
50 | static void __pthread_init(void) __attribute__((__constructor__, __used__)); | 53 | static void __pthread_init(void) __attribute__((__constructor__, __used__)); |
--- src/lib/libpthread/res_state.c 2008/04/28 20:23:02 1.6
+++ src/lib/libpthread/res_state.c 2022/02/12 14:59:32 1.7
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: res_state.c,v 1.6 2008/04/28 20:23:02 martin Exp $ */ | 1 | /* $NetBSD: res_state.c,v 1.7 2022/02/12 14:59:32 riastradh Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 2004 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 2004 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 Christos Zoulas. | 8 | * by Christos Zoulas. | |
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. | |
@@ -21,29 +21,32 @@ | @@ -21,29 +21,32 @@ | |||
21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | 22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | |
23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | 23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | 24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
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 | #include <sys/cdefs.h> | 32 | #include <sys/cdefs.h> | |
33 | #if defined(LIBC_SCCS) && !defined(lint) | 33 | #if defined(LIBC_SCCS) && !defined(lint) | |
34 | __RCSID("$NetBSD: res_state.c,v 1.6 2008/04/28 20:23:02 martin Exp $"); | 34 | __RCSID("$NetBSD: res_state.c,v 1.7 2022/02/12 14:59:32 riastradh Exp $"); | |
35 | #endif | 35 | #endif | |
36 | 36 | |||
37 | /* Need to use libc-private names for atomic operations. */ | |||
38 | #include "../../common/lib/libc/atomic/atomic_op_namespace.h" | |||
39 | ||||
37 | #include <sys/types.h> | 40 | #include <sys/types.h> | |
38 | #include <sys/queue.h> | 41 | #include <sys/queue.h> | |
39 | #include <arpa/inet.h> | 42 | #include <arpa/inet.h> | |
40 | #include <arpa/nameser.h> | 43 | #include <arpa/nameser.h> | |
41 | #include <stdlib.h> | 44 | #include <stdlib.h> | |
42 | #include <unistd.h> | 45 | #include <unistd.h> | |
43 | #include <resolv.h> | 46 | #include <resolv.h> | |
44 | #include <netdb.h> | 47 | #include <netdb.h> | |
45 | 48 | |||
46 | #include "pthread.h" | 49 | #include "pthread.h" | |
47 | #include "pthread_int.h" | 50 | #include "pthread_int.h" | |
48 | 51 | |||
49 | static SLIST_HEAD(, _res_st) res_list = LIST_HEAD_INITIALIZER(&res_list); | 52 | static SLIST_HEAD(, _res_st) res_list = LIST_HEAD_INITIALIZER(&res_list); |
--- src/lib/libpthread/pthread_cond.c 2020/06/14 21:33:28 1.76
+++ src/lib/libpthread/pthread_cond.c 2022/02/12 14:59:32 1.77
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: pthread_cond.c,v 1.76 2020/06/14 21:33:28 ad Exp $ */ | 1 | /* $NetBSD: pthread_cond.c,v 1.77 2022/02/12 14:59:32 riastradh Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 2001, 2006, 2007, 2008, 2020 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 2001, 2006, 2007, 2008, 2020 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 Nathan J. Williams and Andrew Doran. | 8 | * by Nathan J. Williams 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. | |
@@ -20,27 +20,30 @@ | @@ -20,27 +20,30 @@ | |||
20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | 20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | |
21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | 22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | |
23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | 23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | 24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
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 | #include <sys/cdefs.h> | 32 | #include <sys/cdefs.h> | |
33 | __RCSID("$NetBSD: pthread_cond.c,v 1.76 2020/06/14 21:33:28 ad Exp $"); | 33 | __RCSID("$NetBSD: pthread_cond.c,v 1.77 2022/02/12 14:59:32 riastradh Exp $"); | |
34 | ||||
35 | /* Need to use libc-private names for atomic operations. */ | |||
36 | #include "../../common/lib/libc/atomic/atomic_op_namespace.h" | |||
34 | 37 | |||
35 | #include <stdlib.h> | 38 | #include <stdlib.h> | |
36 | #include <errno.h> | 39 | #include <errno.h> | |
37 | #include <sys/time.h> | 40 | #include <sys/time.h> | |
38 | #include <sys/types.h> | 41 | #include <sys/types.h> | |
39 | 42 | |||
40 | #include "pthread.h" | 43 | #include "pthread.h" | |
41 | #include "pthread_int.h" | 44 | #include "pthread_int.h" | |
42 | #include "reentrant.h" | 45 | #include "reentrant.h" | |
43 | 46 | |||
44 | int _sys___nanosleep50(const struct timespec *, struct timespec *); | 47 | int _sys___nanosleep50(const struct timespec *, struct timespec *); | |
45 | 48 | |||
46 | int _pthread_cond_has_waiters_np(pthread_cond_t *); | 49 | int _pthread_cond_has_waiters_np(pthread_cond_t *); |
--- src/lib/libpthread/pthread_getcpuclockid.c 2020/01/29 16:03:44 1.3
+++ src/lib/libpthread/pthread_getcpuclockid.c 2022/02/12 14:59:32 1.4
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: pthread_getcpuclockid.c,v 1.3 2020/01/29 16:03:44 kamil Exp $ */ | 1 | /* $NetBSD: pthread_getcpuclockid.c,v 1.4 2022/02/12 14:59:32 riastradh Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 2016 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 2016 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 Christos Zoulas. | 8 | * by Christos Zoulas. | |
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. | |
@@ -20,29 +20,32 @@ | @@ -20,29 +20,32 @@ | |||
20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | 20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | |
21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | 22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | |
23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | 23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | 24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
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 | #include <sys/cdefs.h> | 31 | #include <sys/cdefs.h> | |
32 | #if defined(LIBC_SCCS) && !defined(lint) | 32 | #if defined(LIBC_SCCS) && !defined(lint) | |
33 | __RCSID("$NetBSD: pthread_getcpuclockid.c,v 1.3 2020/01/29 16:03:44 kamil Exp $"); | 33 | __RCSID("$NetBSD: pthread_getcpuclockid.c,v 1.4 2022/02/12 14:59:32 riastradh Exp $"); | |
34 | #endif /* LIBC_SCCS and not lint */ | 34 | #endif /* LIBC_SCCS and not lint */ | |
35 | 35 | |||
36 | /* Need to use libc-private names for atomic operations. */ | |||
37 | #include "../../common/lib/libc/atomic/atomic_op_namespace.h" | |||
38 | ||||
36 | #include <sys/types.h> | 39 | #include <sys/types.h> | |
37 | #include <errno.h> | 40 | #include <errno.h> | |
38 | #include <pthread.h> | 41 | #include <pthread.h> | |
39 | #include <time.h> | 42 | #include <time.h> | |
40 | 43 | |||
41 | #include "pthread_int.h" | 44 | #include "pthread_int.h" | |
42 | 45 | |||
43 | int | 46 | int | |
44 | pthread_getcpuclockid(pthread_t thread, clockid_t *clock_id) | 47 | pthread_getcpuclockid(pthread_t thread, clockid_t *clock_id) | |
45 | { | 48 | { | |
46 | int error = 0, saved_errno; | 49 | int error = 0, saved_errno; | |
47 | 50 | |||
48 | pthread__error(EINVAL, "Invalid thread", | 51 | pthread__error(EINVAL, "Invalid thread", |
--- src/lib/libpthread/pthread_once.c 2013/03/21 16:49:12 1.3
+++ src/lib/libpthread/pthread_once.c 2022/02/12 14:59:32 1.4
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: pthread_once.c,v 1.3 2013/03/21 16:49:12 christos Exp $ */ | 1 | /* $NetBSD: pthread_once.c,v 1.4 2022/02/12 14:59:32 riastradh Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 2001, 2003 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 2001, 2003 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 Nathan J. Williams, and by Jason R. Thorpe. | 8 | * by Nathan J. Williams, and by Jason R. Thorpe. | |
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. | |
@@ -27,27 +27,30 @@ | @@ -27,27 +27,30 @@ | |||
27 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | 27 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | |
28 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 28 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
29 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | 29 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | |
30 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | 30 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
31 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | 31 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
32 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | 32 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
33 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | 33 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
34 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 34 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
35 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | 35 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
36 | * POSSIBILITY OF SUCH DAMAGE. | 36 | * POSSIBILITY OF SUCH DAMAGE. | |
37 | */ | 37 | */ | |
38 | 38 | |||
39 | #include <sys/cdefs.h> | 39 | #include <sys/cdefs.h> | |
40 | __RCSID("$NetBSD: pthread_once.c,v 1.3 2013/03/21 16:49:12 christos Exp $"); | 40 | __RCSID("$NetBSD: pthread_once.c,v 1.4 2022/02/12 14:59:32 riastradh Exp $"); | |
41 | ||||
42 | /* Need to use libc-private names for atomic operations. */ | |||
43 | #include "../../common/lib/libc/atomic/atomic_op_namespace.h" | |||
41 | 44 | |||
42 | #include "pthread.h" | 45 | #include "pthread.h" | |
43 | #include "pthread_int.h" | 46 | #include "pthread_int.h" | |
44 | #include "reentrant.h" | 47 | #include "reentrant.h" | |
45 | 48 | |||
46 | static void | 49 | static void | |
47 | once_cleanup(void *closure) | 50 | once_cleanup(void *closure) | |
48 | { | 51 | { | |
49 | 52 | |||
50 | pthread_mutex_unlock((pthread_mutex_t *)closure); | 53 | pthread_mutex_unlock((pthread_mutex_t *)closure); | |
51 | } | 54 | } | |
52 | 55 | |||
53 | int | 56 | int |
--- src/lib/libpthread/pthread_int.h 2020/06/10 22:45:15 1.107
+++ src/lib/libpthread/pthread_int.h 2022/02/12 14:59:32 1.108
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: pthread_int.h,v 1.107 2020/06/10 22:45:15 ad Exp $ */ | 1 | /* $NetBSD: pthread_int.h,v 1.108 2022/02/12 14:59:32 riastradh Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 2001, 2002, 2003, 2006, 2007, 2008, 2020 | 4 | * Copyright (c) 2001, 2002, 2003, 2006, 2007, 2008, 2020 | |
5 | * The NetBSD Foundation, Inc. | 5 | * The NetBSD Foundation, Inc. | |
6 | * All rights reserved. | 6 | * All rights reserved. | |
7 | * | 7 | * | |
8 | * This code is derived from software contributed to The NetBSD Foundation | 8 | * This code is derived from software contributed to The NetBSD Foundation | |
9 | * by Nathan J. Williams and Andrew Doran. | 9 | * by Nathan J. Williams and Andrew Doran. | |
10 | * | 10 | * | |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without | |
12 | * modification, are permitted provided that the following conditions | 12 | * modification, are permitted provided that the following conditions | |
13 | * are met: | 13 | * are met: | |
14 | * 1. Redistributions of source code must retain the above copyright | 14 | * 1. Redistributions of source code must retain the above copyright | |
@@ -31,29 +31,26 @@ | @@ -31,29 +31,26 @@ | |||
31 | */ | 31 | */ | |
32 | 32 | |||
33 | #ifndef _LIB_PTHREAD_INT_H | 33 | #ifndef _LIB_PTHREAD_INT_H | |
34 | #define _LIB_PTHREAD_INT_H | 34 | #define _LIB_PTHREAD_INT_H | |
35 | 35 | |||
36 | #include <sys/tls.h> | 36 | #include <sys/tls.h> | |
37 | 37 | |||
38 | /* #define PTHREAD__DEBUG */ | 38 | /* #define PTHREAD__DEBUG */ | |
39 | 39 | |||
40 | #include "pthread_types.h" | 40 | #include "pthread_types.h" | |
41 | #include "pthread_queue.h" | 41 | #include "pthread_queue.h" | |
42 | #include "pthread_md.h" | 42 | #include "pthread_md.h" | |
43 | 43 | |||
44 | /* Need to use libc-private names for atomic operations. */ | |||
45 | #include "../../common/lib/libc/atomic/atomic_op_namespace.h" | |||
46 | ||||
47 | #include <sys/atomic.h> | 44 | #include <sys/atomic.h> | |
48 | #include <sys/rbtree.h> | 45 | #include <sys/rbtree.h> | |
49 | #include <sys/param.h> | 46 | #include <sys/param.h> | |
50 | 47 | |||
51 | #include <limits.h> | 48 | #include <limits.h> | |
52 | #include <lwp.h> | 49 | #include <lwp.h> | |
53 | #include <signal.h> | 50 | #include <signal.h> | |
54 | #include <stdbool.h> | 51 | #include <stdbool.h> | |
55 | 52 | |||
56 | #ifdef __GNUC__ | 53 | #ifdef __GNUC__ | |
57 | #define PTHREAD_HIDE __attribute__ ((visibility("hidden"))) | 54 | #define PTHREAD_HIDE __attribute__ ((visibility("hidden"))) | |
58 | #else | 55 | #else | |
59 | #define PTHREAD_HIDE /* nothing */ | 56 | #define PTHREAD_HIDE /* nothing */ |
--- src/lib/libpthread/pthread_lock.c 2008/04/28 20:23:01 1.34
+++ src/lib/libpthread/pthread_lock.c 2022/02/12 14:59:32 1.35
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: pthread_lock.c,v 1.34 2008/04/28 20:23:01 martin Exp $ */ | 1 | /* $NetBSD: pthread_lock.c,v 1.35 2022/02/12 14:59:32 riastradh Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 2001, 2006, 2007 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 2001, 2006, 2007 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 Nathan J. Williams and Andrew Doran. | 8 | * by Nathan J. Williams 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. | |
@@ -24,27 +24,30 @@ | @@ -24,27 +24,30 @@ | |||
24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | 24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
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 | /* | 32 | /* | |
33 | * libpthread internal spinlock routines. | 33 | * libpthread internal spinlock routines. | |
34 | */ | 34 | */ | |
35 | 35 | |||
36 | #include <sys/cdefs.h> | 36 | #include <sys/cdefs.h> | |
37 | __RCSID("$NetBSD: pthread_lock.c,v 1.34 2008/04/28 20:23:01 martin Exp $"); | 37 | __RCSID("$NetBSD: pthread_lock.c,v 1.35 2022/02/12 14:59:32 riastradh Exp $"); | |
38 | ||||
39 | /* Need to use libc-private names for atomic operations. */ | |||
40 | #include "../../common/lib/libc/atomic/atomic_op_namespace.h" | |||
38 | 41 | |||
39 | #include <sys/types.h> | 42 | #include <sys/types.h> | |
40 | #include <sys/ras.h> | 43 | #include <sys/ras.h> | |
41 | 44 | |||
42 | #include <machine/lock.h> | 45 | #include <machine/lock.h> | |
43 | 46 | |||
44 | #include <errno.h> | 47 | #include <errno.h> | |
45 | #include <unistd.h> | 48 | #include <unistd.h> | |
46 | #include <stdio.h> | 49 | #include <stdio.h> | |
47 | #include <stdlib.h> | 50 | #include <stdlib.h> | |
48 | 51 | |||
49 | #include "pthread.h" | 52 | #include "pthread.h" | |
50 | #include "pthread_int.h" | 53 | #include "pthread_int.h" |
--- src/lib/libpthread/pthread_makelwp_netbsd.c 2014/12/17 01:49:08 1.2
+++ src/lib/libpthread/pthread_makelwp_netbsd.c 2022/02/12 14:59:32 1.3
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: pthread_makelwp_netbsd.c,v 1.2 2014/12/17 01:49:08 pooka Exp $ */ | 1 | /* $NetBSD: pthread_makelwp_netbsd.c,v 1.3 2022/02/12 14:59:32 riastradh Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 2001, 2002, 2003, 2006, 2007, 2008 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 2001, 2002, 2003, 2006, 2007, 2008 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 Nathan J. Williams and Andrew Doran. | 8 | * by Nathan J. Williams 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. | |
@@ -20,27 +20,30 @@ | @@ -20,27 +20,30 @@ | |||
20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | 20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | |
21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | 22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | |
23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | 23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | 24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
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 | #include <sys/cdefs.h> | 32 | #include <sys/cdefs.h> | |
33 | __RCSID("$NetBSD: pthread_makelwp_netbsd.c,v 1.2 2014/12/17 01:49:08 pooka Exp $"); | 33 | __RCSID("$NetBSD: pthread_makelwp_netbsd.c,v 1.3 2022/02/12 14:59:32 riastradh Exp $"); | |
34 | ||||
35 | /* Need to use libc-private names for atomic operations. */ | |||
36 | #include "../../common/lib/libc/atomic/atomic_op_namespace.h" | |||
34 | 37 | |||
35 | #include <sys/param.h> | 38 | #include <sys/param.h> | |
36 | 39 | |||
37 | #include <lwp.h> | 40 | #include <lwp.h> | |
38 | #include <pthread.h> | 41 | #include <pthread.h> | |
39 | #include <string.h> | 42 | #include <string.h> | |
40 | 43 | |||
41 | #include "pthread_int.h" | 44 | #include "pthread_int.h" | |
42 | #include "pthread_makelwp.h" | 45 | #include "pthread_makelwp.h" | |
43 | 46 | |||
44 | int | 47 | int | |
45 | pthread__makelwp(void (*start_routine)(void *), void *arg, void *priv, | 48 | pthread__makelwp(void (*start_routine)(void *), void *arg, void *priv, | |
46 | void *stack_base, size_t stack_size, | 49 | void *stack_base, size_t stack_size, |
--- src/lib/libpthread/pthread_misc.c 2020/01/29 16:34:09 1.17
+++ src/lib/libpthread/pthread_misc.c 2022/02/12 14:59:32 1.18
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: pthread_misc.c,v 1.17 2020/01/29 16:34:09 kamil Exp $ */ | 1 | /* $NetBSD: pthread_misc.c,v 1.18 2022/02/12 14:59:32 riastradh Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 2001, 2006, 2007, 2008 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 2001, 2006, 2007, 2008 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 Nathan J. Williams. | 8 | * by Nathan J. Williams. | |
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. | |
@@ -20,27 +20,30 @@ | @@ -20,27 +20,30 @@ | |||
20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | 20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | |
21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | 22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | |
23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | 23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | 24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
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 | #include <sys/cdefs.h> | 32 | #include <sys/cdefs.h> | |
33 | __RCSID("$NetBSD: pthread_misc.c,v 1.17 2020/01/29 16:34:09 kamil Exp $"); | 33 | __RCSID("$NetBSD: pthread_misc.c,v 1.18 2022/02/12 14:59:32 riastradh Exp $"); | |
34 | ||||
35 | /* Need to use libc-private names for atomic operations. */ | |||
36 | #include "../../common/lib/libc/atomic/atomic_op_namespace.h" | |||
34 | 37 | |||
35 | #include <errno.h> | 38 | #include <errno.h> | |
36 | #include <string.h> | 39 | #include <string.h> | |
37 | #include <unistd.h> | 40 | #include <unistd.h> | |
38 | 41 | |||
39 | #include <sys/types.h> | 42 | #include <sys/types.h> | |
40 | #include <sys/pset.h> | 43 | #include <sys/pset.h> | |
41 | #include <sys/signal.h> | 44 | #include <sys/signal.h> | |
42 | #include <sys/time.h> | 45 | #include <sys/time.h> | |
43 | 46 | |||
44 | #include <lwp.h> | 47 | #include <lwp.h> | |
45 | #include <sched.h> | 48 | #include <sched.h> | |
46 | 49 |
--- src/lib/libpthread/pthread_mutex.c 2020/06/11 18:41:22 1.81
+++ src/lib/libpthread/pthread_mutex.c 2022/02/12 14:59:32 1.82
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: pthread_mutex.c,v 1.81 2020/06/11 18:41:22 ad Exp $ */ | 1 | /* $NetBSD: pthread_mutex.c,v 1.82 2022/02/12 14:59:32 riastradh Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 2001, 2003, 2006, 2007, 2008, 2020 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 2001, 2003, 2006, 2007, 2008, 2020 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 Nathan J. Williams, by Jason R. Thorpe, and by Andrew Doran. | 8 | * by Nathan J. Williams, by Jason R. Thorpe, and by 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. | |
@@ -37,27 +37,30 @@ | @@ -37,27 +37,30 @@ | |||
37 | * follow, but spinlocks are problematic in userspace. If a thread is | 37 | * follow, but spinlocks are problematic in userspace. If a thread is | |
38 | * preempted by the kernel while holding a spinlock, any other thread | 38 | * preempted by the kernel while holding a spinlock, any other thread | |
39 | * attempting to acquire that spinlock will needlessly busy wait. | 39 | * attempting to acquire that spinlock will needlessly busy wait. | |
40 | * | 40 | * | |
41 | * There is no good way to know that the holding thread is no longer | 41 | * There is no good way to know that the holding thread is no longer | |
42 | * running, nor to request a wake-up once it has begun running again. | 42 | * running, nor to request a wake-up once it has begun running again. | |
43 | * Of more concern, threads in the SCHED_FIFO class do not have a | 43 | * Of more concern, threads in the SCHED_FIFO class do not have a | |
44 | * limited time quantum and so could spin forever, preventing the | 44 | * limited time quantum and so could spin forever, preventing the | |
45 | * thread holding the spinlock from getting CPU time: it would never | 45 | * thread holding the spinlock from getting CPU time: it would never | |
46 | * be released. | 46 | * be released. | |
47 | */ | 47 | */ | |
48 | 48 | |||
49 | #include <sys/cdefs.h> | 49 | #include <sys/cdefs.h> | |
50 | __RCSID("$NetBSD: pthread_mutex.c,v 1.81 2020/06/11 18:41:22 ad Exp $"); | 50 | __RCSID("$NetBSD: pthread_mutex.c,v 1.82 2022/02/12 14:59:32 riastradh Exp $"); | |
51 | ||||
52 | /* Need to use libc-private names for atomic operations. */ | |||
53 | #include "../../common/lib/libc/atomic/atomic_op_namespace.h" | |||
51 | 54 | |||
52 | #include <sys/types.h> | 55 | #include <sys/types.h> | |
53 | #include <sys/lwpctl.h> | 56 | #include <sys/lwpctl.h> | |
54 | #include <sys/sched.h> | 57 | #include <sys/sched.h> | |
55 | #include <sys/lock.h> | 58 | #include <sys/lock.h> | |
56 | 59 | |||
57 | #include <errno.h> | 60 | #include <errno.h> | |
58 | #include <limits.h> | 61 | #include <limits.h> | |
59 | #include <stdlib.h> | 62 | #include <stdlib.h> | |
60 | #include <time.h> | 63 | #include <time.h> | |
61 | #include <string.h> | 64 | #include <string.h> | |
62 | #include <stdio.h> | 65 | #include <stdio.h> | |
63 | 66 |
--- src/lib/libpthread/pthread_rwlock.c 2022/02/11 21:40:58 1.43
+++ src/lib/libpthread/pthread_rwlock.c 2022/02/12 14:59:32 1.44
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: pthread_rwlock.c,v 1.43 2022/02/11 21:40:58 riastradh Exp $ */ | 1 | /* $NetBSD: pthread_rwlock.c,v 1.44 2022/02/12 14:59:32 riastradh Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 2002, 2006, 2007, 2008, 2020 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 2002, 2006, 2007, 2008, 2020 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 Nathan J. Williams, by Jason R. Thorpe, and by Andrew Doran. | 8 | * by Nathan J. Williams, by Jason R. Thorpe, and by 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. | |
@@ -20,27 +20,30 @@ | @@ -20,27 +20,30 @@ | |||
20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | 20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | |
21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | 22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | |
23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | 23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | 24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
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 | #include <sys/cdefs.h> | 32 | #include <sys/cdefs.h> | |
33 | __RCSID("$NetBSD: pthread_rwlock.c,v 1.43 2022/02/11 21:40:58 riastradh Exp $"); | 33 | __RCSID("$NetBSD: pthread_rwlock.c,v 1.44 2022/02/12 14:59:32 riastradh Exp $"); | |
34 | ||||
35 | /* Need to use libc-private names for atomic operations. */ | |||
36 | #include "../../common/lib/libc/atomic/atomic_op_namespace.h" | |||
34 | 37 | |||
35 | #include <sys/types.h> | 38 | #include <sys/types.h> | |
36 | #include <sys/lwpctl.h> | 39 | #include <sys/lwpctl.h> | |
37 | 40 | |||
38 | #include <assert.h> | 41 | #include <assert.h> | |
39 | #include <time.h> | 42 | #include <time.h> | |
40 | #include <errno.h> | 43 | #include <errno.h> | |
41 | #include <stddef.h> | 44 | #include <stddef.h> | |
42 | 45 | |||
43 | #include "pthread.h" | 46 | #include "pthread.h" | |
44 | #include "pthread_int.h" | 47 | #include "pthread_int.h" | |
45 | #include "reentrant.h" | 48 | #include "reentrant.h" | |
46 | 49 |
--- src/lib/libpthread/pthread_specific.c 2013/03/21 16:49:12 1.26
+++ src/lib/libpthread/pthread_specific.c 2022/02/12 14:59:32 1.27
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: pthread_specific.c,v 1.26 2013/03/21 16:49:12 christos Exp $ */ | 1 | /* $NetBSD: pthread_specific.c,v 1.27 2022/02/12 14:59:32 riastradh Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 2001, 2007 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 2001, 2007 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 Nathan J. Williams. | 8 | * by Nathan J. Williams. | |
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. | |
@@ -20,27 +20,30 @@ | @@ -20,27 +20,30 @@ | |||
20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | 20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | |
21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | 22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | |
23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | 23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | 24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
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 | #include <sys/cdefs.h> | 32 | #include <sys/cdefs.h> | |
33 | __RCSID("$NetBSD: pthread_specific.c,v 1.26 2013/03/21 16:49:12 christos Exp $"); | 33 | __RCSID("$NetBSD: pthread_specific.c,v 1.27 2022/02/12 14:59:32 riastradh Exp $"); | |
34 | ||||
35 | /* Need to use libc-private names for atomic operations. */ | |||
36 | #include "../../common/lib/libc/atomic/atomic_op_namespace.h" | |||
34 | 37 | |||
35 | /* Functions and structures dealing with thread-specific data */ | 38 | /* Functions and structures dealing with thread-specific data */ | |
36 | 39 | |||
37 | #include "pthread.h" | 40 | #include "pthread.h" | |
38 | #include "pthread_int.h" | 41 | #include "pthread_int.h" | |
39 | #include "reentrant.h" | 42 | #include "reentrant.h" | |
40 | 43 | |||
41 | #include <string.h> | 44 | #include <string.h> | |
42 | #include <sys/lwpctl.h> | 45 | #include <sys/lwpctl.h> | |
43 | 46 | |||
44 | #include "../libc/include/extern.h" /* for _sys_setcontext() */ | 47 | #include "../libc/include/extern.h" /* for _sys_setcontext() */ | |
45 | 48 | |||
46 | int pthread_setcontext(const ucontext_t *); | 49 | int pthread_setcontext(const ucontext_t *); |
--- src/lib/libpthread/pthread_spin.c 2020/02/05 11:05:10 1.8
+++ src/lib/libpthread/pthread_spin.c 2022/02/12 14:59:32 1.9
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: pthread_spin.c,v 1.8 2020/02/05 11:05:10 kamil Exp $ */ | 1 | /* $NetBSD: pthread_spin.c,v 1.9 2022/02/12 14:59:32 riastradh Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 2001, 2006, 2007 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 2001, 2006, 2007 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 Nathan J. Williams and Andrew Doran. | 8 | * by Nathan J. Williams 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. | |
@@ -24,27 +24,30 @@ | @@ -24,27 +24,30 @@ | |||
24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | 24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
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 | /* | 32 | /* | |
33 | * Public (POSIX-specified) spinlocks. | 33 | * Public (POSIX-specified) spinlocks. | |
34 | */ | 34 | */ | |
35 | 35 | |||
36 | #include <sys/cdefs.h> | 36 | #include <sys/cdefs.h> | |
37 | __RCSID("$NetBSD: pthread_spin.c,v 1.8 2020/02/05 11:05:10 kamil Exp $"); | 37 | __RCSID("$NetBSD: pthread_spin.c,v 1.9 2022/02/12 14:59:32 riastradh Exp $"); | |
38 | ||||
39 | /* Need to use libc-private names for atomic operations. */ | |||
40 | #include "../../common/lib/libc/atomic/atomic_op_namespace.h" | |||
38 | 41 | |||
39 | #include <sys/types.h> | 42 | #include <sys/types.h> | |
40 | #include <sys/ras.h> | 43 | #include <sys/ras.h> | |
41 | 44 | |||
42 | #include <machine/lock.h> | 45 | #include <machine/lock.h> | |
43 | 46 | |||
44 | #include <errno.h> | 47 | #include <errno.h> | |
45 | #include <unistd.h> | 48 | #include <unistd.h> | |
46 | #include <stdio.h> | 49 | #include <stdio.h> | |
47 | #include <stdlib.h> | 50 | #include <stdlib.h> | |
48 | 51 | |||
49 | #include "pthread.h" | 52 | #include "pthread.h" | |
50 | #include "pthread_int.h" | 53 | #include "pthread_int.h" |
--- src/lib/libpthread/pthread_tsd.c 2020/06/11 18:42:02 1.23
+++ src/lib/libpthread/pthread_tsd.c 2022/02/12 14:59:32 1.24
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: pthread_tsd.c,v 1.23 2020/06/11 18:42:02 ad Exp $ */ | 1 | /* $NetBSD: pthread_tsd.c,v 1.24 2022/02/12 14:59:32 riastradh Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 2001, 2007, 2020 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 2001, 2007, 2020 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 Nathan J. Williams, by Andrew Doran, and by Christos Zoulas. | 8 | * by Nathan J. Williams, by Andrew Doran, and by Christos Zoulas. | |
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. | |
@@ -20,27 +20,30 @@ | @@ -20,27 +20,30 @@ | |||
20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | 20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | |
21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | 22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | |
23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | 23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | 24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
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 | #include <sys/cdefs.h> | 32 | #include <sys/cdefs.h> | |
33 | __RCSID("$NetBSD: pthread_tsd.c,v 1.23 2020/06/11 18:42:02 ad Exp $"); | 33 | __RCSID("$NetBSD: pthread_tsd.c,v 1.24 2022/02/12 14:59:32 riastradh Exp $"); | |
34 | ||||
35 | /* Need to use libc-private names for atomic operations. */ | |||
36 | #include "../../common/lib/libc/atomic/atomic_op_namespace.h" | |||
34 | 37 | |||
35 | /* Functions and structures dealing with thread-specific data */ | 38 | /* Functions and structures dealing with thread-specific data */ | |
36 | #include <errno.h> | 39 | #include <errno.h> | |
37 | #include <sys/mman.h> | 40 | #include <sys/mman.h> | |
38 | 41 | |||
39 | #include "pthread.h" | 42 | #include "pthread.h" | |
40 | #include "pthread_int.h" | 43 | #include "pthread_int.h" | |
41 | #include "reentrant.h" | 44 | #include "reentrant.h" | |
42 | #include "tsd.h" | 45 | #include "tsd.h" | |
43 | 46 | |||
44 | int pthread_keys_max; | 47 | int pthread_keys_max; | |
45 | static pthread_mutex_t tsd_mutex = PTHREAD_MUTEX_INITIALIZER; | 48 | static pthread_mutex_t tsd_mutex = PTHREAD_MUTEX_INITIALIZER; | |
46 | static int nextkey; | 49 | static int nextkey; |