1 /*
2  * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
3  *
4  * SPDX-License-Identifier: MPL-2.0
5  *
6  * This Source Code Form is subject to the terms of the Mozilla Public
7  * License, v. 2.0.  If a copy of the MPL was not distributed with this
8  * file, you can obtain one at https://mozilla.org/MPL/2.0/.
9  *
10  * See the COPYRIGHT file distributed with this work for additional
11  * information regarding copyright ownership.
12  */
13 
14 #ifndef ISC_STAT_H
15 #define ISC_STAT_H 1
16 
17 #include <sys/stat.h>
18 
19 /*
20  * Windows doesn't typedef this.
21  */
22 typedef unsigned short mode_t;
23 
24 /* open() under unix allows setting of read/write permissions
25  * at the owner, group and other levels.  These don't exist in NT
26  * We'll just map them all to the NT equivalent
27  */
28 
29 #define S_IREAD	 _S_IREAD  /* read permission, owner */
30 #define S_IWRITE _S_IWRITE /* write permission, owner */
31 #define S_IRUSR	 _S_IREAD  /* Owner read permission */
32 #define S_IWUSR	 _S_IWRITE /* Owner write permission */
33 #define S_IRGRP	 _S_IREAD  /* Group read permission */
34 #define S_IWGRP	 _S_IWRITE /* Group write permission */
35 #define S_IROTH	 _S_IREAD  /* Other read permission */
36 #define S_IWOTH	 _S_IWRITE /* Other write permission */
37 
38 #ifndef S_IFMT
39 #define S_IFMT _S_IFMT
40 #endif /* ifndef S_IFMT */
41 #ifndef S_IFDIR
42 #define S_IFDIR _S_IFDIR
43 #endif /* ifndef S_IFDIR */
44 #ifndef S_IFCHR
45 #define S_IFCHR _S_IFCHR
46 #endif /* ifndef S_IFCHR */
47 #ifndef S_IFREG
48 #define S_IFREG _S_IFREG
49 #endif /* ifndef S_IFREG */
50 
51 #ifndef S_ISDIR
52 #define S_ISDIR(m) (((m)&S_IFMT) == S_IFDIR)
53 #endif /* ifndef S_ISDIR */
54 #ifndef S_ISREG
55 #define S_ISREG(m) (((m)&S_IFMT) == S_IFREG)
56 #endif /* ifndef S_ISREG */
57 
58 #endif /* ISC_STAT_H */
59