summaryrefslogtreecommitdiffstats
path: root/lib/libc
diff options
context:
space:
mode:
authorngie <ngie@FreeBSD.org>2015-12-15 19:52:02 +0000
committerngie <ngie@FreeBSD.org>2015-12-15 19:52:02 +0000
commit3fed53d02350ae9cbd7b2786b72b83d2e292b8d1 (patch)
tree57320bb171eaf81a24aa51f751919d972710edf9 /lib/libc
parent17ca717571c27f52897c406a71864f864ca65710 (diff)
parent3713a6d4d1859668807d1f8c46fc21b15334f7c9 (diff)
downloadFreeBSD-src-3fed53d02350ae9cbd7b2786b72b83d2e292b8d1.zip
FreeBSD-src-3fed53d02350ae9cbd7b2786b72b83d2e292b8d1.tar.gz
MFhead @ r292285
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/resolv/res_init.c30
-rw-r--r--lib/libc/resolv/res_mkquery.c4
-rw-r--r--lib/libc/resolv/res_mkupdate.c4
-rw-r--r--lib/libc/resolv/res_private.h5
-rw-r--r--lib/libc/resolv/res_query.c4
-rw-r--r--lib/libc/resolv/res_send.c4
-rw-r--r--lib/libc/resolv/res_state.c18
-rw-r--r--lib/libc/sys/brk.23
-rw-r--r--lib/libc/sys/getgid.23
-rw-r--r--lib/libc/sys/getpid.23
-rw-r--r--lib/libc/sys/getuid.23
-rw-r--r--lib/libc/sys/read.23
-rw-r--r--lib/libc/sys/setuid.23
-rw-r--r--lib/libc/sys/utrace.25
-rw-r--r--lib/libc/sys/write.23
15 files changed, 54 insertions, 41 deletions
diff --git a/lib/libc/resolv/res_init.c b/lib/libc/resolv/res_init.c
index 087e6a8..8832342 100644
--- a/lib/libc/resolv/res_init.c
+++ b/lib/libc/resolv/res_init.c
@@ -116,7 +116,9 @@ __FBSDID("$FreeBSD$");
/*% Options. Should all be left alone. */
#define RESOLVSORT
-#define DEBUG
+#ifndef DEBUG
+#define DEBUG
+#endif
#ifdef SOLARIS2
#include <sys/systeminfo.h>
@@ -228,7 +230,6 @@ __res_vinit(res_state statp, int preinit) {
statp->pfcode = 0;
statp->_vcsock = -1;
statp->_flags = 0;
- statp->reload_period = 2;
statp->qhook = NULL;
statp->rhook = NULL;
statp->_u._ext.nscount = 0;
@@ -238,6 +239,7 @@ __res_vinit(res_state statp, int preinit) {
statp->_u._ext.ext->nsaddrs[0].sin = statp->nsaddr;
strcpy(statp->_u._ext.ext->nsuffix, "ip6.arpa");
strcpy(statp->_u._ext.ext->nsuffix2, "ip6.int");
+ statp->_u._ext.ext->reload_period = 2;
} else {
/*
* Historically res_init() rarely, if at all, failed.
@@ -326,17 +328,13 @@ __res_vinit(res_state statp, int preinit) {
struct stat sb;
struct timespec now;
- if (_fstat(fileno(fp), &sb) == 0) {
- statp->conf_mtim = sb.st_mtim;
- if (clock_gettime(CLOCK_MONOTONIC_FAST, &now) == 0) {
- statp->conf_stat = now.tv_sec;
- } else {
- statp->conf_stat = 0;
+ if (statp->_u._ext.ext != NULL) {
+ if (_fstat(fileno(fp), &sb) == 0) {
+ statp->_u._ext.ext->conf_mtim = sb.st_mtim;
+ if (clock_gettime(CLOCK_MONOTONIC_FAST, &now) == 0) {
+ statp->_u._ext.ext->conf_stat = now.tv_sec;
+ }
}
- } else {
- statp->conf_mtim.tv_sec = 0;
- statp->conf_mtim.tv_nsec = 0;
- statp->conf_stat = 0;
}
/* read the config file */
@@ -599,9 +597,7 @@ res_setoptions(res_state statp, const char *options, const char *source)
{
const char *cp = options;
int i;
-#ifndef _LIBC
struct __res_state_ext *ext = statp->_u._ext.ext;
-#endif
#ifdef DEBUG
if (statp->options & RES_DEBUG)
@@ -686,8 +682,10 @@ res_setoptions(res_state statp, const char *options, const char *source)
statp->options |= RES_NOCHECKNAME;
} else if (!strncmp(cp, "reload-period:",
sizeof("reload-period:") - 1)) {
- statp->reload_period = (u_short)
- atoi(cp + sizeof("reload-period:") - 1);
+ if (ext != NULL) {
+ ext->reload_period = (u_short)
+ atoi(cp + sizeof("reload-period:") - 1);
+ }
}
#ifdef RES_USE_EDNS0
else if (!strncmp(cp, "edns0", sizeof("edns0") - 1)) {
diff --git a/lib/libc/resolv/res_mkquery.c b/lib/libc/resolv/res_mkquery.c
index b60d8f5..0d45e34 100644
--- a/lib/libc/resolv/res_mkquery.c
+++ b/lib/libc/resolv/res_mkquery.c
@@ -83,7 +83,9 @@ __FBSDID("$FreeBSD$");
#include "port_after.h"
/* Options. Leave them on. */
-#define DEBUG
+#ifndef DEBUG
+#define DEBUG
+#endif
extern const char *_res_opcodes[];
diff --git a/lib/libc/resolv/res_mkupdate.c b/lib/libc/resolv/res_mkupdate.c
index d4981a5..c076c1e5 100644
--- a/lib/libc/resolv/res_mkupdate.c
+++ b/lib/libc/resolv/res_mkupdate.c
@@ -54,7 +54,9 @@ __FBSDID("$FreeBSD$");
#include "port_after.h"
/* Options. Leave them on. */
-#define DEBUG
+#ifndef DEBUG
+#define DEBUG
+#endif
#define MAXPORT 1024
static int getnum_str(u_char **, u_char *);
diff --git a/lib/libc/resolv/res_private.h b/lib/libc/resolv/res_private.h
index 4e98157..a986e95 100644
--- a/lib/libc/resolv/res_private.h
+++ b/lib/libc/resolv/res_private.h
@@ -1,3 +1,5 @@
+/* $FreeBSD$ */
+
#ifndef res_private_h
#define res_private_h
@@ -12,6 +14,9 @@ struct __res_state_ext {
} sort_list[MAXRESOLVSORT];
char nsuffix[64];
char nsuffix2[64];
+ struct timespec conf_mtim; /* mod time of loaded resolv.conf */
+ time_t conf_stat; /* time of last stat(resolv.conf) */
+ u_short reload_period; /* seconds between stat(resolv.conf) */
};
extern int
diff --git a/lib/libc/resolv/res_query.c b/lib/libc/resolv/res_query.c
index 4ae97f6..5992edd 100644
--- a/lib/libc/resolv/res_query.c
+++ b/lib/libc/resolv/res_query.c
@@ -88,7 +88,9 @@ __FBSDID("$FreeBSD$");
#include "port_after.h"
/* Options. Leave them on. */
-#define DEBUG
+#ifndef DEBUG
+#define DEBUG
+#endif
#if PACKETSZ > 1024
#define MAXPACKET PACKETSZ
diff --git a/lib/libc/resolv/res_send.c b/lib/libc/resolv/res_send.c
index 5690491..c127c3b 100644
--- a/lib/libc/resolv/res_send.c
+++ b/lib/libc/resolv/res_send.c
@@ -119,7 +119,9 @@ __FBSDID("$FreeBSD$");
#include "un-namespace.h"
/* Options. Leave them on. */
-#define DEBUG
+#ifndef DEBUG
+#define DEBUG
+#endif
#include "res_debug.h"
#include "res_private.h"
diff --git a/lib/libc/resolv/res_state.c b/lib/libc/resolv/res_state.c
index 87643422..6d31d92 100644
--- a/lib/libc/resolv/res_state.c
+++ b/lib/libc/resolv/res_state.c
@@ -37,6 +37,8 @@
#include "reentrant.h"
#include "un-namespace.h"
+#include "res_private.h"
+
#undef _res
struct __res_state _res;
@@ -66,20 +68,26 @@ res_check_reload(res_state statp)
{
struct timespec now;
struct stat sb;
+ struct __res_state_ext *ext;
+
+ if ((statp->options & RES_INIT) == 0) {
+ return (statp);
+ }
- if ((statp->options & RES_INIT) == 0 || statp->reload_period == 0) {
+ ext = statp->_u._ext.ext;
+ if (ext == NULL || ext->reload_period == 0) {
return (statp);
}
if (clock_gettime(CLOCK_MONOTONIC_FAST, &now) != 0 ||
- (now.tv_sec - statp->conf_stat) < statp->reload_period) {
+ (now.tv_sec - ext->conf_stat) < ext->reload_period) {
return (statp);
}
- statp->conf_stat = now.tv_sec;
+ ext->conf_stat = now.tv_sec;
if (stat(_PATH_RESCONF, &sb) == 0 &&
- (sb.st_mtim.tv_sec != statp->conf_mtim.tv_sec ||
- sb.st_mtim.tv_nsec != statp->conf_mtim.tv_nsec)) {
+ (sb.st_mtim.tv_sec != ext->conf_mtim.tv_sec ||
+ sb.st_mtim.tv_nsec != ext->conf_mtim.tv_nsec)) {
statp->options &= ~RES_INIT;
}
diff --git a/lib/libc/sys/brk.2 b/lib/libc/sys/brk.2
index 31dea32..0a529ee 100644
--- a/lib/libc/sys/brk.2
+++ b/lib/libc/sys/brk.2
@@ -28,7 +28,7 @@
.\" @(#)brk.2 8.4 (Berkeley) 5/1/95
.\" $FreeBSD$
.\"
-.Dd July 12, 1999
+.Dd December 15, 2015
.Dt BRK 2
.Os
.Sh NAME
@@ -38,7 +38,6 @@
.Sh LIBRARY
.Lb libc
.Sh SYNOPSIS
-.In sys/types.h
.In unistd.h
.Ft int
.Fn brk "const void *addr"
diff --git a/lib/libc/sys/getgid.2 b/lib/libc/sys/getgid.2
index b03040b..5bd2a94 100644
--- a/lib/libc/sys/getgid.2
+++ b/lib/libc/sys/getgid.2
@@ -28,7 +28,7 @@
.\" @(#)getgid.2 8.1 (Berkeley) 6/4/93
.\" $FreeBSD$
.\"
-.Dd June 4, 1993
+.Dd December 15, 2015
.Dt GETGID 2
.Os
.Sh NAME
@@ -38,7 +38,6 @@
.Sh LIBRARY
.Lb libc
.Sh SYNOPSIS
-.In sys/types.h
.In unistd.h
.Ft gid_t
.Fn getgid void
diff --git a/lib/libc/sys/getpid.2 b/lib/libc/sys/getpid.2
index aefa770..ab69f71 100644
--- a/lib/libc/sys/getpid.2
+++ b/lib/libc/sys/getpid.2
@@ -28,7 +28,7 @@
.\" @(#)getpid.2 8.1 (Berkeley) 6/4/93
.\" $FreeBSD$
.\"
-.Dd November 2, 2006
+.Dd December 15, 2015
.Dt GETPID 2
.Os
.Sh NAME
@@ -38,7 +38,6 @@
.Sh LIBRARY
.Lb libc
.Sh SYNOPSIS
-.In sys/types.h
.In unistd.h
.Ft pid_t
.Fn getpid void
diff --git a/lib/libc/sys/getuid.2 b/lib/libc/sys/getuid.2
index eae0b23..4145356 100644
--- a/lib/libc/sys/getuid.2
+++ b/lib/libc/sys/getuid.2
@@ -28,7 +28,7 @@
.\" @(#)getuid.2 8.1 (Berkeley) 6/4/93
.\" $FreeBSD$
.\"
-.Dd June 4, 1993
+.Dd December 15, 2015
.Dt GETUID 2
.Os
.Sh NAME
@@ -39,7 +39,6 @@
.Lb libc
.Sh SYNOPSIS
.In unistd.h
-.In sys/types.h
.Ft uid_t
.Fn getuid void
.Ft uid_t
diff --git a/lib/libc/sys/read.2 b/lib/libc/sys/read.2
index e99665f..a0a7be8 100644
--- a/lib/libc/sys/read.2
+++ b/lib/libc/sys/read.2
@@ -28,7 +28,7 @@
.\" @(#)read.2 8.4 (Berkeley) 2/26/94
.\" $FreeBSD$
.\"
-.Dd September 11, 2013
+.Dd December 15, 2015
.Dt READ 2
.Os
.Sh NAME
@@ -40,7 +40,6 @@
.Sh LIBRARY
.Lb libc
.Sh SYNOPSIS
-.In sys/types.h
.In unistd.h
.Ft ssize_t
.Fn read "int fd" "void *buf" "size_t nbytes"
diff --git a/lib/libc/sys/setuid.2 b/lib/libc/sys/setuid.2
index 54d89bc..949d936 100644
--- a/lib/libc/sys/setuid.2
+++ b/lib/libc/sys/setuid.2
@@ -28,7 +28,7 @@
.\" @(#)setuid.2 8.1 (Berkeley) 6/4/93
.\" $FreeBSD$
.\"
-.Dd September 13, 2015
+.Dd December 15, 2015
.Dt SETUID 2
.Os
.Sh NAME
@@ -40,7 +40,6 @@
.Sh LIBRARY
.Lb libc
.Sh SYNOPSIS
-.In sys/types.h
.In unistd.h
.Ft int
.Fn setuid "uid_t uid"
diff --git a/lib/libc/sys/utrace.2 b/lib/libc/sys/utrace.2
index 345c1fd..9f48ca9 100644
--- a/lib/libc/sys/utrace.2
+++ b/lib/libc/sys/utrace.2
@@ -28,7 +28,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd October 5, 2015
+.Dd December 11, 2015
.Dt UTRACE 2
.Os
.Sh NAME
@@ -71,7 +71,8 @@ support
.Xr kdump 1 ,
.Xr ktrace 1 ,
.Xr ktrace 2 ,
-.Xr truss 1
+.Xr truss 1 ,
+.Xr sysdecode_utrace 3
.Sh HISTORY
The
.Fn utrace
diff --git a/lib/libc/sys/write.2 b/lib/libc/sys/write.2
index a06e7c9..0bfe565 100644
--- a/lib/libc/sys/write.2
+++ b/lib/libc/sys/write.2
@@ -28,7 +28,7 @@
.\" @(#)write.2 8.5 (Berkeley) 4/2/94
.\" $FreeBSD$
.\"
-.Dd September 11, 2013
+.Dd December 15, 2015
.Dt WRITE 2
.Os
.Sh NAME
@@ -40,7 +40,6 @@
.Sh LIBRARY
.Lb libc
.Sh SYNOPSIS
-.In sys/types.h
.In unistd.h
.Ft ssize_t
.Fn write "int fd" "const void *buf" "size_t nbytes"
OpenPOWER on IntegriCloud