From: Roland McGrath Date: Wed, 30 Jul 2014 22:10:35 +0000 (-0700) Subject: Starting on NPTL. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=54c4f1d5bdb110e56ff6a3aacb96a7d0ffecca37;p=thirdparty%2Fglibc.git Starting on NPTL. --- diff --git a/sysdeps/arm/armv7/nacl/Implies b/sysdeps/arm/armv7/nacl/Implies deleted file mode 100644 index d6969219299..00000000000 --- a/sysdeps/arm/armv7/nacl/Implies +++ /dev/null @@ -1,2 +0,0 @@ -# We can do everything that 6T2 can -arm/armv6t2/nacl diff --git a/sysdeps/arm/nacl/Implies b/sysdeps/arm/nacl/Implies index 9ab295139c7..2294208dbac 100644 --- a/sysdeps/arm/nacl/Implies +++ b/sysdeps/arm/nacl/Implies @@ -1 +1,2 @@ +arm/nptl init_array diff --git a/sysdeps/arm/nacl/tls.h b/sysdeps/arm/nacl/tls.h index a9d0240cf4c..646e7a9d06f 100644 --- a/sysdeps/arm/nacl/tls.h +++ b/sysdeps/arm/nacl/tls.h @@ -1,92 +1,2 @@ -/* XXX */ - -#ifndef _TLS_H -#define _TLS_H 1 - -#ifndef __ASSEMBLER__ -# include -# include -# include -# include - -/* Type for the dtv. */ -typedef union dtv -{ - size_t counter; - struct - { - void *val; - bool is_static; - } pointer; -} dtv_t; - -/* The TP points to the start of the thread blocks. */ -# define TLS_DTV_AT_TP 1 - -typedef struct -{ - dtv_t *dtv; - void *private; -} tcbhead_t; - -/* This is the size of the initial TCB. */ -# define TLS_INIT_TCB_SIZE sizeof (tcbhead_t) - -/* Alignment requirements for the initial TCB. */ -# define TLS_INIT_TCB_ALIGN 16 - -/* This is the size of the TCB. */ -# define TLS_TCB_SIZE sizeof (tcbhead_t) - -/* This is the size we need before TCB. */ -# define TLS_PRE_TCB_SIZE 0 /* XXX */ - -/* Return the thread descriptor for the current thread. */ -# define THREAD_SELF __builtin_thread_pointer () - -/* Alignment requirements for the TCB. */ -# define TLS_TCB_ALIGN 16 - -/* Install the dtv pointer. The pointer passed is to the element with - index -1 which contain the length. */ -# define INSTALL_DTV(tcbp, dtvp) \ - (((tcbhead_t *) (tcbp))->dtv = (dtvp) + 1) - -/* Install new dtv for current thread. */ -# define INSTALL_NEW_DTV(dtv) \ - (THREAD_DTV() = (dtv)) - -/* Return dtv of given thread descriptor. */ -# define GET_DTV(tcbp) \ - (((tcbhead_t *) (tcbp))->dtv) - -/* Return the address of the dtv for the current thread. */ -# define THREAD_DTV() \ - (((tcbhead_t *) __builtin_thread_pointer ())->dtv) - -#define TLS_INIT_TP_EXPENSIVE 1 - -/* Code to initially initialize the thread pointer. This might need - special attention since 'errno' is not yet available and if the - operation can cause a failure 'errno' must not be touched. */ -# define TLS_INIT_TP(tcbp, secondcall) \ - ((*__nacl_irt_tls.tls_init) (tcbp) == 0 ? NULL : "tls_init call failed") - -/* Get and set the global scope generation counter in struct pthread. */ -#define THREAD_GSCOPE_FLAG_UNUSED 0 -#define THREAD_GSCOPE_FLAG_USED 1 -#define THREAD_GSCOPE_FLAG_WAIT 2 -#define THREAD_GSCOPE_RESET_FLAG() \ - do \ - {} \ - while (0) -#define THREAD_GSCOPE_SET_FLAG() \ - do \ - {} \ - while (0) -#define THREAD_GSCOPE_WAIT() ((void) 0) - - -#endif /* __ASSEMBLER__ */ - -#endif /* tls.h */ +#include +#include diff --git a/sysdeps/nacl/Implies b/sysdeps/nacl/Implies index f380b879a92..0448f3f0182 100644 --- a/sysdeps/nacl/Implies +++ b/sysdeps/nacl/Implies @@ -1,2 +1,3 @@ +nptl posix gnu diff --git a/sysdeps/nacl/Subdirs b/sysdeps/nacl/Subdirs new file mode 100644 index 00000000000..5d570b99691 --- /dev/null +++ b/sysdeps/nacl/Subdirs @@ -0,0 +1,3 @@ +inet +resolv +nss diff --git a/sysdeps/nacl/Versions b/sysdeps/nacl/Versions index 49e98561dc5..d2d655851b5 100644 --- a/sysdeps/nacl/Versions +++ b/sysdeps/nacl/Versions @@ -1,3 +1,9 @@ +ld { + GLIBC_PRIVATE { + __nacl_irt_*; + } +} + libc { GLIBC_2.17 { nacl_interface_query; diff --git a/sysdeps/nacl/bits/local_lim.h b/sysdeps/nacl/bits/local_lim.h index d655d80ae41..2792161c474 100644 --- a/sysdeps/nacl/bits/local_lim.h +++ b/sysdeps/nacl/bits/local_lim.h @@ -22,3 +22,43 @@ #define PATH_MAX 4096 #define NGROUPS_MAX 65536 + +/* The number of data keys per process. */ +#define _POSIX_THREAD_KEYS_MAX 128 +/* This is the value this implementation supports. */ +#define PTHREAD_KEYS_MAX 1024 + +/* Controlling the iterations of destructors for thread-specific data. */ +#define _POSIX_THREAD_DESTRUCTOR_ITERATIONS 4 +/* Number of iterations this implementation does. */ +#define PTHREAD_DESTRUCTOR_ITERATIONS _POSIX_THREAD_DESTRUCTOR_ITERATIONS + +/* The number of threads per process. */ +#define _POSIX_THREAD_THREADS_MAX 64 +/* We have no predefined limit on the number of threads. */ +#undef PTHREAD_THREADS_MAX + +/* Maximum amount by which a process can descrease its asynchronous I/O + priority level. */ +#define AIO_PRIO_DELTA_MAX 20 + +/* Minimum size for a thread. We are free to choose a reasonable value. */ +#define PTHREAD_STACK_MIN 131072 + +/* Maximum number of timer expiration overruns. */ +#define DELAYTIMER_MAX 2147483647 + +/* Maximum tty name length. */ +#define TTY_NAME_MAX 32 + +/* Maximum login name length. This is arbitrary. */ +#define LOGIN_NAME_MAX 256 + +/* Maximum host name length. */ +#define HOST_NAME_MAX 64 + +/* Maximum message queue priority level. */ +#define MQ_PRIO_MAX 32768 + +/* Maximum value the semaphore can have. */ +#define SEM_VALUE_MAX (2147483647) diff --git a/sysdeps/nacl/exit-thread.h b/sysdeps/nacl/exit-thread.h new file mode 100644 index 00000000000..9c8ed33420b --- /dev/null +++ b/sysdeps/nacl/exit-thread.h @@ -0,0 +1,35 @@ +/* Call to terminate the current thread. NaCl version. + Copyright (C) 2014 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include +#include + +/* This causes the current thread to exit, without affecting other + threads in the process if there are any. If there are no other + threads left, then this has the effect of _exit (0). */ + +static inline void __attribute__ ((noreturn, always_inline, unused)) +__exit_thread (void) +{ + __nacl_irt_thread.thread_exit (NULL); + + /* That never returns unless something is severely and unrecoverably wrong. + If it ever does, try to make sure we crash. */ + while (1) + __builtin_trap (); +} diff --git a/sysdeps/nacl/fork.c b/sysdeps/nacl/fork.c new file mode 100644 index 00000000000..2502a663ba2 --- /dev/null +++ b/sysdeps/nacl/fork.c @@ -0,0 +1,2 @@ +/* Get the stub, bypassing the "generic" NPTL code. */ +#include diff --git a/sysdeps/nacl/nacl-interface-list.h b/sysdeps/nacl/nacl-interface-list.h index 649e29b8df0..3206eb75f9a 100644 --- a/sysdeps/nacl/nacl-interface-list.h +++ b/sysdeps/nacl/nacl-interface-list.h @@ -4,9 +4,7 @@ NACL_MANDATORY_INTERFACE (NACL_IRT_FILENAME_v0_1, nacl_irt_filename) NACL_MANDATORY_INTERFACE (NACL_IRT_MEMORY_v0_3, nacl_irt_memory) NACL_MANDATORY_INTERFACE (NACL_IRT_DYNCODE_v0_1, nacl_irt_dyncode) NACL_MANDATORY_INTERFACE (NACL_IRT_THREAD_v0_1, nacl_irt_thread) -NACL_MANDATORY_INTERFACE (NACL_IRT_MUTEX_v0_1, nacl_irt_mutex) -NACL_MANDATORY_INTERFACE (NACL_IRT_COND_v0_1, nacl_irt_cond) -NACL_MANDATORY_INTERFACE (NACL_IRT_SEM_v0_1, nacl_irt_sem) +NACL_MANDATORY_INTERFACE (NACL_IRT_FUTEX_v0_1, nacl_irt_futex) NACL_MANDATORY_INTERFACE (NACL_IRT_TLS_v0_1, nacl_irt_tls) NACL_MANDATORY_INTERFACE (NACL_IRT_RESOURCE_OPEN_v0_1, nacl_irt_resource_open) NACL_OPTIONAL_INTERFACE (NACL_IRT_CLOCK_v0_1, nacl_irt_clock) diff --git a/sysdeps/nacl/tls.h b/sysdeps/nacl/tls.h new file mode 100644 index 00000000000..36d0b5b3df1 --- /dev/null +++ b/sysdeps/nacl/tls.h @@ -0,0 +1,34 @@ +/* Definition for thread-local data handling. NaCl version. + Copyright (C) 2014 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library. If not, see + . */ + +#ifndef _NACL_TLS_H +#define _NACL_TLS_H 1 + +#ifndef __ASSEMBLER__ + +# include + +/* Code to initially initialize the thread pointer. This might need + special attention since 'errno' is not yet available and if the + operation can cause a failure 'errno' must not be touched. */ +# define TLS_INIT_TP(tcbp) \ + ((*__nacl_irt_tls.tls_init) (tcbp) == 0 ? NULL : "tls_init call failed") + +#endif /* __ASSEMBLER__ */ + +#endif /* tls.h */