aboutsummaryrefslogtreecommitdiff
path: root/lib/libc
Commit message (Collapse)AuthorAgeFilesLines
* strfmon(3): Match the return typeJose Luis Duran41 hours1-2/+2
| | | | | Reviewed by: kib MFC after: 1 week
* strfmon(3): Wording improvementsJose Luis Duran41 hours1-12/+11
| | | | | | | Use the same terminology as the other `_l` xlocale(3) functions. Reviewed by: kib MFC after: 1 week
* strfmon(3): Add an EXAMPLES sectionJose Luis Duran41 hours1-0/+25
| | | | | Reviewed by: kib MFC after: 1 week
* man: add Netlink reference to socket(2)Alexander V. Chernikov12 days1-1/+2
| | | | | Reviewed by: lwhsu, pauamma, gbe Differential Revision: https://reviews.freebsd.org/D38054
* xdr: store chars consistentlyBrooks Davis2023-01-121-4/+4
| | | | | | | | | | | | | | | | | | Cast char's through unsigned char before storing as an integer in xdr_char(), this ensures that the encoded form is consistently not sign-extended following Open Solaris's example. Prior to this change, platforms with signed chars would sign extend values with the high bit set but ones with unsigned chars would not so 0xff would be stored as 0x000000ff on unsigned char platforms and 0xffffffff on signed char platforms. Decoding has the same result for either form so this is a largely cosmetic change, but it seems best to produce consistent output. For more discussion, see https://github.com/openzfs/zfs/issues/14173 Reviewed by: mav, imp Differential Revision: https://reviews.freebsd.org/D37992
* tzcode: Move configuration into separate header.Dag-Erling Smørgrav2023-01-112-7/+12
| | | | | MFC after: 1 week Sponsored by: Klara, Inc.
* Bring our tzcode up to date.Dag-Erling Smørgrav2023-01-104-4/+414
|\ | | | | | | | | | | | | | | | | | | * Replay 2010[acflm] which had been merged but not recorded. * Merge 2010n. * Reorganize (unsplit) the code to match the upstream layout. * Merge 2022[cdefg]. MFC after: 1 week Sponsored by: Klara, Inc.
* | libc: Fix build with WITHOUT_MACHDEP_OPTIMIZATIONS=YES set.Gleb Popov2023-01-101-1/+6
| | | | | | | | | | | | | | | | | | | | Test Plan: `make buildword WITHOUT_MACHDEP_OPTIMIZATIONS=YES` on 14-CURRENT and 13-STABLE Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D38017 PR: 266900
* | libc: Fix longjmp/_longjmp(buf, 0) for AArch64 and RISC-VJessica Clarke2023-01-094-2/+10
| | | | | | | | | | | | | | | | | | | | | | These architectures fail to handle this special case, and will cause the corresponding setjmp/_setjmp to return 0 rather than 1. Fix this and add regression tests (also committed upstream). PR: 268684 Reviewed by: arichardson, jhb MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D29363
* | copyright: chase my name and email changeVal Packett2023-01-062-2/+2
| | | | | | | | | | 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
| |
* | ptrace(2): document PT_SC_REMOTEKonstantin Belousov2022-12-221-5/+68
| | | | | | | | | | | | | | Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D37590
* | ptrace(2): explain how to select specific thread to operate onKonstantin Belousov2022-12-221-0/+19
| | | | | | | | | | | | | | | | Requested by: emaste Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D37590
* | xlocale(3): Link man pagesJose Luis Duran2022-12-1921-128/+443
| | | | | | | | | | | | | | | | | | | | | | | | | | | | - provide various missing MLINKS for library functions - update various SEE ALSO section to include the new linked manual pages - add various definitions of new functions like isideogram_l(3) - document COMPATIBILITY for some functions - bump man page dates Reviewed by: gbe, bcr MFC after: 1 week Pull Request: https://github.com/freebsd/freebsd-src/pull/621 Differential Revision: https://reviews.freebsd.org/D37203
* | ptrace.2: Fix warnings from igor.John Baldwin2022-12-151-4/+4
| | | | | | | | | | Reviewed by: pauamma, imp Differential Revision: https://reviews.freebsd.org/D37689
* | 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
* | getservent.3: Mention the service.dbGordon Bergling2022-12-071-2/+4
| | | | | | | | | | | | | | | | - reference /var/db/services.db - reference services_mkdb(8) Obtained from: NetBSD MFC after: 3 days
* | [skip ci] document first appearance of fhlink et alAlan Somers2022-11-303-3/+23
| | | | | | | | | | | | | | MFC after: 1 week Sponsored by: Axcient Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D37575
* | 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
* | amd64 libc: add missed GNU-stack annotation to memmove/memcpyKonstantin Belousov2022-11-181-0/+2
| | | | | | | | | | Sponsored by: The FreeBSD Foundation MFC after: 1 week
* | rpcb_clnt.c: Do not force use of UDPRick Macklem2022-11-131-2/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Without this patch, the code in the rpcbind client forces the use of UDP. A comment notes that some rpcbind servers only support UDP. This makes NFSv3 mounts to Azure servers impossible, since they require use of TCP for rpcbind. Since the comment is very old (imported from NetBSD in 2001) and I do not believe any UDP only rpcbind servers will still exist, this patch comments out the code that forces use of UDP, so that NFSv3 mounts to Azure servers can work. For an NFSv3 mount, the "udp" mount option will still make mount_nfs use UDP for rpcbind so that can be used as a workaround for any old NFSv3 server that only supports rpcbind over UDP (if any such server still exists). I asked if doing this change is appropriate on freebsd-fs@ and I only got one reply (off list) that supported doing the change. PR: 267301 MFC after: 1 month
* | libc: Don't warn about RRSIG replies.Dag-Erling Smørgrav2022-11-092-2/+5
| | | | | | | | | | | | PR: 213178 MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D37303
* | getsockopt.2: Clarify the SO_REUSEPORT_LB text a bitMark Johnston2022-11-021-4/+4
| | | | | | | | | | | | | | | | | | Refer to sockets rather than processes, since one can have multiple sockets in a load-balancing group within the same process. MFC after: 1 week Sponsored by: Modirum MDPay Sponsored by: Klara, Inc.
* | ktrace.2: Document KTRFAC_STRUCT_ARRAY.John Baldwin2022-11-021-1/+2
| | | | | | | | Sponsored by: DARPA
* | getaddrinfo: distinguish missing addrs from unresolvable namesMike Karels2022-11-021-5/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Rework getaddrinfo(3) to return different error values for unresolvable names (same as before, EAI_NONAME) and those without a requested addr (EAI_ADDRFAMILY) when using DNS. This is implemented via an added error in the nsswitch layer, NS_ADDRFAMILY, which is used only by getaddrinfo(). The error is passed through nsdispatch(3), but that routine has no changes to handle this error. The error originates in the getaddrinfo DNS layer called via nsdispatch(), and is processed by the search layer that calls nsdispatch(). While here, add a little style to returns near those that were modified. Reviewed in https://reviews.freebsd.org/D37139 with related changes. Reviewed by: bz MFC after: 1 month
* | gai_strerror.[c3]: re-enable EAI_ADDRFAMILY, EAI_NODATAMike Karels2022-11-022-7/+20
| | | | | | | | | | | | | | | | | | | | | | | | gai_strerror.c still has messages for EAI_ADDRFAMILY and EAI_NODATA, but not the man page. Re-add to the man page, and update comments in the source. Document the errors that are not in RFC 3493 or POSIX. Reviewed in https://reviews.freebsd.org/D37139 with related changes. Reviewed by: bz, pauamma MFC after: 1 month
* | strfmon: Remove XXX marksJose Luis Duran2022-10-291-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | phantom@'s HDD crashed with the final version of strfmon.c, as explained in 9d430a5991d3f64a75fee951a1efab3593207832. Now there are tests in place that cover these code paths. Reviewed by: kib PR: 267410 Github PR: #620 MFC after: 1 week
* | strfmon_l: Use specified locale for number formattingJose Luis Duran2022-10-292-26/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | strfmon_l does not take fully into consideration the explicitly passed locale to perform the formatting. Parallel universe bug report: https://sourceware.org/bugzilla/show_bug.cgi?id=19633 Obtained from: Darwin Reviewed by: kib PR: 267410 Github PR: #620 MFC after: 1 week
* | strfmon_test: Add a test for strfmon_lJose Luis Duran2022-10-291-0/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | Attempt to test the correctness of strfmon_l(3). Items marked with XXX represent an invalid output. Obtained from: https://github.com/NetBSD/src/commit/e7eba0044fe6128291cbb7e5923c7cf7d87318cc Reviewed by: kib PR: 267410 Github PR: #620 MFC after: 1 week
* | strfmon_test: Reserve space for the null terminatorJose Luis Duran2022-10-291-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | Otherwise strfmon(3) could overflow the buffer. Here is mostly done for correctness and illustrative purposes, as there is no chance it could actually happen. Reviewed by: kib PR: 267410 Github PR: #620 MFC after: 1 week
* | strfmon_l(3): Add name to the man pageJose Luis Duran2022-10-291-3/+5
| | | | | | | | | | | | | | Reviewed by: kib PR: 267410 Github PR: #620 MFC after: 1 week
* | strfmon(3): Fix # explanationJose Luis Duran2022-10-251-2/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | There's only one value that specifies the number of digits after the decimal point (oh, sorry, the "radix character") the other specifies the number before... While here, add a little more info on the effects of using the #n value. Obtained from: https://github.com/NetBSD/src/commit/d1dd1a086400ae719bde1f2c45938d9bc1d29e8b Reviewed by: kib PR: 267282 Github PR: #619 MFC after: 1 week
* | strfmon(3): Remove repeated wordsJose Luis Duran2022-10-251-1/+1
| | | | | | | | | | | | | | Reviewed by: kib PR: 267282 Github PR: #619 MFC after: 1 week
* | strfmon: Fix formatting of a second fixed-width valueJose Luis Duran2022-10-252-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | There is a bug when formatting two consecutive values using fixed-widths and the values need padding. This was because the value of pad_size was zeroed only every other time. Format Before After [%8n] [%8n] [ $123.45] [ $123.45] [ $123.45] [ $123.45] Reviewed by: kib PR: 267282 Github PR: #619 MFC after: 1 week
* | strfmon: Fix an edge case when sep_by_space is 2Jose Luis Duran2022-10-252-3/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix an edge case by printing the required space when, the currency symbol succeeds the value, a space separates the sign from the value and the sign position precedes the quantity and the currency symbol. In other words: n_cs_precedes = 0 n_sep_by_space = 2 n_sign_posn = 1 From The Open Group's localeconv[1]: > When {p,n,int_p,int_n}_sep_by_space is 2: > If the currency symbol and sign string are adjacent, a space separates > them; otherwise, a space separates the sign string from the value. Format Before After [%n] [-123.45¤] [- 123.45¤] [1]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/localeconv.html Obtained from: Darwin Reviewed by: kib PR: 267282 Github PR: #619 MFC after: 1 week
* | strfmon: Fix alignment when enclosed by parenthesesJose Luis Duran2022-10-252-4/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Take into consideration the possibility of quantities enclosed by parentheses when aligning. Matches the examples from The Open Group's: Format Before After %(#5n [$ 123.45] [ $ 123.45 ] Use an alternative pos/neg style [($ 123.45)] [($ 123.45)] [$ 3,456.78] [ $ 3,456.78 ] %!(#5n [ 123.45] [ 123.45 ] Disable the currency symbol [( 123.45)] [( 123.45)] [ 3,456.78] [ 3,456.78 ] https://pubs.opengroup.org/onlinepubs/9699919799/functions/strfmon.html SD5-XSH-ERN-29 is applied, updating the examples for %(#5n and %!(#5n. Obtained from: Darwin Reviewed by: kib PR: 267282 Github PR: #619 MFC after: 1 week
* | strfmon: Trim the SPACE from international currency symbolJose Luis Duran2022-10-252-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The international currency symbol (int_curr_symbol) has a mandatory SPACE character as the last character. Trim this space after reading it, otherwise this extra space will always be printed when displaying the int_curr_symbol. Fixes the output when the international currency format is selected (%i). Locale Format Before After en_US.UTF-8 [%i] [USD 123.45] [USD123.45] fr_FR.UTF-8 [%i] [123,45 EUR ] [123,45 EUR] Note that the en_US.UTF-8 locale states that no space should be printed between the currency symbol and the value (sep_by_space = 0). Reviewed by: kib PR: 267282 Github PR: #619 MFC after: 1 week
* | strfmon: Avoid an out-of-bounds accessJose Luis Duran2022-10-252-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Avoid an out-of-bounds access when trying to set the space_char using an international currency format (%i) and the C/POSIX locale. The current code tries to read the SPACE from int_curr_symbol[3]: currency_symbol = strdup(lc->int_curr_symbol); space_char = *(currency_symbol+3); But on C/POSIX locales, int_curr_symbol is empty. Three implementations have been examined: NetBSD[1], Darwin[2], and Illumos[3]. Only NetBSD has fixed it[4]. Darwin and NetBSD also trim the mandatory final SPACE character after reading it. Locale Format Darwin/NetBSD FreeBSD/Illumos en_US.UTF-8 [%i] [USD123.45] [USD 123.45] fr_FR.UTF-8 [%i] [123,45 EUR] [123,45 EUR ] This commit only fixes the out-of-bounds access. [1]: https://github.com/NetBSD/src/blob/trunk/lib/libc/stdlib/strfmon.c [2]: https://opensource.apple.com/source/Libc/Libc-1439.141.1/stdlib/NetBSD/strfmon.c.auto.html [3]: https://github.com/illumos/illumos-gate/blob/master/usr/src/lib/libc/port/locale/strfmon.c [4]: https://github.com/NetBSD/src/commit/3d7b5d498aa9609f2bc9ece9c734c5f493a8e239 Reviewed by: kib PR: 267282 Github PR: #619 MFC after: 1 week
* | strfmon: Fix typos in source code commentsJose Luis Duran2022-10-251-2/+2
| | | | | | | | | | | | | | | | | | | | s/defult/default s/internaltion/international Reviewed by: kib PR: 267282 Github PR: #619 MFC after: 1 week
* | strfmon: Fix typo in constantJose Luis Duran2022-10-251-4/+4
| | | | | | | | | | | | | | | | | | s/SUPRESS_CURR_SYMBOL/SUPPRESS_CURR_SYMBOL Reviewed by: kib PR: 267282 Github PR: #619 MFC after: 1 week
* | strfmon: Code cleanupJose Luis Duran2022-10-251-64/+68
| | | | | | | | | | | | | | | | | | | | No functional change intended. Not claiming full style(9) compliance. Reviewed by: kib PR: 267282 Github PR: #619 MFC after: 1 week
* | strfmon_test: Add some testsJose Luis Duran2022-10-251-0/+151
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Attempt to test the correctness of strfmon(3). Some of them were inspired from the examples section at: https://pubs.opengroup.org/onlinepubs/9699919799/functions/strfmon.html Items marked with XXX represent an invalid output. Reviewed by: kib PR: 267282 Github PR: #619 MFC after: 1 week
* | strfmon_test: Fix typo and remove extra spaceJose Luis Duran2022-10-251-2/+2
| | | | | | | | | | | | | | Reviewed by: kib PR: 267282 Github PR: #619 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
* | Revert "listen(): improve POSIX compliance"Michael Tuexen2022-10-121-10/+2
| | | | | | | | | | | | | | | | This reverts commit 76e6e4d72f8d3da7d19242f303bc95461fde7fb9. Several programs in the tree use -1 instead of INT_MAX to use the maximum value. Thanks to Eugene Grosbein for pointing this out.
* | listen(): improve POSIX complianceMichael Tuexen2022-10-111-2/+10
| | | | | | | | | | | | | | | | Ensure that a negative backlog argument is handled as it if was 0. Reviewed by: markj@, glebius@ Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D31821