Fix build by adding some Mac OS X specific files that implement fs function missing on that OS. The functions are stubbed out currently and have not been implemented. However, it does build now. I also added a weak attribute in driver_settings.cpp that I have no idea what does but was necessary to fix the build.
This commit is contained in:
parent
4183675895
commit
9d6e5fdb65
34
headers/build/host/darwin/sys/stat.h
Normal file
34
headers/build/host/darwin/sys/stat.h
Normal file
@ -0,0 +1,34 @@
|
||||
#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)
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
/* assume that futimens() and utimensat() aren't available */
|
||||
int futimens(int fd, const struct timespec times[2]);
|
||||
int utimensat(int fd, const char* path, const struct timespec times[2],
|
||||
int flag);
|
||||
|
||||
__END_DECLS
|
||||
|
||||
# ifndef _HAIKU_BUILD_NO_FUTIMENS
|
||||
# define _HAIKU_BUILD_NO_FUTIMENS 1
|
||||
# endif
|
||||
# ifndef _HAIKU_BUILD_NO_FUTIMESAT
|
||||
# define _HAIKU_BUILD_NO_FUTIMESAT 1
|
||||
# endif
|
||||
# ifndef _HAIKU_BUILD_NO_UTIMENSAT
|
||||
# define _HAIKU_BUILD_NO_UTIMENSAT 1
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* _HAIKU_BUILD_COMPATIBILITY_DARWIN_SYS_STAT */
|
@ -50,6 +50,10 @@ if $(HOST_PLATFORM) = freebsd {
|
||||
hostPlatformSources = fs_freebsd.cpp ;
|
||||
}
|
||||
|
||||
if $(HOST_PLATFORM) = darwin {
|
||||
hostPlatformSources = fs_darwin.cpp ;
|
||||
}
|
||||
|
||||
local librootSources =
|
||||
atomic.cpp
|
||||
byteorder.cpp
|
||||
|
@ -31,6 +31,8 @@
|
||||
|
||||
#if defined(HAIKU_HOST_PLATFORM_FREEBSD)
|
||||
# include "fs_freebsd.h"
|
||||
#elif defined(HAIKU_HOST_PLATFORM_DARWIN)
|
||||
# include "fs_darwin.h"
|
||||
#endif
|
||||
|
||||
|
||||
@ -45,6 +47,13 @@ using namespace BPrivate;
|
||||
# define haiku_host_platform_writev haiku_freebsd_writev
|
||||
# define HAIKU_HOST_STAT_ATIM(x) ((x).st_atimespec)
|
||||
# define HAIKU_HOST_STAT_MTIM(x) ((x).st_mtimespec)
|
||||
#elif defined(HAIKU_HOST_PLATFORM_DARWIN)
|
||||
# define haiku_host_platform_read read
|
||||
# define haiku_host_platform_write write
|
||||
# define haiku_host_platform_readv readv
|
||||
# define haiku_host_platform_writev writev
|
||||
# define HAIKU_HOST_STAT_ATIM(x) ((x).st_atimespec)
|
||||
# define HAIKU_HOST_STAT_MTIM(x) ((x).st_mtimespec)
|
||||
#else
|
||||
# define haiku_host_platform_read read
|
||||
# define haiku_host_platform_write write
|
||||
@ -65,6 +74,139 @@ using namespace BPrivate;
|
||||
} while (0)
|
||||
|
||||
|
||||
#if defined(_HAIKU_BUILD_NO_FUTIMENS) || defined(_HAIKU_BUILD_NO_FUTIMENS)
|
||||
|
||||
template<typename File>
|
||||
static int
|
||||
utimes_helper(File& file, const struct timespec times[2])
|
||||
{
|
||||
if (times == NULL)
|
||||
return file.SetTimes(NULL);
|
||||
|
||||
timeval timeBuffer[2];
|
||||
timeBuffer[0].tv_sec = times[0].tv_sec;
|
||||
timeBuffer[0].tv_usec = times[0].tv_nsec / 1000;
|
||||
timeBuffer[1].tv_sec = times[1].tv_sec;
|
||||
timeBuffer[1].tv_usec = times[1].tv_nsec / 1000;
|
||||
|
||||
if (times[0].tv_nsec == UTIME_OMIT || times[1].tv_nsec == UTIME_OMIT) {
|
||||
struct stat st;
|
||||
if (file.GetStat(st) != 0)
|
||||
return -1;
|
||||
|
||||
if (times[0].tv_nsec == UTIME_OMIT && times[1].tv_nsec == UTIME_OMIT)
|
||||
return 0;
|
||||
|
||||
if (times[0].tv_nsec == UTIME_OMIT) {
|
||||
timeBuffer[0].tv_sec = st.st_atimespec.tv_sec;
|
||||
timeBuffer[0].tv_usec = st.st_atimespec.tv_nsec / 1000;
|
||||
}
|
||||
|
||||
if (times[1].tv_nsec == UTIME_OMIT) {
|
||||
timeBuffer[1].tv_sec = st.st_mtimespec.tv_sec;
|
||||
timeBuffer[1].tv_usec = st.st_mtimespec.tv_nsec / 1000;
|
||||
}
|
||||
}
|
||||
|
||||
if (times[0].tv_nsec == UTIME_NOW || times[1].tv_nsec == UTIME_NOW) {
|
||||
timeval now;
|
||||
gettimeofday(&now, NULL);
|
||||
|
||||
if (times[0].tv_nsec == UTIME_NOW)
|
||||
timeBuffer[0] = now;
|
||||
|
||||
if (times[1].tv_nsec == UTIME_NOW)
|
||||
timeBuffer[1] = now;
|
||||
}
|
||||
|
||||
return file.SetTimes(timeBuffer);
|
||||
}
|
||||
|
||||
#endif // _HAIKU_BUILD_NO_FUTIMENS || _HAIKU_BUILD_NO_FUTIMENS
|
||||
|
||||
|
||||
#ifdef _HAIKU_BUILD_NO_FUTIMENS
|
||||
|
||||
struct FDFile {
|
||||
FDFile(int fd)
|
||||
:
|
||||
fFD(fd)
|
||||
{
|
||||
}
|
||||
|
||||
int GetStat(struct stat& _st)
|
||||
{
|
||||
return fstat(fFD, &_st);
|
||||
}
|
||||
|
||||
int SetTimes(const timeval times[2])
|
||||
{
|
||||
return futimes(fFD, times);
|
||||
}
|
||||
|
||||
private:
|
||||
int fFD;
|
||||
};
|
||||
|
||||
|
||||
int
|
||||
futimens(int fd, const struct timespec times[2])
|
||||
{
|
||||
FDFile file(fd);
|
||||
return utimes_helper(file, times);
|
||||
}
|
||||
|
||||
#endif // _HAIKU_BUILD_NO_FUTIMENS
|
||||
|
||||
#ifdef _HAIKU_BUILD_NO_FUTIMESAT
|
||||
|
||||
int
|
||||
futimesat(int fd, const char *path, const struct timeval times[2]) {
|
||||
FDFile file(fd);
|
||||
return futimes(fd, times);
|
||||
}
|
||||
|
||||
#endif // _HAIKU_BUILD_NO_FUTIMESAT
|
||||
|
||||
#ifdef _HAIKU_BUILD_NO_UTIMENSAT
|
||||
|
||||
struct FDPathFile {
|
||||
FDPathFile(int fd, const char* path, int flag)
|
||||
:
|
||||
fFD(fd),
|
||||
fPath(path),
|
||||
fFlag(flag)
|
||||
{
|
||||
}
|
||||
|
||||
int GetStat(struct stat& _st)
|
||||
{
|
||||
return fstatat(fFD, fPath, &_st, fFlag);
|
||||
}
|
||||
|
||||
int SetTimes(const timeval times[2])
|
||||
{
|
||||
// TODO: fFlag (AT_SYMLINK_NOFOLLOW) is not supported here!
|
||||
return futimesat(fFD, fPath, times);
|
||||
}
|
||||
|
||||
private:
|
||||
int fFD;
|
||||
const char* fPath;
|
||||
int fFlag;
|
||||
};
|
||||
|
||||
|
||||
int
|
||||
utimensat(int fd, const char* path, const struct timespec times[2], int flag)
|
||||
{
|
||||
FDPathFile file(fd, path, flag);
|
||||
return utimes_helper(file, times);
|
||||
}
|
||||
|
||||
#endif // _HAIKU_BUILD_NO_UTIMENSAT
|
||||
|
||||
|
||||
static status_t get_path(dev_t device, ino_t node, const char *name,
|
||||
string &path);
|
||||
|
||||
|
99
src/build/libroot/fs_darwin.cpp
Normal file
99
src/build/libroot/fs_darwin.cpp
Normal file
@ -0,0 +1,99 @@
|
||||
/*
|
||||
* Copyright 2011, John Scipione, jscipione@gmail.com.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
|
||||
#include "fs_darwin.h"
|
||||
|
||||
#include <dirent.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
|
||||
|
||||
int
|
||||
faccessat(int fd, const char* path, int accessMode, int flag)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
fchmodat(int fd, const char* path, mode_t mode, int flag)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
fchownat(int fd, const char* path, uid_t owner, gid_t group, int flag)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
fstatat(int fd, const char *path, struct stat *st, int flag)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
mkdirat(int fd, const char *path, mode_t mode)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
mkfifoat(int fd, const char *path, mode_t mode)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
mknodat(int fd, const char *name, mode_t mode, dev_t dev)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
renameat(int fromFD, const char* from, int toFD, const char* to)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
ssize_t
|
||||
readlinkat(int fd, const char *path, char *buffer, size_t bufferSize)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
symlinkat(const char *toPath, int fd, const char *symlinkPath)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
unlinkat(int fd, const char *path, int flag)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
linkat(int toFD, const char *toPath, int linkFD, const char *linkPath, int flag)
|
||||
{
|
||||
return 0;
|
||||
}
|
31
src/build/libroot/fs_darwin.h
Normal file
31
src/build/libroot/fs_darwin.h
Normal file
@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Copyright 2011, John Scipione, jscipione@gmail.com.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef FS_DARWIN_H
|
||||
#define FS_DARWIN_H
|
||||
|
||||
/* flags for the *at() functions */
|
||||
#define AT_FDCWD (-1) /* CWD FD for the *at() functions */
|
||||
|
||||
#define AT_SYMLINK_NOFOLLOW 0x01 /* fstatat(), fchmodat(), fchownat(),
|
||||
utimensat() */
|
||||
#define AT_SYMLINK_FOLLOW 0x02 /* linkat() */
|
||||
#define AT_REMOVEDIR 0x04 /* unlinkat() */
|
||||
#define AT_EACCESS 0x08 /* faccessat() */
|
||||
|
||||
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 fromFD, const char* from, int toFD, const char* to);
|
||||
|
||||
ssize_t readlinkat(int fd, const char *path, char *buffer, size_t bufferSize);
|
||||
int symlinkat(const char *toPath, int fd, const char *symlinkPath);
|
||||
int unlinkat(int fd, const char *path, int flag);
|
||||
int linkat(int toFD, const char *toPath, int linkFD, const char *linkPath, int flag);
|
||||
|
||||
#endif // FS_DARWIN_H
|
@ -254,127 +254,3 @@ haiku_freebsd_writev(int fd, const struct iovec *vecs, size_t count)
|
||||
|
||||
return bytesWritten;
|
||||
}
|
||||
|
||||
|
||||
#if defined(_HAIKU_BUILD_NO_FUTIMENS) || defined(_HAIKU_BUILD_NO_FUTIMENS)
|
||||
|
||||
template<typename File>
|
||||
static int
|
||||
utimes_helper(File& file, const struct timespec times[2])
|
||||
{
|
||||
if (times == NULL)
|
||||
return file.SetTimes(NULL);
|
||||
|
||||
timeval timeBuffer[2];
|
||||
timeBuffer[0].tv_sec = times[0].tv_sec;
|
||||
timeBuffer[0].tv_usec = times[0].tv_nsec / 1000;
|
||||
timeBuffer[1].tv_sec = times[1].tv_sec;
|
||||
timeBuffer[1].tv_usec = times[1].tv_nsec / 1000;
|
||||
|
||||
if (times[0].tv_nsec == UTIME_OMIT || times[1].tv_nsec == UTIME_OMIT) {
|
||||
struct stat st;
|
||||
if (file.GetStat(st) != 0)
|
||||
return -1;
|
||||
|
||||
if (times[0].tv_nsec == UTIME_OMIT && times[1].tv_nsec == UTIME_OMIT)
|
||||
return 0;
|
||||
|
||||
if (times[0].tv_nsec == UTIME_OMIT) {
|
||||
timeBuffer[0].tv_sec = st.st_atimespec.tv_sec;
|
||||
timeBuffer[0].tv_usec = st.st_atimespec.tv_nsec / 1000;
|
||||
}
|
||||
|
||||
if (times[1].tv_nsec == UTIME_OMIT) {
|
||||
timeBuffer[1].tv_sec = st.st_mtimespec.tv_sec;
|
||||
timeBuffer[1].tv_usec = st.st_mtimespec.tv_nsec / 1000;
|
||||
}
|
||||
}
|
||||
|
||||
if (times[0].tv_nsec == UTIME_NOW || times[1].tv_nsec == UTIME_NOW) {
|
||||
timeval now;
|
||||
gettimeofday(&now, NULL);
|
||||
|
||||
if (times[0].tv_nsec == UTIME_NOW)
|
||||
timeBuffer[0] = now;
|
||||
|
||||
if (times[1].tv_nsec == UTIME_NOW)
|
||||
timeBuffer[1] = now;
|
||||
}
|
||||
|
||||
return file.SetTimes(timeBuffer);
|
||||
}
|
||||
|
||||
#endif // _HAIKU_BUILD_NO_FUTIMENS || _HAIKU_BUILD_NO_FUTIMENS
|
||||
|
||||
|
||||
#ifdef _HAIKU_BUILD_NO_FUTIMENS
|
||||
|
||||
struct FDFile {
|
||||
FDFile(int fd)
|
||||
:
|
||||
fFD(fd)
|
||||
{
|
||||
}
|
||||
|
||||
int GetStat(struct stat& _st)
|
||||
{
|
||||
return fstat(fFD, &_st);
|
||||
}
|
||||
|
||||
int SetTimes(const timeval times[2])
|
||||
{
|
||||
return futimes(fFD, times);
|
||||
}
|
||||
|
||||
private:
|
||||
int fFD;
|
||||
};
|
||||
|
||||
|
||||
int
|
||||
futimens(int fd, const struct timespec times[2])
|
||||
{
|
||||
FDFile file(fd);
|
||||
return utimes_helper(file, times);
|
||||
}
|
||||
|
||||
#endif // _HAIKU_BUILD_NO_FUTIMENS
|
||||
|
||||
|
||||
#ifdef _HAIKU_BUILD_NO_UTIMENSAT
|
||||
|
||||
struct FDPathFile {
|
||||
FDPathFile(int fd, const char* path, int flag)
|
||||
:
|
||||
fFD(fd),
|
||||
fPath(path),
|
||||
fFlag(flag)
|
||||
{
|
||||
}
|
||||
|
||||
int GetStat(struct stat& _st)
|
||||
{
|
||||
return fstatat(fFD, fPath, &_st, fFlag);
|
||||
}
|
||||
|
||||
int SetTimes(const timeval times[2])
|
||||
{
|
||||
// TODO: fFlag (AT_SYMLINK_NOFOLLOW) is not supported here!
|
||||
return futimesat(fFD, fPath, times);
|
||||
}
|
||||
|
||||
private:
|
||||
int fFD;
|
||||
const char* fPath;
|
||||
int fFlag;
|
||||
};
|
||||
|
||||
|
||||
int
|
||||
utimensat(int fd, const char* path, const struct timespec times[2], int flag)
|
||||
{
|
||||
FDPathFile file(fd, path, flag);
|
||||
return utimes_helper(file, times);
|
||||
}
|
||||
|
||||
#endif // _HAIKU_BUILD_NO_UTIMENSAT
|
||||
|
@ -977,5 +977,5 @@ get_driver_settings(void *handle)
|
||||
// this creates an alias of the above function
|
||||
// unload_driver_settings() is the same as delete_driver_settings()
|
||||
extern "C" __typeof(unload_driver_settings) delete_driver_settings
|
||||
__attribute__((alias ("unload_driver_settings")));
|
||||
__attribute__((weak, alias ("unload_driver_settings")));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user