File tree Expand file tree Collapse file tree 3 files changed +8
-21
lines changed Expand file tree Collapse file tree 3 files changed +8
-21
lines changed Original file line number Diff line number Diff line change @@ -39,6 +39,7 @@ uuid.workspace = true
3939# Async dependencies
4040async-trait.workspace = true
4141tokio = { workspace = true , features = [" full" ] }
42+ rustix = { version = " 1" , features = [" termios" ] }
4243
4344[target .'cfg(target_os = "linux")' .dependencies ]
4445cgroups-rs.workspace = true
Original file line number Diff line number Diff line change 1414 limitations under the License.
1515*/
1616
17- use std:: {
18- os:: unix:: io:: AsRawFd ,
19- sync:: { Arc , Mutex } ,
20- } ;
17+ use std:: sync:: { Arc , Mutex } ;
2118
2219use async_trait:: async_trait;
2320use containerd_shim:: {
24- ioctl_set_winsz,
2521 protos:: {
2622 api:: { ProcessInfo , StateResponse , Status } ,
2723 cgroups:: metrics:: Metrics ,
2824 protobuf:: well_known_types:: timestamp:: Timestamp ,
2925 } ,
30- util:: asyncify,
3126 Console , Result ,
3227} ;
3328use oci_spec:: runtime:: LinuxResources ;
29+ use rustix:: termios:: { tcsetwinsize, Winsize } ;
3430use time:: OffsetDateTime ;
3531use tokio:: {
3632 fs:: File ,
@@ -174,17 +170,14 @@ where
174170
175171 async fn resize_pty ( & mut self , height : u32 , width : u32 ) -> Result < ( ) > {
176172 if let Some ( console) = self . console . as_ref ( ) {
177- let w = libc :: winsize {
173+ let w = Winsize {
178174 ws_row : height as u16 ,
179175 ws_col : width as u16 ,
180176 ws_xpixel : 0 ,
181177 ws_ypixel : 0 ,
182178 } ;
183- let fd = console. file . as_raw_fd ( ) ;
184- asyncify ( move || -> Result < ( ) > {
185- unsafe { ioctl_set_winsz ( fd, & w) . map ( |_x| ( ) ) . map_err ( Into :: into) }
186- } )
187- . await ?;
179+ tcsetwinsize ( & console. file , w)
180+ . map_err ( |e| containerd_shim:: Error :: Other ( e. to_string ( ) ) ) ?;
188181 }
189182 Ok ( ( ) )
190183 }
Original file line number Diff line number Diff line change 1717#![ cfg_attr( feature = "docs" , doc = include_str!( "../README.md" ) ) ]
1818
1919use std:: { fs:: File , path:: PathBuf } ;
20+ #[ cfg( windows) ]
21+ use std:: { fs:: OpenOptions , os:: windows:: prelude:: OpenOptionsExt } ;
2022#[ cfg( unix) ]
2123use std:: { os:: unix:: net:: UnixListener , path:: Path } ;
2224
2325pub use containerd_shim_protos as protos;
24- #[ cfg( unix) ]
25- use nix:: ioctl_write_ptr_bad;
2626pub use protos:: {
2727 shim:: shim:: DeleteResponse ,
2828 ttrpc:: { context:: Context , Result as TtrpcResult } ,
2929} ;
3030use sha2:: { Digest , Sha256 } ;
31-
32- #[ cfg( unix) ]
33- ioctl_write_ptr_bad ! ( ioctl_set_winsz, libc:: TIOCSWINSZ , libc:: winsize) ;
34-
35- #[ cfg( windows) ]
36- use std:: { fs:: OpenOptions , os:: windows:: prelude:: OpenOptionsExt } ;
37-
3831#[ cfg( windows) ]
3932use windows_sys:: Win32 :: Storage :: FileSystem :: FILE_FLAG_OVERLAPPED ;
4033
You can’t perform that action at this time.
0 commit comments