summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Gerdts <mike.gerdts@joyent.com>2018-02-16 22:34:41 +0000
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>2018-02-19 11:40:05 +0000
commitf766d90704b03cbe277e3fd4b4153d892960f135 (patch)
tree9b72bb7fa235affb8282dbe9b6e03662eb5e3eab
parentdf952c149da2a3a7574c54a8a62c791211223270 (diff)
downloadpsycopg2-f766d90704b03cbe277e3fd4b4153d892960f135.tar.gz
Fixed building on SmartOS
timeradd is missing on Solaris 10, but is present as a macro in <sys/time.h> on SmartOS, illumos, and likely Solaris 11.
-rw-r--r--psycopg/solaris_support.c5
-rw-r--r--psycopg/solaris_support.h3
2 files changed, 7 insertions, 1 deletions
diff --git a/psycopg/solaris_support.c b/psycopg/solaris_support.c
index cf82e2e..e5f8edf 100644
--- a/psycopg/solaris_support.c
+++ b/psycopg/solaris_support.c
@@ -1,6 +1,7 @@
/* solaris_support.c - emulate functions missing on Solaris
*
* Copyright (C) 2017 My Karlsson <mk@acc.umu.se>
+ * Copyright (c) 2018, Joyent, Inc.
*
* This file is part of psycopg.
*
@@ -28,7 +29,8 @@
#include "psycopg/solaris_support.h"
#if defined(__sun) && defined(__SVR4)
-/* timeradd is missing on Solaris */
+/* timeradd is missing on Solaris 10 */
+#ifndef timeradd
void
timeradd(struct timeval *a, struct timeval *b, struct timeval *c)
{
@@ -51,4 +53,5 @@ timersub(struct timeval *a, struct timeval *b, struct timeval *c)
c->tv_sec -= 1;
}
}
+#endif /* timeradd */
#endif /* defined(__sun) && defined(__SVR4) */
diff --git a/psycopg/solaris_support.h b/psycopg/solaris_support.h
index 33c2f2b..880e9f1 100644
--- a/psycopg/solaris_support.h
+++ b/psycopg/solaris_support.h
@@ -1,6 +1,7 @@
/* solaris_support.h - definitions for solaris_support.c
*
* Copyright (C) 2017 My Karlsson <mk@acc.umu.se>
+ * Copyright (c) 2018, Joyent, Inc.
*
* This file is part of psycopg.
*
@@ -30,8 +31,10 @@
#if defined(__sun) && defined(__SVR4)
#include <sys/time.h>
+#ifndef timeradd
extern HIDDEN void timeradd(struct timeval *a, struct timeval *b, struct timeval *c);
extern HIDDEN void timersub(struct timeval *a, struct timeval *b, struct timeval *c);
#endif
+#endif
#endif /* !defined(PSYCOPG_SOLARIS_SUPPORT_H) */