xref: /haiku/headers/build/BeOSBuildCompatibility.h (revision 1214ef1b2100f2b3299fc9d8d6142e46f70a4c3f)
1 #ifndef BEOS_BUILD_COMPATIBILITY_H
2 #define BEOS_BUILD_COMPATIBILITY_H
3 
4 typedef unsigned long haiku_build_addr_t;
5 #define addr_t haiku_build_addr_t
6 
7 #include <Errors.h>
8 
9 #include <fcntl.h>
10 #include <string.h>
11 #include <sys/types.h>
12 #include <sys/uio.h>
13 
14 #ifdef __x86_64__
15 #define HAIKU_HOST_PLATFORM_64_BIT
16 #endif
17 
18 #ifdef __cplusplus
19 extern "C" {
20 #endif
21 
22 // Is kernel-only under Linux.
23 extern size_t   strlcpy(char *dest, const char *source, size_t length);
24 extern size_t	strlcat(char *dest, const char *source, size_t length);
25 
26 #if defined(HAIKU_HOST_PLATFORM_FREEBSD) || defined(HAIKU_HOST_PLATFORM_DARWIN)
27 extern size_t	strnlen(const char *string, size_t length);
28 #endif
29 
30 // BeOS only
31 extern ssize_t  read_pos(int fd, off_t pos, void *buffer, size_t count);
32 extern ssize_t  write_pos(int fd, off_t pos, const void *buffer, size_t count);
33 extern ssize_t	readv_pos(int fd, off_t pos, const struct iovec *vec,
34 					size_t count);
35 extern ssize_t	writev_pos(int fd, off_t pos, const struct iovec *vec,
36 					size_t count);
37 
38 
39 // There's no O_NOTRAVERSE under Linux and FreeBSD, but there's a O_NOFOLLOW, which
40 // means something different (open() fails when the file is a symlink), but
41 // we can abuse this flag for our purposes (we filter it in libroot).
42 #ifndef O_NOTRAVERSE
43         #ifdef O_NOFOLLOW
44                 #define O_NOTRAVERSE O_NOFOLLOW
45         #else
46                 #define O_NOTRAVERSE 0
47         #endif
48 #endif
49 
50 #ifndef S_IUMSK
51 	#define S_IUMSK ALLPERMS
52 #endif
53 
54 
55 // remap strerror()
56 extern char *_haiku_build_strerror(int errnum);
57 
58 #ifndef BUILDING_HAIKU_ERROR_MAPPER
59 
60 #undef strerror
61 #define strerror(errnum)	_haiku_build_strerror(errnum)
62 
63 #endif
64 
65 
66 #ifdef __cplusplus
67 } // extern "C"
68 #endif
69 
70 #endif	// BEOS_BUILD_COMPATIBILITY_H
71 
72