Google SOC project POSIXFIFOs

Joel Sherrill joel.sherrill at OARcorp.com
Fri Mar 21 14:07:13 UTC 2008


Wei Shen wrote:
> Hi,
>
> On 3/20/08, *Joel Sherrill* <joel.sherrill at oarcorp.com 
> <mailto:joel.sherrill at oarcorp.com>> wrote:
>
>      Hmm... read that carefully.. it said you MIGHT be able to
>     refactor the buffering code
>      out of termios into a common ring buffer handler.  It also said
>     that it might be impossible
>      because the canonical character processing might be too intertwined.
>
>  
> I studied the termios source code today. I think it may be diffcult to 
> share buffering code between termios and pipe. Reasons are listed below:
>  
> 1) termios needs to process input characters one by one (in siproc). 
> May change, echo, or erase a charater, and check for new lines.
> 2) termios may send control characters during input/output processing, 
> and may initiate device commands.
> 3) One end of termios buffering is in RX/TX IRQ context, and 
> interrupt_disable/enable are used for synchronization.
> 4) termios maintains a set of buffer states to control buffering.
>  
> All these above are not needed by pipe, but mix with termios buffering 
> code.
>  
> On the other hand, for pipe buffering implementation:
> 1) Two counters are needed to indicate the counts of current readers 
> and writers of a pipe.
> 2) A flag (O_NONBLOCK) should be added and checked in pipe buffer 
> read/write routines.
> 3) Some kinds of atomic mechanism is needed for buffer 
> control variable access.
> 4) Sometimes, termios drops some charaters when the inbuffer is full.
>  
> So, even if refactering existing code is possible, it may not be 
> worthwhile for the complexity introduced.
> Comments are solicited.
>  
I can't help but agree.  That is the type of analysis the project needed 
to know
what was required.

Sounds like you have to:

+ write a ring buffer object
+ write FIFO system calls.
+hopefully FIFO filesystem.

I am torn between a dedicated filesystem and adding a filesystem to the
IMFS.  The dedicated filesystem makes sense and is cleaner./  If you
don't want this capability, don't mount it.

Make sure about the pipe() and mkfifo() calls.  Careful reading of the
opengroup standard may force a decision.  I hope we can get away with
the dedicated filesystem.  It sounds cleaner and easier to drop out.

--joel
> Regards,
> Wei Shen


-- 
Joel Sherrill, Ph.D.             Director of Research & Development
joel.sherrill at OARcorp.com        On-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
   Support Available             (256) 722-9985





More information about the users mailing list