diff options
author | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
commit | 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch) | |
tree | 0bba044c4ce775e45a88a51686b5d9f90697ea9d /arch/um/os-Linux/tty.c |
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history,
even though we have it. We can create a separate "historical" git
archive of that later if we want to, and in the meantime it's about
3.2GB when imported into git - space that would just make the early
git days unnecessarily complicated, when we don't have a lot of good
infrastructure for it.
Let it rip!
Diffstat (limited to 'arch/um/os-Linux/tty.c')
-rw-r--r-- | arch/um/os-Linux/tty.c | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/arch/um/os-Linux/tty.c b/arch/um/os-Linux/tty.c new file mode 100644 index 000000000000..4cfdd18ea1ef --- /dev/null +++ b/arch/um/os-Linux/tty.c | |||
@@ -0,0 +1,61 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2002 Jeff Dike (jdike@karaya.com) | ||
3 | * Licensed under the GPL | ||
4 | */ | ||
5 | |||
6 | #include <stdlib.h> | ||
7 | #include <errno.h> | ||
8 | #include "os.h" | ||
9 | #include "user.h" | ||
10 | #include "kern_util.h" | ||
11 | |||
12 | struct grantpt_info { | ||
13 | int fd; | ||
14 | int res; | ||
15 | int err; | ||
16 | }; | ||
17 | |||
18 | static void grantpt_cb(void *arg) | ||
19 | { | ||
20 | struct grantpt_info *info = arg; | ||
21 | |||
22 | info->res = grantpt(info->fd); | ||
23 | info->err = errno; | ||
24 | } | ||
25 | |||
26 | int get_pty(void) | ||
27 | { | ||
28 | struct grantpt_info info; | ||
29 | int fd; | ||
30 | |||
31 | fd = os_open_file("/dev/ptmx", of_rdwr(OPENFLAGS()), 0); | ||
32 | if(fd < 0){ | ||
33 | printk("get_pty : Couldn't open /dev/ptmx - err = %d\n", -fd); | ||
34 | return(fd); | ||
35 | } | ||
36 | |||
37 | info.fd = fd; | ||
38 | initial_thread_cb(grantpt_cb, &info); | ||
39 | |||
40 | if(info.res < 0){ | ||
41 | printk("get_pty : Couldn't grant pty - errno = %d\n", | ||
42 | -info.err); | ||
43 | return(-1); | ||
44 | } | ||
45 | if(unlockpt(fd) < 0){ | ||
46 | printk("get_pty : Couldn't unlock pty - errno = %d\n", errno); | ||
47 | return(-1); | ||
48 | } | ||
49 | return(fd); | ||
50 | } | ||
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 | */ | ||