forked from haskell/directory
/
HsDirectory.h
70 lines (56 loc) · 1.98 KB
/
HsDirectory.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/* -----------------------------------------------------------------------------
*
* (c) The University of Glasgow 2001-2004
*
* Definitions for package `directory' which are visible in Haskell land.
*
* ---------------------------------------------------------------------------*/
/* [DEPRECATED] Do not include this header nor HsDirectoryConfig.h. They are
for internal use only and may be removed in future versions. */
#ifndef __HSDIRECTORY_H__
#define __HSDIRECTORY_H__
// On Solaris we have to make sure _FILE_OFFSET_BITS is defined
// before including <sys/stat.h> below, because that header
// will try and define it if it isn't already.
#include "HsFFI.h"
#include "HsDirectoryConfig.h"
// Otherwise these clash with similar definitions from other packages:
#undef PACKAGE_BUGREPORT
#undef PACKAGE_NAME
#undef PACKAGE_STRING
#undef PACKAGE_TARNAME
#undef PACKAGE_VERSION
#if HAVE_SYS_STAT_H
#include <sys/stat.h>
#endif
#if HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#include "HsFFI.h"
/* -----------------------------------------------------------------------------
INLINE functions.
These functions are given as inlines here for when compiling via C,
but we also generate static versions into the cbits library for
when compiling to native code.
-------------------------------------------------------------------------- */
#ifndef INLINE
# if defined(_MSC_VER)
# define INLINE extern __inline
# else
# define INLINE static inline
# endif
#endif
/* Do not use: it may give the wrong value on systems where PATH_MAX is not
defined (e.g. Hurd). Instead, use System.Directory.Internal.c_PATH_MAX. */
INLINE HsInt __hscore_long_path_size(void) {
#ifdef PATH_MAX
return PATH_MAX;
#else
return 4096;
#endif
}
INLINE mode_t __hscore_S_IRUSR(void) { return S_IRUSR; }
INLINE mode_t __hscore_S_IWUSR(void) { return S_IWUSR; }
INLINE mode_t __hscore_S_IXUSR(void) { return S_IXUSR; }
INLINE mode_t __hscore_S_IFDIR(void) { return S_IFDIR; }
#endif /* __HSDIRECTORY_H__ */