aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2015-09-11 17:20:03 +0000
committerDimitry Andric <dim@FreeBSD.org>2015-09-11 17:20:03 +0000
commit0e1e5c22c20e636264ff1284083c6af7a1b282cb (patch)
tree09add9017de3c98451b1eaf85a24b608cf228e4b /lib
parent6160f3cfcac58513eef46e925b0bf15681e88512 (diff)
parent92392e798859a0d87094d6c0b22afee48fde7881 (diff)
downloadsrc-0e1e5c22c20e636264ff1284083c6af7a1b282cb.tar.gz
src-0e1e5c22c20e636264ff1284083c6af7a1b282cb.zip
Merge ^/head r287527 through r287679.
Notes
Notes: svn path=/projects/clang370-import/; revision=287681
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/gen/sysctl.310
-rw-r--r--lib/libc/net/getnameinfo.c20
-rw-r--r--lib/libc/net/if_nametoindex.c2
-rw-r--r--lib/libc/posix1e/acl_entry.c2
-rw-r--r--lib/libc/tests/sys/Makefile3
-rw-r--r--lib/libthr/thread/thr_once.c27
6 files changed, 28 insertions, 36 deletions
diff --git a/lib/libc/gen/sysctl.3 b/lib/libc/gen/sysctl.3
index 7d7b90a7442e..4594d9af9a50 100644
--- a/lib/libc/gen/sysctl.3
+++ b/lib/libc/gen/sysctl.3
@@ -28,7 +28,7 @@
.\" @(#)sysctl.3 8.4 (Berkeley) 5/9/95
.\" $FreeBSD$
.\"
-.Dd May 17, 2013
+.Dd September 10, 2015
.Dt SYSCTL 3
.Os
.Sh NAME
@@ -736,8 +736,6 @@ privilege may change the value.
.It "VM_LOADAVG struct loadavg no"
.It "VM_TOTAL struct vmtotal no"
.It "VM_SWAPPING_ENABLED integer maybe"
-.It "VM_V_CACHE_MAX integer yes"
-.It "VM_V_CACHE_MIN integer yes"
.It "VM_V_FREE_MIN integer yes"
.It "VM_V_FREE_RESERVED integer yes"
.It "VM_V_FREE_TARGET integer yes"
@@ -757,12 +755,6 @@ The returned data consists of a
1 if process swapping is enabled or 0 if disabled.
This variable is
permanently set to 0 if the kernel was built with swapping disabled.
-.It Li VM_V_CACHE_MAX
-Maximum desired size of the cache queue.
-.It Li VM_V_CACHE_MIN
-Minimum desired size of the cache queue.
-If the cache queue size
-falls very far below this value, the pageout daemon is awakened.
.It Li VM_V_FREE_MIN
Minimum amount of memory (cache memory plus free memory)
required to be available before a process waiting on memory will be
diff --git a/lib/libc/net/getnameinfo.c b/lib/libc/net/getnameinfo.c
index f83d0e26a86d..d7e7971ea647 100644
--- a/lib/libc/net/getnameinfo.c
+++ b/lib/libc/net/getnameinfo.c
@@ -78,6 +78,8 @@ getnameinfo(const struct sockaddr *sa, socklen_t salen,
char *host, size_t hostlen, char *serv, size_t servlen,
int flags)
{
+ if (sa == NULL)
+ return (EAI_FAIL);
switch (sa->sa_family) {
case AF_INET:
@@ -124,25 +126,19 @@ getnameinfo_inet(const struct sockaddr *sa, socklen_t salen,
struct servent *sp;
struct hostent *hp;
u_short port;
- int family, i;
const char *addr;
u_int32_t v4a;
int h_error;
char numserv[512];
char numaddr[512];
- if (sa == NULL)
- return EAI_FAIL;
-
- family = sa->sa_family;
- for (i = 0; afdl[i].a_af; i++)
- if (afdl[i].a_af == family) {
- afd = &afdl[i];
- goto found;
- }
- return EAI_FAMILY;
+ for (afd = &afdl[0]; afd->a_af > 0; afd++) {
+ if (afd->a_af == sa->sa_family)
+ break;
+ }
+ if (afd->a_af == 0)
+ return (EAI_FAMILY);
- found:
if (salen != afd->a_socklen)
return EAI_FAIL;
diff --git a/lib/libc/net/if_nametoindex.c b/lib/libc/net/if_nametoindex.c
index 8f04921760eb..debf3fabc6af 100644
--- a/lib/libc/net/if_nametoindex.c
+++ b/lib/libc/net/if_nametoindex.c
@@ -70,9 +70,7 @@ if_nametoindex(const char *ifname)
s = _socket(AF_INET, SOCK_DGRAM | SOCK_CLOEXEC, 0);
if (s != -1) {
-#ifdef PURIFY
memset(&ifr, 0, sizeof(ifr));
-#endif
strlcpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name));
if (_ioctl(s, SIOCGIFINDEX, &ifr) != -1) {
_close(s);
diff --git a/lib/libc/posix1e/acl_entry.c b/lib/libc/posix1e/acl_entry.c
index 3f8ca62c8b00..2cffaa33d54c 100644
--- a/lib/libc/posix1e/acl_entry.c
+++ b/lib/libc/posix1e/acl_entry.c
@@ -91,7 +91,7 @@ acl_create_entry_np(acl_t *acl_p, acl_entry_t *entry_p, int offset)
return (-1);
}
- if (offset < 0 || offset >= acl_int->acl_cnt) {
+ if (offset < 0 || offset > acl_int->acl_cnt) {
errno = EINVAL;
return (-1);
}
diff --git a/lib/libc/tests/sys/Makefile b/lib/libc/tests/sys/Makefile
index 7ecf1d69c616..89431bced322 100644
--- a/lib/libc/tests/sys/Makefile
+++ b/lib/libc/tests/sys/Makefile
@@ -25,10 +25,7 @@ NETBSD_ATF_TESTS_C+= kevent_test
NETBSD_ATF_TESTS_C+= kill_test
NETBSD_ATF_TESTS_C+= link_test
NETBSD_ATF_TESTS_C+= listen_test
-# On arm64 triggers panic ARM64TODO: pmap_mincore (PR202307).
-.if ${MACHINE_CPUARCH} != "aarch64"
NETBSD_ATF_TESTS_C+= mincore_test
-.endif
NETBSD_ATF_TESTS_C+= mkdir_test
NETBSD_ATF_TESTS_C+= mkfifo_test
NETBSD_ATF_TESTS_C+= mknod_test
diff --git a/lib/libthr/thread/thr_once.c b/lib/libthr/thread/thr_once.c
index 4f7037416c25..208b703ff432 100644
--- a/lib/libthr/thread/thr_once.c
+++ b/lib/libthr/thread/thr_once.c
@@ -50,9 +50,11 @@ __weak_reference(_pthread_once, pthread_once);
static void
once_cancel_handler(void *arg)
{
- pthread_once_t *once_control = arg;
+ pthread_once_t *once_control;
- if (atomic_cmpset_rel_int(&once_control->state, ONCE_IN_PROGRESS, ONCE_NEVER_DONE))
+ once_control = arg;
+ if (atomic_cmpset_rel_int(&once_control->state, ONCE_IN_PROGRESS,
+ ONCE_NEVER_DONE))
return;
atomic_store_rel_int(&once_control->state, ONCE_NEVER_DONE);
_thr_umtx_wake(&once_control->state, INT_MAX, 0);
@@ -68,16 +70,22 @@ _pthread_once(pthread_once_t *once_control, void (*init_routine) (void))
for (;;) {
state = once_control->state;
- if (state == ONCE_DONE)
+ if (state == ONCE_DONE) {
+ atomic_thread_fence_acq();
return (0);
+ }
if (state == ONCE_NEVER_DONE) {
- if (atomic_cmpset_acq_int(&once_control->state, state, ONCE_IN_PROGRESS))
+ if (atomic_cmpset_int(&once_control->state, state,
+ ONCE_IN_PROGRESS))
break;
} else if (state == ONCE_IN_PROGRESS) {
- if (atomic_cmpset_acq_int(&once_control->state, state, ONCE_WAIT))
- _thr_umtx_wait_uint(&once_control->state, ONCE_WAIT, NULL, 0);
+ if (atomic_cmpset_int(&once_control->state, state,
+ ONCE_WAIT))
+ _thr_umtx_wait_uint(&once_control->state,
+ ONCE_WAIT, NULL, 0);
} else if (state == ONCE_WAIT) {
- _thr_umtx_wait_uint(&once_control->state, state, NULL, 0);
+ _thr_umtx_wait_uint(&once_control->state, state,
+ NULL, 0);
} else
return (EINVAL);
}
@@ -86,7 +94,8 @@ _pthread_once(pthread_once_t *once_control, void (*init_routine) (void))
THR_CLEANUP_PUSH(curthread, once_cancel_handler, once_control);
init_routine();
THR_CLEANUP_POP(curthread, 0);
- if (atomic_cmpset_rel_int(&once_control->state, ONCE_IN_PROGRESS, ONCE_DONE))
+ if (atomic_cmpset_rel_int(&once_control->state, ONCE_IN_PROGRESS,
+ ONCE_DONE))
return (0);
atomic_store_rel_int(&once_control->state, ONCE_DONE);
_thr_umtx_wake(&once_control->state, INT_MAX, 0);
@@ -94,6 +103,6 @@ _pthread_once(pthread_once_t *once_control, void (*init_routine) (void))
}
void
-_thr_once_init()
+_thr_once_init(void)
{
}