🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

2 total messages Started by Phil Howard Thu, 27 Aug 1992 23:55
asyncronous I/O notification in POSIX: a question
#247
Author: Phil Howard
Date: Thu, 27 Aug 1992 23:55
35 lines
2120 bytes
Submitted-by: pdh@netcom.com (Phil Howard )

I read in "POSIX PROGRAMMER'S GUIDE - Writing Portable UNIX Programs", by
Donald Lewine (O'Reilly & Associates, publisher)...

...that POSIX has a macro flag called O_NONBLOCK, which can be used in
open() and in fcntl() to effect asyncronous I/O.  I also read that the
read() and write() functions will return an error with the EAGAIN value
in "errno" ifn the attempted I/O would block the process to complete that
function call.

What I cannot find or cannot figure out is how the process that has
received the EAGAIN code from one of these functions is going to be
able to be notified of the fact that I/O is now completeable when that
condition exists, and how it can find out which file descriptor(s) has
the I/O ready (of probably 2 or more in cases where the benefit of the
asyncronous I/O is helpful).

The mechanism I use in BSD is the select() function.

I don't have access to a POSIX conformant system at the present time,
but I would like to design new programs I write so that are "POSIX ready"
as much as I can do it, so that the effort to port them to POSIX is
trivial (hopefully).

Can anyone fill me in on how this is done?  If you think it is best to
send me e-mail directly, send it to: pdh@netcom.com.  Thanks.
-- 
/***********************************************************************\
| Phil Howard  ---  KA9WGN  ---  pdh@netcom.com   |   "The problem with |
| depending on government is that you cannot depend on it" - Tony Brown |
\***********************************************************************/


Volume-Number: Volume 29, Number 14
Re: asyncronous I/O notification in POSIX: a question
#248
Author: Chuck Karish
Date: Fri, 28 Aug 1992 01:05
30 lines
1618 bytes
Submitted-by: karish@pangea.stanford.edu (Chuck Karish)

In article <17jq1lINN7gc@ftp.UU.NET> pdh@netcom.com (Phil Howard ) writes:

>What I cannot find or cannot figure out is how the process that has
>received the EAGAIN code from [a non-blocking read() or write()] is
>going to be
>able to be notified of the fact that I/O is now completeable when that
>condition exists, and how it can find out which file descriptor(s) has
>the I/O ready (of probably 2 or more in cases where the benefit of the
>asyncronous I/O is helpful).
>
>The mechanism I use in BSD is the select() function.

The description of [EAGAIN] in POSIX.1 is:

    [EAGAIN] Resource temporarily unavailable
             This is a temporaty condition, and later calls to
             the same routine may complete normally.

The portable way to find out whether the resource has become
available (modem connection completed, data ready, memory available,
etc.) is to wait a while, then try again.
--

    Chuck Karish          karish@mindcraft.com
    (415) 323-9000 x117   karish@forel.stanford.edu


Volume-Number: Volume 29, Number 15
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads