@@ -31,7 +31,7 @@ use crate::userland::scheduler;
3131use crate :: fs:: Path ;
3232use crate :: utils:: downcast;
3333
34- #[ aero_proc :: syscall]
34+ #[ syscall]
3535pub fn write ( fd : usize , buffer : & [ u8 ] ) -> Result < usize , AeroSyscallError > {
3636 let handle = scheduler:: get_scheduler ( )
3737 . current_task ( )
@@ -49,7 +49,7 @@ pub fn write(fd: usize, buffer: &[u8]) -> Result<usize, AeroSyscallError> {
4949 }
5050}
5151
52- #[ aero_proc :: syscall]
52+ #[ syscall]
5353pub fn read ( fd : usize , buffer : & mut [ u8 ] ) -> Result < usize , AeroSyscallError > {
5454 let handle = scheduler:: get_scheduler ( )
5555 . current_task ( )
@@ -67,7 +67,7 @@ pub fn read(fd: usize, buffer: &mut [u8]) -> Result<usize, AeroSyscallError> {
6767 }
6868}
6969
70- #[ aero_proc :: syscall]
70+ #[ syscall]
7171pub fn open ( _fd : usize , path : & Path , mode : usize ) -> Result < usize , AeroSyscallError > {
7272 let mut flags = OpenFlags :: from_bits ( mode) . ok_or ( AeroSyscallError :: EINVAL ) ?;
7373
@@ -97,15 +97,15 @@ pub fn open(_fd: usize, path: &Path, mode: usize) -> Result<usize, AeroSyscallEr
9797 . open_file ( inode, flags) ?)
9898}
9999
100- #[ aero_proc :: syscall]
100+ #[ syscall]
101101pub fn dup ( fd : usize , flags : usize ) -> Result < usize , AeroSyscallError > {
102102 let task = scheduler:: get_scheduler ( ) . current_task ( ) ;
103103 let flags = OpenFlags :: from_bits ( flags) . ok_or ( AeroSyscallError :: EINVAL ) ? & OpenFlags :: O_CLOEXEC ;
104104
105105 task. file_table . duplicate ( fd, DuplicateHint :: Any , flags)
106106}
107107
108- #[ aero_proc :: syscall]
108+ #[ syscall]
109109pub fn dup2 ( fd : usize , new_fd : usize , flags : usize ) -> Result < usize , AeroSyscallError > {
110110 let task = scheduler:: get_scheduler ( ) . current_task ( ) ;
111111 let flags = OpenFlags :: from_bits ( flags) . ok_or ( AeroSyscallError :: EINVAL ) ? & OpenFlags :: O_CLOEXEC ;
@@ -114,7 +114,7 @@ pub fn dup2(fd: usize, new_fd: usize, flags: usize) -> Result<usize, AeroSyscall
114114 . duplicate ( fd, DuplicateHint :: Exact ( new_fd) , flags)
115115}
116116
117- #[ aero_proc :: syscall]
117+ #[ syscall]
118118pub fn getdents ( fd : usize , buffer : & mut [ u8 ] ) -> Result < usize , AeroSyscallError > {
119119 let handle = scheduler:: get_scheduler ( )
120120 . current_task ( )
@@ -125,7 +125,7 @@ pub fn getdents(fd: usize, buffer: &mut [u8]) -> Result<usize, AeroSyscallError>
125125 Ok ( handle. get_dents ( buffer) ?)
126126}
127127
128- #[ aero_proc :: syscall]
128+ #[ syscall]
129129pub fn close ( fd : usize ) -> Result < usize , AeroSyscallError > {
130130 let res = scheduler:: get_scheduler ( )
131131 . current_task ( )
@@ -140,7 +140,7 @@ pub fn close(fd: usize) -> Result<usize, AeroSyscallError> {
140140 }
141141}
142142
143- #[ aero_proc :: syscall]
143+ #[ syscall]
144144pub fn chdir ( path : & str ) -> Result < usize , AeroSyscallError > {
145145 let inode = fs:: lookup_path ( Path :: new ( path) ) ?;
146146
@@ -153,7 +153,7 @@ pub fn chdir(path: &str) -> Result<usize, AeroSyscallError> {
153153 Ok ( 0x00 )
154154}
155155
156- #[ aero_proc :: syscall]
156+ #[ syscall]
157157pub fn mkdirat ( dfd : usize , path : & Path ) -> Result < usize , AeroSyscallError > {
158158 // NOTE: If the pathname given in pathname is relative, then it is interpreted
159159 // relative to the directory referred to by the file descriptor (rather than relative
@@ -194,7 +194,7 @@ pub fn mkdirat(dfd: usize, path: &Path) -> Result<usize, AeroSyscallError> {
194194 Ok ( 0x00 )
195195}
196196
197- #[ aero_proc :: syscall]
197+ #[ syscall]
198198pub fn rmdir ( path : & str ) -> Result < usize , AeroSyscallError > {
199199 let path = Path :: new ( path) ;
200200
@@ -212,15 +212,15 @@ pub fn rmdir(path: &str) -> Result<usize, AeroSyscallError> {
212212 Ok ( 0x00 )
213213}
214214
215- #[ aero_proc :: syscall]
215+ #[ syscall]
216216pub fn getcwd ( buffer : & mut [ u8 ] ) -> Result < usize , AeroSyscallError > {
217217 let cwd = scheduler:: get_scheduler ( ) . current_task ( ) . get_cwd ( ) ;
218218
219219 buffer[ ..cwd. len ( ) ] . copy_from_slice ( cwd. as_bytes ( ) ) ;
220220 Ok ( cwd. len ( ) )
221221}
222222
223- #[ aero_proc :: syscall]
223+ #[ syscall]
224224pub fn ioctl ( fd : usize , command : usize , argument : usize ) -> Result < usize , AeroSyscallError > {
225225 let handle = scheduler:: get_scheduler ( )
226226 . current_task ( )
@@ -231,7 +231,7 @@ pub fn ioctl(fd: usize, command: usize, argument: usize) -> Result<usize, AeroSy
231231 Ok ( handle. inode ( ) . ioctl ( command, argument) ?)
232232}
233233
234- #[ aero_proc :: syscall]
234+ #[ syscall]
235235pub fn seek ( fd : usize , offset : usize , whence : usize ) -> Result < usize , AeroSyscallError > {
236236 let handle = scheduler:: get_scheduler ( )
237237 . current_task ( )
@@ -242,7 +242,7 @@ pub fn seek(fd: usize, offset: usize, whence: usize) -> Result<usize, AeroSyscal
242242 Ok ( handle. seek ( offset as isize , aero_syscall:: SeekWhence :: from ( whence) ) ?)
243243}
244244
245- #[ aero_proc :: syscall]
245+ #[ syscall]
246246pub fn pipe ( fds : & mut [ usize ; 2 ] , flags : usize ) -> Result < usize , AeroSyscallError > {
247247 let flags = OpenFlags :: from_bits ( flags) . ok_or ( AeroSyscallError :: EINVAL ) ?;
248248 let pipe = Pipe :: new ( ) ;
@@ -274,7 +274,7 @@ pub fn pipe(fds: &mut [usize; 2], flags: usize) -> Result<usize, AeroSyscallErro
274274 Ok ( 0x00 )
275275}
276276
277- #[ aero_proc :: syscall]
277+ #[ syscall]
278278pub fn unlink ( fd : usize , path : & Path , flags : usize ) -> Result < usize , AeroSyscallError > {
279279 // TODO: Make use of the open flags.
280280 let _flags = OpenFlags :: from_bits ( flags) . ok_or ( AeroSyscallError :: EINVAL ) ?;
@@ -298,7 +298,7 @@ pub fn unlink(fd: usize, path: &Path, flags: usize) -> Result<usize, AeroSyscall
298298 Ok ( 0x00 )
299299}
300300
301- #[ aero_proc :: syscall]
301+ #[ syscall]
302302pub fn access (
303303 fd : usize ,
304304 path : & Path ,
@@ -314,7 +314,7 @@ pub fn access(
314314 }
315315}
316316
317- #[ aero_proc :: syscall]
317+ #[ syscall]
318318pub fn fcntl ( fd : usize , command : usize , arg : usize ) -> Result < usize , AeroSyscallError > {
319319 let handle = scheduler:: get_scheduler ( )
320320 . current_task ( )
@@ -361,7 +361,7 @@ pub fn fcntl(fd: usize, command: usize, arg: usize) -> Result<usize, AeroSyscall
361361 }
362362}
363363
364- #[ aero_proc :: syscall]
364+ #[ syscall]
365365pub fn fstat ( fd : usize , stat : & mut Stat ) -> Result < usize , AeroSyscallError > {
366366 let file = scheduler:: get_scheduler ( )
367367 . current_task ( )
@@ -374,7 +374,7 @@ pub fn fstat(fd: usize, stat: &mut Stat) -> Result<usize, AeroSyscallError> {
374374 Ok ( 0 )
375375}
376376
377- #[ aero_proc :: syscall]
377+ #[ syscall]
378378pub fn stat ( path : & Path , stat : & mut Stat ) -> Result < usize , AeroSyscallError > {
379379 let file = fs:: lookup_path ( path) ?;
380380
@@ -383,32 +383,31 @@ pub fn stat(path: &Path, stat: &mut Stat) -> Result<usize, AeroSyscallError> {
383383 Ok ( 0 )
384384}
385385
386- #[ aero_proc :: syscall]
386+ #[ syscall]
387387pub fn read_link ( path : & Path , _buffer : & mut [ u8 ] ) -> Result < usize , AeroSyscallError > {
388388 log:: warn!( "read_link: is a stub! (path={path:?})" ) ;
389389
390390 Err ( AeroSyscallError :: EINVAL )
391391}
392392
393393/// Returns a file descriptor referring to the new epoll instance.
394- #[ aero_proc :: syscall]
394+ #[ syscall]
395395pub fn epoll_create ( flags : usize ) -> Result < usize , AeroSyscallError > {
396396 let _flags = EPollFlags :: from_bits ( flags) . ok_or ( AeroSyscallError :: EINVAL ) ?;
397397
398398 let epoll_file = EPoll :: new ( ) ;
399399 let entry = DirEntry :: from_inode ( epoll_file) ;
400400
401- let current_task = scheduler:: get_scheduler ( ) . current_task ( ) ;
402-
403- Ok ( current_task
401+ Ok ( scheduler:: get_scheduler ( )
402+ . current_task ( )
404403 . file_table
405404 . open_file ( entry, OpenFlags :: O_RDWR ) ?)
406405}
407406
408407/// Used to add, modify, or remove entries in the interest list of the
409408/// epoll instance referred to by the file descriptor. It requests that
410409/// the operation be performed for the target file descriptor.
411- #[ aero_proc :: syscall]
410+ #[ syscall]
412411pub fn epoll_ctl (
413412 epfd : usize ,
414413 mode : usize ,
@@ -434,7 +433,7 @@ pub fn epoll_ctl(
434433 }
435434}
436435
437- #[ aero_proc :: syscall]
436+ #[ syscall]
438437pub fn event_fd ( _initval : usize , flags : usize ) -> Result < usize , AeroSyscallError > {
439438 let flags = EventFdFlags :: from_bits ( flags) . ok_or ( AeroSyscallError :: EINVAL ) ?;
440439 assert ! ( !flags. contains( EventFdFlags :: SEMAPHORE ) ) ; // todo: implement event fd semaphore support.
0 commit comments