diff options
Diffstat (limited to 'arch/um')
-rw-r--r-- | arch/um/Kconfig | 6 | ||||
-rw-r--r-- | arch/um/Kconfig.char | 5 | ||||
-rw-r--r-- | arch/um/drivers/cow_sys.h | 1 | ||||
-rw-r--r-- | arch/um/drivers/daemon_user.c | 1 | ||||
-rw-r--r-- | arch/um/drivers/fd.c | 1 | ||||
-rw-r--r-- | arch/um/drivers/mcast_user.c | 1 | ||||
-rw-r--r-- | arch/um/drivers/mmapper_kern.c | 3 | ||||
-rw-r--r-- | arch/um/drivers/net_user.c | 1 | ||||
-rw-r--r-- | arch/um/drivers/pcap_user.c | 1 | ||||
-rw-r--r-- | arch/um/drivers/port_user.c | 1 | ||||
-rw-r--r-- | arch/um/drivers/pty.c | 1 | ||||
-rw-r--r-- | arch/um/drivers/slip_user.c | 1 | ||||
-rw-r--r-- | arch/um/drivers/tty.c | 1 | ||||
-rw-r--r-- | arch/um/drivers/xterm.c | 2 | ||||
-rw-r--r-- | arch/um/include/um_malloc.h | 17 | ||||
-rw-r--r-- | arch/um/include/user.h | 6 | ||||
-rw-r--r-- | arch/um/include/user_util.h | 1 | ||||
-rw-r--r-- | arch/um/kernel/irq.c | 1 | ||||
-rw-r--r-- | arch/um/kernel/process.c | 1 | ||||
-rw-r--r-- | arch/um/os-Linux/drivers/ethertap_user.c | 1 | ||||
-rw-r--r-- | arch/um/os-Linux/helper.c | 54 | ||||
-rw-r--r-- | arch/um/os-Linux/irq.c | 1 | ||||
-rw-r--r-- | arch/um/os-Linux/main.c | 1 | ||||
-rw-r--r-- | arch/um/os-Linux/sigio.c | 1 | ||||
-rw-r--r-- | arch/um/os-Linux/time.c | 3 |
25 files changed, 76 insertions, 37 deletions
diff --git a/arch/um/Kconfig b/arch/um/Kconfig index 78fb619bdb..5ac1f2963a 100644 --- a/arch/um/Kconfig +++ b/arch/um/Kconfig | |||
@@ -1,3 +1,8 @@ | |||
1 | config DEFCONFIG_LIST | ||
2 | string | ||
3 | option defconfig_list | ||
4 | default "arch/$ARCH/defconfig" | ||
5 | |||
1 | # UML uses the generic IRQ sugsystem | 6 | # UML uses the generic IRQ sugsystem |
2 | config GENERIC_HARDIRQS | 7 | config GENERIC_HARDIRQS |
3 | bool | 8 | bool |
@@ -52,6 +57,7 @@ menu "UML-specific options" | |||
52 | config MODE_TT | 57 | config MODE_TT |
53 | bool "Tracing thread support (DEPRECATED)" | 58 | bool "Tracing thread support (DEPRECATED)" |
54 | default n | 59 | default n |
60 | depends on BROKEN | ||
55 | help | 61 | help |
56 | This option controls whether tracing thread support is compiled | 62 | This option controls whether tracing thread support is compiled |
57 | into UML. This option is largely obsolete, given that skas0 provides | 63 | into UML. This option is largely obsolete, given that skas0 provides |
diff --git a/arch/um/Kconfig.char b/arch/um/Kconfig.char index 62d87b7117..e03e40c7aa 100644 --- a/arch/um/Kconfig.char +++ b/arch/um/Kconfig.char | |||
@@ -190,6 +190,11 @@ config HOSTAUDIO | |||
190 | tristate | 190 | tristate |
191 | default UML_SOUND | 191 | default UML_SOUND |
192 | 192 | ||
193 | #It is selected elsewhere, so kconfig would warn without this. | ||
194 | config HW_RANDOM | ||
195 | tristate | ||
196 | default n | ||
197 | |||
193 | config UML_RANDOM | 198 | config UML_RANDOM |
194 | tristate "Hardware random number generator" | 199 | tristate "Hardware random number generator" |
195 | help | 200 | help |
diff --git a/arch/um/drivers/cow_sys.h b/arch/um/drivers/cow_sys.h index 7a5b4afde6..c6a308464a 100644 --- a/arch/um/drivers/cow_sys.h +++ b/arch/um/drivers/cow_sys.h | |||
@@ -5,6 +5,7 @@ | |||
5 | #include "user_util.h" | 5 | #include "user_util.h" |
6 | #include "os.h" | 6 | #include "os.h" |
7 | #include "user.h" | 7 | #include "user.h" |
8 | #include "um_malloc.h" | ||
8 | 9 | ||
9 | static inline void *cow_malloc(int size) | 10 | static inline void *cow_malloc(int size) |
10 | { | 11 | { |
diff --git a/arch/um/drivers/daemon_user.c b/arch/um/drivers/daemon_user.c index 77954ea770..310af0f1e4 100644 --- a/arch/um/drivers/daemon_user.c +++ b/arch/um/drivers/daemon_user.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include "user_util.h" | 17 | #include "user_util.h" |
18 | #include "user.h" | 18 | #include "user.h" |
19 | #include "os.h" | 19 | #include "os.h" |
20 | #include "um_malloc.h" | ||
20 | 21 | ||
21 | #define MAX_PACKET (ETH_MAX_PACKET + ETH_HEADER_OTHER) | 22 | #define MAX_PACKET (ETH_MAX_PACKET + ETH_HEADER_OTHER) |
22 | 23 | ||
diff --git a/arch/um/drivers/fd.c b/arch/um/drivers/fd.c index 108b7dafbd..218aa0e9b7 100644 --- a/arch/um/drivers/fd.c +++ b/arch/um/drivers/fd.c | |||
@@ -12,6 +12,7 @@ | |||
12 | #include "user_util.h" | 12 | #include "user_util.h" |
13 | #include "chan_user.h" | 13 | #include "chan_user.h" |
14 | #include "os.h" | 14 | #include "os.h" |
15 | #include "um_malloc.h" | ||
15 | 16 | ||
16 | struct fd_chan { | 17 | struct fd_chan { |
17 | int fd; | 18 | int fd; |
diff --git a/arch/um/drivers/mcast_user.c b/arch/um/drivers/mcast_user.c index 4d2bd39a85..8138f5ea1b 100644 --- a/arch/um/drivers/mcast_user.c +++ b/arch/um/drivers/mcast_user.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include "user_util.h" | 23 | #include "user_util.h" |
24 | #include "user.h" | 24 | #include "user.h" |
25 | #include "os.h" | 25 | #include "os.h" |
26 | #include "um_malloc.h" | ||
26 | 27 | ||
27 | #define MAX_PACKET (ETH_MAX_PACKET + ETH_HEADER_OTHER) | 28 | #define MAX_PACKET (ETH_MAX_PACKET + ETH_HEADER_OTHER) |
28 | 29 | ||
diff --git a/arch/um/drivers/mmapper_kern.c b/arch/um/drivers/mmapper_kern.c index 9a3b5daf62..df3516e47d 100644 --- a/arch/um/drivers/mmapper_kern.c +++ b/arch/um/drivers/mmapper_kern.c | |||
@@ -95,7 +95,8 @@ static const struct file_operations mmapper_fops = { | |||
95 | .release = mmapper_release, | 95 | .release = mmapper_release, |
96 | }; | 96 | }; |
97 | 97 | ||
98 | static const struct miscdevice mmapper_dev = { | 98 | /* No locking needed - only used (and modified) by below initcall and exitcall. */ |
99 | static struct miscdevice mmapper_dev = { | ||
99 | .minor = MISC_DYNAMIC_MINOR, | 100 | .minor = MISC_DYNAMIC_MINOR, |
100 | .name = "mmapper", | 101 | .name = "mmapper", |
101 | .fops = &mmapper_fops | 102 | .fops = &mmapper_fops |
diff --git a/arch/um/drivers/net_user.c b/arch/um/drivers/net_user.c index f3a3f8a29c..0ffd7ac295 100644 --- a/arch/um/drivers/net_user.c +++ b/arch/um/drivers/net_user.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include "kern_util.h" | 18 | #include "kern_util.h" |
19 | #include "net_user.h" | 19 | #include "net_user.h" |
20 | #include "os.h" | 20 | #include "os.h" |
21 | #include "um_malloc.h" | ||
21 | 22 | ||
22 | int tap_open_common(void *dev, char *gate_addr) | 23 | int tap_open_common(void *dev, char *gate_addr) |
23 | { | 24 | { |
diff --git a/arch/um/drivers/pcap_user.c b/arch/um/drivers/pcap_user.c index 2ef641ded9..11921a7baa 100644 --- a/arch/um/drivers/pcap_user.c +++ b/arch/um/drivers/pcap_user.c | |||
@@ -12,6 +12,7 @@ | |||
12 | #include "net_user.h" | 12 | #include "net_user.h" |
13 | #include "pcap_user.h" | 13 | #include "pcap_user.h" |
14 | #include "user.h" | 14 | #include "user.h" |
15 | #include "um_malloc.h" | ||
15 | 16 | ||
16 | #define MAX_PACKET (ETH_MAX_PACKET + ETH_HEADER_OTHER) | 17 | #define MAX_PACKET (ETH_MAX_PACKET + ETH_HEADER_OTHER) |
17 | 18 | ||
diff --git a/arch/um/drivers/port_user.c b/arch/um/drivers/port_user.c index f2e8fc42ec..bc6afaf74c 100644 --- a/arch/um/drivers/port_user.c +++ b/arch/um/drivers/port_user.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include "chan_user.h" | 19 | #include "chan_user.h" |
20 | #include "port.h" | 20 | #include "port.h" |
21 | #include "os.h" | 21 | #include "os.h" |
22 | #include "um_malloc.h" | ||
22 | 23 | ||
23 | struct port_chan { | 24 | struct port_chan { |
24 | int raw; | 25 | int raw; |
diff --git a/arch/um/drivers/pty.c b/arch/um/drivers/pty.c index abec620e83..829a5eca8c 100644 --- a/arch/um/drivers/pty.c +++ b/arch/um/drivers/pty.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #include "user_util.h" | 13 | #include "user_util.h" |
14 | #include "kern_util.h" | 14 | #include "kern_util.h" |
15 | #include "os.h" | 15 | #include "os.h" |
16 | #include "um_malloc.h" | ||
16 | 17 | ||
17 | struct pty_chan { | 18 | struct pty_chan { |
18 | void (*announce)(char *dev_name, int dev); | 19 | void (*announce)(char *dev_name, int dev); |
diff --git a/arch/um/drivers/slip_user.c b/arch/um/drivers/slip_user.c index 8460285c69..7eddacc53b 100644 --- a/arch/um/drivers/slip_user.c +++ b/arch/um/drivers/slip_user.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include "slip.h" | 15 | #include "slip.h" |
16 | #include "slip_common.h" | 16 | #include "slip_common.h" |
17 | #include "os.h" | 17 | #include "os.h" |
18 | #include "um_malloc.h" | ||
18 | 19 | ||
19 | void slip_user_init(void *data, void *dev) | 20 | void slip_user_init(void *data, void *dev) |
20 | { | 21 | { |
diff --git a/arch/um/drivers/tty.c b/arch/um/drivers/tty.c index 11de3ac1eb..d95d64309e 100644 --- a/arch/um/drivers/tty.c +++ b/arch/um/drivers/tty.c | |||
@@ -11,6 +11,7 @@ | |||
11 | #include "user_util.h" | 11 | #include "user_util.h" |
12 | #include "user.h" | 12 | #include "user.h" |
13 | #include "os.h" | 13 | #include "os.h" |
14 | #include "um_malloc.h" | ||
14 | 15 | ||
15 | struct tty_chan { | 16 | struct tty_chan { |
16 | char *dev; | 17 | char *dev; |
diff --git a/arch/um/drivers/xterm.c b/arch/um/drivers/xterm.c index 386f8b9529..850221d9b4 100644 --- a/arch/um/drivers/xterm.c +++ b/arch/um/drivers/xterm.c | |||
@@ -136,8 +136,6 @@ int xterm_open(int input, int output, int primary, void *d, | |||
136 | return(pid); | 136 | return(pid); |
137 | } | 137 | } |
138 | 138 | ||
139 | if(data->stack == 0) free_stack(stack, 0); | ||
140 | |||
141 | if (data->direct_rcv) { | 139 | if (data->direct_rcv) { |
142 | new = os_rcv_fd(fd, &data->helper_pid); | 140 | new = os_rcv_fd(fd, &data->helper_pid); |
143 | } else { | 141 | } else { |
diff --git a/arch/um/include/um_malloc.h b/arch/um/include/um_malloc.h new file mode 100644 index 0000000000..0363a9b53f --- /dev/null +++ b/arch/um/include/um_malloc.h | |||
@@ -0,0 +1,17 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2005 Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it> | ||
3 | * Licensed under the GPL | ||
4 | */ | ||
5 | |||
6 | #ifndef __UM_MALLOC_H__ | ||
7 | #define __UM_MALLOC_H__ | ||
8 | |||
9 | extern void *um_kmalloc(int size); | ||
10 | extern void *um_kmalloc_atomic(int size); | ||
11 | extern void kfree(const void *ptr); | ||
12 | |||
13 | extern void *um_vmalloc(int size); | ||
14 | extern void *um_vmalloc_atomic(int size); | ||
15 | extern void vfree(void *ptr); | ||
16 | |||
17 | #endif /* __UM_MALLOC_H__ */ | ||
diff --git a/arch/um/include/user.h b/arch/um/include/user.h index 39f8c88010..acadce3f27 100644 --- a/arch/um/include/user.h +++ b/arch/um/include/user.h | |||
@@ -11,17 +11,11 @@ extern void panic(const char *fmt, ...) | |||
11 | extern int printk(const char *fmt, ...) | 11 | extern int printk(const char *fmt, ...) |
12 | __attribute__ ((format (printf, 1, 2))); | 12 | __attribute__ ((format (printf, 1, 2))); |
13 | extern void schedule(void); | 13 | extern void schedule(void); |
14 | extern void *um_kmalloc(int size); | ||
15 | extern void *um_kmalloc_atomic(int size); | ||
16 | extern void kfree(void *ptr); | ||
17 | extern int in_aton(char *str); | 14 | extern int in_aton(char *str); |
18 | extern int open_gdb_chan(void); | 15 | extern int open_gdb_chan(void); |
19 | /* These use size_t, however unsigned long is correct on both i386 and x86_64. */ | 16 | /* These use size_t, however unsigned long is correct on both i386 and x86_64. */ |
20 | extern unsigned long strlcpy(char *, const char *, unsigned long); | 17 | extern unsigned long strlcpy(char *, const char *, unsigned long); |
21 | extern unsigned long strlcat(char *, const char *, unsigned long); | 18 | extern unsigned long strlcat(char *, const char *, unsigned long); |
22 | extern void *um_vmalloc(int size); | ||
23 | extern void *um_vmalloc_atomic(int size); | ||
24 | extern void vfree(void *ptr); | ||
25 | 19 | ||
26 | #endif | 20 | #endif |
27 | 21 | ||
diff --git a/arch/um/include/user_util.h b/arch/um/include/user_util.h index 802d784251..06625fefef 100644 --- a/arch/um/include/user_util.h +++ b/arch/um/include/user_util.h | |||
@@ -52,7 +52,6 @@ extern int linux_main(int argc, char **argv); | |||
52 | extern void set_cmdline(char *cmd); | 52 | extern void set_cmdline(char *cmd); |
53 | extern void input_cb(void (*proc)(void *), void *arg, int arg_len); | 53 | extern void input_cb(void (*proc)(void *), void *arg, int arg_len); |
54 | extern int get_pty(void); | 54 | extern int get_pty(void); |
55 | extern void *um_kmalloc(int size); | ||
56 | extern int switcheroo(int fd, int prot, void *from, void *to, int size); | 55 | extern int switcheroo(int fd, int prot, void *from, void *to, int size); |
57 | extern void do_exec(int old_pid, int new_pid); | 56 | extern void do_exec(int old_pid, int new_pid); |
58 | extern void tracer_panic(char *msg, ...) | 57 | extern void tracer_panic(char *msg, ...) |
diff --git a/arch/um/kernel/irq.c b/arch/um/kernel/irq.c index ef259569fd..5c1e611f62 100644 --- a/arch/um/kernel/irq.c +++ b/arch/um/kernel/irq.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include "irq_kern.h" | 31 | #include "irq_kern.h" |
32 | #include "os.h" | 32 | #include "os.h" |
33 | #include "sigio.h" | 33 | #include "sigio.h" |
34 | #include "um_malloc.h" | ||
34 | #include "misc_constants.h" | 35 | #include "misc_constants.h" |
35 | 36 | ||
36 | /* | 37 | /* |
diff --git a/arch/um/kernel/process.c b/arch/um/kernel/process.c index fe6c64abda..348b272bb7 100644 --- a/arch/um/kernel/process.c +++ b/arch/um/kernel/process.c | |||
@@ -46,6 +46,7 @@ | |||
46 | #include "mode.h" | 46 | #include "mode.h" |
47 | #include "mode_kern.h" | 47 | #include "mode_kern.h" |
48 | #include "choose-mode.h" | 48 | #include "choose-mode.h" |
49 | #include "um_malloc.h" | ||
49 | 50 | ||
50 | /* This is a per-cpu array. A processor only modifies its entry and it only | 51 | /* This is a per-cpu array. A processor only modifies its entry and it only |
51 | * cares about its entry, so it's OK if another processor is modifying its | 52 | * cares about its entry, so it's OK if another processor is modifying its |
diff --git a/arch/um/os-Linux/drivers/ethertap_user.c b/arch/um/os-Linux/drivers/ethertap_user.c index f559bdf746..863981ba14 100644 --- a/arch/um/os-Linux/drivers/ethertap_user.c +++ b/arch/um/os-Linux/drivers/ethertap_user.c | |||
@@ -20,6 +20,7 @@ | |||
20 | #include "net_user.h" | 20 | #include "net_user.h" |
21 | #include "etap.h" | 21 | #include "etap.h" |
22 | #include "os.h" | 22 | #include "os.h" |
23 | #include "um_malloc.h" | ||
23 | 24 | ||
24 | #define MAX_PACKET ETH_MAX_PACKET | 25 | #define MAX_PACKET ETH_MAX_PACKET |
25 | 26 | ||
diff --git a/arch/um/os-Linux/helper.c b/arch/um/os-Linux/helper.c index cd15b9df5b..d13299cfa3 100644 --- a/arch/um/os-Linux/helper.c +++ b/arch/um/os-Linux/helper.c | |||
@@ -35,22 +35,23 @@ static int helper_child(void *arg) | |||
35 | char **argv = data->argv; | 35 | char **argv = data->argv; |
36 | int errval; | 36 | int errval; |
37 | 37 | ||
38 | if(helper_pause){ | 38 | if (helper_pause){ |
39 | signal(SIGHUP, helper_hup); | 39 | signal(SIGHUP, helper_hup); |
40 | pause(); | 40 | pause(); |
41 | } | 41 | } |
42 | if(data->pre_exec != NULL) | 42 | if (data->pre_exec != NULL) |
43 | (*data->pre_exec)(data->pre_data); | 43 | (*data->pre_exec)(data->pre_data); |
44 | execvp(argv[0], argv); | 44 | execvp(argv[0], argv); |
45 | errval = -errno; | 45 | errval = -errno; |
46 | printk("helper_child - execve of '%s' failed - errno = %d\n", argv[0], errno); | 46 | printk("helper_child - execve of '%s' failed - errno = %d\n", argv[0], errno); |
47 | os_write_file(data->fd, &errval, sizeof(errval)); | 47 | os_write_file(data->fd, &errval, sizeof(errval)); |
48 | kill(os_getpid(), SIGKILL); | 48 | kill(os_getpid(), SIGKILL); |
49 | return(0); | 49 | return 0; |
50 | } | 50 | } |
51 | 51 | ||
52 | /* Returns either the pid of the child process we run or -E* on failure. | 52 | /* Returns either the pid of the child process we run or -E* on failure. |
53 | * XXX The alloc_stack here breaks if this is called in the tracing thread */ | 53 | * XXX The alloc_stack here breaks if this is called in the tracing thread, so |
54 | * we need to receive a preallocated stack (a local buffer is ok). */ | ||
54 | int run_helper(void (*pre_exec)(void *), void *pre_data, char **argv, | 55 | int run_helper(void (*pre_exec)(void *), void *pre_data, char **argv, |
55 | unsigned long *stack_out) | 56 | unsigned long *stack_out) |
56 | { | 57 | { |
@@ -58,20 +59,21 @@ int run_helper(void (*pre_exec)(void *), void *pre_data, char **argv, | |||
58 | unsigned long stack, sp; | 59 | unsigned long stack, sp; |
59 | int pid, fds[2], ret, n; | 60 | int pid, fds[2], ret, n; |
60 | 61 | ||
61 | if((stack_out != NULL) && (*stack_out != 0)) | 62 | if ((stack_out != NULL) && (*stack_out != 0)) |
62 | stack = *stack_out; | 63 | stack = *stack_out; |
63 | else stack = alloc_stack(0, __cant_sleep()); | 64 | else |
64 | if(stack == 0) | 65 | stack = alloc_stack(0, __cant_sleep()); |
66 | if (stack == 0) | ||
65 | return -ENOMEM; | 67 | return -ENOMEM; |
66 | 68 | ||
67 | ret = os_pipe(fds, 1, 0); | 69 | ret = os_pipe(fds, 1, 0); |
68 | if(ret < 0){ | 70 | if (ret < 0) { |
69 | printk("run_helper : pipe failed, ret = %d\n", -ret); | 71 | printk("run_helper : pipe failed, ret = %d\n", -ret); |
70 | goto out_free; | 72 | goto out_free; |
71 | } | 73 | } |
72 | 74 | ||
73 | ret = os_set_exec_close(fds[1], 1); | 75 | ret = os_set_exec_close(fds[1], 1); |
74 | if(ret < 0){ | 76 | if (ret < 0) { |
75 | printk("run_helper : setting FD_CLOEXEC failed, ret = %d\n", | 77 | printk("run_helper : setting FD_CLOEXEC failed, ret = %d\n", |
76 | -ret); | 78 | -ret); |
77 | goto out_close; | 79 | goto out_close; |
@@ -83,7 +85,7 @@ int run_helper(void (*pre_exec)(void *), void *pre_data, char **argv, | |||
83 | data.argv = argv; | 85 | data.argv = argv; |
84 | data.fd = fds[1]; | 86 | data.fd = fds[1]; |
85 | pid = clone(helper_child, (void *) sp, CLONE_VM | SIGCHLD, &data); | 87 | pid = clone(helper_child, (void *) sp, CLONE_VM | SIGCHLD, &data); |
86 | if(pid < 0){ | 88 | if (pid < 0) { |
87 | ret = -errno; | 89 | ret = -errno; |
88 | printk("run_helper : clone failed, errno = %d\n", errno); | 90 | printk("run_helper : clone failed, errno = %d\n", errno); |
89 | goto out_close; | 91 | goto out_close; |
@@ -95,10 +97,10 @@ int run_helper(void (*pre_exec)(void *), void *pre_data, char **argv, | |||
95 | /* Read the errno value from the child, if the exec failed, or get 0 if | 97 | /* Read the errno value from the child, if the exec failed, or get 0 if |
96 | * the exec succeeded because the pipe fd was set as close-on-exec. */ | 98 | * the exec succeeded because the pipe fd was set as close-on-exec. */ |
97 | n = os_read_file(fds[0], &ret, sizeof(ret)); | 99 | n = os_read_file(fds[0], &ret, sizeof(ret)); |
98 | if(n == 0) | 100 | if (n == 0) { |
99 | ret = pid; | 101 | ret = pid; |
100 | else { | 102 | } else { |
101 | if(n < 0){ | 103 | if (n < 0) { |
102 | printk("run_helper : read on pipe failed, ret = %d\n", | 104 | printk("run_helper : read on pipe failed, ret = %d\n", |
103 | -n); | 105 | -n); |
104 | ret = n; | 106 | ret = n; |
@@ -112,10 +114,9 @@ out_close: | |||
112 | close(fds[1]); | 114 | close(fds[1]); |
113 | close(fds[0]); | 115 | close(fds[0]); |
114 | out_free: | 116 | out_free: |
115 | if(stack_out == NULL) | 117 | if ((stack_out == NULL) || (*stack_out == 0)) |
116 | free_stack(stack, 0); | 118 | free_stack(stack, 0); |
117 | else *stack_out = stack; | 119 | return ret; |
118 | return(ret); | ||
119 | } | 120 | } |
120 | 121 | ||
121 | int run_helper_thread(int (*proc)(void *), void *arg, unsigned int flags, | 122 | int run_helper_thread(int (*proc)(void *), void *arg, unsigned int flags, |
@@ -125,31 +126,32 @@ int run_helper_thread(int (*proc)(void *), void *arg, unsigned int flags, | |||
125 | int pid, status, err; | 126 | int pid, status, err; |
126 | 127 | ||
127 | stack = alloc_stack(stack_order, __cant_sleep()); | 128 | stack = alloc_stack(stack_order, __cant_sleep()); |
128 | if(stack == 0) return(-ENOMEM); | 129 | if (stack == 0) |
130 | return -ENOMEM; | ||
129 | 131 | ||
130 | sp = stack + (page_size() << stack_order) - sizeof(void *); | 132 | sp = stack + (page_size() << stack_order) - sizeof(void *); |
131 | pid = clone(proc, (void *) sp, flags | SIGCHLD, arg); | 133 | pid = clone(proc, (void *) sp, flags | SIGCHLD, arg); |
132 | if(pid < 0){ | 134 | if (pid < 0) { |
133 | err = -errno; | 135 | err = -errno; |
134 | printk("run_helper_thread : clone failed, errno = %d\n", | 136 | printk("run_helper_thread : clone failed, errno = %d\n", |
135 | errno); | 137 | errno); |
136 | return err; | 138 | return err; |
137 | } | 139 | } |
138 | if(stack_out == NULL){ | 140 | if (stack_out == NULL) { |
139 | CATCH_EINTR(pid = waitpid(pid, &status, 0)); | 141 | CATCH_EINTR(pid = waitpid(pid, &status, 0)); |
140 | if(pid < 0){ | 142 | if (pid < 0) { |
141 | err = -errno; | 143 | err = -errno; |
142 | printk("run_helper_thread - wait failed, errno = %d\n", | 144 | printk("run_helper_thread - wait failed, errno = %d\n", |
143 | errno); | 145 | errno); |
144 | pid = err; | 146 | pid = err; |
145 | } | 147 | } |
146 | if(!WIFEXITED(status) || (WEXITSTATUS(status) != 0)) | 148 | if (!WIFEXITED(status) || (WEXITSTATUS(status) != 0)) |
147 | printk("run_helper_thread - thread returned status " | 149 | printk("run_helper_thread - thread returned status " |
148 | "0x%x\n", status); | 150 | "0x%x\n", status); |
149 | free_stack(stack, stack_order); | 151 | free_stack(stack, stack_order); |
150 | } | 152 | } else |
151 | else *stack_out = stack; | 153 | *stack_out = stack; |
152 | return(pid); | 154 | return pid; |
153 | } | 155 | } |
154 | 156 | ||
155 | int helper_wait(int pid) | 157 | int helper_wait(int pid) |
@@ -157,9 +159,9 @@ int helper_wait(int pid) | |||
157 | int ret; | 159 | int ret; |
158 | 160 | ||
159 | CATCH_EINTR(ret = waitpid(pid, NULL, WNOHANG)); | 161 | CATCH_EINTR(ret = waitpid(pid, NULL, WNOHANG)); |
160 | if(ret < 0){ | 162 | if (ret < 0) { |
161 | ret = -errno; | 163 | ret = -errno; |
162 | printk("helper_wait : waitpid failed, errno = %d\n", errno); | 164 | printk("helper_wait : waitpid failed, errno = %d\n", errno); |
163 | } | 165 | } |
164 | return(ret); | 166 | return ret; |
165 | } | 167 | } |
diff --git a/arch/um/os-Linux/irq.c b/arch/um/os-Linux/irq.c index a97206df5b..d46b818c13 100644 --- a/arch/um/os-Linux/irq.c +++ b/arch/um/os-Linux/irq.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include "sigio.h" | 18 | #include "sigio.h" |
19 | #include "irq_user.h" | 19 | #include "irq_user.h" |
20 | #include "os.h" | 20 | #include "os.h" |
21 | #include "um_malloc.h" | ||
21 | 22 | ||
22 | static struct pollfd *pollfds = NULL; | 23 | static struct pollfd *pollfds = NULL; |
23 | static int pollfds_num = 0; | 24 | static int pollfds_num = 0; |
diff --git a/arch/um/os-Linux/main.c b/arch/um/os-Linux/main.c index d1c5670787..685feaab65 100644 --- a/arch/um/os-Linux/main.c +++ b/arch/um/os-Linux/main.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include "choose-mode.h" | 23 | #include "choose-mode.h" |
24 | #include "uml-config.h" | 24 | #include "uml-config.h" |
25 | #include "os.h" | 25 | #include "os.h" |
26 | #include "um_malloc.h" | ||
26 | 27 | ||
27 | /* Set in set_stklim, which is called from main and __wrap_malloc. | 28 | /* Set in set_stklim, which is called from main and __wrap_malloc. |
28 | * __wrap_malloc only calls it if main hasn't started. | 29 | * __wrap_malloc only calls it if main hasn't started. |
diff --git a/arch/um/os-Linux/sigio.c b/arch/um/os-Linux/sigio.c index f6457765b1..925a65240c 100644 --- a/arch/um/os-Linux/sigio.c +++ b/arch/um/os-Linux/sigio.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include "user_util.h" | 19 | #include "user_util.h" |
20 | #include "sigio.h" | 20 | #include "sigio.h" |
21 | #include "os.h" | 21 | #include "os.h" |
22 | #include "um_malloc.h" | ||
22 | 23 | ||
23 | /* Protected by sigio_lock(), also used by sigio_cleanup, which is an | 24 | /* Protected by sigio_lock(), also used by sigio_cleanup, which is an |
24 | * exitcall. | 25 | * exitcall. |
diff --git a/arch/um/os-Linux/time.c b/arch/um/os-Linux/time.c index 38be096e75..2115b8beb5 100644 --- a/arch/um/os-Linux/time.c +++ b/arch/um/os-Linux/time.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #include "process.h" | 16 | #include "process.h" |
17 | #include "kern_constants.h" | 17 | #include "kern_constants.h" |
18 | #include "os.h" | 18 | #include "os.h" |
19 | #include "uml-config.h" | ||
19 | 20 | ||
20 | int set_interval(int is_virtual) | 21 | int set_interval(int is_virtual) |
21 | { | 22 | { |
@@ -30,7 +31,7 @@ int set_interval(int is_virtual) | |||
30 | return 0; | 31 | return 0; |
31 | } | 32 | } |
32 | 33 | ||
33 | #ifdef CONFIG_MODE_TT | 34 | #ifdef UML_CONFIG_MODE_TT |
34 | void enable_timer(void) | 35 | void enable_timer(void) |
35 | { | 36 | { |
36 | set_interval(1); | 37 | set_interval(1); |