#include <thread>
#ifndef _WIN32
#include <sys/mount.h>
+#else
+#include <stdlib.h>
#endif
#include <sys/param.h>
#include <sys/socket.h>
return val;
}
+int random() {
+ return rand();
+}
+
int fsync(int fd) {
HANDLE handle = (HANDLE*)_get_osfhandle(fd);
if (handle == INVALID_HANDLE_VALUE)
return SOCKET_ERROR;
}
+unsigned get_page_size() {
+ SYSTEM_INFO system_info;
+ GetSystemInfo(&system_info);
+ return system_info.dwPageSize;
+}
+
+int setenv(const char *name, const char *value, int overwrite) {
+ if (!overwrite && getenv(name)) {
+ return 0;
+ }
+ return _putenv_s(name, value);
+}
+
+#else
+
+unsigned get_page_size() {
+ return sysconf(_SC_PAGESIZE);
+}
+
#endif /* _WIN32 */
int pipe_cloexec(int pipefd[2], int flags);
char *ceph_strerror_r(int errnum, char *buf, size_t buflen);
+unsigned get_page_size();
#ifdef __cplusplus
}
#define WIN32_ERROR 0
#undef ERROR
+#ifndef uint
+typedef unsigned int uint;
+#endif
+
typedef _sigset_t sigset_t;
typedef int uid_t;
#define ENODATA 120
#endif
+#ifndef EDQUOT
+#define EDQUOT ENOSPC
+#endif
+
#define ESHUTDOWN ECONNABORTED
#define ESTALE 256
#define EREMOTEIO 257
ssize_t pwrite(int fd, const void *buf, size_t count, off_t offset);
long int lrand48(void);
+int random();
int pipe(int pipefd[2]);
int chown(const char *path, uid_t owner, gid_t group);
int fchown(int fd, uid_t owner, gid_t group);
int lchown(const char *path, uid_t owner, gid_t group);
+int setenv(const char *name, const char *value, int overwrite);
+#define unsetenv(name) _putenv_s(name, "")
int win_socketpair(int socks[2]);
+#ifdef __MINGW32__
+extern _CRTIMP errno_t __cdecl _putenv_s(const char *_Name,const char *_Value);
+#endif
+
#ifdef __cplusplus
}
#endif
};
#else
-#include <sys/resource.h>
#ifdef RLIMIT_CORE
+#include <sys/resource.h>
#include <iostream>
#include <sys/resource.h>
#include "common/errno.h"