Subject: Re: select()/i386
To: David Brownlee <abs@anim.dreamworks.com>
From: Patrick Welche <prlw1@newn.cam.ac.uk>
List: netbsd-help
Date: 04/07/1999 21:41:25
David Brownlee wrote:
> 
> 	That looks perfectly sane - what arch and OS version are you
> 	using? Also, are you certain its coming from that select() call,
> 	and not one somewhere else in the program :)

NetBSD-current/i386. I just added code to print out the return value of
the select, and now

Illegal instruction (core dumped)
#0  0x1521f in _PROCEDURE_LINKAGE_TABLE_ ()
#1  0x40077dd3 in pqWait (forRead=1, forWrite=0, conn=0x19000) at fe-misc.c:569
!!
still in the select(). The target keeps moving... compiled with -g -O0...

Cheers,

Patrick

> On Tue, 30 Mar 1999, Patrick Welche wrote:
> 
> > 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
> > 
> 
>