Add FreeBSD / DragonFly specific /proc path for an executable file.

Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
(cherry picked from commit 4ef8f95912)
pull/182/head
Slávek Banko 4 years ago
parent 8fc36c4ae2
commit baed31ac7b
No known key found for this signature in database
GPG Key ID: 608F5293A04BE668

@ -332,9 +332,11 @@ int main( int argc, char **argv )
char fullpath[PATH_MAX];
#if defined(__dilos__)
snprintf(procpath, sizeof(procpath), "/proc/%d/path/a.out", pid);
#else /* !__dilos__ */
#elif defined(__FreeBSD__) || defined (__DragonFly__)
snprintf(procpath, sizeof(procpath), "/compat/linux/proc/%d/exe", pid);
#else /* Linux way as default */
snprintf(procpath, sizeof(procpath), "/proc/%d/exe", pid);
#endif /* __dilos__ */
#endif
len = readlink( procpath, fullpath, sizeof(fullpath) );
if (len >= 0) {
fullpath[len] = 0;

Loading…
Cancel
Save