Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/crypto/dist/heimdal/lib/krb5 select() -> poll()



details:   https://anonhg.NetBSD.org/src/rev/e64bc51655b1
branches:  trunk
changeset: 536704:e64bc51655b1
user:      mycroft <mycroft%NetBSD.org@localhost>
date:      Fri Sep 20 22:05:59 2002 +0000

description:
select() -> poll()

diffstat:

 crypto/dist/heimdal/lib/krb5/changepw.c    |  13 ++++++++++++-
 crypto/dist/heimdal/lib/krb5/send_to_kdc.c |  14 +++++++++++++-
 2 files changed, 25 insertions(+), 2 deletions(-)

diffs (93 lines):

diff -r c12bf93a5545 -r e64bc51655b1 crypto/dist/heimdal/lib/krb5/changepw.c
--- a/crypto/dist/heimdal/lib/krb5/changepw.c   Fri Sep 20 22:04:31 2002 +0000
+++ b/crypto/dist/heimdal/lib/krb5/changepw.c   Fri Sep 20 22:05:59 2002 +0000
@@ -34,7 +34,7 @@
 #include <krb5_locl.h>
 
 __RCSID("$Heimdal: changepw.c,v 1.37 2002/09/03 16:14:34 nectar Exp $"
-        "$NetBSD: changepw.c,v 1.7 2002/09/12 13:19:13 joda Exp $");
+        "$NetBSD: changepw.c,v 1.8 2002/09/20 22:05:59 mycroft Exp $");
 
 static krb5_error_code
 send_request (krb5_context context,
@@ -300,8 +300,12 @@
            }
 
            for (i = 0; !done && i < 5; ++i) {
+#ifdef HAVE_POLL
+               struct pollfd set[1];
+#else
                fd_set fdset;
                struct timeval tv;
+#endif
 
                if (!replied) {
                    replied = 0;
@@ -317,6 +321,12 @@
                    }
                }
            
+#ifdef HAVE_POLL
+               set[0].fd = sock;
+               set[0].events = POLLIN;
+
+               ret = poll (set, 1, (1 + (1 << i)) * 1000);
+#else
                if (sock >= FD_SETSIZE) {
                    krb5_set_error_string(context, "fd %d too large", sock);
                    ret = ERANGE;
@@ -330,6 +340,7 @@
                tv.tv_sec  = 1 + (1 << i);
 
                ret = select (sock + 1, &fdset, NULL, NULL, &tv);
+#endif
                if (ret < 0 && errno != EINTR) {
                    close(sock);
                    goto out;
diff -r c12bf93a5545 -r e64bc51655b1 crypto/dist/heimdal/lib/krb5/send_to_kdc.c
--- a/crypto/dist/heimdal/lib/krb5/send_to_kdc.c        Fri Sep 20 22:04:31 2002 +0000
+++ b/crypto/dist/heimdal/lib/krb5/send_to_kdc.c        Fri Sep 20 22:05:59 2002 +0000
@@ -34,7 +34,7 @@
 #include "krb5_locl.h"
 
 __RCSID("$Heimdal: send_to_kdc.c,v 1.48 2002/03/27 09:32:50 joda Exp $"
-        "$NetBSD: send_to_kdc.c,v 1.6 2002/09/12 13:19:18 joda Exp $");
+        "$NetBSD: send_to_kdc.c,v 1.7 2002/09/20 22:05:59 mycroft Exp $");
 
 /*
  * send the data in `req' on the socket `fd' (which is datagram iff udp)
@@ -50,22 +50,34 @@
           size_t limit,
           krb5_data *rep)
 {
+#ifdef HAVE_POLL
+     struct pollfd set[1];
+#else
      fd_set fdset;
      struct timeval timeout;
+#endif
      int ret;
      int nbytes;
 
+#ifndef HAVE_POLL
      if (fd >= FD_SETSIZE) {
         return -1;
      }
+#endif
 
      krb5_data_zero(rep);
      do {
+#ifdef HAVE_POLL
+        set[0].fd = fd;
+        set[0].events = POLLIN;
+        ret = poll (set, 1, tmout * 1000);
+#else
         FD_ZERO(&fdset);
         FD_SET(fd, &fdset);
         timeout.tv_sec  = tmout;
         timeout.tv_usec = 0;
         ret = select (fd + 1, &fdset, NULL, NULL, &timeout);
+#endif
         if (ret < 0) {
             if (errno == EINTR)
                 continue;



Home | Main Index | Thread Index | Old Index