9#if QT_VERSION >= QT_VERSION_CHECK(6,5,0)
10#include <QtSystemDetection>
15# define S_IREAD S_IRUSR
18# define S_IWRITE S_IRUSR
24# include <sys/resource.h>
25# include <sys/socket.h>
28# define close wsock_close
62# define setenv(x, y, z) ::SetEnvironmentVariableA(x, y)
66#define nice(x) ((int)!::SetPriorityClass(\
67 ::GetCurrentProcess(), ((x) < -10) ? \
68 HIGH_PRIORITY_CLASS : (((x) < 0) ? \
69 ABOVE_NORMAL_PRIORITY_CLASS : (((x) > 10) ? \
70 IDLE_PRIORITY_CLASS : (((x) > 0) ? \
71 BELOW_NORMAL_PRIORITY_CLASS : \
72 NORMAL_PRIORITY_CLASS)))))
74#define setpriority(x, y, z) ((x) == PRIO_PROCESS && y == 0 ? nice(z) : -1)
92 #define mkfifo(path, mode) \
93 (CreateNamedPipeA(path, PIPE_ACCESS_DUPLEX | WRITE_DAC, \
94 PIPE_WAIT, PIPE_UNLIMITED_INSTANCES, \
95 1024, 1024, 10000, nullptr) == INVALID_HANDLE_VALUE ? -1 : 0)
98# define dlopen(x, y) LoadLibraryA((x))
99# define dlclose(x) !FreeLibrary((HMODULE)(x))
100# define dlsym(x, y) GetProcAddress((HMODULE)(x), (y))
105 #define DLERR_MAX 512
107 DWORD errCode = GetLastError();
109 if (!FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM |
110 FORMAT_MESSAGE_IGNORE_INSERTS |
111 FORMAT_MESSAGE_MAX_WIDTH_MASK,
113 MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
116 "dlopen()/dlsym() caused error %d", (
int)errCode);
129# define daemon(x, y) -1
130# define getloadavg(x, y) -1
133# define WIFEXITED(w) (((w) & 0xff) == 0)
134# define WIFSIGNALED(w) (((w) & 0x7f) > 0 && (((w) & 0x7f) < 0x7f))
135# define WIFSTOPPED(w) (((w) & 0xff) == 0x7f)
136# define WEXITSTATUS(w) (((w) >> 8) & 0xff)
137# define WTERMSIG(w) ((w) & 0x7f)
142# define O_NONBLOCK 04000
const char * dlerror(void)