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