Appendix B
IPCIF: Alta IPC-based interfaces

The set of IPCIF interfaces defined for Alta are described here. These interfaces are designed to support the basic responsibilities of a parent process and to support the standard Java class libraries, as of JDK 1.0.2, but without support for an AWT. These interfaces are analogous to the "Common Protocol" interfaces in Fluke.

B.1 Parent interface

The parent interface is the "bootstrap" interface from which a process gains access to all other IPCIF services. Every edu.utah.npm.core.Space object has a port reference associated with it. Every process that creates a subprocess must also handle the parent interface requests for that process.

ClassForName(String name) Returns ClassHandle
Given a fully qualified class name, return a edu.utah.npm.core.ClassHandle object representing the class to bind that name to in the child.

LastThreadDied() Returns boolean
The child process will invoke this method when the last thread in the process has expired.

Exit() Returns boolean
Perform an explicit process exit.

GetStandardIn() Returns Reference
The child will invoke this method as it is being initialized to setup its default input stream. The edu.utah.npm.core.Reference returned should be compatible with the file interface.

GetStandardOut() Returns Reference
The child will invoke this method as it is being initialized to setup its default output stream. The edu.utah.npm.core.Reference returned should be compatible with the file interface.

GetStandardErr() Returns Reference
The child will invoke this method as it is being initialized to setup its default error stream. The edu.utah.npm.core.Reference returned should be compatible with the file interface.

ServiceMapServerReq() Returns Reference
The child will invoke this method to get a handle on the "Service Mapper" service (see Section B.2). The service mapper is a basic name service, mapping string names to ports. The returned edu.utah.npm.core.Reference is the port through which all other services are acquired.

B.2 Service map interface

The Service Map is a generic name to port reference binding service. It supports only one method.

handlePortForName(String name) Returns Reference
This method is invoked with a java.lang.String argument. The associated port reference is returned.

B.3 MemPool interface

The MemPool Interface is used by parent processes that manage the memory resources of a nested child. The child's interface to the garbage collector (invocation of the garbage collector and invocation of the finalizer) are accomplished through this interface.

OutOfMemory(int shortAmt) Returns boolean
Invoked directly by the VM, this method indicates that a process has insufficent memory in its MemPool (requiring shortAmt to proceed).

InvokeGC() Returns void
Invoke the GC.

InvokeFinalizer() Returns void
Invoke the finalizer thread.

AvailableMemory() Returns long
Returns the amount of memory available in child's MemPool.

TotalMemory() Returns long
Returns the total amount of memory in the child's MemPool.

B.4 File system interface

The File System Interface supports method for performing file-system level operations such as opening a file, renaming files, etc. These methods are used by the IPC-based version of the java.io.File class.

CanRead(String path) Returns boolean
Returns true if the file specified by path is readable by the current process.

CanWrite(String path) Returns boolean
Returns true if the file specified by path is writeable by the current process.

Exists(String path) Returns boolean
Returns true if the file specified by path exists.

IsDirectory(String path) Returns boolean
Returns true if the file specified by path is a directory.

IsFile(String path) Returns boolean
Returns true if the file specified by path is a regular file.

LastModified(String path) Returns long
Returns the last modification timestamp (in milliseconds) of the file specified by path.

FileSize(String path) Returns long
Returns the size (in bytes) of the file specified by path.

Delete(String path) Returns boolean
Deletes the file specified by path; returns true for success and false for failure.

Rename(String from, String to) Returns boolean
Renames the file specified by from to to; returns true for success and false for failure.

Mkdir(String path) Returns boolean
Creates the directory specified by path; returns true for success and false for failure. Does not create any required parent directories.

DirList(String path) Returns String[]
Returns an array of java.lang.String objects, one for each entry in the directory given by path.

Open_read(String path) Returns Reference
Returns a port reference to a File I/O Interface, corresponding to the file specified by path. The file is opened in read-only mode.

Open_write(String path) Returns Reference
Returns a port reference to a File I/O Interface, corresponding to the file specified by path. The file is opened for reading.

Open_read_write(String path) Returns Reference
Returns a port reference to a File I/O Interface, corresponding to the file specified by path. The file is opened in read-write mode.

B.5 File I/O interface

The File I/O Interface represents a single open file.

Read(byte[] buffer, int toRead) Returns int
Reads toRead bytes into buffer from this file. Returns the actual number of bytes read.

Write(byte[] buffer) Returns int
Write the entire contents of buffer into this file. Returns the actual number of bytes written.

Skip(long bytes) Returns long
Skip forward bytes bytes in this file.

Ftell() Returns long
Return the current offset in this file.

Fseek(long offset, int whence) Returns long
Move the current offset pointer offset bytes in the whence direction (from the beginning, from the end, or from the current position).

Close() Returns void
Close this file.

B.6 Network I/O interface

The Network I/O Interface corresponds to the File System Interface, but, obviously, provides an interface to networking services.

Socket(boolean streamsocket) Returns Reference
Create a stream socket or datagram socket (depending on streamsocket). Returns a port reference to a File I/O interface.

Bind(byte[] addr, int port) Returns void
Bind the current descriptor to the given IP address and port.

Listen(int count) Returns void
Flag the current descriptor to accept connections and to buffer count of them.

Accept(byte[] resultAddr, Reference acceptPortRef) Returns int
Accept a connection on the current descriptor. The resultAddr is the address of the remote connection and acceptPortRef will point to the new File I/O descriptor representing the connection.

Connect(byte[] address, int remotePort) Returns int
Connection to the given address and remotePort using the current descriptor.

DGSocket() Returns Reference
Create a datagram socket from the current descriptor.

Recv() Returns int
Receive a buffer of data on the current datagram descriptor.

Send() Returns int
Send a buffer of data on the current datagram descriptor.

Close() Returns void
Close the current socket.