Commit graph

9846 commits

Author SHA1 Message Date
Brooks Davis
c6e072f15c memfd_create: don't allocate heap memory
Rather than calling calloc() to allocate space for a page size array to
pass to getpagesizes(), just follow the getpagesizes() implementation
and allocate MAXPAGESIZES elements on the stack.  This avoids the need
for the allocation.

While this does mean that a new libc is required to take advantage of a
new huge page size, that was already true due to getpagesizes() using a
static buffer of MAXPAGESIZES elements.

Reviewed by:	kevans, imp, emaste
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D42710

(cherry picked from commit c96772227b7dfcaf4eec4d07acb5c916643aca3a)
2023-12-21 18:13:19 +00:00
Brooks Davis
89ebe0ce1f memfd_create: move implementation to libc/gen
Due to memfd_create(3)'s construction of a path to pass to shm_open2(2),
it has a much larger than typical dependency footprint for a system
call wrapper (the list currently includes calloc, memset, sprintf, and
strlen).  As such, split it off into its own file under libc/gen to
lighten libc/sys's dependency list.

Reviewed by:	kevans, imp, emaste
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D42709

(cherry picked from commit c3207e2d2554c8e36f9cf5950f8cd52a19fedfd5)
2023-12-21 18:13:18 +00:00
Peter Eriksson
e373880312 libc: correct some memory leaks in acl_to_text(3) and acl_to_text_np(3)
PR:	275232

(cherry picked from commit 7aa375dcc61e48cc56da45c9d5a11371693c8043)
2023-12-20 10:29:55 +02:00
Konstantin Belousov
79ca908fde strfmon.c: Use the restrict keyword directly
(cherry picked from commit 86e2bcbf47fb4c8dbd799f2f21c0ed338b2e8f1b)
2023-12-16 06:17:51 +02:00
Jose Luis Duran
2f427cbb35 strfmon: style fixes
(cherry picked from commit 56a0d5444d6f39302f3476b61c1b81ed39abe589)
2023-12-16 06:17:51 +02:00
Jose Luis Duran
ea99922484 strfmon: Silence scan-build warning
(cherry picked from commit 6abee52e0d79f68fd725de748d7027ca8eef2294)
2023-12-16 06:17:51 +02:00
Jose Luis Duran
9f1c1cfe69 strfmon.3: Cleanup example code
(cherry picked from commit 2a163c3649e59dd616e057994ec02092362f0ae7)
2023-12-16 06:17:51 +02:00
Brooks Davis
83c9481db9 libc: remove some obsolete VCS data
These wide char support files were copied from the previous versions
with expanded $FreeBSD$ strings in #if 0 blocks.  Remove them and the
scssid definitions in the same #if 0 blocks.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D42688

(cherry picked from commit 9fc0ff9d85b1497b45a4c6d74e0bc7eea9dcf37b)
2023-12-13 23:08:50 +00:00
Brooks Davis
acf0f65f52 libc: remove unused stub vdso timecounter implementations
All supported architectures have shared page support so remove this
unused stub.

Reviewed by:	imp, kib
Differential Revision:	https://reviews.freebsd.org/D42619

(cherry picked from commit 500bf0592cf1de1d26369efe3877d812f724f5c0)
2023-12-13 22:08:14 +00:00
Brooks Davis
f695db9fba libc: centralize a few numeric symbols
fabs, __infinity, and __nan are universally implemented so declare them
in gen/Symbol.map.

We would also include __flt_rounds, but  it's under FBSD_1.3 on arm so
until that's gone we're stuck with it.  Likewise, everyone but i386
implements fp[gs]etmask.

Reviewed by:	imp, kib, emaste
Differential Revision:	https://reviews.freebsd.org/D42618

(cherry picked from commit c7045186819dbc64c3f005cb1138a1948868cf5a)
2023-12-13 22:08:14 +00:00
Brooks Davis
01edb548c5 libc: centralize makecontext symbols
Declare makecontext() and __makecontext() symbols centrally as they are
always implemented.

Reviewed by:	imp, kib
Differential Revision:	https://reviews.freebsd.org/D42617

(cherry picked from commit 5d79b5445e12873b316a04de352d12a02bfe2d53)
2023-12-13 22:08:14 +00:00
Brooks Davis
ba1279da0f libc: centralize {_,sig,}{set,long}jmp symbols
These symbols are universally exposed and documented so declare them
centrally.  Double- and triple-underscore versions exist on some
platforms, but leave those alone for now.

Reviewed by:	imp, kib
Differential Revision:	https://reviews.freebsd.org/D42616

(cherry picked from commit 1c656143be734de4b1e1bac27c0c48ef4d974510)
2023-12-13 22:08:14 +00:00
Brooks Davis
9d67dced83 libc: centralize ntoh symbols
These are implemented by net/ntoh.c via headers and compiler intrinsics
so declare them in net/Symbol.map.

Reviewed by:	imp, kib, emaste
Differential Revision:	https://reviews.freebsd.org/D42615

(cherry picked from commit ff3a9d8e2909692c73ce9f9279cac2f15848b3f4)
2023-12-13 22:08:14 +00:00
Brooks Davis
e150833764 libc: further centralize syscall symbols
All architectures necessarily implement _exit(2) and vfork(2) so
declare them in sys/Symbol.map.

Reviewed by:	imp, kib, emaste
Differential Revision:	https://reviews.freebsd.org/D42614

(cherry picked from commit e4a1800f06884dc00931f55d0fa8cd9ce473a83e)
2023-12-13 22:08:13 +00:00
Brooks Davis
e0f6b29f6a lib{c,lzma,z}: remove -DSYMBOL_VERSIONING from CFLAGS
This was part of a libkse and libpthread transition aide when libc
gained symbol versions in e62165c8b0
(March 2006).  The code that cared about this macro was removed in
commit 00fb440c1a (May 2007) when symbol
versioning was enabled by default and libthr became the default
threading library.  For unknown reasons, it stayed in libc (which
seemingly never used it) and seems to have been copied to liblzma and
libz.

Reviewed by:	imp, kib, emaste
Differential Revision:	https://reviews.freebsd.org/D42613

(cherry picked from commit e3e9c205ff54aac287309e03a808d9e9ec5c49eb)
2023-12-13 22:08:13 +00:00
Brooks Davis
695639d2f4 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)
2023-12-13 22:08:13 +00:00
Brooks Davis
9a2bee998b libc/<arch>/sys/Makefile.inc: remove cruft
Remove stray blank lines left over from $FreeBSD$ removal as well as
some CVS-era (perhaps pre-repocopy) version comments.

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

(cherry picked from commit b73eace889f1db518a7b0b3372351e0cbf550085)
2023-12-13 22:08:13 +00:00
Dag-Erling Smørgrav
6a2dd26311 hesiod: Modernize.
Reviewed by:	zlei
Differential Revision:	https://reviews.freebsd.org/D42190

(cherry picked from commit 64fc8a936c868345a8f687fe2797474c5fcf35cb)
2023-12-13 17:41:48 +01:00
Brooks Davis
1c63aa2989 procctl.2: improve phrasing for ASLR disable
Reported by:	jrtc27
Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D42364

(cherry picked from commit 4894205482555447c6b3372598c7589a66596724)
2023-12-02 00:03:25 +00:00
Alan Somers
f23f9941f1 aio_read.2: correct the description of aio_buf
Looks like a copypasta from aio_write.2.

[skip ci]

Reported by:	Paul Floyd <pjfloyd@wanadoo.fr>
Sponsored by:	Axcient
Reviewed by:	jilles (manpages)
Differential Revision: https://reviews.freebsd.org/D42621

(cherry picked from commit 04cfe6c12ccc75624dc87ab8f44c4852b16f0c4f)
2023-11-30 13:38:09 -07:00
Alan Somers
60314995ef libc/libc/rpc: refactor some global variables
* Combine dg_fd_locks and dg_cv into one array.
* Similarly for vc_fd_locks and vc_cv
* Turn some macros into inline functions

This is a mostly cosmetic change to make refactoring these strutures in
a future commit easier.

Sponsored by:	Axcient
Reviewed by:	kib
Differential Revision: https://reviews.freebsd.org/D42597

(cherry picked from commit a5c2f4e939430f0048136c39fb9fa6093d401905)

lib/libc/rpc: switch the per-fd structs in clnt_{dg,vc}.c to RB Trees

This saves oodles of memory, especially when "ulimit -n" is large.  It
also prevents a buffer overflow if getrlimit should fail.

Also replace per-fd condvars with mutexes to simplify the code.

PR:		274968
Sponsored by:	Axcient
Reviewed by:	kib
Differential Revision: https://reviews.freebsd.org/D42597

(cherry picked from commit 24938f9311c9c9acc1ce747f4e6a088c2dbc967d)
2023-11-29 20:16:16 -07:00
Warner Losh
4025b5b527 libc: Purge unneeded cdefs.h
These sys/cdefs.h are not needed. Purge them. They are mostly left-over
from the $FreeBSD$ removal. A few in libc are still required for macros
that cdefs.h defines. Keep those.

Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D42385

(cherry picked from commit 559a218c9b257775fb249b67945fe4a05b7a6b9f)
2023-11-26 21:20:09 -07:00
Gordon Bergling
7041faf5a5 Add a HISTORY section for memcpy(3) and mempcpy(3)
The memcpy() function first appeared in AT&T System V UNIX and was
reimplemented for 4.3BSD-Tahoe. The mempcpy() function first appeared in
FreeBSD 13.1.

PR:	272227
Differential Revision:	https://reviews.freebsd.org/D42630

(cherry picked from commit 8c8ffe541eabb23e21ddffb534ecda7ac6d7e04a)
2023-11-25 09:25:03 +01:00
Gordon Bergling
edb6d4f50d getpeerid.3: Clarify the 's' argument
The argument 's' of getpeerid(3) must be a connected UNIX-domain socket,
so document it.

PR:	248614
Differential Revision:	https://reviews.freebsd.org/D42629

(cherry picked from commit fa9f74220146233b7224da7c94870540dc39ae68)
2023-11-21 07:49:28 +01:00
Ed Maste
d2c65a1c94 fflush: correct buffer handling in __sflush
Two additional stdio changes followed 86a16ada1e and need to be
reverted as part of the fflush fix.

This reverts commit 6e13794fbe.
This reverts commit bafaa70b6f.

Fixes: d09a3bf72c0b ("fflush: correct buffer handling in __sflush")
Reviewed by: markj
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D42491

(cherry picked from commit 4e0e01bf6511c28212d7dff94fe131a502e13026)

Approved by:	so
2023-11-07 12:31:34 -05:00
Ed Maste
abe12d2f4c libc: remove unused errno.h include
errno.h was added in 44cf1e5eb4, which has been reverted.

Fixes: d09a3bf72c0b ("fflush: correct buffer handling in __sflush")
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 418f026bd5a5084c1c4e2e91ad38051f6caa928c)

Approved by:	so
2023-11-07 12:29:20 -05:00
Dag-Erling Smørgrav
ba490dfc95 fflush: Add test for buffer handling in __sflush
Sponsored by:	Klara, Inc.

(cherry picked from commit b8dbfb0a6c181a9aeab0b793deb0813d06052df9)

Approved by:	so
2023-11-07 08:38:35 -05:00
Dag-Erling Smørgrav
92709431b1 fflush: correct buffer handling in __sflush
This fixes CVE-2014-8611 correctly.

The commit that purported to fix CVE-2014-8611 (805288c2f0) only hid
it behind another bug.  Two later commits, 86a16ada1e and
44cf1e5eb4, attempted to address this new bug but mostly just confused
the issue.  This commit rolls back the three previous changes and fixes
CVE-2014-8611 correctly.

The key to understanding the bug (and the fix) is that `_w` has
different meanings for different stream modes.  If the stream is
unbuffered, it is always zero.  If the stream is fully buffered, it is
the amount of space remaining in the buffer (equal to the buffer size
when the buffer is empty and zero when the buffer is full).  If the
stream is line-buffered, it is a negative number reflecting the amount
of data in the buffer (zero when the buffer is empty and negative buffer
size when the buffer is full).

At the heart of `fflush()`, we call the stream's write function in a
loop, where `t` represents the return value from the last call and `n`
the amount of data that remains to be written.  When the write function
fails, we need to move the unwritten data to the top of the buffer
(unless nothing was written) and adjust `_p` (which points to the next
free location in the buffer) and `_w` accordingly.  These variables have
already been set to the values they should have after a successful
flush, so instead of adjusting them down to reflect what was written,
we're adjusting them up to reflect what remains.

The bug was that while `_p` was always adjusted, we only adjusted `_w`
if the stream was fully buffered.  The fix is to also adjust `_w` for
line-buffered streams.  Everything else is just noise.

Fixes: 805288c2f0
Fixes: 86a16ada1e
Fixes: 44cf1e5eb4
Sponsored by:	Klara, Inc.

(cherry picked from commit d09a3bf72c0b5f1779c52269671872368c99f02a)

Approved by:	so
2023-11-07 08:38:24 -05:00
Dag-Erling Smørgrav
1e99535be2 fflush: Split a temporary variable in two.
It is clearer to avoid reusing temporary variables for different
purposes.

Sponsored by:	Klara, Inc.

(cherry picked from commit 1f90b4edffe815aebb35e74b79e10593b31f6b75)
2023-11-06 09:41:54 -05:00
John Baldwin
260bab9f1e Purge more stray embedded $FreeBSD$ strings
These do not use __FBSDID but instead use bare char arrays.

Reviewed by:	imp, emaste
Differential Revision:	https://reviews.freebsd.org/D41957

(cherry picked from commit eba230afba4932f02a1ca44efc797cf7499a5cb0)
2023-10-24 10:10:12 -07:00
John Baldwin
5db9e9e296 Remove a few more stray __FBSDID uses
Reviewed by:	imp, emaste
Differential Revision:	https://reviews.freebsd.org/D41954

(cherry picked from commit 16837d353cdde87672d08112610e51e4121c4e50)
2023-10-24 10:08:46 -07:00
Olivier Certner
b018679002 ptrace(2): Disabling: Describe influence of security.bsd.see_jail_proc
Reviewed by:            mhorne, emaste, pauamma_gundo.com
MFC after:              2 weeks
Sponsored by:           Kumacom SAS
Differential Revision:  https://reviews.freebsd.org/D41109

(cherry picked from commit d952820105d6a2ad87ddf3bdc6c5fc5215d13b87)
2023-10-17 16:42:59 -03:00
Ed Maste
6eae573dc2 ptsname.3: accommodate upcoming POSIX Issue 8 ptsname_r
POSIX has accepted a proposal[1] to add glibc-compatible ptsname_r.  It
indicates an error by returning the error number, rather than returning
-1 and setting errno.  Update RETURN VALUES in ptsname_r's man page now
to encourage folks to test that the return value != 0 rather than == -1.

[1] https://www.austingroupbugs.net/bug_view_page.php?bug_id=508

Reported by:	Collin Funk
Reviewed by:	kib
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D42204

(cherry picked from commit a5ed6a815e38d6c622cd97a6020592ded579cf7a)
2023-10-16 13:50:10 -04:00
Ed Maste
2fe06dda0a ktrace.2: correct kern.ktrace.genio_size sysctl name
The man page had `kern.ktrace.geniosize` but the sysctl node contains an
underscore.

PR:		274274
Reported by:	Ivan Rozhuk
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit a572dfa1bfe00cec93b27d8848ca49562cab5e3c)
2023-10-13 10:12:34 -04:00
Dag-Erling Smørgrav
b9c361e4af libc: Rewrite quick_exit() and at_quick_exit() using C11 atomics.
Compiler memory barriers do not prevent the CPU from executing the code
out of order.  Switch to C11 atomics.  This also lets us get rid of the
mutex; instead, loop until the compare_exchange succeeds.

While here, change the return value of at_quick_exit() on failure to
the more traditional -1, matching atexit().

Sponsored by:	Klara, Inc.
Reviewed by:	Olivier Certner, kevans, kib
Differential Revision:	https://reviews.freebsd.org/D41936

(cherry picked from commit 1dc3abb052430279e47c8922d22b30922adcf0f6)

libc: Add a rudimentary test for quick_exit(3).

Sponsored by:	Klara, Inc.
Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D41937

(cherry picked from commit c7dd4601aeebbc1bbe131cbe6747476c124b47fe)
2023-10-05 01:59:43 +02:00
Christos Zoulas
56b09feb23 regcomp: use unsigned char when testing for escapes
- cast GETNEXT to unsigned where it is being promoted to int to prevent
  sign-extension (really it would have been better for PEEK*() and
  GETNEXT() to return unsigned char; this would have removed a ton of
  (uch) casts, but it is too intrusive for now).
- fix an isalpha that should have been iswalpha

PR:		264275, 274032
Reviewed by:	kevans, eugen (previous version)
Obtained from:	NetBSD

(cherry picked from commit 3fb80f1476c7776f04ba7ef6d08397cef6abcfb0)
2023-09-29 20:40:59 -05:00
Dag-Erling Smørgrav
b9b207e4ec Remove mention of defunct mailing list from acl / mac man pages.
Sponsored by:	Klara, Inc.
Reviewed by:	kevans
Differential Revision:	https://reviews.freebsd.org/D41923

(cherry picked from commit b653faaa19c47a4a7e488e5ead738b7ae44ffe8b)

Fix typos in acl_get_entry(3) manual page.

Sponsored by:	Klara, Inc.
Reviewed by:	kevans
Differential Revision:	https://reviews.freebsd.org/D41924

(cherry picked from commit c34fce8a039935e06ed84db1395d7d2c551e5a7c)
2023-09-29 02:28:18 +02:00
Robert Clausecker
efbccec3e0 lib/libc/tests/string/strcspn_test.c: extend tests to catch previous bug
This extends the strcspn() unit tests to catch mistakes in the
implementation that only appear when a mismatch occurs in a certain
position of the string against a certain position of the set.

See also:	52d4a4d4e0dedc72bc33082a3f84c2d0fd6f2cbb
Sponsored by:	The FreeBSD Foundation
Approved by:	imp
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D41821

(cherry picked from commit 601fd768cfd599518f7f9d30592763d1279d336d)
2023-09-23 14:21:42 -04:00
Robert Clausecker
0666c6fc03 lib/libc/amd64/string/memcmp.S: harden against phony buffer lengths
When memcmp(a, b, len) (or equally, bcmp) is called with a phony length
such that a + len < a, the code would malfunction and not compare the
two buffers correctly.  While such arguments are illegal (buffers do not
wrap around the end of the address space), it is neverthless conceivable
that people try things like memcmp(a, b, SIZE_MAX) to compare a and b
until the first mismatch, in the knowledge that such a mismatch exists,
expecting memcmp() to stop comparing somewhere around the mismatch.
While memcmp() is usually written to confirm to this assumption, no
version of ISO/IEC 9899 guarantees this behaviour (in contrast to
memchr() for which it is).

Neverthless it appears sensible to at least not grossly misbehave on
phony lengths.  This change hardens memcmp() against this case by
comparing at least until the end of the address space if a + len
overflows a 64 bit integer.

Sponsored by:	The FreeBSD Foundation
Approved by:	mjg (blanket, via IRC)
See also:	b2618b651b28fd29e62a4e285f5be09ea30a85d4
MFC after:	1 week

(cherry picked from commit 953b93cf24d8871c62416c9bcfca935f1f1853b6)
2023-09-23 14:21:42 -04:00
Robert Clausecker
62f73a711e lib/libc/amd64/string: implement strnlen(3) trough memchr(3)
Now that we have an optimised memchr(3), we can use it to implement
strnlen(3) with better perofrmance.

Sponsored by:	The FreeBSD Foundation
Approved by:	mjg
MFC after:	1 week
MFC to:		stable/14
Differential Revision:	https://reviews.freebsd.org/D41598

(cherry picked from commit 331737281c1929c29e679e48783055351ac4fbd9)
2023-09-23 14:21:37 -04:00
Robert Clausecker
3f78bde932 lib/libc/amd64/string: add memchr(3) scalar, baseline implementation
This is conceptually similar to strchr(3), but there are
slight changes to account for the buffer having an explicit
buffer length.

this includes the bug fix from b2618b6.

Sponsored by:	The FreeBSD Foundation
Reported by:	yuri, des
Tested by:	des
Approved by:	mjg
MFC after:	1 week
MFC to:		stable/14
PR:		273652
Differential Revision:	https://reviews.freebsd.org/D41598

(cherry picked from commit de12a689fad271f5a2ba7c188b0b5fb5cabf48e7)
(cherry picked from commit b2618b651b28fd29e62a4e285f5be09ea30a85d4)
2023-09-23 14:20:28 -04:00
Robert Clausecker
39d500190b lib/libc/amd64/string: add strspn(3) scalar, x86-64-v2 implementation
This is conceptually very similar to the strcspn(3) implementations
from D41557, but we can't do the fast paths the same way.

Sponsored by:	The FreeBSD Foundation
Approved by:	mjg
MFC after:	1 week
MFC to:		stable/14
Differential Revision:	https://reviews.freebsd.org/D41567

(cherry picked from commit 7084133cde6a58412d86bae9f8a55b86141fb304)
2023-09-23 14:20:28 -04:00
Robert Clausecker
73883def32 lib/libc/tests/string: derive strspn(3) tests from strcspn(3) tests
To cover the new optimised amd64 strspn(3) SIMD implementation, extend
the previously written strcspn(3) unit test to also cover strspn(3).

Sponsored by:	The FreeBSD Foundation
Approved by:	mjg
MFC after:	1 week
MFC to:		stable/14
Differential Revision:	https://reviews.freebsd.org/D41567

(cherry picked from commit 468adddd75f6461fcdd2151122d85879ec592a5b)
2023-09-23 14:20:28 -04:00
Robert Clausecker
08eab36169 lib/libc/tests/string: add unit tests for strcspn(3)
We currently use the NetBSD test suite to cover strcspn(3).  It only
contains a very rudimentary test of this function.  This all new set
of unit tests for the FreeBSD test suite should cover many more edge
cases relating to alignment issues.

Sponsored by:	The FreeBSD Foundation
Approved by:	mjg
MFC after:	1 week
MFC to:		stable/14
Differential Revision: https://reviews.freebsd.org/D41557

(cherry picked from commit 35a5359406fe779186d1fd7131c95927fefe20be)
2023-09-23 14:20:28 -04:00
Robert Clausecker
feda2297b7 lib/libc/amd64/string: add strcspn(3) scalar, x86-64-v2 implementation
This changeset adds both a scalar and an x86-64-v2 implementation
of the strcspn(3) function to libc. A baseline implementation does not
appear to be feasible given the requirements of the function.

The scalar implementation is similar to the generic libc implementation,
but expands the bit set into a byte set to reduce latency, improving
performance. This approach could probably be backported to the generic
C version to benefit other platforms.

The x86-64-v2 implementation is built around the infamous pcmpistri
instruction. An alternative implementation based on the Muła/Langdale
algorithm [1] was prototyped, but performed worse than the pcmpistri
approach except for sets of more than 16 characters with long input
strings.

All implementations provide special cases for the empty set (reduces to
strlen as well as single-character sets (reduces to strchr). The
x86-64-v2 kernel falls back to the scalar implementation for sets of
more than 32 characters. This limit could be raised by additional
multiples of 16 through the use of additional pcmpistri code paths, but
I consider this case to be too rare to be of importance.

This includes the bug fix from 52d4a4d.

[1]: http://0x80.pl/articles/simd-byte-lookup.html

Sponsored by:	The FreeBSD Foundation
Approved by:	mjg
MFC after:	1 week
MFC to:		stable/14
Differential Revision:	https://reviews.freebsd.org/D41557

(cherry picked from commit 474408bb7933f0383a0da2b01e717bfe683ae77c)
(cherry picked from commit 52d4a4d4e0dedc72bc33082a3f84c2d0fd6f2cbb)
2023-09-23 14:19:28 -04:00
Ed Maste
f4bb052a78 swapon.2: correct FreeBSD release that introduced swapoff
It was introduced in 92da00bb24, after 5.0 and beforen 5.1.  Reported
in https://github.com/ziglang/zig/issues/16590.

(cherry picked from commit b15f6400376a90d3b00aa3ac00666f683f975376)
2023-09-21 12:52:46 -04:00
Li-Wen Hsu
75e7075fca powerpcspe: Fix build
Copy _fpmath.h from powerpc, which is the same as the one in powerpc64.

Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 604f6bf022cea7e48f3675aa82e756a440716fd9)
2023-09-17 08:43:26 -06:00
Warner Losh
1972e2eba4 msun: LIBCSRCDIR is too fragile, use ${SRCTOP}/lib/libc instead
LIBCSRCDIR is defined in bsd.libnames.mk, which is read in later in the
Makefile than the line:

.if exists(${LIBCSRCDIR}/${MACHINE_ARCH})

so we test to see if /${MARCHIN_ARCH} exists which it usually doesn't
(but did for me since I mounted 13.2R SD image there).  Move to defining
our own LIBC_SRCTOP in terms of SRCTOP to treat these uniformily.

Sponsored by:		Netflix
Reviewed by:		sjg
Differential Revision:	https://reviews.freebsd.org/D41661

(cherry picked from commit b19d8afe4dd205f7d4bfa3282f58b73d504926db)

Approved by: re (cperciva@)
2023-09-17 08:34:41 -06:00
Dag-Erling Smørgrav
c1335a776b libc: Don't assume signed char.
MFC after:	3 days
Reviewed by:	andrew
Differential Revision:	https://reviews.freebsd.org/D41814

(cherry picked from commit 88a9b6e1ed82b562f52bae26b3de257495cd1983)
2023-09-14 08:56:45 +00:00
Mateusz Piotrowski
d2557f02d1 getdirentries.2: Reference dir(5)
As a note, parts of manual pages getdirentries(2) and dir(5) should
probably be consolidated.

MFC after:	3 days

(cherry picked from commit 5b7a776f481891f10820a0b4838d0e0feb60b8ad)
2023-09-12 13:48:18 +02:00