Rudiments
fileincludes.h
1 // Copyright (c) 2002 David Muse
2 // See the COPYING file for more information.
3 
4 #include <rudiments/private/dll.h>
5 #include <rudiments/filedescriptor.h>
6 
7 #include <sys/types.h>
8 
9 // some systems need this for key_t
10 #ifdef RUDIMENTS_HAVE_SYS_IPC_H
11  #include <sys/ipc.h>
12 #endif
13 
14 // for open flags
15 #ifdef RUDIMENTS_HAVE_FCNTL_H
16  // for open flags with msvc/mingw32...
17  // make sure to undefine _POSIX_ if it wasn't already defined though,
18  // as it will prevent various process-related functions from being
19  // found later if it's still defined
20  #ifdef _WIN32
21  #ifndef _POSIX_
22  #define _POSIX_
23  #define RUDIMENTS_UNDEFPOSIX
24  #endif
25  #endif
26  #include <fcntl.h>
27  #ifdef _WIN32
28  #ifdef RUDIMENTS_UNDEFPOSIX
29  #undef _POSIX_
30  #endif
31  #endif
32 #endif
33 
34 #ifndef RUDIMENTS_HAVE_BLKSIZE_T
35  typedef long blksize_t;
36 #endif
37 #ifndef RUDIMENTS_HAVE_BLKCNT_T
38  typedef long blkcnt_t;
39 #endif
40 
41 // windows doesn't define these but we need them to be able to lock files
42 #ifndef F_RDLCK
43  #define F_RDLCK 0
44 #endif
45 #ifndef F_WRLCK
46  #define F_WRLCK 1
47 #endif
48 #ifndef F_UNLCK
49  #define F_UNLCK 2
50 #endif
51 
52 // most platforms don't define O_BINARY but it's
53 // helpful to have it for portability
54 #ifndef O_BINARY
55  #define O_BINARY 0
56 #endif