File tree Expand file tree Collapse file tree 3 files changed +32
-17
lines changed Expand file tree Collapse file tree 3 files changed +32
-17
lines changed Original file line number Diff line number Diff line change @@ -320,7 +320,7 @@ dependencies = [
320320[[package ]]
321321name = " safa-abi"
322322version = " 0.4.0"
323- source = " git+https://github.com/SafaOS/SafaOS?branch=GUI#72525a91b4b3c13127aff04662c567555920df96 "
323+ source = " git+https://github.com/SafaOS/SafaOS?branch=GUI#b4d02bf81d2db05cd4a06c050052f064a2926dda "
324324dependencies = [
325325 " compiler_builtins" ,
326326 " rustc-std-workspace-alloc" ,
@@ -330,7 +330,7 @@ dependencies = [
330330[[package ]]
331331name = " safa-api"
332332version = " 0.4.3"
333- source = " git+https://github.com/SafaOS/safa-api#4bfba2718e7cdd79347609486560c48823df3d85 "
333+ source = " git+https://github.com/SafaOS/safa-api#5e18738e30dc8231daa504927fe037830a7f767e "
334334dependencies = [
335335 " compiler_builtins" ,
336336 " rustc-std-workspace-alloc" ,
Original file line number Diff line number Diff line change 1+ use safa_api:: syscalls;
2+
3+ use crate :: fs:: File ;
4+
5+ use super :: { AsRawResource , FromRawResource } ;
6+
7+ #[ stable( feature = "rust1" , since = "1.0.0" ) ]
8+ pub trait IoUtils {
9+ #[ stable( feature = "rust1" , since = "1.0.0" ) ]
10+ /// Sends command `command` with argument `arg` to the resource `self`
11+ fn send_command ( & self , command : u16 , arg : u64 ) -> crate :: io:: Result < ( ) > ;
12+ }
13+
14+ #[ stable( feature = "rust1" , since = "1.0.0" ) ]
15+ impl IoUtils for File {
16+ fn send_command ( & self , command : u16 , arg : u64 ) -> crate :: io:: Result < ( ) > {
17+ let ri = self . as_raw_resource ( ) ;
18+ syscalls:: io:: io_command ( ri, command, arg) . map_err ( |e| e. into ( ) )
19+ }
20+ }
21+
22+ /// Creates a new VTTY pair of (mother, child) file descriptors.
23+ #[ stable( feature = "io_create_vtty" , since = "1.75.0" ) ]
24+ pub fn create_vtty ( ) -> crate :: io:: Result < ( File , File ) > {
25+ let ( mother, child) = syscalls:: io:: vtty_alloc ( ) ?;
26+ unsafe { Ok ( ( File :: from_raw_resource ( mother) , File :: from_raw_resource ( child) ) ) }
27+ }
Original file line number Diff line number Diff line change 11#![ stable( feature = "rust1" , since = "1.0.0" ) ]
2+ #[ stable( feature = "rust1" , since = "1.0.0" ) ]
3+ pub mod io;
4+
25#[ unstable( feature = "rustc_private" , issue = "27812" ) ]
36pub use safa_api as api;
47
@@ -52,18 +55,3 @@ impl FromRawResource for File {
5255 FromInner :: from_inner ( inner)
5356 }
5457}
55-
56- #[ stable( feature = "rust1" , since = "1.0.0" ) ]
57- pub trait IoUtils {
58- #[ stable( feature = "rust1" , since = "1.0.0" ) ]
59- /// Sends command `command` with argument `arg` to the resource `self`
60- fn send_command ( & self , command : u16 , arg : u64 ) -> crate :: io:: Result < ( ) > ;
61- }
62-
63- #[ stable( feature = "rust1" , since = "1.0.0" ) ]
64- impl IoUtils for File {
65- fn send_command ( & self , command : u16 , arg : u64 ) -> crate :: io:: Result < ( ) > {
66- let ri = self . as_raw_resource ( ) ;
67- syscalls:: io:: io_command ( ri, command, arg) . map_err ( |e| e. into ( ) )
68- }
69- }
You can’t perform that action at this time.
0 commit comments