LAM_RFPOSIX(2)

NAME
lam_rfposix - LAM POSIX-like remote file service

DESCRIPTION
The remote file daemon, filed, provides POSIX file access for any client process in the LAM multicomputer. Some services are LAM specific (see lam_rfrmfd(2))). Most of services mirror local POSIX services and these are listed below.

    open(2)	open file
    close(2)	close file descriptor
    read(2)	read input
    write(2)	write output
    lseek(2)	set or increment position in file
    access(2)	check permissions and/or existance of a file
    mkdir(2)	create a directory
    chdir(2)	change current working directory
    fstat(2)	get status on a file descriptor
    stat(2)	get status on a file name
    dup(2)	duplicate a file descriptor
    dup2(2)	duplicate a file descriptor to a specific handle
    system(3)	issue a command to sh(1)
    rmdir(2)	remove a directory
    unlink(2)	remove a file
    getwd(3)	get name of current working directory
    ftruncate(2)	set open file to specified length
    truncate(2)	set named file to specified length

The names of the LAM versions of these functions are prepended with 'lam_rf', for example lam_rfopen(), lam_rfclose(), etc. The parameters are the same as in the POSIX calls. Special flag bits passed to lam_rfopen(2) will invoke special LAM functionality. These flags, defined in <freq.h>, are listed below.

    LAM_O_LOCK	lock a file permanently active
    LAM_O_REUSE	reuse existing open descriptor with same file name
    LAM_O_1WAY	do not reply to write requests
    LAM_O_DINT4	data are four-byte integers
    LAM_O_DFLT4	data are four-byte reals (single precision)
    LAM_O_DFLT8	data are eight-byte reals (double precision)

By default, files are accessed on the origin node. The node ID of a file can be specified by prepending the file name with the node ID and a `:'. The example below opens the file "foo" on node 15.

        lam_rfopen("15:foo", O_RDWR, 0);

An active LAM file descriptor has an associated open POSIX file descriptor. Since the daemon can maintain only a limited number of open POSIX files, it periodically has to close them and reopen them for a different LAM file descriptor. The global number of LAM file descriptors is unlimited, as are the clients of the remote file service. Thus, performance problems (like thrashing) may be avoided by locking certain files in an active state. Locked LAM file descriptors will maintain their open POSIX descriptors until closed by the client. Do not overuse this facility.

Most of the POSIX-like services behave exactly as in POSIX (in fact, the genuine article is eventually called). The exception is lam_rfwrite() when the data size is greater than the LAM network message size (as defined in <net.h>). Such requests have to be packetized. The daemon treats each packet as an individual write request in order to remain simple and stateless. Therefore, long writes on asynchronous descriptors are not atomic.

BUGS
The daemon does not allow read access to any filename starting with "/dev/". This is done to prevent the possibility of the daemon blocking on a slow device, such as a tty. This limitation will be removed in the future.

SEE ALSO
lam_rfstate(2), lam_rfrmfd(2)