NAME

src/io/unix.c - UNIX IO utility functions

DESCRIPTION

This file implements unbuffered, low-level, UNIX-specific functionality. "UNIX" is a generalization, it may be necessary to create separate OS-specific functions for UNIX flavors.

These functions are not part of Parrot's API. Don't call them directly, call the Parrot_io_* functions in src/io/api.c instead. Each platform defines the standard set of macros, which call the correct functions for that platform.

References:

APitUE - W. Richard Stevens, AT&T SFIO, Perl 5 (Nick Ing-Simmons)

Functions

static INTVAL convert_flags_to_unix
Returns a UNIX-specific interpretation of flags suitable for passing to open() and fopen() in Parrot_io_open_unix() and Parrot_io_fdopen_unix() respectively.
INTVAL Parrot_io_init_unix
Sets up the interpreter's standard std* IO handles. Returns 0 on success and -1 on error.
PMC *Parrot_io_open_unix
Opens a string path. flags is a bitwise or combination of PIO_F_* flag values.
INTVAL Parrot_io_async_unix
Experimental asynchronous IO.This is available if PARROT_ASYNC_DEVEL is defined.Only works on Linux at the moment.Toggles the O_ASYNC flag on the IO file descriptor.
PMC *Parrot_io_fdopen_unix
Returns a new FileHandle PMC with the file descriptor passed in.
INTVAL Parrot_io_close_unix
Closes *io's file descriptor.
INTVAL Parrot_io_is_closed_unix
Test whether the filehandle has been closed.
static INTVAL io_is_tty_unix
Returns a boolean value indicating whether fd is a console/tty.
INTVAL Parrot_io_getblksize_unix
Various ways of determining block size.If passed a file descriptor then fstat() and the stat buffer are used if available.If called without an argument then the BLKSIZE constant is returned if it was available at compile time, otherwise PIO_BLKSIZE is returned.
INTVAL Parrot_io_flush_unix
At lowest layer all we can do for flush is to ask the kernel to sync().XXX: Is it necessary to sync() here?
size_t Parrot_io_read_unix
Calls read() to return up to len bytes in the memory starting at buffer.
size_t Parrot_io_write_unix
Calls write() to write len bytes from the memory starting at buffer to the file descriptor in *io.
PIOOFF_T Parrot_io_seek_unix
Hard seek.Calls lseek() to advance the read/write position on *io's file descriptor to offset bytes from the location indicated by whence.
PIOOFF_T Parrot_io_tell_unix
Returns the current read/write position on *io's file discriptor.
PMC *Parrot_io_open_pipe_unix
Very limited exec for now.
size_t Parrot_io_peek_unix
Retrieve the next character in the stream without modifying the stream. Not implemented on this platform.

SEE ALSO

src/io/common.c, src/io/win32.c, src/io/stdio.c, src/io/io_private.h, include/parrot/io_unix.h.