1 /*
2     SPDX-FileCopyrightText: 2014 Alex Richardson <arichardson.kde@gmail.com>
3 
4     SPDX-License-Identifier: LGPL-2.0-only
5 */
6 
7 #ifndef FILENAMESEARCH_P_H
8 #define FILENAMESEARCH_P_H
9 
10 // Copied from kio/src/core/kiogloba_p.h
11 
12 #include <qplatformdefs.h>
13 
14 #ifdef Q_OS_WIN
15 // windows just sets the mode_t access rights bits to the same value for user+group+other.
16 // This means using the Linux values here is fine.
17 #ifndef S_IRUSR
18 #define S_IRUSR 0400
19 #endif
20 #ifndef S_IRGRP
21 #define S_IRGRP 0040
22 #endif
23 #ifndef S_IROTH
24 #define S_IROTH 0004
25 #endif
26 
27 #ifndef S_IWUSR
28 #define S_IWUSR 0200
29 #endif
30 #ifndef S_IWGRP
31 #define S_IWGRP 0020
32 #endif
33 #ifndef S_IWOTH
34 #define S_IWOTH 0002
35 #endif
36 
37 #ifndef S_IXUSR
38 #define S_IXUSR 0100
39 #endif
40 #ifndef S_IXGRP
41 #define S_IXGRP 0010
42 #endif
43 #ifndef S_IXOTH
44 #define S_IXOTH 0001
45 #endif
46 
47 #ifndef S_IRWXU
48 #define S_IRWXU S_IRUSR | S_IWUSR | S_IXUSR
49 #endif
50 #ifndef S_IRWXG
51 #define S_IRWXG S_IRGRP | S_IWGRP | S_IXGRP
52 #endif
53 #ifndef S_IRWXO
54 #define S_IRWXO S_IROTH | S_IWOTH | S_IXOTH
55 #endif
56 Q_STATIC_ASSERT(S_IRUSR == _S_IREAD && S_IWUSR == _S_IWRITE && S_IXUSR == _S_IEXEC);
57 
58 // these three will never be set in st_mode
59 #ifndef S_ISUID
60 #define S_ISUID 04000 // SUID bit does not exist on windows
61 #endif
62 #ifndef S_ISGID
63 #define S_ISGID 02000 // SGID bit does not exist on windows
64 #endif
65 #ifndef S_ISVTX
66 #define S_ISVTX 01000 // sticky bit does not exist on windows
67 #endif
68 
69 // Windows does not have S_IFBLK and S_IFSOCK, just use the Linux values, they won't conflict
70 #ifndef S_IFBLK
71 #define S_IFBLK 0060000
72 #endif
73 #ifndef S_IFSOCK
74 #define S_IFSOCK 0140000
75 #endif
76 
77 #endif // Q_OS_WIN
78 
79 #endif // FILENAMESEARCH_P_H