From 64266621a221b11c145c6c711286f7430a4a54d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Thu, 26 Nov 2009 16:02:07 +0000 Subject: [PATCH] * 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 --- headers/build/BeOSBuildCompatibility.h | 49 ++++++++++++++------------ 1 file changed, 26 insertions(+), 23 deletions(-) diff --git a/headers/build/BeOSBuildCompatibility.h b/headers/build/BeOSBuildCompatibility.h index 5a51165f06..87619e71a3 100644 --- a/headers/build/BeOSBuildCompatibility.h +++ b/headers/build/BeOSBuildCompatibility.h @@ -2,9 +2,9 @@ #define BEOS_BUILD_COMPATIBILITY_H #if defined(HAIKU_HOST_PLATFORM_CYGWIN) -#ifndef __addr_t_defined -#define __addr_t_defined -#endif +# ifndef __addr_t_defined +# define __addr_t_defined +# endif #endif #if defined(HAIKU_HOST_PLATFORM_CYGWIN) || defined(HAIKU_HOST_PLATFORM_SUNOS) @@ -41,52 +41,55 @@ extern "C" { #endif // Is kernel-only under Linux. -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 strlcpy(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) -extern size_t strnlen(const char *string, size_t length); +extern size_t strnlen(const char* string, size_t length); #endif #if defined(HAIKU_HOST_PLATFORM_CYGWIN) || defined(HAIKU_HOST_PLATFORM_SUNOS) -extern char * stpcpy(char *dest, const char *src); -extern char * strcasestr(const char *s, const char *find); +extern char* stpcpy(char* dest, const char* src); +extern char* strcasestr(const char* s, const char* find); #endif // BeOS only -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, +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, 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); -// There's no O_NOTRAVERSE under Linux and FreeBSD, but there's a O_NOFOLLOW, which -// means something different (open() fails when the file is a symlink), but -// we can abuse this flag for our purposes (we filter it in libroot). +// 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. #ifndef O_NOTRAVERSE - #ifdef O_NOFOLLOW - #define O_NOTRAVERSE O_NOFOLLOW - #else - #define O_NOTRAVERSE 0 - #endif +# 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 #endif #ifndef S_IUMSK - #define S_IUMSK ALLPERMS +# define S_IUMSK ALLPERMS #endif // remap strerror() -extern char *_haiku_build_strerror(int errnum); +extern char* _haiku_build_strerror(int errnum); #ifndef BUILDING_HAIKU_ERROR_MAPPER #undef strerror #define strerror(errnum) _haiku_build_strerror(errnum) -#endif +#endif // BUILDING_HAIKU_ERROR_MAPPER #ifdef __cplusplus } // extern "C"