parrotcode: UNIX IO utility functions | |
Contents | C |
src/io/unix.c - UNIX IO utility functions
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.
APitUE - W. Richard Stevens, AT&T SFIO, Perl 5 (Nick Ing-Simmons)
static INTVAL convert_flags_to_unix
flags
suitable for passing to open()
and fopen()
in Parrot_io_open_unix()
and Parrot_io_fdopen_unix()
respectively.
INTVAL Parrot_io_init_unix
std*
IO handles.
Returns 0
on success and -1
on error.
PMC *Parrot_io_open_unix
path
.
flags
is a bitwise or
combination of PIO_F_*
flag values.
INTVAL Parrot_io_async_unix
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
FileHandle
PMC with the file descriptor passed in.
INTVAL Parrot_io_close_unix
*io
's file descriptor.
INTVAL Parrot_io_is_closed_unix
static INTVAL io_is_tty_unix
fd
is a console/tty.
INTVAL Parrot_io_getblksize_unix
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
flush
is to ask the kernel to sync()
.XXX: Is it necessary to sync()
here?
size_t Parrot_io_read_unix
read()
to return up to len
bytes in the memory starting at buffer
.
size_t Parrot_io_write_unix
write()
to write len
bytes from the memory starting at buffer
to the file descriptor in *io
.
PIOOFF_T Parrot_io_seek_unix
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
*io
's file discriptor.
PMC *Parrot_io_open_pipe_unix
exec
for now.
size_t Parrot_io_peek_unix
src/io/common.c, src/io/win32.c, src/io/stdio.c, src/io/io_private.h, include/parrot/io_unix.h.
|