12#include "mythconfig.h"
16# define S_IREAD S_IRUSR
19# define S_IWRITE S_IRUSR
25# include <sys/resource.h>
26# include <sys/socket.h>
30# define close wsock_close
67 #if defined(__cplusplus)
70 typedef unsigned int uint;
74# if defined(__cplusplus)
76# define setenv(x, y, z) ::SetEnvironmentVariableA(x, y)
92#pragma GCC diagnostic push
93#pragma GCC diagnostic ignored "-Wshadow"
96 DWORD spc = 0, bps = 0, fc = 0, c = 0;
98 if (buffer && GetDiskFreeSpaceA(path, &spc, &bps, &fc, &c))
108#pragma GCC diagnostic pop
112#define nice(x) ((int)!::SetPriorityClass(\
113 ::GetCurrentProcess(), ((x) < -10) ? \
114 HIGH_PRIORITY_CLASS : (((x) < 0) ? \
115 ABOVE_NORMAL_PRIORITY_CLASS : (((x) > 10) ? \
116 IDLE_PRIORITY_CLASS : (((x) > 0) ? \
117 BELOW_NORMAL_PRIORITY_CLASS : \
118 NORMAL_PRIORITY_CLASS)))))
119#define PRIO_PROCESS 0
120#define setpriority(x, y, z) ((x) == PRIO_PROCESS && y == 0 ? nice(z) : -1)
138 #define mkfifo(path, mode) \
139 (CreateNamedPipeA(path, PIPE_ACCESS_DUPLEX | WRITE_DAC, \
140 PIPE_WAIT, PIPE_UNLIMITED_INSTANCES, \
141 1024, 1024, 10000, nullptr) == INVALID_HANDLE_VALUE ? -1 : 0)
144# define dlopen(x, y) LoadLibraryA((x))
145# define dlclose(x) !FreeLibrary((HMODULE)(x))
146# define dlsym(x, y) GetProcAddress((HMODULE)(x), (y))
152 #define DLERR_MAX 512
154 DWORD errCode = GetLastError();
156 if (!FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM |
157 FORMAT_MESSAGE_IGNORE_INSERTS |
158 FORMAT_MESSAGE_MAX_WIDTH_MASK,
160 MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
163 "dlopen()/dlsym() caused error %d", (
int)errCode);
169# define dlerror() "dlerror() is unimplemented."
180# define daemon(x, y) -1
181# define getloadavg(x, y) -1
184# define WIFEXITED(w) (((w) & 0xff) == 0)
185# define WIFSIGNALED(w) (((w) & 0x7f) > 0 && (((w) & 0x7f) < 0x7f))
186# define WIFSTOPPED(w) (((w) & 0xff) == 0x7f)
187# define WEXITSTATUS(w) (((w) >> 8) & 0xff)
188# define WTERMSIG(w) ((w) & 0x7f)
195 #include <sys/time.h>
198 #pragma warning(disable:4786)
204 #define strtoll _strtoi64
205 #define strncasecmp _strnicmp
206 #define snprintf _snprintf
209 using ssize_t = __int64;
217 #define getpid() _getpid()
218 #define ftruncate( fd, fsize ) _chsize( fd, fsize )
222 # define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
224 # define S_ISCHR(m) 0
229 # define S_ISBLK(m) 0
233 # define S_ISREG(m) 1
238 # define S_ISDIR(m) (((m) & S_IFDIR) == S_IFDIR )
240 # define S_ISDIR(m) 0
244 using mode_t = uint32_t;
246# define SIGTRAP SIGBREAK
247# define STDERR_FILENO (int)GetStdHandle( STD_ERROR_HANDLE )
250# define S_IRUSR _S_IREAD
252# define lseek _lseeki64
253# define off_t __int64
258# define O_NONBLOCK 04000
int statfs(const char *path, struct statfs *buffer)
const char * dlerror(void)