Include sys/types.h in HsDirectory.h; fixes trac #3653
[haskell-directory.git] / include / HsDirectory.h
1 /* -----------------------------------------------------------------------------
2  *
3  * (c) The University of Glasgow 2001-2004
4  *
5  * Definitions for package `directory' which are visible in Haskell land.
6  *
7  * ---------------------------------------------------------------------------*/
8
9 #ifndef __HSDIRECTORY_H__
10 #define __HSDIRECTORY_H__
11
12 #ifdef __NHC__
13 #include "Nhc98BaseConfig.h"
14 #else
15 #include "HsDirectoryConfig.h"
16 #endif
17 // Otherwise these clash with similar definitions from other packages:
18 #undef PACKAGE_BUGREPORT
19 #undef PACKAGE_NAME
20 #undef PACKAGE_STRING
21 #undef PACKAGE_TARNAME
22 #undef PACKAGE_VERSION
23
24 #if HAVE_SYS_STAT_H
25 #include <sys/stat.h>
26 #endif
27
28 #if HAVE_SYS_TYPES_H
29 #include <sys/types.h>
30 #endif
31
32 #include "HsFFI.h"
33
34 /* -----------------------------------------------------------------------------
35    INLINE functions.
36
37    These functions are given as inlines here for when compiling via C,
38    but we also generate static versions into the cbits library for
39    when compiling to native code.
40    -------------------------------------------------------------------------- */
41
42 #ifndef INLINE
43 # if defined(_MSC_VER)
44 #  define INLINE extern __inline
45 # else
46 #  define INLINE static inline
47 # endif
48 #endif
49
50 /* A size that will contain many path names, but not necessarily all
51  * (PATH_MAX is not defined on systems with unlimited path length,
52  * e.g. the Hurd).
53  */
54 INLINE HsInt __hscore_long_path_size() {
55 #ifdef PATH_MAX
56     return PATH_MAX;
57 #else
58     return 4096;
59 #endif
60 }
61
62 INLINE mode_t __hscore_S_IRUSR() { return S_IRUSR; }
63 INLINE mode_t __hscore_S_IWUSR() { return S_IWUSR; }
64 INLINE mode_t __hscore_S_IXUSR() { return S_IXUSR; }
65 INLINE mode_t __hscore_S_IFDIR() { return S_IFDIR; }
66
67 #endif /* __HSDIRECTORY_H__ */
68