diff options
Diffstat (limited to 'arch/um/os-Linux')
-rw-r--r-- | arch/um/os-Linux/drivers/ethertap_user.c | 2 | ||||
-rw-r--r-- | arch/um/os-Linux/helper.c | 10 | ||||
-rw-r--r-- | arch/um/os-Linux/mem.c | 23 | ||||
-rw-r--r-- | arch/um/os-Linux/sigio.c | 2 | ||||
-rw-r--r-- | arch/um/os-Linux/skas/mem.c | 4 | ||||
-rw-r--r-- | arch/um/os-Linux/skas/process.c | 4 | ||||
-rw-r--r-- | arch/um/os-Linux/sys-i386/tls.c | 1 | ||||
-rw-r--r-- | arch/um/os-Linux/umid.c | 15 | ||||
-rw-r--r-- | arch/um/os-Linux/user_syms.c | 9 |
9 files changed, 42 insertions, 28 deletions
diff --git a/arch/um/os-Linux/drivers/ethertap_user.c b/arch/um/os-Linux/drivers/ethertap_user.c index 901b85e8a1c6..8f49507e64ef 100644 --- a/arch/um/os-Linux/drivers/ethertap_user.c +++ b/arch/um/os-Linux/drivers/ethertap_user.c | |||
@@ -40,7 +40,7 @@ static void etap_change(int op, unsigned char *addr, unsigned char *netmask, | |||
40 | int fd) | 40 | int fd) |
41 | { | 41 | { |
42 | struct addr_change change; | 42 | struct addr_change change; |
43 | void *output; | 43 | char *output; |
44 | int n; | 44 | int n; |
45 | 45 | ||
46 | change.what = op; | 46 | change.what = op; |
diff --git a/arch/um/os-Linux/helper.c b/arch/um/os-Linux/helper.c index 6490a4ff40ac..6987d1d247a2 100644 --- a/arch/um/os-Linux/helper.c +++ b/arch/um/os-Linux/helper.c | |||
@@ -43,7 +43,7 @@ static int helper_child(void *arg) | |||
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("execvp 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); |
@@ -92,15 +92,15 @@ int run_helper(void (*pre_exec)(void *), void *pre_data, char **argv, | |||
92 | close(fds[1]); | 92 | close(fds[1]); |
93 | fds[1] = -1; | 93 | fds[1] = -1; |
94 | 94 | ||
95 | /*Read the errno value from the child.*/ | 95 | /* 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. */ | ||
96 | n = os_read_file(fds[0], &ret, sizeof(ret)); | 97 | n = os_read_file(fds[0], &ret, sizeof(ret)); |
97 | if(n < 0){ | 98 | if (n < 0) { |
98 | printk("run_helper : read on pipe failed, ret = %d\n", -n); | 99 | printk("run_helper : read on pipe failed, ret = %d\n", -n); |
99 | ret = n; | 100 | ret = n; |
100 | kill(pid, SIGKILL); | 101 | kill(pid, SIGKILL); |
101 | CATCH_EINTR(waitpid(pid, NULL, 0)); | 102 | CATCH_EINTR(waitpid(pid, NULL, 0)); |
102 | } | 103 | } else if(n != 0){ |
103 | else if(n != 0){ | ||
104 | CATCH_EINTR(n = waitpid(pid, NULL, 0)); | 104 | CATCH_EINTR(n = waitpid(pid, NULL, 0)); |
105 | ret = -errno; | 105 | ret = -errno; |
106 | } else { | 106 | } else { |
diff --git a/arch/um/os-Linux/mem.c b/arch/um/os-Linux/mem.c index 6ab372da9657..71bb90a7606d 100644 --- a/arch/um/os-Linux/mem.c +++ b/arch/um/os-Linux/mem.c | |||
@@ -53,33 +53,36 @@ static void __init find_tempdir(void) | |||
53 | */ | 53 | */ |
54 | int make_tempfile(const char *template, char **out_tempname, int do_unlink) | 54 | int make_tempfile(const char *template, char **out_tempname, int do_unlink) |
55 | { | 55 | { |
56 | char tempname[MAXPATHLEN]; | 56 | char *tempname; |
57 | int fd; | 57 | int fd; |
58 | 58 | ||
59 | tempname = malloc(MAXPATHLEN); | ||
60 | |||
59 | find_tempdir(); | 61 | find_tempdir(); |
60 | if (*template != '/') | 62 | if (template[0] != '/') |
61 | strcpy(tempname, tempdir); | 63 | strcpy(tempname, tempdir); |
62 | else | 64 | else |
63 | *tempname = 0; | 65 | tempname[0] = '\0'; |
64 | strcat(tempname, template); | 66 | strcat(tempname, template); |
65 | fd = mkstemp(tempname); | 67 | fd = mkstemp(tempname); |
66 | if(fd < 0){ | 68 | if(fd < 0){ |
67 | fprintf(stderr, "open - cannot create %s: %s\n", tempname, | 69 | fprintf(stderr, "open - cannot create %s: %s\n", tempname, |
68 | strerror(errno)); | 70 | strerror(errno)); |
69 | return -1; | 71 | goto out; |
70 | } | 72 | } |
71 | if(do_unlink && (unlink(tempname) < 0)){ | 73 | if(do_unlink && (unlink(tempname) < 0)){ |
72 | perror("unlink"); | 74 | perror("unlink"); |
73 | return -1; | 75 | goto out; |
74 | } | 76 | } |
75 | if(out_tempname){ | 77 | if(out_tempname){ |
76 | *out_tempname = strdup(tempname); | 78 | *out_tempname = tempname; |
77 | if(*out_tempname == NULL){ | 79 | } else { |
78 | perror("strdup"); | 80 | free(tempname); |
79 | return -1; | ||
80 | } | ||
81 | } | 81 | } |
82 | return(fd); | 82 | return(fd); |
83 | out: | ||
84 | free(tempname); | ||
85 | return -1; | ||
83 | } | 86 | } |
84 | 87 | ||
85 | #define TEMPNAME_TEMPLATE "vm_file-XXXXXX" | 88 | #define TEMPNAME_TEMPLATE "vm_file-XXXXXX" |
diff --git a/arch/um/os-Linux/sigio.c b/arch/um/os-Linux/sigio.c index 9ba942947146..00e9388e947a 100644 --- a/arch/um/os-Linux/sigio.c +++ b/arch/um/os-Linux/sigio.c | |||
@@ -304,8 +304,8 @@ out_clear_poll: | |||
304 | .size = 0, | 304 | .size = 0, |
305 | .used = 0 }); | 305 | .used = 0 }); |
306 | out_free: | 306 | out_free: |
307 | kfree(p); | ||
308 | sigio_unlock(); | 307 | sigio_unlock(); |
308 | kfree(p); | ||
309 | out_close2: | 309 | out_close2: |
310 | close(l_sigio_private[0]); | 310 | close(l_sigio_private[0]); |
311 | close(l_sigio_private[1]); | 311 | close(l_sigio_private[1]); |
diff --git a/arch/um/os-Linux/skas/mem.c b/arch/um/os-Linux/skas/mem.c index fbb080c2fc26..b3c11cfa995a 100644 --- a/arch/um/os-Linux/skas/mem.c +++ b/arch/um/os-Linux/skas/mem.c | |||
@@ -82,8 +82,8 @@ static inline long do_syscall_stub(struct mm_id * mm_idp, void **addr) | |||
82 | if (offset) { | 82 | if (offset) { |
83 | data = (unsigned long *)(mm_idp->stack + | 83 | data = (unsigned long *)(mm_idp->stack + |
84 | offset - UML_CONFIG_STUB_DATA); | 84 | offset - UML_CONFIG_STUB_DATA); |
85 | printk("do_syscall_stub : ret = %d, offset = %d, " | 85 | printk("do_syscall_stub : ret = %ld, offset = %ld, " |
86 | "data = 0x%x\n", ret, offset, data); | 86 | "data = %p\n", ret, offset, data); |
87 | syscall = (unsigned long *)((unsigned long)data + data[0]); | 87 | syscall = (unsigned long *)((unsigned long)data + data[0]); |
88 | printk("do_syscall_stub: syscall %ld failed, return value = " | 88 | printk("do_syscall_stub: syscall %ld failed, return value = " |
89 | "0x%lx, expected return value = 0x%lx\n", | 89 | "0x%lx, expected return value = 0x%lx\n", |
diff --git a/arch/um/os-Linux/skas/process.c b/arch/um/os-Linux/skas/process.c index bbf34cb91ce1..045ae0037456 100644 --- a/arch/um/os-Linux/skas/process.c +++ b/arch/um/os-Linux/skas/process.c | |||
@@ -265,7 +265,7 @@ void userspace(union uml_pt_regs *regs) | |||
265 | if(err) | 265 | if(err) |
266 | panic("userspace - could not resume userspace process, " | 266 | panic("userspace - could not resume userspace process, " |
267 | "pid=%d, ptrace operation = %d, errno = %d\n", | 267 | "pid=%d, ptrace operation = %d, errno = %d\n", |
268 | op, errno); | 268 | pid, op, errno); |
269 | 269 | ||
270 | CATCH_EINTR(err = waitpid(pid, &status, WUNTRACED)); | 270 | CATCH_EINTR(err = waitpid(pid, &status, WUNTRACED)); |
271 | if(err < 0) | 271 | if(err < 0) |
@@ -369,7 +369,7 @@ int copy_context_skas0(unsigned long new_stack, int pid) | |||
369 | */ | 369 | */ |
370 | wait_stub_done(pid, -1, "copy_context_skas0"); | 370 | wait_stub_done(pid, -1, "copy_context_skas0"); |
371 | if (child_data->err != UML_CONFIG_STUB_DATA) | 371 | if (child_data->err != UML_CONFIG_STUB_DATA) |
372 | panic("copy_context_skas0 - stub-child reports error %d\n", | 372 | panic("copy_context_skas0 - stub-child reports error %ld\n", |
373 | child_data->err); | 373 | child_data->err); |
374 | 374 | ||
375 | if (ptrace(PTRACE_OLDSETOPTIONS, pid, NULL, | 375 | if (ptrace(PTRACE_OLDSETOPTIONS, pid, NULL, |
diff --git a/arch/um/os-Linux/sys-i386/tls.c b/arch/um/os-Linux/sys-i386/tls.c index ba21f0e04a2f..120abbe4e3ce 100644 --- a/arch/um/os-Linux/sys-i386/tls.c +++ b/arch/um/os-Linux/sys-i386/tls.c | |||
@@ -1,3 +1,4 @@ | |||
1 | #include <errno.h> | ||
1 | #include <linux/unistd.h> | 2 | #include <linux/unistd.h> |
2 | #include "sysdep/tls.h" | 3 | #include "sysdep/tls.h" |
3 | #include "user_util.h" | 4 | #include "user_util.h" |
diff --git a/arch/um/os-Linux/umid.c b/arch/um/os-Linux/umid.c index 198e59163288..34bfc1bb9e38 100644 --- a/arch/um/os-Linux/umid.c +++ b/arch/um/os-Linux/umid.c | |||
@@ -120,7 +120,8 @@ static int not_dead_yet(char *dir) | |||
120 | 120 | ||
121 | dead = 0; | 121 | dead = 0; |
122 | fd = open(file, O_RDONLY); | 122 | fd = open(file, O_RDONLY); |
123 | if(fd < 0){ | 123 | if(fd < 0) { |
124 | fd = -errno; | ||
124 | if(fd != -ENOENT){ | 125 | if(fd != -ENOENT){ |
125 | printk("not_dead_yet : couldn't open pid file '%s', " | 126 | printk("not_dead_yet : couldn't open pid file '%s', " |
126 | "err = %d\n", file, -fd); | 127 | "err = %d\n", file, -fd); |
@@ -130,9 +131,13 @@ static int not_dead_yet(char *dir) | |||
130 | 131 | ||
131 | err = 0; | 132 | err = 0; |
132 | n = read(fd, pid, sizeof(pid)); | 133 | n = read(fd, pid, sizeof(pid)); |
133 | if(n <= 0){ | 134 | if(n < 0){ |
135 | printk("not_dead_yet : couldn't read pid file '%s', " | ||
136 | "err = %d\n", file, errno); | ||
137 | goto out_close; | ||
138 | } else if(n == 0){ | ||
134 | printk("not_dead_yet : couldn't read pid file '%s', " | 139 | printk("not_dead_yet : couldn't read pid file '%s', " |
135 | "err = %d\n", file, -n); | 140 | "0-byte read\n", file); |
136 | goto out_close; | 141 | goto out_close; |
137 | } | 142 | } |
138 | 143 | ||
@@ -155,9 +160,9 @@ static int not_dead_yet(char *dir) | |||
155 | 160 | ||
156 | return err; | 161 | return err; |
157 | 162 | ||
158 | out_close: | 163 | out_close: |
159 | close(fd); | 164 | close(fd); |
160 | out: | 165 | out: |
161 | return 0; | 166 | return 0; |
162 | } | 167 | } |
163 | 168 | ||
diff --git a/arch/um/os-Linux/user_syms.c b/arch/um/os-Linux/user_syms.c index 8da6ab31152a..2598158e1f53 100644 --- a/arch/um/os-Linux/user_syms.c +++ b/arch/um/os-Linux/user_syms.c | |||
@@ -18,14 +18,19 @@ extern void *memmove(void *, const void *, size_t); | |||
18 | extern void *memset(void *, int, size_t); | 18 | extern void *memset(void *, int, size_t); |
19 | extern int printf(const char *, ...); | 19 | extern int printf(const char *, ...); |
20 | 20 | ||
21 | /* If they're not defined, the export is included in lib/string.c.*/ | ||
22 | #ifdef __HAVE_ARCH_STRLEN | ||
21 | EXPORT_SYMBOL(strlen); | 23 | EXPORT_SYMBOL(strlen); |
24 | #endif | ||
25 | #ifdef __HAVE_ARCH_STRSTR | ||
26 | EXPORT_SYMBOL(strstr); | ||
27 | #endif | ||
28 | |||
22 | EXPORT_SYMBOL(memcpy); | 29 | EXPORT_SYMBOL(memcpy); |
23 | EXPORT_SYMBOL(memmove); | 30 | EXPORT_SYMBOL(memmove); |
24 | EXPORT_SYMBOL(memset); | 31 | EXPORT_SYMBOL(memset); |
25 | EXPORT_SYMBOL(printf); | 32 | EXPORT_SYMBOL(printf); |
26 | 33 | ||
27 | EXPORT_SYMBOL(strstr); | ||
28 | |||
29 | /* Here, instead, I can provide a fake prototype. Yes, someone cares: genksyms. | 34 | /* Here, instead, I can provide a fake prototype. Yes, someone cares: genksyms. |
30 | * However, the modules will use the CRC defined *here*, no matter if it is | 35 | * However, the modules will use the CRC defined *here*, no matter if it is |
31 | * good; so the versions of these symbols will always match | 36 | * good; so the versions of these symbols will always match |