git: 5942b4b6fde3 - main - sys/param.h: Add _WANT_P_OSREL
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 15 Feb 2023 00:44:20 UTC
The branch main has been updated by kib:
URL: https://cgit.FreeBSD.org/src/commit/?id=5942b4b6fde3f4ce6d0295fbcf135f552f92c607
commit 5942b4b6fde3f4ce6d0295fbcf135f552f92c607
Author: Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2023-02-14 08:52:14 +0000
Commit: Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2023-02-15 00:43:18 +0000
sys/param.h: Add _WANT_P_OSREL
Use it instead of defining IN_RTLD by base sources that want P_OSREL_
defines in userspace, but are not rtld.
This allows to remove abuse of IN_RTLD from userspace.
Reviewed by: dchagin, markj, imp
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D38585
---
lib/libc/amd64/sys/amd64_get_fsbase.c | 3 +--
lib/libc/amd64/sys/amd64_get_gsbase.c | 3 +--
lib/libc/amd64/sys/amd64_set_fsbase.c | 3 +--
lib/libc/amd64/sys/amd64_set_gsbase.c | 3 +--
libexec/rtld-elf/amd64/reloc.c | 1 +
libexec/rtld-elf/map_object.c | 1 +
sbin/fsck_ffs/main.c | 2 +-
sbin/newfs/mkfs.c | 2 +-
sys/sys/param.h | 2 +-
9 files changed, 9 insertions(+), 11 deletions(-)
diff --git a/lib/libc/amd64/sys/amd64_get_fsbase.c b/lib/libc/amd64/sys/amd64_get_fsbase.c
index 2de99912daf2..04d872165e32 100644
--- a/lib/libc/amd64/sys/amd64_get_fsbase.c
+++ b/lib/libc/amd64/sys/amd64_get_fsbase.c
@@ -33,9 +33,8 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-#define IN_RTLD 1
+#define _WANT_P_OSREL
#include <sys/param.h>
-#undef IN_RTLD
#include <machine/cpufunc.h>
#include <machine/specialreg.h>
#include <machine/sysarch.h>
diff --git a/lib/libc/amd64/sys/amd64_get_gsbase.c b/lib/libc/amd64/sys/amd64_get_gsbase.c
index 0deac34c90d1..35f69da6ac1e 100644
--- a/lib/libc/amd64/sys/amd64_get_gsbase.c
+++ b/lib/libc/amd64/sys/amd64_get_gsbase.c
@@ -33,9 +33,8 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-#define IN_RTLD 1
+#define _WANT_P_OSREL
#include <sys/param.h>
-#undef IN_RTLD
#include <machine/cpufunc.h>
#include <machine/specialreg.h>
#include <machine/sysarch.h>
diff --git a/lib/libc/amd64/sys/amd64_set_fsbase.c b/lib/libc/amd64/sys/amd64_set_fsbase.c
index 02ca9233d855..9474b1148161 100644
--- a/lib/libc/amd64/sys/amd64_set_fsbase.c
+++ b/lib/libc/amd64/sys/amd64_set_fsbase.c
@@ -33,9 +33,8 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-#define IN_RTLD 1
+#define _WANT_P_OSREL
#include <sys/param.h>
-#undef IN_RTLD
#include <machine/cpufunc.h>
#include <machine/specialreg.h>
#include <machine/sysarch.h>
diff --git a/lib/libc/amd64/sys/amd64_set_gsbase.c b/lib/libc/amd64/sys/amd64_set_gsbase.c
index c4880c126ae9..5ecde27f27f0 100644
--- a/lib/libc/amd64/sys/amd64_set_gsbase.c
+++ b/lib/libc/amd64/sys/amd64_set_gsbase.c
@@ -33,9 +33,8 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-#define IN_RTLD 1
+#define _WANT_P_OSREL
#include <sys/param.h>
-#undef IN_RTLD
#include <machine/cpufunc.h>
#include <machine/specialreg.h>
#include <machine/sysarch.h>
diff --git a/libexec/rtld-elf/amd64/reloc.c b/libexec/rtld-elf/amd64/reloc.c
index c7cf7bd58845..c9a2734853b6 100644
--- a/libexec/rtld-elf/amd64/reloc.c
+++ b/libexec/rtld-elf/amd64/reloc.c
@@ -33,6 +33,7 @@
* John Polstra <jdp@polstra.com>.
*/
+#define _WANT_P_OSREL
#include <sys/param.h>
#include <sys/mman.h>
#include <machine/cpufunc.h>
diff --git a/libexec/rtld-elf/map_object.c b/libexec/rtld-elf/map_object.c
index 4bf32398710d..1ca5fc16477a 100644
--- a/libexec/rtld-elf/map_object.c
+++ b/libexec/rtld-elf/map_object.c
@@ -27,6 +27,7 @@
* $FreeBSD$
*/
+#define _WANT_P_OSREL
#include <sys/param.h>
#include <sys/mman.h>
#include <sys/stat.h>
diff --git a/sbin/fsck_ffs/main.c b/sbin/fsck_ffs/main.c
index 14b5c1076d5e..f7d995a54d1b 100644
--- a/sbin/fsck_ffs/main.c
+++ b/sbin/fsck_ffs/main.c
@@ -43,7 +43,7 @@ static char sccsid[] = "@(#)main.c 8.6 (Berkeley) 5/14/95";
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-#define IN_RTLD /* So we pickup the P_OSREL defines */
+#define _WANT_P_OSREL
#include <sys/param.h>
#include <sys/file.h>
#include <sys/mount.h>
diff --git a/sbin/newfs/mkfs.c b/sbin/newfs/mkfs.c
index 48091d7882d0..56496eacdc7c 100644
--- a/sbin/newfs/mkfs.c
+++ b/sbin/newfs/mkfs.c
@@ -46,7 +46,7 @@ static char sccsid[] = "@(#)mkfs.c 8.11 (Berkeley) 5/3/95";
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-#define IN_RTLD /* So we pickup the P_OSREL defines */
+#define _WANT_P_OSREL
#include <sys/param.h>
#include <sys/disklabel.h>
#include <sys/file.h>
diff --git a/sys/sys/param.h b/sys/sys/param.h
index 751020f6d087..2d5edf9a0b90 100644
--- a/sys/sys/param.h
+++ b/sys/sys/param.h
@@ -94,7 +94,7 @@
#undef __FreeBSD_kernel__
#define __FreeBSD_kernel__
-#if defined(_KERNEL) || defined(IN_RTLD)
+#if defined(_KERNEL) || defined(_WANT_P_OSREL)
#define P_OSREL_SIGWAIT 700000
#define P_OSREL_SIGSEGV 700004
#define P_OSREL_MAP_ANON 800104