OS: 파일에 접근하는 프로세스의 PID 표시
필요 RPM
dnf install psmisc
테스트 프로그램
- 코드
const string strFileName = "/root/temp.txt";
...
fread(caBuffer, sizeof(caBuffer), 1, psFile);
while(1) {
}
...
pid 출력
fuser /root/temp.txt
/root/temp.txt: 3706
pid와 소유자 출력
fuser -u /root/temp.txt
/root/temp.txt: 3706(root)
상세 출력
fuser -v /root/temp.txt
USER PID ACCESS COMMAND
/root/temp.txt: root 3706 f.... test3