📄 列表5.18.txt
字号:
【列表5.18】帮助函数 ProcReadLink和调用他的函数。
// ProcReadLink - return the name of the file that the
// link points to.
function ProcReadLink (pid: __pid_t; const sFile: String): String;
var
buf : array [0..1024] of char;
iLen : Integer;
sFilename : String;
begin
sFilename := Format ('/proc/%d/%s', [pid, sFile]);
iLen := readlink (PChar(sFilename), buf, 1024);
if iLen = -1 then
iLen := 0;
buf[iLen] := #0;
Result := buf;
end;
// ProcGetCwd - return the process's current working directory.
function ProcGetCwd (pid: __pid_t): String;
begin
Result := ProcReadLink (pid, 'cwd');
end;
// ProcGetExe - return the name of the process's executable.
function ProcGetExe (pid: __pid_t): String;
begin
Result := ProcReadLink (pid, 'exe');
end;
// ProcGetRoot - return the process's root directory
function ProcGetRoot (pid: __pid_t): String;
begin
Result := ProcReadLink (pid, 'root');
end;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -