|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectmoss.user.MPosixIf
public class MPosixIf
the MPosixIF interface provides the glue between applications and the kernel.
| Field Summary | |
|---|---|
static int |
STDERR
standard error descriptor |
static int |
STDIN
standard input descriptor |
static int |
STDOUT
standard output descriptor |
| Constructor Summary | |
|---|---|
MPosixIf()
|
|
| Method Summary | |
|---|---|
static int |
accept(int fd,
MSocketAddr addr)
accepts an incoming connection from a listening socket |
static int |
access(java.lang.String path,
int amode)
test to see if a file can be opened in the given mode. |
static int |
bind(int fd,
MSocketAddr addr)
binds a socket to an address |
static int |
close(int fd)
This method closes the given descriptor. |
static int |
connect(int fd,
MSocketAddr addr)
connects a socket to a remote host |
static void |
exit(int exitcode)
this is called by a process to terminate. |
static int |
fcntl(int fd,
int op,
int arg)
file-handle control. |
static int |
forkexec(java.lang.String cmd,
java.lang.String[] args)
this performs a typical fork()/exec() to start a new process, but tries to find it via the file-system and MExec |
static int |
forkexecc(java.lang.String cname,
java.lang.String[] args)
this performs a typical fork()/exec() used to start a new process |
static int |
getpid()
used to retrieve the current process ID |
static int |
getppid()
used to retrieve the parent process ID |
static int |
kill(int pid,
int sig)
sends a signal to a process |
static int |
listen(int fd,
int backlog)
enables a socket to listen for incoming connections |
static int |
loadmodule(java.lang.String mod,
java.lang.String[] args)
this loads a new kernel module (something that implements MKernelProcess) |
static int |
mkdir(java.lang.String path,
int mode)
creates a directory |
static int |
mount(java.lang.String path,
java.lang.String fstype,
java.lang.String[] options)
this is used to mount a file-system. |
static int |
open_device(java.lang.String name,
int flags)
this opens a device by name (until we get a file-system..) |
static int |
open(java.lang.String path,
int flags)
This method is used to open a file |
static int |
open(java.lang.String path,
int flags,
int mode)
This method is used to open a file, with a file-mode if needed |
static int |
opendir(java.lang.String path)
This method is used to open a directory |
static int |
opennmq(java.lang.String name)
opens a named message-queue. |
static int |
pause()
this is called to put a process to sleep (indefinitely) |
static int |
pipe(int[] fds)
This method creates a new pair of pipe descriptors (and the pipe). |
static MProcess[] |
process_list()
used to get the current process list. |
static int |
read(int fd,
byte[] buffer,
int count)
this performs a read from the given descriptor. |
static int |
readdir(int fd,
MDirEnt dirent)
reads a directory entry from an open directory. |
static int |
readmsg(int fd,
MNamedMsgQ.MNamedMsg msgret)
reads a message from a named message-queue |
static java.lang.Object |
recvmsg(int pid,
int type)
this is used to receive a message from another (or any) process |
static void |
reschedule()
this performes a rescheduling operation. |
static int |
semop(int op,
int key,
int value)
this is used to perform a semaphore operation. |
static int |
sendmsg(int pid,
int type,
java.lang.Object message)
this is used to send a message to another process |
static int |
setpriority(int pri)
sets the priority of the calling process |
static int |
signal(int sig,
int action)
sets a process's handling of a particular signal |
static int |
sleep(long millis)
this is used to put a process to sleep for a given amount of time |
static int |
socket(int domain,
int type)
this creates a new socket |
static int |
stat(java.lang.String path,
MInode statbuf)
stats a file or directory |
static int |
umask(int mask)
sets a process's umask. |
static int |
umount(java.lang.String path)
this is used to unmount a file-system. |
static int |
unlink(java.lang.String path)
unlinks (removes) a file or directory |
static int[] |
wait(boolean nohang)
this method waits for a child process to exit (nohang is false), or polls for an exited child (nohang is true). |
static int |
write(int fd,
byte[] buffer,
int count)
this performs a write to the given descriptor. |
static int |
writeklog(java.lang.String str)
writes a string to the kernel log |
static int |
writemsg(int fd,
int type,
java.lang.Object msg)
sends a message to a named message-queue |
static int |
writestring(int fd,
java.lang.String str)
writes a Java "String" to the given descriptor (more useful than necessary) |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int STDIN
public static final int STDOUT
public static final int STDERR
| Constructor Detail |
|---|
public MPosixIf()
| Method Detail |
|---|
public static int pipe(int[] fds)
fds - array where returned descriptors are stored. fds[0] is for reading,
fds[1] for writing.
public static int open_device(java.lang.String name,
int flags)
name - name of device to openflags - open flags
public static int open(java.lang.String path,
int flags)
path - path to fileflags - open flags (MFileOps.OPEN_...)
public static int open(java.lang.String path,
int flags,
int mode)
path - path to fileflags - open flags (MFileOps.OPEN_...)mode - mode if creating file
public static int opendir(java.lang.String path)
path - path to directory
public static int close(int fd)
fd - file-descriptor
public static int read(int fd,
byte[] buffer,
int count)
fd - file-descriptor to read frombuffer - buffer where data will be storedcount - maximum number of bytes to read
public static int readdir(int fd,
MDirEnt dirent)
fd - file-descriptor referring to an open directorydirent - structure where the directory information will be placed
public static int write(int fd,
byte[] buffer,
int count)
fd - file-descriptor to write tobuffer - data to writecount - maximum number of bytes to write
public static int writestring(int fd,
java.lang.String str)
fd - file-descriptorstr - string to write
public static int fcntl(int fd,
int op,
int arg)
fd - file-descriptor of some fcntl capable streamop - operation (F_... in MFileOps)arg - operation-specific argument
public static int unlink(java.lang.String path)
path - path to the file/directory to remove
public static int opennmq(java.lang.String name)
public static int writemsg(int fd,
int type,
java.lang.Object msg)
fd - file-handle of the named message-queuemsg - object messagetype - application-defined type
public static int readmsg(int fd,
MNamedMsgQ.MNamedMsg msgret)
fd - file-handle of the named message-queuemsgret - message return structure
public static int socket(int domain,
int type)
domain - domain of this sockettype - type of this socket
public static int bind(int fd,
MSocketAddr addr)
fd - file-descriptor for a socketaddr - address to bind
public static int listen(int fd,
int backlog)
fd - file-descriptor for a bound socketbacklog - connection backlog
public static int accept(int fd,
MSocketAddr addr)
fd - file-descriptor for a listening socketaddr - address in which the connecting client address is stored
public static int connect(int fd,
MSocketAddr addr)
fd - file-descriptor for a socketaddr - address of remote host (and port)
public static void reschedule()
public static int forkexecc(java.lang.String cname,
java.lang.String[] args)
cname - Java class name to load (should implement MUserProcess)args - arguments to pass to the started process
public static int forkexec(java.lang.String cmd,
java.lang.String[] args)
cmd - program name to runargs - arguments to pass to the started process
public static int writeklog(java.lang.String str)
str - string to write
public static int loadmodule(java.lang.String mod,
java.lang.String[] args)
mod - path to module to runargs - arguments to pass to the module
public static void exit(int exitcode)
exitcode - return code for parent processpublic static int pause()
public static int getpid()
public static int getppid()
public static int signal(int sig,
int action)
sig - signal constant (MSignal.SIG...)action - signal action constant (MSignal.SIG_...)
public static int kill(int pid,
int sig)
pid - ID of process to signalsig - signal number (MSignal.SIG...)
public static int[] wait(boolean nohang)
nohang - if true, this method will not sleep if no child processes have exited
public static MProcess[] process_list()
public static int sleep(long millis)
millis - timeout in milli-seconds
public static int sendmsg(int pid,
int type,
java.lang.Object message)
pid - target process PIDtype - message type (application specific)message - object message (application specific)
public static java.lang.Object recvmsg(int pid,
int type)
pid - specific PID to receive from (or -1 for any)type - specific message type to receive (application specific, or -1 for any)
public static int semop(int op,
int key,
int value)
op - semaphore operation (SEMOP_CREATE, SEMOP_SET)key - semaphore key (identifier)value - initial value when creating, or adjustment when setting
public static int mount(java.lang.String path,
java.lang.String fstype,
java.lang.String[] options)
path - absolute path to mount pointfstype - file-system type to mountoptions - file-system specific options (may include device)
public static int umount(java.lang.String path)
path - absolute path of the file-system to unmount (mount-point)
public static int mkdir(java.lang.String path,
int mode)
path - absolute path to the directory to be createdmode - permissions to be used when creating the directory
public static int stat(java.lang.String path,
MInode statbuf)
path - absolute path to the file/directory to be `stat'dstatbuf - MInode where the information will be placed
public static int umask(int mask)
mask - the new umask
public static int access(java.lang.String path,
int amode)
path - path to file/directory to checkamode - access modes to check for
public static int setpriority(int pri)
pri - new process priority
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||