All of lore.kernel.org
 help / color / mirror / Atom feed
From: Philippe Gerum <rpm@xenomai.org>
To: Dmitry Adamushko <dmitry.adamushko@domain.hid>
Cc: xenomai@xenomai.org
Subject: Re: [Xenomai-help] pipe fun
Date: Mon, 21 Nov 2005 19:28:54 +0100	[thread overview]
Message-ID: <438211E6.1070905@domain.hid> (raw)
In-Reply-To: <OF9B0F824D.7587E331-ONC12570C0.00465803-C12570C0.0047036C@datacon.at>

Dmitry Adamushko wrote:
> Philippe Gerum <rpm@xenomai.org> wrote on 21.11.2005 13:36:41:
> 
>  > Dmitry Adamushko wrote:
>  > > Ignacio García Pérez <iggarpe@domain.hid> wrote on 21.11.2005 12:24:57:
>  > >
>  > >  > Dmitry Adamushko wrote:
>  > >  >
>  > >  > >            /* Return buffer is too small - message is lost. */
>  > >  > >            ret = -ENOSPC; <---- That's the error you are getting.
>  > >  > >
>  > >  > Maybe "No space left on device" is a bit misleading. Wouldn't 
> ENOMEM fit
>  > >  > better? (or event EINVAL)
>  > >  >
>  > >
>  > > Actually, looking now at the linux sources, -ENOSPC is used for
>  > > describing the same reason (buffer is not big enough) in some places;
>  > > although there is, at least, one more value -ENOBUFS that's used 
> for the
>  > > same reason.
>  > >
>  > > #define ENOSPC          28      /* No space left on device */
>  > > #define ENOBUFS         105     /* No buffer space available */
>  > >
>  > > So it looks like both may be used in the same context but, I guess, a
>  > > definition of -ENOBUFS is less confusing.
>  > >
>  > >
>  >
>  > Let's fix this.
>  >
> 
> Enclosed.
> 

Applied, thanks.

> One more thing about xnpipe_read() though.
> 
> 
> ...
>            }
>        else
>            /* Return buffer is too small - message is lost. */
>            ret = -ENOBUFS;
> 
> So the message is lost in such a case. We may easily avoid that by 
> making a proper check of the size when we are still in the locked 
> section and putting the message back into the queue (prependq() of 
> course). I think that would be more sane.
>

Problem is that if nobody ends up reading the message because the 
application always passes invalid args, internal heap memory may be 
exhausted due to unread messages.

> 
>  > --
>  >
>  > Philippe.
> 
> ---
> Best regards,
> Dmitry
> 
> /(See attached file: pipe-ENOBUFS.patch)//(See attached file: 
> ChangeLog.patch)/
> 


-- 

Philippe.


      reply	other threads:[~2005-11-21 18:28 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-21 10:11 [Xenomai-help] pipe fun Ignacio García Pérez
2005-11-21 10:44 ` Dmitry Adamushko
2005-11-21 11:24   ` Ignacio García Pérez
2005-11-21 12:11     ` Dmitry Adamushko
2005-11-21 12:36       ` Philippe Gerum
2005-11-21 12:55         ` Dmitry Adamushko
2005-11-21 18:28           ` Philippe Gerum [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=438211E6.1070905@domain.hid \
    --to=rpm@xenomai.org \
    --cc=dmitry.adamushko@domain.hid \
    --cc=xenomai@xenomai.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.