Consider both FreeBSD and OpenBSD "bsd"

This commit is contained in:
Steven Dee 2013-10-07 12:31:41 -04:00
parent ab35a08774
commit 1a6f18d09d
8 changed files with 16 additions and 14 deletions

View File

@ -11,7 +11,9 @@ ifeq ($(UNAME),Darwin)
else ifeq ($(UNAME),Linux)
OS=linux
else ifeq ($(UNAME),FreeBSD)
OS=freebsd
OS=bsd
else ifeq ($(UNAME),OpenBSD))
OS=bsd
else
$(error unknown unix)
endif
@ -43,7 +45,7 @@ endif
ifeq ($(OS),linux)
OSLIBS=-lcrypto -lpthread -lrt -lcurses
endif
ifeq ($(OS),freebsd)
ifeq ($(OS),bsd)
OSLIBS=-lcrypto -lpthread -lncurses -lkvm
endif

View File

@ -126,7 +126,7 @@ u2_cf_flat_date(u2_noun pas)
#elif defined(U2_OS_osx)
return ( ((c3_d)pas_s.st_mtimespec.tv_sec) +
((c3_d)(pas_s.st_mtimespec.tv_nsec / 1000)) );
#elif defined(U2_OS_freebsd)
#elif defined(U2_OS_bsd)
return ( ((c3_d)pas_s.st_mtim.tv_sec) +
((c3_d)(pas_s.st_mtim.tv_nsec / 1000)) );
#else

View File

@ -287,7 +287,7 @@ u2_loom_save(c3_w ent_w)
#elif defined(U2_OS_osx)
fcntl(ceg_u->ctl_i, F_FULLFSYNC);
fcntl(ceg_u->dat_i, F_FULLFSYNC);
#elif defined(U2_OS_freebsd)
#elif defined(U2_OS_bsd)
fsync(ceg_u->ctl_i);
fsync(ceg_u->dat_i);
#else

View File

@ -138,8 +138,8 @@ _tx_samp_on(u2_ray rac_r)
sig_s.sa_flags = 0;
#elif defined(U2_OS_linux)
// TODO: support profiling on linux
#elif defined(U2_OS_freebsd)
// TODO: support profiling on freebsd
#elif defined(U2_OS_bsd)
// TODO: support profiling on bsd
#else
#error "port: profiling"
#endif

View File

@ -312,7 +312,7 @@ u2_ux_fresh(const c3_c* paf_c,
(nam_stat.st_mtimespec.tv_sec > nom_stat.st_mtimespec.tv_sec) ||
((nam_stat.st_mtimespec.tv_sec == (nam_stat.st_mtimespec.tv_sec)) &&
(nam_stat.st_mtimespec.tv_nsec > nom_stat.st_mtimespec.tv_nsec))
#elif defined(U2_OS_freebsd)
#elif defined(U2_OS_bsd)
(nam_stat.st_mtim.tv_sec > nom_stat.st_mtim.tv_sec) ||
((nam_stat.st_mtim.tv_sec == (nom_stat.st_mtim.tv_sec)) &&
(nam_stat.st_mtim.tv_nsec > nom_stat.st_mtim.tv_nsec))

View File

@ -5,7 +5,7 @@
#include "all.h"
#include "../pit.h"
#if defined(U2_OS_linux) || defined(U2_OS_freebsd)
#if defined(U2_OS_linux) || defined(U2_OS_bsd)
#include <openssl/sha.h>
#elif defined(U2_OS_osx)
#include <CommonCrypto/CommonDigest.h>
@ -25,7 +25,7 @@
u2_bytes(0, met_w, fat_y, a);
{
c3_y dig_y[32];
#if defined(U2_OS_linux) || defined(U2_OS_freebsd)
#if defined(U2_OS_linux) || defined(U2_OS_bsd)
SHA256_CTX ctx_h;
SHA256_Init(&ctx_h);

View File

@ -47,7 +47,7 @@
# include <sys/resource.h>
# include <sys/mman.h>
# elif defined(U2_OS_freebsd)
# elif defined(U2_OS_bsd)
# include <stdlib.h>
# include <string.h>
# include <stdarg.h>
@ -79,7 +79,7 @@
# define U2_OS_LoomBase 0x4000000
# endif
# define U2_OS_LoomBits 28 // ie, 2^28 words == 1GB
# elif defined(U2_OS_freebsd)
# elif defined(U2_OS_bsd)
# ifdef __LP64__
# define U2_OS_LoomBase 0x200000000
# else
@ -128,7 +128,7 @@
/* Byte swapping.
*/
# if defined(U2_OS_linux) || defined(U2_OS_freebsd)
# if defined(U2_OS_linux) || defined(U2_OS_bsd)
# define c3_bswap_16(x) bswap_16(x)
# define c3_bswap_32(x) bswap_32(x)
# define c3_bswap_64(x) bswap_64(x)
@ -147,7 +147,7 @@
# define c3_stat_mtime(dp) (u2_time_t_in_ts((dp)->st_mtime))
# elif defined(U2_OS_osx)
# define c3_stat_mtime(dp) (u2_time_in_ts(&((dp)->st_mtimespec)))
# elif defined(U2_OS_freebsd)
# elif defined(U2_OS_bsd)
# define c3_stat_mtime(dp) (u2_time_in_ts(&((dp)->st_mtim)))
# else
# error "port: timeconvert"

View File

@ -129,7 +129,7 @@ u2_unix_acquire(c3_c* pax_c)
fdatasync(fid_i);
#elif defined(U2_OS_osx)
fcntl(fid_i, F_FULLFSYNC);
#elif defined(U2_OS_freebsd)
#elif defined(U2_OS_bsd)
fsync(fid_i);
#else
#error "port: datasync"