summaryrefslogtreecommitdiffstats
path: root/contrib/bind9/lib/isc/unix/entropy.c
diff options
context:
space:
mode:
authordougb <dougb@FreeBSD.org>2009-05-31 05:42:58 +0000
committerdougb <dougb@FreeBSD.org>2009-05-31 05:42:58 +0000
commit1e9abbf9ca25c8e19cbc0405a365df5433813cd6 (patch)
tree21a5399cf53ce4f1ffedece1c1700a317f190f2e /contrib/bind9/lib/isc/unix/entropy.c
parent9babfe9f9b2fa8b533dad4a39b00918df9809aa7 (diff)
parentfd553238c94c3abfef11bfdfc5cb05b32cbe5f76 (diff)
downloadFreeBSD-src-1e9abbf9ca25c8e19cbc0405a365df5433813cd6.zip
FreeBSD-src-1e9abbf9ca25c8e19cbc0405a365df5433813cd6.tar.gz
Update BIND to version 9.6.1rc1. This version has better performance and
lots of new features compared to 9.4.x, including: Full NSEC3 support Automatic zone re-signing New update-policy methods tcp-self and 6to4-self DHCID support. More detailed statistics counters including those supported in BIND 8. Faster ACL processing. Efficient LRU cache-cleaning mechanism. NSID support.
Diffstat (limited to 'contrib/bind9/lib/isc/unix/entropy.c')
-rw-r--r--contrib/bind9/lib/isc/unix/entropy.c29
1 files changed, 20 insertions, 9 deletions
diff --git a/contrib/bind9/lib/isc/unix/entropy.c b/contrib/bind9/lib/isc/unix/entropy.c
index 4c0d0d0..0e9e297 100644
--- a/contrib/bind9/lib/isc/unix/entropy.c
+++ b/contrib/bind9/lib/isc/unix/entropy.c
@@ -1,8 +1,8 @@
/*
- * Copyright (C) 2004-2006 Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (C) 2004-2007, 2009 Internet Systems Consortium, Inc. ("ISC")
* Copyright (C) 2000-2003 Internet Software Consortium.
*
- * Permission to use, copy, modify, and distribute this software for any
+ * Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: entropy.c,v 1.71.18.7 2006/12/07 04:53:03 marka Exp $ */
+/* $Id: entropy.c,v 1.80.332.2 2009/02/16 23:47:15 tbox Exp $ */
/* \file unix/entropy.c
* \brief
@@ -31,6 +31,9 @@
#include <sys/socket.h>
#include <sys/un.h>
+#ifdef HAVE_NANOSLEEP
+#include <time.h>
+#endif
#include <unistd.h>
#include <isc/platform.h>
@@ -153,12 +156,12 @@ get_from_usocketsource(isc_entropysource_t *source, isc_uint32_t desired) {
source->sources.usocket.status =
isc_usocketsource_ndesired;
goto eagain_loop;
- }
+ }
INSIST(n == 2);
source->sources.usocket.status =
isc_usocketsource_wrote;
/*FALLTHROUGH*/
-
+
case isc_usocketsource_wrote:
if (recvfrom(fd, buf, 1, 0, NULL, NULL) != 1) {
if (errno == EAGAIN) {
@@ -166,15 +169,23 @@ get_from_usocketsource(isc_entropysource_t *source, isc_uint32_t desired) {
* The problem of EAGAIN (try again
* later) is a major issue on HP-UX.
* Solaris actually tries the recvfrom
- * call again, while HP-UX just dies.
+ * call again, while HP-UX just dies.
* This code is an attempt to let the
* entropy pool fill back up (at least
* that's what I think the problem is.)
- * We go to eagain_loop because if we
+ * We go to eagain_loop because if we
* just "break", then the "desired"
* amount gets borked.
*/
+#ifdef HAVE_NANOSLEEP
+ struct timespec ts;
+
+ ts.tv_sec = 0;
+ ts.tv_nsec = 1000000;
+ nanosleep(&ts, NULL);
+#else
usleep(1000);
+#endif
goto eagain_loop;
}
if (errno == EWOULDBLOCK || errno == EINTR)
@@ -201,7 +212,7 @@ get_from_usocketsource(isc_entropysource_t *source, isc_uint32_t desired) {
} else
n = 0;
break;
-
+
default:
goto err;
}
@@ -491,7 +502,7 @@ isc_entropy_createfilesource(isc_entropy_t *ent, const char *fname) {
ret = isc__errno2result(errno);
goto errout;
}
- /*
+ /*
* Solaris 2.5.1 does not have support for sockets (S_IFSOCK),
* but it does return type S_IFIFO (the OS believes that
* the socket is a fifo). This may be an issue if we tell
OpenPOWER on IntegriCloud