<feed xmlns='http://www.w3.org/2005/Atom'>
<title>src/include/stdlib.h, branch release/14.2.0-p4</title>
<subtitle>FreeBSD source tree</subtitle>
<id>https://cgit-dev.freebsd.org/src/atom?h=release%2F14.2.0-p4</id>
<link rel='self' href='https://cgit-dev.freebsd.org/src/atom?h=release%2F14.2.0-p4'/>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/'/>
<updated>2023-08-16T17:54:23Z</updated>
<entry>
<title>Remove $FreeBSD$: one-line .h pattern</title>
<updated>2023-08-16T17:54:23Z</updated>
<author>
<name>Warner Losh</name>
<email>imp@FreeBSD.org</email>
</author>
<published>2023-08-16T17:54:23Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=42b388439bd3795e09258c57a74ce9eec3651c7b'/>
<id>urn:sha1:42b388439bd3795e09258c57a74ce9eec3651c7b</id>
<content type='text'>
Remove /^\s*\*+\s*\$FreeBSD\$.*$\n/
</content>
</entry>
<entry>
<title>Revert "libc: Implement bsort(3) a bitonic type of sorting algorithm."</title>
<updated>2023-04-20T17:16:14Z</updated>
<author>
<name>Hans Petter Selasky</name>
<email>hselasky@FreeBSD.org</email>
</author>
<published>2023-04-20T16:50:32Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=bb8e8e230d94c9522bd9ff95c13dc9f5b1592929'/>
<id>urn:sha1:bb8e8e230d94c9522bd9ff95c13dc9f5b1592929</id>
<content type='text'>
Some points for the future:
 - libc is not the right place for sorting algorithms.
   Probably libutil is better suited for this purpose or
   a dedicated libsort. Should move all sorting algorithms
   away from libc eventually.
 - CheriBSD uses capabilities for memory access, and could
   benefit from a standard memswap() function.
 - Do something about qsort() in FreeBSD's libc like:
   - Mark it deprecated on FreeBSD, as a first step,
     due to missing limits on CPU time.
   - Audit the use of qsort() in the FreeBSD base system
     and consider swapping to other existing sorting
     algorithms.

Discussed with:	brooks@

Differential Revision:	https://reviews.freebsd.org/D36493

This reverts commit a7469c9c0a504a5e6e9b89e148cd78df5e67ff7f.
This reverts commit 7d65a450cdcc7cc743f2ecd114ba3428a21c0033.
This reverts commit 8dcf3a82c54cb216df3213a013047907636a01da.
</content>
</entry>
<entry>
<title>libc: bsort_s() requires both __BSD_VISIBLE and __EXT1_VISIBLE</title>
<updated>2023-04-19T20:12:04Z</updated>
<author>
<name>Hans Petter Selasky</name>
<email>hselasky@FreeBSD.org</email>
</author>
<published>2023-04-19T19:37:29Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=a7469c9c0a504a5e6e9b89e148cd78df5e67ff7f'/>
<id>urn:sha1:a7469c9c0a504a5e6e9b89e148cd78df5e67ff7f</id>
<content type='text'>
Fixes build of Python:
/usr/include/stdlib.h:409:1: error: unknown type name 'errno_t'
errno_t  bsort_s(void *, rsize_t, rsize_t,

Reported by:	vishwin@
MFC after:	1 week
Sponsored by:	NVIDIA Networking
Differential Revision:	https://reviews.freebsd.org/D36493
</content>
</entry>
<entry>
<title>libc: Implement bsort(3) a bitonic type of sorting algorithm.</title>
<updated>2023-04-19T12:04:22Z</updated>
<author>
<name>Hans Petter Selasky</name>
<email>hselasky@FreeBSD.org</email>
</author>
<published>2022-09-08T10:16:43Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=8dcf3a82c54cb216df3213a013047907636a01da'/>
<id>urn:sha1:8dcf3a82c54cb216df3213a013047907636a01da</id>
<content type='text'>
The bsort(3) algorithm works by swapping objects, similarly to qsort(3),
and does not require any significant amount of additional memory.

The bsort(3) algorithm doesn't suffer from the processing time issues
known the plague the qsort(3) family of algorithms, and is bounded by
a complexity of O(log2(N) * log2(N) * N), where N is the number of
elements in the sorting array. The additional complexity compared to
mergesort(3) is a fair tradeoff in situations where no memory may
be allocated.

The bsort(3) APIs are identical to those of qsort(3), allowing for
easy drop-in and testing.

The design of the bsort(3) algorithm allows for future parallell CPU
execution when sorting arrays. The current version of the bsort(3)
algorithm is single threaded. This is possible because fixed areas
of the sorting data is compared at a time, and can easily be divided
among different CPU's to sort large arrays faster.

Reviewed by:	gbe@, delphij@, pauamma_gundo.com (manpages)
Sponsored by:	NVIDIA Networking
Differential Revision:	https://reviews.freebsd.org/D36493
</content>
</entry>
<entry>
<title>secure_getenv: Put under __BSD_VISIBLE</title>
<updated>2023-03-14T23:43:13Z</updated>
<author>
<name>Warner Losh</name>
<email>imp@FreeBSD.org</email>
</author>
<published>2023-03-14T23:42:18Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=a06761e3f4738de3a33696fd71cce571c489eec4'/>
<id>urn:sha1:a06761e3f4738de3a33696fd71cce571c489eec4</id>
<content type='text'>
Sponsored by:		Netflix
Reviewed by:		delphij
Differential Revision:	https://reviews.freebsd.org/D39076
</content>
</entry>
<entry>
<title>Add GNU glibc compatible secure_getenv</title>
<updated>2023-03-14T04:19:24Z</updated>
<author>
<name>lucy</name>
<email>seafork@disroot.org</email>
</author>
<published>2023-03-13T22:01:12Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=adeca21464d25bc61f98968a5c1e76ab3c808ae4'/>
<id>urn:sha1:adeca21464d25bc61f98968a5c1e76ab3c808ae4</id>
<content type='text'>
Add mostly glibc and msl compatible secure_getenv. Return NULL if
issetugid() indicates the process is tainted, otherwise getenv(x).  The
rational behind this is the fact that many Linux applications use this
function instead of getenv() as it's widely consider a, "best
practice".

Reviewed by: imp, mjg (feedback)
Pull Request: https://github.com/freebsd/freebsd-src/pull/686
Signed-off-by: Lucy Marsh &lt;seafork@disroot.org&gt;
</content>
</entry>
<entry>
<title>include: Fix typos</title>
<updated>2023-02-22T16:52:57Z</updated>
<author>
<name>Elyes Haouas</name>
<email>ehaouas@noos.fr</email>
</author>
<published>2023-02-22T08:33:35Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=ce7db385f50a29e73170c4e7cedfe4706bba34fc'/>
<id>urn:sha1:ce7db385f50a29e73170c4e7cedfe4706bba34fc</id>
<content type='text'>
Signed-off-by: Elyes Haouas &lt;ehaouas@noos.fr&gt;
</content>
</entry>
<entry>
<title>Revert "stdlib.h: Fix qsort_r compatibility with GCC 12."</title>
<updated>2023-01-27T00:28:03Z</updated>
<author>
<name>John Baldwin</name>
<email>jhb@FreeBSD.org</email>
</author>
<published>2023-01-27T00:28:03Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=e5dc40935f6e57c6d1034ae4dea021e677bbae18'/>
<id>urn:sha1:e5dc40935f6e57c6d1034ae4dea021e677bbae18</id>
<content type='text'>
This reverts commit 43703bc489ec504b947b869045c492ed38c1a69c.

Reviewed by:	jrtc27
Differential Revision:	https://reviews.freebsd.org/D38216
</content>
</entry>
<entry>
<title>stdlib.h: Fix qsort_r compatibility with GCC 12.</title>
<updated>2023-01-19T22:48:52Z</updated>
<author>
<name>John Baldwin</name>
<email>jhb@FreeBSD.org</email>
</author>
<published>2023-01-19T22:48:52Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=43703bc489ec504b947b869045c492ed38c1a69c'/>
<id>urn:sha1:43703bc489ec504b947b869045c492ed38c1a69c</id>
<content type='text'>
GCC 12 (unlike GCC 9) does not match a function argument passed to the
old qsort_r() API (as is used in the qsort_r_compat test) to a
function pointer type via __generic.  It treats the function type as a
distinct type from a function pointer.  As a workaround, add a second
definition of qsort_r for GCC 12 which uses the bare function type.

Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D37410
</content>
</entry>
<entry>
<title>Alter the prototype of qsort_r(3) to match POSIX, which adopted the</title>
<updated>2022-09-30T22:26:30Z</updated>
<author>
<name>Ed Schouten</name>
<email>ed@FreeBSD.org</email>
</author>
<published>2022-09-30T22:26:30Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=af3c78886fd8d4ca5eebdbe581a459a6f6d29d6a'/>
<id>urn:sha1:af3c78886fd8d4ca5eebdbe581a459a6f6d29d6a</id>
<content type='text'>
glibc-based interface.

Unfortunately, the glibc maintainers, despite knowing the existence
of the FreeBSD qsort_r(3) interface in 2004 and refused to add the
same interface to glibc based on grounds of the lack of standardization
and portability concerns, has decided it was a good idea to introduce
their own qsort_r(3) interface in 2007 as a GNU extension with a
slightly different and incompatible interface.

With the adoption of their interface as POSIX standard, let's switch
to the same prototype, there is no need to remain incompatible.

C++ and C applications written for the historical FreeBSD interface
get source level compatibility when building in C++ mode, or when
building with a C compiler with C11 generics support, provided that
the caller passes a fifth parameter of qsort_r() that exactly matches
the historical FreeBSD comparator function pointer type and does not
redefine the historical qsort_r(3) prototype in their source code.

Symbol versioning is used to keep old binaries working.

MFC:			never
Relnotes:		yes
Reviewed by:		cem, imp, hps, pauamma
Differential revision:	https://reviews.freebsd.org/D17083
</content>
</entry>
</feed>
