xcall FIFO, opcode, ch, buffer, flags, status
FIFO (Unix only) provides a general-purpose technique for communicating with other processes, including those outside of A-Shell and possibly even on other machines (connected via a network) using named pipes. Named pipes (sometimes called FIFOs because that is the way they act) are supported under most implementations of Unix and are similar to sockets, except that they are disk based and therefore somewhat removed from the details of networking.
Parameters
MAP1 OPCODE, F
! opcode (any numeric type)
! 0 = create FIFO
! 1 = open FIFO
! 2 = close FIFO
! 3 = read FIFO
! 4 = write FIFO
MAP1 CH ,F
! channel returned from open; passed to other
! opcodes (any numeric type)
MAP1 BUFFER, S
! data used in various ways depending on
! opcode. May be type X or S as appropriate
MAP1 FLAGS, F
! misc. flags, based on OPCODE (any numeric type)
! opcode 0: permission bits (modified by umask)
! opcode 1: open flags (0=read, 1=write, +4 for 'NDELAY'
! +100 for 'NONBLOCK' (see explanation below)
! opcode 2: ignored
! opcode 3: maximum number of bytes to read (if 0, use map size of BUFFER)
! opcode 4: maximum number of bytes to write (if 0, use map size of BUFFER;
!if –1, use length of BUFFER up to first null)
MAP1 STATUS, F
! result code (any numeric type)
! opcode 0: 0=OK, else –errno (see notes below on errno)
! opcode 1: >0=file number, else –errno
! opcode 2: none
! opcode 3: number of bytes read; else –errno
! opcode 4: number of bytes written; else –errno
Comments
NDELAY and NONBLOCK are mode options controlling how the routine attempts to read or write to a FIFO when the other end is not ready. The exact behavior may differ from one Unix to another, so some experimentation may be required. In general, without either flag, read and write operations will suspend the caller until the operation can be completed. With NDELAY set, the operation will generally succeed and return immediately. That is, data written is buffered if the other end is not ready to read it, and read operations will just return NULL if no data is available. With NONBLOCK set, the routine will return immediately but will fail with an error code if the operation cannot be complete immediately.
Under SCO OpenServer (and possibly others) NONBLOCK is probably not practical for the writing end of a pipe, and in all cases it is not practical for both ends to use NONBLOCK.
Error Codes: Aside from the standard Unix errno values, two special STATUS values are possible:-999 indicates that you passed a bad opcode, and –998 is returned when in NONBLOCK mode and the operation could not be carried out immediately.