POSIXFIFOs
From RTEMSWiki
RTEMS does not currently support POSIX named FIFOs or unnamed pipes. It does support most of the filesystem and system call infrastructure for FIFOs but the lowest levels are not there yet. For pipes, the details would be similar but we would have to figure out how to treat them as unnamed to the user while accessing the same infrastructure. This page describes what is required technically to implement them.
References
Existing Infrastructure
The call tree for FIFOs is as follows:
mkfifo()
mknod( path, mode | S_IFIFO, 0LL );
indirect call to filesystem specific mknod_h entry point
In RTEMS, POSIX FIFOs would be supported by the In Memory File System (IMFS). The mknod_h handler in cpukit/libfs/src/imfs/imfs_mknod.c currently does not recognize the S_IFIFO argument and returns an error when an attempt is made to create one.
Implementation Thoughts
The IMFS will have to be augmented to support a file of type FIFO. A set of file type specific handlers will have to be implemented and appropriate support added in various filesystem handlers.
The IMFS mknod handler will have to be augmented to recognize the S_IFIFO argument and invoke some specific FIFO create handler.
It is expected that the underlying implementation will be a protected ring buffer similar to those found in OS text books as examples of the Producer/Consumer problem. In keeping with spirit of the RTEMS design, this code should be general enough to be potentially promoted through other APIs. The protected ring buffer could be implemented in terms of POSIX mutexes and condition variables but this would limit the FIFO implementation to RTEMS configurations with POSIX thread support enabled. So it would generally be better to implement it in terms of Classic API objects or as a direct SuperCore object.
If the decision is made to implement it in terms of Classic API objects, then it is possible that the buffering code in the RTEMS termios implementation could be refactored and extracted and provide the foundation for all of these services. This may not be possible if the termios buffering is interwoven with canonical input processing and termios synchronization. If this is possible, it would be desirable since it would reduce the footprint of an RTEMS application using both FIFOs and termios code.
For unnamed pipes, we could create a named FIFO using a temporary name. We hide the underlying name from the user and place them possibly in a special directory.
