aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorJeff Dike <jdike@addtoit.com>2008-02-05 01:30:46 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2008-02-05 12:44:26 -0500
commitedea138584d7586a3b93b6d5ab5ec021d18e11e9 (patch)
tree0c5a5dd14256d675c8c64c8abdda86053f72abc8 /arch
parent0ba7fe03b638a084a4e15e21d2e585ba321ad9c8 (diff)
uml: tidy kern_util.h
Tidy kern_util.h. It turns out that most of the function declarations aren't used, so they can go away. os.h no longer includes kern_util.h, so files which got it through os.h now need to include it directly. A number of other files never needed it, so these includes are deleted. The structure which was used to pass signal handlers from the kernel side to the userspace side is gone. Instead, the handlers are declared here, and used directly from libc code. This allows arch/um/os-Linux/trap.c to be deleted, with its remnants being moved to arch/um/os-Linux/skas/trap.c. arch/um/os-Linux/tty.c had its inclusions changed, and it needed some style attention, so it got tidied. Signed-off-by: Jeff Dike <jdike@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/um/drivers/line.c1
-rw-r--r--arch/um/drivers/ssl.c1
-rw-r--r--arch/um/drivers/stdio_console.c1
-rw-r--r--arch/um/drivers/ubd_kern.c1
-rw-r--r--arch/um/drivers/ubd_user.c1
-rw-r--r--arch/um/include/kern_util.h118
-rw-r--r--arch/um/include/os.h4
-rw-r--r--arch/um/kernel/initrd.c1
-rw-r--r--arch/um/kernel/reboot.c1
-rw-r--r--arch/um/kernel/smp.c1
-rw-r--r--arch/um/kernel/trap.c15
-rw-r--r--arch/um/kernel/um_arch.c6
-rw-r--r--arch/um/os-Linux/Makefile4
-rw-r--r--arch/um/os-Linux/aio.c1
-rw-r--r--arch/um/os-Linux/drivers/tuntap_user.c1
-rw-r--r--arch/um/os-Linux/file.c1
-rw-r--r--arch/um/os-Linux/irq.c1
-rw-r--r--arch/um/os-Linux/mem.c1
-rw-r--r--arch/um/os-Linux/signal.c1
-rw-r--r--arch/um/os-Linux/skas/process.c1
-rw-r--r--arch/um/os-Linux/skas/trap.c18
-rw-r--r--arch/um/os-Linux/trap.c23
-rw-r--r--arch/um/os-Linux/tty.c57
-rw-r--r--arch/um/os-Linux/tty_log.c1
-rw-r--r--arch/um/sys-i386/bugs.c1
25 files changed, 89 insertions, 173 deletions
diff --git a/arch/um/drivers/line.c b/arch/um/drivers/line.c
index 5cff6536a843..fac058b49282 100644
--- a/arch/um/drivers/line.c
+++ b/arch/um/drivers/line.c
@@ -8,6 +8,7 @@
8#include "chan_kern.h" 8#include "chan_kern.h"
9#include "irq_kern.h" 9#include "irq_kern.h"
10#include "irq_user.h" 10#include "irq_user.h"
11#include "kern_util.h"
11#include "os.h" 12#include "os.h"
12 13
13#define LINE_BUFSIZE 4096 14#define LINE_BUFSIZE 4096
diff --git a/arch/um/drivers/ssl.c b/arch/um/drivers/ssl.c
index 875d60d0c6a2..f1786e64607f 100644
--- a/arch/um/drivers/ssl.c
+++ b/arch/um/drivers/ssl.c
@@ -15,7 +15,6 @@
15#include "line.h" 15#include "line.h"
16#include "ssl.h" 16#include "ssl.h"
17#include "chan_kern.h" 17#include "chan_kern.h"
18#include "kern_util.h"
19#include "kern.h" 18#include "kern.h"
20#include "init.h" 19#include "init.h"
21#include "irq_user.h" 20#include "irq_user.h"
diff --git a/arch/um/drivers/stdio_console.c b/arch/um/drivers/stdio_console.c
index 656036e90b19..cec0c33cdd39 100644
--- a/arch/um/drivers/stdio_console.c
+++ b/arch/um/drivers/stdio_console.c
@@ -22,7 +22,6 @@
22#include "stdio_console.h" 22#include "stdio_console.h"
23#include "line.h" 23#include "line.h"
24#include "chan_kern.h" 24#include "chan_kern.h"
25#include "kern_util.h"
26#include "irq_user.h" 25#include "irq_user.h"
27#include "mconsole_kern.h" 26#include "mconsole_kern.h"
28#include "init.h" 27#include "init.h"
diff --git a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c
index 7a252abbfead..4fe4d6b73070 100644
--- a/arch/um/drivers/ubd_kern.c
+++ b/arch/um/drivers/ubd_kern.c
@@ -49,6 +49,7 @@
49#include "irq_user.h" 49#include "irq_user.h"
50#include "irq_kern.h" 50#include "irq_kern.h"
51#include "ubd_user.h" 51#include "ubd_user.h"
52#include "kern_util.h"
52#include "os.h" 53#include "os.h"
53#include "mem.h" 54#include "mem.h"
54#include "mem_kern.h" 55#include "mem_kern.h"
diff --git a/arch/um/drivers/ubd_user.c b/arch/um/drivers/ubd_user.c
index 48fc7452bc1d..b591bb9c41dd 100644
--- a/arch/um/drivers/ubd_user.c
+++ b/arch/um/drivers/ubd_user.c
@@ -16,7 +16,6 @@
16#include <sys/mman.h> 16#include <sys/mman.h>
17#include <sys/param.h> 17#include <sys/param.h>
18#include "asm/types.h" 18#include "asm/types.h"
19#include "kern_util.h"
20#include "user.h" 19#include "user.h"
21#include "ubd_user.h" 20#include "ubd_user.h"
22#include "os.h" 21#include "os.h"
diff --git a/arch/um/include/kern_util.h b/arch/um/include/kern_util.h
index aa27eb0f4586..8fadf8962e3e 100644
--- a/arch/um/include/kern_util.h
+++ b/arch/um/include/kern_util.h
@@ -9,107 +9,59 @@
9#include "sysdep/ptrace.h" 9#include "sysdep/ptrace.h"
10#include "sysdep/faultinfo.h" 10#include "sysdep/faultinfo.h"
11 11
12typedef void (*kern_hndl)(int, struct uml_pt_regs *);
13
14struct kern_handlers {
15 kern_hndl relay_signal;
16 kern_hndl winch;
17 kern_hndl bus_handler;
18 kern_hndl page_fault;
19 kern_hndl sigio_handler;
20 kern_hndl timer_handler;
21};
22
23extern const struct kern_handlers handlinfo_kern;
24
25extern int ncpus; 12extern int ncpus;
26extern char *gdb_init;
27extern int kmalloc_ok; 13extern int kmalloc_ok;
28extern int jail;
29extern int nsyscalls; 14extern int nsyscalls;
30 15
31#define UML_ROUND_DOWN(addr) ((void *)(((unsigned long) addr) & PAGE_MASK))
32#define UML_ROUND_UP(addr) \ 16#define UML_ROUND_UP(addr) \
33 UML_ROUND_DOWN(((unsigned long) addr) + PAGE_SIZE - 1) 17 ((((unsigned long) addr) + PAGE_SIZE - 1) & PAGE_MASK)
34 18
35extern int kernel_fork(unsigned long flags, int (*fn)(void *), void * arg);
36extern int kernel_thread_proc(void *data);
37extern void syscall_segv(int sig);
38extern int current_pid(void);
39extern unsigned long alloc_stack(int order, int atomic); 19extern unsigned long alloc_stack(int order, int atomic);
20extern void free_stack(unsigned long stack, int order);
21
40extern int do_signal(void); 22extern int do_signal(void);
41extern int is_stack_fault(unsigned long sp); 23extern void copy_sc(struct uml_pt_regs *regs, void *from);
24extern void interrupt_end(void);
25extern void relay_signal(int sig, struct uml_pt_regs *regs);
26
42extern unsigned long segv(struct faultinfo fi, unsigned long ip, 27extern unsigned long segv(struct faultinfo fi, unsigned long ip,
43 int is_user, struct uml_pt_regs *regs); 28 int is_user, struct uml_pt_regs *regs);
44extern int handle_page_fault(unsigned long address, unsigned long ip, 29extern int handle_page_fault(unsigned long address, unsigned long ip,
45 int is_write, int is_user, int *code_out); 30 int is_write, int is_user, int *code_out);
46extern void syscall_ready(void); 31
47extern void set_tracing(void *t, int tracing);
48extern int is_tracing(void *task);
49extern int segv_syscall(void);
50extern void kern_finish_exec(void *task, int new_pid, unsigned long stack);
51extern unsigned long page_mask(void);
52extern int need_finish_fork(void);
53extern void free_stack(unsigned long stack, int order);
54extern void add_input_request(int op, void (*proc)(int), void *arg);
55extern char *current_cmd(void);
56extern void timer_handler(int sig, struct uml_pt_regs *regs);
57extern int set_signals(int enable);
58extern int pid_to_processor_id(int pid);
59extern void deliver_signals(void *t);
60extern int next_trap_index(int max);
61extern void default_idle(void);
62extern void finish_fork(void);
63extern void paging_init(void);
64extern void init_flush_vm(void);
65extern void *syscall_sp(void *t);
66extern void syscall_trace(struct uml_pt_regs *regs, int entryexit);
67extern unsigned int do_IRQ(int irq, struct uml_pt_regs *regs); 32extern unsigned int do_IRQ(int irq, struct uml_pt_regs *regs);
68extern void interrupt_end(void);
69extern void initial_thread_cb(void (*proc)(void *), void *arg);
70extern int debugger_signal(int status, int pid);
71extern void debugger_parent_signal(int status, int pid);
72extern void child_signal(int pid, int status);
73extern int init_ptrace_proxy(int idle_pid, int startup, int stop);
74extern int init_parent_proxy(int pid);
75extern int singlestepping(void *t);
76extern void check_stack_overflow(void *ptr);
77extern void relay_signal(int sig, struct uml_pt_regs *regs);
78extern int user_context(unsigned long sp);
79extern void timer_irq(struct uml_pt_regs *regs);
80extern void do_uml_exitcalls(void);
81extern int attach_debugger(int idle_pid, int pid, int stop);
82extern int config_gdb(char *str);
83extern int remove_gdb(void);
84extern char *uml_strdup(const char *string);
85extern void unprotect_kernel_mem(void);
86extern void protect_kernel_mem(void);
87extern void uml_cleanup(void);
88extern void lock_signalled_task(void *t);
89extern void IPI_handler(int cpu);
90extern int jail_setup(char *line, int *add);
91extern void *get_init_task(void);
92extern int clear_user_proc(void *buf, int size);
93extern int copy_to_user_proc(void *to, void *from, int size);
94extern int copy_from_user_proc(void *to, void *from, int size);
95extern int strlen_user_proc(char *str);
96extern long execute_syscall(void *r);
97extern int smp_sigio_handler(void); 33extern int smp_sigio_handler(void);
98extern void *get_current(void); 34extern void initial_thread_cb(void (*proc)(void *), void *arg);
99extern struct task_struct *get_task(int pid, int require);
100extern void machine_halt(void);
101extern int is_syscall(unsigned long addr); 35extern int is_syscall(unsigned long addr);
36extern void timer_handler(int sig, struct uml_pt_regs *regs);
102 37
103extern void free_irq(unsigned int, void *); 38extern void timer_handler(int sig, struct uml_pt_regs *regs);
104extern int cpu(void); 39
40extern int start_uml(void);
41extern void paging_init(void);
105 42
106extern void time_init_kern(void); 43extern void uml_cleanup(void);
44extern void do_uml_exitcalls(void);
107 45
108/* Are we disallowed to sleep? Used to choose between GFP_KERNEL and GFP_ATOMIC. */ 46/*
47 * Are we disallowed to sleep? Used to choose between GFP_KERNEL and
48 * GFP_ATOMIC.
49 */
109extern int __cant_sleep(void); 50extern int __cant_sleep(void);
110extern void sigio_handler(int sig, struct uml_pt_regs *regs); 51extern void *get_current(void);
111extern void copy_sc(struct uml_pt_regs *regs, void *from); 52extern int copy_from_user_proc(void *to, void *from, int size);
53extern int cpu(void);
54extern char *uml_strdup(const char *string);
55
112extern unsigned long to_irq_stack(unsigned long *mask_out); 56extern unsigned long to_irq_stack(unsigned long *mask_out);
113unsigned long from_irq_stack(int nested); 57extern unsigned long from_irq_stack(int nested);
114extern int start_uml(void); 58
59extern void syscall_trace(struct uml_pt_regs *regs, int entryexit);
60extern int singlestepping(void *t);
61
62extern void segv_handler(int sig, struct uml_pt_regs *regs);
63extern void bus_handler(int sig, struct uml_pt_regs *regs);
64extern void winch(int sig, struct uml_pt_regs *regs);
65
66
115#endif 67#endif
diff --git a/arch/um/include/os.h b/arch/um/include/os.h
index 82e5aeae2b84..55ca073589dc 100644
--- a/arch/um/include/os.h
+++ b/arch/um/include/os.h
@@ -8,7 +8,6 @@
8 8
9#include <stdarg.h> 9#include <stdarg.h>
10#include "irq_user.h" 10#include "irq_user.h"
11#include "kern_util.h"
12#include "longjmp.h" 11#include "longjmp.h"
13#include "mm_id.h" 12#include "mm_id.h"
14#include "sysdep/tls.h" 13#include "sysdep/tls.h"
@@ -237,9 +236,6 @@ extern void unblock_signals(void);
237extern int get_signals(void); 236extern int get_signals(void);
238extern int set_signals(int enable); 237extern int set_signals(int enable);
239 238
240/* trap.c */
241extern void os_fill_handlinfo(struct kern_handlers h);
242
243/* util.c */ 239/* util.c */
244extern void stack_protections(unsigned long address); 240extern void stack_protections(unsigned long address);
245extern int raw(int fd); 241extern int raw(int fd);
diff --git a/arch/um/kernel/initrd.c b/arch/um/kernel/initrd.c
index 16dc43e9d940..ae31c62f0323 100644
--- a/arch/um/kernel/initrd.c
+++ b/arch/um/kernel/initrd.c
@@ -7,7 +7,6 @@
7#include "linux/bootmem.h" 7#include "linux/bootmem.h"
8#include "linux/initrd.h" 8#include "linux/initrd.h"
9#include "asm/types.h" 9#include "asm/types.h"
10#include "kern_util.h"
11#include "initrd.h" 10#include "initrd.h"
12#include "init.h" 11#include "init.h"
13#include "os.h" 12#include "os.h"
diff --git a/arch/um/kernel/reboot.c b/arch/um/kernel/reboot.c
index 04cebcf0679f..1ce49cd8aca3 100644
--- a/arch/um/kernel/reboot.c
+++ b/arch/um/kernel/reboot.c
@@ -4,6 +4,7 @@
4 */ 4 */
5 5
6#include "linux/sched.h" 6#include "linux/sched.h"
7#include "kern_util.h"
7#include "os.h" 8#include "os.h"
8#include "skas.h" 9#include "skas.h"
9 10
diff --git a/arch/um/kernel/smp.c b/arch/um/kernel/smp.c
index 36d89cf8d20b..a12e5bd15790 100644
--- a/arch/um/kernel/smp.c
+++ b/arch/um/kernel/smp.c
@@ -21,7 +21,6 @@ DEFINE_PER_CPU(struct mmu_gather, mmu_gathers);
21#include "asm/smp.h" 21#include "asm/smp.h"
22#include "asm/processor.h" 22#include "asm/processor.h"
23#include "asm/spinlock.h" 23#include "asm/spinlock.h"
24#include "kern_util.h"
25#include "kern.h" 24#include "kern.h"
26#include "irq_user.h" 25#include "irq_user.h"
27#include "os.h" 26#include "os.h"
diff --git a/arch/um/kernel/trap.c b/arch/um/kernel/trap.c
index e3a3ab8f8635..ff405a446d15 100644
--- a/arch/um/kernel/trap.c
+++ b/arch/um/kernel/trap.c
@@ -128,7 +128,7 @@ static void bad_segv(struct faultinfo fi, unsigned long ip)
128 force_sig_info(SIGSEGV, &si, current); 128 force_sig_info(SIGSEGV, &si, current);
129} 129}
130 130
131static void segv_handler(int sig, struct uml_pt_regs *regs) 131void segv_handler(int sig, struct uml_pt_regs *regs)
132{ 132{
133 struct faultinfo * fi = UPT_FAULTINFO(regs); 133 struct faultinfo * fi = UPT_FAULTINFO(regs);
134 134
@@ -229,27 +229,18 @@ void relay_signal(int sig, struct uml_pt_regs *regs)
229 force_sig(sig, current); 229 force_sig(sig, current);
230} 230}
231 231
232static void bus_handler(int sig, struct uml_pt_regs *regs) 232void bus_handler(int sig, struct uml_pt_regs *regs)
233{ 233{
234 if (current->thread.fault_catcher != NULL) 234 if (current->thread.fault_catcher != NULL)
235 UML_LONGJMP(current->thread.fault_catcher, 1); 235 UML_LONGJMP(current->thread.fault_catcher, 1);
236 else relay_signal(sig, regs); 236 else relay_signal(sig, regs);
237} 237}
238 238
239static void winch(int sig, struct uml_pt_regs *regs) 239void winch(int sig, struct uml_pt_regs *regs)
240{ 240{
241 do_IRQ(WINCH_IRQ, regs); 241 do_IRQ(WINCH_IRQ, regs);
242} 242}
243 243
244const struct kern_handlers handlinfo_kern = {
245 .relay_signal = relay_signal,
246 .winch = winch,
247 .bus_handler = bus_handler,
248 .page_fault = segv_handler,
249 .sigio_handler = sigio_handler,
250 .timer_handler = timer_handler
251};
252
253void trap_init(void) 244void trap_init(void)
254{ 245{
255} 246}
diff --git a/arch/um/kernel/um_arch.c b/arch/um/kernel/um_arch.c
index f1c71393f578..9b5d2cdb621c 100644
--- a/arch/um/kernel/um_arch.c
+++ b/arch/um/kernel/um_arch.c
@@ -16,6 +16,7 @@
16#include "as-layout.h" 16#include "as-layout.h"
17#include "init.h" 17#include "init.h"
18#include "kern.h" 18#include "kern.h"
19#include "kern_util.h"
19#include "mem_user.h" 20#include "mem_user.h"
20#include "os.h" 21#include "os.h"
21#include "skas.h" 22#include "skas.h"
@@ -280,11 +281,6 @@ int __init linux_main(int argc, char **argv)
280 281
281 host_task_size = set_task_sizes_skas(&task_size); 282 host_task_size = set_task_sizes_skas(&task_size);
282 283
283 /*
284 * Setting up handlers to 'sig_info' struct
285 */
286 os_fill_handlinfo(handlinfo_kern);
287
288 brk_start = (unsigned long) sbrk(0); 284 brk_start = (unsigned long) sbrk(0);
289 285
290 /* 286 /*
diff --git a/arch/um/os-Linux/Makefile b/arch/um/os-Linux/Makefile
index 8e129af8170d..8a48d6a30064 100644
--- a/arch/um/os-Linux/Makefile
+++ b/arch/um/os-Linux/Makefile
@@ -4,7 +4,7 @@
4# 4#
5 5
6obj-y = aio.o elf_aux.o execvp.o file.o helper.o irq.o main.o mem.o process.o \ 6obj-y = aio.o elf_aux.o execvp.o file.o helper.o irq.o main.o mem.o process.o \
7 registers.o sigio.o signal.o start_up.o time.o trap.o tty.o uaccess.o \ 7 registers.o sigio.o signal.o start_up.o time.o tty.o uaccess.o \
8 umid.o tls.o user_syms.o util.o drivers/ sys-$(SUBARCH)/ skas/ 8 umid.o tls.o user_syms.o util.o drivers/ sys-$(SUBARCH)/ skas/
9 9
10obj-$(CONFIG_TTY_LOG) += tty_log.o 10obj-$(CONFIG_TTY_LOG) += tty_log.o
@@ -12,7 +12,7 @@ user-objs-$(CONFIG_TTY_LOG) += tty_log.o
12 12
13USER_OBJS := $(user-objs-y) aio.o elf_aux.o execvp.o file.o helper.o irq.o \ 13USER_OBJS := $(user-objs-y) aio.o elf_aux.o execvp.o file.o helper.o irq.o \
14 main.o mem.o process.o registers.o sigio.o signal.o start_up.o time.o \ 14 main.o mem.o process.o registers.o sigio.o signal.o start_up.o time.o \
15 trap.o tty.o tls.o uaccess.o umid.o util.o 15 tty.o tls.o uaccess.o umid.o util.o
16 16
17CFLAGS_user_syms.o += -DSUBARCH_$(SUBARCH) 17CFLAGS_user_syms.o += -DSUBARCH_$(SUBARCH)
18 18
diff --git a/arch/um/os-Linux/aio.c b/arch/um/os-Linux/aio.c
index 93dc0c80ebaf..b8d8c9ca8d4a 100644
--- a/arch/um/os-Linux/aio.c
+++ b/arch/um/os-Linux/aio.c
@@ -12,6 +12,7 @@
12#include "aio.h" 12#include "aio.h"
13#include "init.h" 13#include "init.h"
14#include "kern_constants.h" 14#include "kern_constants.h"
15#include "kern_util.h"
15#include "os.h" 16#include "os.h"
16#include "user.h" 17#include "user.h"
17 18
diff --git a/arch/um/os-Linux/drivers/tuntap_user.c b/arch/um/os-Linux/drivers/tuntap_user.c
index 1d847959d1d6..7739e29cf341 100644
--- a/arch/um/os-Linux/drivers/tuntap_user.c
+++ b/arch/um/os-Linux/drivers/tuntap_user.c
@@ -14,6 +14,7 @@
14#include <sys/wait.h> 14#include <sys/wait.h>
15#include <sys/uio.h> 15#include <sys/uio.h>
16#include "kern_constants.h" 16#include "kern_constants.h"
17#include "kern_util.h"
17#include "os.h" 18#include "os.h"
18#include "tuntap.h" 19#include "tuntap.h"
19#include "user.h" 20#include "user.h"
diff --git a/arch/um/os-Linux/file.c b/arch/um/os-Linux/file.c
index c3bb5ce70c95..9387cb11c0ad 100644
--- a/arch/um/os-Linux/file.c
+++ b/arch/um/os-Linux/file.c
@@ -17,7 +17,6 @@
17#include <sys/uio.h> 17#include <sys/uio.h>
18#include "os.h" 18#include "os.h"
19#include "user.h" 19#include "user.h"
20#include "kern_util.h"
21 20
22static void copy_stat(struct uml_stat *dst, const struct stat64 *src) 21static void copy_stat(struct uml_stat *dst, const struct stat64 *src)
23{ 22{
diff --git a/arch/um/os-Linux/irq.c b/arch/um/os-Linux/irq.c
index 6aa6f95d6524..a26e0662aa12 100644
--- a/arch/um/os-Linux/irq.c
+++ b/arch/um/os-Linux/irq.c
@@ -11,7 +11,6 @@
11#include <sys/poll.h> 11#include <sys/poll.h>
12#include <sys/types.h> 12#include <sys/types.h>
13#include <sys/time.h> 13#include <sys/time.h>
14#include "kern_util.h"
15#include "user.h" 14#include "user.h"
16#include "process.h" 15#include "process.h"
17#include "sigio.h" 16#include "sigio.h"
diff --git a/arch/um/os-Linux/mem.c b/arch/um/os-Linux/mem.c
index 9674ed1bef2f..eedc2d88ef8a 100644
--- a/arch/um/os-Linux/mem.c
+++ b/arch/um/os-Linux/mem.c
@@ -9,7 +9,6 @@
9#include <sys/types.h> 9#include <sys/types.h>
10#include <sys/mman.h> 10#include <sys/mman.h>
11#include <sys/statfs.h> 11#include <sys/statfs.h>
12#include "kern_util.h"
13#include "user.h" 12#include "user.h"
14#include "mem_user.h" 13#include "mem_user.h"
15#include "init.h" 14#include "init.h"
diff --git a/arch/um/os-Linux/signal.c b/arch/um/os-Linux/signal.c
index 37302e86fda0..7ff8f57b7150 100644
--- a/arch/um/os-Linux/signal.c
+++ b/arch/um/os-Linux/signal.c
@@ -9,6 +9,7 @@
9#include <errno.h> 9#include <errno.h>
10#include <signal.h> 10#include <signal.h>
11#include <strings.h> 11#include <strings.h>
12#include "kern_util.h"
12#include "os.h" 13#include "os.h"
13#include "sysdep/barrier.h" 14#include "sysdep/barrier.h"
14#include "sysdep/sigcontext.h" 15#include "sysdep/sigcontext.h"
diff --git a/arch/um/os-Linux/skas/process.c b/arch/um/os-Linux/skas/process.c
index e8b7a97e83d3..765cfa6ddbcd 100644
--- a/arch/um/os-Linux/skas/process.c
+++ b/arch/um/os-Linux/skas/process.c
@@ -15,6 +15,7 @@
15#include "as-layout.h" 15#include "as-layout.h"
16#include "chan_user.h" 16#include "chan_user.h"
17#include "kern_constants.h" 17#include "kern_constants.h"
18#include "kern_util.h"
18#include "mem.h" 19#include "mem.h"
19#include "os.h" 20#include "os.h"
20#include "process.h" 21#include "process.h"
diff --git a/arch/um/os-Linux/skas/trap.c b/arch/um/os-Linux/skas/trap.c
index 3b1b9244f468..a19a74f08fa9 100644
--- a/arch/um/os-Linux/skas/trap.c
+++ b/arch/um/os-Linux/skas/trap.c
@@ -3,22 +3,26 @@
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
6#if 0
7#include "kern_util.h"
8#include "skas.h"
9#include "ptrace_user.h"
10#include "sysdep/ptrace_user.h"
11#endif
12
13#include <errno.h> 6#include <errno.h>
14#include <signal.h> 7#include <signal.h>
15#include "sysdep/ptrace.h" 8#include "sysdep/ptrace.h"
16#include "kern_constants.h" 9#include "kern_constants.h"
17#include "as-layout.h" 10#include "as-layout.h"
11#include "kern_util.h"
18#include "os.h" 12#include "os.h"
19#include "sigcontext.h" 13#include "sigcontext.h"
20#include "task.h" 14#include "task.h"
21 15
16void (*sig_info[NSIG])(int, struct uml_pt_regs *) = {
17 [SIGTRAP] = relay_signal,
18 [SIGFPE] = relay_signal,
19 [SIGILL] = relay_signal,
20 [SIGWINCH] = winch,
21 [SIGBUS] = bus_handler,
22 [SIGSEGV] = segv_handler,
23 [SIGIO] = sigio_handler,
24 [SIGVTALRM] = timer_handler };
25
22static struct uml_pt_regs ksig_regs[UM_NR_CPUS]; 26static struct uml_pt_regs ksig_regs[UM_NR_CPUS];
23 27
24void sig_handler_common_skas(int sig, void *sc_ptr) 28void sig_handler_common_skas(int sig, void *sc_ptr)
diff --git a/arch/um/os-Linux/trap.c b/arch/um/os-Linux/trap.c
deleted file mode 100644
index 2a1c9843e32e..000000000000
--- a/arch/um/os-Linux/trap.c
+++ /dev/null
@@ -1,23 +0,0 @@
1/*
2 * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL
4 */
5
6#include <signal.h>
7#include "os.h"
8#include "sysdep/ptrace.h"
9
10/* Initialized from linux_main() */
11void (*sig_info[NSIG])(int, struct uml_pt_regs *);
12
13void os_fill_handlinfo(struct kern_handlers h)
14{
15 sig_info[SIGTRAP] = h.relay_signal;
16 sig_info[SIGFPE] = h.relay_signal;
17 sig_info[SIGILL] = h.relay_signal;
18 sig_info[SIGWINCH] = h.winch;
19 sig_info[SIGBUS] = h.bus_handler;
20 sig_info[SIGSEGV] = h.page_fault;
21 sig_info[SIGIO] = h.sigio_handler;
22 sig_info[SIGVTALRM] = h.timer_handler;
23}
diff --git a/arch/um/os-Linux/tty.c b/arch/um/os-Linux/tty.c
index 4cfdd18ea1ef..b09ff66a77ee 100644
--- a/arch/um/os-Linux/tty.c
+++ b/arch/um/os-Linux/tty.c
@@ -1,13 +1,16 @@
1/* 1/*
2 * Copyright (C) 2002 Jeff Dike (jdike@karaya.com) 2 * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
6#include <stdlib.h> 6#include <stdlib.h>
7#include <unistd.h>
7#include <errno.h> 8#include <errno.h>
9#include <fcntl.h>
10#include "kern_constants.h"
11#include "kern_util.h"
8#include "os.h" 12#include "os.h"
9#include "user.h" 13#include "user.h"
10#include "kern_util.h"
11 14
12struct grantpt_info { 15struct grantpt_info {
13 int fd; 16 int fd;
@@ -26,36 +29,34 @@ static void grantpt_cb(void *arg)
26int get_pty(void) 29int get_pty(void)
27{ 30{
28 struct grantpt_info info; 31 struct grantpt_info info;
29 int fd; 32 int fd, err;
30 33
31 fd = os_open_file("/dev/ptmx", of_rdwr(OPENFLAGS()), 0); 34 fd = open("/dev/ptmx", O_RDWR);
32 if(fd < 0){ 35 if (fd < 0) {
33 printk("get_pty : Couldn't open /dev/ptmx - err = %d\n", -fd); 36 err = -errno;
34 return(fd); 37 printk(UM_KERN_ERR "get_pty : Couldn't open /dev/ptmx - "
38 "err = %d\n", errno);
39 return err;
35 } 40 }
36 41
37 info.fd = fd; 42 info.fd = fd;
38 initial_thread_cb(grantpt_cb, &info); 43 initial_thread_cb(grantpt_cb, &info);
39 44
40 if(info.res < 0){ 45 if (info.res < 0) {
41 printk("get_pty : Couldn't grant pty - errno = %d\n", 46 err = -info.err;
42 -info.err); 47 printk(UM_KERN_ERR "get_pty : Couldn't grant pty - "
43 return(-1); 48 "errno = %d\n", -info.err);
49 goto out;
44 } 50 }
45 if(unlockpt(fd) < 0){ 51
46 printk("get_pty : Couldn't unlock pty - errno = %d\n", errno); 52 if (unlockpt(fd) < 0) {
47 return(-1); 53 err = -errno;
54 printk(UM_KERN_ERR "get_pty : Couldn't unlock pty - "
55 "errno = %d\n", errno);
56 goto out;
48 } 57 }
49 return(fd); 58 return fd;
59out:
60 close(fd);
61 return err;
50} 62}
51
52/*
53 * Overrides for Emacs so that we follow Linus's tabbing style.
54 * Emacs will notice this stuff at the end of the file and automatically
55 * adjust the settings for this buffer only. This must remain at the end
56 * of the file.
57 * ---------------------------------------------------------------------------
58 * Local variables:
59 * c-file-style: "linux"
60 * End:
61 */
diff --git a/arch/um/os-Linux/tty_log.c b/arch/um/os-Linux/tty_log.c
index d11a55baa6bd..cc648e6fd3a2 100644
--- a/arch/um/os-Linux/tty_log.c
+++ b/arch/um/os-Linux/tty_log.c
@@ -12,7 +12,6 @@
12#include <sys/time.h> 12#include <sys/time.h>
13#include "init.h" 13#include "init.h"
14#include "user.h" 14#include "user.h"
15#include "kern_util.h"
16#include "os.h" 15#include "os.h"
17 16
18#define TTY_LOG_DIR "./" 17#define TTY_LOG_DIR "./"
diff --git a/arch/um/sys-i386/bugs.c b/arch/um/sys-i386/bugs.c
index b0cb05228a97..a74442d13762 100644
--- a/arch/um/sys-i386/bugs.c
+++ b/arch/um/sys-i386/bugs.c
@@ -5,6 +5,7 @@
5 5
6#include <signal.h> 6#include <signal.h>
7#include "kern_constants.h" 7#include "kern_constants.h"
8#include "kern_util.h"
8#include "longjmp.h" 9#include "longjmp.h"
9#include "task.h" 10#include "task.h"
10#include "user.h" 11#include "user.h"