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
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
PMC *Parrot_io_socket_unix
Uses socket() to create a socket with the specified address family, socket type and protocol number.
INTVAL Parrot_io_connect_unix
Connects *io's socket to address *r.
INTVAL Parrot_io_bind_unix
Binds *io's socket to the local address and port specified by *l.
INTVAL Parrot_io_listen_unix
Listen for new connections. This is only applicable to STREAM or SEQ sockets.
ParrotIO *Parrot_io_accept_unix
Accept a new connection and return a newly created ParrotIO socket.
INTVAL Parrot_io_send_unix
Send the message *s to *io's connected socket.
INTVAL Parrot_io_recv_unix
Receives a message in **s from *io's connected socket.
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 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.