LibC: Move pthread keys to TCB
This removes all TLS relocations from libc which may become handy ;)
This commit is contained in:
14
userspace/libraries/LibC/include/bits/types/pthread_key_t.h
Normal file
14
userspace/libraries/LibC/include/bits/types/pthread_key_t.h
Normal file
@@ -0,0 +1,14 @@
|
||||
#ifndef _BITS_TYPES_PTHREAD_KEY_H
|
||||
#define _BITS_TYPES_PTHREAD_KEY_H 1
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/pthread.h.html
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
typedef unsigned pthread_key_t;
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif
|
||||
@@ -8,14 +8,13 @@
|
||||
__BEGIN_DECLS
|
||||
|
||||
#include <bits/types/pthread_attr_t.h>
|
||||
#include <bits/types/pthread_key_t.h>
|
||||
#include <bits/types/pthread_t.h>
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
typedef int pthread_once_t;
|
||||
|
||||
typedef unsigned pthread_key_t;
|
||||
|
||||
typedef pthread_t pthread_spinlock_t;
|
||||
|
||||
typedef struct
|
||||
|
||||
@@ -8,7 +8,9 @@ __BEGIN_DECLS
|
||||
#define __need_size_t
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <bits/types/pthread_key_t.h>
|
||||
#include <bits/types/pthread_t.h>
|
||||
#include <limits.h>
|
||||
#include <stdint.h>
|
||||
|
||||
typedef struct _pthread_cleanup_t
|
||||
@@ -44,6 +46,8 @@ struct uthread
|
||||
int cancel_type;
|
||||
int cancel_state;
|
||||
volatile int canceled;
|
||||
pthread_key_t specific_keys[PTHREAD_KEYS_MAX];
|
||||
void* specific_values[PTHREAD_KEYS_MAX];
|
||||
// FIXME: make this dynamic
|
||||
uintptr_t dtv[1 + 256];
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user