aboutsummaryrefslogtreecommitdiffstats
path: root/lib/libc
Commit message (Collapse)AuthorAgeFilesLines
* libc: Fix most issues reported by mandocGordon Bergling2020-12-1920-65/+61
| | | | | | | | | | | | | | - varios "new sentence, new line" warnings - varios "sections out of conventional order" warnings - varios "unusual Xr order" warnings - varios "missing section argument" warnings - varios "no blank before trailing delimiter" warnings - varios "normalizing date format" warnings MFC after: 1 month Notes: svn path=/head/; revision=368817
* strerror.3: Fix whitespace issue introduced in r368714Jessica Clarke2020-12-181-1/+1
| | | | | | | MFC with: 368714 Notes: svn path=/head/; revision=368770
* strerror.3: Add an example for perror()Mateusz Piotrowski2020-12-171-1/+26
| | | | | | | | | | | This is a nice and quick reference. Reviewed by: jilles, yuripv MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D27623 Notes: svn path=/head/; revision=368714
* nl_langinfo(3): document recognized item namesYuri Pankov2020-12-171-8/+94
| | | | | | | | | | | While here, remove .Tn macro usage (prompted by mandoc lint). PR: 251468 Reviewed by: bapt Differential Revision: https://reviews.freebsd.org/D27606 Notes: svn path=/head/; revision=368711
* Implement strerror_l().Konstantin Belousov2020-12-166-22/+95
| | | | | | | | | | | | | | Only for the arches that provide user-mode TLS. PR: 251651 Requested by: yuri Discussed with: emaste, jilles, tijl Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D27495 MFC after: 2 weeks Notes: svn path=/head/; revision=368692
* strdup.3: Function appeared in 4.3BSD-Reno, not 4.4BSDJessica Clarke2020-12-141-1/+1
| | | | | | | | | | | | | Linux claims 4.3BSD, we claim 4.4BSD and OpenBSD claims 4.3BSD-Reno. It turns out that OpenBSD got it right: the function was added in late 1988 a few months after 4.3BSD-Tahoe, well in advance of 4.3BSD-Reno. Reviewed by: bcr Approved by: bcr Differential Revision: https://reviews.freebsd.org/D27392 Notes: svn path=/head/; revision=368625
* timespec_get(3): sort SEE ALSO correctlyEnji Cooper2020-12-111-1/+1
| | | | | | | | | | | clock_gettime(2) should be mentioned before gettimeofday(2). Reported by: make manlint MFC after: 1 week Sponsored by: DellEMC Isilon Notes: svn path=/head/; revision=368547
* cpuset{,_getaffinity,_getdomain}.2: fix SEE ALSOEnji Cooper2020-12-113-7/+7
| | | | | | | | | | | | Sort by manpage section, then sort entries alphabetically. This makes the manpages `make manlint` clean. MFC after: 1 week Sponsored by: DellEMC Isilon Notes: svn path=/head/; revision=368546
* aio_suspend.2: properly canonicalize .DdEnji Cooper2020-12-111-1/+1
| | | | | | | | | | | | Months should be fully spelled as their local-specific equivalents: in this case `Oct` should have been spelled like `October`. Reported by: make manlint MFC after: 1 week Sponsored by: DellEMC Isilon Notes: svn path=/head/; revision=368537
* cap_enter(2): fix CAVEATS sectionEnji Cooper2020-12-111-13/+13
| | | | | | | | | | | | | | | | The CAVEATS section was misspelled as "CAVEAT" before this change. Fix the spelling to identify issues related to the section. Furthermore, given that the section order was incorrect, move the CAVEATS section down to the bottom of the manpage, per the conventional section order. MFC after: 1 week Reported by: make manlint Sponsored by: DellEMC Isilon Notes: svn path=/head/; revision=368536
* posix_spawn(3): fix section that references `vfork`Enji Cooper2020-12-111-1/+3
| | | | | | | | | | | | | `vfork(2)` should be referenced in paragraphs as `.Fn vfork`, not `vfork()`. This change switches the reference to use `.Fn`, which in turn makes the manpage `make manlint` clean. MFC after: 1 week Reported by: make manlint Sponsored by: DellEMC Isilon Notes: svn path=/head/; revision=368534
* getentropy(3): sort SEE ALSO sectionsEnji Cooper2020-12-111-1/+1
| | | | | | | | | | | | Sorting order should be done by manpage section (2 vs 3), then alphabetically. This change fixes the order to sort by the manpage section, first. Reported by: make manlint MFC after: 1 week Sponsored by: DellEMC Isilon Notes: svn path=/head/; revision=368533
* arc4random(3): fix .Xr issuesEnji Cooper2020-12-111-2/+2
| | | | | | | | | | | | | - pthreads(3) should actually be pthread(3). - getentropy(2) should actually be getentropy(3). This makes the manpage `make manlint` clean. MFC after: 1 week Sponsored by: DellEMC Isilon Notes: svn path=/head/; revision=368532
* _umtx_op(2): document recent addition of 32bit compat flagsKyle Evans2020-12-091-1/+74
| | | | | | | | | This was part of D27325. Reviewed by: kib Notes: svn path=/head/; revision=368479
* extattr_get_file(20: bump .DdEnji Cooper2020-12-081-1/+1
| | | | | | | | | | | | | This is being done for the formatting and context changes. While the net content hasn't been changed, the content/context changes were sufficient to warrant the date bump. MFC after: 1 week MFC with: r368431, r368433, r368434, r368435 Sponsored by: DellEMC Isilon Notes: svn path=/head/; revision=368436
* extattr_get_file(2): clarify RETURN VALUESEnji Cooper2020-12-081-4/+15
| | | | | | | | | | | | | | | | | | | While some of the syscalls' behavior were documented and implied in the RETURN VALUES section by earlier, e.g., the DESCRIPTION sections, as having behavior of the other calls (`*_fd` vs `*_file` vs `*_link`), there was a lot of implied return value behavior in the section prior to this change. Explicitly document the syscall behavior per the current implementation in sys/kern/vfs_extattr.c so others can better develop based on its explicit documented behavior instead of having to digest the context of the manpage to understand the appropriate behavior. MFC after: 1 week MFC with: r368431, r368433, r368434 Sponsored by: DellEMC Isilon Notes: svn path=/head/; revision=368435
* extattr_get_file(2): fix more formattingEnji Cooper2020-12-081-3/+3
| | | | | | | | | | | - Remove an unnecessary trailing comma separating a two-item clause. - Sort more function calls alphabetically (in the same vein as r368433). MFC after: 1 week Sponsored by: DellEMC Isilon Notes: svn path=/head/; revision=368434
* extattr_get_file(2): sort syscalls alphabeticallyEnji Cooper2020-12-081-22/+22
| | | | | | | | | | | | | | | Although some sections of the manpage sort the syscalls alphabetically, many core areas of the manpage do not. Sort the syscalls so it is easier to pick out functional changes and to improve manpage readability. This formatting change is also being done to make future functional changes easier to spot. MFC after: 1 week Sponsored by: DellEMC Isilon Notes: svn path=/head/; revision=368433
* lio_listio(2): fix manlint errorEnji Cooper2020-12-081-1/+1
| | | | | | | | | | | The date with .Dd prior to this change isn't canonically spelled out: it should have been "December", not "Dec". MFC after: 1 week Sponsored by: DellEMC Isilon Notes: svn path=/head/; revision=368432
* extattr_get_fd(2): fix manlint errorsEnji Cooper2020-12-081-4/+4
| | | | | | | | | | | | | - The CAVEATS section was misspelled as "CAVEAT". - The CAVEATS section should come before the "BUGS" section and after other existing sections by convention. MFC after: 1 week Reported by: make manlint Sponsored by: DellEMC Isilon Notes: svn path=/head/; revision=368431
* libc: regex: retire internal EMPTBR ("Empty branch present")Kyle Evans2020-12-052-7/+0
| | | | | | | | | It was realized just a little too late that this was a hack that belonged in individual regex(3)-using applications. It was surrounded in NOTYET and not implemented in the engine, so remove it. Notes: svn path=/head/; revision=368359
* libregex: implement \b and \B (word boundary, not word boundary)Kyle Evans2020-12-053-0/+55
| | | | | | | | | | This is the last of the needed GNU expressions before we can unleash bsdgrep by default. \b is effectively an agnostic equivalent of \< and \>, while \B will match every space that isn't making a transition from nonchar -> char or char -> nonchar. Notes: svn path=/head/; revision=368358
* libregex: implement \` and \' (begin-of-subj, end-of-subj)Kyle Evans2020-12-053-8/+65
| | | | | | | | | | These are GNU extensions, generally equivalent to ^ and $ except that the new syntax will not match beginning of line after the first in a multi-line expression or the end of line before absolute last in a multi-line expression. Notes: svn path=/head/; revision=368357
* libc: regex: factor out ISBOW/ISEOW macrosKyle Evans2020-12-051-8/+13
| | | | | | | | | These will be reused for \b (word boundary, which matches both sides). No functional change. Notes: svn path=/head/; revision=368356
* Add CFI start/end proc directives to arm64, i386, and ppcConrad Meyer2020-12-053-4/+9
| | | | | | | | | | | | | | Follow-up to r353959 and r368070: do the same for other architectures. arm32 already seems to use its own .fnstart/.fnend directives, which appear to be ARM-specific variants of the same thing. Likewise, MIPS uses .frame directives. Reviewed by: arichardson Differential Revision: https://reviews.freebsd.org/D27387 Notes: svn path=/head/; revision=368354
* Remove trailing whitespace.Cy Schubert2020-12-031-4/+4
| | | | | | | MFC after: 1 week Notes: svn path=/head/; revision=368294
* libc: Add pthread_attr_get_np(3) stub, reporting ESRCH.Konstantin Belousov2020-11-283-0/+11
| | | | | | | | | | | | | | | This seems to be required by recent clang asan. I do not see other way than put the symbol under FBSD_1.0 version. PR: 251112 Reported by: Andrew Stitcher <astitcher@apache.org> Reviewed by: emaste Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D27389 Notes: svn path=/head/; revision=368125
* Remove stray column.Konstantin Belousov2020-11-261-1/+1
| | | | | | | | Sponsored by: The FreeBSD Foundation MFC after: 3 days Notes: svn path=/head/; revision=368083
* Use designated initializers for libc pthread stubs' jump table.Konstantin Belousov2020-11-251-67/+67
| | | | | | | | Sponsored by: The FreeBSD Foundation MFC after: 1 week Notes: svn path=/head/; revision=368023
* libc: fix undefined behavior from signed overflow in strstr and memmemEd Maste2020-11-192-8/+8
| | | | | | | | | | | | | | | | | | | | | unsigned char promotes to int, which can overflow when shifted left by 24 bits or more. this has been reported multiple times but then forgotten. it's expected to be benign UB, but can trap when built with explicit overflow catching (ubsan or similar). fix it now. note that promotion to uint32_t is safe and portable even outside of the assumptions usually made in musl, since either uint32_t has rank at least unsigned int, so that no further default promotions happen, or int is wide enough that the shift can't overflow. this is a desirable property to have in case someone wants to reuse the code elsewhere. musl commit: 593caa456309714402ca4cb77c3770f4c24da9da Obtained from: musl Notes: svn path=/head/; revision=367823
* libc: optimize memmem two-way bad character shiftEd Maste2020-11-191-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | first, the condition (mem && k < p) is redundant, because mem being nonzero implies the needle is periodic with period exactly p, in which case any byte that appears in the needle must appear in the last p bytes of the needle, bounding the shift (k) by p. second, the whole point of replacing the shift k by mem (=l-p) is to prevent shifting by less than mem when discarding the memory on shift, in which case linear time could not be guaranteed. but as written, the check also replaced shifts greater than mem by mem, reducing the benefit of the shift. there is no possible benefit to this reduction of the shift; since mem is being cleared, the full shift is valid and more optimal. so only replace the shift by mem when it would be less than mem. musl commits: 8f5a820d147da36bcdbddd201b35d293699dacd8 122d67f846cb0be2c9e1c3880db9eb9545bbe38c Obtained from: musl MFC after: 2 weeks Notes: svn path=/head/; revision=367822
* clang-format libc string functions imported from muslEd Maste2020-11-183-125/+194
| | | | | | | | | | | We have adopted these and don't consider them 'contrib' code, so bring them closer to style(9). This is a followon to r315467 and r351700. MFC after: 1 week Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=367821
* _umtx_op: document UMTX_OP_SEM2_WAIT copyout behaviorKyle Evans2020-11-171-1/+22
| | | | | | | | | | | This clever technique to get a time remaining back was added to support sem_clockwait_np. Reviewed by: kib, vangyzen MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D27160 Notes: svn path=/head/; revision=367742
* Add a missing Nm macroMateusz Piotrowski2020-11-131-0/+1
| | | | | | | | All functions documented in a manual page should be enumerated with the Nm macros. Notes: svn path=/head/; revision=367641
* Reference setprogname(3) in setproctitle(3)Mateusz Piotrowski2020-11-131-1/+2
| | | | | | | | | | The reference to setproctitle(3) in the setprogname(3) manual is already in place. MFC after: 3 days Notes: svn path=/head/; revision=367639
* Add collation version support to querylocale(3).Thomas Munro2020-11-085-16/+57
| | | | | | | | | | | | | | | | | | | | | | | Provide a way to ask for an opaque version string for a locale_t, so that potential changes in sort order can be detected. Similar to ICU's ucol_getVersion() and Windows' GetNLSVersionEx(), this API is intended to allow databases to detect when text order-based indexes might need to be rebuilt. The CLDR version is extracted from CLDR source data by the Makefile under tools/tools/locale, written into the machine-generated Makefile under shared/colldef, passed to localedef -V, and then written into LC_COLLATE file headers. The initial version is 34.0. tools/tools/locale was recently updated to pull down 35.0, but the output hasn't been committed under share/colldef yet, so that will provide the first observable change when it happens. Other versioning schemes are possible in future, because the format is unspecified. Reviewed by: bapt, 0mp, kib, yuripv (albeit a long time ago) Differential Revision: https://reviews.freebsd.org/D17166 Notes: svn path=/head/; revision=367476
* Re-arrange some of the code to separate writable user tree variables fromStefan Eßer2020-11-021-28/+27
| | | | | | | | | | | R/O variables. While here fix some nearby style. No functional change intended. MFC after: 1 month Notes: svn path=/head/; revision=367280
* Make sysctl user.local a tunable that can be written at run-timeStefan Eßer2020-10-311-10/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | This sysctl value had been provided as a read-only variable that is compiled into the C library based on the value of _PATH_LOCALBASE in paths.h. After this change, the value is compiled into the kernel as an empty string, which is translated to _PATH_LOCALBASE by the C library. This empty string can be overridden at boot time or by a privileged user at run time and will then be returned by sysctl. When set to an empty string, the value returned by sysctl reverts to _PATH_LOCALBASE. This update does not change the behavior on any system that does not modify the default value of user.localbase. I consider this change as experimental and would prefer if the run-time write permission was reconsidered and the sysctl variable defined with CLFLAG_RDTUN instead to restrict it to be set at boot time. MFC after: 1 month Notes: svn path=/head/; revision=367243
* Fix reversed condition after attempted style fix in r367196Stefan Eßer2020-10-311-2/+2
| | | | | | | | Reported by: xtouqh@hotmail.com MFC after: 3 days Notes: svn path=/head/; revision=367199
* Fix style, no functional changeStefan Eßer2020-10-311-5/+5
| | | | | | | | Submitted by: kib MFC after: 3 days Notes: svn path=/head/; revision=367196
* Update man-pages to describe the user.localbase variable added in r367179.Stefan Eßer2020-10-301-1/+5
| | | | | | | MFC after: 3 days Notes: svn path=/head/; revision=367184
* Add read only sysctl variable user.localbaseStefan Eßer2020-10-301-0/+9
| | | | | | | | | | | | The value is provided by the C library as for other sysctl variables in the user tree. It is compiled in and returns the value of _PATH_LOCALBASE defined in paths.h. Reviewed by: imp, scottl Differential Revision: https://reviews.freebsd.org/D27009 Notes: svn path=/head/; revision=367179
* Disable ssp raw test without ASANBrooks Davis2020-10-281-1/+1
| | | | | | | | | | | | | r366981 disabled ASAN when it might not be reliable (with an external compiler), but this test is broken without ASAN so disable it completely in that case. PR: 250706 Reviewed by: emaste, lwhsu Differential Revision: https://reviews.freebsd.org/D26982 Notes: svn path=/head/; revision=367121
* Drop "All rights reserved" from all my stuff. This includesEdward Tomasz Napierala2020-10-2818-18/+0
| | | | | | | | | | | | Foundation copyrights, approved by emaste@. It does not include files which carry other people's copyrights; if you're one of those people, feel free to make similar change. Reviewed by: emaste, imp, gbe (manpages) Differential Revision: https://reviews.freebsd.org/D26980 Notes: svn path=/head/; revision=367105
* Revise the description of MAP_STACK. In particular, describe the guardAlan Cox2020-10-271-19/+23
| | | | | | | | | | | in more detail. Reviewed by: bcr, kib, markj MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D26908 Notes: svn path=/head/; revision=367087
* Replace literal uses of /usr/local in C sources with _PATH_LOCALBASEStefan Eßer2020-10-271-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | Literal references to /usr/local exist in a large number of files in the FreeBSD base system. Many are in contributed software, in configuration files, or in the documentation, but 19 uses have been identified in C source files or headers outside the contrib and sys/contrib directories. This commit makes it possible to set _PATH_LOCALBASE in paths.h to use a different prefix for locally installed software. In order to avoid changes to openssh source files, LOCALBASE is passed to the build via Makefiles under src/secure. While _PATH_LOCALBASE could have been used here, there is precedent in the construction of the path used to a xauth program which depends on the LOCALBASE value passed on the compiler command line to select a non-default directory. This could be changed in a later commit to make the openssh build consistently use _PATH_LOCALBASE. It is considered out-of-scope for this commit. Reviewed by: imp MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D26942 Notes: svn path=/head/; revision=367075
* update write(2)'s iovec limit w/ info about the iosize_max_clamp sysctl...John-Mark Gurney2020-10-261-4/+8
| | | | Notes: svn path=/head/; revision=367048
* warnx: fix needless staticWarner Losh2020-10-241-2/+2
| | | | | | | | | I noticed after the review that these shouldn't be static. Remove the 'static' from them, otherwise concurrent calls to warn* might see a similar but to the original. Notes: svn path=/head/; revision=366983
* warnx: Save errno across calls that might change it.Warner Losh2020-10-231-0/+8
| | | | | | | | | | | | | | | When warn() family of functions is being used after err_set_file() has been set to, for example, /dev/null, errno is being clobbered, rendering it unreliable after, for example, procstat_getpathname() when it is supposed to emit a warning. Then the errno is changed to Inappropriate ioctl for device, destroying the original value (via calls to fprintf()functions). Submitted by: Juraj Lutter Differential Revision: https://reviews.freebsd.org/D26871 Notes: svn path=/head/; revision=366982
* Only use ASAN when using the in-tree compilerBrooks Davis2020-10-231-1/+3
| | | | | | | | | | | | | | When building FreeBSD 11 on a FreeBSD 12 system with CROSS_TOOLCHAIN=llvm10 we end up trying to link against the packaged version of the sanitizer library. This resulted in a requirement for getentropy(3) which is not present in FreeBSD 11. Reviewed by: emaste MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D26903 Notes: svn path=/head/; revision=366981