mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-09-13 02:42:09 +02:00
SunOS: support InitSystem
This commit is contained in:
+2
-1
@@ -773,7 +773,7 @@ elseif(SunOS)
|
||||
src/detection/gtk_qt/gtk.c
|
||||
src/detection/host/host_windows.c
|
||||
src/detection/icons/icons_linux.c
|
||||
src/detection/initsystem/initsystem_nosupport.c
|
||||
src/detection/initsystem/initsystem_linux.c
|
||||
src/detection/libc/libc_nosupport.c
|
||||
src/detection/lm/lm_nosupport.c
|
||||
src/detection/loadavg/loadavg_nosupport.c
|
||||
@@ -1130,6 +1130,7 @@ elseif(SunOS)
|
||||
PRIVATE "socket"
|
||||
PRIVATE "kstat"
|
||||
PRIVATE "pciaccess"
|
||||
PRIVATE "proc"
|
||||
)
|
||||
elseif(ANDROID)
|
||||
CHECK_LIBRARY_EXISTS(-l:libandroid-wordexp.a wordexp "" HAVE_LIBANDROID_WORDEXP_STATIC)
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
#include <sys/user.h>
|
||||
#include <sys/sysctl.h>
|
||||
#endif
|
||||
#ifdef __APPLE__
|
||||
#if defined(__APPLE__) || defined(__sun)
|
||||
#include <libproc.h>
|
||||
#endif
|
||||
|
||||
@@ -113,6 +113,15 @@ const char* ffProcessAppendOutput(FFstrbuf* buffer, char* const argv[], bool use
|
||||
return "read(childPipeFd, str, FF_PIPE_BUFSIZ) failed";
|
||||
}
|
||||
|
||||
#ifdef __sun
|
||||
void freeProcHandle(struct ps_prochandle** phandle)
|
||||
{
|
||||
assert(phandle);
|
||||
if (*phandle)
|
||||
Pfree(*phandle);
|
||||
}
|
||||
#endif
|
||||
|
||||
void ffProcessGetInfoLinux(pid_t pid, FFstrbuf* processName, FFstrbuf* exe, const char** exeName, FFstrbuf* exePath)
|
||||
{
|
||||
assert(processName->length > 0);
|
||||
@@ -335,6 +344,22 @@ const char* ffProcessGetBasicInfoLinux(pid_t pid, FFstrbuf* name, pid_t* ppid, i
|
||||
*tty = -1;
|
||||
}
|
||||
|
||||
#elif defined(__sun)
|
||||
int err;
|
||||
__attribute__((__cleanup__(freeProcHandle))) struct ps_prochandle* handle = Pgrab(pid, PGRAB_RDONLY, &err);
|
||||
if (!handle)
|
||||
return "Pgrab() failed";
|
||||
|
||||
const psinfo_t* proc = Ppsinfo(handle);
|
||||
if (!proc)
|
||||
return "Ppsinfo() failed";
|
||||
|
||||
ffStrbufSetS(name, proc->pr_fname);
|
||||
if (ppid)
|
||||
*ppid = proc->pr_ppid;
|
||||
if (tty)
|
||||
*tty = (int) proc->pr_ttydev;
|
||||
|
||||
#else
|
||||
|
||||
return "Unsupported platform";
|
||||
|
||||
Reference in New Issue
Block a user