tags:

views:

73

answers:

2

Would a very small/simple command line program, programmed in standards compliant C99, and statically compiled on FreeBSD work if executed on Linux ?

(I would test this myself but I do not currently have a separate HDD to test on Linux.)

A: 

Only if FreeBSD and Linux used the exact same syscalls, and did them in the exact same way. I haven't looked into the internals, but that seems unlikely.

cHao
+5  A: 

No, not in general, because the syscall interface is different. However, FreeBSD has a good Linux compatibility layer where you can run Linux binaries (that are compiled against the Linux syscall interface) on FreeBSD. There is such a layer available for both i386 and amd64 binaries.

See Chapter 10: Linux Binary Compatibility of the FreeBSD handbook for more information.

Greg Hewgill