aboutsummaryrefslogtreecommitdiffstats
path: root/arch/um/os-Linux
diff options
context:
space:
mode:
authorJeff Dike <jdike@addtoit.com>2008-02-08 07:22:08 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2008-02-08 12:22:42 -0500
commit5134d8fea06ab51459fd095d091d1e6f73a44553 (patch)
tree504a84a9290a40f0c98b7c5731b7df82cb357ebe /arch/um/os-Linux
parent536788fe2d28e11db6aeda74207d95d750fb761f (diff)
uml: style fixes in arch/um/os-Linux
Style changes under arch/um/os-Linux: include trimming CodingStyle fixes some printks needed severity indicators make_tempfile turns out not to be used outside of mem.c, so it is now static. Its declaration in tempfile.h is no longer needed, and tempfile.h itself is no longer needed. create_tmp_file was also made static. checkpatch moans about an EXPORT_SYMBOL in user_syms.c which is part of a macro definition - this is copying a bit of kernel infrastructure into the libc side of UML because the kernel headers can't be included there. 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/um/os-Linux')
-rw-r--r--arch/um/os-Linux/aio.c2
-rw-r--r--arch/um/os-Linux/drivers/ethertap_kern.c8
-rw-r--r--arch/um/os-Linux/drivers/tuntap_kern.c6
-rw-r--r--arch/um/os-Linux/include/file.h13
-rw-r--r--arch/um/os-Linux/mem.c101
-rw-r--r--arch/um/os-Linux/process.c2
-rw-r--r--arch/um/os-Linux/signal.c2
-rw-r--r--arch/um/os-Linux/skas/process.c6
-rw-r--r--arch/um/os-Linux/sys-i386/registers.c4
-rw-r--r--arch/um/os-Linux/sys-x86_64/registers.c21
-rw-r--r--arch/um/os-Linux/uaccess.c4
-rw-r--r--arch/um/os-Linux/user_syms.c4
-rw-r--r--arch/um/os-Linux/util.c43
13 files changed, 98 insertions, 118 deletions
diff --git a/arch/um/os-Linux/aio.c b/arch/um/os-Linux/aio.c
index b8d8c9ca8d4..57e3d46c989 100644
--- a/arch/um/os-Linux/aio.c
+++ b/arch/um/os-Linux/aio.c
@@ -142,7 +142,7 @@ static int do_not_aio(struct aio_thread_req *req)
142 if (actual != req->offset) 142 if (actual != req->offset)
143 return -errno; 143 return -errno;
144 144
145 switch(req->type) { 145 switch (req->type) {
146 case AIO_READ: 146 case AIO_READ:
147 n = read(req->io_fd, req->buf, req->len); 147 n = read(req->io_fd, req->buf, req->len);
148 break; 148 break;
diff --git a/arch/um/os-Linux/drivers/ethertap_kern.c b/arch/um/os-Linux/drivers/ethertap_kern.c
index 04f11b9f1ac..046a131f610 100644
--- a/arch/um/os-Linux/drivers/ethertap_kern.c
+++ b/arch/um/os-Linux/drivers/ethertap_kern.c
@@ -6,7 +6,7 @@
6 * Licensed under the GPL. 6 * Licensed under the GPL.
7 */ 7 */
8 8
9#include "linux/init.h" 9#include <linux/init.h>
10#include <linux/netdevice.h> 10#include <linux/netdevice.h>
11#include "etap.h" 11#include "etap.h"
12#include "net_kern.h" 12#include "net_kern.h"
@@ -30,10 +30,10 @@ static void etap_init(struct net_device *dev, void *data)
30 epri->control_fd = -1; 30 epri->control_fd = -1;
31 epri->dev = dev; 31 epri->dev = dev;
32 32
33 printk("ethertap backend - %s", epri->dev_name); 33 printk(KERN_INFO "ethertap backend - %s", epri->dev_name);
34 if (epri->gate_addr != NULL) 34 if (epri->gate_addr != NULL)
35 printk(", IP = %s", epri->gate_addr); 35 printk(KERN_CONT ", IP = %s", epri->gate_addr);
36 printk("\n"); 36 printk(KERN_CONT "\n");
37} 37}
38 38
39static int etap_read(int fd, struct sk_buff *skb, struct uml_net_private *lp) 39static int etap_read(int fd, struct sk_buff *skb, struct uml_net_private *lp)
diff --git a/arch/um/os-Linux/drivers/tuntap_kern.c b/arch/um/os-Linux/drivers/tuntap_kern.c
index 9d384807b07..6b9e33d5de2 100644
--- a/arch/um/os-Linux/drivers/tuntap_kern.c
+++ b/arch/um/os-Linux/drivers/tuntap_kern.c
@@ -29,10 +29,10 @@ static void tuntap_init(struct net_device *dev, void *data)
29 tpri->fd = -1; 29 tpri->fd = -1;
30 tpri->dev = dev; 30 tpri->dev = dev;
31 31
32 printk("TUN/TAP backend - "); 32 printk(KERN_INFO "TUN/TAP backend - ");
33 if (tpri->gate_addr != NULL) 33 if (tpri->gate_addr != NULL)
34 printk("IP = %s", tpri->gate_addr); 34 printk(KERN_CONT "IP = %s", tpri->gate_addr);
35 printk("\n"); 35 printk(KERN_CONT "\n");
36} 36}
37 37
38static int tuntap_read(int fd, struct sk_buff *skb, struct uml_net_private *lp) 38static int tuntap_read(int fd, struct sk_buff *skb, struct uml_net_private *lp)
diff --git a/arch/um/os-Linux/include/file.h b/arch/um/os-Linux/include/file.h
index d82711efacf..fe71be24bd5 100644
--- a/arch/um/os-Linux/include/file.h
+++ b/arch/um/os-Linux/include/file.h
@@ -1,5 +1,5 @@
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
@@ -9,14 +9,3 @@
9#define DEV_NULL "/dev/null" 9#define DEV_NULL "/dev/null"
10 10
11#endif 11#endif
12
13/*
14 * Overrides for Emacs so that we follow Linus's tabbing style.
15 * Emacs will notice this stuff at the end of the file and automatically
16 * adjust the settings for this buffer only. This must remain at the end
17 * of the file.
18 * ---------------------------------------------------------------------------
19 * Local variables:
20 * c-file-style: "linux"
21 * End:
22 */
diff --git a/arch/um/os-Linux/mem.c b/arch/um/os-Linux/mem.c
index eedc2d88ef8..38742c21def 100644
--- a/arch/um/os-Linux/mem.c
+++ b/arch/um/os-Linux/mem.c
@@ -1,22 +1,21 @@
1/*
2 * Copyright (C) 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL
4 */
5
1#include <stdio.h> 6#include <stdio.h>
2#include <stdlib.h>
3#include <stddef.h> 7#include <stddef.h>
4#include <stdarg.h> 8#include <stdlib.h>
5#include <unistd.h> 9#include <unistd.h>
6#include <errno.h> 10#include <errno.h>
7#include <string.h>
8#include <fcntl.h> 11#include <fcntl.h>
9#include <sys/types.h> 12#include <string.h>
10#include <sys/mman.h> 13#include <sys/mman.h>
11#include <sys/statfs.h> 14#include <sys/param.h>
12#include "user.h"
13#include "mem_user.h"
14#include "init.h" 15#include "init.h"
15#include "os.h"
16#include "tempfile.h"
17#include "kern_constants.h" 16#include "kern_constants.h"
18 17#include "os.h"
19#include <sys/param.h> 18#include "user.h"
20 19
21/* Modified by which_tmpdir, which is called during early boot */ 20/* Modified by which_tmpdir, which is called during early boot */
22static char *default_tmpdir = "/tmp"; 21static char *default_tmpdir = "/tmp";
@@ -33,18 +32,19 @@ static void __init find_tempdir(void)
33 int i; 32 int i;
34 char *dir = NULL; 33 char *dir = NULL;
35 34
36 if(tempdir != NULL) /* We've already been called */ 35 if (tempdir != NULL)
36 /* We've already been called */
37 return; 37 return;
38 for(i = 0; dirs[i]; i++){ 38 for (i = 0; dirs[i]; i++) {
39 dir = getenv(dirs[i]); 39 dir = getenv(dirs[i]);
40 if((dir != NULL) && (*dir != '\0')) 40 if ((dir != NULL) && (*dir != '\0'))
41 break; 41 break;
42 } 42 }
43 if((dir == NULL) || (*dir == '\0')) 43 if ((dir == NULL) || (*dir == '\0'))
44 dir = default_tmpdir; 44 dir = default_tmpdir;
45 45
46 tempdir = malloc(strlen(dir) + 2); 46 tempdir = malloc(strlen(dir) + 2);
47 if(tempdir == NULL){ 47 if (tempdir == NULL) {
48 fprintf(stderr, "Failed to malloc tempdir, " 48 fprintf(stderr, "Failed to malloc tempdir, "
49 "errno = %d\n", errno); 49 "errno = %d\n", errno);
50 return; 50 return;
@@ -53,7 +53,8 @@ static void __init find_tempdir(void)
53 strcat(tempdir, "/"); 53 strcat(tempdir, "/");
54} 54}
55 55
56/* This will return 1, with the first character in buf being the 56/*
57 * This will return 1, with the first character in buf being the
57 * character following the next instance of c in the file. This will 58 * character following the next instance of c in the file. This will
58 * read the file as needed. If there's an error, -errno is returned; 59 * read the file as needed. If there's an error, -errno is returned;
59 * if the end of the file is reached, 0 is returned. 60 * if the end of the file is reached, 0 is returned.
@@ -64,11 +65,11 @@ static int next(int fd, char *buf, size_t size, char c)
64 size_t len; 65 size_t len;
65 char *ptr; 66 char *ptr;
66 67
67 while((ptr = strchr(buf, c)) == NULL){ 68 while ((ptr = strchr(buf, c)) == NULL) {
68 n = read(fd, buf, size - 1); 69 n = read(fd, buf, size - 1);
69 if(n == 0) 70 if (n == 0)
70 return 0; 71 return 0;
71 else if(n < 0) 72 else if (n < 0)
72 return -errno; 73 return -errno;
73 74
74 buf[n] = '\0'; 75 buf[n] = '\0';
@@ -78,11 +79,12 @@ static int next(int fd, char *buf, size_t size, char c)
78 len = strlen(ptr); 79 len = strlen(ptr);
79 memmove(buf, ptr, len + 1); 80 memmove(buf, ptr, len + 1);
80 81
81 /* Refill the buffer so that if there's a partial string that we care 82 /*
83 * Refill the buffer so that if there's a partial string that we care
82 * about, it will be completed, and we can recognize it. 84 * about, it will be completed, and we can recognize it.
83 */ 85 */
84 n = read(fd, &buf[len], size - len - 1); 86 n = read(fd, &buf[len], size - len - 1);
85 if(n < 0) 87 if (n < 0)
86 return -errno; 88 return -errno;
87 89
88 buf[len + n] = '\0'; 90 buf[len + n] = '\0';
@@ -92,7 +94,8 @@ static int next(int fd, char *buf, size_t size, char c)
92/* which_tmpdir is called only during early boot */ 94/* which_tmpdir is called only during early boot */
93static int checked_tmpdir = 0; 95static int checked_tmpdir = 0;
94 96
95/* Look for a tmpfs mounted at /dev/shm. I couldn't find a cleaner 97/*
98 * Look for a tmpfs mounted at /dev/shm. I couldn't find a cleaner
96 * way to do this than to parse /proc/mounts. statfs will return the 99 * way to do this than to parse /proc/mounts. statfs will return the
97 * same filesystem magic number and fs id for both /dev and /dev/shm 100 * same filesystem magic number and fs id for both /dev and /dev/shm
98 * when they are both tmpfs, so you can't tell if they are different 101 * when they are both tmpfs, so you can't tell if they are different
@@ -107,7 +110,7 @@ static void which_tmpdir(void)
107 int fd, found; 110 int fd, found;
108 char buf[128] = { '\0' }; 111 char buf[128] = { '\0' };
109 112
110 if(checked_tmpdir) 113 if (checked_tmpdir)
111 return; 114 return;
112 115
113 checked_tmpdir = 1; 116 checked_tmpdir = 1;
@@ -115,28 +118,28 @@ static void which_tmpdir(void)
115 printf("Checking for tmpfs mount on /dev/shm..."); 118 printf("Checking for tmpfs mount on /dev/shm...");
116 119
117 fd = open("/proc/mounts", O_RDONLY); 120 fd = open("/proc/mounts", O_RDONLY);
118 if(fd < 0){ 121 if (fd < 0) {
119 printf("failed to open /proc/mounts, errno = %d\n", errno); 122 printf("failed to open /proc/mounts, errno = %d\n", errno);
120 return; 123 return;
121 } 124 }
122 125
123 while(1){ 126 while (1) {
124 found = next(fd, buf, ARRAY_SIZE(buf), ' '); 127 found = next(fd, buf, ARRAY_SIZE(buf), ' ');
125 if(found != 1) 128 if (found != 1)
126 break; 129 break;
127 130
128 if(!strncmp(buf, "/dev/shm", strlen("/dev/shm"))) 131 if (!strncmp(buf, "/dev/shm", strlen("/dev/shm")))
129 goto found; 132 goto found;
130 133
131 found = next(fd, buf, ARRAY_SIZE(buf), '\n'); 134 found = next(fd, buf, ARRAY_SIZE(buf), '\n');
132 if(found != 1) 135 if (found != 1)
133 break; 136 break;
134 } 137 }
135 138
136err: 139err:
137 if(found == 0) 140 if (found == 0)
138 printf("nothing mounted on /dev/shm\n"); 141 printf("nothing mounted on /dev/shm\n");
139 else if(found < 0) 142 else if (found < 0)
140 printf("read returned errno %d\n", -found); 143 printf("read returned errno %d\n", -found);
141 144
142out: 145out:
@@ -146,10 +149,10 @@ out:
146 149
147found: 150found:
148 found = next(fd, buf, ARRAY_SIZE(buf), ' '); 151 found = next(fd, buf, ARRAY_SIZE(buf), ' ');
149 if(found != 1) 152 if (found != 1)
150 goto err; 153 goto err;
151 154
152 if(strncmp(buf, "tmpfs", strlen("tmpfs"))){ 155 if (strncmp(buf, "tmpfs", strlen("tmpfs"))) {
153 printf("not tmpfs\n"); 156 printf("not tmpfs\n");
154 goto out; 157 goto out;
155 } 158 }
@@ -164,8 +167,8 @@ found:
164 * (file: kernel/tt/ptproxy/proxy.c, proc: start_debugger). 167 * (file: kernel/tt/ptproxy/proxy.c, proc: start_debugger).
165 * So it isn't 'static' yet. 168 * So it isn't 'static' yet.
166 */ 169 */
167int __init make_tempfile(const char *template, char **out_tempname, 170static int __init make_tempfile(const char *template, char **out_tempname,
168 int do_unlink) 171 int do_unlink)
169{ 172{
170 char *tempname; 173 char *tempname;
171 int fd; 174 int fd;
@@ -182,16 +185,16 @@ int __init make_tempfile(const char *template, char **out_tempname,
182 tempname[0] = '\0'; 185 tempname[0] = '\0';
183 strncat(tempname, template, MAXPATHLEN-1-strlen(tempname)); 186 strncat(tempname, template, MAXPATHLEN-1-strlen(tempname));
184 fd = mkstemp(tempname); 187 fd = mkstemp(tempname);
185 if(fd < 0){ 188 if (fd < 0) {
186 fprintf(stderr, "open - cannot create %s: %s\n", tempname, 189 fprintf(stderr, "open - cannot create %s: %s\n", tempname,
187 strerror(errno)); 190 strerror(errno));
188 goto out; 191 goto out;
189 } 192 }
190 if(do_unlink && (unlink(tempname) < 0)){ 193 if (do_unlink && (unlink(tempname) < 0)) {
191 perror("unlink"); 194 perror("unlink");
192 goto out; 195 goto out;
193 } 196 }
194 if(out_tempname){ 197 if (out_tempname) {
195 *out_tempname = tempname; 198 *out_tempname = tempname;
196 } else { 199 } else {
197 free(tempname); 200 free(tempname);
@@ -204,27 +207,23 @@ out:
204 207
205#define TEMPNAME_TEMPLATE "vm_file-XXXXXX" 208#define TEMPNAME_TEMPLATE "vm_file-XXXXXX"
206 209
207/* 210static int __init create_tmp_file(unsigned long long len)
208 * This proc is used in start_up.c
209 * So it isn't 'static'.
210 */
211int __init create_tmp_file(unsigned long long len)
212{ 211{
213 int fd, err; 212 int fd, err;
214 char zero; 213 char zero;
215 214
216 fd = make_tempfile(TEMPNAME_TEMPLATE, NULL, 1); 215 fd = make_tempfile(TEMPNAME_TEMPLATE, NULL, 1);
217 if(fd < 0) { 216 if (fd < 0)
218 exit(1); 217 exit(1);
219 }
220 218
221 err = fchmod(fd, 0777); 219 err = fchmod(fd, 0777);
222 if(err < 0){ 220 if (err < 0) {
223 perror("fchmod"); 221 perror("fchmod");
224 exit(1); 222 exit(1);
225 } 223 }
226 224
227 /* Seek to len - 1 because writing a character there will 225 /*
226 * Seek to len - 1 because writing a character there will
228 * increase the file size by one byte, to the desired length. 227 * increase the file size by one byte, to the desired length.
229 */ 228 */
230 if (lseek64(fd, len - 1, SEEK_SET) < 0) { 229 if (lseek64(fd, len - 1, SEEK_SET) < 0) {
@@ -235,7 +234,7 @@ int __init create_tmp_file(unsigned long long len)
235 zero = 0; 234 zero = 0;
236 235
237 err = write(fd, &zero, 1); 236 err = write(fd, &zero, 1);
238 if(err != 1){ 237 if (err != 1) {
239 perror("write"); 238 perror("write");
240 exit(1); 239 exit(1);
241 } 240 }
@@ -250,7 +249,7 @@ int __init create_mem_file(unsigned long long len)
250 fd = create_tmp_file(len); 249 fd = create_tmp_file(len);
251 250
252 err = os_set_exec_close(fd); 251 err = os_set_exec_close(fd);
253 if(err < 0){ 252 if (err < 0) {
254 errno = -err; 253 errno = -err;
255 perror("exec_close"); 254 perror("exec_close");
256 } 255 }
@@ -267,11 +266,11 @@ void __init check_tmpexec(void)
267 PROT_READ | PROT_WRITE | PROT_EXEC, MAP_PRIVATE, fd, 0); 266 PROT_READ | PROT_WRITE | PROT_EXEC, MAP_PRIVATE, fd, 0);
268 printf("Checking PROT_EXEC mmap in %s...",tempdir); 267 printf("Checking PROT_EXEC mmap in %s...",tempdir);
269 fflush(stdout); 268 fflush(stdout);
270 if(addr == MAP_FAILED){ 269 if (addr == MAP_FAILED) {
271 err = errno; 270 err = errno;
272 perror("failed"); 271 perror("failed");
273 close(fd); 272 close(fd);
274 if(err == EPERM) 273 if (err == EPERM)
275 printf("%s must be not mounted noexec\n",tempdir); 274 printf("%s must be not mounted noexec\n",tempdir);
276 exit(1); 275 exit(1);
277 } 276 }
diff --git a/arch/um/os-Linux/process.c b/arch/um/os-Linux/process.c
index abf6beae3df..e0477c3ee89 100644
--- a/arch/um/os-Linux/process.c
+++ b/arch/um/os-Linux/process.c
@@ -224,7 +224,7 @@ int __init can_drop_memory(void)
224 goto out_unmap; 224 goto out_unmap;
225 } 225 }
226 226
227 printk("OK\n"); 227 printk(UM_KERN_CONT "OK\n");
228 ok = 1; 228 ok = 1;
229 229
230out_unmap: 230out_unmap:
diff --git a/arch/um/os-Linux/signal.c b/arch/um/os-Linux/signal.c
index 0fb0cc8d475..3f1694b134c 100644
--- a/arch/um/os-Linux/signal.c
+++ b/arch/um/os-Linux/signal.c
@@ -237,7 +237,7 @@ void unblock_signals(void)
237 * interrupts may have arrived and we need to re-enable them and 237 * interrupts may have arrived and we need to re-enable them and
238 * recheck signals_pending. 238 * recheck signals_pending.
239 */ 239 */
240 while(1) { 240 while (1) {
241 /* 241 /*
242 * Save and reset save_pending after enabling signals. This 242 * Save and reset save_pending after enabling signals. This
243 * way, signals_pending won't be changed while we're reading it. 243 * way, signals_pending won't be changed while we're reading it.
diff --git a/arch/um/os-Linux/skas/process.c b/arch/um/os-Linux/skas/process.c
index d36c89c24a4..b14829469fa 100644
--- a/arch/um/os-Linux/skas/process.c
+++ b/arch/um/os-Linux/skas/process.c
@@ -341,7 +341,7 @@ void userspace(struct uml_pt_regs *regs)
341 int local_using_sysemu; 341 int local_using_sysemu;
342 342
343 if (getitimer(ITIMER_VIRTUAL, &timer)) 343 if (getitimer(ITIMER_VIRTUAL, &timer))
344 printk("Failed to get itimer, errno = %d\n", errno); 344 printk(UM_KERN_ERR "Failed to get itimer, errno = %d\n", errno);
345 nsecs = timer.it_value.tv_sec * UM_NSEC_PER_SEC + 345 nsecs = timer.it_value.tv_sec * UM_NSEC_PER_SEC +
346 timer.it_value.tv_usec * UM_NSEC_PER_USEC; 346 timer.it_value.tv_usec * UM_NSEC_PER_USEC;
347 nsecs += os_nsecs(); 347 nsecs += os_nsecs();
@@ -388,7 +388,7 @@ void userspace(struct uml_pt_regs *regs)
388 388
389 if (WIFSTOPPED(status)) { 389 if (WIFSTOPPED(status)) {
390 int sig = WSTOPSIG(status); 390 int sig = WSTOPSIG(status);
391 switch(sig) { 391 switch (sig) {
392 case SIGSEGV: 392 case SIGSEGV:
393 if (PTRACE_FULL_FAULTINFO || 393 if (PTRACE_FULL_FAULTINFO ||
394 !ptrace_faultinfo) { 394 !ptrace_faultinfo) {
@@ -641,7 +641,7 @@ int start_idle_thread(void *stack, jmp_buf *switch_buf)
641 * after returning to the jumper. 641 * after returning to the jumper.
642 */ 642 */
643 n = setjmp(initial_jmpbuf); 643 n = setjmp(initial_jmpbuf);
644 switch(n) { 644 switch (n) {
645 case INIT_JMP_NEW_THREAD: 645 case INIT_JMP_NEW_THREAD:
646 (*switch_buf)[0].JB_IP = (unsigned long) new_thread_handler; 646 (*switch_buf)[0].JB_IP = (unsigned long) new_thread_handler;
647 (*switch_buf)[0].JB_SP = (unsigned long) stack + 647 (*switch_buf)[0].JB_SP = (unsigned long) stack +
diff --git a/arch/um/os-Linux/sys-i386/registers.c b/arch/um/os-Linux/sys-i386/registers.c
index d1997ca76e5..f74d853a0ee 100644
--- a/arch/um/os-Linux/sys-i386/registers.c
+++ b/arch/um/os-Linux/sys-i386/registers.c
@@ -62,10 +62,10 @@ void arch_init_registers(int pid)
62 int err; 62 int err;
63 63
64 err = ptrace(PTRACE_GETFPXREGS, pid, 0, fpx_regs); 64 err = ptrace(PTRACE_GETFPXREGS, pid, 0, fpx_regs);
65 if(!err) 65 if (!err)
66 return; 66 return;
67 67
68 if(errno != EIO) 68 if (errno != EIO)
69 panic("check_ptrace : PTRACE_GETFPXREGS failed, errno = %d", 69 panic("check_ptrace : PTRACE_GETFPXREGS failed, errno = %d",
70 errno); 70 errno);
71 71
diff --git a/arch/um/os-Linux/sys-x86_64/registers.c b/arch/um/os-Linux/sys-x86_64/registers.c
index 9bfa789992d..a375853337a 100644
--- a/arch/um/os-Linux/sys-x86_64/registers.c
+++ b/arch/um/os-Linux/sys-x86_64/registers.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (C) 2006-2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) 2 * Copyright (C) 2006 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
@@ -7,31 +7,36 @@
7#include <sys/ptrace.h> 7#include <sys/ptrace.h>
8#define __FRAME_OFFSETS 8#define __FRAME_OFFSETS
9#include <asm/ptrace.h> 9#include <asm/ptrace.h>
10#include "kern_constants.h"
10#include "longjmp.h" 11#include "longjmp.h"
11#include "user.h" 12#include "user.h"
12 13
13int save_fp_registers(int pid, unsigned long *fp_regs) 14int save_fp_registers(int pid, unsigned long *fp_regs)
14{ 15{
15 if(ptrace(PTRACE_GETFPREGS, pid, 0, fp_regs) < 0) 16 if (ptrace(PTRACE_GETFPREGS, pid, 0, fp_regs) < 0)
16 return -errno; 17 return -errno;
17 return 0; 18 return 0;
18} 19}
19 20
20int restore_fp_registers(int pid, unsigned long *fp_regs) 21int restore_fp_registers(int pid, unsigned long *fp_regs)
21{ 22{
22 if(ptrace(PTRACE_SETFPREGS, pid, 0, fp_regs) < 0) 23 if (ptrace(PTRACE_SETFPREGS, pid, 0, fp_regs) < 0)
23 return -errno; 24 return -errno;
24 return 0; 25 return 0;
25} 26}
26 27
27unsigned long get_thread_reg(int reg, jmp_buf *buf) 28unsigned long get_thread_reg(int reg, jmp_buf *buf)
28{ 29{
29 switch(reg){ 30 switch (reg) {
30 case RIP: return buf[0]->__rip; 31 case RIP:
31 case RSP: return buf[0]->__rsp; 32 return buf[0]->__rip;
32 case RBP: return buf[0]->__rbp; 33 case RSP:
34 return buf[0]->__rsp;
35 case RBP:
36 return buf[0]->__rbp;
33 default: 37 default:
34 printk("get_thread_regs - unknown register %d\n", reg); 38 printk(UM_KERN_ERR "get_thread_regs - unknown register %d\n",
39 reg);
35 return 0; 40 return 0;
36 } 41 }
37} 42}
diff --git a/arch/um/os-Linux/uaccess.c b/arch/um/os-Linux/uaccess.c
index 8d27b6d1df9..087ed74ffca 100644
--- a/arch/um/os-Linux/uaccess.c
+++ b/arch/um/os-Linux/uaccess.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * Copyright (C) 2001 Chris Emerson (cemerson@chiark.greenend.org.uk) 2 * Copyright (C) 2001 Chris Emerson (cemerson@chiark.greenend.org.uk)
3 * Copyright (C) 2001, 2002 Jeff Dike (jdike@karaya.com) 3 * Copyright (C) 2001 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
4 * Licensed under the GPL 4 * Licensed under the GPL
5 */ 5 */
6 6
@@ -16,7 +16,7 @@ unsigned long __do_user_copy(void *to, const void *from, int n,
16 16
17 jmp_buf jbuf; 17 jmp_buf jbuf;
18 *fault_catcher = &jbuf; 18 *fault_catcher = &jbuf;
19 if(UML_SETJMP(&jbuf) == 0){ 19 if (UML_SETJMP(&jbuf) == 0) {
20 (*op)(to, from, n); 20 (*op)(to, from, n);
21 ret = 0; 21 ret = 0;
22 *faulted_out = 0; 22 *faulted_out = 0;
diff --git a/arch/um/os-Linux/user_syms.c b/arch/um/os-Linux/user_syms.c
index 4c37b1b1d0b..74f49bb9b12 100644
--- a/arch/um/os-Linux/user_syms.c
+++ b/arch/um/os-Linux/user_syms.c
@@ -34,8 +34,8 @@ EXPORT_SYMBOL(printf);
34 * good; so the versions of these symbols will always match 34 * good; so the versions of these symbols will always match
35 */ 35 */
36#define EXPORT_SYMBOL_PROTO(sym) \ 36#define EXPORT_SYMBOL_PROTO(sym) \
37 int sym(void); \ 37 int sym(void); \
38 EXPORT_SYMBOL(sym); 38 EXPORT_SYMBOL(sym);
39 39
40extern void readdir64(void) __attribute__((weak)); 40extern void readdir64(void) __attribute__((weak));
41EXPORT_SYMBOL(readdir64); 41EXPORT_SYMBOL(readdir64);
diff --git a/arch/um/os-Linux/util.c b/arch/um/os-Linux/util.c
index a6f31d47699..6ea77979531 100644
--- a/arch/um/os-Linux/util.c
+++ b/arch/um/os-Linux/util.c
@@ -1,39 +1,24 @@
1/* 1/*
2 * Copyright (C) 2000, 2001, 2002 Jeff Dike (jdike@karaya.com) 2 * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
6#include <stdio.h> 6#include <stdio.h>
7#include <stdlib.h> 7#include <stdlib.h>
8#include <unistd.h>
9#include <limits.h>
10#include <sys/mman.h>
11#include <sys/stat.h>
12#include <sys/utsname.h>
13#include <sys/param.h>
14#include <sys/time.h>
15#include "asm/types.h"
16#include <ctype.h>
17#include <signal.h>
18#include <wait.h>
19#include <errno.h> 8#include <errno.h>
20#include <stdarg.h> 9#include <signal.h>
21#include <sched.h>
22#include <termios.h>
23#include <string.h> 10#include <string.h>
24#include "kern_util.h" 11#include <termios.h>
25#include "user.h" 12#include <wait.h>
26#include "mem_user.h" 13#include <sys/mman.h>
27#include "init.h" 14#include <sys/utsname.h>
28#include "ptrace_user.h"
29#include "uml-config.h"
30#include "os.h"
31#include "longjmp.h"
32#include "kern_constants.h" 15#include "kern_constants.h"
16#include "os.h"
17#include "user.h"
33 18
34void stack_protections(unsigned long address) 19void stack_protections(unsigned long address)
35{ 20{
36 if(mprotect((void *) address, UM_THREAD_SIZE, 21 if (mprotect((void *) address, UM_THREAD_SIZE,
37 PROT_READ | PROT_WRITE | PROT_EXEC) < 0) 22 PROT_READ | PROT_WRITE | PROT_EXEC) < 0)
38 panic("protecting stack failed, errno = %d", errno); 23 panic("protecting stack failed, errno = %d", errno);
39} 24}
@@ -44,17 +29,19 @@ int raw(int fd)
44 int err; 29 int err;
45 30
46 CATCH_EINTR(err = tcgetattr(fd, &tt)); 31 CATCH_EINTR(err = tcgetattr(fd, &tt));
47 if(err < 0) 32 if (err < 0)
48 return -errno; 33 return -errno;
49 34
50 cfmakeraw(&tt); 35 cfmakeraw(&tt);
51 36
52 CATCH_EINTR(err = tcsetattr(fd, TCSADRAIN, &tt)); 37 CATCH_EINTR(err = tcsetattr(fd, TCSADRAIN, &tt));
53 if(err < 0) 38 if (err < 0)
54 return -errno; 39 return -errno;
55 40
56 /* XXX tcsetattr could have applied only some changes 41 /*
57 * (and cfmakeraw() is a set of changes) */ 42 * XXX tcsetattr could have applied only some changes
43 * (and cfmakeraw() is a set of changes)
44 */
58 return 0; 45 return 0;
59} 46}
60 47