Subject: select()/i386
To: None <netbsd-help@netbsd.org>
From: Patrick Welche <prlw1@newn.cam.ac.uk>
List: netbsd-help
Date: 03/30/1999 12:25:22
I was wondering if someone could give me some hints/tips debugging

Program terminated with signal 11, Segmentation fault.
#0  0x16235 in select ()

This is actually in postgresql, fe-misc.c, pqWait():

        fd_set          input_mask;
        fd_set          output_mask;
...
                FD_ZERO(&input_mask);
                FD_ZERO(&output_mask);
                if (forRead)
                        FD_SET(conn->sock, &input_mask);
                if (forWrite)
                        FD_SET(conn->sock, &output_mask);
                if (select(conn->sock + 1, &input_mask, &output_mask,
                	(fd_set *) NULL, (struct timeval *) NULL) < 0)

Now, conn->sock=7, forRead=1, forWrite=0,
input_mask ={fds_bits = {128, 0, 0, 0, 0, 0, 0, 0}}
output_mask={fds_bits = {  0, 0, 0, 0, 0, 0, 0, 0}}

So, all seems OK, so why the segfault? The only reference to select() I can
find is a declaration in src/lib/libc/obj/LintSysNormal.c, so I don't know
where to UTSL. From the sun os 6.5 man page, there is a suggestion that
maybe &output_mask=(fd_set *)NULL might be handled differently to an
output_mask set to zero - is this the case?

Cheers,

Patrick