Submission for comp-unix-ultrix

Chris Torek chris at mimsy.UUCP
Fri Feb 5 05:26:53 AEST 1988


In article <20344 at felix.UUCP> jdp at adiron.UUCP (Powell) writes:
-I don't remember this bug being reported before so here goes:
-
-ULTRIX 1.2 is semi-4.2BSD compatible but 4.2BSD will not exhibit
-this bug:

The bug is in the program that attempts to demonstrate the bug,
not in the kernel.  (jdp seems to know that, but his posting may
be unclear to others.)

-readfd = (1 << 3);
-if (select(getdtablesize(),&readfd,0,0,0) < 0)
-	fprintf(stderr,"Error in select %d\n",errno);
-else
-	fprintf(stderr,"select ok\n");

-The second time and probably all remaining times that select is called,
-it will fail with the error number corresponding to invalid file descriptor.

-Replace the getdtablesize() with the expression (8 * sizeof readfd) for
-portability.

s/portability/correctness/: `8*sizeof(readfd)' assumes that the type
`char' is eight bits wide.  Better yet, borrow the fd_set type and
FD_xxx macros from a 4.3BSD <sys/types.h> (which is what DEC should
have done).

-...getdtablesize() and NOFILE under standard ULTRIX 1.2 are greater
-than 32 (namely 64).  The readfd parameter is a 32-bit value so it
-can never tell select() to poll file descriptors 32 - 63 but
-apparently select() is looking for advice about all 64 descriptors
-because you told it to.  Shame on you :-)

Right.
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163)
Domain:	chris at mimsy.umd.edu	Path:	uunet!mimsy!chris



More information about the Comp.unix.ultrix mailing list