1e6769554SRui Paulo.\" Copyright (c) 2000 Sheldon Hearn 2e6769554SRui Paulo.\" All rights reserved. 3e6769554SRui Paulo.\" 4e6769554SRui Paulo.\" Redistribution and use in source and binary forms, with or without 5e6769554SRui Paulo.\" modification, are permitted provided that the following conditions 6e6769554SRui Paulo.\" are met: 7e6769554SRui Paulo.\" 1. Redistributions of source code must retain the above copyright 8e6769554SRui Paulo.\" notice, this list of conditions and the following disclaimer. 9e6769554SRui Paulo.\" 2. Redistributions in binary form must reproduce the above copyright 10e6769554SRui Paulo.\" notice, this list of conditions and the following disclaimer in the 11e6769554SRui Paulo.\" documentation and/or other materials provided with the distribution. 12e6769554SRui Paulo.\" 13e6769554SRui Paulo.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 14e6769554SRui Paulo.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 15e6769554SRui Paulo.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 16e6769554SRui Paulo.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 17e6769554SRui Paulo.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 18e6769554SRui Paulo.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 19e6769554SRui Paulo.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 20e6769554SRui Paulo.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 21e6769554SRui Paulo.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 22e6769554SRui Paulo.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 23e6769554SRui Paulo.\" SUCH DAMAGE. 24e6769554SRui Paulo.\" 25e6769554SRui Paulo.\" $FreeBSD$ 26e6769554SRui Paulo.\" 27*8c5059e9SEdward Tomasz Napierala.Dd June 10, 2020 28c383d55bSGavin Atkinson.Dt LINUX 4 29e6769554SRui Paulo.Os 30e6769554SRui Paulo.Sh NAME 31e6769554SRui Paulo.Nm linux 32e6769554SRui Paulo.Nd Linux ABI support 33e6769554SRui Paulo.Sh SYNOPSIS 3439eb4bc6SBernhard SchmidtTo compile support for this ABI into an i386 kernel 35e6769554SRui Pauloplace the following line in your 36e6769554SRui Paulokernel configuration file: 37e6769554SRui Paulo.Bd -ragged -offset indent 38e6769554SRui Paulo.Cd "options COMPAT_LINUX" 39e6769554SRui Paulo.Ed 40e6769554SRui Paulo.Pp 4139eb4bc6SBernhard Schmidtfor an amd64 kernel use: 4239eb4bc6SBernhard Schmidt.Bd -ragged -offset indent 4339eb4bc6SBernhard Schmidt.Cd "options COMPAT_LINUX32" 4439eb4bc6SBernhard Schmidt.Ed 4539eb4bc6SBernhard Schmidt.Pp 46e6769554SRui PauloAlternatively, to load the ABI as a 47e6769554SRui Paulomodule at boot time, place the following line in 48e6769554SRui Paulo.Xr loader.conf 5 : 49e6769554SRui Paulo.Bd -literal -offset indent 50e6769554SRui Paulolinux_load="YES" 51e6769554SRui Paulo.Ed 52e6769554SRui Paulo.Sh DESCRIPTION 53e6769554SRui PauloThe 54e6769554SRui Paulo.Nm 55f54d9519SEdward Tomasz Napieralamodule provides limited Linux ABI (application binary interface) compatibility, 56f54d9519SEdward Tomasz Napieralamaking it possible to run many unmodified Linux applications and libraries 57f54d9519SEdward Tomasz Napieralawithout the need for virtualization or emulation. 58f54d9519SEdward Tomasz NapieralaSome of the facilities provided are: 59e6769554SRui Paulo.Bl -bullet 60e6769554SRui Paulo.It 61e6769554SRui PauloAn image activator 62e6769554SRui Paulofor correctly branded 63e6769554SRui Paulo.Xr elf 5 64e6769554SRui Pauloexecutable images 65e6769554SRui Paulo.It 66e6769554SRui PauloSpecial signal handling for activated images 67e6769554SRui Paulo.It 68e6769554SRui PauloLinux to native system call translation 69f54d9519SEdward Tomasz Napierala.It 70f54d9519SEdward Tomasz NapieralaLinux-specific system calls 71e6769554SRui Paulo.El 72e6769554SRui Paulo.Pp 73f54d9519SEdward Tomasz NapieralaNote that dynamically linked Linux executables 74f54d9519SEdward Tomasz Napieralawill require a suitable environment in 75f54d9519SEdward Tomasz Napierala.Pa /compat/linux . 76f54d9519SEdward Tomasz NapieralaThis includes native Linux shared libraries, and Linux-specific virtual 77f54d9519SEdward Tomasz Napieralafilesystems. 78f54d9519SEdward Tomasz NapieralaTo set it up, install the 79f54d9519SEdward Tomasz Napierala.Pa emulators/linux_base-c7 80f54d9519SEdward Tomasz Napieralaport or the linux_base-c7 81f54d9519SEdward Tomasz Napieralapackage, and add the following line to the 82f54d9519SEdward Tomasz Napierala.Xr rc.conf 5 83f54d9519SEdward Tomasz Napieralafile: 84e6769554SRui Paulo.Pp 85f54d9519SEdward Tomasz Napierala.Dl linux_enable="YES" 86f54d9519SEdward Tomasz Napierala.Pp 87f54d9519SEdward Tomasz NapieralaTo avoid mounting Linux-specific filesystems at startup, also add the following 88f54d9519SEdward Tomasz Napieralaline: 89f54d9519SEdward Tomasz Napierala.Pp 90f54d9519SEdward Tomasz Napierala.Dl linux_mounts_enable="NO" 91f54d9519SEdward Tomasz Napierala.Sh SYSCTL VARIABLES 92f54d9519SEdward Tomasz NapieralaThe following variables are available as both 93e6769554SRui Paulo.Xr sysctl 8 94f54d9519SEdward Tomasz Napieralavariables and 95f54d9519SEdward Tomasz Napierala.Xr loader 8 96f54d9519SEdward Tomasz Napieralatunables: 97f54d9519SEdward Tomasz Napierala.Bl -tag -width indent 98*8c5059e9SEdward Tomasz Napierala.It Va compat.linux.default_openfiles 99*8c5059e9SEdward Tomasz NapieralaDefault soft openfiles resource limit for Linux applications. 100*8c5059e9SEdward Tomasz NapieralaSet to -1 to disable the limit. 101*8c5059e9SEdward Tomasz NapieralaDefaults to 1024. 102b5f20658SEdward Tomasz Napierala.It Va compat.linux.emul_path 103b5f20658SEdward Tomasz NapieralaPath to the Linux run-time environment. 104b5f20658SEdward Tomasz NapieralaDefaults to 105b5f20658SEdward Tomasz Napierala.Pa /compat/linux . 106f54d9519SEdward Tomasz Napierala.It Va compat.linux.osname 107e6769554SRui PauloLinux kernel operating system name. 108f54d9519SEdward Tomasz Napierala.It Va compat.linux.osrelease 109e6769554SRui PauloLinux kernel operating system release. 110e6769554SRui PauloChanging this to something else is discouraged on non-development systems, 111e6769554SRui Paulobecause it may change the way Linux programs work. 112e6769554SRui PauloRecent versions of GNU libc are known to use different syscalls depending 113e6769554SRui Pauloon the value of this sysctl. 114f54d9519SEdward Tomasz Napierala.It Va compat.linux.oss_version 115e6769554SRui PauloLinux Open Sound System version. 1162cf9eb6cSEdward Tomasz Napierala.It Va compat.linux.preserve_vstatus 1172cf9eb6cSEdward Tomasz NapieralaWhen set to 1, it prevents Linux applications from resetting the 1182cf9eb6cSEdward Tomasz Napierala.Xr termios 4 1192cf9eb6cSEdward Tomasz NapieralaVSTATUS setting. 1202cf9eb6cSEdward Tomasz NapieralaFrom a user perspective, this makes 1212cf9eb6cSEdward Tomasz Napierala.Va SIGINFO 1222cf9eb6cSEdward Tomasz Napieralawork for Linux executables. 1232cf9eb6cSEdward Tomasz NapieralaDefaults to 0. 124e6769554SRui Paulo.Sh FILES 125f54d9519SEdward Tomasz Napierala.Bl -tag -width /compat/linux/dev/shm -compact 126e6769554SRui Paulo.It Pa /compat/linux 127e6769554SRui Paulominimal Linux run-time environment 12877d3337cSDmitry Chagin.It Pa /compat/linux/dev/fd 129f54d9519SEdward Tomasz Napieralafile-descriptor file system, see 130f54d9519SEdward Tomasz Napierala.Xr fdescfs 5 131f54d9519SEdward Tomasz Napierala.It Pa /compat/linux/dev/shm 132f54d9519SEdward Tomasz Napieralain-memory file system, see 133f54d9519SEdward Tomasz Napierala.Xr tmpfs 5 134e6769554SRui Paulo.It Pa /compat/linux/proc 135f54d9519SEdward Tomasz NapieralaLinux process file system, see 136f54d9519SEdward Tomasz Napierala.Xr linprocfs 5 137e6769554SRui Paulo.It Pa /compat/linux/sys 138f54d9519SEdward Tomasz NapieralaLinux kernel objects file system, see 139f54d9519SEdward Tomasz Napierala.Xr linsysfs 5 140e6769554SRui Paulo.El 141e6769554SRui Paulo.Sh SEE ALSO 142e6769554SRui Paulo.Xr brandelf 1 , 143fd2ced61SEdward Tomasz Napierala.Xr pty 4 , 144e6769554SRui Paulo.Xr elf 5 , 14577d3337cSDmitry Chagin.Xr fdescfs 5 , 146e6769554SRui Paulo.Xr linprocfs 5 , 147f54d9519SEdward Tomasz Napierala.Xr linsysfs 5 , 148f54d9519SEdward Tomasz Napierala.Xr tmpfs 5 149e6769554SRui Paulo.Sh HISTORY 150e6769554SRui PauloLinux ABI support first appeared in 151e6769554SRui Paulo.Fx 2.1 . 152f54d9519SEdward Tomasz Napierala.Sh BUGS 153f54d9519SEdward Tomasz NapieralaSupport for some of the Linux-specific system calls and system call arguments 154f54d9519SEdward Tomasz Napieralais missing. 155