Commit dd77aec0 authored by Paolo 'Blaisorblade' Giarrusso's avatar Paolo 'Blaisorblade' Giarrusso Committed by Linus Torvalds

[PATCH] uml: tls support: hack to make it compile on any host

Copy the definition of struct user_desc (with another name) for use by
userspace sources (where we use the host headers, and we can't be sure about
their content) to make sure UML compiles.
Signed-off-by: default avatarPaolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Acked-by: default avatarJeff Dike <jdike@addtoit.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent aa6758d4
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include "kern_util.h" #include "kern_util.h"
#include "skas/mm_id.h" #include "skas/mm_id.h"
#include "irq_user.h" #include "irq_user.h"
#include "sysdep/tls.h"
#define OS_TYPE_FILE 1 #define OS_TYPE_FILE 1
#define OS_TYPE_DIR 2 #define OS_TYPE_DIR 2
...@@ -238,10 +239,10 @@ extern int helper_wait(int pid); ...@@ -238,10 +239,10 @@ extern int helper_wait(int pid);
/* tls.c */ /* tls.c */
extern int os_set_thread_area(void *data, int pid); extern int os_set_thread_area(user_desc_t *info, int pid);
extern int os_get_thread_area(void *data, int pid); extern int os_get_thread_area(user_desc_t *info, int pid);
/* umid.c */
/* umid.c */
extern int umid_file_name(char *name, char *buf, int len); extern int umid_file_name(char *name, char *buf, int len);
extern int set_umid(char *name); extern int set_umid(char *name);
extern char *get_umid(void); extern char *get_umid(void);
......
#ifndef _SYSDEP_TLS_H
#define _SYSDEP_TLS_H
# ifndef __KERNEL__
/* Change name to avoid conflicts with the original one from <asm/ldt.h>, which
* may be named user_desc (but in 2.4 and in header matching its API was named
* modify_ldt_ldt_s). */
typedef struct um_dup_user_desc {
unsigned int entry_number;
unsigned int base_addr;
unsigned int limit;
unsigned int seg_32bit:1;
unsigned int contents:2;
unsigned int read_exec_only:1;
unsigned int limit_in_pages:1;
unsigned int seg_not_present:1;
unsigned int useable:1;
} user_desc_t;
# else /* __KERNEL__ */
# include <asm/ldt.h>
typedef struct user_desc user_desc_t;
# endif /* __KERNEL__ */
#endif /* _SYSDEP_TLS_H */
#ifndef _SYSDEP_TLS_H
#define _SYSDEP_TLS_H
# ifndef __KERNEL__
/* Change name to avoid conflicts with the original one from <asm/ldt.h>, which
* may be named user_desc (but in 2.4 and in header matching its API was named
* modify_ldt_ldt_s). */
typedef struct um_dup_user_desc {
unsigned int entry_number;
unsigned int base_addr;
unsigned int limit;
unsigned int seg_32bit:1;
unsigned int contents:2;
unsigned int read_exec_only:1;
unsigned int limit_in_pages:1;
unsigned int seg_not_present:1;
unsigned int useable:1;
unsigned int lm:1;
} user_desc_t;
# else /* __KERNEL__ */
# include <asm/ldt.h>
typedef struct user_desc user_desc_t;
# endif /* __KERNEL__ */
#endif /* _SYSDEP_TLS_H */
#include <errno.h> #include <errno.h>
#include <sys/ptrace.h> #include <sys/ptrace.h>
#include <asm/ldt.h> #include <asm/ldt.h>
#include "sysdep/tls.h"
#include "uml-config.h" #include "uml-config.h"
/* TLS support - we basically rely on the host's one.*/ /* TLS support - we basically rely on the host's one.*/
...@@ -18,9 +19,8 @@ ...@@ -18,9 +19,8 @@
#define PTRACE_SET_THREAD_AREA 26 #define PTRACE_SET_THREAD_AREA 26
#endif #endif
int os_set_thread_area(void *data, int pid) int os_set_thread_area(user_desc_t *info, int pid)
{ {
struct user_desc *info = data;
int ret; int ret;
ret = ptrace(PTRACE_SET_THREAD_AREA, pid, info->entry_number, ret = ptrace(PTRACE_SET_THREAD_AREA, pid, info->entry_number,
...@@ -32,9 +32,8 @@ int os_set_thread_area(void *data, int pid) ...@@ -32,9 +32,8 @@ int os_set_thread_area(void *data, int pid)
#ifdef UML_CONFIG_MODE_SKAS #ifdef UML_CONFIG_MODE_SKAS
int os_get_thread_area(void *data, int pid) int os_get_thread_area(user_desc_t *info, int pid)
{ {
struct user_desc *info = data;
int ret; int ret;
ret = ptrace(PTRACE_GET_THREAD_AREA, pid, info->entry_number, ret = ptrace(PTRACE_GET_THREAD_AREA, pid, info->entry_number,
...@@ -49,10 +48,10 @@ int os_get_thread_area(void *data, int pid) ...@@ -49,10 +48,10 @@ int os_get_thread_area(void *data, int pid)
#ifdef UML_CONFIG_MODE_TT #ifdef UML_CONFIG_MODE_TT
#include "linux/unistd.h" #include "linux/unistd.h"
_syscall1(int, get_thread_area, struct user_desc *, u_info); _syscall1(int, get_thread_area, user_desc_t *, u_info);
_syscall1(int, set_thread_area, struct user_desc *, u_info); _syscall1(int, set_thread_area, user_desc_t *, u_info);
int do_set_thread_area_tt(struct user_desc *info) int do_set_thread_area_tt(user_desc_t *info)
{ {
int ret; int ret;
...@@ -63,7 +62,7 @@ int do_set_thread_area_tt(struct user_desc *info) ...@@ -63,7 +62,7 @@ int do_set_thread_area_tt(struct user_desc *info)
return ret; return ret;
} }
int do_get_thread_area_tt(struct user_desc *info) int do_get_thread_area_tt(user_desc_t *info)
{ {
int ret; int ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment