I want to intercept every write system call and modify the data of write syscall when the syscall is directed towards some specific file otherwise do original write syscall.
Now from where I can modify the write syscall. Also, I want the name of the file to which syscall is directed how can I get that from the file descriptor argument in write syscall.
I have tried the LD_PRELOAD trick but it only works on the library calls not on syscalls. I am using ubuntu 18.04.