Contents of /trunk/mkinitrd-magellan/klibc/usr/klibc/pty.c
Parent Directory | Revision Log
Revision 532 -
(show annotations)
(download)
Sat Sep 1 22:45:15 2007 UTC (16 years, 9 months ago) by niro
File MIME type: text/plain
File size: 520 byte(s)
Sat Sep 1 22:45:15 2007 UTC (16 years, 9 months ago) by niro
File MIME type: text/plain
File size: 520 byte(s)
-import if magellan mkinitrd; it is a fork of redhats mkinitrd-5.0.8 with all magellan patches and features; deprecates magellan-src/mkinitrd
1 | /* |
2 | * pty.c |
3 | * |
4 | * Basic Unix98 PTY functionality; assumes devpts mounted on /dev/pts |
5 | */ |
6 | |
7 | #include <stdio.h> |
8 | #include <stdlib.h> |
9 | #include <unistd.h> |
10 | #include <termios.h> |
11 | #include <sys/ioctl.h> |
12 | |
13 | char *ptsname(int fd) |
14 | { |
15 | static char buffer[32]; /* Big enough to hold even a 64-bit pts no */ |
16 | unsigned int ptyno; |
17 | |
18 | if (ioctl(fd, TIOCGPTN, &ptyno)) |
19 | return NULL; |
20 | |
21 | snprintf(buffer, sizeof buffer, "/dev/pts/%u", ptyno); |
22 | |
23 | return buffer; |
24 | } |
25 | |
26 | int unlockpt(int fd) |
27 | { |
28 | int unlock = 0; |
29 | |
30 | return ioctl(fd, TIOCSPTLCK, &unlock); |
31 | } |