CONTENT="Modular DocBook HTML Stylesheet Version 1.64
7.5. Posix Input and Output Primitives
createPipe calls pipe to create a pipe and returns a pair of Fds, the first for reading and the second for writing.
dup fd calls dup to duplicate Fd fd to another Fd.
dupTo src dst calls dup2 to duplicate Fd src to Fd dst.
fdClose fd calls close to close Fd fd.
fdRead fd nbytes calls read to read at most nbytes bytes from Fd fd, and returns the result as a string paired with the number of bytes actually read.
The operation may fail with:
fdWrite fd s calls write to write the string s to Fd fd as a contiguous sequence of bytes. It returns the number of bytes successfully written.
getFdOption opt fd calls fcntl to determine whether or not the flag associated with FdOption opt is set for Fd fd.
setFdOption fd opt val calls fcntl to set the flag associated with FdOption opt on Fd fd to val.
getLock fd lock calls fcntl to get the first FileLock for Fd fd which blocks the FileLock lock. If no such FileLock exists, getLock returns Nothing. Otherwise, it returns Just (pid, block), where block is the blocking FileLock and pid is the ProcessID of the process holding the blocking FileLock.
setLock fd lock calls fcntl with F_SETLK to set or clear a lock segment for Fd fd as indicated by the FileLock lock. setLock does not block, but fails with SystemError if the request cannot be satisfied immediately.
waitToSetLock fd lock calls fcntl with F_SETLKW to set or clear a lock segment for Fd fd as indicated by the FileLock lock. If the request cannot be satisfied immediately, waitToSetLock blocks until the request can be satisfied.
fdSeek fd whence offset calls lseek to position the Fd fd at the given offset from the starting location indicated by whence. It returns the resulting offset from the start of the file in bytes.