简体   繁体   中英

Is it possible to remove the fd link in /proc/<pid>/fd?

I've been trying to setup an kernel module to later fake a GPS within a program, in order to simulate communication with gpsd which uses a fixed path. But right now I'm stuck due to gpsd checking if there's more than one link to the file in /proc//fd before starting reading/writing.

Is there a way to exclude the link from this directory but still be able to read/write to file from my gpsfake? Or bypass this fd tracking altogether from the module?

/proc/<pid>/ is a filesystem-like view on the process <pid> , exposed by the kernel.

As such, the only way to remove/add/change anything within this directory is by changing the process itself (in your case: make the process close the offending file-descriptor to have the corresponding symlink go away).

The other way is to patch the kernel, but you probably don't want to do this.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM