<feed xmlns='http://www.w3.org/2005/Atom'>
<title>src/lib/libc/stdlib, branch main</title>
<subtitle>FreeBSD source tree</subtitle>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/'/>
<entry>
<title>_exit.2: Cross-reference atexit(3)</title>
<updated>2026-03-31T17:13:02+00:00</updated>
<author>
<name>Artem Bunichev</name>
<email>tembun@bk.ru</email>
</author>
<published>2026-03-31T17:09:00+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=c082e5656417945bfa567114c60969844f3d7bdf'/>
<id>c082e5656417945bfa567114c60969844f3d7bdf</id>
<content type='text'>
atexit(3) is one of the cases when _exit(2) must be used instead of
exit(3).

MFC after:		3 days
Reviewed by:		mhorne, ziaee
Differential Revision:	https://reviews.freebsd.org/D54467
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
atexit(3) is one of the cases when _exit(2) must be used instead of
exit(3).

MFC after:		3 days
Reviewed by:		mhorne, ziaee
Differential Revision:	https://reviews.freebsd.org/D54467
</pre>
</div>
</content>
</entry>
<entry>
<title>realpath: Improve manual page</title>
<updated>2026-03-19T01:26:34+00:00</updated>
<author>
<name>Dag-Erling Smørgrav</name>
<email>des@FreeBSD.org</email>
</author>
<published>2026-03-19T01:26:21+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=1aecb32021ce46d812db36b9037cdc6f423575f9'/>
<id>1aecb32021ce46d812db36b9037cdc6f423575f9</id>
<content type='text'>
* Try to make the RETURN VALUES section flow better.

* Add basename(3), dirname(3), free(3) to the SEE ALSO section.

* Drop the CAVEATS section, which was obsolete the moment realpath(3)
  was added to the Single Unix Specification in 1994.

MFC after:      1 week
Sponsored by:   Klara, Inc.
Reviewed by:	kevans
Differential Revision:	https://reviews.freebsd.org/D55928
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* Try to make the RETURN VALUES section flow better.

* Add basename(3), dirname(3), free(3) to the SEE ALSO section.

* Drop the CAVEATS section, which was obsolete the moment realpath(3)
  was added to the Single Unix Specification in 1994.

MFC after:      1 week
Sponsored by:   Klara, Inc.
Reviewed by:	kevans
Differential Revision:	https://reviews.freebsd.org/D55928
</pre>
</div>
</content>
</entry>
<entry>
<title>realpath: Improve prev_len logic</title>
<updated>2026-03-19T01:26:34+00:00</updated>
<author>
<name>Dag-Erling Smørgrav</name>
<email>des@FreeBSD.org</email>
</author>
<published>2026-03-19T01:26:16+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=99d295e471bc362a7927047c89472e1ee2d0da6b'/>
<id>99d295e471bc362a7927047c89472e1ee2d0da6b</id>
<content type='text'>
* Save prev_len after having checked for and appended a trailing slash,
  not before.  This requires us to back up if we end up returning a
  partial result, but previously we would sometimes return a partial
  result with a trailing slash and sometimes without.

* Replace strlcat() with a faster strlcpy() since we know exactly how
  far into the buffer we are.

MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	kevans
Differential Revision:	https://reviews.freebsd.org/D55914
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* Save prev_len after having checked for and appended a trailing slash,
  not before.  This requires us to back up if we end up returning a
  partial result, but previously we would sometimes return a partial
  result with a trailing slash and sometimes without.

* Replace strlcat() with a faster strlcpy() since we know exactly how
  far into the buffer we are.

MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	kevans
Differential Revision:	https://reviews.freebsd.org/D55914
</pre>
</div>
</content>
</entry>
<entry>
<title>libc: Fix dtor order in __cxa_thread_atexit</title>
<updated>2026-03-14T04:30:25+00:00</updated>
<author>
<name>ShengYi Hung</name>
<email>aokblast@FreeBSD.org</email>
</author>
<published>2026-03-12T13:40:34+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=9d26b82826d9962d5085bc5d9df7f8a762c57602'/>
<id>9d26b82826d9962d5085bc5d9df7f8a762c57602</id>
<content type='text'>
The thread_local variable may creates another thread_local variable
inside its dtor. This new object is immediately be registered in
__cxa_thread_atexit() and need to be freed before processing another
variable.

This fixes the libcxx test thread_local_destruction_order.pass.cpp.

Reported by:    kib
Approved by:    lwhsu (mentor)
MFC after:      2 weeks
Sponsored by:   The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D55826
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The thread_local variable may creates another thread_local variable
inside its dtor. This new object is immediately be registered in
__cxa_thread_atexit() and need to be freed before processing another
variable.

This fixes the libcxx test thread_local_destruction_order.pass.cpp.

Reported by:    kib
Approved by:    lwhsu (mentor)
MFC after:      2 weeks
Sponsored by:   The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D55826
</pre>
</div>
</content>
</entry>
<entry>
<title>system(3): Unwrap execve()</title>
<updated>2026-03-04T15:22:42+00:00</updated>
<author>
<name>Dag-Erling Smørgrav</name>
<email>des@FreeBSD.org</email>
</author>
<published>2026-03-04T15:22:42+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=40e52e0edd038460a2a2aca017b3ac5a513fe37b'/>
<id>40e52e0edd038460a2a2aca017b3ac5a513fe37b</id>
<content type='text'>
There is no need to call execl(), which will allocate an array and copy
our arguments into it, when we can use a static array and call execve()
directly.

MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	kevans
Differential Revision:	https://reviews.freebsd.org/D55648
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
There is no need to call execl(), which will allocate an array and copy
our arguments into it, when we can use a static array and call execve()
directly.

MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	kevans
Differential Revision:	https://reviews.freebsd.org/D55648
</pre>
</div>
</content>
</entry>
<entry>
<title>system(3): Fix null case</title>
<updated>2026-02-25T21:12:42+00:00</updated>
<author>
<name>Dag-Erling Smørgrav</name>
<email>des@FreeBSD.org</email>
</author>
<published>2026-02-25T21:12:42+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=8ae3f44991948cc97b09adc248a9a46db71bf9e0'/>
<id>8ae3f44991948cc97b09adc248a9a46db71bf9e0</id>
<content type='text'>
Our manual page states that if given a null pointer, system() returns
non-zero if the shell is available and zero if it is not.  This is
consistent with the C standard's description of system(), but it is not
what we actually do.  What we actually do is always return non-zero, as
required by POSIX.

As the POSIX rationale explains, implementing the logic required by the
C standard does not violate POSIX, since a conforming system always has
a shell, therefore the logic will always return non-zero.

Since our libc is commonly used in non-conforming situations such as
chroots or thin jails, we should implement the full logic required by
the C standard.

MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	obiwac, bnovkov, kevans
Differential Revision:	https://reviews.freebsd.org/D55484
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Our manual page states that if given a null pointer, system() returns
non-zero if the shell is available and zero if it is not.  This is
consistent with the C standard's description of system(), but it is not
what we actually do.  What we actually do is always return non-zero, as
required by POSIX.

As the POSIX rationale explains, implementing the logic required by the
C standard does not violate POSIX, since a conforming system always has
a shell, therefore the logic will always return non-zero.

Since our libc is commonly used in non-conforming situations such as
chroots or thin jails, we should implement the full logic required by
the C standard.

MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	obiwac, bnovkov, kevans
Differential Revision:	https://reviews.freebsd.org/D55484
</pre>
</div>
</content>
</entry>
<entry>
<title>system(3): Clarify return values</title>
<updated>2026-02-25T21:12:36+00:00</updated>
<author>
<name>Dag-Erling Smørgrav</name>
<email>des@FreeBSD.org</email>
</author>
<published>2026-02-25T21:12:36+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=7305604b29d3db29c9bb5de6e7a25829fb541d1e'/>
<id>7305604b29d3db29c9bb5de6e7a25829fb541d1e</id>
<content type='text'>
Our manual page currently states that system() will return 127 if it
fails to execute the shell.  The actual return value is, to quote POSIX,
“as if the command language interpreter had terminated using exit(127)
or _exit(127)”.

MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	bnovkov, kevans
Differential Revision:	https://reviews.freebsd.org/D55483
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Our manual page currently states that system() will return 127 if it
fails to execute the shell.  The actual return value is, to quote POSIX,
“as if the command language interpreter had terminated using exit(127)
or _exit(127)”.

MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	bnovkov, kevans
Differential Revision:	https://reviews.freebsd.org/D55483
</pre>
</div>
</content>
</entry>
<entry>
<title>system(3): Improve signal handling</title>
<updated>2026-02-25T21:12:21+00:00</updated>
<author>
<name>Dag-Erling Smørgrav</name>
<email>des@FreeBSD.org</email>
</author>
<published>2026-02-25T21:12:21+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=6e589e6e8e64793adb437c561ec084dbb6ad1ced'/>
<id>6e589e6e8e64793adb437c561ec084dbb6ad1ced</id>
<content type='text'>
Ignore SIGINT and SIGQUIT and block SIGCHLD, as POSIX requires.

To deal with the concurrency problem described in POSIX, we keep track
of the count of concurrent invocations.  We ignore and block signals
only when the counter was zero before we incremented it, and restore
them only when the counter reaches zero after we decrement it.

Note that this does not address the issue of thread cancellation.

MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	bnovkov, sef, kevans
Differential Revision:	https://reviews.freebsd.org/D55471
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Ignore SIGINT and SIGQUIT and block SIGCHLD, as POSIX requires.

To deal with the concurrency problem described in POSIX, we keep track
of the count of concurrent invocations.  We ignore and block signals
only when the counter was zero before we incremented it, and restore
them only when the counter reaches zero after we decrement it.

Note that this does not address the issue of thread cancellation.

MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	bnovkov, sef, kevans
Differential Revision:	https://reviews.freebsd.org/D55471
</pre>
</div>
</content>
</entry>
<entry>
<title>libc: Roll {l,ll,imax}abs(3) manpages into just abs(3)</title>
<updated>2026-02-21T23:22:05+00:00</updated>
<author>
<name>Aymeric Wibo</name>
<email>obiwac@FreeBSD.org</email>
</author>
<published>2026-02-19T03:02:19+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=98ffaae49fea5c478230ef68086bcea89a6f654b'/>
<id>98ffaae49fea5c478230ef68086bcea89a6f654b</id>
<content type='text'>
No need to have 4 separate manpages for these functions. Use opportunity
to change parameter names in the source from j -&gt; i to reflect the name
used in POSIX. (The ISO C standard uses j but i is a better name
anyway.)

Reviewed by:	des, rpokala
Approved by:	rpokala
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D55361
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
No need to have 4 separate manpages for these functions. Use opportunity
to change parameter names in the source from j -&gt; i to reflect the name
used in POSIX. (The ISO C standard uses j but i is a better name
anyway.)

Reviewed by:	des, rpokala
Approved by:	rpokala
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D55361
</pre>
</div>
</content>
</entry>
<entry>
<title>libc: Roll {l,ll,imax}div(3) manpages into just div(3)</title>
<updated>2026-02-21T23:19:25+00:00</updated>
<author>
<name>Aymeric Wibo</name>
<email>obiwac@FreeBSD.org</email>
</author>
<published>2026-02-21T23:14:23+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=c242bf1b70796313dabb5594b5aacdf4c20377aa'/>
<id>c242bf1b70796313dabb5594b5aacdf4c20377aa</id>
<content type='text'>
No need to have 4 separate manpages for these functions.

Reviewed by:	ziaee, rpokala, des
Approved by:	rpokala, des
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D55360
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
No need to have 4 separate manpages for these functions.

Reviewed by:	ziaee, rpokala, des
Approved by:	rpokala, des
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D55360
</pre>
</div>
</content>
</entry>
</feed>
