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)
82#define nice(x) ((int)!::SetPriorityClass(\
83 ::GetCurrentProcess(), ((x) < -10) ? \
84 HIGH_PRIORITY_CLASS : (((x) < 0) ? \
85 ABOVE_NORMAL_PRIORITY_CLASS : (((x) > 10) ? \
86 IDLE_PRIORITY_CLASS : (((x) > 0) ? \
87 BELOW_NORMAL_PRIORITY_CLASS : \
88 NORMAL_PRIORITY_CLASS)))))
90#define setpriority(x, y, z) ((x) == PRIO_PROCESS && y == 0 ? nice(z) : -1)
108 #define mkfifo(path, mode) \
109 (CreateNamedPipeA(path, PIPE_ACCESS_DUPLEX | WRITE_DAC, \
110 PIPE_WAIT, PIPE_UNLIMITED_INSTANCES, \
111 1024, 1024, 10000, nullptr) == INVALID_HANDLE_VALUE ? -1 : 0)
114# define dlopen(x, y) LoadLibraryA((x))
115# define dlclose(x) !FreeLibrary((HMODULE)(x))
116# define dlsym(x, y) GetProcAddress((HMODULE)(x), (y))
122 #define DLERR_MAX 512
124 DWORD errCode = GetLastError();
126 if (!FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM |
127 FORMAT_MESSAGE_IGNORE_INSERTS |
128 FORMAT_MESSAGE_MAX_WIDTH_MASK,
130 MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
133 "dlopen()/dlsym() caused error %d", (
int)errCode);
139# define dlerror() "dlerror() is unimplemented."
150# define daemon(x, y) -1
151# define getloadavg(x, y) -1
154# define WIFEXITED(w) (((w) & 0xff) == 0)
155# define WIFSIGNALED(w) (((w) & 0x7f) > 0 && (((w) & 0x7f) < 0x7f))
156# define WIFSTOPPED(w) (((w) & 0xff) == 0x7f)
157# define WEXITSTATUS(w) (((w) >> 8) & 0xff)
158# define WTERMSIG(w) ((w) & 0x7f)
165 #include <sys/time.h>
168 #pragma warning(disable:4786)
174 #define strtoll _strtoi64
175 #define strncasecmp _strnicmp
176 #define snprintf _snprintf
179 using ssize_t = __int64;
187 #define getpid() _getpid()
188 #define ftruncate( fd, fsize ) _chsize( fd, fsize )
192 # define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
194 # define S_ISCHR(m) 0
199 # define S_ISBLK(m) 0
203 # define S_ISREG(m) 1
208 # define S_ISDIR(m) (((m) & S_IFDIR) == S_IFDIR )
210 # define S_ISDIR(m) 0
214 using mode_t = uint32_t;
216# define SIGTRAP SIGBREAK
217# define STDERR_FILENO (int)GetStdHandle( STD_ERROR_HANDLE )
220# define S_IRUSR _S_IREAD
222# define lseek _lseeki64
223# define off_t __int64
228# define O_NONBLOCK 04000
const char * dlerror(void)