Contents of /trunk/mkinitrd-magellan/klibc/usr/include/termios.h
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: 1919 byte(s)
Sat Sep 1 22:45:15 2007 UTC (16 years, 9 months ago) by niro
File MIME type: text/plain
File size: 1919 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 | * termios.h |
3 | */ |
4 | |
5 | #ifndef _TERMIOS_H |
6 | #define _TERMIOS_H |
7 | |
8 | #include <klibc/extern.h> |
9 | #include <stdint.h> |
10 | #include <sys/ioctl.h> |
11 | #include <sys/types.h> |
12 | #include <linux/termios.h> |
13 | |
14 | /* Redefine these so the magic constants == the ioctl number to use. */ |
15 | #undef TCSANOW |
16 | #undef TCSADRAIN |
17 | #undef TCSAFLUSH |
18 | #define TCSANOW TCSETS |
19 | #define TCSADRAIN TCSETSW |
20 | #define TCSAFLUSH TCSETSF |
21 | |
22 | static __inline__ int tcgetattr(int __fd, struct termios *__s) |
23 | { |
24 | return ioctl(__fd, TCGETS, __s); |
25 | } |
26 | |
27 | static __inline__ int tcsetattr(int __fd, int __opt, const struct termios *__s) |
28 | { |
29 | return ioctl(__fd, __opt, (void *)__s); |
30 | } |
31 | |
32 | static __inline__ int tcflow(int __fd, int __action) |
33 | { |
34 | return ioctl(__fd, TCXONC, (void *)(intptr_t) __action); |
35 | } |
36 | |
37 | static __inline__ int tcflush(int __fd, int __queue) |
38 | { |
39 | return ioctl(__fd, TCFLSH, (void *)(intptr_t) __queue); |
40 | } |
41 | |
42 | static __inline__ int tcdrain(int __fd) |
43 | { |
44 | return ioctl(__fd, TCSBRK, (void *)1L); |
45 | } |
46 | |
47 | static __inline__ pid_t tcgetpgrp(int __fd) |
48 | { |
49 | pid_t __p; |
50 | return ioctl(__fd, TIOCGPGRP, &__p) ? (pid_t) - 1 : __p; |
51 | } |
52 | |
53 | static __inline__ pid_t tcgetsid(int __fd) |
54 | { |
55 | pid_t __p; |
56 | return ioctl(__fd, TIOCGSID, &__p) ? (pid_t) - 1 : __p; |
57 | } |
58 | |
59 | static __inline__ int tcsendbreak(int __fd, int __duration) |
60 | { |
61 | return ioctl(__fd, TCSBRKP, (void *)(uintptr_t) __duration); |
62 | } |
63 | |
64 | static __inline__ int tcsetpgrp(int __fd, pid_t __p) |
65 | { |
66 | return ioctl(__fd, TIOCSPGRP, &__p); |
67 | } |
68 | |
69 | static __inline__ speed_t cfgetospeed(const struct termios *__s) |
70 | { |
71 | return (speed_t) (__s->c_cflag & CBAUD); |
72 | } |
73 | |
74 | static __inline__ speed_t cfgetispeed(const struct termios *__s) |
75 | { |
76 | return (speed_t) (__s->c_cflag & CBAUD); |
77 | } |
78 | |
79 | static __inline__ int cfsetospeed(struct termios *__s, speed_t __v) |
80 | { |
81 | __s->c_cflag = (__s->c_cflag & ~CBAUD) | (__v & CBAUD); |
82 | return 0; |
83 | } |
84 | |
85 | static __inline__ int cfsetispeed(struct termios *__s, speed_t __v) |
86 | { |
87 | __s->c_cflag = (__s->c_cflag & ~CBAUD) | (__v & CBAUD); |
88 | return 0; |
89 | } |
90 | |
91 | #endif /* _TERMIOS_H */ |