Ticket #8857: 0002-Move-POSIX-functions-for-Darwin-to-build-headers.patch

File 0002-Move-POSIX-functions-for-Darwin-to-build-headers.patch, 6.9 KB (added by nielx, 7 years ago)
  • new file headers/build/host/darwin/fcntl.h

    From 13d4a1c1fe51ded1c117cc2f6428ac0a20c2bea7 Mon Sep 17 00:00:00 2001
    From: Niels Sascha Reedijk <niels.reedijk@gmail.com>
    Date: Wed, 8 Aug 2012 23:06:20 +0200
    Subject: [PATCH 2/3] Move POSIX functions for Darwin to build headers.
    
    The package-management branch requires access to the POSIX features that were
    missing from Darwin and that were implemented in the libroot_build.so. They are
    now moved to the appropriate headers so that host build tools can use them.
    ---
     headers/build/host/darwin/fcntl.h    |   36 ++++++++++++++++++++++++++++
     headers/build/host/darwin/stdio.h    |   18 ++++++++++++++
     headers/build/host/darwin/sys/stat.h |   14 +++++++++++
     headers/build/host/darwin/unistd.h   |   21 ++++++++++++++++
     src/build/libroot/fs.cpp             |    2 --
     src/build/libroot/fs_darwin.cpp      |    2 --
     src/build/libroot/fs_darwin.h        |   44 ----------------------------------
     7 files changed, 89 insertions(+), 48 deletions(-)
     create mode 100644 headers/build/host/darwin/fcntl.h
     create mode 100644 headers/build/host/darwin/stdio.h
     create mode 100644 headers/build/host/darwin/unistd.h
     delete mode 100644 src/build/libroot/fs_darwin.h
    
    diff --git a/headers/build/host/darwin/fcntl.h b/headers/build/host/darwin/fcntl.h
    new file mode 100644
    index 0000000..fe81882
    - +  
     1#ifndef _HAIKU_BUILD_COMPATIBILITY_DARWIN_FCNTL
     2#define _HAIKU_BUILD_COMPATIBILITY_DARWIN_FCNTL
     3
     4#ifdef __cplusplus
     5extern "C" {
     6#endif
     7
     8#include_next <fcntl.h>
     9#include <sys/time.h>
     10
     11    /*
     12     * Magic value that specify the use of the current working directory
     13     * to determine the target of relative file paths in the openat() and
     14     * similar syscalls.
     15     */
     16#define AT_FDCWD            -100    /* CWD FD for the *at() functions */
     17   
     18    /*
     19     * Miscellaneous flags for the *at() syscalls.
     20     */
     21#define AT_EACCESS          0x100   /* faccessat() */
     22#define AT_SYMLINK_NOFOLLOW 0x200   /* fstatat(), fchmodat(), fchownat(),
     23utimensat() */
     24#define AT_SYMLINK_FOLLOW   0x400   /* linkat() */
     25#define AT_REMOVEDIR        0x800   /* unlinkat() */
     26   
     27
     28int unlinkat(int fd, const char *path, int flag);
     29int futimesat(int fd, const char *path, const struct timeval times[2]);
     30   
     31   
     32#ifdef __cplusplus
     33}
     34#endif
     35
     36#endif  // _HAIKU_BUILD_COMPATIBILITY_DARWIN_FCNTL
  • new file headers/build/host/darwin/stdio.h

    diff --git a/headers/build/host/darwin/stdio.h b/headers/build/host/darwin/stdio.h
    new file mode 100644
    index 0000000..4bfc494
    - +  
     1#ifndef _HAIKU_BUILD_COMPATIBILITY_DARWIN_STDIO
     2#define _HAIKU_BUILD_COMPATIBILITY_DARWIN_STDIO
     3
     4#ifdef __cplusplus
     5extern "C" {
     6#endif
     7
     8#include_next <stdio.h>
     9
     10int renameat(int oldFD, const char* oldPath, int newFD, const char* newPath);
     11int symlinkat(const char *oldPath, int fd, const char *newPath);
     12   
     13   
     14#ifdef __cplusplus
     15}
     16#endif
     17
     18#endif  // _HAIKU_BUILD_COMPATIBILITY_DARWIN_STDIO
  • headers/build/host/darwin/sys/stat.h

    diff --git a/headers/build/host/darwin/sys/stat.h b/headers/build/host/darwin/sys/stat.h
    index 04ca945..0a92f03 100644
    a b  
    11#ifndef _HAIKU_BUILD_COMPATIBILITY_DARWIN_SYS_STAT
    22#define _HAIKU_BUILD_COMPATIBILITY_DARWIN_SYS_STAT
    33
     4#ifdef __cplusplus
     5extern "C" {
     6#endif
    47
    58#include_next <sys/stat.h>
    69
     
    2932#endif
    3033
    3134
     35int fchmodat(int fd, const char* path, mode_t mode, int flag);
     36int fstatat(int fd, const char *path, struct stat *st, int flag);
     37int mkdirat(int fd, const char *path, mode_t mode);
     38int mkfifoat(int fd, const char *path, mode_t mode);
     39int mknodat(int fd, const char *name, mode_t mode, dev_t dev);
     40
     41
     42#ifdef __cplusplus
     43}
     44#endif
     45
    3246#endif  /* _HAIKU_BUILD_COMPATIBILITY_DARWIN_SYS_STAT */
  • new file headers/build/host/darwin/unistd.h

    diff --git a/headers/build/host/darwin/unistd.h b/headers/build/host/darwin/unistd.h
    new file mode 100644
    index 0000000..7632834
    - +  
     1#ifndef _HAIKU_BUILD_COMPATIBILITY_DARWIN_UNISTD
     2#define _HAIKU_BUILD_COMPATIBILITY_DARWIN_UNISTD
     3
     4#ifdef __cplusplus
     5extern "C" {
     6#endif
     7
     8#include_next <unistd.h>
     9
     10int faccessat(int fd, const char* path, int accessMode, int flag);
     11int fchownat(int fd, const char* path, uid_t owner, gid_t group, int flag);
     12ssize_t readlinkat(int fd, const char *path, char *buffer, size_t bufferSize);
     13int linkat(int oldFD, const char *oldPath, int newFD, const char *newPath,
     14               int flag);
     15   
     16   
     17#ifdef __cplusplus
     18}
     19#endif
     20
     21#endif  // _HAIKU_BUILD_COMPATIBILITY_DARWIN_UNISTD
  • src/build/libroot/fs.cpp

    diff --git a/src/build/libroot/fs.cpp b/src/build/libroot/fs.cpp
    index 13a0fdd..fd62acf 100644
    a b  
    3131
    3232#if defined(HAIKU_HOST_PLATFORM_FREEBSD)
    3333#   include "fs_freebsd.h"
    34 #elif defined(HAIKU_HOST_PLATFORM_DARWIN)
    35 #   include "fs_darwin.h"
    3634#endif
    3735
    3836
  • src/build/libroot/fs_darwin.cpp

    diff --git a/src/build/libroot/fs_darwin.cpp b/src/build/libroot/fs_darwin.cpp
    index c4400da..1c58577 100644
    a b  
    55 */
    66
    77
    8 #include "fs_darwin.h"
    9 
    108#include <dirent.h>
    119#include <errno.h>
    1210#include <fcntl.h>
  • deleted file src/build/libroot/fs_darwin.h

    diff --git a/src/build/libroot/fs_darwin.h b/src/build/libroot/fs_darwin.h
    deleted file mode 100644
    index 66c5726..0000000
    + -  
    1 /*
    2  * Copyright 2005-2011, Ingo Weinhold, ingo_weinhold@gmx.de.
    3  * Copyright 2012, John Scipione, jscipione@gmail.com.
    4  * Distributed under the terms of the MIT License.
    5  */
    6 #ifndef FS_DARWIN_H
    7 #define FS_DARWIN_H
    8 
    9 
    10 /*
    11  * Magic value that specify the use of the current working directory
    12  * to determine the target of relative file paths in the openat() and
    13  * similar syscalls.
    14  */
    15 #define AT_FDCWD            -100    /* CWD FD for the *at() functions */
    16 
    17 /*
    18  * Miscellaneous flags for the *at() syscalls.
    19  */
    20 #define AT_EACCESS          0x100   /* faccessat() */
    21 #define AT_SYMLINK_NOFOLLOW 0x200   /* fstatat(), fchmodat(), fchownat(),
    22                                         utimensat() */
    23 #define AT_SYMLINK_FOLLOW   0x400   /* linkat() */
    24 #define AT_REMOVEDIR        0x800   /* unlinkat() */
    25 
    26 int faccessat(int fd, const char* path, int accessMode, int flag);
    27 int fchmodat(int fd, const char* path, mode_t mode, int flag);
    28 int fchownat(int fd, const char* path, uid_t owner, gid_t group, int flag);
    29 int fstatat(int fd, const char *path, struct stat *st, int flag);
    30 int mkdirat(int fd, const char *path, mode_t mode);
    31 int mkfifoat(int fd, const char *path, mode_t mode);
    32 int mknodat(int fd, const char *name, mode_t mode, dev_t dev);
    33 int renameat(int oldFD, const char* oldPath, int newFD, const char* newPath);
    34 
    35 ssize_t readlinkat(int fd, const char *path, char *buffer, size_t bufferSize);
    36 int symlinkat(const char *oldPath, int fd, const char *newPath);
    37 int unlinkat(int fd, const char *path, int flag);
    38 int linkat(int oldFD, const char *oldPath, int newFD, const char *newPath,
    39     int flag);
    40 
    41 int futimesat(int fd, const char *path, const struct timeval times[2]);
    42 
    43 
    44 #endif // FS_DARWIN_H