11 char resolvedPath
[PATH_MAX
];
12 auto count
= readlink("/proc/curproc/file", resolvedPath
, PATH_MAX
);
13 resolvedPath
[count
] = '\0';
14 //std::cout << "resolvedPath: " << resolvedPath << '\n';
15 char resolvedPath2
[PATH_MAX
];
16 auto count2
= readlinkat(AT_FDCWD
, "/proc/curproc/file", resolvedPath2
, PATH_MAX
);
17 resolvedPath2
[count2
] = '\0';
18 //std::cout << "resolvedPath2: " << resolvedPath2 << '\n';
19 std::string
rp(resolvedPath
);
20 assert(rp
== resolvedPath2
);
22 auto n
= rp
.rfind("proc_pid_file");
24 std::string
filename(rp
.substr(n
));
25 //std::cout << "filename: " << filename << '\n';
26 assert(filename
== "proc_pid_file");