intercepting file system system calls

后端 未结 4 590
轮回少年
轮回少年 2021-02-08 09:58

I am writing an application for which I need to intercept some filesystem system calls eg. unlink. I would like to save some file say abc. If user deletes the file then I need t

4条回答
  •  广开言路
    2021-02-08 10:43

    If you want to handle deletions only, you could keep a "shadow" directory of hardlinks (created via link) to the files being watched (via inotify, as suggested by Graham Lee).

    If the original is now unlinked, you still have the shadow file to handle as you want to, without using a kernel module.

提交回复
热议问题