Fixup fromcvs/togit conversion
[minix-pkgsrc.git] / sysutils / libgtop / patches / patch-sysdeps_freebsd_procwd.c
bloba2437272696ac791a1126e2fbc71f7628e2bbaef
1 $NetBSD$
3 --- sysdeps/freebsd/procwd.c.orig 2012-03-23 16:53:25.085432000 +0000
4 +++ sysdeps/freebsd/procwd.c
5 @@ -100,8 +100,6 @@ parse_output(const char *output, glibtop
6 char**
7 glibtop_get_proc_wd_s(glibtop *server, glibtop_proc_wd *buf, pid_t pid)
9 - int exe_mib[4];
10 - size_t len;
11 #if __FreeBSD_version > 800018 || (__FreeBSD_version < 800000 && __FreeBSD_version >= 700104)
12 struct kinfo_file *freep, *kif;
13 GPtrArray *dirs;
14 @@ -116,6 +114,16 @@ glibtop_get_proc_wd_s(glibtop *server, g
15 #endif
17 memset (buf, 0, sizeof (glibtop_proc_wd));
18 +#if defined(__DragonFly__)
19 + char path[MAXPATHLEN];
21 + g_snprintf(path, sizeof(path), "/proc/%u/file", pid);
22 + if (safe_readlink(path, buf->exe, sizeof(buf->exe)))
23 + buf->flags |= (1 << GLIBTOP_PROC_WD_EXE);
24 +#else
25 + int exe_mib[4];
26 + size_t len;
28 len = 0;
30 exe_mib[0] = CTL_KERN;
31 @@ -129,6 +137,7 @@ glibtop_get_proc_wd_s(glibtop *server, g
32 if (sysctl(exe_mib, 4, buf->exe, &len, NULL, 0) == 0)
33 buf->flags |= (1 << GLIBTOP_PROC_WD_EXE);
35 +#endif
37 #if __FreeBSD_version > 800018 || (__FreeBSD_version < 800000 && __FreeBSD_version >= 700104)
38 #ifndef HAVE_KINFO_GETFILE