]> git.proxmox.com Git - ceph.git/blame - ceph/src/seastar/fmt/test/posix-mock.h
update download target update for octopus release
[ceph.git] / ceph / src / seastar / fmt / test / posix-mock.h
CommitLineData
11fdf7f2
TL
1// Formatting library for C++ - mocks of POSIX functions
2//
3// Copyright (c) 2012 - present, Victor Zverovich
4// All rights reserved.
5//
6// For the license information refer to format.h.
7
8#ifndef FMT_POSIX_TEST_H
9#define FMT_POSIX_TEST_H
10
11#include <errno.h>
12#include <stdio.h>
13
14#ifdef _WIN32
15# include <windows.h>
16#else
17# include <sys/param.h> // for FreeBSD version
18# include <sys/types.h> // for ssize_t
19#endif
20
21#ifndef _MSC_VER
22struct stat;
23#endif
24
25namespace test {
26
27#ifndef _MSC_VER
28// Size type for read and write.
29typedef size_t size_t;
30typedef ssize_t ssize_t;
31int open(const char *path, int oflag, int mode);
32int fstat(int fd, struct stat *buf);
33#else
34typedef unsigned size_t;
35typedef int ssize_t;
36errno_t sopen_s(
37 int* pfh, const char *filename, int oflag, int shflag, int pmode);
38#endif
39
40#ifndef _WIN32
41long sysconf(int name);
42#else
43DWORD GetFileSize(HANDLE hFile, LPDWORD lpFileSizeHigh);
44#endif
45
46int close(int fildes);
47
48int dup(int fildes);
49int dup2(int fildes, int fildes2);
50
51FILE *fdopen(int fildes, const char *mode);
52
53ssize_t read(int fildes, void *buf, size_t nbyte);
54ssize_t write(int fildes, const void *buf, size_t nbyte);
55
56#ifndef _WIN32
57int pipe(int fildes[2]);
58#else
59int pipe(int *pfds, unsigned psize, int textmode);
60#endif
61
62FILE *fopen(const char *filename, const char *mode);
63int fclose(FILE *stream);
64int (fileno)(FILE *stream);
65} // namespace test
66
67#define FMT_SYSTEM(call) test::call
68
69#endif // FMT_POSIX_TEST_H