From 1a6f18d09d86c050dc396f2664457ca8decd1d00 Mon Sep 17 00:00:00 2001 From: Steven Dee Date: Mon, 7 Oct 2013 12:31:41 -0400 Subject: [PATCH] Consider both FreeBSD and OpenBSD "bsd" --- Makefile | 6 ++++-- f/coal.c | 2 +- f/loom.c | 2 +- f/trac.c | 4 ++-- f/unix.c | 2 +- gen191/5/shax.c | 4 ++-- include/c/portable.h | 8 ++++---- v/unix.c | 2 +- 8 files changed, 16 insertions(+), 14 deletions(-) diff --git a/Makefile b/Makefile index cbba8d7a55..61f1c7893b 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/f/coal.c b/f/coal.c index 4f2e037c04..d52e5863a8 100644 --- a/f/coal.c +++ b/f/coal.c @@ -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 diff --git a/f/loom.c b/f/loom.c index 9d2fecf339..6f13453774 100644 --- a/f/loom.c +++ b/f/loom.c @@ -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 diff --git a/f/trac.c b/f/trac.c index f592e97b55..c9dbc3b6b4 100644 --- a/f/trac.c +++ b/f/trac.c @@ -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 diff --git a/f/unix.c b/f/unix.c index cee9c74891..37323fb304 100644 --- a/f/unix.c +++ b/f/unix.c @@ -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)) diff --git a/gen191/5/shax.c b/gen191/5/shax.c index 780851f8fe..fa00f69c32 100644 --- a/gen191/5/shax.c +++ b/gen191/5/shax.c @@ -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 #elif defined(U2_OS_osx) #include @@ -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); diff --git a/include/c/portable.h b/include/c/portable.h index d42a6ce444..770bb7f68e 100644 --- a/include/c/portable.h +++ b/include/c/portable.h @@ -47,7 +47,7 @@ # include # include -# elif defined(U2_OS_freebsd) +# elif defined(U2_OS_bsd) # include # include # include @@ -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" diff --git a/v/unix.c b/v/unix.c index 357bbba668..bcd324f3fc 100644 --- a/v/unix.c +++ b/v/unix.c @@ -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"