diff --git a/userlib/syscall.rs b/userlib/syscall.rs index 0f1befd..0615261 100644 --- a/userlib/syscall.rs +++ b/userlib/syscall.rs @@ -1,7 +1,7 @@ use std::str::Chars; /// Define the BurritOS running time basic unit -pub struct Burritos_Time { +pub struct BurritosTime { seconds: i64, nanos: i64 } @@ -13,7 +13,7 @@ pub struct ThreadId{ /// The system call interface. These are the operations the BurritOS /// kernel needs to support, to be able to run user programs. -pub struct t_error{ +pub struct TError { t: i32 } @@ -45,7 +45,7 @@ extern "C" { /// Return the time spent running BurritOS /// ## Param /// - **t** a struct to define the time unit - fn SysTime(t: Burritos_Time) -> (); + fn SysTime(t: BurritosTime) -> (); /// This user program is done /// ## Param @@ -61,7 +61,7 @@ extern "C" { fn newThread(debug_name: *const char, func: i32, arg: i32) -> ThreadId; /// Only return once the the thread "id" has finished. - fn Join (id: ThreadId) -> t_error; + fn Join (id: ThreadId) -> TError; /// Yield the CPU to another runnable thread, whether in this address space /// or not. @@ -71,30 +71,30 @@ extern "C" { fn PError(mess: *const char) -> (); /// Create a BurritOS file, with "name" - fn Create(name: *const char, size: i32) -> t_error; + fn Create(name: *const char, size: i32) -> TError; /// Open the Nachos file "name", and return an "OpenFileId" that can /// be used to read and write to the file. fn Open(name: *const char) -> OpenFiledId; /// Write "size" bytes from "buffer" to the open file. - fn Write(buffer: *const char, size: i32, id: OpenFiledId) -> t_error; + fn Write(buffer: *const char, size: i32, id: OpenFiledId) -> TError; /// Read "size" bytes from the open file into "buffer". /// Return the number of bytes actually read -- if the open file isn't /// long enough, or if it is an I/O device, and there aren't enough /// characters to read, return whatever is available (for I/O devices, /// you should always wait until you can return at least one character). - fn Read(buffer: *const char, size: i32, id:OpenFiledId) -> t_error; + fn Read(buffer: *const char, size: i32, id:OpenFiledId) -> TError; /// Seek to a specified offset into an opened file - fn Seek(offset: i32, id: OpenFiledId) -> t_error; + fn Seek(offset: i32, id: OpenFiledId) -> TError; /// Close the file, we're done reading and writing to it. - fn Close(id: OpenFiledId) -> t_error; + fn Close(id: OpenFiledId) -> TError; /// Remove the file - fn Remove(name: *const char) -> t_error; + fn Remove(name: *const char) -> TError; //////////////////////////////////////////////////// /// system calls concerning directory management /// @@ -106,10 +106,10 @@ extern "C" { /// Destroy a repertory, which must be empty. /// Return a negative number if an error ocurred. - fn Rmdir(name: *const char) -> t_error; + fn Rmdir(name: *const char) -> TError; /// List the content of BurritOS FileSystem - fn FSList() -> t_error; + fn FSList() -> TError; /// Create a semaphore, initialising it at count. /// Return a Semid, which will enable to do operations on this @@ -118,13 +118,13 @@ extern "C" { /// Destroy a semaphore identified by sema. /// Return a negative number if an error occured during the destruction - fn SemDestroy(sema: SemId) -> t_error; + fn SemDestroy(sema: SemId) -> TError; /// Do the operation P() on the semaphore sema - fn P(sema: SemId) -> t_error; + fn P(sema: SemId) -> TError; /// Do the operation V() on the semaphore sema - fn V(sema: SemId) -> t_error; + fn V(sema: SemId) -> TError; /// Create a lock. /// Return an identifier @@ -133,34 +133,34 @@ extern "C" { /// Destroy a lock. /// Return a negative number if an error ocurred /// during the destruction. - fn LockDestroy(id: LockId) -> t_error; + fn LockDestroy(id: LockId) -> TError; /// Do the operation Acquire on the lock id. /// Return a negative number if an error ocurred. - fn LockAcquire(id: LockId) -> t_error; + fn LockAcquire(id: LockId) -> TError; /// Do the operation Release on the lock id. /// Return a negative number if an error ocurred. - fn LockRelease(id: LockId) -> t_error; + fn LockRelease(id: LockId) -> TError; /// Create a new condition variable fn CondCreate(debug_name: *const char) -> CondId; /// Destroy a condition variable. /// Return a negative number if an error ocurred. - fn CondDestroy(id: CondId) -> t_error; + fn CondDestroy(id: CondId) -> TError; /// Do the operation Wait on a condition variable. /// Returns a negative number if an error ocurred. - fn CondWait(id: CondId) -> t_error; + fn CondWait(id: CondId) -> TError; /// Do the operation Signal on a condition variable (wake up only one thread). /// Return a negative number if an error ocurred. - fn CondSignal(id: CondId) -> t_error; + fn CondSignal(id: CondId) -> TError; /// Do the operation Signal on a condition variable (wake up all threads). /// Return a negative number if an error ocurred. - fn CondBroadcast(id: CondId) -> t_error; + fn CondBroadcast(id: CondId) -> TError; /////////////////////////////////////////////////////// /// # System calls concerning serial port and console