diff options
author | Jeff Dike <jdike@addtoit.com> | 2006-09-29 04:58:50 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-09-29 12:18:04 -0400 |
commit | 730760e90a173ef81f89beed2f1dad2fab310f68 (patch) | |
tree | e60039deb19683fac30e58277450c657ecd33e07 /arch/um/kernel | |
parent | b10aeeef554eb1ff80e10111829f6e7484877811 (diff) |
[PATCH] uml: locking documentation
Some locking documentation and a cleanup. uml_exitcode is copied into a local
before sprintf sees it, in case sprintf does anything non-atomic with it.
The rest are comments about why certain globals don't need any kind of
locking.
Signed-off-by: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/um/kernel')
-rw-r--r-- | arch/um/kernel/exitcode.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/arch/um/kernel/exitcode.c b/arch/um/kernel/exitcode.c index d21ebad666b4..8b7f2cdedf94 100644 --- a/arch/um/kernel/exitcode.c +++ b/arch/um/kernel/exitcode.c | |||
@@ -16,9 +16,13 @@ int uml_exitcode = 0; | |||
16 | static int read_proc_exitcode(char *page, char **start, off_t off, | 16 | static int read_proc_exitcode(char *page, char **start, off_t off, |
17 | int count, int *eof, void *data) | 17 | int count, int *eof, void *data) |
18 | { | 18 | { |
19 | int len; | 19 | int len, val; |
20 | 20 | ||
21 | len = sprintf(page, "%d\n", uml_exitcode); | 21 | /* Save uml_exitcode in a local so that we don't need to guarantee |
22 | * that sprintf accesses it atomically. | ||
23 | */ | ||
24 | val = uml_exitcode; | ||
25 | len = sprintf(page, "%d\n", val); | ||
22 | len -= off; | 26 | len -= off; |
23 | if(len <= off+count) *eof = 1; | 27 | if(len <= off+count) *eof = 1; |
24 | *start = page + off; | 28 | *start = page + off; |