diff options
author | Jeff Dike <jdike@addtoit.com> | 2006-09-29 01:58:50 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-09-29 09:18:04 -0700 |
commit | 730760e90a173ef81f89beed2f1dad2fab310f68 (patch) | |
tree | e60039deb19683fac30e58277450c657ecd33e07 /arch/um/kernel/exitcode.c | |
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/exitcode.c')
-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 d21ebad666b..8b7f2cdedf9 100644 --- a/arch/um/kernel/exitcode.c +++ b/arch/um/kernel/exitcode.c @@ -16,9 +16,13 @@ int uml_exitcode = 0; static int read_proc_exitcode(char *page, char **start, off_t off, int count, int *eof, void *data) { - int len; + int len, val; - len = sprintf(page, "%d\n", uml_exitcode); + /* Save uml_exitcode in a local so that we don't need to guarantee + * that sprintf accesses it atomically. + */ + val = uml_exitcode; + len = sprintf(page, "%d\n", val); len -= off; if(len <= off+count) *eof = 1; *start = page + off; |