umockdev
umockdev copied to clipboard
Making proc and removing files
To remove a file in the /proc the docu suggest to create a broken symlink:
Currently there is no way to "remove" files from the real directories or fully control them. You can get the effect of removing a file by creating a broken symlink in the umockdev directory though.
This does not seem to work because to check if a file exists in the mocked proc an access call is done, which dereferences the symlink, which will then fail and the real /proc will show through:
symlink("/NONEXIST-BOLT", "/tmp/umockdev.ZNLR7Z/proc/sys/kernel/osrelease") = 0
access("/tmp/umockdev.ZNLR7Z/disabled", F_OK) = -1 ENOENT (No such file or directory)
access("/tmp/umockdev.ZNLR7Z/proc/sys/kernel/osrelease", F_OK) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/proc/sys/kernel/osrelease", O_RDONLY) = 7