These procedures are in structures
Open-pipecreates a new pipe and returns the two ends as an input port and an output port.
A file descriptor port (or
is a port that reads to or writes from an OS file descriptor.
Fd-ports are returned by
open-pipe, and other procedures.
Fd-port?returns true if its argument is an fd-port.
Port->fdreturns the file descriptor associated with or
portis not an fd-port.
Remap-file-descriptorsreassigns file descriptors to ports. The
fd-specsindicate which port is to be mapped to each file descriptor: the first gets file descriptor
0, the second gets
1, and so forth. A
fd-specis either a port that reads from or writes to a file descriptor, or
#findicating that the corresponding file descriptor is not used. Any open ports not listed are marked `close-on-exec'. The same port may be moved to multiple new file descriptors.
moves the current output port to file descriptor(remap-file-descriptors (current-output-port) #f (current-input-port))
0and the current input port to file descriptor
(dup fd-port) -> fd-port
(dup-switching-mode fd-port) -> fd-port
(dup2 fd-port file-descriptor) -> fd-port
fd-port's file descriptor and return a new port that uses
ports's old file descriptor.
Dupuses the lowest unused file descriptor and
dup2uses the one provided.
Dup-switching-modeis the same as
dupexcept that the returned port is an input port if the argument was an output port and vice versa. If any existing port uses the file descriptor passed to
dup2, that port is closed.
Close-all-butcloses all file descriptors whose associated ports are not passed to it as arguments.
Close-on-exec?returns true if
portwill be closed when a new program is exec'ed.
port's close-on-exec flag.
port. The options that can be read are
read/write. Only the
nonblockingcan be written.
Port-is-a-terminal?returns true if
porthas an underlying file descriptor that is associated with a terminal. For such ports
port-terminal-namereturns the name of the terminal, for all others it returns
Previous: I/O | Next: I/O