From 2d78cc9624dd735ffdc634e6c39dd30bddfb95f7 Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Fri, 18 May 2007 06:22:03 +0000 Subject: [PATCH] 2185. [port] sunos: libbind: check for ssize_t, memmove() and memchr(). [RT #16463] --- CHANGES | 3 +++ lib/bind/config.h.in | 3 +++ lib/bind/configure.in | 16 +++++++++++++++- lib/bind/isc/ctl_clnt.c | 15 ++++++++++++++- lib/bind/port_before.h.in | 12 +++++++++++- 5 files changed, 46 insertions(+), 3 deletions(-) diff --git a/CHANGES b/CHANGES index 121095ef91..423e89a8c9 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,6 @@ +2185. [port] sunos: libbind: check for ssize_t, memmove() and + memchr(). [RT #16463] + 2184. [bug] bind9.xsl.h didn't build out of the source tree. [RT #16830] diff --git a/lib/bind/config.h.in b/lib/bind/config.h.in index c4d88d347e..69ea285430 100644 --- a/lib/bind/config.h.in +++ b/lib/bind/config.h.in @@ -11,6 +11,8 @@ #undef POSIX_GETPWNAM_R #undef POSIX_GETGRGID_R #undef POSIX_GETGRNAM_R +#undef HAVE_MEMMOVE +#undef HAVE_MEMCHR #undef NEED_SETGROUPENT #undef NEED_GETGROUPLIST @@ -38,6 +40,7 @@ #undef HAS_PW_CLASS +#undef ssize_t #undef uintptr_t /* Shut up warnings about sputaux in stdio.h on BSD/OS pre-4.1 */ diff --git a/lib/bind/configure.in b/lib/bind/configure.in index 0b4dd34d3f..cbb8cbdbaa 100644 --- a/lib/bind/configure.in +++ b/lib/bind/configure.in @@ -13,7 +13,7 @@ # OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # PERFORMANCE OF THIS SOFTWARE. -AC_REVISION($Revision: 1.125 $) +AC_REVISION($Revision: 1.126 $) AC_INIT(resolv/herror.c) AC_PREREQ(2.13) @@ -174,6 +174,7 @@ AC_CHECK_HEADERS(fcntl.h db.h paths.h sys/time.h unistd.h sys/sockio.h sys/selec AC_C_CONST AC_C_INLINE AC_TYPE_SIZE_T +AC_CHECK_TYPE(ssize_t,signed) AC_CHECK_TYPE(uintptr_t,unsigned long) AC_HEADER_TIME # @@ -458,6 +459,8 @@ AC_SUBST(WANT_IRS_THREADS_OBJS) AC_SUBST(WANT_THREADS_OBJS) AC_CHECK_FUNC(strlcat, AC_DEFINE(HAVE_STRLCAT)) +AC_CHECK_FUNC(memmove, AC_DEFINE(HAVE_MEMMOVE)) +AC_CHECK_FUNC(memchr, AC_DEFINE(HAVE_MEMCHR)) AC_CHECK_FUNC(if_nametoindex, [USE_IFNAMELINKID="#define USE_IFNAMELINKID 1"], @@ -1117,6 +1120,17 @@ AC_TRY_COMPILE([ ISC_PLATFORM_NEEDPORTT="#define ISC_PLATFORM_NEEDPORTT 1"]) AC_SUBST(ISC_PLATFORM_NEEDPORTT) +AC_MSG_CHECKING(for struct timespec) +AC_TRY_COMPILE([ +#include +#include ], +[struct timespec ts = { 0, 0 }; return (0);], + [AC_MSG_RESULT(yes) + ISC_PLATFORM_NEEDTIMESPEC="#undef ISC_PLATFORM_NEEDTIMESPEC"], + [AC_MSG_RESULT(no) + ISC_PLATFORM_NEEDTIMESPEC="#define ISC_PLATFORM_NEEDTIMESPEC 1"]) +AC_SUBST(ISC_PLATFORM_NEEDTIMESPEC) + # # Check for addrinfo # diff --git a/lib/bind/isc/ctl_clnt.c b/lib/bind/isc/ctl_clnt.c index a53d8d1e82..5438868fe9 100644 --- a/lib/bind/isc/ctl_clnt.c +++ b/lib/bind/isc/ctl_clnt.c @@ -1,5 +1,5 @@ #if !defined(lint) && !defined(SABER) -static const char rcsid[] = "$Id: ctl_clnt.c,v 1.8 2005/04/27 04:56:35 sra Exp $"; +static const char rcsid[] = "$Id: ctl_clnt.c,v 1.9 2007/05/18 06:22:03 marka Exp $"; #endif /* not lint */ /* @@ -114,6 +114,19 @@ static void touch_timer(struct ctl_cctx *); static void timer(evContext, void *, struct timespec, struct timespec); +#ifndef HAVE_MEMCHR +static void * +memchr(const void *b, int c, size_t len) { + const unsigned char *p = b; + size_t i; + + for (i = 0; i < len; i++, p++) + if (*p == (unsigned char)c) + return ((void *)p); + return (NULL); +} +#endif + /* Private data. */ static const char * const state_names[] = { diff --git a/lib/bind/port_before.h.in b/lib/bind/port_before.h.in index 606cb83dfa..52f1b5fafd 100644 --- a/lib/bind/port_before.h.in +++ b/lib/bind/port_before.h.in @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: port_before.h.in,v 1.25 2007/01/09 03:11:15 marka Exp $ */ +/* $Id: port_before.h.in,v 1.26 2007/05/18 06:22:03 marka Exp $ */ #ifndef port_before_h #define port_before_h @@ -31,6 +31,16 @@ struct timezone; /* silence warning */ #endif #include +#ifdef ISC_PLATFORM_NEEDTIMESPEC +#include /* For time_t */ +struct timespec { + time_t tv_sec; /* seconds */ + long tv_nsec; /* nanoseconds */ +}; +#endif +#ifndef HAVE_MEMMOVE +#define memmove(a,b,c) bcopy(b,a,c) +#endif @WANT_IRS_GR@ @WANT_IRS_NIS@