2005-11-07 21:17:21 +03:00
|
|
|
#ifndef BEOS_BUILD_COMPATIBILITY_H
|
|
|
|
#define BEOS_BUILD_COMPATIBILITY_H
|
2005-11-04 17:48:35 +03:00
|
|
|
|
2008-07-24 01:39:13 +04:00
|
|
|
#if defined(HAIKU_HOST_PLATFORM_CYGWIN)
|
2009-11-26 19:02:07 +03:00
|
|
|
# ifndef __addr_t_defined
|
|
|
|
# define __addr_t_defined
|
|
|
|
# endif
|
2008-08-09 19:36:24 +04:00
|
|
|
#endif
|
2008-07-24 01:39:13 +04:00
|
|
|
|
2008-08-09 19:36:24 +04:00
|
|
|
#if defined(HAIKU_HOST_PLATFORM_CYGWIN) || defined(HAIKU_HOST_PLATFORM_SUNOS)
|
2008-07-24 01:39:13 +04:00
|
|
|
#ifndef DEFFILEMODE
|
|
|
|
#define DEFFILEMODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef S_IUMSK
|
|
|
|
#define S_IUMSK 07777
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <ctype.h>
|
|
|
|
#endif
|
|
|
|
|
2008-08-09 19:36:24 +04:00
|
|
|
#ifdef HAIKU_HOST_PLATFORM_SUNOS
|
|
|
|
# include <limits.h>
|
|
|
|
# ifndef NAME_MAX
|
|
|
|
# define NAME_MAX MAXNAMELEN
|
|
|
|
# endif
|
|
|
|
#endif
|
|
|
|
|
2005-11-04 17:48:35 +03:00
|
|
|
typedef unsigned long haiku_build_addr_t;
|
|
|
|
#define addr_t haiku_build_addr_t
|
|
|
|
|
|
|
|
#include <Errors.h>
|
2007-09-05 06:54:24 +04:00
|
|
|
|
|
|
|
#include <fcntl.h>
|
2005-11-04 17:48:35 +03:00
|
|
|
#include <string.h>
|
2007-09-05 06:54:24 +04:00
|
|
|
#include <sys/types.h>
|
2007-09-04 22:42:13 +04:00
|
|
|
#include <sys/uio.h>
|
2005-11-04 17:48:35 +03:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// Is kernel-only under Linux.
|
2009-11-26 19:02:07 +03:00
|
|
|
extern size_t strlcpy(char* dest, const char* source, size_t length);
|
|
|
|
extern size_t strlcat(char* dest, const char* source, size_t length);
|
2005-11-04 17:48:35 +03:00
|
|
|
|
2007-05-18 19:59:04 +04:00
|
|
|
#if defined(HAIKU_HOST_PLATFORM_FREEBSD) || defined(HAIKU_HOST_PLATFORM_DARWIN)
|
2009-11-26 19:02:07 +03:00
|
|
|
extern size_t strnlen(const char* string, size_t length);
|
2006-02-03 15:24:15 +03:00
|
|
|
#endif
|
|
|
|
|
2008-08-09 19:36:24 +04:00
|
|
|
#if defined(HAIKU_HOST_PLATFORM_CYGWIN) || defined(HAIKU_HOST_PLATFORM_SUNOS)
|
2009-11-26 19:02:07 +03:00
|
|
|
extern char* stpcpy(char* dest, const char* src);
|
|
|
|
extern char* strcasestr(const char* s, const char* find);
|
2008-07-24 01:39:13 +04:00
|
|
|
#endif
|
|
|
|
|
2005-11-04 17:48:35 +03:00
|
|
|
// BeOS only
|
2009-11-26 19:02:07 +03:00
|
|
|
extern ssize_t read_pos(int fd, off_t pos, void* buffer, size_t count);
|
|
|
|
extern ssize_t write_pos(int fd, off_t pos, const void* buffer, size_t count);
|
|
|
|
extern ssize_t readv_pos(int fd, off_t pos, const struct iovec* vec,
|
2007-04-27 16:11:30 +04:00
|
|
|
size_t count);
|
2009-11-26 19:02:07 +03:00
|
|
|
extern ssize_t writev_pos(int fd, off_t pos, const struct iovec* vec,
|
2007-04-27 16:11:30 +04:00
|
|
|
size_t count);
|
2005-11-04 17:48:35 +03:00
|
|
|
|
|
|
|
|
2009-11-26 19:02:07 +03:00
|
|
|
// There's no O_NOTRAVERSE under Linux and FreeBSD -- we replace it with a flag
|
|
|
|
// that won't be used by our tools, preferrably a non-portable one; a fixed
|
|
|
|
// constant could always lead to trouble on the host.
|
|
|
|
// We can abuse this flag for our purposes as we filter it in libroot.
|
2005-11-04 17:48:35 +03:00
|
|
|
#ifndef O_NOTRAVERSE
|
2009-11-26 19:02:07 +03:00
|
|
|
# ifdef O_NOCTTY
|
|
|
|
# define O_NOTRAVERSE O_NOCTTY
|
|
|
|
# elif defined(O_RANDOM)
|
|
|
|
# define O_NOTRAVERSE O_RANDOM
|
|
|
|
# else
|
|
|
|
# error "Search for a proper replacement value for O_NOTRAVERSE"
|
|
|
|
# endif
|
2005-11-04 17:48:35 +03:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef S_IUMSK
|
2009-11-26 19:02:07 +03:00
|
|
|
# define S_IUMSK ALLPERMS
|
2005-11-04 17:48:35 +03:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
// remap strerror()
|
2009-11-26 19:02:07 +03:00
|
|
|
extern char* _haiku_build_strerror(int errnum);
|
2005-11-04 17:48:35 +03:00
|
|
|
|
|
|
|
#ifndef BUILDING_HAIKU_ERROR_MAPPER
|
|
|
|
|
|
|
|
#undef strerror
|
|
|
|
#define strerror(errnum) _haiku_build_strerror(errnum)
|
|
|
|
|
2009-11-26 19:02:07 +03:00
|
|
|
#endif // BUILDING_HAIKU_ERROR_MAPPER
|
2005-11-04 17:48:35 +03:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
} // extern "C"
|
|
|
|
#endif
|
|
|
|
|
2005-11-07 21:17:21 +03:00
|
|
|
#endif // BEOS_BUILD_COMPATIBILITY_H
|
2005-11-04 17:48:35 +03:00
|
|
|
|