diff options
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 9387cb11c0ad..4f547d75b17e 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) | |||
328 | return 0; | 328 | return 0; |
329 | } | 329 | } |
330 | 330 | ||
331 | int os_get_exec_close(int fd, int *close_on_exec) | ||
332 | { | ||
333 | int ret; | ||
334 | |||
335 | CATCH_EINTR(ret = fcntl(fd, F_GETFD)); | ||
336 | |||
337 | if(ret < 0) | ||
338 | return -errno; | ||
339 | |||
340 | *close_on_exec = (ret & FD_CLOEXEC) ? 1 : 0; | ||
341 | return ret; | ||
342 | } | ||
343 | |||
344 | int os_set_exec_close(int fd) | 331 | int os_set_exec_close(int fd) |
345 | { | 332 | { |
346 | int err; | 333 | int err; |
@@ -380,30 +367,27 @@ int os_pipe(int *fds, int stream, int close_on_exec) | |||
380 | return err; | 367 | return err; |
381 | } | 368 | } |
382 | 369 | ||
383 | int os_set_fd_async(int fd, int owner) | 370 | int os_set_fd_async(int fd) |
384 | { | 371 | { |
385 | int err; | 372 | int err, flags; |
373 | |||
374 | flags = fcntl(fd, F_GETFL); | ||
375 | if (flags < 0) | ||
376 | return -errno; | ||
386 | 377 | ||
387 | /* XXX This should do F_GETFL first */ | 378 | flags |= O_ASYNC | O_NONBLOCK; |
388 | if(fcntl(fd, F_SETFL, O_ASYNC | O_NONBLOCK) < 0){ | 379 | if (fcntl(fd, F_SETFL, flags) < 0) { |
389 | err = -errno; | 380 | err = -errno; |
390 | printk("os_set_fd_async : failed to set O_ASYNC and " | 381 | printk("os_set_fd_async : failed to set O_ASYNC and " |
391 | "O_NONBLOCK on fd # %d, errno = %d\n", fd, errno); | 382 | "O_NONBLOCK on fd # %d, errno = %d\n", fd, errno); |
392 | return err; | 383 | return err; |
393 | } | 384 | } |
394 | #ifdef notdef | ||
395 | if(fcntl(fd, F_SETFD, 1) < 0){ | ||
396 | printk("os_set_fd_async : Setting FD_CLOEXEC failed, " | ||
397 | "errno = %d\n", errno); | ||
398 | } | ||
399 | #endif | ||
400 | 385 | ||
401 | if((fcntl(fd, F_SETSIG, SIGIO) < 0) || | 386 | if ((fcntl(fd, F_SETSIG, SIGIO) < 0) || |
402 | (fcntl(fd, F_SETOWN, owner) < 0)){ | 387 | (fcntl(fd, F_SETOWN, os_getpid()) < 0)) { |
403 | err = -errno; | 388 | err = -errno; |
404 | printk("os_set_fd_async : Failed to fcntl F_SETOWN " | 389 | printk("os_set_fd_async : Failed to fcntl F_SETOWN " |
405 | "(or F_SETSIG) fd %d to pid %d, errno = %d\n", fd, | 390 | "(or F_SETSIG) fd %d, errno = %d\n", fd, errno); |
406 | owner, errno); | ||
407 | return err; | 391 | return err; |
408 | } | 392 | } |
409 | 393 | ||