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 PIO_*
macros 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
Networking
Define PARROT_NET_DEVEL
to enable networking.
These could be native extensions but they probably should be here if we wish to make them integrated with the async IO system.
Very minimal stubs for now, maybe someone will run with these.
STRING *Parrot_io_sockaddr_in
PMC *Parrot_io_socket_unix
Uses INTVAL Parrot_io_connect_unix
Connects INTVAL Parrot_io_bind_unix
Binds INTVAL Parrot_io_listen_unix
Listen for new connections.
This is only applicable to ParrotIO *Parrot_io_accept_unix
Accept a new connection and return a newly created INTVAL Parrot_io_send_unix
Send the message INTVAL Parrot_io_recv_unix
Receives a message in INTVAL Parrot_io_poll_unix
Utility function for polling a single IO stream with a timeout.Returns a 1 | 2 | 4 (read,
write,
error) value.This is not equivalent to any speficic POSIX or BSD socket call,
however it is a useful,
common primitive.Not at all usefule --leo.Also,
a buffering layer above this may choose to reimpliment by checking the read buffer.
PMC *Parrot_io_pipe_unix
Very limited
Parrot_io_sockaddr_in()
is not part of the layer and so must be extern
.XXX: We can probably just write our own routines (htons()
,
inet_aton()
,
etc.) and take this out of platform specific compilation
socket()
to create a socket with the specified address family,
socket type and protocol number.
*io
's socket to address *r
.
*io
's socket to the local address and port specified by *l
.
STREAM
or SEQ
sockets.
ParrotIO
socket.
*s
to *io
's connected socket.
**s
from *io
's connected socket.
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.