I have a ‘legacy’ app I need to run on a Legato system, and this app currently needs to write a file to /tmp
(essentially doing the equivalent of the shell command touch /tmp/shutting-down
). Actually, it’s not so important that the file be located in /tmp
, the only requirements are:
- The file should not persist across reboots of the device, and:
- It should be possible for other applications to detect the existence of this file
We have a fairly complex build system that already contains some CMake functions my colleages wrote to create the required .adef
files for our legacy apps. The resulting .adef
file for my app contains this block:
requires:
{
...
dir:
{
/proc /
[rwx] /tmp /
}
}
Unfortunately, it doesn’t quite work for my needs, because the file winds up being written to /legato/systems/current/appsWriteable/parentApp/tmp/shutting-down
, and I’m not sure how to make this location readable by other apps.
Can somebody give me a clue how to make this work, or point me to some example code that demonstrates how a tmpfs location can be shared between two different apps? Thanks!
UPDATE – Some more (possibly) relevant details: I probably should have mentioned that my app, as well as the other applications that need to access the tmp file written by my app, are all ‘child’ apps under the same ‘parent’ app. (Apologies if these aren’t the correct terms, this is just how it appears to me as a Legato n00b.)
The fact that my app’s tmp file showed up under /legato/systems/current/appsWriteable/parentApp/tmp/shutting-down
—and not /legato/systems/current/appsWriteable/myApp/tmp/shutting-down
(as I originally reported!)—makes me hopeful that this location might also be readable by my app’s ‘sibling’ apps if I simply include the same dir
block as above? Maybe?
Unfortunately, I lent my hardware setup to a colleague and won’t be able to test this myself for a couple of days. If somebody reading this understands the context well enough to tell me before then that it’s a doomed exercise, I would be very much obliged!