diff --git a/headers/build/host/darwin/fcntl.h b/headers/build/host/darwin/fcntl.h new file mode 100644 index 0000000000..36810e3eb3 --- /dev/null +++ b/headers/build/host/darwin/fcntl.h @@ -0,0 +1,34 @@ +#ifndef _HAIKU_BUILD_COMPATIBILITY_DARWIN_FCNTL +#define _HAIKU_BUILD_COMPATIBILITY_DARWIN_FCNTL + +#ifdef __cplusplus +extern "C" { +#endif + +#include_next +#include + +/* + * Magic value that specify the use of the current working directory + * to determine the target of relative file paths in the openat() and + * similar syscalls. + */ +#define AT_FDCWD -100 /* CWD FD for the *at() functions */ + +/* + * Miscellaneous flags for the *at() syscalls. + */ +#define AT_EACCESS 0x100 /* faccessat() */ +#define AT_SYMLINK_NOFOLLOW 0x200 /* fstatat(), fchmodat(), fchownat(), + utimensat() */ +#define AT_SYMLINK_FOLLOW 0x400 /* linkat() */ +#define AT_REMOVEDIR 0x800 /* unlinkat() */ + +int unlinkat(int fd, const char *path, int flag); +int futimesat(int fd, const char *path, const struct timeval times[2]); + +#ifdef __cplusplus +} +#endif + +#endif // _HAIKU_BUILD_COMPATIBILITY_DARWIN_FCNTL diff --git a/headers/build/host/darwin/stdio.h b/headers/build/host/darwin/stdio.h new file mode 100644 index 0000000000..08432070ac --- /dev/null +++ b/headers/build/host/darwin/stdio.h @@ -0,0 +1,17 @@ +#ifndef _HAIKU_BUILD_COMPATIBILITY_DARWIN_STDIO +#define _HAIKU_BUILD_COMPATIBILITY_DARWIN_STDIO + +#ifdef __cplusplus +extern "C" { +#endif + +#include_next + +int renameat(int oldFD, const char* oldPath, int newFD, const char* newPath); +int symlinkat(const char *oldPath, int fd, const char *newPath); + +#ifdef __cplusplus +} +#endif + +#endif // _HAIKU_BUILD_COMPATIBILITY_DARWIN_STDIO diff --git a/headers/build/host/darwin/sys/stat.h b/headers/build/host/darwin/sys/stat.h index 0742c975ca..cd742a9d1a 100644 --- a/headers/build/host/darwin/sys/stat.h +++ b/headers/build/host/darwin/sys/stat.h @@ -1,12 +1,9 @@ #ifndef _HAIKU_BUILD_COMPATIBILITY_DARWIN_SYS_STAT #define _HAIKU_BUILD_COMPATIBILITY_DARWIN_SYS_STAT - #include_next - #include - #ifndef UTIME_NOW # define UTIME_NOW (-1) # define UTIME_OMIT (-2) @@ -28,5 +25,10 @@ # endif #endif +int fchmodat(int fd, const char* path, mode_t mode, int flag); +int fstatat(int fd, const char *path, struct stat *st, int flag); +int mkdirat(int fd, const char *path, mode_t mode); +int mkfifoat(int fd, const char *path, mode_t mode); +int mknodat(int fd, const char *name, mode_t mode, dev_t dev); #endif /* _HAIKU_BUILD_COMPATIBILITY_DARWIN_SYS_STAT */ diff --git a/headers/build/host/darwin/unistd.h b/headers/build/host/darwin/unistd.h new file mode 100644 index 0000000000..c451674e56 --- /dev/null +++ b/headers/build/host/darwin/unistd.h @@ -0,0 +1,20 @@ +#ifndef _HAIKU_BUILD_COMPATIBILITY_DARWIN_UNISTD +#define _HAIKU_BUILD_COMPATIBILITY_DARWIN_UNISTD + +#ifdef __cplusplus +extern "C" { +#endif + +#include_next + +int faccessat(int fd, const char* path, int accessMode, int flag); +int fchownat(int fd, const char* path, uid_t owner, gid_t group, int flag); +ssize_t readlinkat(int fd, const char *path, char *buffer, size_t bufferSize); +int linkat(int oldFD, const char *oldPath, int newFD, const char *newPath, + int flag); + +#ifdef __cplusplus +} +#endif + +#endif // _HAIKU_BUILD_COMPATIBILITY_DARWIN_UNISTD diff --git a/headers/build/host/freebsd/sys/stat.h b/headers/build/host/freebsd/sys/stat.h index 4276f92385..5f06ac78ba 100644 --- a/headers/build/host/freebsd/sys/stat.h +++ b/headers/build/host/freebsd/sys/stat.h @@ -1,12 +1,9 @@ #ifndef _HAIKU_BUILD_COMPATIBILITY_FREEBSD_SYS_STAT #define _HAIKU_BUILD_COMPATIBILITY_FREEBSD_SYS_STAT - #include_next - #include - #ifndef UTIME_NOW # define UTIME_NOW (-1) # define UTIME_OMIT (-2) @@ -14,7 +11,7 @@ __BEGIN_DECLS /* assume that futimens() and utimensat() aren't available */ - int futimens(int fd, const struct timespec times[2]); + int futimens(int fd, const struct timespec times[2]); int utimensat(int fd, const char* path, const struct timespec times[2], int flag); @@ -28,5 +25,4 @@ # endif #endif - #endif /* _HAIKU_BUILD_COMPATIBILITY_FREEBSD_SYS_STAT */ diff --git a/src/build/libroot/fs.cpp b/src/build/libroot/fs.cpp index 13a0fdd4df..fd62acfc6e 100644 --- a/src/build/libroot/fs.cpp +++ b/src/build/libroot/fs.cpp @@ -31,8 +31,6 @@ #if defined(HAIKU_HOST_PLATFORM_FREEBSD) # include "fs_freebsd.h" -#elif defined(HAIKU_HOST_PLATFORM_DARWIN) -# include "fs_darwin.h" #endif diff --git a/src/build/libroot/fs_darwin.cpp b/src/build/libroot/fs_darwin.cpp index 115c72dd6e..3bd669f0f5 100644 --- a/src/build/libroot/fs_darwin.cpp +++ b/src/build/libroot/fs_darwin.cpp @@ -5,8 +5,6 @@ */ -#include "fs_darwin.h" - #include #include #include diff --git a/src/build/libroot/fs_darwin.h b/src/build/libroot/fs_darwin.h deleted file mode 100644 index 66c5726c9d..0000000000 --- a/src/build/libroot/fs_darwin.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright 2005-2011, Ingo Weinhold, ingo_weinhold@gmx.de. - * Copyright 2012, John Scipione, jscipione@gmail.com. - * Distributed under the terms of the MIT License. - */ -#ifndef FS_DARWIN_H -#define FS_DARWIN_H - - -/* - * Magic value that specify the use of the current working directory - * to determine the target of relative file paths in the openat() and - * similar syscalls. - */ -#define AT_FDCWD -100 /* CWD FD for the *at() functions */ - -/* - * Miscellaneous flags for the *at() syscalls. - */ -#define AT_EACCESS 0x100 /* faccessat() */ -#define AT_SYMLINK_NOFOLLOW 0x200 /* fstatat(), fchmodat(), fchownat(), - utimensat() */ -#define AT_SYMLINK_FOLLOW 0x400 /* linkat() */ -#define AT_REMOVEDIR 0x800 /* unlinkat() */ - -int faccessat(int fd, const char* path, int accessMode, int flag); -int fchmodat(int fd, const char* path, mode_t mode, int flag); -int fchownat(int fd, const char* path, uid_t owner, gid_t group, int flag); -int fstatat(int fd, const char *path, struct stat *st, int flag); -int mkdirat(int fd, const char *path, mode_t mode); -int mkfifoat(int fd, const char *path, mode_t mode); -int mknodat(int fd, const char *name, mode_t mode, dev_t dev); -int renameat(int oldFD, const char* oldPath, int newFD, const char* newPath); - -ssize_t readlinkat(int fd, const char *path, char *buffer, size_t bufferSize); -int symlinkat(const char *oldPath, int fd, const char *newPath); -int unlinkat(int fd, const char *path, int flag); -int linkat(int oldFD, const char *oldPath, int newFD, const char *newPath, - int flag); - -int futimesat(int fd, const char *path, const struct timeval times[2]); - - -#endif // FS_DARWIN_H diff --git a/src/build/libroot/remapped_functions.h b/src/build/libroot/remapped_functions.h index 6b940e72e9..01190bb65e 100644 --- a/src/build/libroot/remapped_functions.h +++ b/src/build/libroot/remapped_functions.h @@ -5,18 +5,10 @@ #ifndef REMAPPED_FUNCTIONS_H #define REMAPPED_FUNCTIONS_H - -#include -#include -#include -#include - - #ifdef __cplusplus extern "C" { #endif - int _haiku_build_fchmod(int fd, mode_t mode); int _haiku_build_fchmodat(int fd, const char* path, mode_t mode, int flag); int _haiku_build_fstat(int fd, struct stat* st); @@ -53,7 +45,6 @@ int _haiku_build_fcntl(int fd, int op, int argument); int _haiku_build_renameat(int fromFD, const char* from, int toFD, const char* to); - #ifdef __cplusplus } // extern "C" #endif