On Sat, 29 Sep 2001, Victor Yodaiken wrote:

> On Sat, Sep 29, 2001 at 09:24:01PM -0400, Calin A. Culianu wrote:
> >
> >
> > On Fri, 28 Sep 2001, Victor Yodaiken wrote:
> >
> > > You're welcome to send a patch and your tone is fine, but ...
> > >   1. Stuart is right, it's easy, just put the function in the rtl_fifos code
> >   I am not sure what you are referring to... if you are saying that
> > creating a custom function to return fifo size is easy, then yes, I agree
> > with that one.. :)
> > >   2. I hate adding functions so my question is always "why do you have to have 
>it"?
> >   Well, because.  :)  No seriously I think it's a fair feature of a fifo
> > for one to be able to query its size and/or fill.  Also, I am being
> > particularly anal with respect to my rt-task talking to userland and I
> > want to be absolutely sure that I don't have any failed and/or partial
> > writes.. the only way to really accomplish this is to have the ability to
> > query the fifo size/freeness.  I don't *absolutely* need this feature, but
>
> So you want
>       RT thread
>               if(freebytes(fifofd)>=n)write(fifofd,&b,n)
>
>       ??
>       and
>               if((i = write(fifofd,&b,n)) < n)
>               { /* do something about partial or null write */
>
>               }
>       is no good ?
>
>       and
>               // whenever user does a read, it writes to controlfifo
>               // to tell us how many bytes it read
>
>               if(read(controlfifo,&i,sizeof int) == sizeof int){
>                       fiforead +=i;
>                       }
>
>
>               if( (fifowritten - fifread) < (fifibuffersie - messagesize) )
>                       { // then we can do the write
>
>                       ....
>                       }

I personally see no drawback to this feature.. it costs nothing in terms
of code complexity (the data structures for this info are there already)
and maybe causes like 15 bytes of additional binary bloat. :) (I know,
kernel memory is so precious.. but well.. 15 bytes that can be optionally
config'd out hopefully won't kill anyone's computer too badly...)

>
>       is not nice enough, then I suggest
>
>       RTF_GETSIZE
>       as an added ioctl.
>

Adding an ioctl?  Aren't ioctl's sort of user-space-oriented things?  I
agree that it might be a nice feature for userland, but are you suggesting
this in lieu, or in addition to, my proposed functions?  Here is what I
propose in the kernel (in rt_fifo.c, to be exact).

int /* returns the total 'bufsize' of FIFO fifo, or errno on error */
rtf_size(int fifo);

int /* returns total bytes of available space in FIFO fifo, or errno */
rtf_bytesfree(int fifo);

As far as the ioctl functionality.. that's a really good suggestion.  I
can add that too.. :)

>       then send a patch with an optional config option and we'll see
>       if anyone else uses it.

Ok...  I will come up with something and send it in.. thanks!! :)

-Calin

>
>
> > if would make me happy if this feature were included.  :)
> >
> > -Calin
> >
> >
> > >
> > >
> > > On Fri, Sep 28, 2001 at 04:21:45PM -0400, Calin A. Culianu wrote:
> > > >
> > > > I realize the tone of my previous this email seems impatient.. it isn't.
> > > > Actually if you guys would honor me with your approval, I can gladly
> > > > submit a patch that defines an interface for my proposed solution (a)
> > > > below, or one that moves the struct definition of struct rtl_fifo_struct
> > > > over to the more public 'rtl_fifo.h' header file. (Since the kernel symbol
> > > > rtl_fifos is already exported).
> > > >
> > > >
> > > > Please allow me to be an rt-linux developer!! :)
> > > >
> > > > -Calin
> > > >
> > > > ---------- Forwarded message ----------
> > > > Date: Fri, 28 Sep 2001 15:35:38 -0400 (EDT)
> > > > From: Calin A. Culianu <[EMAIL PROTECTED]>
> > > > To: [EMAIL PROTECTED]
> > > > Cc: rtl <[EMAIL PROTECTED]>
> > > > Subject: RE: [rtl] number of elements in a fifo
> > > >
> > > > Well, in kernel mode there's no way to tell how full a fifo is (as of rtl
> > > > 3.1)!
> > > >
> > > > Actually, that macro only occurs in rtl_fifo.c, and furthermore, the
> > > > exported kernel symbol "rtl_fifos" that the macro really uses is of
> > > > type struct rt_fifo_struct, which is a private type inside rtl_fifo.c!
> > > >
> > > > Why is kernel symbol 'rtl_fifos' exported when its type is private?
> > > > It aggravates me!!
> > > >
> > > > Can someone on the rt-linux dev team either kindly:
> > > >
> > > > a) create a public interface to find out the size and/or the bytes free in
> > > > an rtf (this is trivial, just make a function that returns
> > > > rtl_fifos[minor].bufsize, rtl_fifos[minor].len etc).
> > > >
> > > > OR
> > > >
> > > > b) make struct rtl_fifo_struct a public struct???? (since the array of
> > > > fifos is exported into the kernel symbol table anyway).
> > > >
> > > > -Calin
> > > >
> > > > On Fri, 21 Sep 2001, stuart warren wrote:
> > > >
> > > > > To read how full the fifo is from userspace...
> > > > >
> > > > >       int bytes_in_fifo;
> > > > >       ioctl(rtfifo_fd, FIONREAD, &bytes_in_fifo);
> > > > >
> > > > > In the kernel you can use...
> > > > >
> > > > >       bytes_in_fifo = RTF_LEN(fifo_number);
> > > > >
> > > > > Cheers,
> > > > > Stuart
> > > > >
> > > > > -----Original Message-----
> > > > > From: fred august [mailto:[EMAIL PROTECTED]]
> > > > > Sent: Thursday, 20 September 2001 6:00
> > > > > To: rtl
> > > > > Subject: [rtl] number of elements in a fifo
> > > > >
> > > > >
> > > > > Hi,
> > > > >      is there a simple way to know how many elements
> > > > > are in a FIFO? This should be in RT, or almost, for a
> > > > > FIFO between a RT thread and a user space one. I need
> > > > > this information in order to dump some of the elements
> > > > > if the FIFO is too full.
> > > > >
> > > > > thanks
> > > > >
> > > > > f
> > > > >
> > > > > ______________________________________________________________________
> > > > > Do You Yahoo!?
> > > > > Il tuo indirizzo gratis e per sempre @yahoo.it su http://mail.yahoo.it
> > > > >
> > > > > -- [rtl] ---
> > > > > To unsubscribe:
> > > > > echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
> > > > > echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
> > > > > --
> > > > > For more information on Real-Time Linux see:
> > > > > http://www.rtlinux.org/
> > > > >
> > > > > -- [rtl] ---
> > > > > To unsubscribe:
> > > > > echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
> > > > > echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
> > > > > --
> > > > > For more information on Real-Time Linux see:
> > > > > http://www.rtlinux.org/
> > > > >
> > > >
> > > >
> > > > -- [rtl] ---
> > > > To unsubscribe:
> > > > echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
> > > > echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
> > > > --
> > > > For more information on Real-Time Linux see:
> > > > http://www.rtlinux.org/
> > >
> > > -- [rtl] ---
> > > To unsubscribe:
> > > echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
> > > echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
> > > --
> > > For more information on Real-Time Linux see:
> > > http://www.rtlinux.org/
> > >
> >
> > -- [rtl] ---
> > To unsubscribe:
> > echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
> > echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
> > --
> > For more information on Real-Time Linux see:
> > http://www.rtlinux.org/
> -- [rtl] ---
> To unsubscribe:
> echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
> echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
> --
> For more information on Real-Time Linux see:
> http://www.rtlinux.org/
>

-- [rtl] ---
To unsubscribe:
echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
--
For more information on Real-Time Linux see:
http://www.rtlinux.org/

Reply via email to