diff options
author | Jeff Dike <jdike@addtoit.com> | 2007-10-16 10:27:11 +0200 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-16 18:43:06 +0200 |
commit | 512b6fb1c14d4c34f23a3419b0789ad01914a899 (patch) | |
tree | 29e51c256dde41db297cff28767bf4dc4a1dc73f /arch/um/os-Linux/process.c | |
parent | uml: fix inlines (diff) | |
download | linux-512b6fb1c14d4c34f23a3419b0789ad01914a899.tar.xz linux-512b6fb1c14d4c34f23a3419b0789ad01914a899.zip |
uml: userspace files should call libc directly
A number of files that were changed in the recent removal of tt mode
are userspace files which call the os_* wrappers instead of calling
libc directly. A few other files were affected by this, through
This patch makes these call glibc directly.
There are also style fixes in the affected areas.
os_print_error has no remaining callers, so it is deleted.
There is a interface change to os_set_exec_close, eliminating a
parameter which was always the same. The callers are fixed as well.
os_process_pc got its error path cleaned up.
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/process.c')
-rw-r--r-- | arch/um/os-Linux/process.c | 37 |
1 files changed, 20 insertions, 17 deletions
diff --git a/arch/um/os-Linux/process.c b/arch/um/os-Linux/process.c index 8b57eb3647f5..90b480cf78f4 100644 --- a/arch/um/os-Linux/process.c +++ b/arch/um/os-Linux/process.c @@ -7,6 +7,7 @@ #include <unistd.h> #include <errno.h> #include <signal.h> +#include <fcntl.h> #include <sys/mman.h> #include <sys/ptrace.h> #include <sys/wait.h> @@ -28,31 +29,32 @@ unsigned long os_process_pc(int pid) { char proc_stat[STAT_PATH_LEN], buf[256]; - unsigned long pc; + unsigned long pc = ARBITRARY_ADDR; int fd, err; sprintf(proc_stat, "/proc/%d/stat", pid); - fd = os_open_file(proc_stat, of_read(OPENFLAGS()), 0); + fd = open(proc_stat, O_RDONLY, 0); if (fd < 0) { printk(UM_KERN_ERR "os_process_pc - couldn't open '%s', " - "err = %d\n", proc_stat, -fd); - return ARBITRARY_ADDR; + "errno = %d\n", proc_stat, errno); + goto out; } CATCH_EINTR(err = read(fd, buf, sizeof(buf))); if (err < 0) { printk(UM_KERN_ERR "os_process_pc - couldn't read '%s', " "err = %d\n", proc_stat, errno); - os_close_file(fd); - return ARBITRARY_ADDR; + goto out_close; } os_close_file(fd); pc = ARBITRARY_ADDR; if (sscanf(buf, "%*d " COMM_SCANF " %*c %*d %*d %*d %*d %*d %*d %*d " - "%*d %*d %*d %*d %*d %*d %*d %*d %*d %*d %*d %*d %*d %*d " - "%*d %*d %*d %*d %*d %lu", &pc) != 1) { + "%*d %*d %*d %*d %*d %*d %*d %*d %*d %*d %*d %*d %*d %*d " + "%*d %*d %*d %*d %*d %lu", &pc) != 1) printk(UM_KERN_ERR "os_process_pc - couldn't find pc in '%s'\n", buf); - } + out_close: + close(fd); + out: return pc; } @@ -60,25 +62,26 @@ int os_process_parent(int pid) { char stat[STAT_PATH_LEN]; char data[256]; - int parent, n, fd; + int parent = FAILURE_PID, n, fd; if (pid == -1) - return -1; + return parent; snprintf(stat, sizeof(stat), "/proc/%d/stat", pid); - fd = os_open_file(stat, of_read(OPENFLAGS()), 0); + fd = open(stat, O_RDONLY, 0); if (fd < 0) { - printk(UM_KERN_ERR "Couldn't open '%s', err = %d\n", stat, -fd); - return FAILURE_PID; + printk(UM_KERN_ERR "Couldn't open '%s', errno = %d\n", stat, + errno); + return parent; } CATCH_EINTR(n = read(fd, data, sizeof(data))); - os_close_file(fd); + close(fd); if (n < 0) { - printk(UM_KERN_ERR "Couldn't read '%s', err = %d\n", stat, + printk(UM_KERN_ERR "Couldn't read '%s', errno = %d\n", stat, errno); - return FAILURE_PID; + return parent; } parent = FAILURE_PID; |