Author: trasz Date: Mon Dec 16 20:07:04 2019 New Revision: 355818 URL: https://svnweb.freebsd.org/changeset/base/355818
Log: Add compat.linux.emul_path, so it can be set to something other than "/compat/linux". Useful when you have several compat directories with different Linux versions and you don't want to clash with files installed by linux-c7 packages. Reviewed by: bcr (manpages) MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D22574 Modified: head/share/man/man4/linux.4 head/sys/amd64/linux/linux_sysvec.c head/sys/amd64/linux32/linux32_sysvec.c head/sys/arm64/linux/linux_sysvec.c head/sys/compat/linux/linux_util.c head/sys/compat/linux/linux_util.h head/sys/i386/linux/linux_sysvec.c Modified: head/share/man/man4/linux.4 ============================================================================== --- head/share/man/man4/linux.4 Mon Dec 16 19:16:26 2019 (r355817) +++ head/share/man/man4/linux.4 Mon Dec 16 20:07:04 2019 (r355818) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 13, 2019 +.Dd December 16, 2019 .Dt LINUX 4 .Os .Sh NAME @@ -95,6 +95,10 @@ variables and .Xr loader 8 tunables: .Bl -tag -width indent +.It Va compat.linux.emul_path +Path to the Linux run-time environment. +Defaults to +.Pa /compat/linux . .It Va compat.linux.osname Linux kernel operating system name. .It Va compat.linux.osrelease Modified: head/sys/amd64/linux/linux_sysvec.c ============================================================================== --- head/sys/amd64/linux/linux_sysvec.c Mon Dec 16 19:16:26 2019 (r355817) +++ head/sys/amd64/linux/linux_sysvec.c Mon Dec 16 20:07:04 2019 (r355818) @@ -836,7 +836,7 @@ static Elf64_Brandinfo linux_glibc2brand = { .brand = ELFOSABI_LINUX, .machine = EM_X86_64, .compat_3_brand = "Linux", - .emul_path = "/compat/linux", + .emul_path = linux_emul_path, .interp_path = "/lib64/ld-linux-x86-64.so.2", .sysvec = &elf_linux_sysvec, .interp_newpath = NULL, @@ -848,7 +848,7 @@ static Elf64_Brandinfo linux_glibc2brandshort = { .brand = ELFOSABI_LINUX, .machine = EM_X86_64, .compat_3_brand = "Linux", - .emul_path = "/compat/linux", + .emul_path = linux_emul_path, .interp_path = "/lib64/ld-linux.so.2", .sysvec = &elf_linux_sysvec, .interp_newpath = NULL, @@ -860,7 +860,7 @@ static Elf64_Brandinfo linux_muslbrand = { .brand = ELFOSABI_LINUX, .machine = EM_X86_64, .compat_3_brand = "Linux", - .emul_path = "/compat/linux", + .emul_path = linux_emul_path, .interp_path = "/lib/ld-musl-x86_64.so.1", .sysvec = &elf_linux_sysvec, .interp_newpath = NULL, Modified: head/sys/amd64/linux32/linux32_sysvec.c ============================================================================== --- head/sys/amd64/linux32/linux32_sysvec.c Mon Dec 16 19:16:26 2019 (r355817) +++ head/sys/amd64/linux32/linux32_sysvec.c Mon Dec 16 20:07:04 2019 (r355818) @@ -992,7 +992,7 @@ static Elf32_Brandinfo linux_brand = { .brand = ELFOSABI_LINUX, .machine = EM_386, .compat_3_brand = "Linux", - .emul_path = "/compat/linux", + .emul_path = linux_emul_path, .interp_path = "/lib/ld-linux.so.1", .sysvec = &elf_linux_sysvec, .interp_newpath = NULL, @@ -1004,7 +1004,7 @@ static Elf32_Brandinfo linux_glibc2brand = { .brand = ELFOSABI_LINUX, .machine = EM_386, .compat_3_brand = "Linux", - .emul_path = "/compat/linux", + .emul_path = linux_emul_path, .interp_path = "/lib/ld-linux.so.2", .sysvec = &elf_linux_sysvec, .interp_newpath = NULL, @@ -1016,7 +1016,7 @@ static Elf32_Brandinfo linux_muslbrand = { .brand = ELFOSABI_LINUX, .machine = EM_386, .compat_3_brand = "Linux", - .emul_path = "/compat/linux", + .emul_path = linux_emul_path, .interp_path = "/lib/ld-musl-i386.so.1", .sysvec = &elf_linux_sysvec, .interp_newpath = NULL, Modified: head/sys/arm64/linux/linux_sysvec.c ============================================================================== --- head/sys/arm64/linux/linux_sysvec.c Mon Dec 16 19:16:26 2019 (r355817) +++ head/sys/arm64/linux/linux_sysvec.c Mon Dec 16 20:07:04 2019 (r355818) @@ -54,6 +54,7 @@ __FBSDID("$FreeBSD$"); #include <compat/linux/linux_ioctl.h> #include <compat/linux/linux_mib.h> #include <compat/linux/linux_misc.h> +#include <compat/linux/linux_util.h> #include <compat/linux/linux_vdso.h> MODULE_VERSION(linux64elf, 1); @@ -494,7 +495,7 @@ static Elf64_Brandinfo linux_glibc2brand = { .brand = ELFOSABI_LINUX, .machine = EM_AARCH64, .compat_3_brand = "Linux", - .emul_path = "/compat/linux", + .emul_path = linux_emul_path, .interp_path = "/lib64/ld-linux-x86-64.so.2", .sysvec = &elf_linux_sysvec, .interp_newpath = NULL, Modified: head/sys/compat/linux/linux_util.c ============================================================================== --- head/sys/compat/linux/linux_util.c Mon Dec 16 19:16:26 2019 (r355817) +++ head/sys/compat/linux/linux_util.c Mon Dec 16 20:07:04 2019 (r355818) @@ -46,11 +46,13 @@ __FBSDID("$FreeBSD$"); #include <sys/proc.h> #include <sys/sdt.h> #include <sys/syscallsubr.h> +#include <sys/sysctl.h> #include <sys/systm.h> #include <sys/vnode.h> #include <machine/stdarg.h> +#include <compat/linux/linux_mib.h> #include <compat/linux/linux_util.h> MALLOC_DEFINE(M_LINUX, "linux", "Linux mode structures"); @@ -58,7 +60,11 @@ MALLOC_DEFINE(M_EPOLL, "lepoll", "Linux events structu MALLOC_DEFINE(M_FUTEX, "futex", "Linux futexes"); MALLOC_DEFINE(M_FUTEX_WP, "futex wp", "Linux futex waiting proc"); -const char linux_emul_path[] = "/compat/linux"; +char linux_emul_path[MAXPATHLEN] = "/compat/linux"; + +SYSCTL_STRING(_compat_linux, OID_AUTO, emul_path, CTLFLAG_RWTUN, + linux_emul_path, sizeof(linux_emul_path), + "Linux runtime environment path"); /* * Search an alternate path before passing pathname arguments on to Modified: head/sys/compat/linux/linux_util.h ============================================================================== --- head/sys/compat/linux/linux_util.h Mon Dec 16 19:16:26 2019 (r355817) +++ head/sys/compat/linux/linux_util.h Mon Dec 16 20:07:04 2019 (r355818) @@ -50,7 +50,7 @@ MALLOC_DECLARE(M_EPOLL); MALLOC_DECLARE(M_FUTEX); MALLOC_DECLARE(M_FUTEX_WP); -extern const char linux_emul_path[]; +extern char linux_emul_path[]; int linux_emul_convpath(struct thread *, const char *, enum uio_seg, char **, int, int); Modified: head/sys/i386/linux/linux_sysvec.c ============================================================================== --- head/sys/i386/linux/linux_sysvec.c Mon Dec 16 19:16:26 2019 (r355817) +++ head/sys/i386/linux/linux_sysvec.c Mon Dec 16 20:07:04 2019 (r355818) @@ -974,7 +974,7 @@ static Elf32_Brandinfo linux_brand = { .brand = ELFOSABI_LINUX, .machine = EM_386, .compat_3_brand = "Linux", - .emul_path = "/compat/linux", + .emul_path = linux_emul_path, .interp_path = "/lib/ld-linux.so.1", .sysvec = &elf_linux_sysvec, .interp_newpath = NULL, @@ -986,7 +986,7 @@ static Elf32_Brandinfo linux_glibc2brand = { .brand = ELFOSABI_LINUX, .machine = EM_386, .compat_3_brand = "Linux", - .emul_path = "/compat/linux", + .emul_path = linux_emul_path, .interp_path = "/lib/ld-linux.so.2", .sysvec = &elf_linux_sysvec, .interp_newpath = NULL, @@ -998,7 +998,7 @@ static Elf32_Brandinfo linux_muslbrand = { .brand = ELFOSABI_LINUX, .machine = EM_386, .compat_3_brand = "Linux", - .emul_path = "/compat/linux", + .emul_path = linux_emul_path, .interp_path = "/lib/ld-musl-i386.so.1", .sysvec = &elf_linux_sysvec, .interp_newpath = NULL, _______________________________________________ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"