mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-10-30 09:33:39 +01:00
Global: support DragonFly BSD
This commit is contained in:
@@ -70,14 +70,26 @@ const char* ffDetectBattery(FF_MAYBE_UNUSED FFBatteryOptions* options, FFlist* r
|
||||
ffStrbufTrimRight(&battery->status, ',');
|
||||
}
|
||||
|
||||
#ifdef ACPIIO_BATT_GET_BIX
|
||||
battio.unit = i;
|
||||
if (ioctl(acpifd, ACPIIO_BATT_GET_BIX, &battio) >= 0)
|
||||
{
|
||||
ffStrbufAppendS(&battery->manufacturer, battio.bix.oeminfo);
|
||||
ffStrbufAppendS(&battery->modelName, battio.bix.model);
|
||||
ffStrbufAppendS(&battery->technology, battio.bix.type);
|
||||
ffStrbufAppendS(&battery->serial, battio.bix.serial);
|
||||
battery->cycleCount = battio.bix.cycles;
|
||||
}
|
||||
#elif defined(ACPIIO_BATT_GET_BIF)
|
||||
battio.unit = i;
|
||||
if (ioctl(acpifd, ACPIIO_BATT_GET_BIF, &battio) >= 0)
|
||||
{
|
||||
ffStrbufAppendS(&battery->manufacturer, battio.bif.oeminfo);
|
||||
ffStrbufAppendS(&battery->modelName, battio.bif.model);
|
||||
ffStrbufAppendS(&battery->technology, battio.bif.type);
|
||||
ffStrbufAppendS(&battery->serial, battio.bif.serial);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#endif
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
#if __has_include(<libgeom.h>)
|
||||
#include <libgeom.h>
|
||||
|
||||
static const char* detectFsLabel(struct statfs* fs, FFDisk* disk)
|
||||
@@ -51,6 +52,12 @@ static const char* detectFsLabel(struct statfs* fs, FFDisk* disk)
|
||||
|
||||
return NULL;
|
||||
}
|
||||
#else
|
||||
static const char* detectFsLabel(struct statfs* fs, FFDisk* disk)
|
||||
{
|
||||
return "Fastfetch was compiled without libgeom support";
|
||||
}
|
||||
#endif
|
||||
|
||||
static void detectFsInfo(struct statfs* fs, FFDisk* disk)
|
||||
{
|
||||
@@ -134,7 +141,7 @@ const char* ffDetectDisksImpl(FFDiskOptions* options, FFlist* disks)
|
||||
if(!ffDiskMatchMountpoint(options, fs->f_mntonname))
|
||||
continue;
|
||||
}
|
||||
else if(!ffStrStartsWith(fs->f_mntfromname, "/dev/") && !ffStrEquals(fs->f_fstypename, "zfs"))
|
||||
else if(!ffStrEquals(fs->f_mntonname, "/") && !ffStrStartsWith(fs->f_mntfromname, "/dev/") && !ffStrEquals(fs->f_fstypename, "zfs"))
|
||||
continue;
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
@@ -168,10 +175,11 @@ const char* ffDetectDisksImpl(FFDiskOptions* options, FFlist* disks)
|
||||
#ifdef __OpenBSD__
|
||||
#define st_birthtimespec __st_birthtim
|
||||
#endif
|
||||
|
||||
#ifndef __DragonFly__
|
||||
struct stat st;
|
||||
if(stat(fs->f_mntonname, &st) == 0 && st.st_birthtimespec.tv_sec > 0)
|
||||
disk->createTime = (uint64_t)((st.st_birthtimespec.tv_sec * 1000) + (st.st_birthtimespec.tv_nsec / 1000000));
|
||||
#endif
|
||||
}
|
||||
|
||||
return NULL;
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
#include "diskio.h"
|
||||
|
||||
#if __has_include(<libgeom.h>)
|
||||
|
||||
#include "util/stringUtils.h"
|
||||
|
||||
#include <devstat.h>
|
||||
@@ -58,3 +61,9 @@ const char* ffDiskIOGetIoCounters(FFlist* result, FFDiskIOOptions* options)
|
||||
|
||||
return NULL;
|
||||
}
|
||||
#else
|
||||
const char* ffDiskIOGetIoCounters(FFlist* result, FFDiskIOOptions* options)
|
||||
{
|
||||
return "Fastfetch was compiled without libgeom support";
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -257,6 +257,10 @@ static const char* getFromProcesses(FFDisplayServerResult* result)
|
||||
uint32_t userId = getuid();
|
||||
|
||||
#if __FreeBSD__
|
||||
#ifdef __DragonFly__
|
||||
#define ki_comm kp_comm
|
||||
#endif
|
||||
|
||||
int request[] = {CTL_KERN, KERN_PROC, KERN_PROC_UID, (int) userId};
|
||||
size_t length = 0;
|
||||
|
||||
|
||||
@@ -4,7 +4,12 @@
|
||||
#include <stdio.h>
|
||||
#include <fcntl.h>
|
||||
#include <usbhid.h>
|
||||
#include <dev/usb/usb_ioctl.h>
|
||||
|
||||
#if __has_include(<dev/usb/usb_ioctl.h>)
|
||||
#include <dev/usb/usb_ioctl.h> // FreeBSD
|
||||
#else
|
||||
#include <bus/u4b/usb_ioctl.h> // DragonFly
|
||||
#endif
|
||||
|
||||
#define MAX_UHID_JOYS 64
|
||||
|
||||
|
||||
@@ -2,12 +2,14 @@
|
||||
|
||||
#include "common/io/io.h"
|
||||
#include "common/properties.h"
|
||||
#include "util/mallocHelper.h"
|
||||
#include "util/stringUtils.h"
|
||||
|
||||
#include <dev/pci/pcireg.h>
|
||||
#include <sys/pciio.h>
|
||||
#include <fcntl.h>
|
||||
#if __has_include(<dev/pci/pcireg.h>)
|
||||
#include <dev/pci/pcireg.h> // FreeBSD
|
||||
#else
|
||||
#include <bus/pci/pcireg.h> // DragonFly
|
||||
#endif
|
||||
|
||||
const char* ffDetectGPUImpl(const FFGPUOptions* options, FFlist* gpus)
|
||||
{
|
||||
|
||||
@@ -4,6 +4,9 @@
|
||||
#include <stdlib.h>
|
||||
#ifdef __FreeBSD__
|
||||
#include <paths.h>
|
||||
#ifndef _PATH_LOCALBASE
|
||||
#define _PATH_LOCALBASE "/usr/local"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if FF_HAVE_EMBEDDED_PCIIDS
|
||||
|
||||
@@ -4,7 +4,12 @@
|
||||
#include <stdio.h>
|
||||
#include <fcntl.h>
|
||||
#include <usbhid.h>
|
||||
#include <dev/usb/usb_ioctl.h>
|
||||
|
||||
#if __has_include(<dev/usb/usb_ioctl.h>)
|
||||
#include <dev/usb/usb_ioctl.h> // FreeBSD
|
||||
#else
|
||||
#include <bus/u4b/usb_ioctl.h> // DragonFly
|
||||
#endif
|
||||
|
||||
#define MAX_UHID_JOYS 64
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ static const FFLocalIpNIFlag niFlagOptions[] = {
|
||||
{ IFF_PROMISC, "PROMISC" },
|
||||
{ IFF_ALLMULTI, "ALLMULTI" },
|
||||
{ IFF_MULTICAST, "MULTICAST" },
|
||||
#if defined(__linux__) || defined(__APPLE__) || defined(__sun)
|
||||
#ifdef IFF_NOTRAILERS
|
||||
{ IFF_NOTRAILERS, "NOTRAILERS" },
|
||||
#endif
|
||||
#ifdef __linux__
|
||||
@@ -59,10 +59,10 @@ static const FFLocalIpNIFlag niFlagOptions[] = {
|
||||
{ IFF_LINK1, "LINK1" },
|
||||
{ IFF_LINK2, "LINK2" },
|
||||
#endif
|
||||
#if defined(__FreeBSD__) || defined(__APPLE__)
|
||||
#ifdef IFF_ALTPHYS
|
||||
{ IFF_ALTPHYS, "ALTPHYS" },
|
||||
#endif
|
||||
#ifdef __FreeBSD__
|
||||
#ifdef IFF_CANTCONFIG
|
||||
{ IFF_CANTCONFIG, "CANTCONFIG" },
|
||||
#endif
|
||||
// sentinel
|
||||
|
||||
@@ -4,7 +4,12 @@
|
||||
#include <stdio.h>
|
||||
#include <fcntl.h>
|
||||
#include <usbhid.h>
|
||||
#include <dev/usb/usb_ioctl.h>
|
||||
|
||||
#if __has_include(<dev/usb/usb_ioctl.h>)
|
||||
#include <dev/usb/usb_ioctl.h> // FreeBSD
|
||||
#else
|
||||
#include <bus/u4b/usb_ioctl.h> // DragonFly
|
||||
#endif
|
||||
|
||||
#define MAX_UHID_JOYS 64
|
||||
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
#include "physicaldisk.h"
|
||||
|
||||
#if __has_include(<libgeom.h>)
|
||||
|
||||
#include "util/stringUtils.h"
|
||||
|
||||
#include <devstat.h>
|
||||
@@ -92,3 +95,9 @@ const char* ffDetectPhysicalDisk(FFlist* result, FFPhysicalDiskOptions* options)
|
||||
|
||||
return NULL;
|
||||
}
|
||||
#else
|
||||
const char* ffDetectPhysicalDisk(FFlist* result, FFPhysicalDiskOptions* options)
|
||||
{
|
||||
return "Fastfetch was compiled without libgeom support";
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -10,6 +10,9 @@ const char* ffDetectSound(FFlist* devices)
|
||||
char path[] = "/dev/mixer0";
|
||||
int defaultDev = ffSysctlGetInt("hw.snd.default_unit", -1);
|
||||
|
||||
if (defaultDev == -1)
|
||||
return "sysctl(hw.snd.default_unit) failed";
|
||||
|
||||
for (int idev = 0; idev <= 9; ++idev)
|
||||
{
|
||||
path[strlen("/dev/mixer")] = (char) ('0' + idev);
|
||||
|
||||
@@ -8,6 +8,9 @@
|
||||
#include <ctype.h>
|
||||
#ifdef __FreeBSD__
|
||||
#include <paths.h>
|
||||
#ifndef _PATH_LOCALBASE
|
||||
#define _PATH_LOCALBASE "/usr/local"
|
||||
#endif
|
||||
#elif __OpenBSD__
|
||||
#define _PATH_LOCALBASE "/usr/local"
|
||||
#elif __NetBSD__
|
||||
|
||||
Reference in New Issue
Block a user