Merge branch 'topic/cs423x-merge' into for-linus
[linux-2.6] / arch / um / os-Linux / tls.c
1 #include <errno.h>
2 #include <sys/ptrace.h>
3 #include "sysdep/tls.h"
4
5 /* TLS support - we basically rely on the host's one.*/
6
7 #ifndef PTRACE_GET_THREAD_AREA
8 #define PTRACE_GET_THREAD_AREA 25
9 #endif
10
11 #ifndef PTRACE_SET_THREAD_AREA
12 #define PTRACE_SET_THREAD_AREA 26
13 #endif
14
15 int os_set_thread_area(user_desc_t *info, int pid)
16 {
17         int ret;
18
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;
24 }
25
26 int os_get_thread_area(user_desc_t *info, int pid)
27 {
28         int ret;
29
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;
35 }