gpt4 book ai didi

android - 如何知道 Android NDK 中访问文件的确切位置

转载 作者:太空宇宙 更新时间:2023-11-04 04:21:52 24 4
gpt4 key购买 nike

使用“lsof”,我可以检查打开文件的列表,是否有任何命令或任何其他方式可以检测正在访问的文件的位置。“lsof”命令的输出如下:-

COMMAND     PID       USER   FD      TYPE             DEVICE  SIZE/OFF       NODE NAME

init 1 ??? cwd ??? ??? ??? ??? /proc/1/cwd (readlink: Permission denied)

init 1 ??? exe ??? ??? ??? ??? /proc/1/exe (readlink: Permission denied)

init 1 ??? root ??? ??? ??? ??? /proc/1/root (readlink: Permission denied)

init 1 ??? FDS /proc/1/fd/ (opendir: Permission denied)

init 2 ??? cwd ??? ??? ??? ??? /proc/2/cwd (readlink: Permission denied)

init 2 ??? exe ??? ??? ??? ??? /proc/2/exe (readlink: Permission denied)

init 2 ??? root ??? ??? ??? ??? /proc/2/root (readlink: Permission denied)

init 2 ??? FDS /proc/2/fd/ (opendir: Permission denied)

init 3 ??? cwd ??? ??? ??? ??? /proc/3/cwd (readlink: Permission denied)

init 3 ??? exe ??? ??? ??? ??? /proc/3/exe (readlink: Permission denied)

init 3 ??? root ??? ??? ??? ??? /proc/3/root (readlink: Permission denied)

init 3 ??? FDS /proc/3/fd/ (opendir: Permission denied)

init 4 ??? cwd ??? ??? ??? ??? /proc/4/cwd (readlink: Permission denied)

init 4 ??? exe ??? ??? ??? ??? /proc/4/exe (readlink: Permission denied)

init 4 ??? root ??? ??? ??? ??? /proc/4/root (readlink: Permission denied)

init 4 ??? FDS /proc/4/fd/ (opendir: Permission denied)

init 5 ??? cwd ??? ??? ??? ??? /proc/5/cwd (readlink: Permission denied)

init 5 ??? exe ??? ??? ??? ??? /proc/5/exe (readlink: Permission denied)

init 5 ??? root ??? ??? ??? ??? /proc/5/root (readlink: Permission denied)

init 5 ??? FDS /proc/5/fd/ (opendir: Permission denied)

init 6 ??? cwd ??? ??? ??? ??? /proc/6/cwd (readlink: Permission denied)

init 6 ??? exe ??? ??? ??? ??? /proc/6/exe (readlink: Permission denied)

init 6 ??? root ??? ??? ??? ??? /proc/6/root (readlink: Permission denied)

init 6 ??? FDS /proc/6/fd/ (opendir: Permission denied)

init 7 ??? cwd ??? ??? ??? ??? /proc/7/cwd (readlink: Permission denied)

init 7 ??? exe ??? ??? ??? ??? /proc/7/exe (readlink: Permission denied)

init 7 ??? root ??? ??? ??? ??? /proc/7/root (readlink: Permission denied)

init 7 ??? FDS /proc/7/fd/ (opendir: Permission denied)

init 8 ??? cwd ??? ??? ??? ??? /proc/8/cwd (readlink: Permission denied)

init 8 ??? exe ??? ??? ??? ??? /proc/8/exe (readlink: Permission denied)

init 8 ??? root ??? ??? ??? ??? /proc/8/root (readlink: Permission denied)

init 8 ??? FDS /proc/8/fd/ (opendir: Permission denied)

init 9 ??? cwd ??? ??? ??? ??? /proc/9/cwd (readlink: Permission denied)

init 9 ??? exe ??? ??? ??? ??? /proc/9/exe (readlink: Permission denied)

init 9 ??? root ??? ??? ??? ??? /proc/9/root (readlink: Permission denied)

init 9 ??? FDS /proc/9/fd/ (opendir: Permission denied)

init 10 ??? cwd ??? ??? ??? ??? /proc/10/cwd (readlink: Permission denied)

对于每个 pid,我得到三个位置,例如 pid“9”,我得到以下位置:-“/proc/1/cwd(readlink:权限被拒绝)”,“/proc/9/exe”,“/proc/9/fd/(opendir:权限被拒绝)”

现在我怎么知道哪个文件正在被使用?我是新手,所以了解不够。任何建议都会对您有很大帮助。

最佳答案

尝试定影器。 http://linux.die.net/man/1/fuser它用于识别使用文件或套接字的进程。

关于android - 如何知道 Android NDK 中访问文件的确切位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12347201/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com