diff options
author | Bryan Drewery <bdrewery@FreeBSD.org> | 2016-12-01 22:12:58 +0000 |
---|---|---|
committer | Bryan Drewery <bdrewery@FreeBSD.org> | 2016-12-01 22:12:58 +0000 |
commit | 710542df20ed68759eb8370402305eef8f68ffe5 (patch) | |
tree | a945afb842da566dc4d5d8cde8c324c8f7b2aad7 /contrib/netbsd-tests/lib/libc/sys/t_setrlimit.c | |
parent | 86a6fcd4ffb8373e942c763cbedbe2e80cb01ffa (diff) | |
download | src-test2-710542df20ed68759eb8370402305eef8f68ffe5.tar.gz src-test2-710542df20ed68759eb8370402305eef8f68ffe5.zip |
Notes
Diffstat (limited to 'contrib/netbsd-tests/lib/libc/sys/t_setrlimit.c')
-rw-r--r-- | contrib/netbsd-tests/lib/libc/sys/t_setrlimit.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/contrib/netbsd-tests/lib/libc/sys/t_setrlimit.c b/contrib/netbsd-tests/lib/libc/sys/t_setrlimit.c index 84b014972361..b6034ec87c49 100644 --- a/contrib/netbsd-tests/lib/libc/sys/t_setrlimit.c +++ b/contrib/netbsd-tests/lib/libc/sys/t_setrlimit.c @@ -50,6 +50,11 @@ __RCSID("$NetBSD: t_setrlimit.c,v 1.5 2016/07/13 09:53:16 njoly Exp $"); #include <ucontext.h> #include <unistd.h> +#ifdef __FreeBSD__ +void set_vm_max_wired(int); +void restore_vm_max_wired(void); +#endif + static void sighandler(int); static const char path[] = "setrlimit"; @@ -235,10 +240,18 @@ sighandler(int signo) _exit(EXIT_SUCCESS); } +#ifdef __FreeBSD__ +ATF_TC_WITH_CLEANUP(setrlimit_memlock); +#else ATF_TC(setrlimit_memlock); +#endif ATF_TC_HEAD(setrlimit_memlock, tc) { atf_tc_set_md_var(tc, "descr", "Test setrlimit(2), RLIMIT_MEMLOCK"); +#ifdef __FreeBSD__ + atf_tc_set_md_var(tc, "require.config", "allow_sysctl_side_effects"); + atf_tc_set_md_var(tc, "require.user", "root"); +#endif } ATF_TC_BODY(setrlimit_memlock, tc) @@ -249,6 +262,11 @@ ATF_TC_BODY(setrlimit_memlock, tc) pid_t pid; int sta; +#ifdef __FreeBSD__ + /* Set max_wired really really high to avoid EAGAIN */ + set_vm_max_wired(INT_MAX); +#endif + page = sysconf(_SC_PAGESIZE); ATF_REQUIRE(page >= 0); @@ -292,6 +310,14 @@ ATF_TC_BODY(setrlimit_memlock, tc) atf_tc_fail("RLIMIT_MEMLOCK not enforced"); } +#ifdef __FreeBSD__ +ATF_TC_CLEANUP(setrlimit_memlock, tc) +{ + + restore_vm_max_wired(); +} +#endif + ATF_TC(setrlimit_nofile_1); ATF_TC_HEAD(setrlimit_nofile_1, tc) { |