Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

solaris/SUNos problem

0 views
Skip to first unread message

roger day

unread,
Sep 7, 1999, 3:00:00 AM9/7/99
to
I have a simple piece of code which works on SunOS 4.1.* but not on Solaris.

#include <sys/types.h>
#include <sys/time.h>
#include <stdio.h>
struct timeval *timeout;
main() {
int n;
fd_set rfds;
fd_set wfds;
fd_set efds;
FD_ZERO(&rfds);
FD_ZERO(&wfds);
FD_ZERO(&efds);
FD_SET(0, &rfds);

n= select(sizeof(rfds), &rfds, &wfds, &efds, timeout);
}

(apologies for the C - it's been a long time :-)

I compile program on both SunOS and Solaris with gcc 2.7.2,
then run using the command line:

a.out </dev/null

On Solaris, it hangs. On SunOS it passes straight through.

The latest patches have been applied to the Solaris box I've been testing on.

Roger.

roger day

unread,
Sep 7, 1999, 3:00:00 AM9/7/99
to

I forgot to say: is there a fix/work-around for this?

Roger.

Casper H.S. Dik - Network Security Engineer

unread,
Sep 7, 1999, 3:00:00 AM9/7/99
to
[[ PLEASE DON'T SEND ME EMAIL COPIES OF POSTINGS ]]

rd...@harlequin.co.uk (roger day) writes:

>I have a simple piece of code which works on SunOS 4.1.* but not on Solaris.

Yes, select/poll on /dev/null is broken in Solaris 2.x.

>#include <sys/types.h>
>#include <sys/time.h>
>#include <stdio.h>
>struct timeval *timeout;

>main() {
>int n;
>fd_set rfds;
>fd_set wfds;
>fd_set efds;
>FD_ZERO(&rfds);
>FD_ZERO(&wfds);
>FD_ZERO(&efds);
>FD_SET(0, &rfds);

>n= select(sizeof(rfds), &rfds, &wfds, &efds, timeout);


Your code is broken too, though; you pass timeout which is initialized
as (struct timeval 0); the first argument uses sizeof(rfds); that's its
size in bytes, but you want its size in bits (which is FD_SETSIZE)

>I compile program on both SunOS and Solaris with gcc 2.7.2,
>then run using the command line:

>a.out </dev/null

>On Solaris, it hangs. On SunOS it passes straight through.


Yes, select() on /dev/null is broken; it will hang until the timeout
expires. (Fixed in Solaris 8, bug #1171830 which was inappropriately closed
as "fixed" hence it was dropped on the floor until rediscovered during S8
work)

Casper
--
Expressed in this posting are my opinions. They are in no way related
to opinions held by my employer, Sun Microsystems.
Statements on Sun products included here are not gospel and may
be fiction rather than truth.

roger day

unread,
Sep 7, 1999, 3:00:00 AM9/7/99
to
In article <casper.9...@uk-usenet.uk.sun.com>, Caspe...@Holland.Sun.Com (Casper H.S. Dik - Network Security Engineer) says:
>
>[[ PLEASE DON'T SEND ME EMAIL COPIES OF POSTINGS ]]

>Yes, select() on /dev/null is broken; it will hang until the timeout


>expires. (Fixed in Solaris 8, bug #1171830 which was inappropriately closed
>as "fixed" hence it was dropped on the floor until rediscovered during S8
>work)
>
>Casper

Many thanks for a quick response.

Roger.

0 new messages