Get canonical path from pathname

拥有回忆 提交于 2020-05-13 07:00:06

问题


I am writing a kernel module that hijacks several system calls. Several of the system calls take paths as parameters. For my purposes, I need to work with full paths, but since these parameters are passed as strings, it could be anything like "documents", "/home/main/../bob", or "../lib". I need to get the real paths of these references, but I don't know which function to use or which information I need (e.g., the current working directory, etc.).

The kernel obviously has some way of making paths normalized so it can perform operations necessary for SELinux, IMA, and a bunch of other things. How can I do that?

来源:https://stackoverflow.com/questions/39089860/get-canonical-path-from-pathname

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!