Linux Source Compatibility

FreeBSD and Linux are already largely compatible at the source code level due to both being Unix systems and following the same standards. There are however certain system calls specific to Linux; there are also differences in header files, constants and so on. Implementing them in FreeBSD would make porting software easier. This page aims to provide an overview and help track progress.

Not all of those items are fixable. Some differences cannot be eliminated due to naming clashes, disagreements on how the system is supposed to work, or because it would make autoconf pick up a less functional compatibility API instead of the native one. In such cases we should document it and advise what to use instead.

The umbrella ticket is https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=281479.

item

status

prospective users and other notes

AF_NETLINK

(./) Implemented since 13.2

accept4(2)

(./) Implemented since 10.0

clone(2)

/!\ Native missing, but implemented for Linux binaries

NetBSD supports it

close_range(2)

(./) Implemented since 13.0

copy_file_range(2)

(./) Implemented since 13.0

epoll(2)

/!\ Native missing, but implemented for Linux binaries

Use the devel/libepoll-shim userspace wrapper. Let's try not to repeat https://mail-index.netbsd.org/tech-userlevel/2023/07/31/msg014063.html.

eventfd(2)

(./) Implemented since 13.0

futex(2) et al

/!\ Native missing, but implemented for Linux binaries

NetBSD got their own implementation

getauxval(3)

{X} Not implemented

Linux' version of elf_aux_info(3); our API is different as the constants might differ?

getrandom(2)

(./) Implemented since 12.0

getxattr(2) et al

/!\ Native missing, but implemented for Linux binaries

Also supported natively by NetBSD

inotify(2)

{X} Not implemented

Use the devel/libinotify userspace wrapper. NetBSD's Linux compat supports it; might port from there

kcmp(2)

(./) Implemented since 14.1

membarrier(2)

(./) Implemented, but man page missing?

mremap(2)

/!\ Native missing, but implemented for Linux binaries

NetBSD supports it

pidfd_getfd(2) et al

{X} Not implemented

Should map nicely to FreeBSD's existing process descriptors

sched_getcpu(2)

(./) Implemented, but man page missing?

sendmmsg(3) and recvmmsg(3)

(./) Implemented since 11.0

setns(2)

{X} Not implemented

This really includes all of cgroups and namespaces; should be possible to implement it on top of jails

signalfd(2)

{X} Not implemented

splice(2)

{X} Not implemented

timerfd(2)

(./) Implemented since 14.0

Please feel free to add new ones as needed; this includes non-syscall items, like missing headers and unsupported constants. Preferably also mention the name of the software that could use them.

LinuxSourceCompatibility (last edited 2024-09-28T19:53:06+0000 by EdwardTomaszNapierala)