Global: support DragonFly BSD

This commit is contained in:
Carter Li
2024-11-03 08:35:11 +08:00
parent 540239fe03
commit f7288fec01
19 changed files with 101 additions and 17 deletions
+1 -1
View File
@@ -245,7 +245,7 @@ void ffListFeatures(void)
#if FF_HAVE_DDCUTIL
"libddcutil\n"
#endif
#if FF_HAVE_ELF || __sun || __FreeBSD__ || __OpenBSD__ || __NetBSD__
#if FF_HAVE_ELF || __sun || (__FreeBSD__ && !__DragonFly__) || __OpenBSD__ || __NetBSD__
"libelf\n"
#endif
#if FF_HAVE_LIBZFS
+1 -1
View File
@@ -91,7 +91,7 @@ bool ffNetifGetDefaultRouteImpl(char iface[IF_NAMESIZE + 1], uint32_t* ifIndex)
if (rtmsg.hdr.rtm_seq == 1 && rtmsg.hdr.rtm_pid == pid)
{
struct sockaddr_dl* sdl = (struct sockaddr_dl *)get_rt_address(&rtmsg.hdr, RTA_IFP);
if (sdl)
if (sdl && sdl->sdl_len)
{
assert(sdl->sdl_nlen <= IF_NAMESIZE);
memcpy(iface, sdl->sdl_data, sdl->sdl_nlen);
+7
View File
@@ -367,6 +367,13 @@ const char* ffProcessGetBasicInfoLinux(pid_t pid, FFstrbuf* name, pid_t* ppid, i
#elif defined(__FreeBSD__)
#ifdef __DragonFly__
#define ki_comm kp_comm
#define ki_ppid kp_ppid
#define ki_tdev kp_tdev
#define ki_flag kp_flags
#endif
struct kinfo_proc proc;
size_t size = sizeof(proc);
if(sysctl(