svn commit: r313469 - in projects/stable-10-backport-test-changes: contrib/netbsd-tests/lib/libc/gen contrib/netbsd-tests/lib/libc/string lib/libc/gen lib/libc/string
Ngie Cooper
ngie at FreeBSD.org
Thu Feb 9 08:39:09 UTC 2017
Author: ngie
Date: Thu Feb 9 08:39:07 2017
New Revision: 313469
URL: https://svnweb.freebsd.org/changeset/base/313469
Log:
MFC r276527,r277648,r279154,r279397,r283584:
r276527:
Don't install h_raw if dealing with clang 3.5.0+ to unbreak the tests2 Jenkins
job
The h_raw application doesn't do proper bounds checking without the option
being supplied via the build, which means that it doesn't throw signals and
fail as expected
PR: 196430
r277648 (by jilles):
Enable utimensat tests from NetBSD.
As with other tests from c063, a required #include <sys/stat.h> was missing.
r279154 (by jilles):
nice(): Correct return value and [EPERM] error.
PR: 189821
Obtained from: NetBSD
Relnotes: yes
r279397 (by jilles):
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
Relnotes: yes
r283584 (by emaste):
memmem(3): empty little string matches the beginning of the big string
This function originated in glibc, and this matches their behaviour
(and NetBSD, OpenBSD, and musl).
An empty big string (arg "l") is handled by the existing
l_len < s_len test.
Modified:
projects/stable-10-backport-test-changes/contrib/netbsd-tests/lib/libc/gen/t_nice.c
projects/stable-10-backport-test-changes/contrib/netbsd-tests/lib/libc/string/t_memmem.c
projects/stable-10-backport-test-changes/lib/libc/gen/nice.3
projects/stable-10-backport-test-changes/lib/libc/gen/nice.c
projects/stable-10-backport-test-changes/lib/libc/string/memmem.3
projects/stable-10-backport-test-changes/lib/libc/string/memmem.c
Directory Properties:
projects/stable-10-backport-test-changes/ (props changed)
Modified: projects/stable-10-backport-test-changes/contrib/netbsd-tests/lib/libc/gen/t_nice.c
==============================================================================
--- projects/stable-10-backport-test-changes/contrib/netbsd-tests/lib/libc/gen/t_nice.c Thu Feb 9 08:25:30 2017 (r313468)
+++ projects/stable-10-backport-test-changes/contrib/netbsd-tests/lib/libc/gen/t_nice.c Thu Feb 9 08:39:07 2017 (r313469)
@@ -72,11 +72,6 @@ ATF_TC_BODY(nice_err, tc)
{
int i;
-#ifdef __FreeBSD__
- atf_tc_expect_fail("nice(incr) with incr < 0 fails with unprivileged "
- "users and sets errno == EPERM; see PR # 189821 for more details");
-#endif
-
/*
* The call should fail with EPERM if the
* supplied parameter is negative and the
Modified: projects/stable-10-backport-test-changes/contrib/netbsd-tests/lib/libc/string/t_memmem.c
==============================================================================
--- projects/stable-10-backport-test-changes/contrib/netbsd-tests/lib/libc/string/t_memmem.c Thu Feb 9 08:25:30 2017 (r313468)
+++ projects/stable-10-backport-test-changes/contrib/netbsd-tests/lib/libc/string/t_memmem.c Thu Feb 9 08:39:07 2017 (r313469)
@@ -75,7 +75,7 @@ ATF_TC_HEAD(memmem_basic, tc)
ATF_TC_BODY(memmem_basic, tc)
{
-#if defined(__darwin__) || defined(__FreeBSD__)
+#if defined(__darwin__)
expect(memmem(b2, lb2, p0, lp0) == NULL);
expect(memmem(b0, lb0, p0, lp0) == NULL);
#else
Modified: projects/stable-10-backport-test-changes/lib/libc/gen/nice.3
==============================================================================
--- projects/stable-10-backport-test-changes/lib/libc/gen/nice.3 Thu Feb 9 08:25:30 2017 (r313468)
+++ projects/stable-10-backport-test-changes/lib/libc/gen/nice.3 Thu Feb 9 08:39:07 2017 (r313469)
@@ -28,7 +28,7 @@
.\" @(#)nice.3 8.1 (Berkeley) 6/4/93
.\" $FreeBSD$
.\"
-.Dd June 4, 1993
+.Dd February 28, 2015
.Dt NICE 3
.Os
.Sh NAME
@@ -48,20 +48,48 @@ This interface is obsoleted by
.Pp
The
.Fn nice
-function obtains the scheduling priority of the process
-from the system and sets it to the priority value specified in
-.Fa incr .
+function adds
+.Fa incr
+to the scheduling priority of the process.
The priority is a value in the range -20 to 20.
The default priority is 0; lower priorities cause more favorable scheduling.
Only the super-user may lower priorities.
.Pp
Children inherit the priority of their parent processes via
.Xr fork 2 .
+.Sh RETURN VALUES
+Upon successful completion,
+.Fn nice
+returns 0, and
+.Va errno
+is unchanged.
+Otherwise, \-1 is returned, the process' nice value is not changed, and
+.Va errno
+is set to indicate the error.
+.Sh ERRORS
+The
+.Fn nice
+function will fail if:
+.Bl -tag -width Er
+.It Bq Er EPERM
+The
+.Fa incr
+argument is negative and the caller does not have appropriate privileges.
+.El
.Sh SEE ALSO
.Xr nice 1 ,
.Xr fork 2 ,
.Xr setpriority 2 ,
.Xr renice 8
+.Sh STANDARDS
+The
+.Fn nice
+function conforms to
+.St -p1003.1-2008
+except for the return value.
+This implementation returns 0 upon successful completion but
+the standard requires returning the new nice value,
+which could be \-1.
.Sh HISTORY
A
.Fn nice
Modified: projects/stable-10-backport-test-changes/lib/libc/gen/nice.c
==============================================================================
--- projects/stable-10-backport-test-changes/lib/libc/gen/nice.c Thu Feb 9 08:25:30 2017 (r313468)
+++ projects/stable-10-backport-test-changes/lib/libc/gen/nice.c Thu Feb 9 08:39:07 2017 (r313469)
@@ -43,14 +43,20 @@ __FBSDID("$FreeBSD$");
* Backwards compatible nice.
*/
int
-nice(incr)
- int incr;
+nice(int incr)
{
- int prio;
+ int saverrno, prio;
+ saverrno = errno;
errno = 0;
prio = getpriority(PRIO_PROCESS, 0);
- if (prio == -1 && errno)
+ if (prio == -1 && errno != 0)
return (-1);
- return (setpriority(PRIO_PROCESS, 0, prio + incr));
+ if (setpriority(PRIO_PROCESS, 0, prio + incr) == -1) {
+ if (errno == EACCES)
+ errno = EPERM;
+ return (-1);
+ }
+ errno = saverrno;
+ return (0);
}
Modified: projects/stable-10-backport-test-changes/lib/libc/string/memmem.3
==============================================================================
--- projects/stable-10-backport-test-changes/lib/libc/string/memmem.3 Thu Feb 9 08:25:30 2017 (r313468)
+++ projects/stable-10-backport-test-changes/lib/libc/string/memmem.3 Thu Feb 9 08:39:07 2017 (r313469)
@@ -26,7 +26,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd August 24, 2005
+.Dd May 26, 2015
.Dt MEMMEM 3
.Os
.Sh NAME
@@ -51,14 +51,12 @@ in the byte string
.Fa big .
.Sh RETURN VALUES
If
-.Fa big_len
-is smaller than
-.Fa little_len ,
-if
.Fa little_len
-is 0, if
-.Fa big_len
-is 0 or if
+is zero
+.Fa big
+is returned (that is, an empty little is deemed to match at the beginning of
+big);
+if
.Fa little
occurs nowhere in
.Fa big ,
@@ -84,3 +82,11 @@ function first appeared in
.Sh BUGS
This function was broken in Linux libc up to and including version 5.0.9
and in GNU libc prior to version 2.1.
+Prior to
+.Fx 11.0
+.Nm
+returned
+.Dv NULL
+when
+.Fa little_len
+equals 0.
Modified: projects/stable-10-backport-test-changes/lib/libc/string/memmem.c
==============================================================================
--- projects/stable-10-backport-test-changes/lib/libc/string/memmem.c Thu Feb 9 08:25:30 2017 (r313468)
+++ projects/stable-10-backport-test-changes/lib/libc/string/memmem.c Thu Feb 9 08:39:07 2017 (r313469)
@@ -42,9 +42,9 @@ memmem(const void *l, size_t l_len, cons
const char *cl = (const char *)l;
const char *cs = (const char *)s;
- /* we need something to compare */
- if (l_len == 0 || s_len == 0)
- return NULL;
+ /* empty "s" matches the beginning of "l" */
+ if (s_len == 0)
+ return (void *)cl;
/* "s" must be smaller or equal to "l" */
if (l_len < s_len)
More information about the svn-src-projects
mailing list