diff options
author | Jeff Dike <jdike@addtoit.com> | 2008-02-04 22:31:04 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2008-02-05 09:44:29 -0800 |
commit | bf8fde785b872282e7e86d9ea8a9c4e543985bb3 (patch) | |
tree | cb813edfbb04c8474caab0f8a26a8512a503cf82 /arch/um/os-Linux/file.c | |
parent | 7b5cc6ee6cf9001775c348bac09814a45f1276b7 (diff) |
uml: miscellaneous code cleanups
Code tidying -
the pid field of struct irq_fd isn't used, so it is removed
os_set_fd_async needed to read flags before changing them, it
doesn't need a pid passed in because it can call getpid itself, and a
block of unused code needed deleting
os_get_exec_close was unused, so it is removed
ptrace_child called _exit for historical reasons which are no
longer valid, so just calls exit instead
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/file.c')
-rw-r--r-- | arch/um/os-Linux/file.c | 38 |
1 files changed, 11 insertions, 27 deletions
diff --git a/arch/um/os-Linux/file.c b/arch/um/os-Linux/file.c index 9387cb11c0a..4f547d75b17 100644 --- a/arch/um/os-Linux/file.c +++ b/arch/um/os-Linux/file.c @@ -328,19 +328,6 @@ int os_file_modtime(const char *file, unsigned long *modtime) return 0; } -int os_get_exec_close(int fd, int *close_on_exec) -{ - int ret; - - CATCH_EINTR(ret = fcntl(fd, F_GETFD)); - - if(ret < 0) - return -errno; - - *close_on_exec = (ret & FD_CLOEXEC) ? 1 : 0; - return ret; -} - int os_set_exec_close(int fd) { int err; @@ -380,30 +367,27 @@ int os_pipe(int *fds, int stream, int close_on_exec) return err; } -int os_set_fd_async(int fd, int owner) +int os_set_fd_async(int fd) { - int err; + int err, flags; + + flags = fcntl(fd, F_GETFL); + if (flags < 0) + return -errno; - /* XXX This should do F_GETFL first */ - if(fcntl(fd, F_SETFL, O_ASYNC | O_NONBLOCK) < 0){ + flags |= O_ASYNC | O_NONBLOCK; + if (fcntl(fd, F_SETFL, flags) < 0) { err = -errno; printk("os_set_fd_async : failed to set O_ASYNC and " "O_NONBLOCK on fd # %d, errno = %d\n", fd, errno); return err; } -#ifdef notdef - if(fcntl(fd, F_SETFD, 1) < 0){ - printk("os_set_fd_async : Setting FD_CLOEXEC failed, " - "errno = %d\n", errno); - } -#endif - if((fcntl(fd, F_SETSIG, SIGIO) < 0) || - (fcntl(fd, F_SETOWN, owner) < 0)){ + if ((fcntl(fd, F_SETSIG, SIGIO) < 0) || + (fcntl(fd, F_SETOWN, os_getpid()) < 0)) { err = -errno; printk("os_set_fd_async : Failed to fcntl F_SETOWN " - "(or F_SETSIG) fd %d to pid %d, errno = %d\n", fd, - owner, errno); + "(or F_SETSIG) fd %d, errno = %d\n", fd, errno); return err; } |