Committer: Michael Beasley <mike@snafu.setup>
[mikesnafu-overlay.git] / arch / um / os-Linux / tls.c
blob73277801ef14b69a8656ee978a63759be9b5c29f
1 #include <errno.h>
2 #include <sys/ptrace.h>
3 #include "sysdep/tls.h"
5 /* TLS support - we basically rely on the host's one.*/
7 #ifndef PTRACE_GET_THREAD_AREA
8 #define PTRACE_GET_THREAD_AREA 25
9 #endif
11 #ifndef PTRACE_SET_THREAD_AREA
12 #define PTRACE_SET_THREAD_AREA 26
13 #endif
15 int os_set_thread_area(user_desc_t *info, int pid)
17 int ret;
19 ret = ptrace(PTRACE_SET_THREAD_AREA, pid, info->entry_number,
20 (unsigned long) info);
21 if (ret < 0)
22 ret = -errno;
23 return ret;
26 int os_get_thread_area(user_desc_t *info, int pid)
28 int ret;
30 ret = ptrace(PTRACE_GET_THREAD_AREA, pid, info->entry_number,
31 (unsigned long) info);
32 if (ret < 0)
33 ret = -errno;
34 return ret;