Module Name: src
Committed By: christos
Date: Sat Oct 24 17:24:02 UTC 2009
Modified Files:
src/lib/libc/resolv: res_init.c res_private.h res_send.c
Log Message:
expose res_check.
To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/lib/libc/resolv/res_init.c
cvs rdiff -u -r1.2 -r1.3 src/lib/libc/resolv/res_private.h
cvs rdiff -u -r1.19 -r1.20 src/lib/libc/resolv/res_send.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/lib/libc/resolv/res_init.c
diff -u src/lib/libc/resolv/res_init.c:1.21 src/lib/libc/resolv/res_init.c:1.22
--- src/lib/libc/resolv/res_init.c:1.21 Sat Oct 24 01:35:37 2009
+++ src/lib/libc/resolv/res_init.c Sat Oct 24 13:24:01 2009
@@ -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
Index: src/lib/libc/resolv/res_private.h
diff -u src/lib/libc/resolv/res_private.h:1.2 src/lib/libc/resolv/res_private.h:1.3
--- src/lib/libc/resolv/res_private.h:1.2 Sat Oct 24 01:35:37 2009
+++ src/lib/libc/resolv/res_private.h Sat Oct 24 13:24:01 2009
@@ -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
Index: src/lib/libc/resolv/res_send.c
diff -u src/lib/libc/resolv/res_send.c:1.19 src/lib/libc/resolv/res_send.c:1.20
--- src/lib/libc/resolv/res_send.c:1.19 Sat Oct 24 01:35:37 2009
+++ src/lib/libc/resolv/res_send.c Sat Oct 24 13:24:01 2009
@@ -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) {