Commit Graph

1845 Commits

Author SHA1 Message Date
Konstantin Belousov
fc287f28df posix_spawn(3): add POSIX_SPAWN_DISABLE_ASLR_NP
(cherry picked from commit 822042fdfc)
2024-03-11 02:29:51 +02:00
Gordon Bergling
44f896fc35 dumprestore.h: Fix typos in source code comments
- s/dumpped/dumped/

(cherry picked from commit 8f87d402e3)
2024-03-03 18:50:16 +01:00
Konstantin Belousov
819c2372c1 Add kcmp(2) userspace bits
(cherry picked from commit 211bdd601e)
2024-02-11 03:40:29 +02:00
Jan Beich
4487c6281b resolv: Add a required include to resolv.h
Add a required include to resolv.h for sockaddr_in.  This should reduce
patching required when porting code written with Linux or NetBSD in mind.

PR:		182466
MFC after:	1 week

(cherry picked from commit 58cf91d3b7)
2024-01-15 19:35:35 +09:00
Jose Luis Duran
8e76e04d09 endian.h: Remove duplicate words
Reviewed by:	emaste
Pull Request:	https://github.com/freebsd/freebsd-src/pull/920

(cherry picked from commit dff3a80f6d)
(cherry picked from commit 4e1deb61ea)
2024-01-07 15:41:47 -05:00
Alan Somers
ad8b59ffe7 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 a5c2f4e939)

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 24938f9311)
2023-11-30 13:42:55 -07:00
John Baldwin
37ba303aa0 Trim various $FreeBSD$
Approved by:	markj (cddl/contrib changes)
Reviewed by:	imp, emaste
Differential Revision:	https://reviews.freebsd.org/D41961

(cherry picked from commit f53355131f)
2023-10-24 11:23:57 -07:00
Dag-Erling Smørgrav
8444b36420 time.h: Fix visibility check for C11 and C23 features.
__BSD_VISIBLE is always defined; we need to check if it's true.

Fixes:		d02489d11a 9b5d724cad
MFC after:	3 days
Reviewed by:	brooks, imp
Differential Revision:	https://reviews.freebsd.org/D41733

(cherry picked from commit 8091b82e29)
2023-09-14 16:59:52 +02:00
Warner Losh
636cb7f7b0 Remove $FreeBSD$: one-line xdr pattern
Remove /^\s*%\s*__FBSDID\("\$FreeBSD\$"\);?\s*\n/

Similar commit in main:
(cherry picked from commit 9524e274b5)
2023-08-23 11:43:34 -06:00
Warner Losh
023fc80ee3 Remove $FreeBSD$: one-line sh pattern
Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/

Similar commit in main:
(cherry picked from commit d0b2dbfa0e)
2023-08-23 11:43:30 -06:00
Warner Losh
8ad303d68c Remove $FreeBSD$: one-line .c comment pattern
Remove /^/[*/]\s*\$FreeBSD\$.*\n/

Similar commit in main:
(cherry picked from commit 2a63c3be15)
2023-08-23 11:43:23 -06:00
Warner Losh
34041aac83 Remove $FreeBSD$: one-line .h pattern
Remove /^\s*\*+\s*\$FreeBSD\$.*$\n/

Similar commit in main:
(cherry picked from commit 42b388439b)
2023-08-23 11:43:22 -06:00
Warner Losh
17da660ad5 Remove $FreeBSD$: two-line .h pattern
Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/

Similar commit in main:
(cherry picked from commit b3e7694832)
2023-08-23 11:43:21 -06:00
Warner Losh
58f593fbb8 spdx: Simplify BSD-2-Clause AND BSD-2-Clause
After removing the -FreeBSD and -NetBSD, we're left with a nuber of
BSD-2-Clause AND BSD-2-Clause, so tidy that up.

Discussed with:		pfg
MFC After:		3 days
Sponsored by:		Netflix

(cherry picked from commit eebd9d5366)
2023-07-25 09:17:00 -06:00
Warner Losh
f73b4bf27c spdx: The BSD-2-Clause-NetBSD identifier is obsolete, drop -NetBSD
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

(cherry picked from commit b61a573019)
2023-07-25 09:15:32 -06:00
Warner Losh
caa41f6417 spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD
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

(cherry picked from commit 4d846d260e)
2023-07-25 09:13:49 -06:00
Alexander V. Chernikov
acaed6b1e2 netlink: add headers installation
(cherry picked from commit 11ca01e9aa)
2023-02-14 12:32:03 +00:00
Warner Losh
1dd126163b byteswap.h: Add a glibc/linux compatible byteswap.h
For endian.h to work instead of sys/endian.h, some software needs
byteswap.h available. It must define {__,}byteswap_{16,32,64}.
Included sys/_endian.h to get an appropriate __byteswap16, etc
and defines the new macros in terms of them. Enhance _endian.h
to allow it to be included from here too.

Sponsored by:		Netflix
Reviewed by:		markj
Differential Revision:	https://reviews.freebsd.org/D32051

(cherry picked from commit 1761b09bf4)
2023-01-24 16:26:28 -07:00
Warner Losh
1004da283d linux: For better compatibility, provide compatible endian.h
Add endian.h. This includes sys/endian.h and then adds extra defines
that glibc defines with double underscores for our
_{BIG,BYTE,LITTLE,PDP}_ENDIAN macros. We also define __FLOAT_WORD_ORDER
to be the same as _BYTE_ENDIAN since FreeBSD doesn't currently define
this, and the default with glibc is exactly this for our platforms.
Move common parts of endian.h and sys/endian.h into sys/_endian.h
to limit namespace pollution from endian.h

All this gives us good compatibility with Linux. There may be one or two
upstreams that haven't integrated the patches I tried to send up.

There are some minor differences:
	o The extra glibc macros are not defined. These are all
	  controlled with either __ at the start, or only defined
	  when glibc is being built. We also don't define macros
	  that are used internally in glibc that would pollute
	  the namespace.
	o For complete compatibility, this change must also be
	  paired with providing a glibc-compatible byteswap.h.

Sponsored by:		Netflix
Reviewed by:		mhorne, markj, jhb
Differential Revision:	https://reviews.freebsd.org/D31962

(cherry picked from commit 30e0d2a510)
2023-01-24 16:26:28 -07:00
Mike Karels
f395174bbb getaddrinfo: distinguish missing addrs from unresolvable names
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

(cherry picked from commit 1443613866)
2022-12-03 09:16:46 -06:00
Mike Karels
870d2ff305 netdb.h: re-enable EAI_ADDRFAMILY, EAI_NODATA
EAI_ADDRFAMILY and EAI_NODATA are not in RFC 3493, but are available
and used in many other systems.  It is desirable to have at least one
of them in order to distinguish between names that do not resolve and
those that do not have the requested address type.  A change to
getaddrinfo() will use EAI_ADDRFAMILY.  Both were "#if 0"; re-enable,
conditioned on __BSD_VISIBLE, and update comments.  Also add comments
and __BSD_VISIBLE conditional for the last three EAI errors, which
are not in the RFC or POSIX.  Note, all of these are available in
NetBSD and OpenBSD, and EAI_ADDRFAMILY and EAI_NODATA are available
in Linux (glibc).

Reviewed in https://reviews.freebsd.org/D37139 with related changes.

Reviewed by:	bz

(cherry picked from commit 40e4e12bd8)
2022-12-03 09:15:50 -06:00
Dag-Erling Smørgrav
48aa2fa71b libc: Don't warn about RRSIG replies.
PR:		213178
MFC after:	1 week
Differential Revision: https://reviews.freebsd.org/D37303

(cherry picked from commit 817f1f3064)
2022-11-14 12:23:32 +01:00
Kyle Evans
2b20cade1e include: put includes into -dev packages
The includes build is kind of funky, as we support either copying or
symlinking files into /usr/include.  For `copies`, we were supplying
the include/ ${TAG_ARGS}, which puts packages into `FreeBSD-runtime`,
without any consideration to the fact that we're installing headers.

Let's copy the approach that the `symlinks` target uses for now, and
add ",dev" to the TAG_ARGS so that headers at least end up in
FreeBSD-runtime-dev, which is more appropriate.  Some of these includes
are actually technically supposed to be in *other* packages and their
INCSGROUP's PACKAGE setting is actually correct, but this is less
trivial to solve.  This is a bandaid to fix the immediate problem of
some headers ending up in two different packages.

PR:		267526
Reviewed by:	dfr, manu
Differential Revision:	https://reviews.freebsd.org/D37256

(cherry picked from commit 8b8babf044)
2022-11-12 23:38:22 -06:00
John Baldwin
5ae69e2f10 Import the WireGuard driver from zx2c4.com.
This commit brings back the driver from FreeBSD commit
f187d6dfbf plus subsequent fixes from
upstream.

Relative to upstream this commit includes a few other small fixes such
as additional INET and INET6 #ifdef's, #include cleanups, and updates
for recent API changes in main.

Reviewed by:	pauamma, gbe, kevans, emaste
Obtained from:	git@git.zx2c4.com:wireguard-freebsd @ 3cc22b2
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D36909

(cherry picked from commit 744bfb2131)
2022-11-11 13:44:11 -08:00
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
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
f8a926bebe libc: add scandirat(3)
(cherry picked from commit 9fb8e8eede)
2022-08-31 04:20:28 +03:00
John Baldwin
b2127b6f1a Install unwind.h into /usr/include
Install headers from LLVM's libunwind in place of the headers from
libcxxrt and allow C applications to use the library.

As part of this, remove include/unwind.h and switch libthr over to
using the installed unwind.h.

Reviewed by:	dim, emaste
MFC after:	10 days
Differential Revision: https://reviews.freebsd.org/D34065

(cherry picked from commit c00d345665)
2022-02-20 13:29:44 +01:00
John Baldwin
62d39fb7c0 Change the return value of _Unwind_GetCFA in include/unwind.h.
I tested the original commit as part of a series that culminates in
removing this header and installing LLVM libunwind's unwind.h in its
place so missed updating this header as was done in b84693501a.

Pointy hat to:	jhb
Reported by:	kevans
Fixes:		3a502289d3 Use uintptr_t for return type of _Unwind_GetCFA.

(cherry picked from commit 522f538354)
2022-02-20 13:29:09 +01:00
John Baldwin
ad16681721 Use an unsigned 64-bit integer for exception class.
This matches the type in other unwind headers (LLVM libunwind,
libcxxrt, glibc).

NB: include/unwind.h is not installed but is only used by libthr

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

(cherry picked from commit b84693501a)
2022-02-20 13:28:58 +01:00
Ed Maste
59f9aad937 Remove 'All Rights Reserved' from xlocale FreeBSD Foundation copyrights
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 301d1de6ba)
2022-02-09 12:39:50 -05:00
Cy Schubert
5729ebba33 ipfilter: Move kernel bits to netpfil
Through fixes and improvements our ipfilter sources have diverged
enough to warrant move from contrib into sys/netpil. Now that I'm
planning on implementing MSS clamping as in iptables it makes more
sense to move ipfilter to netpfil.

This is the first of three commits the ipfilter move.

Suggested by glebius on two occaions.

Suggested by and discussed with:	glebius
Reviewed by:				glebius, kp (for #network)
Differential Revision:		https://reviews.freebsd.org/D33510

(cherry picked from commit 3b9b51fe46)
2022-02-07 05:51:14 -08:00
Stefan Eßer
379bfb2aa9 sys/bitset.h: reduce visibility of BIT_* macros
(cherry picked from commit 5e04571cf3)
2022-01-14 18:17:30 +02:00
David CARLIER
86227aa975 sched.h: Use pid_t type for pid argument
(cherry picked from commit 65dd321054)
2022-01-14 18:17:30 +02:00
Konstantin Belousov
58865d5f8d sched.h: Hide all Linux compat sched_* functions under _WITH_CPU_SET_T
(cherry picked from commit 90fa9705d5)
2022-01-14 18:17:29 +02:00
Konstantin Belousov
a48d9f1900 Add sched_getcpu()
(cherry picked from commit 77b2c2f814)
2022-01-14 18:17:29 +02:00
Konstantin Belousov
526f94cc0e Add sched_get/setaffinity(3)
(cherry picked from commit 43736b71dd)
2022-01-14 18:17:29 +02:00
Konstantin Belousov
b9d131feb3 Add real sched.h
(cherry picked from commit 160b4b922b)
2022-01-14 18:17:29 +02:00
Konstantin Belousov
1791debf4a swapoff: add one more variant of the syscall
For MFC, COMPAT_FREEBSD13 braces were removed.

(cherry picked from commit 5346570276)
2021-12-20 02:29:11 +02:00
Konstantin Belousov
54cdfdf12a posix_spawn: add closefrom non-portable action
(cherry picked from commit a18ddf7757)
2021-12-07 02:25:55 +02:00
Konstantin Belousov
c7b624979a posix_spawn: add chdir-related non-portable actions
(cherry picked from commit 25cda42a49)
2021-12-07 02:25:53 +02:00
Steve Kargl
4ac2d43111 Implementations of cexpl()
PR:	216862

(cherry picked from commit 046e2d5db1)
2021-11-10 21:36:20 +02:00
Warner Losh
d7535fb3e3 time.h: reduce CLOCK_ namespace pollution, move to _clock_id.h
Attempt to comply with the strict namespace pollution requirements of
_POSIX_C_SOURCE. Add guards to limit visitbility of CLOCK_ and TIMER_
defines as appropriate. Only define the CLOCK_ variables relevant to the
specific standards. Move all the sharing to sys/_clock_id.h and make
time.h and sys/time.h both include that rather than copy due to the
now large number of clocks and compat defines.

Please note: The old time.h previously used these newer dates:
	CLOCK_REALTIME			199506
	CLOCK_MONOTONIC			200112
	CLOCK_THREAD_CPUTIME_ID		200112
	CLOCK_PROCESS_CPUTIME_ID	200112

but glibc defines all of these for 199309. glibc uses this date for all
these values, however, only CLOCK_REALTIME was in IEEE 1003.1b. Add a
comment about this to document it. A large number of programs and
libraries assume that these will be defined for _POSIX_C_SOURCE =
199309.

In addition, leak CLOCK_UPTIME_FAST for the pocl package until it can be
updated to use a simple CLOCK_MONOTONIC.

Reviewed by:		kib
Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D31056

(cherry picked from commit 7b797ba27a)
2021-09-12 09:56:16 -06:00
Konstantin Belousov
1c54a109d7 Add _Fork()
(cherry picked from commit 49ad342cc1)
2021-08-12 15:37:54 +03:00
Konstantin Belousov
dba677d13b libc: add mempcpy(3) and wmempcpy(3)
(cherry picked from commit ee37f64cf8)
2021-07-22 13:33:10 +03:00
Emmanuel Vadot
ba56ee36eb Fix build with WITHOUT_AUDIT=yes in src.conf
Always install the audit related includes are some part of the source
always requires them.

Reported by:	many
Fixes:	8c3eaf244a

(cherry picked from commit f41efc453a)
2021-07-03 10:20:02 +02:00
Emmanuel Vadot
577dfb1ca1 pkgbase: Install all cam includes with INCS
Now they are correctly taggued and put into the -dev package

Reviewed by:	bapt
Differential Revision:	https://reviews.freebsd.org/D29166
MFC after:      2 weeks
2021-06-30 09:24:29 +02:00
Emmanuel Vadot
4074502552 pkgbase: Install all BSM includes with INCS
Now they are correctly taggued and put them into the libbsm package

Reviewed by:	bapt
Differential Revision:	https://reviews.freebsd.org/D29165
MFC after:      2 weeks
2021-06-30 09:24:29 +02:00
John Baldwin
77ffc9399d Stop installing kernel-only crypto headers to /usr/include/crypto.
The only user-facing header from OCF is <crypto/cryptodev.h>.

Sponsored by:	Chelsio Communications

(cherry picked from commit afbee98232)
(cherry picked from commit 2fc640d5bc)
(cherry picked from commit 283352dd4f)
(cherry picked from commit 9946b2f4e0)
(cherry picked from commit 7af04dff02)
2021-03-29 16:23:36 -07:00
Konstantin Belousov
73dc6674e0 Remove __NO_TLS.
MFC note: this plus the merge of two preliminary removal of __NO_TLS
definitions for mips and risc-v break ABI.  It was decided that doing
ABI break on tier 2 platforms at this stage of 13.0 release process is
better than drag on __NO_TLS presence for the 13.x branch lifetime.

(cherry picked from commit 3ae8d83d04)
2021-03-02 02:49:42 +02:00