Commit graph

9528 commits

Author SHA1 Message Date
John Baldwin
35acd8db34 libc rpc: Fix mismatches in prototypes for array bounds.
Various RPC functions used a bare pointer in function prototypes to
describe fixed-length buffer arguments but used a fixed-length array
in the function definition.  The manual page for these functions
describes the parameters as being fixed-length buffers, so update
the prototypes to match the definitions.

Reviewed by:	imp, emaste
Reported by:	GCC -Warray-parameter
Differential Revision:	https://reviews.freebsd.org/D36757

(cherry picked from commit a2e41a585b)
2022-11-11 10:18:52 -08:00
Mark Johnston
f9b1c96e30 getsockopt.2: Clarify the SO_REUSEPORT_LB text a bit
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.

(cherry picked from commit d0f8e31761)
2022-11-10 12:02:47 -05:00
Jose Luis Duran
85e34c0f67 strfmon: Remove XXX marks
(cherry picked from commit f0a15aafcb)
2022-11-05 02:30:39 +02:00
Jose Luis Duran
bd847e46f1 strfmon_l: Use specified locale for number formatting
(cherry picked from commit 621bf91893)
2022-11-05 02:30:39 +02:00
Jose Luis Duran
dbfea0a6d8 strfmon_test: Add a test for strfmon_l
(cherry picked from commit 29972f06f9)
2022-11-05 02:30:39 +02:00
Jose Luis Duran
15a6febddb strfmon_test: Reserve space for the null terminator
(cherry picked from commit edcee003e5)
2022-11-05 02:30:39 +02:00
Jose Luis Duran
6e3a5a802e strfmon_l(3): Add name to the man page
(cherry picked from commit d96088b3ab)
2022-11-05 02:30:39 +02:00
Jose Luis Duran
b37c1241fe strfmon(3): Fix # explanation
(cherry picked from commit 7cfd67ce96)
2022-11-01 02:44:42 +02:00
Jose Luis Duran
0e3c078aa8 strfmon(3): Remove repeated words
(cherry picked from commit 0efec50e9e)
2022-11-01 02:44:41 +02:00
Jose Luis Duran
81e14c8f16 strfmon: Fix formatting of a second fixed-width value
(cherry picked from commit 34f88528ed)
2022-11-01 02:44:41 +02:00
Jose Luis Duran
babe20c88c strfmon: Fix an edge case when sep_by_space is 2
(cherry picked from commit 750fe3e6a4)
2022-11-01 02:44:41 +02:00
Jose Luis Duran
8e5a213521 strfmon: Fix alignment when enclosed by parentheses
(cherry picked from commit 947efadc3d)
2022-11-01 02:44:41 +02:00
Jose Luis Duran
56462db942 strfmon: Trim the SPACE from international currency symbol
(cherry picked from commit 6da51e19e3)
2022-11-01 02:44:41 +02:00
Jose Luis Duran
da5b1c42c5 strfmon: Avoid an out-of-bounds access
(cherry picked from commit 9e03b903e3)
2022-11-01 02:44:41 +02:00
Jose Luis Duran
96ef02d4a3 strfmon: Fix typos in source code comments
(cherry picked from commit 0afd11d50f)
2022-11-01 02:44:41 +02:00
Jose Luis Duran
f281bc0686 strfmon: Fix typo in constant
(cherry picked from commit d5980dff6b)
2022-11-01 02:44:41 +02:00
Jose Luis Duran
27744c741d strfmon: Code cleanup
(cherry picked from commit f81dfea291)
2022-11-01 02:44:41 +02:00
Jose Luis Duran
712101eb2b strfmon_test: Add some tests
(cherry picked from commit 3f97d37ac5)
2022-11-01 02:44:41 +02:00
Jose Luis Duran
40fbde93a4 strfmon_test: Fix typo and remove extra space
(cherry picked from commit f91301cc79)
2022-11-01 02:44:40 +02:00
Mark Johnston
6dde65fa74 libc: Make elf_aux_info() return an error if AT_USRSTACK* is undefined
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>
Reviewed by:	brooks, kib

(cherry picked from commit a4ee0edc4a)
2022-10-25 08:45:08 -04:00
Mitchell Horne
ec390e83ab getpagesize(3): cross-reference getpagesizes(3)
MFC after:	3 days

(cherry picked from commit 4a9b1a1463)
2022-10-24 12:53:11 -03:00
Hans Petter Selasky
16a49ddfe7 qdivrem: Predict division by zero as false.
Division by zero triggers an arithmetic exception and should not be very
common. Predict this.

No functional change intended.

Sponsored by:	NVIDIA Networking

(cherry picked from commit 1024bb2633)
2022-10-12 17:53:21 +02:00
Ed Maste
a8db30cd70 libc: Fix size range check in setvbuf
From enh at google.com via openbsd-tech mailing list via pfg@:

The existing test is wrong for LP64, where size_t has twice as many
relevant bits as int, not just one. (Found by inspection by
rprichard.)

(cherry picked from commit 9515313b26)
2022-10-07 11:23:10 -04:00
Xin LI
39be4f7d1f scandir(3): Rename alphasort_thunk to scandir_thunk_cmp to
reflect that it is not alphasort-specific.

Reported by:	emaste
Reviewed by:	emaste
Differential Revision: https://reviews.freebsd.org/D36708

(cherry picked from commit 45ff071ddc)
2022-10-04 23:16:11 -07:00
Konstantin Belousov
b904f197ce libc, libthr: use AT_USRSTACK{BASE,LIM} instead of sysctl("kern.usrstack") and get_rlimit(RLIMIT_STACK)
(cherry picked from commit e2879ece43)
2022-09-30 03:29:10 +03:00
Konstantin Belousov
a26c4766b0 libthr: use nitems() for mib length
(cherry picked from commit ebf7a01594)
2022-09-30 03:29:10 +03:00
Konstantin Belousov
2b2bf73326 auxv.3: Document AT_USRSTACKBASE and AT_USRSTACKLIM
(cherry picked from commit 62b4fb22df)
2022-09-30 03:29:09 +03:00
Konstantin Belousov
c71b8367de _elf_aux_info(3): add support for AT_USRSTACK{BASE,LIM}
(cherry picked from commit 8f2668b060)
2022-09-30 03:29:09 +03:00
Gordon Bergling
13798b4078 Update SEE ALSO sections for resolver.{3,5} and hosts.5
The mentioned document "Name Server Operations Guide for BIND" is
outdated, so remove it from the SEE ALSO section of hosts.5
and resolver.{3,5}.

PR:		266360
Reported by:	Graham Perrin <grahamperrin at FreeBSD dot org>
Reviewed by:	karels
Differential Revision:	https://reviews.freebsd.org/D36557

(cherry picked from commit 0090d18235)
2022-09-24 10:31:13 +02:00
Fernando Apesteguía
b7c55aaa6d Bump .Dd for recently modified manual pages
During the removal of named(8) references, some pages were modified but their
.Dd where not updated accordingly.

Reported by:	lwhsu@
Fixes:	942e234d86

(cherry picked from commit 4a3c598f35)
2022-09-24 10:25:07 +02:00
Fernando Apesteguía
a3c3c02244 getnetent(3): Add missing reentrant functions
Add documentation for gethostbyname_r, gethostbyname2_r and gethostbyaddr_r

Create proper MLINKs for the new functions.

PR:	249154
Reported by:	asomers@
Approved by:	manpages (0mp@), Pau Amma
Differential Revision: 	https://reviews.freebsd.org/D30469

(cherry picked from commit dc68997328)
2022-09-24 10:12:08 +02:00
Fernando Apesteguía
36c7fd643b Remove references to named(8)
named(8) hasn't been in base for some time. Remove all references to it in
manual pages.

Approved by:	manpages (Pau Amma)
Differential Revision:	https://reviews.freebsd.org/D35586

(cherry picked from commit 942e234d86)
2022-09-24 10:09:35 +02:00
Xin LI
a6426a69f4 libc: add test case for qsort_b(3)
Reviewed by: 	markj
Differential Revision: https://reviews.freebsd.org/D36463

(cherry picked from commit c65e42dbde)
(cherry picked from commit 4385a9f851)
2022-09-20 23:46:48 -07:00
Gleb Popov
998c08856a src.conf: Introduce WITHOUT_MACHDEP_OPTIMIZATIONS knob.
Summary:
This knob can be used to make buildsystem prefer generic C implentations of
various functions, instead of machine-specific assembler ones.

Test Plan: `make buildworld` on amd64

Reviewed by: imp, emaste

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

(cherry picked from commit 20adba8bc1)
2022-09-13 21:55:45 +03:00
Konstantin Belousov
2a92854d81 libc/stdio: only roll FILE state back on EINTR
PR:	266171

(cherry picked from commit 44cf1e5eb4)
2022-09-09 20:01:53 +03:00
Konstantin Belousov
c4e47e45ab __swbuf(): style
(cherry picked from commit 120bacabfd)
2022-09-09 20:01:52 +03:00
Aymeric Wibo
27e60668bf libc: Add strverscmp(3) and versionsort(3)
(cherry picked from commit 05c9a0158f)
2022-08-31 04:20:28 +03:00
Konstantin Belousov
a7593bf87d Document scandirat(3)
(cherry picked from commit a294e67973)
2022-08-31 04:20:28 +03:00
Konstantin Belousov
f8a926bebe libc: add scandirat(3)
(cherry picked from commit 9fb8e8eede)
2022-08-31 04:20:28 +03:00
Konstantin Belousov
066b09c2b1 libc: split scandir() into scandir_dirp() and proper scandir()
(cherry picked from commit cb6e97f4da)
2022-08-31 04:20:28 +03:00
Konstantin Belousov
628b801a8d Link scandir_b(3) to scandir(3)
(cherry picked from commit ea448a0a43)
2022-08-31 04:20:28 +03:00
Konstantin Belousov
c5b0a30c46 scandir.3: Use .Fo instead of .Fn for long args
(cherry picked from commit aa5e19a9b3)
2022-08-31 04:20:28 +03:00
Xin LI
09f390a215 arc4random(3): Reduce diff with OpenBSD.
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)
Differential Revision: https://reviews.freebsd.org/D36088

(cherry picked from commit e9a2e4d1d2)
2022-08-23 22:11:09 -07:00
Andrew Turner
8f736f867c Remove "All rights reserved" where I can in libc
These all have my copyright so can be removed. Some also have FreeBSD
Foundation copyright so drop from there as has been done for previous
files.

Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 101480e926)
2022-08-22 10:11:29 +01:00
Eugene Grosbein
2067574b27 MFC: syslog(3): unbreak log generation using fabricated PID
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

(cherry picked from commit e9ae9fa937)
2022-08-22 09:30:32 +07:00
Ed Maste
52c8052938 libc: ANSIfy div / ldiv function definitions
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit a8a43edc0f)
2022-08-03 20:35:09 -04:00
Gordon Bergling
9de56faedb sockatmark(3): Add references to 4.4BSD IPC tutorials
Obtained from:	NetBSD

(cherry picked from commit 6cea3be922)
2022-07-08 04:24:32 +02:00
Mark Johnston
af5ea5ccce wait.2: Remove sys/types.h from the list of required headers
wait.h is self-contained.

Sponsored by:	The FreeBSD Foundation

(cherry picked from commit b8ec0ce5b4)
2022-07-07 13:05:18 -04:00
Alexander Motin
558e8b6adb amd64: Stop using REP MOVSB for backward memmove()s.
Enhanced REP MOVSB feature of CPUs starting from Ivy Bridge makes
REP MOVSB the fastest way to copy memory in most of cases. However
Intel Optimization Reference Manual says: "setting the DF to force
REP MOVSB to copy bytes from high towards low addresses will expe-
rience significant performance degradation". Measurements on Intel
Cascade Lake and Alder Lake, same as on AMD Zen3 show that it can
drop throughput to as low as 2.5-3.5GB/s, comparing to ~10-30GB/s
of REP MOVSQ or hand-rolled loop, used for non-ERMS CPUs.

This patch keeps ERMS use for forward ordered memory copies, but
removes it for backward overlapped moves where it does not work.

This is just a cosmetic sync with kernel, since libc does not use
ERMS at this time.

Reviewed by:    mjg
MFC after:	2 weeks

(cherry picked from commit f22068d91b)
2022-06-29 21:13:51 -04:00
Mark Johnston
5d6f9a7da2 kevent.2: Add an xref to listen.2
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 6405997f45)
2022-06-27 10:11:27 -04:00