[haiku-commits] haiku: hrev44516 - headers/build/host/darwin src/build/libroot headers/build/host/darwin/sys

  • From: jscipione@xxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sun, 12 Aug 2012 00:32:02 +0200 (CEST)

hrev44516 adds 1 changeset to branch 'master'
old head: 0de0cd6c473a290a68db994d6e83071bb192636e
new head: a43b1ed6d894723ed5dbc26e2c399e8ad46022d6

----------------------------------------------------------------------------

a43b1ed: Split fs_darwin.h defines into various platform dependent headers.
  
  This completes the final 1/3 of #8857. Changes again by nielx with
  style fixes by me.
  
  The one part that I couldn't figure out, and maybe Ingo can chime
  in here. If headers/build/host/darwin/sys/stat.h is surrounded in
  
  extern "C" {
  
  }
  
  guards then I get a link error complaining that the functions defined
  here are duplicate symbols, once in fs.o and once in function_remapper.o.
  For example:
  
  ld: duplicate symbol _futimens in 
generated/objects/darwin/x86_64/release/build/libroot/libroot_build_function_remapper.a(function_remapper.o)
 and 
generated/objects/darwin/x86_64/release/build/libroot/libroot_build.a(fs.o) for 
architecture x86_64
  
  I'm not sure why that is.

                                     [ John Scipione <jscipione@xxxxxxxxx> ]

----------------------------------------------------------------------------

Revision:    hrev44516
Commit:      a43b1ed6d894723ed5dbc26e2c399e8ad46022d6
URL:         http://cgit.haiku-os.org/haiku/commit/?id=a43b1ed
Author:      John Scipione <jscipione@xxxxxxxxx>
Date:        Sat Aug 11 22:26:36 2012 UTC

Ticket:      https://dev.haiku-os.org/ticket/8857

----------------------------------------------------------------------------

9 files changed, 77 insertions(+), 65 deletions(-)
headers/build/host/darwin/fcntl.h      |   34 +++++++++++++++++++++
headers/build/host/darwin/stdio.h      |   17 +++++++++++
headers/build/host/darwin/sys/stat.h   |    8 +++--
headers/build/host/darwin/unistd.h     |   20 +++++++++++++
headers/build/host/freebsd/sys/stat.h  |    6 +---
src/build/libroot/fs.cpp               |    2 --
src/build/libroot/fs_darwin.cpp        |    2 --
src/build/libroot/fs_darwin.h          |   44 ----------------------------
src/build/libroot/remapped_functions.h |    9 ------

----------------------------------------------------------------------------

diff --git a/headers/build/host/darwin/fcntl.h 
b/headers/build/host/darwin/fcntl.h
new file mode 100644
index 0000000..36810e3
--- /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 <fcntl.h>
+#include <sys/time.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 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 0000000..0843207
--- /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 <stdio.h>
+
+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 0742c97..cd742a9 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 <sys/stat.h>
-
 #include <sys/cdefs.h>
 
-
 #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 0000000..c451674
--- /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 <unistd.h>
+
+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 4276f92..5f06ac7 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 <sys/stat.h>
-
 #include <sys/cdefs.h>
 
-
 #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 13a0fdd..fd62acf 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 115c72d..3bd669f 100644
--- a/src/build/libroot/fs_darwin.cpp
+++ b/src/build/libroot/fs_darwin.cpp
@@ -5,8 +5,6 @@
  */
 
 
-#include "fs_darwin.h"
-
 #include <dirent.h>
 #include <errno.h>
 #include <fcntl.h>
diff --git a/src/build/libroot/fs_darwin.h b/src/build/libroot/fs_darwin.h
deleted file mode 100644
index 66c5726..0000000
--- a/src/build/libroot/fs_darwin.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright 2005-2011, Ingo Weinhold, ingo_weinhold@xxxxxxx
- * Copyright 2012, John Scipione, jscipione@xxxxxxxxxx
- * 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 6b940e7..01190bb 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 <fcntl.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <sys/stat.h>
-
-
 #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


Other related posts: