xref: /haiku/headers/build/BeOSBuildCompatibility.h (revision 14e3d1b5768e7110b3d5c0855833267409b71dbb)
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 #if defined(HAIKU_HOST_PLATFORM_FREEBSD) || defined(HAIKU_HOST_PLATFORM_DARWIN)
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 extern ssize_t	readv_pos(int fd, off_t pos, const struct iovec *vec,
27 					size_t count);
28 extern ssize_t	writev_pos(int fd, off_t pos, const struct iovec *vec,
29 					size_t count);
30 
31 
32 // There's no O_NOTRAVERSE under Linux and FreeBSD, but there's a O_NOFOLLOW, which
33 // means something different (open() fails when the file is a symlink), but
34 // we can abuse this flag for our purposes (we filter it in libroot).
35 #ifndef O_NOTRAVERSE
36         #ifdef O_NOFOLLOW
37                 #define O_NOTRAVERSE O_NOFOLLOW
38         #else
39                 #define O_NOTRAVERSE 0
40         #endif
41 #endif
42 
43 #ifndef S_IUMSK
44 	#define S_IUMSK ALLPERMS
45 #endif
46 
47 
48 // remap strerror()
49 extern char *_haiku_build_strerror(int errnum);
50 
51 #ifndef BUILDING_HAIKU_ERROR_MAPPER
52 
53 #undef strerror
54 #define strerror(errnum)	_haiku_build_strerror(errnum)
55 
56 #endif
57 
58 
59 #ifdef __cplusplus
60 } // extern "C"
61 #endif
62 
63 #endif	// BEOS_BUILD_COMPATIBILITY_H
64 
65