aboutsummaryrefslogtreecommitdiffstats
path: root/arch/um/kernel/exitcode.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/um/kernel/exitcode.c')
-rw-r--r--arch/um/kernel/exitcode.c31
1 files changed, 17 insertions, 14 deletions
diff --git a/arch/um/kernel/exitcode.c b/arch/um/kernel/exitcode.c
index c716b5a6db13..984f80e668ca 100644
--- a/arch/um/kernel/exitcode.c
+++ b/arch/um/kernel/exitcode.c
@@ -1,15 +1,17 @@
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 "linux/kernel.h" 6#include <linux/ctype.h>
7#include "linux/init.h" 7#include <linux/init.h>
8#include "linux/ctype.h" 8#include <linux/kernel.h>
9#include "linux/proc_fs.h" 9#include <linux/proc_fs.h>
10#include "asm/uaccess.h" 10#include <linux/types.h>
11#include <asm/uaccess.h>
11 12
12/* If read and write race, the read will still atomically read a valid 13/*
14 * If read and write race, the read will still atomically read a valid
13 * value. 15 * value.
14 */ 16 */
15int uml_exitcode = 0; 17int uml_exitcode = 0;
@@ -19,18 +21,19 @@ static int read_proc_exitcode(char *page, char **start, off_t off,
19{ 21{
20 int len, val; 22 int len, val;
21 23
22 /* Save uml_exitcode in a local so that we don't need to guarantee 24 /*
25 * Save uml_exitcode in a local so that we don't need to guarantee
23 * that sprintf accesses it atomically. 26 * that sprintf accesses it atomically.
24 */ 27 */
25 val = uml_exitcode; 28 val = uml_exitcode;
26 len = sprintf(page, "%d\n", val); 29 len = sprintf(page, "%d\n", val);
27 len -= off; 30 len -= off;
28 if(len <= off+count) 31 if (len <= off+count)
29 *eof = 1; 32 *eof = 1;
30 *start = page + off; 33 *start = page + off;
31 if(len > count) 34 if (len > count)
32 len = count; 35 len = count;
33 if(len < 0) 36 if (len < 0)
34 len = 0; 37 len = 0;
35 return len; 38 return len;
36} 39}
@@ -41,11 +44,11 @@ static int write_proc_exitcode(struct file *file, const char __user *buffer,
41 char *end, buf[sizeof("nnnnn\0")]; 44 char *end, buf[sizeof("nnnnn\0")];
42 int tmp; 45 int tmp;
43 46
44 if(copy_from_user(buf, buffer, count)) 47 if (copy_from_user(buf, buffer, count))
45 return -EFAULT; 48 return -EFAULT;
46 49
47 tmp = simple_strtol(buf, &end, 0); 50 tmp = simple_strtol(buf, &end, 0);
48 if((*end != '\0') && !isspace(*end)) 51 if ((*end != '\0') && !isspace(*end))
49 return -EINVAL; 52 return -EINVAL;
50 53
51 uml_exitcode = tmp; 54 uml_exitcode = tmp;
@@ -57,7 +60,7 @@ static int make_proc_exitcode(void)
57 struct proc_dir_entry *ent; 60 struct proc_dir_entry *ent;
58 61
59 ent = create_proc_entry("exitcode", 0600, &proc_root); 62 ent = create_proc_entry("exitcode", 0600, &proc_root);
60 if(ent == NULL){ 63 if (ent == NULL) {
61 printk(KERN_WARNING "make_proc_exitcode : Failed to register " 64 printk(KERN_WARNING "make_proc_exitcode : Failed to register "
62 "/proc/exitcode\n"); 65 "/proc/exitcode\n");
63 return 0; 66 return 0;