拔u盘的时候会有文件占用,导致ProcessKiller杀掉player进程,打出的日志如下
Process xxx has open filemaps /mnt/usb_storage/USB_DISK0/udisk0/xxx.
Process xxx has open filemaps /mnt/usb_storage/USB_DISK0/udisk0/xxx.
Process xxx has open filemaps /mnt/usb_storage/USB_DISK0/udisk0/xxx.
...has retried 130 times.blabla
在内核中grep日志关键字"has open filemap"查找到来源是/system/vold/Process.cpp
的checkFileMaps函数打出的日志,来源是/proc/[pid]/maps文件。
cat /proc/[pid]/maps 出来后结果大致如下
address | perms | offset | dev | inode | pathname
44bcc000-44bce000 | r--s | 00000000 | 08:01 | 415 | /mnt/usb_storage/USB_DISK0/udisk0/xx
cat /proc/[pid]/fd会多出来一个[fd