commit d44819ae9c55f4d3c0f347b2640f58a2deddebb4
parent 8923a6ffa3da869b5fc56b9b1f698f483e3180a4
Author: Laurent Bercot <ska-skaware@skarnet.org>
Date: Mon, 22 Jul 2019 13:58:11 +0000
Factor all the BSD complaints into one new header
Diffstat:
19 files changed, 98 insertions(+), 100 deletions(-)
diff --git a/package/deps.mak b/package/deps.mak
@@ -22,7 +22,7 @@ src/include/skalibs/djbunix.h: src/include/skalibs/envalloc.h src/include/skalib
src/include/skalibs/env.h: src/include/skalibs/gccattributes.h src/include/skalibs/stralloc.h
src/include/skalibs/envalloc.h: src/include/skalibs/genalloc.h
src/include/skalibs/environ.h: src/include/skalibs/posixplz.h
-src/include/skalibs/error.h: src/include/skalibs/gccattributes.h src/include/skalibs/sysdeps.h
+src/include/skalibs/error.h: src/include/skalibs/gccattributes.h
src/include/skalibs/fmtscan.h: src/include/skalibs/gccattributes.h
src/include/skalibs/genalloc.h: src/include/skalibs/functypes.h src/include/skalibs/stralloc.h
src/include/skalibs/genqdyn.h: src/include/skalibs/stralloc.h
@@ -70,10 +70,10 @@ src/libstddjb/djbtime-internal.h: src/include/skalibs/uint64.h
src/libstddjb/fmtscan-internal.h: src/include/skalibs/fmtscan.h src/include/skalibs/uint64.h
src/libstddjb/selfpipe-internal.h: src/include/skalibs/sig.h src/include/skalibs/sysdeps.h
src/libunixonacid/skaclient-internal.h: src/include/skalibs/kolbak.h src/include/skalibs/skaclient.h src/include/skalibs/unixmessage.h
-src/libbiguint/bu_addc.o src/libbiguint/bu_addc.lo: src/libbiguint/bu_addc.c src/include/skalibs/biguint.h
+src/libbiguint/bu_addc.o src/libbiguint/bu_addc.lo: src/libbiguint/bu_addc.c src/include/skalibs/biguint.h src/include/skalibs/bsdsnowflake.h
src/libbiguint/bu_addmod.o src/libbiguint/bu_addmod.lo: src/libbiguint/bu_addmod.c src/include/skalibs/biguint.h
src/libbiguint/bu_cmp.o src/libbiguint/bu_cmp.lo: src/libbiguint/bu_cmp.c src/include/skalibs/biguint.h
-src/libbiguint/bu_copy.o src/libbiguint/bu_copy.lo: src/libbiguint/bu_copy.c src/include/skalibs/biguint.h
+src/libbiguint/bu_copy.o src/libbiguint/bu_copy.lo: src/libbiguint/bu_copy.c src/include/skalibs/biguint.h src/include/skalibs/bsdsnowflake.h
src/libbiguint/bu_copy_internal.o src/libbiguint/bu_copy_internal.lo: src/libbiguint/bu_copy_internal.c src/include/skalibs/biguint.h
src/libbiguint/bu_div.o src/libbiguint/bu_div.lo: src/libbiguint/bu_div.c src/include/skalibs/biguint.h
src/libbiguint/bu_div_internal.o src/libbiguint/bu_div_internal.lo: src/libbiguint/bu_div_internal.c src/include/skalibs/biguint.h
@@ -88,12 +88,12 @@ src/libbiguint/bu_mul.o src/libbiguint/bu_mul.lo: src/libbiguint/bu_mul.c src/in
src/libbiguint/bu_mulmod.o src/libbiguint/bu_mulmod.lo: src/libbiguint/bu_mulmod.c src/include/skalibs/biguint.h
src/libbiguint/bu_pack.o src/libbiguint/bu_pack.lo: src/libbiguint/bu_pack.c src/include/skalibs/biguint.h src/include/skalibs/uint32.h
src/libbiguint/bu_pack_big.o src/libbiguint/bu_pack_big.lo: src/libbiguint/bu_pack_big.c src/include/skalibs/biguint.h src/include/skalibs/uint32.h
-src/libbiguint/bu_scan.o src/libbiguint/bu_scan.lo: src/libbiguint/bu_scan.c src/include/skalibs/biguint.h src/include/skalibs/bitarray.h
+src/libbiguint/bu_scan.o src/libbiguint/bu_scan.lo: src/libbiguint/bu_scan.c src/include/skalibs/biguint.h src/include/skalibs/bitarray.h src/include/skalibs/bsdsnowflake.h
src/libbiguint/bu_scan_internal.o src/libbiguint/bu_scan_internal.lo: src/libbiguint/bu_scan_internal.c src/include/skalibs/biguint.h src/include/skalibs/uint32.h
src/libbiguint/bu_scanlen.o src/libbiguint/bu_scanlen.lo: src/libbiguint/bu_scanlen.c src/include/skalibs/biguint.h src/include/skalibs/fmtscan.h
src/libbiguint/bu_slbc.o src/libbiguint/bu_slbc.lo: src/libbiguint/bu_slbc.c src/include/skalibs/biguint.h
src/libbiguint/bu_srbc.o src/libbiguint/bu_srbc.lo: src/libbiguint/bu_srbc.c src/include/skalibs/biguint.h
-src/libbiguint/bu_subc.o src/libbiguint/bu_subc.lo: src/libbiguint/bu_subc.c src/include/skalibs/biguint.h
+src/libbiguint/bu_subc.o src/libbiguint/bu_subc.lo: src/libbiguint/bu_subc.c src/include/skalibs/biguint.h src/include/skalibs/bsdsnowflake.h
src/libbiguint/bu_submod.o src/libbiguint/bu_submod.lo: src/libbiguint/bu_submod.c src/include/skalibs/biguint.h
src/libbiguint/bu_unpack.o src/libbiguint/bu_unpack.lo: src/libbiguint/bu_unpack.c src/include/skalibs/biguint.h src/include/skalibs/uint32.h
src/libbiguint/bu_unpack_big.o src/libbiguint/bu_unpack_big.lo: src/libbiguint/bu_unpack_big.c src/include/skalibs/biguint.h src/include/skalibs/uint32.h
@@ -153,7 +153,7 @@ src/libposixplz/mkhtemp.o src/libposixplz/mkhtemp.lo: src/libposixplz/mkhtemp.c
src/libposixplz/mklinktemp.o src/libposixplz/mklinktemp.lo: src/libposixplz/mklinktemp.c src/include/skalibs/djbunix.h src/libposixplz/posixplz-internal.h src/include/skalibs/posixplz.h
src/libposixplz/mkltemp.o src/libposixplz/mkltemp.lo: src/libposixplz/mkltemp.c src/include/skalibs/posixplz.h
src/libposixplz/mkptemp.o src/libposixplz/mkptemp.lo: src/libposixplz/mkptemp.c src/include/skalibs/djbunix.h src/include/skalibs/posixplz.h
-src/libposixplz/setgroups.o src/libposixplz/setgroups.lo: src/libposixplz/setgroups.c src/include/skalibs/nonposix.h src/include/skalibs/setgroups.h src/include/skalibs/sysdeps.h
+src/libposixplz/setgroups.o src/libposixplz/setgroups.lo: src/libposixplz/setgroups.c src/include/skalibs/nonposix.h src/include/skalibs/posixishard.h src/include/skalibs/setgroups.h src/include/skalibs/sysdeps.h
src/libposixplz/strnlen.o src/libposixplz/strnlen.lo: src/libposixplz/strnlen.c src/include/skalibs/bytestr.h src/include/skalibs/posixishard.h src/include/skalibs/sysdeps.h
src/libposixplz/touch.o src/libposixplz/touch.lo: src/libposixplz/touch.c src/include/skalibs/djbunix.h src/include/skalibs/nonposix.h src/include/skalibs/posixplz.h src/include/skalibs/sysdeps.h
src/libposixplz/unlink_void.o src/libposixplz/unlink_void.lo: src/libposixplz/unlink_void.c src/include/skalibs/posixplz.h
@@ -281,7 +281,7 @@ src/libstddjb/cbuffer_wseek.o src/libstddjb/cbuffer_wseek.lo: src/libstddjb/cbuf
src/libstddjb/cdb_findnext.o src/libstddjb/cdb_findnext.lo: src/libstddjb/cdb_findnext.c src/include/skalibs/cdb.h src/include/skalibs/uint32.h
src/libstddjb/cdb_free.o src/libstddjb/cdb_free.lo: src/libstddjb/cdb_free.c src/include/skalibs/cdb.h
src/libstddjb/cdb_hash.o src/libstddjb/cdb_hash.lo: src/libstddjb/cdb_hash.c src/include/skalibs/cdb.h
-src/libstddjb/cdb_init_map.o src/libstddjb/cdb_init_map.lo: src/libstddjb/cdb_init_map.c src/include/skalibs/cdb.h
+src/libstddjb/cdb_init_map.o src/libstddjb/cdb_init_map.lo: src/libstddjb/cdb_init_map.c src/include/skalibs/bsdsnowflake.h src/include/skalibs/cdb.h
src/libstddjb/cdb_make.o src/libstddjb/cdb_make.lo: src/libstddjb/cdb_make.c src/include/skalibs/buffer.h src/include/skalibs/cdb.h src/include/skalibs/cdb_make.h src/include/skalibs/diuint32.h src/include/skalibs/genalloc.h src/include/skalibs/uint32.h
src/libstddjb/cdb_mapfile.o src/libstddjb/cdb_mapfile.lo: src/libstddjb/cdb_mapfile.c src/include/skalibs/cdb.h src/include/skalibs/djbunix.h
src/libstddjb/cdb_nextkey.o src/libstddjb/cdb_nextkey.lo: src/libstddjb/cdb_nextkey.c src/include/skalibs/cdb.h src/include/skalibs/uint32.h
@@ -312,6 +312,7 @@ src/libstddjb/envalloc_make.o src/libstddjb/envalloc_make.lo: src/libstddjb/enva
src/libstddjb/envalloc_merge.o src/libstddjb/envalloc_merge.lo: src/libstddjb/envalloc_merge.c src/include/skalibs/bytestr.h src/include/skalibs/env.h src/include/skalibs/envalloc.h src/include/skalibs/genalloc.h
src/libstddjb/envalloc_uniq.o src/libstddjb/envalloc_uniq.lo: src/libstddjb/envalloc_uniq.c src/include/skalibs/bytestr.h src/include/skalibs/envalloc.h src/include/skalibs/genalloc.h
src/libstddjb/envdir.o src/libstddjb/envdir.lo: src/libstddjb/envdir.c src/include/skalibs/bytestr.h src/include/skalibs/direntry.h src/include/skalibs/djbunix.h src/include/skalibs/env.h src/include/skalibs/stralloc.h
+src/libstddjb/error_isalready.o src/libstddjb/error_isalready.lo: src/libstddjb/error_isalready.c src/include/skalibs/bsdsnowflake.h src/include/skalibs/error.h
src/libstddjb/error_temp.o src/libstddjb/error_temp.lo: src/libstddjb/error_temp.c src/include/skalibs/error.h
src/libstddjb/fd_cat.o src/libstddjb/fd_cat.lo: src/libstddjb/fd_cat.c src/include/skalibs/djbunix.h src/include/skalibs/iobuffer.h
src/libstddjb/fd_catn.o src/libstddjb/fd_catn.lo: src/libstddjb/fd_catn.c src/include/skalibs/allreadwrite.h src/include/skalibs/djbunix.h src/include/skalibs/iobuffer.h
@@ -379,8 +380,8 @@ src/libstddjb/iobufferu_flush.o src/libstddjb/iobufferu_flush.lo: src/libstddjb/
src/libstddjb/iobufferu_init.o src/libstddjb/iobufferu_init.lo: src/libstddjb/iobufferu_init.c src/include/skalibs/alloc.h src/include/skalibs/allreadwrite.h src/include/skalibs/buffer.h src/include/skalibs/iobuffer.h
src/libstddjb/iopause.o src/libstddjb/iopause.lo: src/libstddjb/iopause.c src/include/skalibs/config.h src/include/skalibs/iopause.h src/include/skalibs/sysdeps.h
src/libstddjb/iopause_poll.o src/libstddjb/iopause_poll.lo: src/libstddjb/iopause_poll.c src/include/skalibs/iopause.h src/include/skalibs/tai.h
-src/libstddjb/iopause_ppoll.o src/libstddjb/iopause_ppoll.lo: src/libstddjb/iopause_ppoll.c src/include/skalibs/iopause.h src/include/skalibs/sysdeps.h src/include/skalibs/tai.h
-src/libstddjb/iopause_select.o src/libstddjb/iopause_select.lo: src/libstddjb/iopause_select.c src/include/skalibs/iopause.h src/include/skalibs/tai.h
+src/libstddjb/iopause_ppoll.o src/libstddjb/iopause_ppoll.lo: src/libstddjb/iopause_ppoll.c src/include/skalibs/iopause.h src/include/skalibs/nonposix.h src/include/skalibs/sysdeps.h src/include/skalibs/tai.h
+src/libstddjb/iopause_select.o src/libstddjb/iopause_select.lo: src/libstddjb/iopause_select.c src/include/skalibs/bsdsnowflake.h src/include/skalibs/iopause.h src/include/skalibs/tai.h
src/libstddjb/iopause_stamp.o src/libstddjb/iopause_stamp.lo: src/libstddjb/iopause_stamp.c src/include/skalibs/iopause.h src/include/skalibs/tai.h
src/libstddjb/ip46_scan.o src/libstddjb/ip46_scan.lo: src/libstddjb/ip46_scan.c src/include/skalibs/fmtscan.h src/include/skalibs/ip46.h
src/libstddjb/ip46_scanlist.o src/libstddjb/ip46_scanlist.lo: src/libstddjb/ip46_scanlist.c src/include/skalibs/fmtscan.h src/include/skalibs/ip46.h
@@ -410,7 +411,7 @@ src/libstddjb/leapsecs_add.o src/libstddjb/leapsecs_add.lo: src/libstddjb/leapse
src/libstddjb/leapsecs_sub.o src/libstddjb/leapsecs_sub.lo: src/libstddjb/leapsecs_sub.c src/libstddjb/djbtime-internal.h src/include/skalibs/uint64.h
src/libstddjb/leapsecs_table.o src/libstddjb/leapsecs_table.lo: src/libstddjb/leapsecs_table.c src/libstddjb/djbtime-internal.h src/include/skalibs/tai.h src/include/skalibs/uint64.h
src/libstddjb/localtm_fmt.o src/libstddjb/localtm_fmt.lo: src/libstddjb/localtm_fmt.c src/include/skalibs/djbtime.h src/include/skalibs/types.h
-src/libstddjb/localtm_from_ltm64.o src/libstddjb/localtm_from_ltm64.lo: src/libstddjb/localtm_from_ltm64.c src/include/skalibs/djbtime.h src/include/skalibs/sysdeps.h src/include/skalibs/tai.h src/include/skalibs/uint64.h
+src/libstddjb/localtm_from_ltm64.o src/libstddjb/localtm_from_ltm64.lo: src/libstddjb/localtm_from_ltm64.c src/include/skalibs/bsdsnowflake.h src/include/skalibs/djbtime.h src/include/skalibs/sysdeps.h src/include/skalibs/tai.h src/include/skalibs/uint64.h
src/libstddjb/localtm_from_sysclock.o src/libstddjb/localtm_from_sysclock.lo: src/libstddjb/localtm_from_sysclock.c src/include/skalibs/djbtime.h src/include/skalibs/uint64.h
src/libstddjb/localtm_from_tai.o src/libstddjb/localtm_from_tai.lo: src/libstddjb/localtm_from_tai.c src/include/skalibs/djbtime.h src/include/skalibs/uint64.h
src/libstddjb/localtm_from_utc.o src/libstddjb/localtm_from_utc.lo: src/libstddjb/localtm_from_utc.c src/include/skalibs/djbtime.h src/include/skalibs/uint64.h
@@ -608,7 +609,7 @@ src/libstddjb/tai_now.o src/libstddjb/tai_now.lo: src/libstddjb/tai_now.c src/in
src/libstddjb/tai_pack.o src/libstddjb/tai_pack.lo: src/libstddjb/tai_pack.c src/include/skalibs/tai.h src/include/skalibs/uint64.h
src/libstddjb/tai_pack_little.o src/libstddjb/tai_pack_little.lo: src/libstddjb/tai_pack_little.c src/include/skalibs/tai.h src/include/skalibs/uint64.h
src/libstddjb/tai_sub.o src/libstddjb/tai_sub.lo: src/libstddjb/tai_sub.c src/include/skalibs/tai.h
-src/libstddjb/tai_u64.o src/libstddjb/tai_u64.lo: src/libstddjb/tai_u64.c src/include/skalibs/tai.h src/include/skalibs/uint64.h
+src/libstddjb/tai_u64.o src/libstddjb/tai_u64.lo: src/libstddjb/tai_u64.c src/include/skalibs/bsdsnowflake.h src/include/skalibs/tai.h src/include/skalibs/uint64.h
src/libstddjb/tai_unpack.o src/libstddjb/tai_unpack.lo: src/libstddjb/tai_unpack.c src/include/skalibs/tai.h src/include/skalibs/uint64.h
src/libstddjb/tai_unpack_little.o src/libstddjb/tai_unpack_little.lo: src/libstddjb/tai_unpack_little.c src/include/skalibs/tai.h src/include/skalibs/uint64.h
src/libstddjb/tain_add.o src/libstddjb/tain_add.lo: src/libstddjb/tain_add.c src/include/skalibs/tai.h
@@ -643,9 +644,9 @@ src/libstddjb/tain_ulong.o src/libstddjb/tain_ulong.lo: src/libstddjb/tain_ulong
src/libstddjb/tain_unpack.o src/libstddjb/tain_unpack.lo: src/libstddjb/tain_unpack.c src/include/skalibs/tai.h src/include/skalibs/uint32.h
src/libstddjb/tain_unpack_little.o src/libstddjb/tain_unpack_little.lo: src/libstddjb/tain_unpack_little.c src/include/skalibs/tai.h src/include/skalibs/uint32.h
src/libstddjb/tain_zero.o src/libstddjb/tain_zero.lo: src/libstddjb/tain_zero.c src/include/skalibs/tai.h
-src/libstddjb/time_from_tai.o src/libstddjb/time_from_tai.lo: src/libstddjb/time_from_tai.c src/include/skalibs/sysdeps.h src/include/skalibs/tai.h src/include/skalibs/uint64.h
-src/libstddjb/time_from_tai_relative.o src/libstddjb/time_from_tai_relative.lo: src/libstddjb/time_from_tai_relative.c src/include/skalibs/sysdeps.h src/include/skalibs/tai.h
-src/libstddjb/time_sysclock_from_tai.o src/libstddjb/time_sysclock_from_tai.lo: src/libstddjb/time_sysclock_from_tai.c src/include/skalibs/sysdeps.h src/include/skalibs/tai.h src/include/skalibs/uint64.h
+src/libstddjb/time_from_tai.o src/libstddjb/time_from_tai.lo: src/libstddjb/time_from_tai.c src/include/skalibs/bsdsnowflake.h src/include/skalibs/sysdeps.h src/include/skalibs/tai.h src/include/skalibs/uint64.h
+src/libstddjb/time_from_tai_relative.o src/libstddjb/time_from_tai_relative.lo: src/libstddjb/time_from_tai_relative.c src/include/skalibs/bsdsnowflake.h src/include/skalibs/sysdeps.h src/include/skalibs/tai.h
+src/libstddjb/time_sysclock_from_tai.o src/libstddjb/time_sysclock_from_tai.lo: src/libstddjb/time_sysclock_from_tai.c src/include/skalibs/bsdsnowflake.h src/include/skalibs/sysdeps.h src/include/skalibs/tai.h src/include/skalibs/uint64.h
src/libstddjb/timespec_from_tain.o src/libstddjb/timespec_from_tain.lo: src/libstddjb/timespec_from_tain.c src/include/skalibs/tai.h
src/libstddjb/timespec_from_tain_relative.o src/libstddjb/timespec_from_tain_relative.lo: src/libstddjb/timespec_from_tain_relative.c src/include/skalibs/tai.h
src/libstddjb/timespec_sysclock_from_tain.o src/libstddjb/timespec_sysclock_from_tain.lo: src/libstddjb/timespec_sysclock_from_tain.c src/include/skalibs/tai.h
@@ -684,9 +685,11 @@ src/libstddjb/uint32_unpack.o src/libstddjb/uint32_unpack.lo: src/libstddjb/uint
src/libstddjb/uint32_unpack_big.o src/libstddjb/uint32_unpack_big.lo: src/libstddjb/uint32_unpack_big.c src/include/skalibs/uint32.h
src/libstddjb/uint640_fmt_generic.o src/libstddjb/uint640_fmt_generic.lo: src/libstddjb/uint640_fmt_generic.c src/include/skalibs/fmtscan.h src/include/skalibs/uint64.h
src/libstddjb/uint640_scan.o src/libstddjb/uint640_scan.lo: src/libstddjb/uint640_scan.c src/libstddjb/fmtscan-internal.h src/include/skalibs/uint64.h
+src/libstddjb/uint640_scan_base_max.o src/libstddjb/uint640_scan_base_max.lo: src/libstddjb/uint640_scan_base_max.c src/include/skalibs/fmtscan.h src/include/skalibs/uint64.h
src/libstddjb/uint64_bswap.o src/libstddjb/uint64_bswap.lo: src/libstddjb/uint64_bswap.c src/include/skalibs/uint64.h
src/libstddjb/uint64_fmt_generic.o src/libstddjb/uint64_fmt_generic.lo: src/libstddjb/uint64_fmt_generic.c src/include/skalibs/fmtscan.h src/include/skalibs/uint64.h
src/libstddjb/uint64_fmtlist.o src/libstddjb/uint64_fmtlist.lo: src/libstddjb/uint64_fmtlist.c src/libstddjb/fmtscan-internal.h src/include/skalibs/uint64.h
+src/libstddjb/uint64_fmtlist_generic.o src/libstddjb/uint64_fmtlist_generic.lo: src/libstddjb/uint64_fmtlist_generic.c src/include/skalibs/uint64.h
src/libstddjb/uint64_pack.o src/libstddjb/uint64_pack.lo: src/libstddjb/uint64_pack.c src/include/skalibs/uint64.h
src/libstddjb/uint64_pack_big.o src/libstddjb/uint64_pack_big.lo: src/libstddjb/uint64_pack_big.c src/include/skalibs/uint64.h
src/libstddjb/uint64_reverse.o src/libstddjb/uint64_reverse.lo: src/libstddjb/uint64_reverse.c src/include/skalibs/uint64.h
diff --git a/src/headers/bits-template b/src/headers/bits-template
@@ -10,8 +10,8 @@ extern uint@BITS@_t uint@BITS@_bswap (uint@BITS@_t) ;
#define UINT@BITS@_XFMT @XFMT@
#define UINT@BITS@_BFMT @BFMT@
-#define uint@BITS@_fmt_base(s, u, base) uint64_fmt_generic(s, u, base)
-#define uint@BITS@0_fmt_base(s, u, n, base) uint640_fmt_generic(s, u, n, base)
+#define uint@BITS@_fmt_base uint64_fmt_generic
+#define uint@BITS@0_fmt_base uint640_fmt_generic
#define uint@BITS@_fmt(s, u) uint@BITS@_fmt_base(s, (u), 10)
#define uint@BITS@0_fmt(s, u, n) uint@BITS@0_fmt_base(s, u, (n), 10)
#define uint@BITS@_ofmt(s, o) uint@BITS@_fmt_base(s, (o), 8)
@@ -37,7 +37,7 @@ extern size_t uint@BITS@0_scan_base (char const *, uint@BITS@_t *, uint8_t) ;
extern size_t uint@BITS@_scanlist (uint@BITS@_t *, size_t, char const *, size_t *) ;
-#define int@BITS@_fmt_base(s, u, base) int64_fmt_generic(s, u, base)
+#define int@BITS@_fmt_base int64_fmt_generic
#define int@BITS@_fmt(s, u) int@BITS@_fmt_base(s, (u), 10)
#define int@BITS@_ofmt(s, o) int@BITS@_fmt_base(s, (o), 8)
#define int@BITS@_xfmt(s, x) int@BITS@_fmt_base(s, (x), 16)
diff --git a/src/include/skalibs/bsdsnowflake.h b/src/include/skalibs/bsdsnowflake.h
@@ -0,0 +1,48 @@
+/* ISC license. */
+
+#ifndef SKALIBS_BSDSNOWFLAKE_H
+#define SKALIBS_BSDSNOWFLAKE_H
+
+ /*
+ Like skalibs/nonposix.h, this header is supposed to be included
+ *before* system headers.
+ Unlike skalibs/nonposix.h, though, it does not define ftms that
+ enable non-portable behaviour; it just attempts to work around
+ blatant brokenness, things that actually ARE defined by POSIX
+ but where OSes just ignore the spec.
+ The BSDs are experts at this, hence the name.
+ */
+
+
+#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__bsdi__) || defined(__DragonFly__)
+
+ /* BSDs: the eponym.
+ Sometimes you just need to recognize who they are and what they do. */
+
+#ifndef SKALIBS_BSD_SUCKS
+#define SKALIBS_BSD_SUCKS
+#endif
+
+ /* Other times you just need to say you're a BSD so they deign
+ to define symbols like EOVERFLOW. Give me my POSIX symbols,
+ pretty please? */
+
+#ifndef _BSD_SOURCE
+#define _BSD_SOURCE
+#endif
+
+#endif
+
+
+#if defined(__APPLE__) && defined(__MACH__)
+
+ /* MacOS: needs this for full SUSv3 conformance. That's how you
+ can tell it's really a BSD inside. With additional layers of crap. */
+
+#ifndef _DARWIN_C_SOURCE
+#define _DARWIN_C_SOURCE
+#endif
+
+#endif /* __APPLE__ && __MACH__ */
+
+#endif /* SKALIBS_BSDSNOWFLAKE_H */
diff --git a/src/include/skalibs/error.h b/src/include/skalibs/error.h
@@ -1,18 +1,12 @@
/* ISC license. */
-#ifndef ERROR_H
-#define ERROR_H
+#ifndef SKALIBS_ERROR_H
+#define SKALIBS_ERROR_H
-#include <skalibs/sysdeps.h>
#include <skalibs/gccattributes.h>
extern int error_temp (int) gccattr_const ;
+extern int error_isalready (int) gccattr_const ;
#define error_isagain(e) (((e) == EAGAIN) || ((e) == EWOULDBLOCK))
-#ifdef SKALIBS_BSD_SUCKS
-# define error_isalready(e) (((e) == EALREADY) || ((e) == EINPROGRESS) || ((e) == EADDRINUSE))
-#else
-# define error_isalready(e) (((e) == EALREADY) || ((e) == EINPROGRESS))
-#endif
-
#endif
diff --git a/src/include/skalibs/posixishard.h b/src/include/skalibs/posixishard.h
@@ -27,14 +27,4 @@ extern size_t strnlen (char const *, size_t) gccattr_pure ;
#define MSG_NOSIGNAL 0
#endif
-#if defined(__APPLE__) && defined(__MACH__)
-
- /* MacOS: needs this for full SUSv3 conformance. */
-
-#ifndef _DARWIN_C_SOURCE
-#define _DARWIN_C_SOURCE
-#endif
-
-#endif /* __APPLE__ && __MACH__ */
-
#endif
diff --git a/src/libbiguint/bu_addc.c b/src/libbiguint/bu_addc.c
@@ -1,10 +1,6 @@
/* ISC license. */
-/* OpenBSD needs that for EOVERFLOW. wtfbsdseriously */
-#ifndef _BSD_SOURCE
-#define _BSD_SOURCE
-#endif
-
+#include <skalibs/bsdsnowflake.h>
#include <errno.h>
#include <skalibs/biguint.h>
diff --git a/src/libbiguint/bu_copy.c b/src/libbiguint/bu_copy.c
@@ -1,10 +1,6 @@
/* ISC license. */
-/* OpenBSD needs that for EOVERFLOW. wtfbsdseriously */
-#ifndef _BSD_SOURCE
-#define _BSD_SOURCE
-#endif
-
+#include <skalibs/bsdsnowflake.h>
#include <errno.h>
#include <skalibs/biguint.h>
diff --git a/src/libbiguint/bu_scan.c b/src/libbiguint/bu_scan.c
@@ -1,10 +1,6 @@
/* ISC license. */
-/* OpenBSD needs that for EOVERFLOW. wtfbsdseriously */
-#ifndef _BSD_SOURCE
-#define _BSD_SOURCE
-#endif
-
+#include <skalibs/bsdsnowflake.h>
#include <errno.h>
#include <skalibs/bitarray.h>
#include <skalibs/biguint.h>
diff --git a/src/libbiguint/bu_subc.c b/src/libbiguint/bu_subc.c
@@ -1,10 +1,6 @@
/* ISC license. */
-/* OpenBSD needs that for EOVERFLOW. wtfbsdseriously */
-#ifndef _BSD_SOURCE
-#define _BSD_SOURCE
-#endif
-
+#include <skalibs/bsdsnowflake.h>
#include <errno.h>
#include <skalibs/biguint.h>
diff --git a/src/libposixplz/setgroups.c b/src/libposixplz/setgroups.c
@@ -5,6 +5,7 @@
#ifdef SKALIBS_HASSETGROUPS
#include <skalibs/nonposix.h>
+#include <skalibs/posixishard.h>
#include <string.h>
#include <unistd.h>
#include <grp.h>
diff --git a/src/libstddjb/cdb_init_map.c b/src/libstddjb/cdb_init_map.c
@@ -1,9 +1,6 @@
/* ISC license. */
-#ifndef _BSD_SOURCE
-#define _BSD_SOURCE
-#endif
-
+#include <skalibs/bsdsnowflake.h>
#include <sys/stat.h>
#include <sys/mman.h>
#include <stdint.h>
diff --git a/src/libstddjb/error_isalready.c b/src/libstddjb/error_isalready.c
@@ -0,0 +1,14 @@
+/* ISC license. */
+
+#include <skalibs/bsdsnowflake.h>
+#include <errno.h>
+#include <skalibs/error.h>
+
+int error_isalready (int e)
+{
+ return e == EALREADY || e == EINPROGRESS
+#ifdef SKALIBS_BSD_SUCKS
+ || e == ADDRINUSE
+#endif
+ ;
+}
diff --git a/src/libstddjb/iopause_ppoll.c b/src/libstddjb/iopause_ppoll.c
@@ -4,16 +4,7 @@
#ifdef SKALIBS_HASPPOLL
-/* Just in case OpenBSD implements ppoll before fixing EOVERFLOW.
- Stranger things have happened in the wonderful world of OpenBSD. */
-#ifndef _BSD_SOURCE
-#define _BSD_SOURCE
-#endif
-
-#ifndef _GNU_SOURCE
-#define _GNU_SOURCE
-#endif
-
+#include <skalibs/nonposix.h>
#include <errno.h>
#include <time.h>
#include <poll.h>
diff --git a/src/libstddjb/iopause_select.c b/src/libstddjb/iopause_select.c
@@ -1,10 +1,6 @@
/* ISC license. */
-/* OpenBSD needs that for EOVERFLOW. wtfbsdseriously */
-#ifndef _BSD_SOURCE
-#define _BSD_SOURCE
-#endif
-
+#include <skalibs/bsdsnowflake.h>
#include <string.h> /* Solaris... */
#include <errno.h>
#include <sys/select.h>
diff --git a/src/libstddjb/localtm_from_ltm64.c b/src/libstddjb/localtm_from_ltm64.c
@@ -1,11 +1,7 @@
/* ISC license. */
-/* OpenBSD needs that for EOVERFLOW. wtfbsdseriously */
-#ifndef _BSD_SOURCE
-#define _BSD_SOURCE
-#endif
-
#include <skalibs/sysdeps.h>
+#include <skalibs/bsdsnowflake.h>
#include <errno.h>
#include <time.h>
#include <skalibs/uint64.h>
diff --git a/src/libstddjb/tai_u64.c b/src/libstddjb/tai_u64.c
@@ -1,10 +1,6 @@
/* ISC license. */
-/* OpenBSD needs that for EOVERFLOW. wtfbsdseriously */
-#ifndef _BSD_SOURCE
-#define _BSD_SOURCE
-#endif
-
+#include <skalibs/bsdsnowflake.h>
#include <errno.h>
#include <skalibs/uint64.h>
#include <skalibs/tai.h>
diff --git a/src/libstddjb/time_from_tai.c b/src/libstddjb/time_from_tai.c
@@ -1,11 +1,7 @@
/* ISC license. */
-/* OpenBSD needs that for EOVERFLOW. wtfbsdseriously */
-#ifndef _BSD_SOURCE
-#define _BSD_SOURCE
-#endif
-
#include <skalibs/sysdeps.h>
+#include <skalibs/bsdsnowflake.h>
#include <time.h>
#include <errno.h>
#include <skalibs/uint64.h>
diff --git a/src/libstddjb/time_from_tai_relative.c b/src/libstddjb/time_from_tai_relative.c
@@ -1,11 +1,7 @@
/* ISC license. */
-/* OpenBSD needs that for EOVERFLOW. wtfbsdseriously */
-#ifndef _BSD_SOURCE
-#define _BSD_SOURCE
-#endif
-
#include <skalibs/sysdeps.h>
+#include <skalibs/bsdsnowflake.h>
#include <time.h>
#include <errno.h>
#include <skalibs/tai.h>
diff --git a/src/libstddjb/time_sysclock_from_tai.c b/src/libstddjb/time_sysclock_from_tai.c
@@ -1,11 +1,7 @@
/* ISC license. */
-/* OpenBSD needs that for EOVERFLOW. wtfbsdseriously */
-#ifndef _BSD_SOURCE
-#define _BSD_SOURCE
-#endif
-
#include <skalibs/sysdeps.h>
+#include <skalibs/bsdsnowflake.h>
#include <time.h>
#include <errno.h>
#include <skalibs/uint64.h>