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