LibC: Make pthread_t pointer to uthread instead of a thread id
This will allow getting info about other threads in userspace!
This commit is contained in:
@@ -7,10 +7,7 @@
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
#define __need_pid_t
|
||||
#include <sys/types.h>
|
||||
|
||||
typedef pid_t pthread_t;
|
||||
typedef struct uthread* pthread_t;
|
||||
|
||||
__END_DECLS
|
||||
|
||||
|
||||
@@ -5,9 +5,11 @@
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
#define __need_pid_t
|
||||
#define __need_size_t
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <bits/types/pthread_attr_t.h>
|
||||
#include <bits/types/pthread_key_t.h>
|
||||
#include <bits/types/pthread_t.h>
|
||||
#include <limits.h>
|
||||
@@ -36,18 +38,24 @@ typedef struct _dynamic_tls_t
|
||||
struct uthread
|
||||
{
|
||||
struct uthread* self;
|
||||
|
||||
// TLS
|
||||
void* master_tls_addr;
|
||||
size_t master_tls_size;
|
||||
size_t master_tls_module_count;
|
||||
_dynamic_tls_t* dynamic_tls;
|
||||
_pthread_cleanup_t* cleanup_stack;
|
||||
pthread_t id;
|
||||
|
||||
// LIBC
|
||||
pid_t id;
|
||||
pthread_attr_t attr;
|
||||
int errno_;
|
||||
int cancel_type;
|
||||
int cancel_state;
|
||||
volatile int canceled;
|
||||
_pthread_cleanup_t* cleanup_funcs;
|
||||
pthread_key_t specific_keys[PTHREAD_KEYS_MAX];
|
||||
void* specific_values[PTHREAD_KEYS_MAX];
|
||||
void* specific_vals[PTHREAD_KEYS_MAX];
|
||||
|
||||
// FIXME: make this dynamic
|
||||
uintptr_t dtv[1 + 256];
|
||||
};
|
||||
|
||||
@@ -168,7 +168,7 @@ void pthread_cleanup_push(void (*routine)(void*), void* arg);
|
||||
|
||||
#define _pthread_equal(t1, t2) ((t1) == (t2))
|
||||
|
||||
#define _pthread_self() (_get_uthread()->id)
|
||||
#define _pthread_self() (_get_uthread())
|
||||
|
||||
#define _pthread_testcancel() do { \
|
||||
struct uthread* uthread = _get_uthread(); \
|
||||
|
||||
Reference in New Issue
Block a user