From abf0c510d77cd6d28a837f8052c097c736bb8fa7 Mon Sep 17 00:00:00 2001 From: verdgil Date: Sun, 8 Feb 2026 09:27:25 +0300 Subject: [PATCH 1/7] Fix Oracle Solaris zpool build --- src/detection/zpool/zpool.c | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/src/detection/zpool/zpool.c b/src/detection/zpool/zpool.c index ca2c31a281..f277a8b3ea 100644 --- a/src/detection/zpool/zpool.c +++ b/src/detection/zpool/zpool.c @@ -16,7 +16,7 @@ typedef struct FFZfsData { FF_LIBRARY_SYMBOL(libzfs_fini) FF_LIBRARY_SYMBOL(zpool_get_prop_int) - FF_LIBRARY_SYMBOL(zpool_get_prop) + FF_LIBRARY_SYMBOL(zpool_get_prop); FF_LIBRARY_SYMBOL(zpool_close) // The fields in this struct store property IDs returned by `zpool_name_to_prop`, @@ -36,6 +36,24 @@ typedef struct FFZfsData FFlist* result; } FFZfsData; +static inline int ff_zpool_get_prop_wrapper( + FFZfsData* data, + zpool_handle_t *zhp, + zpool_prop_t prop, + char *buf, + size_t len, + zprop_source_t *srctype, + boolean_t literal __attribute__((unused)) +) +{ +#if defined(__sun) && ! defined(__illumos__) + return data->ffzpool_get_prop(zhp, prop, buf, len, srctype); +#else + return data->ffzpool_get_prop(zhp, prop, buf, len, srctype, literal); +#endif + +} + static inline void cleanLibzfs(FFZfsData* data) { if (data->fflibzfs_fini && data->handle) @@ -51,11 +69,17 @@ static int enumZpoolCallback(zpool_handle_t* zpool, void* param) zprop_source_t source; FFZpoolResult* item = ffListAdd(data->result); char buf[1024]; - if (data->ffzpool_get_prop(zpool, data->props.name, buf, ARRAY_SIZE(buf), &source, false) == 0) + /* + Solaris: + extern int zpool_get_prop(zpool_handle_t *, zpool_prop_t, char *, size_t __proplen, zprop_source_t *); + Illumos: + extern int zpool_get_prop(zpool_handle_t *, zpool_prop_t, char *, size_t proplen, zprop_source_t *, boolean_t); + */ + if (ff_zpool_get_prop_wrapper(data, zpool, data->props.name, buf, ARRAY_SIZE(buf), &source, false) == 0) ffStrbufInitS(&item->name, buf); else ffStrbufInitStatic(&item->name, "unknown"); - if (data->ffzpool_get_prop(zpool, data->props.health, buf, ARRAY_SIZE(buf), &source, false) == 0) + if (ff_zpool_get_prop_wrapper(data, zpool, data->props.health, buf, ARRAY_SIZE(buf), &source, false) == 0) ffStrbufInitS(&item->state, buf); else ffStrbufInitStatic(&item->state, "unknown"); From fe05d7bcd43c086fba6f30a480c4301c6a418040 Mon Sep 17 00:00:00 2001 From: verdgil Date: Sun, 8 Feb 2026 10:45:20 +0300 Subject: [PATCH 2/7] Add memrchr fallback --- CMakeLists.txt | 1 + README.md | 2 +- src/common/solaris/memrchr.c | 15 +++++++++++++++ src/detection/gpu/gpu_pci.c | 4 ++++ 4 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 src/common/solaris/memrchr.c diff --git a/CMakeLists.txt b/CMakeLists.txt index 28778aacbb..58fc2a11d9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1115,6 +1115,7 @@ elseif(SunOS) src/detection/displayserver/linux/xcb.c src/detection/displayserver/linux/xlib.c src/detection/font/font_linux.c + src/common/solaris/memrchr.c src/detection/gpu/gpu_sunos.c src/detection/gpu/gpu_pci.c src/detection/gtk_qt/gtk.c diff --git a/README.md b/README.md index 4630b13ee3..789782a3d1 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ [![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/fastfetch-cli/fastfetch) [![中文README](https://img.shields.io/badge/%E4%B8%AD%E6%96%87-README-red)](README-cn.md) -Fastfetch is a [neofetch](https://github.com/dylanaraps/neofetch)-like tool for fetching system information and displaying it in a visually appealing way. It is written mainly in C, with a focus on performance and customizability. Currently, it supports Linux, macOS, Windows 7+, Android, FreeBSD, OpenBSD, NetBSD, DragonFly, Haiku, and illumos (SunOS). +Fastfetch is a [neofetch](https://github.com/dylanaraps/neofetch)-like tool for fetching system information and displaying it in a visually appealing way. It is written mainly in C, with a focus on performance and customizability. Currently, it supports Linux, macOS, Windows 7+, Android, FreeBSD, OpenBSD, NetBSD, DragonFly, Haiku, illumos (SunOS) and Solaris. diff --git a/src/common/solaris/memrchr.c b/src/common/solaris/memrchr.c new file mode 100644 index 0000000000..52570469a2 --- /dev/null +++ b/src/common/solaris/memrchr.c @@ -0,0 +1,15 @@ +#if defined(__sun) && ! defined(__illumos__) +#include + +void *memrchr(const void *s, int c, size_t n) +{ + if(n == 0) return NULL; + const unsigned char *p = (const unsigned char *)s + n; + while (n--) { + if (*(--p) == (unsigned char) c) + return (void*) p; + } + + return NULL; +} +#endif diff --git a/src/detection/gpu/gpu_pci.c b/src/detection/gpu/gpu_pci.c index 02923a286f..02191ae1d6 100644 --- a/src/detection/gpu/gpu_pci.c +++ b/src/detection/gpu/gpu_pci.c @@ -24,6 +24,10 @@ #define FF_STR_INDIR(x) #x #define FF_STR(x) FF_STR_INDIR(x) +#if defined(__sun) && ! defined(__illumos__) +extern void *memrchr(const void *, int, size_t); +#endif + static const FFstrbuf* loadPciIds() { static FFstrbuf pciids; From 0efcef8740b28cf1e1bccee643e461e4da819ed1 Mon Sep 17 00:00:00 2001 From: verdgil Date: Sun, 8 Feb 2026 11:24:03 +0300 Subject: [PATCH 3/7] Change to include fron extern --- src/common/solaris/memrchr.c | 2 +- src/common/solaris/memrchr.h | 6 ++++++ src/detection/gpu/gpu_pci.c | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 src/common/solaris/memrchr.h diff --git a/src/common/solaris/memrchr.c b/src/common/solaris/memrchr.c index 52570469a2..0e0c03d991 100644 --- a/src/common/solaris/memrchr.c +++ b/src/common/solaris/memrchr.c @@ -1,5 +1,5 @@ #if defined(__sun) && ! defined(__illumos__) -#include +#include "memrchr.h" void *memrchr(const void *s, int c, size_t n) { diff --git a/src/common/solaris/memrchr.h b/src/common/solaris/memrchr.h new file mode 100644 index 0000000000..9d9c5e3b39 --- /dev/null +++ b/src/common/solaris/memrchr.h @@ -0,0 +1,6 @@ +#pragma once +#include + +#if defined(__sun) && !defined(__illumos__) +void *memrchr(const void *s, int c, size_t n); +#endif \ No newline at end of file diff --git a/src/detection/gpu/gpu_pci.c b/src/detection/gpu/gpu_pci.c index 02191ae1d6..8d66bd9779 100644 --- a/src/detection/gpu/gpu_pci.c +++ b/src/detection/gpu/gpu_pci.c @@ -25,7 +25,7 @@ #define FF_STR(x) FF_STR_INDIR(x) #if defined(__sun) && ! defined(__illumos__) -extern void *memrchr(const void *, int, size_t); +#include "common/solaris/memrchr.h" #endif static const FFstrbuf* loadPciIds() From 31049d5c25a6552bb76ab6e5101450b206298dfe Mon Sep 17 00:00:00 2001 From: verdgil Date: Sun, 8 Feb 2026 11:29:40 +0300 Subject: [PATCH 4/7] add new line --- src/common/solaris/memrchr.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common/solaris/memrchr.h b/src/common/solaris/memrchr.h index 9d9c5e3b39..6e6453d821 100644 --- a/src/common/solaris/memrchr.h +++ b/src/common/solaris/memrchr.h @@ -3,4 +3,4 @@ #if defined(__sun) && !defined(__illumos__) void *memrchr(const void *s, int c, size_t n); -#endif \ No newline at end of file +#endif From f08ff02306592e0f670a56ebbb122ff504dd26ac Mon Sep 17 00:00:00 2001 From: verdgil Date: Sun, 8 Feb 2026 11:31:57 +0300 Subject: [PATCH 5/7] remove ; in zpool.c --- src/detection/zpool/zpool.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/detection/zpool/zpool.c b/src/detection/zpool/zpool.c index f277a8b3ea..3dd44a46af 100644 --- a/src/detection/zpool/zpool.c +++ b/src/detection/zpool/zpool.c @@ -16,7 +16,7 @@ typedef struct FFZfsData { FF_LIBRARY_SYMBOL(libzfs_fini) FF_LIBRARY_SYMBOL(zpool_get_prop_int) - FF_LIBRARY_SYMBOL(zpool_get_prop); + FF_LIBRARY_SYMBOL(zpool_get_prop) FF_LIBRARY_SYMBOL(zpool_close) // The fields in this struct store property IDs returned by `zpool_name_to_prop`, @@ -46,6 +46,12 @@ static inline int ff_zpool_get_prop_wrapper( boolean_t literal __attribute__((unused)) ) { + /* + Solaris header: + extern int zpool_get_prop(zpool_handle_t *, zpool_prop_t, char *, size_t __proplen, zprop_source_t *); + Illumos header: + extern int zpool_get_prop(zpool_handle_t *, zpool_prop_t, char *, size_t proplen, zprop_source_t *, boolean_t); + */ #if defined(__sun) && ! defined(__illumos__) return data->ffzpool_get_prop(zhp, prop, buf, len, srctype); #else @@ -69,12 +75,6 @@ static int enumZpoolCallback(zpool_handle_t* zpool, void* param) zprop_source_t source; FFZpoolResult* item = ffListAdd(data->result); char buf[1024]; - /* - Solaris: - extern int zpool_get_prop(zpool_handle_t *, zpool_prop_t, char *, size_t __proplen, zprop_source_t *); - Illumos: - extern int zpool_get_prop(zpool_handle_t *, zpool_prop_t, char *, size_t proplen, zprop_source_t *, boolean_t); - */ if (ff_zpool_get_prop_wrapper(data, zpool, data->props.name, buf, ARRAY_SIZE(buf), &source, false) == 0) ffStrbufInitS(&item->name, buf); else From b06465129be732e1da326d9cbcac484b574854cc Mon Sep 17 00:00:00 2001 From: verdgil Date: Mon, 9 Feb 2026 20:15:16 +0300 Subject: [PATCH 6/7] Change wrapper to macro Also change README.md --- README.md | 2 +- src/detection/zpool/zpool.c | 27 +++++---------------------- 2 files changed, 6 insertions(+), 23 deletions(-) diff --git a/README.md b/README.md index 789782a3d1..7fc0a17051 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ [![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/fastfetch-cli/fastfetch) [![中文README](https://img.shields.io/badge/%E4%B8%AD%E6%96%87-README-red)](README-cn.md) -Fastfetch is a [neofetch](https://github.com/dylanaraps/neofetch)-like tool for fetching system information and displaying it in a visually appealing way. It is written mainly in C, with a focus on performance and customizability. Currently, it supports Linux, macOS, Windows 7+, Android, FreeBSD, OpenBSD, NetBSD, DragonFly, Haiku, illumos (SunOS) and Solaris. +Fastfetch is a [neofetch](https://github.com/dylanaraps/neofetch)-like tool for fetching system information and displaying it in a visually appealing way. It is written mainly in C, with a focus on performance and customizability. Currently, it supports Linux, macOS, Windows 7+, Android, FreeBSD, OpenBSD, NetBSD, DragonFly, Haiku, illumos (SunOS), and Solaris. diff --git a/src/detection/zpool/zpool.c b/src/detection/zpool/zpool.c index 3dd44a46af..3bdfa489cc 100644 --- a/src/detection/zpool/zpool.c +++ b/src/detection/zpool/zpool.c @@ -36,29 +36,12 @@ typedef struct FFZfsData FFlist* result; } FFZfsData; -static inline int ff_zpool_get_prop_wrapper( - FFZfsData* data, - zpool_handle_t *zhp, - zpool_prop_t prop, - char *buf, - size_t len, - zprop_source_t *srctype, - boolean_t literal __attribute__((unused)) -) -{ - /* - Solaris header: - extern int zpool_get_prop(zpool_handle_t *, zpool_prop_t, char *, size_t __proplen, zprop_source_t *); - Illumos header: - extern int zpool_get_prop(zpool_handle_t *, zpool_prop_t, char *, size_t proplen, zprop_source_t *, boolean_t); - */ + #if defined(__sun) && ! defined(__illumos__) - return data->ffzpool_get_prop(zhp, prop, buf, len, srctype); -#else - return data->ffzpool_get_prop(zhp, prop, buf, len, srctype, literal); +#define ffzpool_get_prop(zhp, prop, buf, len, srctype, literal) \ + ffzpool_get_prop(zhp, prop, buf, len, srctype) #endif -} static inline void cleanLibzfs(FFZfsData* data) { @@ -75,11 +58,11 @@ static int enumZpoolCallback(zpool_handle_t* zpool, void* param) zprop_source_t source; FFZpoolResult* item = ffListAdd(data->result); char buf[1024]; - if (ff_zpool_get_prop_wrapper(data, zpool, data->props.name, buf, ARRAY_SIZE(buf), &source, false) == 0) + if (data->ffzpool_get_prop(zpool, data->props.name, buf, ARRAY_SIZE(buf), &source, false) == 0) ffStrbufInitS(&item->name, buf); else ffStrbufInitStatic(&item->name, "unknown"); - if (ff_zpool_get_prop_wrapper(data, zpool, data->props.health, buf, ARRAY_SIZE(buf), &source, false) == 0) + if (data->ffzpool_get_prop(zpool, data->props.health, buf, ARRAY_SIZE(buf), &source, false) == 0) ffStrbufInitS(&item->state, buf); else ffStrbufInitStatic(&item->state, "unknown"); From f38ded1771ba1701c6456e2c8da1a10e366caa1c Mon Sep 17 00:00:00 2001 From: Carter Li Date: Tue, 10 Feb 2026 17:22:56 +0800 Subject: [PATCH 7/7] Tweaks --- src/detection/zpool/zpool.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/detection/zpool/zpool.c b/src/detection/zpool/zpool.c index 3bdfa489cc..2f4a4a83fc 100644 --- a/src/detection/zpool/zpool.c +++ b/src/detection/zpool/zpool.c @@ -6,6 +6,11 @@ #ifdef __sun #include + #ifndef __illumos__ + // On Solaris 11, zpool_get_prop has only 5 arguments. #2173 + #define ffzpool_get_prop(zhp, prop, buf, len, srctype, literal) \ + ffzpool_get_prop(zhp, prop, buf, len, srctype) + #endif #else #include "libzfs_simplified.h" #endif @@ -36,13 +41,6 @@ typedef struct FFZfsData FFlist* result; } FFZfsData; - -#if defined(__sun) && ! defined(__illumos__) -#define ffzpool_get_prop(zhp, prop, buf, len, srctype, literal) \ - ffzpool_get_prop(zhp, prop, buf, len, srctype) -#endif - - static inline void cleanLibzfs(FFZfsData* data) { if (data->fflibzfs_fini && data->handle)