[comp.unix.questions] "system" call to find out if there is data to be read.

adb@elrond.CalComp.COM (Alan D. Brunelle) (03/04/88)

    I am looking for information regarding simulation of the BSD "select"
    system call on a Motorola SysV Delta box.  The OS has some of the
    BSD extensions (sans the select, and the ioctl(FIONREAD)). 
    Here is what I would like to do (sort of ...):

	/*
	 * Cause SIGIO on any input from any of my sockets
	 */
	foreach (socket connection) do
	    fcntl(socket, F_SETOWN, pid);

	/*
	 * Now sit and wait for the Input
	 */
	old_mask = sigblock( sigmask(SIGIO) );
	sigpause(0);

	/* 
	 * Have signal, now see which socket(s) it applies to
	 */
	foreach (socket connection) do
	    if (socket has outstanding data)
		add socket to set of sockets with input

	sigsetmask(old_mask);

	return set of sockets with input outstanding

    Now what I need to know is how to do 
	if (socket has outstanding data)
    in a System V box that doesn't have the ioctl(FIONREAD).

    Any help would be appreciated.

    Thanks
    al

/-----------------------------------------------------------------------\
| Alan D. Brunelle   (adb@elrond.CalComp.COM)  (603) 885-8145           |
| Calcomp (A Lockheed Company)         Display Products Division	|
| PTP2-2D02 Hudson NH 03051-0908     "We draw on your imagination" (tm) |
\-----------------------------------------------------------------------/