Source-Changes-HG archive

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

[src/trunk]: src/lib/libc/resolv expose res_check.



details:   https://anonhg.NetBSD.org/src/rev/c08af48bc147
branches:  trunk
changeset: 748465:c08af48bc147
user:      christos <christos%NetBSD.org@localhost>
date:      Sat Oct 24 17:24:01 2009 +0000

description:
expose res_check.

diffstat:

 lib/libc/resolv/res_init.c    |  18 ++++++++++++------
 lib/libc/resolv/res_private.h |   3 +--
 lib/libc/resolv/res_send.c    |   6 +++---
 3 files changed, 16 insertions(+), 11 deletions(-)

diffs (99 lines):

diff -r 7db68abe6945 -r c08af48bc147 lib/libc/resolv/res_init.c
--- a/lib/libc/resolv/res_init.c        Sat Oct 24 17:23:34 2009 +0000
+++ b/lib/libc/resolv/res_init.c        Sat Oct 24 17:24:01 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: res_init.c,v 1.21 2009/10/24 05:35:37 christos Exp $   */
+/*     $NetBSD: res_init.c,v 1.22 2009/10/24 17:24:01 christos Exp $   */
 
 /*
  * Copyright (c) 1985, 1989, 1993
@@ -76,7 +76,7 @@
 static const char sccsid[] = "@(#)res_init.c   8.1 (Berkeley) 6/7/93";
 static const char rcsid[] = "Id: res_init.c,v 1.26 2008/12/11 09:59:00 marka Exp";
 #else
-__RCSID("$NetBSD: res_init.c,v 1.21 2009/10/24 05:35:37 christos Exp $");
+__RCSID("$NetBSD: res_init.c,v 1.22 2009/10/24 17:24:01 christos Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -562,8 +562,8 @@
        return (statp->res_h_errno);
 }
 
-void
-__res_check(res_state statp)
+int
+res_check(res_state statp, struct timespec *mtime)
 {
        /*
         * If the times are equal, then we check if there
@@ -576,17 +576,23 @@
            &__res_conf_time, ==)) {
                struct kevent ke;
                if (statp->_u._ext.ext->kq == -1)
-                       return;
+                       goto out;
 
                switch (kevent(statp->_u._ext.ext->kq, NULL, 0, &ke, 1, &ts)) {
                case 0:
                case -1:
-                       return;
+out:
+                       if (mtime)
+                               *mtime = __res_conf_time;
+                       return 0;
                default:
                        break;
                }
        }
        (void)__res_vinit(statp, 0);
+       if (mtime)
+               *mtime = __res_conf_time;
+       return 1;
 }
 
 static void
diff -r 7db68abe6945 -r c08af48bc147 lib/libc/resolv/res_private.h
--- a/lib/libc/resolv/res_private.h     Sat Oct 24 17:23:34 2009 +0000
+++ b/lib/libc/resolv/res_private.h     Sat Oct 24 17:24:01 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: res_private.h,v 1.2 2009/10/24 05:35:37 christos Exp $ */
+/*     $NetBSD: res_private.h,v 1.3 2009/10/24 17:24:01 christos Exp $ */
 
 #ifndef res_private_h
 #define res_private_h
@@ -20,7 +20,6 @@
 
 extern int res_ourserver_p(const res_state, const struct sockaddr *);
 extern int __res_vinit(res_state, int);
-extern void __res_check(res_state);
 
 #endif
 
diff -r 7db68abe6945 -r c08af48bc147 lib/libc/resolv/res_send.c
--- a/lib/libc/resolv/res_send.c        Sat Oct 24 17:23:34 2009 +0000
+++ b/lib/libc/resolv/res_send.c        Sat Oct 24 17:24:01 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: res_send.c,v 1.19 2009/10/24 05:35:37 christos Exp $   */
+/*     $NetBSD: res_send.c,v 1.20 2009/10/24 17:24:01 christos Exp $   */
 
 /*
  * Portions Copyright (C) 2004-2009  Internet Systems Consortium, Inc. ("ISC")
@@ -93,7 +93,7 @@
 static const char sccsid[] = "@(#)res_send.c   8.1 (Berkeley) 6/4/93";
 static const char rcsid[] = "Id: res_send.c,v 1.22 2009/01/22 23:49:23 tbox Exp";
 #else
-__RCSID("$NetBSD: res_send.c,v 1.19 2009/10/24 05:35:37 christos Exp $");
+__RCSID("$NetBSD: res_send.c,v 1.20 2009/10/24 17:24:01 christos Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -337,7 +337,7 @@
        highestFD = sysconf(_SC_OPEN_MAX) - 1;
 #endif
 
-       __res_check(statp);
+       (void)res_check(statp, NULL);
 
        /* No name servers or res_init() failure */
        if (statp->nscount == 0 || EXT(statp).ext == NULL) {



Home | Main Index | Thread Index | Old Index