* Fw: select(2)
@ 2001-08-03 20:34 Brad Bonkoski
2001-08-04 1:42 ` Matti Aarnio
0 siblings, 1 reply; 2+ messages in thread
From: Brad Bonkoski @ 2001-08-03 20:34 UTC (permalink / raw)
To: lkml
----- Original Message -----
From: "Brad Bonkoski" <bbonkoski@xyterra.com>
To: <redhat-list@redhat.com>
Sent: Friday, August 03, 2001 10:15 AM
Subject: select(2)
> Hello,
>
> this code:
> fd_set set;
> struct timeval timeout;
> int len_inet;
> int n;
> FD_ZERO(&set);
> timeout.tv_sec = 1L;
> FD_SET(sc_sock,&set);
> n = select(sc_sock+1, &set, NULL, NULL, &timeout);
> if (n == -1)
>
> perror("select()\n");
> exit(1);
> }
>
> Works just fine on one machine, i.e. select() does not return a '-1' which
lets it run through the rest of the code. However, on other machines, it
does not work fine, -1 is always returned by select() with error of: Invalid
arguement
>
> Any ideas on where I could look to fix this problem? Something in the
syntax of the posted code, or should I be looking at the creation of the
socket?
> TIA.
> Brad
>
>
>
>
>
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: Fw: select(2)
2001-08-03 20:34 Fw: select(2) Brad Bonkoski
@ 2001-08-04 1:42 ` Matti Aarnio
0 siblings, 0 replies; 2+ messages in thread
From: Matti Aarnio @ 2001-08-04 1:42 UTC (permalink / raw)
To: Brad Bonkoski; +Cc: lkml
On Fri, Aug 03, 2001 at 01:34:34PM -0700, Brad Bonkoski wrote:
> > Hello,
> >
> > this code:
> > fd_set set;
> > struct timeval timeout;
> > int len_inet;
> > int n;
> > FD_ZERO(&set);
> > timeout.tv_sec = 1L;
I would venture a guess that as you don't EXPLICITELY
initialize the timeout.tv_usec value to be
within 0 to 999999 it may get some system dependent
sometimes random, sometimes fixed value (the joys of these
stack-allocated "automatic" variables..)
For short: Smells of UNINITIALIZED PARAMETER DATA.
> > FD_SET(sc_sock,&set);
> > n = select(sc_sock+1, &set, NULL, NULL, &timeout);
> > if (n == -1)
> >
>
> > perror("select()\n");
> > exit(1);
> > }
> >
> > Works just fine on one machine, i.e. select() does not return a '-1' which
> lets it run through the rest of the code. However, on other machines, it
> does not work fine, -1 is always returned by select() with error of: Invalid
> arguement
> >
> > Any ideas on where I could look to fix this problem? Something in the
> syntax of the posted code, or should I be looking at the creation of the
> socket?
> > TIA.
> > Brad
> >
> >
> >
> >
> >
>
>
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2001-08-04 1:42 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-08-03 20:34 Fw: select(2) Brad Bonkoski
2001-08-04 1:42 ` Matti Aarnio
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox