Am Donnerstag, 10. Januar 2008 16:38:47 schrieb Michael S:
> I am a computer science student taking the operating
> systems course. All of our assignments are supposed
> run on Linux and I don't have
> a Linux machine.
> I was wondering mostly if FreeBSD uses the same
> functions for process / thread handling, whether the
> header files (e.g. unistd.h, stdlib.h, etc) are in the
> same locations
> and whether the pthread library is present by default.
Whereas both systems could be termed mostly POSIX compliant (and thus you
should be able to recompile program sources freely on each of the two without
modifications to the source and get equal behaviour), FreeBSD's libc and
kernel is (in my experience) more and the glibc (i.e., the most commonly used
libc on Linux) and the Linux kernel generally somewhat less close/compliant
to the specification in border- or seldom used cases.
This includes (for example) the (still, IIRC) default pthreads implementation
on Linux (called LinuxThreads, even though a new/"better" threads
implementation has been available for quite some time, called NPTL), which
doesn't properly support thread cancellation (or rather doesn't support them
at all), and only implements a subset of the POSIX.1c (i.e., POSIX Threads)
specification. FreeBSDs pthreads library is fully POSIX.1c compliant, IIRC.
Some other things which I've hit when recompiling programs I implemented on
FreeBSD for Linux generally concern more "esoteric" differences, like glibc
missing a sys/endian.h (which is a heavens gift), but sys/endian.h isn't part
of the POSIX standard anyway.
What's not so "esoteric" though: socket behaviour isn't specified in the POSIX
standard either; if you implement networking programs, you'll soon find that
for example the error return values differ slightly between the two operating
systems, making proper error recovery all the harder. Preprocessor macros are
your friend, even in C++.
For the rest, the compiler/linker-toolchain you'll use under Linux is (most
probably) the exact same as under FreeBSD (i.e., gcc + GNU binutils), and as
such you'll not have to expect any problems here. Concerning make: if you
stick to writing GNU make Makefiles under FreeBSD, you'll also be on the safe
side there, because I've yet to find a properly functioning BSD make
implementation for Linux. Finally: stay away from the "autotools" if you can.
They make your brain cringe.
And, to finish up: generally you'll not feel the differences. And if you do,
you've (most probably) hit operating system specific (i.e., non
POSIX-specified) behaviour, anyway, and were on your own from the start.
Product & Application Development
email@example.com mailing list
To unsubscribe, send any mail to "[EMAIL PROTECTED]"