|
System.Posix.IO | Portability | non-portable (requires POSIX) | Stability | provisional | Maintainer | libraries@haskell.org |
|
|
|
|
|
Description |
POSIX IO support. These types and functions correspond to the unix
functions open(2), close(2), etc. For more portable functions
which are more like fopen(3) and friends from stdio.h, see
System.IO.
|
|
Synopsis |
|
|
|
|
Input / Output
|
|
Standard file descriptors
|
|
|
|
|
|
|
|
Opening and closing files
|
|
|
Constructors | ReadOnly | | WriteOnly | | ReadWrite | |
|
|
|
|
Correspond to some of the int flags from C's fcntl.h.
| Constructors | OpenFileFlags | | append :: Bool | O_APPEND
| exclusive :: Bool | O_EXCL
| noctty :: Bool | O_NOCTTY
| nonBlock :: Bool | O_NONBLOCK
| trunc :: Bool | O_TRUNC
|
|
|
|
|
|
Default values for the OpenFileFlags type. False for each of
append, exclusive, noctty, nonBlock, and trunc.
|
|
|
|
|
|
Create and open this file in WriteOnly mode. A special case of
openFd. See Files for information on how to use
the FileMode type.
|
|
|
Close this file descriptor. May throw an exception if this is an
invalid descriptor.
|
|
Reading/writing data
|
|
Programmers using the fdRead and fdWrite API should be aware that
EAGAIN exceptions may occur for non-blocking IO!
|
|
|
:: Fd | | -> ByteCount | How many bytes to read
| -> IO (String, ByteCount) | The bytes read, how many bytes were read.
| May throw an exception if this is an invalid descriptor.
|
|
|
|
May throw an exception if this is an invalid descriptor.
|
|
Seeking
|
|
|
May throw an exception if this is an invalid descriptor.
|
|
File options
|
|
|
Constructors | AppendOnWrite | O_APPEND
| CloseOnExec | FD_CLOEXEC
| NonBlockingRead | O_NONBLOCK
| SynchronousWrites | O_SYNC
|
|
|
|
|
May throw an exception if this is an invalid descriptor.
|
|
|
May throw an exception if this is an invalid descriptor.
|
|
Locking
|
|
|
|
|
|
|
|
May throw an exception if this is an invalid descriptor.
|
|
|
May throw an exception if this is an invalid descriptor.
|
|
|
May throw an exception if this is an invalid descriptor.
|
|
Pipes
|
|
|
The createPipe function creates a pair of connected file
descriptors. The first component is the fd to read from, the second
is the write end. Although pipes may be bidirectional, this
behaviour is not portable and programmers should use two separate
pipes for this purpose. May throw an exception if this is an
invalid descriptor.
|
|
Duplicating file descriptors
|
|
|
May throw an exception if this is an invalid descriptor.
|
|
|
May throw an exception if this is an invalid descriptor.
|
|
Converting file descriptors to/from Handles
|
|
|
Extracts the Fd from a Handle. This function has the side effect
of closing the Handle and flushing its write buffer, if necessary.
|
|
|
Converts an Fd into a Handle that can be used with the
standard Haskell IO library (see System.IO).
GHC only: this function has the side effect of putting the Fd
into non-blocking mode (O_NONBLOCK) due to the way the standard
IO library implements multithreaded I/O.
|
|
Produced by Haddock version 0.8 |