Skip to content

Commit a3f50f3

Browse files
committed
Smbios (OpenBSD): add support for legency BIOS
1 parent ab1bfff commit a3f50f3

File tree

3 files changed

+16
-9
lines changed

3 files changed

+16
-9
lines changed

CMakeLists.txt

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -817,22 +817,22 @@ elseif(OpenBSD)
817817
src/common/processing_linux.c
818818
src/common/sysctl.c
819819
src/detection/battery/battery_obsd.c
820-
src/detection/bios/bios_nosupport.c
820+
src/detection/bios/bios_windows.c
821821
src/detection/bluetooth/bluetooth_nosupport.c
822822
src/detection/bluetoothradio/bluetoothradio_nosupport.c
823-
src/detection/board/board_nosupport.c
823+
src/detection/board/board_windows.c
824824
src/detection/bootmgr/bootmgr_nosupport.c
825825
src/detection/brightness/brightness_obsd.c
826826
src/detection/btrfs/btrfs_nosupport.c
827-
src/detection/chassis/chassis_nosupport.c
827+
src/detection/chassis/chassis_windows.c
828828
src/detection/cpu/cpu_obsd.c
829-
src/detection/cpucache/cpucache_nosupport.c
829+
src/detection/cpucache/cpucache_shared.c
830830
src/detection/cpuusage/cpuusage_bsd.c
831831
src/detection/cursor/cursor_linux.c
832832
src/detection/disk/disk_bsd.c
833833
src/detection/dns/dns_linux.c
834834
src/detection/physicaldisk/physicaldisk_nosupport.c
835-
src/detection/physicalmemory/physicalmemory_nosupport.c
835+
src/detection/physicalmemory/physicalmemory_linux.c
836836
src/detection/diskio/diskio_obsd.c
837837
src/detection/displayserver/linux/displayserver_linux.c
838838
src/detection/displayserver/linux/drm.c
@@ -889,6 +889,7 @@ elseif(OpenBSD)
889889
src/detection/zpool/zpool_nosupport.c
890890
src/util/platform/FFPlatform_unix.c
891891
src/util/binary_linux.c
892+
src/util/smbiosHelper.c
892893
)
893894
elseif(APPLE)
894895
list(APPEND LIBFASTFETCH_SRC

src/detection/bios/bios_windows.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ const char* ffDetectBios(FFBiosResult* bios)
8989
default: break;
9090
}
9191
}
92-
#elif __HAIKU__
92+
#elif __HAIKU__ || __OpenBSD__
9393
// Currently SMBIOS detection is supported in legency BIOS only
9494
ffStrbufSetStatic(&bios->type, "BIOS");
9595
#endif

src/util/smbiosHelper.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ const FFSmbiosHeader* ffSmbiosNextEntry(const FFSmbiosHeader* header)
5050
return (const FFSmbiosHeader*) (p + 1);
5151
}
5252

53-
#if defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__sun) || defined(__HAIKU__)
53+
#if defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__sun) || defined(__HAIKU__) || defined(__OpenBSD__)
5454
#include <fcntl.h>
5555
#include <sys/stat.h>
5656
#include <sys/mman.h>
@@ -139,7 +139,7 @@ const FFSmbiosHeaderTable* ffGetSmbiosHeaderTable()
139139
if (buffer.chars == NULL)
140140
{
141141
ffStrbufInit(&buffer);
142-
#ifndef __HAIKU__
142+
#if !__HAIKU__ && !__OpenBSD__
143143
#ifdef __linux__
144144
if (!ffAppendFileBuffer("/sys/firmware/dmi/tables/DMI", &buffer))
145145
#endif
@@ -233,7 +233,13 @@ const FFSmbiosHeaderTable* ffGetSmbiosHeaderTable()
233233
{
234234
uint32_t tableLength = 0;
235235
off_t tableAddress = 0;
236-
FF_AUTO_CLOSE_FD int fd = open("/dev/misc/mem", O_RDONLY);
236+
FF_AUTO_CLOSE_FD int fd = open(
237+
#if __HAIKU__
238+
"/dev/misc/mem"
239+
#else
240+
"/dev/mem"
241+
#endif
242+
, O_RDONLY);
237243
if (fd < 0)
238244
return NULL;
239245

0 commit comments

Comments
 (0)