diff options
Diffstat (limited to 'arch/um/os-Linux/tty.c')
-rw-r--r-- | arch/um/os-Linux/tty.c | 57 |
1 files changed, 29 insertions, 28 deletions
diff --git a/arch/um/os-Linux/tty.c b/arch/um/os-Linux/tty.c index 4cfdd18ea1ef..b09ff66a77ee 100644 --- a/arch/um/os-Linux/tty.c +++ b/arch/um/os-Linux/tty.c | |||
@@ -1,13 +1,16 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2002 Jeff Dike (jdike@karaya.com) | 2 | * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) |
3 | * Licensed under the GPL | 3 | * Licensed under the GPL |
4 | */ | 4 | */ |
5 | 5 | ||
6 | #include <stdlib.h> | 6 | #include <stdlib.h> |
7 | #include <unistd.h> | ||
7 | #include <errno.h> | 8 | #include <errno.h> |
9 | #include <fcntl.h> | ||
10 | #include "kern_constants.h" | ||
11 | #include "kern_util.h" | ||
8 | #include "os.h" | 12 | #include "os.h" |
9 | #include "user.h" | 13 | #include "user.h" |
10 | #include "kern_util.h" | ||
11 | 14 | ||
12 | struct grantpt_info { | 15 | struct grantpt_info { |
13 | int fd; | 16 | int fd; |
@@ -26,36 +29,34 @@ static void grantpt_cb(void *arg) | |||
26 | int get_pty(void) | 29 | int get_pty(void) |
27 | { | 30 | { |
28 | struct grantpt_info info; | 31 | struct grantpt_info info; |
29 | int fd; | 32 | int fd, err; |
30 | 33 | ||
31 | fd = os_open_file("/dev/ptmx", of_rdwr(OPENFLAGS()), 0); | 34 | fd = open("/dev/ptmx", O_RDWR); |
32 | if(fd < 0){ | 35 | if (fd < 0) { |
33 | printk("get_pty : Couldn't open /dev/ptmx - err = %d\n", -fd); | 36 | err = -errno; |
34 | return(fd); | 37 | printk(UM_KERN_ERR "get_pty : Couldn't open /dev/ptmx - " |
38 | "err = %d\n", errno); | ||
39 | return err; | ||
35 | } | 40 | } |
36 | 41 | ||
37 | info.fd = fd; | 42 | info.fd = fd; |
38 | initial_thread_cb(grantpt_cb, &info); | 43 | initial_thread_cb(grantpt_cb, &info); |
39 | 44 | ||
40 | if(info.res < 0){ | 45 | if (info.res < 0) { |
41 | printk("get_pty : Couldn't grant pty - errno = %d\n", | 46 | err = -info.err; |
42 | -info.err); | 47 | printk(UM_KERN_ERR "get_pty : Couldn't grant pty - " |
43 | return(-1); | 48 | "errno = %d\n", -info.err); |
49 | goto out; | ||
44 | } | 50 | } |
45 | if(unlockpt(fd) < 0){ | 51 | |
46 | printk("get_pty : Couldn't unlock pty - errno = %d\n", errno); | 52 | if (unlockpt(fd) < 0) { |
47 | return(-1); | 53 | err = -errno; |
54 | printk(UM_KERN_ERR "get_pty : Couldn't unlock pty - " | ||
55 | "errno = %d\n", errno); | ||
56 | goto out; | ||
48 | } | 57 | } |
49 | return(fd); | 58 | return fd; |
59 | out: | ||
60 | close(fd); | ||
61 | return err; | ||
50 | } | 62 | } |
51 | |||
52 | /* | ||
53 | * Overrides for Emacs so that we follow Linus's tabbing style. | ||
54 | * Emacs will notice this stuff at the end of the file and automatically | ||
55 | * adjust the settings for this buffer only. This must remain at the end | ||
56 | * of the file. | ||
57 | * --------------------------------------------------------------------------- | ||
58 | * Local variables: | ||
59 | * c-file-style: "linux" | ||
60 | * End: | ||
61 | */ | ||