If the entry is a file, you print the name and the number of bytes it's currently using (found using the st_size member of the struct stat).
如果该条目是一个文件,那么显示其名称和字节数(可在struct stat的st_size成员中找到)。
The stat() function fills a struct stat structure with information about a specific file; if you've got a file descriptor instead of a file name, you can use the fstat() function instead.
stat() 函数会将特定文件的相关信息填入 struct stat 结构中,如果您获得的是文件描述符而不是文件名,那么作为替代,您可以使用 fstat() 函数。
When you pass lsof the name of a file, such as in lsof /file/I/deleted, it first uses the stat() system call to get information about the file, which is, unfortunately, gone.
当您向 lsof 传递文件名时,比如在 lsof /file/I/deleted 中,它首先使用 stat() 系统调用获得有关该文件的信息,不幸的是,这个文件已经被删除。
应用推荐