1 // Formatting library for C++ - mocks of POSIX functions
3 // Copyright (c) 2012 - present, Victor Zverovich
4 // All rights reserved.
6 // For the license information refer to format.h.
8 #ifndef FMT_POSIX_TEST_H
9 #define FMT_POSIX_TEST_H
21 # include <sys/param.h> // for FreeBSD version
22 # include <sys/types.h> // for ssize_t
32 // Size type for read and write.
33 using size_t = size_t;
34 using ssize_t
= ssize_t
;
35 int open(const char* path
, int oflag
, int mode
);
36 int fstat(int fd
, struct stat
* buf
);
38 using size_t = unsigned;
43 long sysconf(int name
);
45 DWORD
GetFileSize(HANDLE hFile
, LPDWORD lpFileSizeHigh
);
48 int close(int fildes
);
51 int dup2(int fildes
, int fildes2
);
53 FILE* fdopen(int fildes
, const char* mode
);
55 ssize_t
read(int fildes
, void* buf
, size_t nbyte
);
56 ssize_t
write(int fildes
, const void* buf
, size_t nbyte
);
59 int pipe(int fildes
[2]);
61 int pipe(int* pfds
, unsigned psize
, int textmode
);
64 FILE* fopen(const char* filename
, const char* mode
);
65 int fclose(FILE* stream
);
66 int(fileno
)(FILE* stream
);
68 #if defined(FMT_LOCALE) && !defined(_WIN32)
69 locale_t
newlocale(int category_mask
, const char* locale
, locale_t base
);
73 #define FMT_SYSTEM(call) test::call
75 #endif // FMT_POSIX_TEST_H