diff options
author | Ella-0 <23418164+Ella-0@users.noreply.github.com> | 2021-05-01 10:50:13 +0000 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2021-05-02 04:48:46 -0500 |
commit | 76676d772db4b7878fc82a879c55e04f21cfbb1d (patch) | |
tree | fbfb760ce0507ca2ac66503c80f8e67e9cd2e1ba /lib/portability.h | |
parent | ecdd8def34c8fb887ac879296b485afcdbf01aed (diff) | |
download | toybox-76676d772db4b7878fc82a879c55e04f21cfbb1d.tar.gz |
Add OpenBSD support
Diffstat (limited to 'lib/portability.h')
-rw-r--r-- | lib/portability.h | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/portability.h b/lib/portability.h index 54f97afd..bb792f10 100644 --- a/lib/portability.h +++ b/lib/portability.h @@ -133,7 +133,7 @@ void *memmem(const void *haystack, size_t haystack_length, #define bswap_32(x) OSSwapInt32(x) #define bswap_64(x) OSSwapInt64(x) -#elif defined(__FreeBSD__) +#elif defined(__FreeBSD__) || defined(__OpenBSD__) #include <sys/endian.h> @@ -184,7 +184,7 @@ void *memmem(const void *haystack, size_t haystack_length, #ifdef __APPLE__ #include <util.h> -#elif !defined(__FreeBSD__) +#elif !defined(__FreeBSD__) && !defined(__OpenBSD__) #include <pty.h> #else #include <termios.h> @@ -208,13 +208,16 @@ ssize_t xattr_lset(const char*, const char*, const void*, size_t, int); ssize_t xattr_fset(int, const char*, const void*, size_t, int); #endif -#ifdef __APPLE__ +#if defined(__APPLE__) // macOS doesn't have these functions, but we can fake them. int mknodat(int, const char*, mode_t, dev_t); int posix_fallocate(int, off_t, off_t); // macOS keeps newlocale(3) in the non-POSIX <xlocale.h> rather than <locale.h>. #include <xlocale.h> +#endif + +#if defined(__APPLE__) || defined(__OpenBSD__) static inline long statfs_bsize(struct statfs *sf) { return sf->f_iosize; } static inline long statfs_frsize(struct statfs *sf) { return sf->f_bsize; } #else |