14#include "mythconfig.h"
19 typedef off_t off64_t;
20# define lseek64(f,o,w) lseek(f,o,w)
25# define S_IREAD S_IRUSR
28# define S_IWRITE S_IRUSR
34# include <sys/resource.h>
35# include <sys/socket.h>
39# define close wsock_close
76 #if defined(__cplusplus)
79 typedef unsigned int uint;
83# if defined(__cplusplus)
85# define setenv(x, y, z) ::SetEnvironmentVariableA(x, y)
101#pragma GCC diagnostic push
102#pragma GCC diagnostic ignored "-Wshadow"
105 DWORD spc = 0, bps = 0, fc = 0, c = 0;
107 if (buffer && GetDiskFreeSpaceA(path, &spc, &bps, &fc, &c))
117#pragma GCC diagnostic pop
121#define nice(x) ((int)!::SetPriorityClass(\
122 ::GetCurrentProcess(), ((x) < -10) ? \
123 HIGH_PRIORITY_CLASS : (((x) < 0) ? \
124 ABOVE_NORMAL_PRIORITY_CLASS : (((x) > 10) ? \
125 IDLE_PRIORITY_CLASS : (((x) > 0) ? \
126 BELOW_NORMAL_PRIORITY_CLASS : \
127 NORMAL_PRIORITY_CLASS)))))
128#define PRIO_PROCESS 0
129#define setpriority(x, y, z) ((x) == PRIO_PROCESS && y == 0 ? nice(z) : -1)
147 #define mkfifo(path, mode) \
148 (CreateNamedPipeA(path, PIPE_ACCESS_DUPLEX | WRITE_DAC, \
149 PIPE_WAIT, PIPE_UNLIMITED_INSTANCES, \
150 1024, 1024, 10000, nullptr) == INVALID_HANDLE_VALUE ? -1 : 0)
153# define dlopen(x, y) LoadLibraryA((x))
154# define dlclose(x) !FreeLibrary((HMODULE)(x))
155# define dlsym(x, y) GetProcAddress((HMODULE)(x), (y))
161 #define DLERR_MAX 512
163 DWORD errCode = GetLastError();
165 if (!FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM |
166 FORMAT_MESSAGE_IGNORE_INSERTS |
167 FORMAT_MESSAGE_MAX_WIDTH_MASK,
169 MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
172 "dlopen()/dlsym() caused error %d", (
int)errCode);
178# define dlerror() "dlerror() is unimplemented."
189# define daemon(x, y) -1
190# define getloadavg(x, y) -1
193# define WIFEXITED(w) (((w) & 0xff) == 0)
194# define WIFSIGNALED(w) (((w) & 0x7f) > 0 && (((w) & 0x7f) < 0x7f))
195# define WIFSTOPPED(w) (((w) & 0xff) == 0x7f)
196# define WEXITSTATUS(w) (((w) >> 8) & 0xff)
197# define WTERMSIG(w) ((w) & 0x7f)
204 #include <sys/time.h>
207 #pragma warning(disable:4786)
217 #define strtoll _strtoi64
218 #define strncasecmp _strnicmp
219 #define snprintf _snprintf
222 using ssize_t = __int64;
230 #if (_MSC_VER < 1800)
231 #define rint( x ) floor(x + 0.5)
232 #define round( x ) floor(x + 0.5)
234 #if ( _MSC_VER < 1700)
235 #define signbit( x ) ( x < 0 )
239 #define M_PI 3.14159265358979323846
242 #define getpid() _getpid()
243 #define ftruncate( fd, fsize ) _chsize( fd, fsize )
247 # define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
249 # define S_ISCHR(m) 0
254 # define S_ISBLK(m) 0
258 # define S_ISREG(m) 1
263 # define S_ISDIR(m) (((m) & S_IFDIR) == S_IFDIR )
265 # define S_ISDIR(m) 0
269 using mode_t = uint32_t;
271 #if !defined(__cplusplus) && !defined( inline )
272 # define inline __inline
275 #if !defined(__func__)
276 # define __func__ __FUNCTION__
279# define SIGTRAP SIGBREAK
280# define STDERR_FILENO (int)GetStdHandle( STD_ERROR_HANDLE )
283# define S_IRUSR _S_IREAD
285# define lseek64( f, o, w ) _lseeki64( f, o, w )
292# define O_NONBLOCK 04000
int statfs(const char *path, struct statfs *buffer)
const char * dlerror(void)