title: POSIX shared memory + directories
body: <p>The OS I'm working on (IBM CNK, which is not Linux, but somewhat POSIX-compliant) doesn't allow me to simply create a new file or directory in /dev/shm using fopen() or mkdir(), respectively. It looks like I have to use shm_open() to get a file descriptor and then fdopen() to use the shared region for file I/O.</p>
  
  <ul>
  <li><p>Do I need to set the size of the shared region using ftruncate(), or does it grow automatically? I've tried it and I can simply fprintf into the region and it works, but is it safe?
  The manpage only says:</p>
  
  <blockquote>
    <p>A new shared memory object initially has zero length  —  the
                     size of the object can be set using ftruncate(2).  The newly
                    allocated bytes of a shared memory object are  automatically
                  initialized to 0.</p>
  </blockquote></li>
  <li><p>Do I want to mmap() the region? I simply want to have a directory with files in it in memory.</p></li>
  <li><p>How would I create a new directory in /dev/shm? Is this "work with /dev/shm as if it was a normal filesystem" a new thing? Are directories in /dev/shm maybe not standard?</p></li>
  </ul>