1 /*	$NetBSD: stat.h,v 1.5 2014/12/10 04:38:01 christos Exp $	*/
2 
3 /*
4  * Copyright (C) 2004, 2007, 2009, 2012  Internet Systems Consortium, Inc. ("ISC")
5  * Copyright (C) 2000, 2001, 2003  Internet Software Consortium.
6  *
7  * Permission to use, copy, modify, and/or distribute this software for any
8  * purpose with or without fee is hereby granted, provided that the above
9  * copyright notice and this permission notice appear in all copies.
10  *
11  * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
12  * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
13  * AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
14  * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
15  * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
16  * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17  * PERFORMANCE OF THIS SOFTWARE.
18  */
19 
20 /* Id: stat.h,v 1.9 2009/10/01 23:48:08 tbox Exp  */
21 
22 #ifndef ISC_STAT_H
23 #define ISC_STAT_H 1
24 
25 #include <sys/stat.h>
26 
27 /*
28  * Windows doesn't typedef this.
29  */
30 typedef unsigned short mode_t;
31 
32 /* open() under unix allows setting of read/write permissions
33  * at the owner, group and other levels.  These don't exist in NT
34  * We'll just map them all to the NT equivalent
35  */
36 
37 #define S_IREAD	_S_IREAD	/* read permission, owner */
38 #define S_IWRITE _S_IWRITE	/* write permission, owner */
39 #define S_IRUSR _S_IREAD	/* Owner read permission */
40 #define S_IWUSR _S_IWRITE	/* Owner write permission */
41 #define S_IRGRP _S_IREAD	/* Group read permission */
42 #define S_IWGRP _S_IWRITE	/* Group write permission */
43 #define S_IROTH _S_IREAD	/* Other read permission */
44 #define S_IWOTH _S_IWRITE	/* Other write permission */
45 
46 #ifndef S_IFMT
47 # define S_IFMT   _S_IFMT
48 #endif
49 #ifndef S_IFDIR
50 # define S_IFDIR  _S_IFDIR
51 #endif
52 #ifndef S_IFCHR
53 # define S_IFCHR  _S_IFCHR
54 #endif
55 #ifndef S_IFREG
56 # define S_IFREG  _S_IFREG
57 #endif
58 
59 #ifndef S_ISDIR
60 # define S_ISDIR(m)	(((m) & S_IFMT) == S_IFDIR)
61 #endif
62 #ifndef S_ISREG
63 # define S_ISREG(m)	(((m) & S_IFMT) == S_IFREG)
64 #endif
65 
66 #endif /* ISC_STAT_H */
67