Next: 6.8 Making Sense of
Up: 6 UNIX Interface
Previous: 6.6 Unix System Calls
Many of the UNIX system calls return file descriptors. Instead of using other
UNIX system calls to perform I/O on them, you can create a stream around them.
For this purpose, fd-streams exist. See also read-n-bytes (page ).
[Function]
system:make-fd-stream descriptor &key :input :output
:element-type :buffering :name
:file :original :delete-original
:auto-close :timeout :pathname
This function creates a file descriptor stream using
descriptor. If :input is non-nil, input operations are
allowed. If :output is non-nil, output operations are
allowed. The default is input only. These keywords are defined:
- :element-type
- is the type of the unit of transaction for
the stream, which defaults to string-char. See the Common
Lisp description of open for valid values.
- :buffering
- is the kind of output buffering desired for
the stream. Legal values are :none for no buffering,
:line for buffering up to each newline, and :full for
full buffering.
- :name
- is a simple-string name to use for descriptive
purposes when the system prints an fd-stream. When printing
fd-streams, the system prepends the streams name with Stream
for . If name is unspecified, it defaults to a string
containing file or descriptor, in order of preference.
- :file, :original
- file specifies the defaulted
namestring of the associated file when creating a file stream
(must be a simple-string). original is the
simple-string name of a backup file containing the original
contents of file while writing file.
When you abort the stream by passing t to close as
the second argument, if you supplied both file and
original, close will rename the original name
to the file name. When you close the stream
normally, if you supplied original, and
delete-original is non-nil, close deletes
original. If auto-close is true (the default), then
descriptor will be closed when the stream is garbage
collected.
- :pathname
- : The original pathname passed to open and
returned by pathname; not defaulted or translated.
- :timeout
- if non-null, then timeout is an integer
number of seconds after which an input wait should time out. If a
read does time out, then the system:io-timeout condition is
signalled.
[Function]
system:fd-stream-p object
This function returns t if object is an fd-stream, and
nil if not. Obsolete: use the portable (typep x
'file-stream).
[Function]
system:fd-stream-fd stream
This returns the file descriptor associated with stream.
Next: 6.8 Making Sense of
Up: 6 UNIX Interface
Previous: 6.6 Unix System Calls
Raymond Toy
Mon Jul 14 09:11:27 EDT 1997