This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: bsd_write() returns EINVAL


Please copy your responses to the eCos discussion list.

On Fri, 2003-01-03 at 08:58, Roland Caßebohm wrote:
> On Freitag, 3. Januar 2003 16:49, Gary D. Thomas wrote:
> > On Fri, 2003-01-03 at 08:42, Roland Caßebohm wrote:
> > > Hi,
> > >
> > > I'm using the OpenBSD stack.
> > >
> > > I have the following problem:
> > > The write() function returns EINVAL, if the TCP connection is close from
> > > the client.
> > > Is this right?
> >
> > What would you have it return?  Note that this value (EINVAL) is
> > unchanged from what the actual BSD code uses (in other words, I
> > didn't change it for eCos).
> 
> Oh, I mean errno is EINVAL.
> I thought if the connection is lost, write() would returns 0 or errno is EPIPE 
> or ECONNRESET.
> 

Possibly ECONNRESET is more correct here.  I didn't change it, just to
remain compatible with the stack (as it might be used elsewhere).

If it's important to you, please send a patch along with a ChangeLog
entry for this change.

> >
> > Also note that the new stack (the FreeBSD one) handles this differently.
> >
> > > The following code in tcp_usrreq() generates the error:
> > >
> > >         inp = sotoinpcb(so);
> > >         /*
> > >          * When a TCP is attached to a socket, then there will be
> > >          * a (struct inpcb) pointed at by the socket, and this
> > >          * structure will point at a subsidary (struct tcpcb).
> > >          */
> > >         if (inp == 0 && req != PRU_ATTACH) {
> > >                 splx(s);
> > >                 /*
> > >                  * The following corrects an mbuf leak under rare
> > >                  * circumstances
> > >                  */
> > >                 if (m && (req == PRU_SEND || req == PRU_SENDOOB))
> > >                         m_freem(m);
> > >                 return (EINVAL);                /* XXX */
> > >         }
> 
> Maybe it's time for me to choose th FreeBSD stack, but it seems, that the snmp 
> package will not compile:
> 
> In file included from 
> /home/cassebohm/Devel/vscs/vscs/vs_osal_ecos_i386/ecos_arm_install/include/ucd-snmp/system.h:196,
>                  from 
> /home/cassebohm/Devel/vscs/vscs/vs_osal_ecos_i386/ecos_arm_install/include/ucd-snmp/config.h:1253,
>                  from 
> /opt/ecos/ecos-2.0_XXX/ecc/net/snmp/agent/current/src/agent_read_config.c:96:
> /home/cassebohm/Devel/vscs/vscs/vs_osal_ecos_i386/ecos_arm_install/include/sys/time.h:233: 
> parse error before `__P'
> /home/cassebohm/Devel/vscs/vscs/vs_osal_ecos_i386/ecos_arm_install/include/sys/time.h:234: 
> parse error before `__P'
> /home/cassebohm/Devel/vscs/vscs/vs_osal_ecos_i386/ecos_arm_install/include/sys/time.h:235: 
> parse error before `__P'
> /home/cassebohm/Devel/vscs/vscs/vs_osal_ecos_i386/ecos_arm_install/include/sys/time.h:236: 
> parse error before `__P'
> 

Indeed, the new stack is not yet compatible with the SNMP package.

-- 
.--------------------------------------------------------.
|       Mind: Embedded Linux and eCos Development        |
|--------------------------------------------------------|
| Gary Thomas              email:  gary.thomas@mind.be   |
| Mind ( http://mind.be )  tel:    +1 (970) 229-1963     |
| gpg: http://www.chez-thomas.org/gary/gpg_key.asc       |
'--------------------------------------------------------'


--
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]