Improving the Linux compatibility layer in the FreeBSD kernel

The goal is to update to 2.6.16 compatible Linux syscalls. Without this compatibility, we are not able to update to a more recent linux_base port.

Test equipment

LTP

Very easy to set up:

  1. Install emulators/linux_dist-gentoo-stage3
  2. Get the latest stable release of the LTP and copy it to the gentoo-stage3 directory
  3. cd into /usr/local/gentoo-stage3/, mkdir dev and sys, mount devfs, linprocfs and linsysfs and then do a "chroot /usr/local/gentoo-stage3 bash"
  4. To prepare the LTP extract the tarball, cd into the newly extracted directory and type "./configure && make all install". This will install the LTP into /usr/local/gentoo-stage3/opt/ltp. To choose a different installation path use "make DESTDIR=YOUR_FAVOURITE_PATH install".

  5. cd into the LTP installation directory and initiate a full LTP test run with "./runltp -p -l/var/tmp/results-log -o/var/tmp/results-output -C/var/tmp/results-failed -d/tmp"

Keep an eye on /usr/local/gentoo-stage3/tmp between tests and clean it up. You should also run "ipcs" and remove some leftover (compare before and after each run).

A little funny note: we are even more compatible than a real linux distribution (don't take this literally). LTP 20061222 does not even compile on Ubuntu 6.10. The error message is ../../generate.sh: 60: arith: syntax error: "cnt--" and the line in question is while [ $((cnt--)) -gt 0 ] ; do. If you do a loop unrolling by hand it fails later when you try to run the LTP tests even before it tries the first test. We did not try to proceed further, we want to fix problems on FreeBSD, not on Linux.

Missing stuff

Syscalls

syscall

status

add_key

not started

adjtimex

not started

capget

not started

create_module

will not be implemented

epoll_create

patch available, this syscall is needed by recent firefox-linux versions (e.g. 3.6.10 or 4.0 beta 6), problem with the patch: epoll does not work after fork()ing

epoll_ctl

patch available

epoll_wait

patch available

fadvise64(_64)

not started, used by gnu-sort, ...

fstatfs64

not started

futex

in RELENG_8_0+, problems when swapping out/mmaping etc., no support for clockrt (FUTEX_CLOCK_REALTIME [op=265]), additional patches available

inotify_add_watch

not started

inotify_init

not started, needed by acroread9, problem: unfinished implementation

inotify_rm_watch

not started

io_cancel

not started

io_destroy

not started

io_getevents

not started

io_setup

not started

io_submit

not started

ioprio_get

not started

ioprio_set

not started

keyctl

not started, used by sshd, cron, ...

lookup_dcookie

implemented in RELENG_8_0+

mbind

not started

mincore

not started

pipe2

SVN r234352 freebsd-emulation srv-src-head

ppoll

not started

prctl

partially implemented

pselect6

not started

ptrace

implemented in RELENG_8_0+

quotactl

not started

readahead

implemented in RELENG_8_0+

remap_file_pages

not started

rt_sigqueueinfo

not started

sendfile

not started

sendfile64

implemented in RELENG_8_0+

setfsgid

not started

setfsuid

not started

set_mempolicy

not started

stime

not started

swapoff

not started

sysctl

will probably not be implemented

sysfs

not started

syslog

not started

unshare

not started

vhangup

not started

waitid

not started

The syscalls(2) manual is a list of all syscalls <= linux-2.6-mainline including references to the linux kernel version each syscall first appeared. This document is part of the Linux man-pages project maintained by Michael Kerrisk.

Right now the goal is to catch up with linux-2.6.16 syscall wise. If this goal has been reached the next step will be to reach linux-2.6-mainline syscall compatibility.

IPC

type

name

status

11

LINUX_GETPID

Appears to be implemented?

12

LINUX_GETVAL

Appears to be implemented?

13

LINUX_GETALL

Implemented (in r166008)

17

LINUX_SETALL

Implemented (in r166008)

-257

??

not started, probably a "has to fail" regression test sentinel

ioctl

type

status

used by

0x541c ('T',28)

not implemented

consoletype

0x5801 ('X',1)

not implemented

quake4.x86

0x6d02 ('m',2)

not implemented

dd

0x8905 ('M',5)

not implemented

ltp-20090930 (sockioctl01)

0x8910 ('M',16)

not implemented

quake4.x86, opera 11

0x8914 ('M',20)

not implemented

ltp-20090930 (sockioctl01)

futex operators and flags

operator

status

FUTEX_WAIT

implemented

FUTEX_WAKE

implemented

FUTEX_FD

abandoned in 2006; removed in 2008 (2.6.26)

FUTEX_REQUEUE

?

FUTEX_CMP_REQUEUE

implemented

FUTEX_WAKE_OP

implemented

FUTEX_LOCK_PI

unimplemented

FUTEX_UNLOCK_PI

unimplemented

FUTEX_TRYLOCK_PI

unimplemented

FUTEX_WAIT_BITSET

implemented in 9.0 (r218117)

FUTEX_WAKE_BITSET

implemented in 9.0 (r218117)

FUTEX_WAIT_REQUEUE_PI

unimplemented

FUTEX_CMP_REQUEUE_PI

unimplemented

FUTEX_PRIVATE_FLAG

ignored

FUTEX_CLOCK_REALTIME

ignored

Workarounds

PRs

TODO

in -current

MFC

The following needs to be MFCed (incomplete list):

The following will not be MFCed (maybe incomplete list):

Bugs

A note to users: Feel free to read the following list of things to fix, but do not make conclusions out of it. The linux compatibility environment runs just fine. There are some broken edge cases which don't affect the daily use. The following list is only meaningful for developers. Just because something is marked as a bug, it doesn't mean it doesn't work. It may be the case that some obscure error condition does not return the expected error value, or that a seldomly used feature is not implemented.

Misc

Automated test results

linux-kernel (last edited 2013-03-08 10:29:20 by GavinAtkinson)