folly: fix sysMembarrier() with newer kernel headers
[folly.git] / folly / portability / Fcntl.h
1 /*
2  * Copyright 2017 Facebook, Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *   http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 #pragma once
18
19 #include <fcntl.h>
20
21 #ifdef _WIN32
22 #include <sys/types.h>
23
24 // I have no idea what the normal values for these are,
25 // and really don't care what they are. They're only used
26 // within fcntl, so it's not an issue.
27 #define FD_CLOEXEC HANDLE_FLAG_INHERIT
28 #define O_NONBLOCK 1
29 #define F_GETFD 1
30 #define F_SETFD 2
31 #define F_GETFL 3
32 #define F_SETFL 4
33
34 #ifdef HAVE_POSIX_FALLOCATE
35 #undef HAVE_POSIX_FALLOCATE
36 #endif
37 #define HAVE_POSIX_FALLOCATE 1
38
39 // See portability/Unistd.h for why these need to be in a namespace
40 // rather then extern "C".
41 namespace folly {
42 namespace portability {
43 namespace fcntl {
44 int creat(char const* fn, int pm);
45 int fcntl(int fd, int cmd, ...);
46 int posix_fallocate(int fd, off_t offset, off_t len);
47 int open(char const* fn, int of, int pm = 0);
48 }
49 }
50 }
51
52 /* using override */ using namespace folly::portability::fcntl;
53 #endif