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