diff options
author | Jeff Dike <jdike@addtoit.com> | 2007-05-06 17:51:35 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-05-07 15:13:03 -0400 |
commit | a61f334fd2864b9b040f7e882726426ed7e8a317 (patch) | |
tree | 51874236a1f324a2664118f54aadd9ba3beb95ca /arch/um/os-Linux/helper.c | |
parent | ef0470c053274c343b2be8737e0146d65e17f9be (diff) |
uml: convert libc layer to call read and write
This patch converts calls in the os layer to os_{read,write}_file to calls
directly to libc read() and write() where it is clear that the I/O buffer is
in the kernel.
We can do that here instead of calling os_{read,write}_file_k since we are in
libc code and can call libc directly.
With the change in the calls, error handling needs to be changed to refer to
errno directly rather than the return value of the call.
CATCH_EINTR wrappers were also added where needed.
Signed-off-by: Jeff Dike <jdike@linux.intel.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
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/helper.c')
-rw-r--r-- | arch/um/os-Linux/helper.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/arch/um/os-Linux/helper.c b/arch/um/os-Linux/helper.c index 8a4c9e47326c..97bed16bf4c7 100644 --- a/arch/um/os-Linux/helper.c +++ b/arch/um/os-Linux/helper.c | |||
@@ -36,7 +36,7 @@ static int helper_child(void *arg) | |||
36 | errval = execvp_noalloc(data->buf, argv[0], argv); | 36 | errval = execvp_noalloc(data->buf, argv[0], argv); |
37 | printk("helper_child - execvp of '%s' failed - errno = %d\n", argv[0], | 37 | printk("helper_child - execvp of '%s' failed - errno = %d\n", argv[0], |
38 | -errval); | 38 | -errval); |
39 | os_write_file(data->fd, &errval, sizeof(errval)); | 39 | write(data->fd, &errval, sizeof(errval)); |
40 | kill(os_getpid(), SIGKILL); | 40 | kill(os_getpid(), SIGKILL); |
41 | return 0; | 41 | return 0; |
42 | } | 42 | } |
@@ -92,11 +92,12 @@ int run_helper(void (*pre_exec)(void *), void *pre_data, char **argv, | |||
92 | * Read the errno value from the child, if the exec failed, or get 0 if | 92 | * Read the errno value from the child, if the exec failed, or get 0 if |
93 | * the exec succeeded because the pipe fd was set as close-on-exec. | 93 | * the exec succeeded because the pipe fd was set as close-on-exec. |
94 | */ | 94 | */ |
95 | n = os_read_file(fds[0], &ret, sizeof(ret)); | 95 | n = read(fds[0], &ret, sizeof(ret)); |
96 | if (n == 0) { | 96 | if (n == 0) { |
97 | ret = pid; | 97 | ret = pid; |
98 | } else { | 98 | } else { |
99 | if (n < 0) { | 99 | if (n < 0) { |
100 | n = -errno; | ||
100 | printk("run_helper : read on pipe failed, ret = %d\n", | 101 | printk("run_helper : read on pipe failed, ret = %d\n", |
101 | -n); | 102 | -n); |
102 | ret = n; | 103 | ret = n; |