1290001Sglebius/*
2290001Sglebius * Copyright (C) 2004, 2007, 2009  Internet Systems Consortium, Inc. ("ISC")
3290001Sglebius * Copyright (C) 2000, 2001, 2003  Internet Software Consortium.
4290001Sglebius *
5290001Sglebius * Permission to use, copy, modify, and/or distribute this software for any
6290001Sglebius * purpose with or without fee is hereby granted, provided that the above
7290001Sglebius * copyright notice and this permission notice appear in all copies.
8290001Sglebius *
9290001Sglebius * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
10290001Sglebius * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
11290001Sglebius * AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
12290001Sglebius * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
13290001Sglebius * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
14290001Sglebius * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
15290001Sglebius * PERFORMANCE OF THIS SOFTWARE.
16290001Sglebius */
17290001Sglebius
18290001Sglebius/* $Id: stat.h,v 1.9 2009/10/01 23:48:08 tbox Exp $ */
19290001Sglebius
20290001Sglebius#ifndef ISC_STAT_H
21290001Sglebius#define ISC_STAT_H 1
22290001Sglebius
23290001Sglebius#include <sys/stat.h>
24290001Sglebius
25290001Sglebius/* open() under unix allows setting of read/write permissions
26290001Sglebius * at the owner, group and other levels.  These don't exist in NT
27290001Sglebius * We'll just map them all to the NT equivalent
28290001Sglebius */
29290001Sglebius
30290001Sglebius#define S_IREAD	_S_IREAD	/* read permission, owner */
31290001Sglebius#define S_IWRITE _S_IWRITE	/* write permission, owner */
32290001Sglebius#define S_IEXEC _S_IEXEC	/* execute/search permission, owner */
33290001Sglebius#define S_IRUSR _S_IREAD	/* Owner read permission */
34290001Sglebius#define S_IWUSR _S_IWRITE	/* Owner write permission */
35290001Sglebius#define S_IRGRP _S_IREAD	/* Group read permission */
36290001Sglebius#define S_IWGRP _S_IWRITE	/* Group write permission */
37290001Sglebius#define S_IROTH _S_IREAD	/* Other read permission */
38290001Sglebius#define S_IWOTH _S_IWRITE	/* Other write permission */
39290001Sglebius
40290001Sglebius#ifndef S_IFMT
41290001Sglebius# define S_IFMT   _S_IFMT
42290001Sglebius#endif
43290001Sglebius#ifndef S_IFDIR
44290001Sglebius# define S_IFDIR  _S_IFDIR
45290001Sglebius#endif
46290001Sglebius#ifndef S_IFCHR
47290001Sglebius# define S_IFCHR  _S_IFCHR
48290001Sglebius#endif
49290001Sglebius#ifndef S_IFREG
50290001Sglebius# define S_IFREG  _S_IFREG
51290001Sglebius#endif
52290001Sglebius
53290001Sglebius#ifndef S_ISDIR
54290001Sglebius# define S_ISDIR(m)	(((m) & S_IFMT) == S_IFDIR)
55290001Sglebius#endif
56290001Sglebius#ifndef S_ISREG
57290001Sglebius# define S_ISREG(m)	(((m) & S_IFMT) == S_IFREG)
58290001Sglebius#endif
59290001Sglebius
60290001Sglebius#define O_RDONLY _O_RDONLY
61290001Sglebius#define O_WRONLY _O_WRONLY
62290001Sglebius#define O_RDWR _O_RDWR
63290001Sglebius#define O_APPEND _O_APPEND
64290001Sglebius#define O_CREAT _O_CREAT
65290001Sglebius#define O_TRUNC _O_TRUNC
66290001Sglebius#define O_EXCL _O_EXCL
67290001Sglebius
68290001Sglebius#endif /* ISC_STAT_H */
69