|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Object Library
Convenience calls for using the Kernel. Each function in this class makes a system call. Sometimes, the arguments are manipulated to make their user representation more convenient. Note that this class contains only static methods. All methods return integers. Negative return values are error codes. Some methods return positive values; others simply return 0 to mean "ok".
Kernel
Field Summary | |
static String[] |
errorMessage
A table of error messages corresponding to Kernel error return codes. |
Constructor Summary | |
private |
Library()
This private constructor ensures that no instances of Library are ever created. |
Method Summary | |
static int |
create(String fname)
Creates a new empty file (size 0). |
static int |
exec(String command,
String[] args)
Performs SYSCALL_EXEC. |
static int |
format(int dsize,
int isize)
Formats the disk. |
static int |
input(StringBuffer result)
Performs SYSCALL_INPUT. |
static int |
join(int pid)
Performs SYSCALL_JOIN. |
static int |
link(String oldFname,
String newFname)
Adds an additional name to an existing file. |
static int |
list()
Reports information about the file system to System.out. |
static int |
output(String s)
Performs SYSCALL_OUTPUT. |
static int |
read(String fname,
int offset,
byte[] buffer)
Reads from a file. |
static int |
sync()
Flushes all cached information to disk. |
static int |
unlink(String fname)
Removes a name from a file. |
static int |
write(String fname,
int offset,
byte[] buffer)
Writes to a file. |
Methods inherited from class Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final String[] errorMessage
rc = Kernel.interrupt(Kernel.INTERRUPT_USER, ... )and rc is less than 0.
Constructor Detail |
private Library()
Method Detail |
public static int output(String s)
s
- a String to display
public static int input(StringBuffer result)
result
- a place to put the result
public static int exec(String command, String[] args)
command
- The name of a Java class to execute.args
- The arguments to give the new program
public static int join(int pid)
pid
- a process id returned by a previous call to exec.
public static int format(int dsize, int isize)
dsize
- space allocated to the directory, in blocks.isize
- space allocated for inodes, in blocks.
public static int create(String fname)
fname
- the name of the new file being created.
public static int read(String fname, int offset, byte[] buffer)
fname
- the name of the file to read from.offset
- the starting position in the file (0 is start).buffer
- the destination for the data.
public static int write(String fname, int offset, byte[] buffer)
fname
- the name of the file to write to.offset
- the starting position in the file (0 is start).buffer
- the source of the data.
public static int link(String oldFname, String newFname)
oldFname
- the name of an existing file.newFname
- a new name for the file.
public static int unlink(String fname)
fname
- the name of an existing file. If no other names exist for
the file, it is deleted.
public static int list()
public static int sync()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |