2022-07-25 14:45:41 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include "util/FFstrbuf.h"
|
|
|
|
|
|
2024-05-28 23:46:13 +08:00
|
|
|
#include <sys/types.h>
|
|
|
|
|
|
2023-07-10 21:02:13 +08:00
|
|
|
const char* ffProcessAppendOutput(FFstrbuf* buffer, char* const argv[], bool useStdErr);
|
|
|
|
|
|
|
|
|
|
static inline const char* ffProcessAppendStdOut(FFstrbuf* buffer, char* const argv[])
|
|
|
|
|
{
|
2023-07-20 16:10:13 +08:00
|
|
|
const char* error = ffProcessAppendOutput(buffer, argv, false);
|
|
|
|
|
if (!error)
|
2024-05-03 13:46:28 +08:00
|
|
|
ffStrbufTrimRightSpace(buffer);
|
2023-07-15 15:46:19 +08:00
|
|
|
return error;
|
2023-07-10 21:02:13 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline const char* ffProcessAppendStdErr(FFstrbuf* buffer, char* const argv[])
|
|
|
|
|
{
|
2023-07-20 16:10:13 +08:00
|
|
|
const char* error = ffProcessAppendOutput(buffer, argv, true);
|
|
|
|
|
if (!error)
|
2024-05-03 13:46:28 +08:00
|
|
|
ffStrbufTrimRightSpace(buffer);
|
2023-07-15 15:46:19 +08:00
|
|
|
return error;
|
2023-07-10 21:02:13 +08:00
|
|
|
}
|
2024-05-28 22:34:41 +08:00
|
|
|
|
|
|
|
|
#ifdef _WIN32
|
|
|
|
|
bool ffProcessGetInfoWindows(uint32_t pid, uint32_t* ppid, FFstrbuf* pname, FFstrbuf* exe, const char** exeName, FFstrbuf* exePath, bool* gui);
|
|
|
|
|
#else
|
|
|
|
|
void ffProcessGetInfoLinux(pid_t pid, FFstrbuf* processName, FFstrbuf* exe, const char** exeName, FFstrbuf* exePath);
|
2024-05-28 23:46:13 +08:00
|
|
|
const char* ffProcessGetBasicInfoLinux(pid_t pid, FFstrbuf* name, pid_t* ppid, int32_t* tty);
|
2024-05-28 22:34:41 +08:00
|
|
|
#endif
|