public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* [ECOS] Misguided error code in net code?
@ 2001-07-19 15:40 Trenton D. Adams
  2001-07-19 16:11 ` Gary Thomas
  0 siblings, 1 reply; 8+ messages in thread
From: Trenton D. Adams @ 2001-07-19 15:40 UTC (permalink / raw)
  To: 'eCos mailing list'

I just ran a test sending a big string from eCos over the network.  My
one end terminated prematurely because I forgot to put in a loop because
my buffer is only 8K.  Anyhow, on the eCos end I got an error of 22
(EINVAL) from send.  I could be wrong, but this seems like a pretty
weird error when the other end drops the connection.  I would have
expected ECONNRESET.

I'd go looking through the code myself for the problem, if in fact it is
a problem, but I don't have time at this point and I figured since some
of you people know the code better than I do, someone else could find it
in a matter of minutes.

Trenton D. Adams
Embedded Developer
Windows Developer
Extreme Engineering Ltd.
Calgary Alberta.



^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: [ECOS] Misguided error code in net code?
  2001-07-19 15:40 [ECOS] Misguided error code in net code? Trenton D. Adams
@ 2001-07-19 16:11 ` Gary Thomas
  2001-07-19 19:54   ` Jonathan Larmour
  2001-07-20  7:32   ` Trenton D. Adams
  0 siblings, 2 replies; 8+ messages in thread
From: Gary Thomas @ 2001-07-19 16:11 UTC (permalink / raw)
  To: Trenton D. Adams; +Cc: eCos mailing list

On 19-Jul-2001 Trenton D. Adams wrote:
> I just ran a test sending a big string from eCos over the network.  My
> one end terminated prematurely because I forgot to put in a loop because
> my buffer is only 8K.  Anyhow, on the eCos end I got an error of 22
> (EINVAL) from send.  I could be wrong, but this seems like a pretty
> weird error when the other end drops the connection.  I would have
> expected ECONNRESET.
> 

I disagree - your request sounds pretty "invalid" to me.

Honestly, most of this stuff (like what errors get returned when) come
from the standard BSD stack we're using - code that's been out there for
twenty years.  (The numeric values may be different, but the codes the same)

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [ECOS] Misguided error code in net code?
  2001-07-19 16:11 ` Gary Thomas
@ 2001-07-19 19:54   ` Jonathan Larmour
  2001-07-20  7:37     ` Trenton D. Adams
  2001-07-20  7:32   ` Trenton D. Adams
  1 sibling, 1 reply; 8+ messages in thread
From: Jonathan Larmour @ 2001-07-19 19:54 UTC (permalink / raw)
  To: Gary Thomas; +Cc: Trenton D. Adams, eCos mailing list

Gary Thomas wrote:
> 
> On 19-Jul-2001 Trenton D. Adams wrote:
> > I just ran a test sending a big string from eCos over the network.  My
> > one end terminated prematurely because I forgot to put in a loop because
> > my buffer is only 8K.  Anyhow, on the eCos end I got an error of 22
> > (EINVAL) from send.  I could be wrong, but this seems like a pretty
> > weird error when the other end drops the connection.  I would have
> > expected ECONNRESET.
> >
> 
> I disagree - your request sounds pretty "invalid" to me.
> 
> Honestly, most of this stuff (like what errors get returned when) come
> from the standard BSD stack we're using - code that's been out there for
> twenty years.  (The numeric values may be different, but the codes the same)

While that's true, the world moves on, and the upcoming update to POSIX
1003.1 now says it should return EPIPE (or possibly ECONNRESET). After a
brief look, it's probably returning EINVAL at line 228 of
sys/netinet/tcp_usrreq.c but I don't know for sure. Even so, I couldn't be
sure that changing that to ECONNRESET is appropriate because I wouldn't
know what other circumstances could cause this to happen. Trenton, if
you're sufficiently bothered, feel free to investigate.

Jifl
-- 
Red Hat, Rustat House, Clifton Road, Cambridge, UK. Tel: +44 (1223) 271062
Maybe this world is another planet's Hell -Aldous Huxley || Opinions==mine
Come to the Red Hat TechWorld open source conference in Brussels!
Keynotes, techie talks and exhibitions    http://www.redhat-techworld.com/

^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: [ECOS] Misguided error code in net code?
  2001-07-19 16:11 ` Gary Thomas
  2001-07-19 19:54   ` Jonathan Larmour
@ 2001-07-20  7:32   ` Trenton D. Adams
  1 sibling, 0 replies; 8+ messages in thread
From: Trenton D. Adams @ 2001-07-20  7:32 UTC (permalink / raw)
  To: 'Gary Thomas'; +Cc: 'eCos mailing list'

  > 
  > 
  > On 19-Jul-2001 Trenton D. Adams wrote:
  > > I just ran a test sending a big string from eCos over the network.
My
  > > one end terminated prematurely because I forgot to put in a loop
  > because
  > > my buffer is only 8K.  Anyhow, on the eCos end I got an error of
22
  > > (EINVAL) from send.  I could be wrong, but this seems like a
pretty
  > > weird error when the other end drops the connection.  I would have
  > > expected ECONNRESET.
  > >
  > 
  > I disagree - your request sounds pretty "invalid" to me.
  > 
  > Honestly, most of this stuff (like what errors get returned when)
come
  > from the standard BSD stack we're using - code that's been out there
for
  > twenty years.  (The numeric values may be different, but the codes
the
  > same)

Although the code may have been around for twenty years, it doesn't make
it right.  Heck, it may even work.  This is very similar to PC BIOS disk
error codes.  There is in fact a valid error of "printer out of paper"
for a disk failure.  And, I have in fact had that error occur when doing
a disk operation.  That doesn't mean that "printer out of paper" is in
fact a really good choice of error codes for disks.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: [ECOS] Misguided error code in net code?
  2001-07-19 19:54   ` Jonathan Larmour
@ 2001-07-20  7:37     ` Trenton D. Adams
  2001-07-20  7:43       ` Jonathan Larmour
  0 siblings, 1 reply; 8+ messages in thread
From: Trenton D. Adams @ 2001-07-20  7:37 UTC (permalink / raw)
  To: 'Jonathan Larmour', 'Gary Thomas'
  Cc: 'eCos mailing list'

  > 
  > Gary Thomas wrote:
  > >
  > > On 19-Jul-2001 Trenton D. Adams wrote:
  > > > I just ran a test sending a big string from eCos over the
network.
  > My
  > > > one end terminated prematurely because I forgot to put in a loop
  > because
  > > > my buffer is only 8K.  Anyhow, on the eCos end I got an error of
22
  > > > (EINVAL) from send.  I could be wrong, but this seems like a
pretty
  > > > weird error when the other end drops the connection.  I would
have
  > > > expected ECONNRESET.
  > > >
  > >
  > > I disagree - your request sounds pretty "invalid" to me.
  > >
  > > Honestly, most of this stuff (like what errors get returned when)
come
  > > from the standard BSD stack we're using - code that's been out
there
  > for
  > > twenty years.  (The numeric values may be different, but the codes
the
  > same)
  > 
  > While that's true, the world moves on, and the upcoming update to
POSIX
  > 1003.1 now says it should return EPIPE (or possibly ECONNRESET).
After a
  > brief look, it's probably returning EINVAL at line 228 of
  > sys/netinet/tcp_usrreq.c but I don't know for sure. Even so, I
couldn't
  > be
  > sure that changing that to ECONNRESET is appropriate because I
wouldn't
  > know what other circumstances could cause this to happen. Trenton,
if
  > you're sufficiently bothered, feel free to investigate.
  > 

I might just do that if I have problems in the future with it when I get
down to actually writing some real net code.  The thing I find weird, is
how you supposed to tell if a connection has been reset?  I suppose I
could go over to the other system and see if it disconnected, but that's
just a work around.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [ECOS] Misguided error code in net code?
  2001-07-20  7:37     ` Trenton D. Adams
@ 2001-07-20  7:43       ` Jonathan Larmour
  2001-07-20  8:06         ` Trenton D. Adams
  0 siblings, 1 reply; 8+ messages in thread
From: Jonathan Larmour @ 2001-07-20  7:43 UTC (permalink / raw)
  To: Trenton D. Adams; +Cc: 'eCos mailing list'

"Trenton D. Adams" wrote:
> 
> I might just do that if I have problems in the future with it when I get
> down to actually writing some real net code.  The thing I find weird, is
> how you supposed to tell if a connection has been reset?  I suppose I
> could go over to the other system and see if it disconnected, but that's
> just a work around.

You could use select() or possibly write() may give different answers.

Jifl
-- 
Red Hat, Rustat House, Clifton Road, Cambridge, UK. Tel: +44 (1223) 271062
Maybe this world is another planet's Hell -Aldous Huxley || Opinions==mine
Come to the Red Hat TechWorld open source conference in Brussels!
Keynotes, techie talks and exhibitions    http://www.redhat-techworld.com/

^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: [ECOS] Misguided error code in net code?
  2001-07-20  7:43       ` Jonathan Larmour
@ 2001-07-20  8:06         ` Trenton D. Adams
  2001-07-20  8:14           ` Jonathan Larmour
  0 siblings, 1 reply; 8+ messages in thread
From: Trenton D. Adams @ 2001-07-20  8:06 UTC (permalink / raw)
  To: 'Jonathan Larmour'; +Cc: 'eCos mailing list'

  > 
  > "Trenton D. Adams" wrote:
  > >
  > > I might just do that if I have problems in the future with it when
I
  > get
  > > down to actually writing some real net code.  The thing I find
weird,
  > is
  > > how you supposed to tell if a connection has been reset?  I
suppose I
  > > could go over to the other system and see if it disconnected, but
  > that's
  > > just a work around.
  > 
  > You could use select() or possibly write() may give different
answers.
  > 

I just used write (), and it returns 360 ETIMEDOUT.  This is slightly
better.  I (me alone ;) ) would expect that an ETIMEDOUT error should
only occur when the connection is still there but there is no response
from the other end.

When this happens on Linux or windows though, I do actually get a
ECONNRESET.  I'm not positive about the Linux side, but windows
definitely does.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [ECOS] Misguided error code in net code?
  2001-07-20  8:06         ` Trenton D. Adams
@ 2001-07-20  8:14           ` Jonathan Larmour
  0 siblings, 0 replies; 8+ messages in thread
From: Jonathan Larmour @ 2001-07-20  8:14 UTC (permalink / raw)
  To: Trenton D. Adams; +Cc: 'eCos mailing list'

"Trenton D. Adams" wrote:
> 
> When this happens on Linux or windows though, I do actually get a
> ECONNRESET.  I'm not positive about the Linux side, but windows
> definitely does.

Linux should give you an EPIPE because it's tracking the upcoming 1003.1
update. And probably send you a SIGPIPE signal.

Jifl
-- 
Red Hat, Rustat House, Clifton Road, Cambridge, UK. Tel: +44 (1223) 271062
Maybe this world is another planet's Hell -Aldous Huxley || Opinions==mine
Come to the Red Hat TechWorld open source conference in Brussels!
Keynotes, techie talks and exhibitions    http://www.redhat-techworld.com/

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2001-07-20  8:14 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-07-19 15:40 [ECOS] Misguided error code in net code? Trenton D. Adams
2001-07-19 16:11 ` Gary Thomas
2001-07-19 19:54   ` Jonathan Larmour
2001-07-20  7:37     ` Trenton D. Adams
2001-07-20  7:43       ` Jonathan Larmour
2001-07-20  8:06         ` Trenton D. Adams
2001-07-20  8:14           ` Jonathan Larmour
2001-07-20  7:32   ` Trenton D. Adams

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).