@@ -11,11 +11,14 @@ use crate::fd::BorrowedFd;
11
11
#[ cfg( not( any( target_os = "fuchsia" , target_os = "wasi" ) ) ) ]
12
12
use crate :: ffi:: CStr ;
13
13
use crate :: io;
14
+ #[ cfg( not( target_os = "wasi" ) ) ]
14
15
use crate :: process:: { Pid , RawNonZeroPid } ;
16
+ #[ cfg( not( target_os = "wasi" ) ) ]
15
17
use crate :: termios:: { Action , OptionalActions , QueueSelector , Speed , Termios , Winsize } ;
16
18
use core:: mem:: MaybeUninit ;
17
19
use libc_errno:: errno;
18
20
21
+ #[ cfg( not( target_os = "wasi" ) ) ]
19
22
pub ( crate ) fn tcgetattr ( fd : BorrowedFd < ' _ > ) -> io:: Result < Termios > {
20
23
let mut result = MaybeUninit :: < Termios > :: uninit ( ) ;
21
24
unsafe {
@@ -24,6 +27,7 @@ pub(crate) fn tcgetattr(fd: BorrowedFd<'_>) -> io::Result<Termios> {
24
27
}
25
28
}
26
29
30
+ #[ cfg( not( target_os = "wasi" ) ) ]
27
31
pub ( crate ) fn tcgetpgrp ( fd : BorrowedFd < ' _ > ) -> io:: Result < Pid > {
28
32
unsafe {
29
33
let pid = ret_pid_t ( c:: tcgetpgrp ( borrowed_fd ( fd) ) ) ?;
@@ -32,10 +36,12 @@ pub(crate) fn tcgetpgrp(fd: BorrowedFd<'_>) -> io::Result<Pid> {
32
36
}
33
37
}
34
38
39
+ #[ cfg( not( target_os = "wasi" ) ) ]
35
40
pub ( crate ) fn tcsetpgrp ( fd : BorrowedFd < ' _ > , pid : Pid ) -> io:: Result < ( ) > {
36
41
unsafe { ret ( c:: tcsetpgrp ( borrowed_fd ( fd) , pid. as_raw_nonzero ( ) . get ( ) ) ) }
37
42
}
38
43
44
+ #[ cfg( not( target_os = "wasi" ) ) ]
39
45
pub ( crate ) fn tcsetattr (
40
46
fd : BorrowedFd ,
41
47
optional_actions : OptionalActions ,
@@ -50,22 +56,27 @@ pub(crate) fn tcsetattr(
50
56
}
51
57
}
52
58
59
+ #[ cfg( not( target_os = "wasi" ) ) ]
53
60
pub ( crate ) fn tcsendbreak ( fd : BorrowedFd ) -> io:: Result < ( ) > {
54
61
unsafe { ret ( c:: tcsendbreak ( borrowed_fd ( fd) , 0 ) ) }
55
62
}
56
63
64
+ #[ cfg( not( target_os = "wasi" ) ) ]
57
65
pub ( crate ) fn tcdrain ( fd : BorrowedFd ) -> io:: Result < ( ) > {
58
66
unsafe { ret ( c:: tcdrain ( borrowed_fd ( fd) ) ) }
59
67
}
60
68
69
+ #[ cfg( not( target_os = "wasi" ) ) ]
61
70
pub ( crate ) fn tcflush ( fd : BorrowedFd , queue_selector : QueueSelector ) -> io:: Result < ( ) > {
62
71
unsafe { ret ( c:: tcflush ( borrowed_fd ( fd) , queue_selector as _ ) ) }
63
72
}
64
73
74
+ #[ cfg( not( target_os = "wasi" ) ) ]
65
75
pub ( crate ) fn tcflow ( fd : BorrowedFd , action : Action ) -> io:: Result < ( ) > {
66
76
unsafe { ret ( c:: tcflow ( borrowed_fd ( fd) , action as _ ) ) }
67
77
}
68
78
79
+ #[ cfg( not( target_os = "wasi" ) ) ]
69
80
pub ( crate ) fn tcgetsid ( fd : BorrowedFd ) -> io:: Result < Pid > {
70
81
unsafe {
71
82
let pid = ret_pid_t ( c:: tcgetsid ( borrowed_fd ( fd) ) ) ?;
@@ -74,10 +85,12 @@ pub(crate) fn tcgetsid(fd: BorrowedFd) -> io::Result<Pid> {
74
85
}
75
86
}
76
87
88
+ #[ cfg( not( target_os = "wasi" ) ) ]
77
89
pub ( crate ) fn tcsetwinsize ( fd : BorrowedFd , winsize : Winsize ) -> io:: Result < ( ) > {
78
90
unsafe { ret ( c:: ioctl ( borrowed_fd ( fd) , c:: TIOCSWINSZ , & winsize) ) }
79
91
}
80
92
93
+ #[ cfg( not( target_os = "wasi" ) ) ]
81
94
pub ( crate ) fn tcgetwinsize ( fd : BorrowedFd ) -> io:: Result < Winsize > {
82
95
unsafe {
83
96
let mut buf = MaybeUninit :: < Winsize > :: uninit ( ) ;
@@ -90,33 +103,39 @@ pub(crate) fn tcgetwinsize(fd: BorrowedFd) -> io::Result<Winsize> {
90
103
}
91
104
}
92
105
106
+ #[ cfg( not( target_os = "wasi" ) ) ]
93
107
#[ inline]
94
108
#[ must_use]
95
109
pub ( crate ) fn cfgetospeed ( termios : & Termios ) -> Speed {
96
110
unsafe { c:: cfgetospeed ( termios) }
97
111
}
98
112
113
+ #[ cfg( not( target_os = "wasi" ) ) ]
99
114
#[ inline]
100
115
#[ must_use]
101
116
pub ( crate ) fn cfgetispeed ( termios : & Termios ) -> Speed {
102
117
unsafe { c:: cfgetispeed ( termios) }
103
118
}
104
119
120
+ #[ cfg( not( target_os = "wasi" ) ) ]
105
121
#[ inline]
106
122
pub ( crate ) fn cfmakeraw ( termios : & mut Termios ) {
107
123
unsafe { c:: cfmakeraw ( termios) }
108
124
}
109
125
126
+ #[ cfg( not( target_os = "wasi" ) ) ]
110
127
#[ inline]
111
128
pub ( crate ) fn cfsetospeed ( termios : & mut Termios , speed : Speed ) -> io:: Result < ( ) > {
112
129
unsafe { ret ( c:: cfsetospeed ( termios, speed) ) }
113
130
}
114
131
132
+ #[ cfg( not( target_os = "wasi" ) ) ]
115
133
#[ inline]
116
134
pub ( crate ) fn cfsetispeed ( termios : & mut Termios , speed : Speed ) -> io:: Result < ( ) > {
117
135
unsafe { ret ( c:: cfsetispeed ( termios, speed) ) }
118
136
}
119
137
138
+ #[ cfg( not( target_os = "wasi" ) ) ]
120
139
#[ inline]
121
140
pub ( crate ) fn cfsetspeed ( termios : & mut Termios , speed : Speed ) -> io:: Result < ( ) > {
122
141
unsafe { ret ( c:: cfsetspeed ( termios, speed) ) }
0 commit comments