mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-11-06 13:14:21 +01:00
SunOS: support swap & opengl detection
This commit is contained in:
@@ -259,7 +259,11 @@ static const char* glxPrint(FFOpenGLResult* result)
|
||||
#endif //FF_HAVE_GLX
|
||||
|
||||
#ifdef FF_HAVE_OSMESA
|
||||
#include <GL/osmesa.h>
|
||||
#if __has_include(<GL/osmesa.h>)
|
||||
#include <GL/osmesa.h>
|
||||
#else
|
||||
#include <mesa/osmesa.h> // for sunos
|
||||
#endif
|
||||
|
||||
typedef struct OSMesaData
|
||||
{
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
#include "swap.h"
|
||||
#include <sys/stat.h>
|
||||
#include <sys/swap.h>
|
||||
#include <limits.h>
|
||||
|
||||
enum { FFMaxNSwap = 8 };
|
||||
|
||||
const char* ffDetectSwap(FFSwapResult* swap)
|
||||
{
|
||||
char strings[FFMaxNSwap][PATH_MAX];
|
||||
uint8_t buffer[sizeof(swaptbl_t) + sizeof(swapent_t) * (FFMaxNSwap - 1)] = {};
|
||||
swaptbl_t* table = (swaptbl_t*) buffer;
|
||||
table->swt_n = FFMaxNSwap;
|
||||
for (int i = 0; i < FFMaxNSwap; ++i)
|
||||
table->swt_ent[i].ste_path = strings[i];
|
||||
|
||||
int size = swapctl(SC_LIST, table);
|
||||
if (size < 0)
|
||||
return "swapctl() failed";
|
||||
|
||||
swap->bytesTotal = swap->bytesUsed = 0;
|
||||
|
||||
for (int i = 0; i < size; ++i)
|
||||
{
|
||||
swap->bytesTotal += (uint64_t) table->swt_ent[i].ste_pages;
|
||||
swap->bytesUsed += (uint64_t) table->swt_ent[i].ste_free;
|
||||
}
|
||||
swap->bytesUsed = swap->bytesTotal - swap->bytesUsed;
|
||||
swap->bytesTotal *= instance.state.platform.pageSize;
|
||||
swap->bytesUsed *= instance.state.platform.pageSize;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
#include "common/option.h"
|
||||
|
||||
#if defined(__linux__) || defined(__FreeBSD__)
|
||||
#if defined(__linux__) || defined(__FreeBSD__) || defined(__sun)
|
||||
typedef enum FFOpenGLLibrary
|
||||
{
|
||||
FF_OPENGL_LIBRARY_AUTO,
|
||||
@@ -19,7 +19,7 @@ typedef struct FFOpenGLOptions
|
||||
FFModuleBaseInfo moduleInfo;
|
||||
FFModuleArgs moduleArgs;
|
||||
|
||||
#if defined(__linux__) || defined(__FreeBSD__)
|
||||
#if defined(__linux__) || defined(__FreeBSD__) || defined(__sun)
|
||||
FFOpenGLLibrary library;
|
||||
#endif
|
||||
} FFOpenGLOptions;
|
||||
|
||||
Reference in New Issue
Block a user