diff options
author | jilles <jilles@FreeBSD.org> | 2015-02-28 18:22:10 +0000 |
---|---|---|
committer | jilles <jilles@FreeBSD.org> | 2015-02-28 18:22:10 +0000 |
commit | dc581a988bf8b9788faf627451a3307e75b32e43 (patch) | |
tree | 1da3465966c2b984a56b85e3f22be6c2f998743e /contrib/netbsd-tests/lib/libc | |
parent | 0b0c9cce2f971a743e2ff85021266ff0b8082bbf (diff) | |
download | FreeBSD-src-dc581a988bf8b9788faf627451a3307e75b32e43.zip FreeBSD-src-dc581a988bf8b9788faf627451a3307e75b32e43.tar.gz |
nice(): Put back old return value, keeping [EPERM] error.
Commit r279154 changed the API and ABI significantly, and {NZERO} is still
wrong.
Also, preserve errno on success instead of setting it to 0.
PR: 189821
Reported by: bde
Relnotes: yes
Diffstat (limited to 'contrib/netbsd-tests/lib/libc')
-rw-r--r-- | contrib/netbsd-tests/lib/libc/gen/t_nice.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/contrib/netbsd-tests/lib/libc/gen/t_nice.c b/contrib/netbsd-tests/lib/libc/gen/t_nice.c index f4a62e9..7c6d232 100644 --- a/contrib/netbsd-tests/lib/libc/gen/t_nice.c +++ b/contrib/netbsd-tests/lib/libc/gen/t_nice.c @@ -93,7 +93,11 @@ ATF_TC_HEAD(nice_priority, tc) ATF_TC_BODY(nice_priority, tc) { +#ifdef __FreeBSD__ + int i, pri, pri2, nic; +#else int i, pri, nic; +#endif pid_t pid; int sta; @@ -106,8 +110,10 @@ ATF_TC_BODY(nice_priority, tc) pri = getpriority(PRIO_PROCESS, 0); ATF_REQUIRE(errno == 0); +#ifdef __NetBSD__ if (nic != pri) atf_tc_fail("nice(3) and getpriority(2) conflict"); +#endif /* * Also verify that the nice(3) values @@ -119,10 +125,18 @@ ATF_TC_BODY(nice_priority, tc) if (pid == 0) { errno = 0; +#ifdef __FreeBSD__ pri = getpriority(PRIO_PROCESS, 0); +#else + pri2 = getpriority(PRIO_PROCESS, 0); +#endif ATF_REQUIRE(errno == 0); +#ifdef __FreeBSD__ + if (pri != pri2) +#else if (nic != pri) +#endif _exit(EXIT_FAILURE); _exit(EXIT_SUCCESS); @@ -161,7 +175,11 @@ ATF_TC_HEAD(nice_thread, tc) ATF_TC_BODY(nice_thread, tc) { pthread_t tid[5]; +#ifdef __FreeBSD__ + int pri, rv, val; +#else int rv, val; +#endif size_t i; /* @@ -173,7 +191,12 @@ ATF_TC_BODY(nice_thread, tc) val = nice(i); ATF_REQUIRE(val != -1); +#ifdef __FreeBSD__ + pri = getpriority(PRIO_PROCESS, 0); + rv = pthread_create(&tid[i], NULL, threadfunc, &pri); +#else rv = pthread_create(&tid[i], NULL, threadfunc, &val); +#endif ATF_REQUIRE(rv == 0); rv = pthread_join(tid[i], NULL); |