1 | /* |
2 | * Copyright 2016-present 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 <sys/stat.h> |
20 | |
21 | #ifdef _WIN32 |
22 | #include <folly/portability/SysTypes.h> |
23 | |
24 | // Windows gives weird names to these. |
25 | #define S_IXUSR 0 |
26 | #define S_IWUSR _S_IWRITE |
27 | #define S_IRUSR _S_IREAD |
28 | // No group/other permissions so default to user. |
29 | #define S_IXGRP S_IXUSR |
30 | #define S_IWGRP S_IWUSR |
31 | #define S_IRGRP S_IRUSR |
32 | #define S_IXOTH S_IXUSR |
33 | #define S_IWOTH S_IWUSR |
34 | #define S_IROTH S_IRUSR |
35 | #define S_IRWXU (S_IRUSR | S_IWUSR | S_IXUSR) |
36 | #define S_IRWXG (S_IRGRP | S_IWGRP | S_IXGRP) |
37 | |
38 | #define S_ISDIR(mode) (((mode) & (_S_IFDIR)) == (_S_IFDIR) ? 1 : 0) |
39 | |
40 | // This isn't defined anywhere, so give a sane value. |
41 | #define MAXSYMLINKS 255 |
42 | |
43 | extern "C" { |
44 | int chmod(char const* fn, int am); |
45 | int fchmod(int fd, mode_t mode); |
46 | int lstat(const char* path, struct stat* st); |
47 | int mkdir(const char* fn, int mode); |
48 | int umask(int md); |
49 | } |
50 | #endif |
51 | |