|
Revision tags: release/13.4.0-p5, release/13.5.0-p1, release/14.2.0-p3, release/13.5.0, release/14.2.0-p2, release/14.1.0-p8, release/13.4.0-p4, release/14.1.0-p7, release/14.2.0-p1, release/13.4.0-p3, release/14.2.0, release/13.4.0, release/14.1.0, release/13.3.0 |
|
| #
695639d2 |
| 15-Nov-2023 |
Brooks Davis <[email protected]> |
libc: Remove empty comments in Symbol.map
These were left over from $FreeBSD$ removal.
Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D42612
(cherry picked from commit 1ca6
libc: Remove empty comments in Symbol.map
These were left over from $FreeBSD$ removal.
Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D42612
(cherry picked from commit 1ca63a8219b88b752b064d19bd3428c61dbcf1f9)
show more ...
|
|
Revision tags: release/14.0.0 |
|
| #
42b38843 |
| 16-Aug-2023 |
Warner Losh <[email protected]> |
Remove $FreeBSD$: one-line .h pattern
Remove /^\s*\*+\s*\$FreeBSD\$.*$\n/
|
| #
bb8e8e23 |
| 20-Apr-2023 |
Hans Petter Selasky <[email protected]> |
Revert "libc: Implement bsort(3) a bitonic type of sorting algorithm."
Some points for the future: - libc is not the right place for sorting algorithms. Probably libutil is better suited for thi
Revert "libc: Implement bsort(3) a bitonic type of sorting algorithm."
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.
show more ...
|
|
Revision tags: release/13.2.0, release/12.4.0 |
|
| #
8dcf3a82 |
| 08-Sep-2022 |
Hans Petter Selasky <[email protected]> |
libc: Implement bsort(3) a bitonic type of sorting algorithm.
The bsort(3) algorithm works by swapping objects, similarly to qsort(3), and does not require any significant amount of additional memor
libc: Implement bsort(3) a bitonic type of sorting algorithm.
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
show more ...
|
| #
adeca214 |
| 13-Mar-2023 |
lucy <[email protected]> |
Add GNU glibc compatible secure_getenv
Add mostly glibc and msl compatible secure_getenv. Return NULL if issetugid() indicates the process is tainted, otherwise getenv(x). The rational behind this
Add GNU glibc compatible secure_getenv
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 <[email protected]>
show more ...
|
| #
939b24b0 |
| 06-Feb-2023 |
Val Packett <[email protected]> |
xlocale: garbage collect references to strtoq_l/strtouq_l
These were explicitly never implemented (see lib/libc/locale/DESIGN.xlocale), but were referenced in the manpage and the symbol map.
Fixes:
xlocale: garbage collect references to strtoq_l/strtouq_l
These were explicitly never implemented (see lib/libc/locale/DESIGN.xlocale), but were referenced in the manpage and the symbol map.
Fixes: 3c87aa1d3dc ("Implement xlocale APIs from Darwin") Reported by: ld.lld 16 being --no-undefined-version by default Reviewed by: theraven, emaste Sponsored by: https://www.patreon.com/valpackett Pull Request: https://github.com/freebsd/freebsd-src/pull/679 Differential Revision: https://reviews.freebsd.org/D38408
show more ...
|
| #
af3c7888 |
| 30-Sep-2022 |
Ed Schouten <[email protected]> |
Alter the prototype of qsort_r(3) to match POSIX, which adopted the glibc-based interface.
Unfortunately, the glibc maintainers, despite knowing the existence of the FreeBSD qsort_r(3) interface in
Alter the prototype of qsort_r(3) to match POSIX, which adopted the 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
show more ...
|
|
Revision tags: release/13.1.0, release/12.3.0 |
|
| #
597b0267 |
| 07-Nov-2021 |
Mariusz Zaborski <[email protected]> |
libc: add clearenv function
The clearenv(3) function allows us to clear all environment variable in one shot. This may be useful for security programs that want to control the environment or what va
libc: add clearenv function
The clearenv(3) function allows us to clear all environment variable in one shot. This may be useful for security programs that want to control the environment or what variables are passed to new spawned programs.
Reviewed by: scf, markj (secteam), 0mp (manpages) Differential Revision: https://reviews.freebsd.org/D28223
show more ...
|
|
Revision tags: release/13.0.0, release/12.2.0 |
|
| #
5011fb43 |
| 20-Oct-2020 |
Xin LI <[email protected]> |
Further refinements of ptsname_r(3) interface:
- Hide ptsname_r under __BSD_VISIBLE for now as the specification is not finalized at this time. - Keep Symbol.map sorted. - Avoid the interposin
Further refinements of ptsname_r(3) interface:
- Hide ptsname_r under __BSD_VISIBLE for now as the specification is not finalized at this time. - Keep Symbol.map sorted. - Avoid the interposing of ptsname_r(3) from an user application from breaking ptsname(3) by making the implementation a static method and call the static function from ptsname(3) instead.
Reported by: kib Reviewed by: kib, jilles MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D26845
show more ...
|
| #
3e7224df |
| 17-Oct-2020 |
Xin LI <[email protected]> |
Implement ptsname_r.
MFC after: 2 weeks PR: 250062 Reviewed by: jilles, 0mp, Ray <i maskray me> Differential Revision: https://reviews.freebsd.org/D26647
|
|
Revision tags: release/11.4.0 |
|
| #
672e1225 |
| 01-Feb-2020 |
Conrad Meyer <[email protected]> |
rand(3): Replace implementation with one backed by random(3) algorithm
rand(3)'s standard C API is extremely limiting, but we can do better than the historical 32-bit state Park-Miller LCG we've shi
rand(3): Replace implementation with one backed by random(3) algorithm
rand(3)'s standard C API is extremely limiting, but we can do better than the historical 32-bit state Park-Miller LCG we've shipped since 2001: r73156.
The justification provided at the time for not using random(3) was that rand_r(3) could not be made to use the same algorithm. That is still true. However, the irrelevance of rand_r(3) is increasingly obvious. Since that time, POSIX has marked the interface obsolescent. rand_r(3) never became part of the standard C library. If not for API compatibility reasons, I would just remove rand_r(3) entirely.
So, I do not believe it is a problem for rand_r(3) and rand(3) to diverge.
The 12 ABI is maintained with compatibility definitions, but this revision does subtly change the API of rand(3). The sequences of pseudorandom numbers produced in programs built against new versions of libc will differ from programs built against prior versions of libc.
Reviewed by: kevans, markm MFC after: no Relnotes: yes Differential Revision: https://reviews.freebsd.org/D23290
show more ...
|
| #
0d2fabfc |
| 20-Jan-2020 |
Edward Tomasz Napierala <[email protected]> |
Add qsort_s(3). Apart from the constraints, it also makes it easier to port software written for Linux variant of qsort_r(3).
Reviewed by: kib, arichardson MFC after: 2 weeks Relnotes: yes Sponsore
Add qsort_s(3). Apart from the constraints, it also makes it easier to port software written for Linux variant of qsort_r(3).
Reviewed by: kib, arichardson MFC after: 2 weeks Relnotes: yes Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D23174
show more ...
|
| #
c62ff280 |
| 14-Dec-2019 |
Conrad Meyer <[email protected]> |
Deprecate sranddev(3) API
It serves no useful purpose and wasn't as popular as its equally meritless cousin, srandomdev(3).
Setting aside the problems with rand(3) in general, the problem with this
Deprecate sranddev(3) API
It serves no useful purpose and wasn't as popular as its equally meritless cousin, srandomdev(3).
Setting aside the problems with rand(3) in general, the problem with this interface is that the seed isn't shared with the caller (other than by attacking the output of the generator, which is trivial, but not a hallmark of pleasant API design). The (arguable) utility of rand(3) or random(3) is as a semi-fast simulation generator which produces consistent results from a given seed. These are mutually at odd. Furthermore, sometimes people got the mistaken impression that a high quality random seed meant a weak generator like rand(3) or random(3) could be used for things like cryptographic key generation. This is absolutely not so.
The API was never part of a standard and was not widely used in tree. Existing in-tree uses have all been removed.
Possible replacement in out of tree codebases:
char buf[3]; time_t t;
time(t); strftime(buf, sizeof(buf), "%S", gmtime(&t)); srand(atoi(buf));
Relnotes: yes
show more ...
|
|
Revision tags: release/12.1.0, release/11.3.0 |
|
| #
760e3477 |
| 15-Apr-2019 |
Konstantin Belousov <[email protected]> |
Fix order of destructors between main binary and libraries.
Since inits for the main binary are run from rtld (for some time), the rtld_exit atexit(3) handler, which is passed from rtld to the progr
Fix order of destructors between main binary and libraries.
Since inits for the main binary are run from rtld (for some time), the rtld_exit atexit(3) handler, which is passed from rtld to the program entry and installed by csu, is installed after any atexit(3) handlers installed by main binary constructors. This means that rtld_exit() is fired before main binary handlers.
Typical C++ static constructors are executed from init (either binary or libs) but use atexit(3) to ensure that destructors are called in the right order, independent of the linking order. Also, C++ libraries finalizers call __cxa_finalize(3) to flush library' atexit(3) entries. Since atexit(3) entry is cleared after being run, this would be mostly innocent, except that, atexit(rtld_exit) done after main binary constructors, makes destructors from libraries executed before destructors for main.
Fix by reordering atexit(rtld_exit) before inits for main binary, same as it happened when inits were called by csu. Do it using new private libc symbol with pre-defined ABI.
Reported. tested, and reviewed by: kan Sponsored by: The FreeBSD Foundation MFC after: 1 week
show more ...
|
|
Revision tags: release/12.0.0, release/11.2.0, release/10.4.0, release/11.1.0 |
|
| #
9851b340 |
| 30-Mar-2017 |
Konstantin Belousov <[email protected]> |
Implement the memset_s(3) function as specified by the C11 ISO/IEC 9899:2011 Appendix K 3.7.4.1.
Other needed supporting types, defines and constraint_handler infrastructure is added as specified in
Implement the memset_s(3) function as specified by the C11 ISO/IEC 9899:2011 Appendix K 3.7.4.1.
Other needed supporting types, defines and constraint_handler infrastructure is added as specified in the C11 spec.
Submitted by: Tom Rix <[email protected]> Sponsored by: Juniper Networks Discussed with: ed MFC after: 3 weeks Differential revision: https://reviews.freebsd.org/D9903 Differential revision: https://reviews.freebsd.org/D10161
show more ...
|
| #
b7c7684a |
| 07-Jan-2017 |
Konstantin Belousov <[email protected]> |
Export __cxa_thread_atexit_impl as an alias for __cxa_thread_atexit.
libstdc++ before gcc r244057 expected that libc provided __cxa_thread_atexit_impl, and libstdc++ implemented __cxa_thread_atexit,
Export __cxa_thread_atexit_impl as an alias for __cxa_thread_atexit.
libstdc++ before gcc r244057 expected that libc provided __cxa_thread_atexit_impl, and libstdc++ implemented __cxa_thread_atexit, by forwarding the calls to _impl. Mentioned gcc revision checks for __cxa_thread_atexit in libc and does not provide the symbol from libstdc++ if found.
This change helps older gcc, in particular, all released versions which implement thread_local, by consolidating the implementation into libc. For that versions, if configured with the current libc, the __cxa_thread_atexit is exported from libstdc++ as a trivial wrapper around libc::__cxa_thread_atexit_impl.
The __cxa_thread_atexit implementation is put into separate source file to allow for static linking with older libstdc++.a.
gcc bugzilla: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78968 Reported by: Hannes Hauswedell <[email protected]> PR: 215709 Sponsored by: The FreeBSD Foundation MFC after: 2 weeks
show more ...
|
|
Revision tags: release/11.0.1, release/11.0.0 |
|
| #
b585cd3e |
| 06-Aug-2016 |
Konstantin Belousov <[email protected]> |
Add __cxa_thread_atexit(3) API implementation.
This is the backing feature to implement C++11 thread storage duration specified by the thread_local keyword. A destructor for given thread-local obje
Add __cxa_thread_atexit(3) API implementation.
This is the backing feature to implement C++11 thread storage duration specified by the thread_local keyword. A destructor for given thread-local object is registered to be executed at the thread termination time using __cxa_thread_atexit(). Libc calls the __cxa_thread_calls_dtors() during exit(3), before finalizers and atexit functions, and libthr calls the function at the thread termination time, after the stack unwinding and thread-specific key destruction.
There are several uncertainties in the API which lacks a formal specification. Among them: - is it allowed to register destructors during destructing; we allow, but limiting the nesting level. If too many iterations detected, a diagnostic is issued to stderr and thread forcibly terminates for now. - how to handle destructors which belong to an unloading dso; for now, we ignore destructor calls for such entries, and issue a diagnostic. Linux does prevent dso unload until all threads with destructors from the dso terminated. It is supposed that the diagnostics allow to detect real-world applications relying on the above details and possibly adjust our implementation. Right now the choices were to provide the slim API (but that rarely stands the practice test).
Tests are added to check generic functionality and to specify some of the above implementation choices.
Submitted by: Mahdi Mokhtari <mokhi64_gmail.com> Reviewed by: theraven Discussed with: dim (detection of -std=c++11 supoort for tests) Sponsored by: The FreeBSD Foundation (my involvement) MFC after: 2 weeks Differential revisions: https://reviews.freebsd.org/D7224, https://reviews.freebsd.org/D7427
show more ...
|
|
Revision tags: release/10.3.0, release/10.2.0 |
|
| #
450dfafb |
| 01-May-2015 |
Baptiste Daroussin <[email protected]> |
Import reallocarray(3) from OpenBSD
Add a manpage for it, assign the copyright to the OpenBSD project on it since it is mostly copy/paste from OpenBSD manpage. style(9) fixes
Differential Revision:
Import reallocarray(3) from OpenBSD
Add a manpage for it, assign the copyright to the OpenBSD project on it since it is mostly copy/paste from OpenBSD manpage. style(9) fixes
Differential Revision: https://reviews.freebsd.org/D2420 Reviewed by: kib
show more ...
|
| #
8495e8b1 |
| 03-Jan-2015 |
Konstantin Belousov <[email protected]> |
Fix known issues which blow up the process after dlopen("libthr.so") (or loading a dso linked to libthr.so into process which was not linked against threading library).
- Remove libthr interposers o
Fix known issues which blow up the process after dlopen("libthr.so") (or loading a dso linked to libthr.so into process which was not linked against threading library).
- Remove libthr interposers of the libc functions, including __error(). Instead, functions calls are indirected through the interposing table, similar to how pthread stubs in libc are already done. Libc by default points either to syscall trampolines or to existing libc implementations. On libthr load, libthr rewrites the pointers to the cancellable implementations already in libthr. The interposition table is separate from pthreads stubs indirection table to not pull pthreads stubs into static binaries.
- Postpone the malloc(3) internal mutexes initialization until libthr is loaded. This avoids recursion between calloc(3) and static pthread_mutex_t initialization.
- Reinstall signal handlers with wrapper on libthr load. The _rtld_is_dlopened(3) is used to avoid useless calls to sigaction(2) when libthr is statically referenced from the main binary.
In the process, fix openat(2), swapcontext(2) and setcontext(2) interposing. The libc symbols were exported at different versions than libthr interposers. Export both libc and libthr versions from libc now, with default set to the higher version from libthr.
Remove unused and disconnected swapcontext(3) userspace implementation from libc/gen.
No objections from: deischen Tested by: pho, antoine (exp-run) (previous versions) Sponsored by: The FreeBSD Foundation MFC after: 1 week
show more ...
|
|
Revision tags: release/10.1.0 |
|
| #
f4189cd6 |
| 01-Sep-2014 |
Pedro F. Giffuni <[email protected]> |
Add bsearch_b to the libc map and the stdlib header.
bsearch_b is the Apple blocks enabled version of bsearch(3). This was added to libc in Revision 264042 but the commit missed the declaration requ
Add bsearch_b to the libc map and the stdlib header.
bsearch_b is the Apple blocks enabled version of bsearch(3). This was added to libc in Revision 264042 but the commit missed the declaration required to make use of it.
While here move some other block-related functions to the BSD_VISIBLE block as these are non-standard.
Phabric: D638 Reviewed by: theraven, wollman
show more ...
|
| #
9823a90c |
| 21-Jul-2014 |
Pedro F. Giffuni <[email protected]> |
Add re-entrant versions of the hash functions based on the GNU api.
While testing this I found a conformance issue in hdestroy() that will be fixed in a subsequent commit.
Obtained from: NetBSD (hc
Add re-entrant versions of the hash functions based on the GNU api.
While testing this I found a conformance issue in hdestroy() that will be fixed in a subsequent commit.
Obtained from: NetBSD (hcreate.c, CVS Rev. 1.7)
show more ...
|
|
Revision tags: release/9.3.0 |
|
| #
4d1c5e03 |
| 03-Apr-2014 |
David Chisnall <[email protected]> |
Move _b functions into the 11.x symbol version namespace.
|
| #
46cdc140 |
| 02-Apr-2014 |
David Chisnall <[email protected]> |
Add support for some block functions that come from OS X. These are intended to build with any C compiler.
Reviewed by: pfg MFC after: 3 weeks
|
|
Revision tags: release/10.0.0, release/9.2.0, release/8.4.0, release/9.1.0 |
|
| #
a4bd5210 |
| 17-Apr-2012 |
Jason Evans <[email protected]> |
Import jemalloc 9ef7f5dc34ff02f50d401e41c8d9a4a928e7c2aa (dev branch, prior to 3.0.0 release) as contrib/jemalloc, and integrate it into libc. The code being imported by this commit diverged from lib
Import jemalloc 9ef7f5dc34ff02f50d401e41c8d9a4a928e7c2aa (dev branch, prior to 3.0.0 release) as contrib/jemalloc, and integrate it into libc. The code being imported by this commit diverged from lib/libc/stdlib/malloc.c in March 2010, which means that a portion of the jemalloc 1.0.0 ChangeLog entries are relevant, as are the entries for all subsequent releases.
show more ...
|
|
Revision tags: release/8.3.0_cvs, release/8.3.0 |
|
| #
9e16bab4 |
| 09-Jan-2012 |
Ed Schouten <[email protected]> |
Add aligned_alloc(3).
The C11 folks reinvented the wheel by introducing an aligned version of malloc(3) called aligned_alloc(3), instead of posix_memalign(3). Instead of returning the allocation by
Add aligned_alloc(3).
The C11 folks reinvented the wheel by introducing an aligned version of malloc(3) called aligned_alloc(3), instead of posix_memalign(3). Instead of returning the allocation by reference, it returns the address, just like malloc(3).
Reviewed by: jasone@
show more ...
|