aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorPaolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>2006-02-24 16:03:55 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-02-24 17:31:37 -0500
commit07f4e2c61c76e8b543c0a2589063aea85c15fb25 (patch)
tree7a43503115b18d26b5baed9c5bb9263469a5587f /arch
parent31bc5a33346b6dd35be219d1416449e0064e9123 (diff)
[PATCH] uml: fix usage of kernel_errno in place of errno
To avoid conflicts, in kernel files errno is expanded to kernel_errno, to distinguish it from glibc errno. In this case, the code wants to use the libc errno but the kernel one is used; in the other usage, we return errno in place of -errno in case of an error. Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it> Acked-by: Jeff Dike <jdike@addtoit.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/um/include/os.h3
-rw-r--r--arch/um/os-Linux/process.c16
-rw-r--r--arch/um/sys-i386/ldt.c9
3 files changed, 22 insertions, 6 deletions
diff --git a/arch/um/include/os.h b/arch/um/include/os.h
index eb1710b81255..2a1c64d8d0bf 100644
--- a/arch/um/include/os.h
+++ b/arch/um/include/os.h
@@ -179,8 +179,11 @@ extern void os_stop_process(int pid);
179extern void os_kill_process(int pid, int reap_child); 179extern void os_kill_process(int pid, int reap_child);
180extern void os_kill_ptraced_process(int pid, int reap_child); 180extern void os_kill_ptraced_process(int pid, int reap_child);
181extern void os_usr1_process(int pid); 181extern void os_usr1_process(int pid);
182extern long os_ptrace_ldt(long pid, long addr, long data);
183
182extern int os_getpid(void); 184extern int os_getpid(void);
183extern int os_getpgrp(void); 185extern int os_getpgrp(void);
186
184extern void init_new_thread_stack(void *sig_stack, void (*usr1_handler)(int)); 187extern void init_new_thread_stack(void *sig_stack, void (*usr1_handler)(int));
185extern void init_new_thread_signals(int altstack); 188extern void init_new_thread_signals(int altstack);
186extern int run_kernel_thread(int (*fn)(void *), void *arg, void **jmp_ptr); 189extern int run_kernel_thread(int (*fn)(void *), void *arg, void **jmp_ptr);
diff --git a/arch/um/os-Linux/process.c b/arch/um/os-Linux/process.c
index 7f5e2dac2a35..d261888f39c4 100644
--- a/arch/um/os-Linux/process.c
+++ b/arch/um/os-Linux/process.c
@@ -19,6 +19,7 @@
19#include "irq_user.h" 19#include "irq_user.h"
20#include "kern_util.h" 20#include "kern_util.h"
21#include "longjmp.h" 21#include "longjmp.h"
22#include "skas_ptrace.h"
22 23
23#define ARBITRARY_ADDR -1 24#define ARBITRARY_ADDR -1
24#define FAILURE_PID -1 25#define FAILURE_PID -1
@@ -100,6 +101,21 @@ void os_kill_process(int pid, int reap_child)
100 101
101} 102}
102 103
104/* This is here uniquely to have access to the userspace errno, i.e. the one
105 * used by ptrace in case of error.
106 */
107
108long os_ptrace_ldt(long pid, long addr, long data)
109{
110 int ret;
111
112 ret = ptrace(PTRACE_LDT, pid, addr, data);
113
114 if (ret < 0)
115 return -errno;
116 return ret;
117}
118
103/* Kill off a ptraced child by all means available. kill it normally first, 119/* Kill off a ptraced child by all means available. kill it normally first,
104 * then PTRACE_KILL it, then PTRACE_CONT it in case it's in a run state from 120 * then PTRACE_KILL it, then PTRACE_CONT it in case it's in a run state from
105 * which it can't exit directly. 121 * which it can't exit directly.
diff --git a/arch/um/sys-i386/ldt.c b/arch/um/sys-i386/ldt.c
index 1fa09a79a10b..fe0877b3509c 100644
--- a/arch/um/sys-i386/ldt.c
+++ b/arch/um/sys-i386/ldt.c
@@ -107,7 +107,7 @@ long write_ldt_entry(struct mm_id * mm_idp, int func, struct user_desc * desc,
107 * So we need to switch child's mm into our userspace, then 107 * So we need to switch child's mm into our userspace, then
108 * later switch back. 108 * later switch back.
109 * 109 *
110 * Note: I'm unshure: should interrupts be disabled here? 110 * Note: I'm unsure: should interrupts be disabled here?
111 */ 111 */
112 if(!current->active_mm || current->active_mm == &init_mm || 112 if(!current->active_mm || current->active_mm == &init_mm ||
113 mm_idp != &current->active_mm->context.skas.id) 113 mm_idp != &current->active_mm->context.skas.id)
@@ -129,9 +129,7 @@ long write_ldt_entry(struct mm_id * mm_idp, int func, struct user_desc * desc,
129 pid = userspace_pid[cpu]; 129 pid = userspace_pid[cpu];
130 } 130 }
131 131
132 res = ptrace(PTRACE_LDT, pid, 0, (unsigned long) &ldt_op); 132 res = os_ptrace_ldt(pid, 0, (unsigned long) &ldt_op);
133 if(res)
134 res = errno;
135 133
136 if(proc_mm) 134 if(proc_mm)
137 put_cpu(); 135 put_cpu();
@@ -181,8 +179,7 @@ static long read_ldt_from_host(void __user * ptr, unsigned long bytecount)
181 */ 179 */
182 180
183 cpu = get_cpu(); 181 cpu = get_cpu();
184 res = ptrace(PTRACE_LDT, userspace_pid[cpu], 0, 182 res = os_ptrace_ldt(userspace_pid[cpu], 0, (unsigned long) &ptrace_ldt);
185 (unsigned long) &ptrace_ldt);
186 put_cpu(); 183 put_cpu();
187 if(res < 0) 184 if(res < 0)
188 goto out; 185 goto out;