hp-ux 7.0/800 select() strangeness?

Staffan Bergstrom staffan at isy.liu.se
Mon Sep 3 23:59:20 AEST 1990


MAH at awiwuw11.wu-wien.ac.at (Michael Haberler) writes:

>I have encountered a strange behaviour of several programs which use
>select(2) on hp-ux 7.0 on the Series 800. All of these programs are
>'ported' BSD code, so I have the suspicion there's something in common:

>It seems that programs which have select(2) in their inner loop sometimes
>start using enormous amounts of system cpu time, just as if the select()
>call would return immediately as if it were polling. Among those programs
>are Xemacs 18.55, Greg Minshall's tn3270, and named4.8.3.

-
-
-

>Has anybody else encountered this behaviour? Is this a bug? If so, is there
>a workaround?

>- michael

I have had similar problems but it turned out to be the macros
FD_SET, FD_CLR etc, that was the cause of the problem. 
FD_SET is defined as follows.
#define FD_SET(n, p)    ((p)->fds_bits[(n)/NFDBITS] |= (1 << ((n) % NFDBITS)))
One has to be carful when using them on closed files otherwise 
it could cause an atempt to do a negative shift.
I had a program that worked fine on sun3, sun4 and hp300 (hp-ux 7.0),
but did not work at all on when I tried to port it to hp 800, because of this.

/Staffan



More information about the Comp.unix.internals mailing list