I am currently developing inside an embedded Linux environment (kernel 3.10.0), and while goofing around in the
procfs mount of the system I found that all processes present the following file in their
-rw-r--r-- 1 root root 0 Feb 22 09:10 make-it-fail
Just for testing, I launched from the shell
sleep 360 & and tried to read/write with
make-if-fail file. These are the results:
# stat /proc/[sleep_pid]/make-it-fail File: /proc/[sleep_pid]/make-it-fail Size: 0 Blocks: 0 IO Block: 1024 regular empty file [...] # cat /proc/[sleep_pid]/make-it-fail 0 # echo "1" > /proc/[sleep_pid]/make-it-fail # cat /proc/[sleep_pid]/make-it-fail 1 # stat /proc/[sleep_pid]/make-it-fail File: /proc/[sleep_pid]/make-it-fail Size: 0 Blocks: 0 IO Block: 1024 regular empty file [...]
statclaims that the file has size 0, I could read and write something there, and retrieve what I wrote.
- The process is alive and kicking, "surviving" the reads and writes of this file. I actually expected it to ... well, fail or exit.
I understand that
procfs is a pseudo-filesystem (therefore
stat results might be not "real"/misleading) and that it interfaces with kernel structures, but I feel I am missing something here right now.
So, what is the purpose and usage of this file? I cannot recall seeing it in other distros (e.g. it is not in the Ubuntu that I use for development)