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