<feed xmlns='http://www.w3.org/2005/Atom'>
<title>src/lib/libc/tests, branch release/14.4.0</title>
<subtitle>FreeBSD source tree</subtitle>
<id>https://cgit-dev.freebsd.org/src/atom?h=release%2F14.4.0</id>
<link rel='self' href='https://cgit-dev.freebsd.org/src/atom?h=release%2F14.4.0'/>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/'/>
<updated>2026-02-05T14:50:01Z</updated>
<entry>
<title>libc/tests: Clean up *dir() tests</title>
<updated>2026-02-05T14:50:01Z</updated>
<author>
<name>Dag-Erling Smørgrav</name>
<email>des@FreeBSD.org</email>
</author>
<published>2026-02-03T14:39:21Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=0018cfdb91c399342a0facd04dfe72cb689d86ea'/>
<id>urn:sha1:0018cfdb91c399342a0facd04dfe72cb689d86ea</id>
<content type='text'>
Mainly, avoid reusing the name of one of the functions we should be
testing (but aren't) for local variables.

Sponsored by:	Klara, Inc.
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D55054

(cherry picked from commit d70b9eb74fc4aa430bd2ff4bca37e6a9b6c8004f)
</content>
</entry>
<entry>
<title>opendir, readdir, telldir: Use the correct types.</title>
<updated>2026-02-05T14:48:34Z</updated>
<author>
<name>Dag-Erling Smørgrav</name>
<email>des@FreeBSD.org</email>
</author>
<published>2025-07-09T20:34:22Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=98b041239c252d0c2433e5d412d74f90a235d0f2'/>
<id>urn:sha1:98b041239c252d0c2433e5d412d74f90a235d0f2</id>
<content type='text'>
Use either size_t or off_t (as appropriate) instead of long.

Sponsored by:	Klara, Inc.
Reviewed by:	kevans
Differential Revision:	https://reviews.freebsd.org/D51210

(cherry picked from commit 42e613018da50ee6877d24815c7626d79629e707)

readdir: Fix error check.

Now that dd_size is unsigned, we need to check if the return value from
getdirentries() was negative before assigning it to dd_size.

While here, simplify the scandir_error test case slightly, and verify
that calling readdir() again after EOF still returns NULL.

Fixes:		42e613018da5
Sponsored by:	Klara, Inc.
Reviewed by:	kevans
Differential Revision:	https://reviews.freebsd.org/D51266

(cherry picked from commit 920b2183919e430cf85c4aa1fa337bfded12aee5)
</content>
</entry>
<entry>
<title>opendir, fdopendir: Add tests, clean up.</title>
<updated>2026-02-05T14:47:47Z</updated>
<author>
<name>Dag-Erling Smørgrav</name>
<email>des@FreeBSD.org</email>
</author>
<published>2025-07-08T19:40:55Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=9d7a0f817cef4c7d94fe584f3f85754996678ed4'/>
<id>urn:sha1:9d7a0f817cef4c7d94fe584f3f85754996678ed4</id>
<content type='text'>
* Add test cases for opendir() and fdopendir().
* Drop O_NONBLOCK from opendir(); it was added a long time ago to avoid
  blocking if given a closed named pipe, but now we use O_DIRECTORY,
  which ensures that we get ENOTDIR in that case.
* While here, remove unused #includes left over from the split.

Sponsored by:	Klara, Inc.
Reviewed by:	kevans, markj
Differential Revision:	https://reviews.freebsd.org/D51126

(cherry picked from commit c08e019c6ce4fc637b195f1bb0878763c3fefe9e)
</content>
</entry>
<entry>
<title>scandir: Propagate errors from readdir().</title>
<updated>2026-02-05T14:47:46Z</updated>
<author>
<name>Dag-Erling Smørgrav</name>
<email>des@FreeBSD.org</email>
</author>
<published>2025-06-26T07:37:00Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=1a3c32bac0f029b0186bb856373fe3bcd2d5e18f'/>
<id>urn:sha1:1a3c32bac0f029b0186bb856373fe3bcd2d5e18f</id>
<content type='text'>
Currently, if `readdir()` fails, `scandir()` simply returns a partial
result (or a null result if it fails before any entries were selected).
There is no way within the current API design to return both a partial
result and an error indicator, so err on the side of caution: if an
error occurs, discard any partial result and return the error instead.

MFC after:	1 week
Reported by:	Maxim Suhanov &lt;dfirblog@gmail.com&gt;
Sponsored by:	Klara, Inc.
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D51046

(cherry picked from commit 62e0f12f5104585b7346fee183e5c667b39ddbad)
</content>
</entry>
<entry>
<title>libc: Rename fscandir{,_b}() to fdscandir{,_b}().</title>
<updated>2026-02-05T14:47:46Z</updated>
<author>
<name>Dag-Erling Smørgrav</name>
<email>des@FreeBSD.org</email>
</author>
<published>2025-06-23T13:02:53Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=35f8b56a41230f5c0853c2e096af72e9e65fa0e5'/>
<id>urn:sha1:35f8b56a41230f5c0853c2e096af72e9e65fa0e5</id>
<content type='text'>
This seems to fit the pattern better (e.g. fdopendir()).

I've added weak references to ease the transition, but since it's only
been a few days, we can remove them (and the ObsoleteFiles entries for
the manual pages) before we branch stable/15.

Fixes:		deeebfdecab5
Sponsored by:	Klara, Inc.
Reviewed by:	kevans
Differential Revision:	https://reviews.freebsd.org/D50980

(cherry picked from commit 0a5b763d98b921f921243525ff25a70bbe00cfaa)

libc: Finish removing fscandir{,_b}().

These only existed for a few days before being renamed, so there's no
reason to continue to carry compatibility shims for them.

Fixes:		deeebfdecab5
Sponsored by:	Klara, Inc.
Reviewed by:	kevans
Differential Revision:	https://reviews.freebsd.org/D50981

(cherry picked from commit ccf937320a1a7383a2c33698007b7244f66dc022)
</content>
</entry>
<entry>
<title>scandir: Fix behavior when no entries match.</title>
<updated>2026-02-05T14:47:46Z</updated>
<author>
<name>Dag-Erling Smørgrav</name>
<email>des@FreeBSD.org</email>
</author>
<published>2025-06-20T16:13:48Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=90c5d1b5f4238823414a82b72e7f80d9e83a3de6'/>
<id>urn:sha1:90c5d1b5f4238823414a82b72e7f80d9e83a3de6</id>
<content type='text'>
In the previous commit, I removed the initial initialization of the
`names` array, not realizing that `scandir()` is expected to return
a non-null (but empty) array of entries if no entries matched.
Restore the historical behavior, document it, and add a test.

Fixes:		deeebfdecab5
Sponsored by:	Klara, Inc.
Reviewed by:	kevans, allanjude, markj
Differential Revision:	https://reviews.freebsd.org/D50949

(cherry picked from commit c187b673bb79905b5d5db1eb34d5a893c4464eeb)
</content>
</entry>
<entry>
<title>libc: Add fscandir(), fscandir_b(), scandirat_b().</title>
<updated>2026-02-05T14:47:46Z</updated>
<author>
<name>Dag-Erling Smørgrav</name>
<email>des@FreeBSD.org</email>
</author>
<published>2025-06-20T11:10:23Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=8b2062419c33c0f5b9b5d83f831bc7f54aff42a7'/>
<id>urn:sha1:8b2062419c33c0f5b9b5d83f831bc7f54aff42a7</id>
<content type='text'>
While here, clean up scandir() a bit and improve the documentation.

MFC after:	never
Sponsored by:	Klara, Inc.
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D50935

(cherry picked from commit deeebfdecab56729fa898271ae53d01c8e156302)
</content>
</entry>
<entry>
<title>libc: report _SC_NPROCESSORS_ONLN more accurately in cpu-limited jails</title>
<updated>2026-01-20T04:06:56Z</updated>
<author>
<name>Kyle Evans</name>
<email>kevans@FreeBSD.org</email>
</author>
<published>2025-10-29T16:32:30Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=b196a718ca0e77685b8e40aaac0911f11604d00c'/>
<id>urn:sha1:b196a718ca0e77685b8e40aaac0911f11604d00c</id>
<content type='text'>
We don't support CPU hotplug, but we do support cpuset(8) restrictions
on jails (including prison0, which uses cpuset 1).  The process cannot
widen its cpuset beyond its root set, so it makes sense to instead
report the number of cpus enabled there rather than the total number
in the system.

This change is effectively a nop for the majority of systems and jails
in the wild, though it does reduce the performance of this query now
that we can't take advantage of AT_NCPUS being provided in the auxinfo.

The implementation here is notably different than Linux, which would not
take cgroups into account.  They do, however, take CPU hotplug into
account, so the possibility for it to diverge from (and be lower than)
the # configured count to reflect what the process can actually be
scheduled on doesn't really diverge in semantics.

Reviewed by:	kib

(cherry picked from commit d617806aac1469319970e3551656e9deabb98a35)
</content>
</entry>
<entry>
<title>libc/tests/string: improve stpncpy() "bounds" unit test</title>
<updated>2026-01-04T13:25:21Z</updated>
<author>
<name>Robert Clausecker</name>
<email>fuz@FreeBSD.org</email>
</author>
<published>2025-12-04T16:34:59Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=e2f095779323204e90843b405863c81dc02423d2'/>
<id>urn:sha1:e2f095779323204e90843b405863c81dc02423d2</id>
<content type='text'>
The test is extended the same way I previously extended the memccpy()
test to fix what is probably the same kind of bug.

PR:		291359
Reported by:	Collin Funk &lt;collin.funk1@gmail.com&gt;
Reviewed by:	ngie
Approved by:	markj (mentor)
Fixes:		6fa9e7d8737548ef93c573387ce62402c368d486 (D42519)
See also:	61ed5748e4e9c7397fcb2638b442f46ac5c9e7c5 (D46051)
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D54169

lib/libc/tests/string/stpncpy_test.c: apply ngie's fixes

(cherry picked from commit 123c086200491819595abc271d360e605288fd18)
(cherry picked from commit 8be8642826099368208efb2c1222f2a102cc5b08)
</content>
</entry>
<entry>
<title>strfmon: Fix negative sign handling for C locale</title>
<updated>2025-12-03T02:34:33Z</updated>
<author>
<name>Jose Luis Duran</name>
<email>jlduran@FreeBSD.org</email>
</author>
<published>2025-11-26T20:34:56Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=1869d604e22d88c8c7487cd8a547de42847a40be'/>
<id>urn:sha1:1869d604e22d88c8c7487cd8a547de42847a40be</id>
<content type='text'>
If the locale's positive_sign and negative_sign values would both be
returned by localeconv() as empty strings, strfmon() shall behave as if
the negative_sign value was the string "-".

This occurs with the C locale.  The implementation previously assigned
"0" to sign_posn (parentheses around the entire string); now it assigns
it to "1" (sign before the string) when it is undefined (CHAR_MAX).

Austin Group Defect 1199[1] is applied, changing the requirements for
the '+' and '(' flags.

[1]: https://www.austingroupbugs.net/view.php?id=1199

Reviewed by:	kib
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D53913

(cherry picked from commit cf85e7034ad5640b18a3b68d6b291b7bf89bfc80)
</content>
</entry>
</feed>
