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 INTVAL Parrot_io_init_unix
Sets up the interpreter's standard PMC *Parrot_io_open_unix
Opens a string INTVAL Parrot_io_async_unix
Experimental asynchronous IO.This is available if PMC *Parrot_io_fdopen_unix
Returns a new INTVAL Parrot_io_close_unix
Closes 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 INTVAL Parrot_io_getblksize_unix
Various ways of determining block size.If passed a file descriptor then INTVAL Parrot_io_flush_unix
At lowest layer all we can do for size_t Parrot_io_read_unix
Calls size_t Parrot_io_write_unix
Calls PIOOFF_T Parrot_io_seek_unix
Hard seek.Calls PIOOFF_T Parrot_io_tell_unix
Returns the current read/write position on PMC *Parrot_io_open_pipe_unix
Very limited size_t Parrot_io_peek_unix
Retrieve the next character in the stream without modifying the stream.
Not implemented on this platform.
flags suitable for passing to open() and fopen() in Parrot_io_open_unix() and Parrot_io_fdopen_unix() respectively.
std* IO handles.
Returns 0 on success and -1 on error.
path.
flags is a bitwise or combination of PIO_F_* flag values.
PARROT_ASYNC_DEVEL is defined.Only works on Linux at the moment.Toggles the O_ASYNC flag on the IO file descriptor.
FileHandle PMC with the file descriptor passed in.
*io's file descriptor.
fd is a console/tty.
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.
flush is to ask the kernel to sync().XXX: Is it necessary to sync() here?
read() to return up to len bytes in the memory starting at buffer.
write() to write len bytes from the memory starting at buffer to the file descriptor in *io.
lseek() to advance the read/write position on *io's file descriptor to offset bytes from the location indicated by whence.
*io's file discriptor.
exec for now.
SEE ALSO
src/io/common.c, src/io/win32.c, src/io/stdio.c, src/io/io_private.h, include/parrot/io_unix.h.