r18129: moved the system includes into libreplace - this gives much more
[samba.git] / source4 / lib / replace / system / filesys.h
1 #ifndef _system_filesys_h
2 #define _system_filesys_h
3 /* 
4    Unix SMB/CIFS implementation.
5
6    filesystem system include wrappers
7
8    Copyright (C) Andrew Tridgell 2004
9    
10    This program is free software; you can redistribute it and/or modify
11    it under the terms of the GNU General Public License as published by
12    the Free Software Foundation; either version 2 of the License, or
13    (at your option) any later version.
14    
15    This program is distributed in the hope that it will be useful,
16    but WITHOUT ANY WARRANTY; without even the implied warranty of
17    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18    GNU General Public License for more details.
19    
20    You should have received a copy of the GNU General Public License
21    along with this program; if not, write to the Free Software
22    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 */
24
25 #include <unistd.h>
26 #include <sys/stat.h>
27
28 #ifdef HAVE_SYS_PARAM_H
29 #include <sys/param.h>
30 #endif
31
32 #ifdef HAVE_SYS_MOUNT_H
33 #include <sys/mount.h>
34 #endif
35
36 #ifdef HAVE_SYS_VFS_H
37 #include <sys/vfs.h>
38 #endif
39
40 #ifdef HAVE_SYS_ACL_H
41 #include <sys/acl.h>
42 #endif
43
44 #ifdef HAVE_SYS_FS_S5PARAM_H 
45 #include <sys/fs/s5param.h>
46 #endif
47
48 #if defined (HAVE_SYS_FILSYS_H) && !defined (_CRAY)
49 #include <sys/filsys.h> 
50 #endif
51
52 #ifdef HAVE_SYS_STATFS_H
53 # include <sys/statfs.h>
54 #endif
55
56 #ifdef HAVE_DUSTAT_H              
57 #include <sys/dustat.h>
58 #endif
59
60 #ifdef HAVE_SYS_STATVFS_H          
61 #include <sys/statvfs.h>
62 #endif
63
64 #ifdef HAVE_SYS_FILIO_H
65 #include <sys/filio.h>
66 #endif
67
68 #include <sys/file.h>
69
70 #ifdef HAVE_FCNTL_H
71 #include <fcntl.h>
72 #else
73 #ifdef HAVE_SYS_FCNTL_H
74 #include <sys/fcntl.h>
75 #endif
76 #endif
77
78 #ifdef HAVE_SYS_MODE_H
79 /* apparently AIX needs this for S_ISLNK */
80 #ifndef S_ISLNK
81 #include <sys/mode.h>
82 #endif
83 #endif
84
85 #ifdef HAVE_SYS_IOCTL_H
86 #include <sys/ioctl.h>
87 #endif
88
89 /*
90  * Veritas File System.  Often in addition to native.
91  * Quotas different.
92  */
93 #if defined(HAVE_SYS_FS_VX_QUOTA_H)
94 #define VXFS_QUOTA
95 #endif
96
97 #if HAVE_SYS_ATTRIBUTES_H
98 #include <sys/attributes.h>
99 #endif
100
101 /* mutually exclusive (SuSE 8.2) */
102 #if HAVE_ATTR_XATTR_H
103 #include <attr/xattr.h>
104 #elif HAVE_SYS_XATTR_H
105 #include <sys/xattr.h>
106 #endif
107
108
109 #ifdef HAVE_SYS_RESOURCE_H
110 #include <sys/resource.h>
111 #endif
112
113 /* Some POSIX definitions for those without */
114  
115 #ifndef S_IFDIR
116 #define S_IFDIR         0x4000
117 #endif
118 #ifndef S_ISDIR
119 #define S_ISDIR(mode)   ((mode & 0xF000) == S_IFDIR)
120 #endif
121 #ifndef S_IRWXU
122 #define S_IRWXU 00700           /* read, write, execute: owner */
123 #endif
124 #ifndef S_IRUSR
125 #define S_IRUSR 00400           /* read permission: owner */
126 #endif
127 #ifndef S_IWUSR
128 #define S_IWUSR 00200           /* write permission: owner */
129 #endif
130 #ifndef S_IXUSR
131 #define S_IXUSR 00100           /* execute permission: owner */
132 #endif
133 #ifndef S_IRWXG
134 #define S_IRWXG 00070           /* read, write, execute: group */
135 #endif
136 #ifndef S_IRGRP
137 #define S_IRGRP 00040           /* read permission: group */
138 #endif
139 #ifndef S_IWGRP
140 #define S_IWGRP 00020           /* write permission: group */
141 #endif
142 #ifndef S_IXGRP
143 #define S_IXGRP 00010           /* execute permission: group */
144 #endif
145 #ifndef S_IRWXO
146 #define S_IRWXO 00007           /* read, write, execute: other */
147 #endif
148 #ifndef S_IROTH
149 #define S_IROTH 00004           /* read permission: other */
150 #endif
151 #ifndef S_IWOTH
152 #define S_IWOTH 00002           /* write permission: other */
153 #endif
154 #ifndef S_IXOTH
155 #define S_IXOTH 00001           /* execute permission: other */
156 #endif
157
158 #ifndef O_ACCMODE
159 #define O_ACCMODE (O_RDONLY | O_WRONLY | O_RDWR)
160 #endif
161
162 #ifndef MAXPATHLEN
163 #define MAXPATHLEN 256
164 #endif
165
166 #ifndef SEEK_SET
167 #define SEEK_SET 0
168 #endif
169
170 #endif