* Map O_NOTRAVERSE to rarely used or non portable O_ modes if possible.

* Fixed indentation.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34286 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2009-11-26 16:02:07 +00:00
parent 4dafc3b298
commit 64266621a2

View File

@ -2,9 +2,9 @@
#define BEOS_BUILD_COMPATIBILITY_H #define BEOS_BUILD_COMPATIBILITY_H
#if defined(HAIKU_HOST_PLATFORM_CYGWIN) #if defined(HAIKU_HOST_PLATFORM_CYGWIN)
#ifndef __addr_t_defined # ifndef __addr_t_defined
#define __addr_t_defined # define __addr_t_defined
#endif # endif
#endif #endif
#if defined(HAIKU_HOST_PLATFORM_CYGWIN) || defined(HAIKU_HOST_PLATFORM_SUNOS) #if defined(HAIKU_HOST_PLATFORM_CYGWIN) || defined(HAIKU_HOST_PLATFORM_SUNOS)
@ -41,52 +41,55 @@ extern "C" {
#endif #endif
// Is kernel-only under Linux. // Is kernel-only under Linux.
extern size_t strlcpy(char *dest, const char *source, size_t length); extern size_t strlcpy(char* dest, const char* source, size_t length);
extern size_t strlcat(char *dest, const char *source, size_t length); extern size_t strlcat(char* dest, const char* source, size_t length);
#if defined(HAIKU_HOST_PLATFORM_FREEBSD) || defined(HAIKU_HOST_PLATFORM_DARWIN) #if defined(HAIKU_HOST_PLATFORM_FREEBSD) || defined(HAIKU_HOST_PLATFORM_DARWIN)
extern size_t strnlen(const char *string, size_t length); extern size_t strnlen(const char* string, size_t length);
#endif #endif
#if defined(HAIKU_HOST_PLATFORM_CYGWIN) || defined(HAIKU_HOST_PLATFORM_SUNOS) #if defined(HAIKU_HOST_PLATFORM_CYGWIN) || defined(HAIKU_HOST_PLATFORM_SUNOS)
extern char * stpcpy(char *dest, const char *src); extern char* stpcpy(char* dest, const char* src);
extern char * strcasestr(const char *s, const char *find); extern char* strcasestr(const char* s, const char* find);
#endif #endif
// BeOS only // BeOS only
extern ssize_t read_pos(int fd, off_t pos, void *buffer, size_t count); 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 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, extern ssize_t readv_pos(int fd, off_t pos, const struct iovec* vec,
size_t count); size_t count);
extern ssize_t writev_pos(int fd, off_t pos, const struct iovec *vec, extern ssize_t writev_pos(int fd, off_t pos, const struct iovec* vec,
size_t count); size_t count);
// There's no O_NOTRAVERSE under Linux and FreeBSD, but there's a O_NOFOLLOW, which // There's no O_NOTRAVERSE under Linux and FreeBSD -- we replace it with a flag
// means something different (open() fails when the file is a symlink), but // that won't be used by our tools, preferrably a non-portable one; a fixed
// we can abuse this flag for our purposes (we filter it in libroot). // constant could always lead to trouble on the host.
// We can abuse this flag for our purposes as we filter it in libroot.
#ifndef O_NOTRAVERSE #ifndef O_NOTRAVERSE
#ifdef O_NOFOLLOW # ifdef O_NOCTTY
#define O_NOTRAVERSE O_NOFOLLOW # define O_NOTRAVERSE O_NOCTTY
#else # elif defined(O_RANDOM)
#define O_NOTRAVERSE 0 # define O_NOTRAVERSE O_RANDOM
#endif # else
# error "Search for a proper replacement value for O_NOTRAVERSE"
# endif
#endif #endif
#ifndef S_IUMSK #ifndef S_IUMSK
#define S_IUMSK ALLPERMS # define S_IUMSK ALLPERMS
#endif #endif
// remap strerror() // remap strerror()
extern char *_haiku_build_strerror(int errnum); extern char* _haiku_build_strerror(int errnum);
#ifndef BUILDING_HAIKU_ERROR_MAPPER #ifndef BUILDING_HAIKU_ERROR_MAPPER
#undef strerror #undef strerror
#define strerror(errnum) _haiku_build_strerror(errnum) #define strerror(errnum) _haiku_build_strerror(errnum)
#endif #endif // BUILDING_HAIKU_ERROR_MAPPER
#ifdef __cplusplus #ifdef __cplusplus
} // extern "C" } // extern "C"