OS X patch for run_erl.c

Peter L <>
Mon Dec 6 13:57:55 CET 2004


This Sunday I discovered that my FreeBSD 4.3 had exactly the same
problem as Sean had in his OS X, with mknod/mkfifo in the run_erl.c
file. When I applied the same patch as Sean did I was able to start
erlang as a daemon, which I had not been able to do before on FreeBSD.

Looking at this file run_erl.c in the latest R10B-1a version of
OTP/Erlang, I was still unable to see any fix for this problem,
despite it being well over a year since Sean reported the problem
the first time.

Is it in Erlang or in FreeBSD / OS X, where the problem needs to be
fixed? Because I guess that Erlang is supposed to support also OS X
and FreeBSD...

A maybe related problem I had, was that I was not able to attach
properly to the erlang daemon with the supplied bin/to_erl. Is there
perhaps another fix that has to be applied for this to work under
FreeBSD or OS X? Sean, any idea?

/Peter

%% ============ From the erlang list archive ===============

    * To: Bengt Kleberg
    * Subject: Re: OS X patch for run_erl.c
    * From: Sean Hinde
    * Date: Fri, 19 Sep 2003 23:46:54 +0100
    * Cc: Erlang Questions

On Monday, September 15, 2003, at 09:07  am, Bengt Kleberg wrote:

> Sean Hinde wrote:
>> Hi,
>> The following patch to run_erl.c is required for Erlang to run in
>> embedded mode under OS X. Without this patch run_erl fails to create
>> the
>
> ...deleted
>> +#ifdef HAVE_MACH_O_DYLD_H
>> +  if ((mkfifo(name, perm) < 0) && (errno != EEXIST))
>> +#else
>> +    if ((mknod(name, S_IFIFO | perm, 0) < 0) && (errno != EEXIST))
>> +#endif
>
> perhaps mkfifo() is deprecated (or something even worse :-), but would
> it not have been better to test like this:
>
> #ifdef HAVE_MKFIFO
> 	if ((mkfifo(name, perm) < 0) && (errno != EEXIST))
> #else
> 	if ((mknod(name, S_IFIFO | perm, 0) < 0) && (errno != EEXIST))
> #endif
>

No doubt. I leave it to the real maintainers of Erlang to take care of
elegance in the build process. All this difficult cross platform C
stuff is light years from anything I claim competence in, beyond the
annoying necessity to occasionally waste many hours making Erlang work
on my favourite laptop :)

Sean


-- 
Peter Lund
Web: http://lundata.se
Tel: +46 70 543 9416



More information about the erlang-questions mailing list