3b68abe48aeda7d94c37a8382f041f9512c59a08
[ira/wip.git] / source3 / 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_ACL_LIBACL_H
45 #include <acl/libacl.h>
46 #endif
47
48 #ifdef HAVE_SYS_FS_S5PARAM_H 
49 #include <sys/fs/s5param.h>
50 #endif
51
52 #if defined (HAVE_SYS_FILSYS_H) && !defined (_CRAY)
53 #include <sys/filsys.h> 
54 #endif
55
56 #ifdef HAVE_SYS_STATFS_H
57 # include <sys/statfs.h>
58 #endif
59
60 #ifdef HAVE_DUSTAT_H              
61 #include <sys/dustat.h>
62 #endif
63
64 #ifdef HAVE_SYS_STATVFS_H          
65 #include <sys/statvfs.h>
66 #endif
67
68 #ifdef HAVE_SYS_FILIO_H
69 #include <sys/filio.h>
70 #endif
71
72 #include <sys/file.h>
73
74 #ifdef HAVE_FCNTL_H
75 #include <fcntl.h>
76 #else
77 #ifdef HAVE_SYS_FCNTL_H
78 #include <sys/fcntl.h>
79 #endif
80 #endif
81
82 #ifdef HAVE_SYS_MODE_H
83 /* apparently AIX needs this for S_ISLNK */
84 #ifndef S_ISLNK
85 #include <sys/mode.h>
86 #endif
87 #endif
88
89 #ifdef HAVE_SYS_IOCTL_H
90 #include <sys/ioctl.h>
91 #endif
92
93 /*
94  * Veritas File System.  Often in addition to native.
95  * Quotas different.
96  */
97 #if defined(HAVE_SYS_FS_VX_QUOTA_H)
98 #define VXFS_QUOTA
99 #endif
100
101 #if HAVE_SYS_ATTRIBUTES_H
102 #include <sys/attributes.h>
103 #endif
104
105 /* mutually exclusive (SuSE 8.2) */
106 #if HAVE_ATTR_XATTR_H
107 #include <attr/xattr.h>
108 #elif HAVE_SYS_XATTR_H
109 #include <sys/xattr.h>
110 #endif
111
112
113 #ifdef HAVE_SYS_RESOURCE_H
114 #include <sys/resource.h>
115 #endif
116
117 /* Some POSIX definitions for those without */
118  
119 #ifndef S_IFDIR
120 #define S_IFDIR         0x4000
121 #endif
122 #ifndef S_ISDIR
123 #define S_ISDIR(mode)   ((mode & 0xF000) == S_IFDIR)
124 #endif
125 #ifndef S_IRWXU
126 #define S_IRWXU 00700           /* read, write, execute: owner */
127 #endif
128 #ifndef S_IRUSR
129 #define S_IRUSR 00400           /* read permission: owner */
130 #endif
131 #ifndef S_IWUSR
132 #define S_IWUSR 00200           /* write permission: owner */
133 #endif
134 #ifndef S_IXUSR
135 #define S_IXUSR 00100           /* execute permission: owner */
136 #endif
137 #ifndef S_IRWXG
138 #define S_IRWXG 00070           /* read, write, execute: group */
139 #endif
140 #ifndef S_IRGRP
141 #define S_IRGRP 00040           /* read permission: group */
142 #endif
143 #ifndef S_IWGRP
144 #define S_IWGRP 00020           /* write permission: group */
145 #endif
146 #ifndef S_IXGRP
147 #define S_IXGRP 00010           /* execute permission: group */
148 #endif
149 #ifndef S_IRWXO
150 #define S_IRWXO 00007           /* read, write, execute: other */
151 #endif
152 #ifndef S_IROTH
153 #define S_IROTH 00004           /* read permission: other */
154 #endif
155 #ifndef S_IWOTH
156 #define S_IWOTH 00002           /* write permission: other */
157 #endif
158 #ifndef S_IXOTH
159 #define S_IXOTH 00001           /* execute permission: other */
160 #endif
161
162 #ifndef O_ACCMODE
163 #define O_ACCMODE (O_RDONLY | O_WRONLY | O_RDWR)
164 #endif
165
166 #ifndef MAXPATHLEN
167 #define MAXPATHLEN 256
168 #endif
169
170 #ifndef SEEK_SET
171 #define SEEK_SET 0
172 #endif
173
174 #endif