Temporary in-memory filesystem

QNX SDP8.0Building Embedded SystemsConfigurationDeveloper

You can use your buildfile to create a temporary filesystem based on shared memory objects.

QNX OS provides a simple Shared Memory Object filesystem that allows read/write files to be placed under /dev/shmem (see Shared Memory Object filesystem in the QNX OS User's Guide). You can link /dev/shmem to the /tmp directory to use it store data in temporary files.

Note:
This buildfile example provided here is useful for demonstration systems that do not have a persistent filesystem. However, it is not a full-featured filesystem (e.g., mkdir is not supported) and should not be used as /tmp for a production system.
You can include the following instruction in a script file within your buildfile:
[+script] startup-script = {
    procmgr_symlink /dev/shmem/ /tmp
    ...

This instruction sets /tmp as a symbolic link in the process manager's pathname table; this symbolic link points to the /dev/shmem directory. Because this directory is where shared memory objects are stored, this link lets you create a temporary filesystem based on shared memory objects.

For an explanation on why it's best to use procmgr_symlink to create the link, as well as guidance on using an alternative mechanism to provide a temporary in-memory filesystem for a production system, see the mkifs buildfile examples in the Utilities Reference.

Page updated: