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..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, 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..0e0c03d991 --- /dev/null +++ b/src/common/solaris/memrchr.c @@ -0,0 +1,15 @@ +#if defined(__sun) && ! defined(__illumos__) +#include "memrchr.h" + +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/common/solaris/memrchr.h b/src/common/solaris/memrchr.h new file mode 100644 index 0000000000..6e6453d821 --- /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 diff --git a/src/detection/gpu/gpu_pci.c b/src/detection/gpu/gpu_pci.c index 02923a286f..8d66bd9779 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__) +#include "common/solaris/memrchr.h" +#endif + static const FFstrbuf* loadPciIds() { static FFstrbuf pciids; diff --git a/src/detection/zpool/zpool.c b/src/detection/zpool/zpool.c index ca2c31a281..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