hurd: Bump remaining LGPL2+ htl licences to LGPL 2.1+
[glibc.git] / sysdeps / mach / hurd / htl / pt-sysdep.h
blob5b15223da825a19fe5253de21c5b47818f64be83
1 /* Internal definitions for pthreads library.
2 Copyright (C) 2000-2018 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <http://www.gnu.org/licenses/>. */
19 #ifndef _PT_SYSDEP_H
20 #define _PT_SYSDEP_H 1
22 #include <mach.h>
24 /* XXX */
25 #define _POSIX_THREAD_THREADS_MAX 64
27 /* The default stack size. */
28 #define PTHREAD_STACK_DEFAULT (8 * 1024 * 1024)
30 #define PTHREAD_SYSDEP_MEMBERS \
31 thread_t kernel_thread; \
32 mach_msg_header_t wakeupmsg;
34 extern __thread struct __pthread *___pthread_self;
35 #define _pthread_self() \
36 ({ \
37 struct __pthread *thread; \
39 assert (__pthread_threads); \
40 thread = ___pthread_self; \
42 assert (thread); \
43 assert (({ mach_port_t ktid = __mach_thread_self (); \
44 int ok = thread->kernel_thread == ktid; \
45 __mach_port_deallocate (__mach_task_self (), ktid);\
46 ok; })); \
47 thread; \
50 extern inline void
51 __attribute__ ((__always_inline__))
52 __pthread_stack_dealloc (void *stackaddr, size_t stacksize)
54 __vm_deallocate (__mach_task_self (), (vm_offset_t) stackaddr, stacksize);
57 /* Change thread THREAD's program counter to PC if SET_PC is true,
58 its stack pointer to SP if SET_IP is true, and its thread pointer
59 to TP if SET_TP is true. */
60 extern int __thread_set_pcsptp (thread_t thread,
61 int set_pc, void *pc,
62 int set_sp, void *sp, int set_tp, void *tp);
65 #endif /* pt-sysdep.h */