Blame sysdeps/mach/hurd/htl/pt-sysdep.h

Packit 6c4009
/* Internal definitions for pthreads library.
Packit 6c4009
   Copyright (C) 2000-2018 Free Software Foundation, Inc.
Packit 6c4009
   This file is part of the GNU C Library.
Packit 6c4009
Packit 6c4009
   The GNU C Library is free software; you can redistribute it and/or
Packit 6c4009
   modify it under the terms of the GNU Lesser General Public
Packit 6c4009
   License as published by the Free Software Foundation; either
Packit 6c4009
   version 2.1 of the License, or (at your option) any later version.
Packit 6c4009
Packit 6c4009
   The GNU C Library is distributed in the hope that it will be useful,
Packit 6c4009
   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 6c4009
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit 6c4009
   Lesser General Public License for more details.
Packit 6c4009
Packit 6c4009
   You should have received a copy of the GNU Lesser General Public
Packit 6c4009
   License along with the GNU C Library;  if not, see
Packit 6c4009
   <http://www.gnu.org/licenses/>.  */
Packit 6c4009
Packit 6c4009
#ifndef _PT_SYSDEP_H
Packit 6c4009
#define _PT_SYSDEP_H	1
Packit 6c4009
Packit 6c4009
#include <mach.h>
Packit 6c4009
Packit 6c4009
/* XXX */
Packit 6c4009
#define _POSIX_THREAD_THREADS_MAX	64
Packit 6c4009
Packit 6c4009
/* The default stack size.  */
Packit 6c4009
#define PTHREAD_STACK_DEFAULT	(8 * 1024 * 1024)
Packit 6c4009
Packit 6c4009
#define PTHREAD_SYSDEP_MEMBERS \
Packit 6c4009
  thread_t kernel_thread;      \
Packit 6c4009
  mach_msg_header_t wakeupmsg;
Packit 6c4009
Packit 6c4009
extern __thread struct __pthread *___pthread_self;
Packit 6c4009
#define _pthread_self()                                            \
Packit 6c4009
	({                                                         \
Packit 6c4009
	  struct __pthread *thread;                                \
Packit 6c4009
	                                                           \
Packit 6c4009
	  assert (__pthread_threads);                              \
Packit 6c4009
	  thread = ___pthread_self;                                \
Packit 6c4009
	                                                           \
Packit 6c4009
	  assert (thread);                                         \
Packit 6c4009
	  assert (({ mach_port_t ktid = __mach_thread_self ();     \
Packit 6c4009
                     int ok = thread->kernel_thread == ktid;       \
Packit 6c4009
                     __mach_port_deallocate (__mach_task_self (), ktid);\
Packit 6c4009
                     ok; }));                                      \
Packit 6c4009
          thread;                                                  \
Packit 6c4009
         })
Packit 6c4009
Packit 6c4009
extern inline void
Packit 6c4009
__attribute__ ((__always_inline__))
Packit 6c4009
__pthread_stack_dealloc (void *stackaddr, size_t stacksize)
Packit 6c4009
{
Packit 6c4009
  __vm_deallocate (__mach_task_self (), (vm_offset_t) stackaddr, stacksize);
Packit 6c4009
}
Packit 6c4009
Packit 6c4009
/* Change thread THREAD's program counter to PC if SET_PC is true,
Packit 6c4009
   its stack pointer to SP if SET_IP is true, and its thread pointer
Packit 6c4009
   to TP if SET_TP is true.  */
Packit 6c4009
extern int __thread_set_pcsptp (thread_t thread,
Packit 6c4009
				int set_pc, void *pc,
Packit 6c4009
				int set_sp, void *sp, int set_tp, void *tp);
Packit 6c4009
Packit 6c4009
Packit 6c4009
#endif /* pt-sysdep.h */