#pragma once
#ifndef _WIN32
#include <unistd.h>
#if defined(__APPLE__) || defined(__EMSCRIPTEN__)
off64_t;
off64_t lseek64(int fh, off64_t off, int orig);
ssize_t pread64(int fd, void* buf, size_t count, off64_t offset);
#endif
#else
#include <cstdint>
#include <process.h>
#include <sys/locking.h>
#include <folly/Portability.h>
#include <folly/portability/SysTypes.h>
#define _SC_PAGESIZE …
#define _SC_PAGE_SIZE …
#define _SC_NPROCESSORS_ONLN …
#define _SC_NPROCESSORS_CONF …
#define STDIN_FILENO …
#define STDOUT_FILENO …
#define STDERR_FILENO …
#define F_OK …
#define X_OK …
#define W_OK …
#define R_OK …
#define RW_OK …
#define F_LOCK …
#define F_ULOCK …
namespace folly {
namespace portability {
namespace unistd {
using off64_t = int64_t;
int access(char const* fn, int am);
int chdir(const char* path);
int close(int fh);
int dup(int fh);
int dup2(int fhs, int fhd);
int fsync(int fd);
int ftruncate(int fd, off_t len);
char* getcwd(char* buf, int sz);
int getdtablesize();
int getgid();
pid_t getppid();
int getuid();
int isatty(int fh);
int lockf(int fd, int cmd, off_t len);
off_t lseek(int fh, off_t off, int orig);
off64_t lseek64(int fh, off64_t off, int orig);
ssize_t read(int fh, void* buf, size_t mcc);
int rmdir(const char* path);
int pipe(int pth[2]);
ssize_t pread(int fd, void* buf, size_t count, off_t offset);
ssize_t pread64(int fd, void* buf, size_t count, off64_t offset);
ssize_t pwrite(int fd, const void* buf, size_t count, off_t offset);
ssize_t readlink(const char* path, char* buf, size_t buflen);
void* sbrk(intptr_t i);
unsigned int sleep(unsigned int seconds);
long sysconf(int tp);
int truncate(const char* path, off_t len);
int usleep(unsigned int ms);
ssize_t write(int fh, void const* buf, size_t count);
}
}
}
FOLLY_PUSH_WARNING
FOLLY_CLANG_DISABLE_WARNING("-Wheader-hygiene")
using namespace folly::portability::unistd;
FOLLY_POP_WARNING
#endif