summaryrefslogtreecommitdiff
path: root/src/libstddjb
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2019-07-22 13:58:11 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2019-07-22 13:58:11 +0000
commitd44819ae9c55f4d3c0f347b2640f58a2deddebb4 (patch)
tree040c9d2c5ce734047af365df4b86edc33379dd70 /src/libstddjb
parent8923a6ffa3da869b5fc56b9b1f698f483e3180a4 (diff)
downloadskalibs-d44819ae9c55f4d3c0f347b2640f58a2deddebb4.tar.xz
Factor all the BSD complaints into one new header
Diffstat (limited to 'src/libstddjb')
-rw-r--r--src/libstddjb/cdb_init_map.c5
-rw-r--r--src/libstddjb/error_isalready.c14
-rw-r--r--src/libstddjb/iopause_ppoll.c11
-rw-r--r--src/libstddjb/iopause_select.c6
-rw-r--r--src/libstddjb/localtm_from_ltm64.c6
-rw-r--r--src/libstddjb/tai_u64.c6
-rw-r--r--src/libstddjb/time_from_tai.c6
-rw-r--r--src/libstddjb/time_from_tai_relative.c6
-rw-r--r--src/libstddjb/time_sysclock_from_tai.c6
9 files changed, 22 insertions, 44 deletions
diff --git a/src/libstddjb/cdb_init_map.c b/src/libstddjb/cdb_init_map.c
index 9851faa..55fb02a 100644
--- 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
new file mode 100644
index 0000000..db63932
--- /dev/null
+++ 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
index 960a464..0c571e1 100644
--- 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
index b6bdd2d..8b8479b 100644
--- 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
index 8eba409..74d2fb3 100644
--- 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
index 624f2cb..1d7eabe 100644
--- 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
index 1f4ff2a..f3f9538 100644
--- 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
index 1d11e2e..598d80b 100644
--- 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
index 3e8322b..b0fd689 100644
--- 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>