]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
MFC r309837:
authorngie <ngie@FreeBSD.org>
Sat, 24 Dec 2016 12:58:33 +0000 (12:58 +0000)
committerngie <ngie@FreeBSD.org>
Sat, 24 Dec 2016 12:58:33 +0000 (12:58 +0000)
commit29cf69d0fdeacdd9809208786e6ed1ab3c4f0ecb
tree4473bb42be74a080ac4664af82a9a2fe302e6b71
parent7b08136c1699729ff75fc4b6ae32bede6588dc12
MFC r309837:

Change the process limits for RLIMIT_MEMLOCK to RLIM_INFINITY when
executing :mincore_resid

The default process limits in FreeBSD is 64kB for unprivileged users,
which empirically is too low to run the :mincore_resid testcase.

Process limits are inherited, so even though the default limit for
root users is RLIM_INFINITY, the inherited limit with "sudo" with the
default login.conf will be 64kB.

Use setrlimit to set rlim_max for RLIMIT_MEMLOCK to RLIM_INFINITY to
avoid ENOMEM issues when calling mlock to wire the mmap'ed address
space.

setrlimit requires root access to increase rlim_max, so require root
privileges when running the test

Discovered when executing the tests with sudo, e.g.
"sudo kyua test -k /usr/tests/lib/libc/sys/Kyuafile mincore_test"
contrib/netbsd-tests/lib/libc/sys/t_mincore.c