FreeBSD 3.2

Klacke <>
Thu Aug 5 14:31:45 CEST 1999


I've been having some trouble with erlang 47.4.1 + Mnesia on
FreeBSD 3.2. It appears as if pwrite() isn't working
correctly on FreeBSD 3.2.
For example the following program coredumps.

#include <sys/types.h>
#include <sys/uio.h>
#include <unistd.h>
main() { pwrite(0, "abc", 3, 0); exit(0); }

The call to pwrite() should simply fail (0 is not a seekable device), 
not coredump.

Anyway, the dets/mnesia modules uses pwrite() and the autoconf test
just checks that pread exists, not that pwrite works.

I've changed erts/autoconf/configure.in to do just that.

That is:

AC_TRY_RUN([
#include <sys/types.h>
#include <sys/uio.h>
#include <unistd.h>
main() { pwrite(0, "abc", 3, 0); exit(0); }],
pwrite_works=yes, 
pwrite_works=no,)


if test $pwrite_works = yes; then
  AC_DEFINE(HAVE_PREADWRITE)
fi

instead of

AC_CHECK_FUNC(pread, [AC_DEFINE(HAVE_PREADWRITE)])dnl FIXME convbreak


This means that each call to pread/pwrite will be transformed
into a call to seek, followed by a call to read/write. This is
of cource not good, but it's better than a core dump.

Possibly some of the more FreeBSD oriented people here on the
list knows about this problem ?? I can't be the first person
that calls pwrite() on FreeBSD 3.2 !!!! Or is my local system
screwed ??

autoconf complains with "AC_TRY_RUN called without default to allow cross compiling", but I've been told that the error message can be safely ignored.
Furthermore I've only tested this stuff on BSD and Linux.


Cheers

/klacke



More information about the erlang-questions mailing list