1

I am working on a problem where a certain file must be placed on a tmpfs and not on a regular filesystem (such as ext4, xfs etc.) The background for the requirement is that the file will be used for shared memory mapping to which DMA will be made, and regular Linux filesystems do not support this situation, causing data corruptions or even kernel panics.

The software will be deployed on various Linux x86_64 configurations, possibly multiple distributions. Instead of requiring the users to create and provide a dedicated tmpfs mountpoint (one more configuration step for them to remember about), I am considering to put the aforementioned file on /dev/shm, which is already a tmpfs used to implement POSIX shared memory.

One doubt I have with it is that presence and properties of this mountpoint may be an implementation detail, not a requirement of any standard that GNU/Linux adheres to.

In other words, there might be distributions that do not have /dev/shm but still are considered compliant. If that is true, then I will not be able to assume/require the /dev/shm presence.

What is the case here? Does any part of POSIX, SUS or any other standard say anything about the subject?

Grigory Rechistov
  • 2,104
  • 16
  • 25
  • Soooo have you searched the POSIX and SUS standards for "shm"? – KamilCuk May 16 '23 at 09:10
  • @KamilCuk not sure if all of POSIX/SUS is in the open access (many standards are not freely available), but I will do that. But the question is more about whether there are any other documents that might be in force for a narrow subset of computing systems that run Linux. E.g., I am sure that in an embedded system one can compile kernel without support of TMPFS, or any filesystem to that matter. This is not what I am looking for. Maybe I should also look at [FHS](https://en.wikipedia.org/wiki/Filesystem_Hierarchy_Standard) – Grigory Rechistov May 16 '23 at 09:45

0 Answers0