aboutsummaryrefslogtreecommitdiff
path: root/lib/libc/gen
Commit message (Collapse)AuthorAgeFilesLines
* libc: Update copyright text to match current templates.Peter Wemm12 days3-21/+35
|
* spdx: The BSD-2-Clause-NetBSD identifier is obsolete, drop -NetBSDWarner Losh2023-05-122-2/+2
| | | | | | | | | The SPDX folks have obsoleted the BSD-2-Clause-NetBSD identifier. Catch up to that fact and revert to their recommended match of BSD-2-Clause. Discussed with: pfg MFC After: 3 days Sponsored by: Netflix
* spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSDWarner Losh2023-05-1241-41/+41
| | | | | | | | | The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch up to that fact and revert to their recommended match of BSD-2-Clause. Discussed with: pfg MFC After: 3 days Sponsored by: Netflix
* Change kqueue1() to be compatible with NetBSDKonstantin Belousov2023-04-053-0/+54
| | | | | | | | | | | by making it accept some open(2) flags. More precisely, only O_CLOEXEC is supported, the flag is translated into the KQUEUE_CLOEXEC flag for kqueuex(2), and O_NONBLOCK is silently ignored. Reported and tested by: vishwin Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D39377
* libc: Use secure_getenv(3) where appropriateMark Johnston2023-03-273-10/+4
| | | | | | | No functional change intended. Reviewed by: mjg, imp, kib Differential Revision: https://reviews.freebsd.org/D39278
* vfs: retire KERN_VNODEMateusz Guzik2023-03-171-10/+1
| | | | | | | | | | | | | | | | | | | | It got disabled in 2003: commit acb18acfec97aa7fe26ff48f80a5c3f89c9b542d Author: Poul-Henning Kamp <phk@FreeBSD.org> Date: Sun Feb 23 18:09:05 2003 +0000 Bracket the kern.vnode sysctl in #ifdef notyet because it results in massive locking issues on diskless systems. It is also not clear that this sysctl is non-dangerous in its requirements for locked down memory on large RAM systems. There does not seem to be practical use for it and the disabled routine does not work anyway. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D39127
* libc: move declaration of 'char **environ' to common private headerKonstantin Belousov2023-03-115-9/+0
| | | | | | | | | Suggested by: imp Reviewed by: markj Tested by: markj (aarch64) Sponsored by: The FreeBSD Foundation MFC after: 3 weeks Differential revision: https://reviews.freebsd.org/D37220
* libc: Remove prototype and documentation for tzsetwall().Dag-Erling Smørgrav2023-03-072-20/+3
| | | | | | PR: 269445 Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D38481
* man 3 daemon: remove double negationIhor Antonov2023-02-271-6/+6
| | | | | | | | Rephrase double negated sentences to improve readability OpenBSD has done the same in the past to their man 3 daemon Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/671
* libc: handle zero alignment in memalign()Paul Floyd2023-02-241-1/+8
| | | | | | | | | | | For compatibility with glibc. The previous code would trigger a division by zero in roundup() and terminate. Instead, just pass through to malloc() for align == 0. PR: 269688 Reviewed by: imp, mjg MFC after: 1 week Pull Request: https://github.com/freebsd/freebsd-src/pull/655
* cpuset: Add compat shim to the sched_affinity functionsDmitry Chagin2023-02-152-2/+27
| | | | | | | | | | | To allow to run a newer world on a pre-1400079 kernel a compat shims to the sched_affinity functions has beed added. Reported by: antoine Tested by: antoine Reviewed by: kib Differential revision: https://reviews.freebsd.org/D38555 MFC after: 3 days
* prof: Remove sysctl docs for sysctls that are now gone.Warner Losh2023-02-131-36/+0
| | | | | | | GRPOF based kernel profiling was removed in aa3ea612be36. However, the docs for the sysctls were not. Remove them belatedly. Sponsored by: Netflix
* libc: popen: slightly simplify cloexec logicKyle Evans2023-02-131-1/+1
| | | | | | | | No need to check the mode again here; we know that `iop` wraps the correct fd. Reviewed by: bapt Differential Revision: https://reviews.freebsd.org/D37987
* tzcode: Resurrect tzsetwall(3) with a deprecation warning.Dag-Erling Smørgrav2023-02-091-5/+9
| | | | | | | | | | This function has been around since 4.4BSD but was dropped upstream in 2020. This went unnoticed when tzcode was updated. Bring it back, but prepare for removing it before 14.0 is released. PR: 269445 MFC after: 3 days Reported by: val@packett.cool Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D38445
* cpuset: Fix sched_[g|s]etaffinity() for better compatibility with Linux.Dmitry Chagin2023-01-292-2/+2
| | | | | | | | | | | | | | | | | | | | Under Linux to sched_[g|s]etaffinity() functions the value returned from a call to gettid(2) (thread id) can be passed in the argument pid. Specifying pid as 0 will set the attribute for the calling thread, and passing the value returned from a call to getpid(2) (process id) will set the attribute for the main thread of the thread group. Native cpuset(2) family of system calls has "which" argument to determine how the value of id argument is interpreted, i.e., CPU_WHICH_TID is used to pass a thread id and CPU_WHICH_PID - to pass a process id. For now native sched_[g|s]etaffinity() implementation is wrong as uses "which" CPU_WHICH_PID to pass both (process and thread id) to the kernel. To fix this adding a new "which" CPU_WHICH_TIDPID intended to handle both id's. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D38209 MFC after: 1 week
* devname(3): apply S_ISBLK() to type, not dev_tAlexander Naumochkin2023-01-281-1/+1
| | | | | | PR: 269190 Reviewed by: kib MFC after: 1 week
* tzcode: Move configuration into separate header.Dag-Erling Smørgrav2023-01-111-0/+2
| | | | | MFC after: 1 week Sponsored by: Klara, Inc.
* copyright: chase my name and email changeVal Packett2023-01-061-1/+1
| | | | | Reviewed by: imp, emaste Differential Revision: https://reviews.freebsd.org/D37945
* syslog: fix PID of forking processEugene Grosbein2023-01-031-1/+1
| | | | | | | | | | Do not cache PID for a process that does not fabricate it, calls openlog() before forking and does not call exec() thereafter. PR: 268666 Fixes: e9ae9fa93745669b7dd0341d333257ad6cfe8e37 Tested by: kp MFC after: 3 days
* syslog(3): expand a commentary adding a reference to RFC 3164.Eugene Grosbein2023-01-011-1/+4
|
* Revert "uname: switch machine to HW_MACHINE_ARCH"Piotr Kubaj2022-12-121-2/+2
| | | | | | | | | Reverting because of issue in Makefile.inc1 during native builds: make[1]: “.../freebsd/Makefile.inc1" line 163: Unknown target aarch64:aarch64. Since I only tested this patch with make universe on amd64, this issue wasn't caught. This reverts commit 83bf6ab568293e325f437342cdb87a626353e27c.
* uname: switch machine to HW_MACHINE_ARCHPiotr Kubaj2022-12-111-2/+2
| | | | | | | | On powerpc64, powerpc64le and riscv64 some software wrongly assumes that it runs on powerpc or riscv (32-bit). Differential revision: https://reviews.freebsd.org/D35962 Approved by: alfredo, imp
* libc: remove unneeded sys/types.h include from several synopsesGuilherme Janczak2022-11-298-16/+8
| | | | | | | PR: 268028 Reviewed by: kib Discussed with: imp MFC after: 1 week
* times: Use modern function definitionsWarner Losh2022-10-251-2/+1
| | | | | | | Use the modern ANSI function defition syntax rather than the old K&R syntax for times. Sponsored by: Netflix
* libc: Make elf_aux_info() return an error if AT_USRSTACK* is undefinedMark Johnston2022-10-181-4/+10
| | | | | | | | | | | | | Otherwise we do not fall back to sysctls if the auxv entries are not defined by the kernel. Arguably this is not a bug since we do not support newer libc running on an older kernel, but we can be a bit more gentle for the benefit of Valgrind or any other software which synthesizes the auxv for virtualization purposes. Reported by: Paul Floyd <paulf2718@gmail.com> MFC after: 1 week Reviewed by: brooks, kib Differential Revision: https://reviews.freebsd.org/D37036
* getpagesize(3): cross-reference getpagesizes(3)Mitchell Horne2022-10-171-1/+2
| | | | MFC after: 3 days
* Alter the prototype of qsort_r(3) to match POSIX, which adopted theEd Schouten2022-09-302-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* scandir(3): Rename alphasort_thunk to scandir_thunk_cmp toXin LI2022-09-262-6/+6
| | | | | | | | | reflect that it is not alphasort-specific. Reported by: emaste Reviewed by: emaste MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D36708
* libc, libthr: use AT_USRSTACK{BASE,LIM} instead of sysctl("kern.usrstack") ↵Konstantin Belousov2022-09-161-11/+16
| | | | | | | | | | and get_rlimit(RLIMIT_STACK) Reviewed by: brooks, imp (previous version) Discussed with: markj Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D36540
* libthr: use nitems() for mib lengthKonstantin Belousov2022-09-161-2/+2
| | | | | | | | | Suggested by: imp Reviewed by: brooks, imp (previous version) Discussed with: markj Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D36540
* auxv.3: Document AT_USRSTACKBASE and AT_USRSTACKLIMKonstantin Belousov2022-09-161-1/+5
| | | | | | | | Reviewed by: brooks, imp (previous version) Discussed with: markj Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D36540
* _elf_aux_info(3): add support for AT_USRSTACK{BASE,LIM}Konstantin Belousov2022-09-161-0/+23
| | | | | | | | Reviewed by: brooks, imp (previous version) Discussed with: markj Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D36540
* More precise language: what is called data pointer, C calls object pointer.Jens Schweikhardt2022-09-161-5/+3
| | | | Also delete reference to non-existing lint(1).
* libc: Add strverscmp(3) and versionsort(3)Aymeric Wibo2022-08-254-3/+30
| | | | | | | | | | | | | | | Add a strverscmp(3) function to libc, a GNU extension I implemented by reading its glibc manual page. It orders strings following a much more natural ordering (e.g. "ent1 < ent2 < ent10" as opposed to "ent1 < ent10 < ent2" with strcmp(3)'s lexicographic ordering). Also add versionsort(3) for use as scandir(3)'s compar argument. Update manual page for scandir(3) and add one for strverscmp(3). Reviewed by: pstef, gbe, kib MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D35807
* Document scandirat(3)Konstantin Belousov2022-08-242-1/+49
| | | | | | | Reviewed by: emaste, gbe (man pages), imp, kevans, markj, Aymeric Wibo <obiwac@gmail.com> Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D36301
* libc: add scandirat(3)Konstantin Belousov2022-08-242-0/+22
| | | | | | | Reviewed by: emaste, imp, kevans, markj, Aymeric Wibo <obiwac@gmail.com> Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D36301
* libc: split scandir() into scandir_dirp() and proper scandir()Konstantin Belousov2022-08-241-8/+28
| | | | | | | | | | The new helper scandir_dirp() takes DIR *, i.e. a pre-opened directory, instead of the directory name. Reviewed by: emaste, imp, kevans, markj, Aymeric Wibo <obiwac@gmail.com> Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D36301
* Link scandir_b(3) to scandir(3)Konstantin Belousov2022-08-242-1/+3
| | | | | | | Reviewed by: emaste, gbe (man pages), imp, kevans, markj, Aymeric Wibo <obiwac@gmail.com> Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D36301
* scandir.3: Use .Fo instead of .Fn for long argsKonstantin Belousov2022-08-241-2/+12
| | | | | | | Reviewed by: emaste, gbe (man pages), imp, kevans, markj, Aymeric Wibo <obiwac@gmail.com> Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D36301
* arc4random(3): Reduce diff with OpenBSD.Xin LI2022-08-101-2/+8
| | | | | | | | | | | | The main change was v1.57 by djm@: Randomise the rekey interval a little. Previously, the chacha20 instance would be rekeyed every 1.6MB. This makes it happen at a random point somewhere in the 1-2MB range. Reviewed by: csprng (markm, cem) MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D36088
* syslog(3): unbreak log generation using fabricated PIDEugene Grosbein2022-08-081-3/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | Recover application ability to supply fabricated PID embedded into ident that was lost when libc switched to generation of RFC 5424 log messages, for example: logger -t "ident[$$]" -p user.notice "test" It is essential for long running scripts. Also, this change unbreaks matching resulted entries by ident in syslog.conf: !ident *.* /var/log/ident.log Without the fix, the log (and matching) was broken: Aug 1 07:36:58 hostname ident[123][86483]: test Now it works as expected and worked before breakage: Aug 1 07:39:40 hostname ident[123]: test Differential: https://reviews.freebsd.org/D36005 MFC after: 2 weeks
* libc: drop "All rights reserved" from Foundation copyrightsEd Maste2022-08-042-2/+2
| | | | | | | | | This has already been done for most files that have the Foundation as the only listed copyright holder. Do it now for files that list multiple copyright holders, but have the Foundation copyright in its own section. Sponsored by: The FreeBSD Foundation
* Remove "All Rights Reserved" from FreeBSD Foundation libc copyrightsEd Maste2022-07-215-5/+0
| | | | | | | As per the updated FreeBSD copyright template. These were unambiguous cases where the Foundation was the only listed copyright holder. Sponsored by: The FreeBSD Foundation
* libc/syslog: deprecate use of "/var/run/logpriv"Gleb Smirnoff2022-06-241-61/+14
| | | | | | | | | | | | | This additional socket was created in 2e89951b6f20 and 240d5a9b1ce76 to try workaround problems with classic PF_UNIX/SOCK_DGRAM sockets. With recent changes in kernel this trick is no longer needed, so the trick can be reverted. In syslogd(8) we would still create the socket for the next several major releases for compatibility. Differential revision: https://reviews.freebsd.org/D35305
* libc/syslog: fully deprecate and don't try to open "/dev/log"Gleb Smirnoff2022-06-241-12/+0
| | | | | | | | | The "/dev/log" socket existed in pre-FreeBSD times. Later it was substituted to a compatibility symlink. The symlink creation was deprecated in FreeBSD 10.2 and 9-STABLE. Reviewed by: markj Differential revision: https://reviews.freebsd.org/D35304
* nlist(3): Fix a common typo in a source code commentGordon Bergling2022-06-051-1/+1
| | | | | | - s/independant/independent/ MFC after: 3 days
* getpagesize(3): add .Xr to sysconf(3)Ed Maste2022-06-011-2/+10
| | | | | | | | | POSIX deprecated getpagesize(3). The portable way to obtain the page size is `sysconf(_SC_PAGESIZE)`. Reviewed by: cperciva (earlier), imp Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D35352
* Fixed the value returned by sched_getaffinity().Dmitry Chagin2022-05-121-4/+0
| | | | | | | | On success gnu libc sched_getaffinity() should return 0, unlike underlying Linux syscall which returns the size of CPU mask copied to user. PR: 263939 MFC after: 2 weeks
* Use Linux semantics for the thread affinity syscalls.Dmitry Chagin2022-05-112-25/+31
| | | | | | | | | | | | | | | | | | | Linux has more tolerant checks of the user supplied cpuset_t's. Minimum cpuset_t size that the Linux kernel permits in case of getaffinity() is the maximum CPU id, present in the system / NBBY, the maximum size is not limited. For setaffinity(), Linux does not limit the size of the user-provided cpuset_t, internally using only the meaningful part of the set, where the upper bound is the maximum CPU id, present in the system, no larger than the size of the kernel cpuset_t. Unlike FreeBSD, Linux ignores high bits if set in the setaffinity(), so clear it in the sched_setaffinity() and Linuxulator itself. Reviewed by: Pau Amma (man pages) In collaboration with: jhb Differential revision: https://reviews.freebsd.org/D34849 MFC after: 2 weeks
* libc: Add HISTORY sections to the manual pagesGordon Bergling2022-05-054-8/+36
| | | | | | | | | | There are some sections which could be improved and work to do so is on going. The work will be covered via 'X-MFC-WITH' commits. Obtained from: OpenBSD MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D34759