Comment 2 for bug 995301

Revision history for this message
Brian Aker (brianaker) wrote : Re: [Bug 995301] Re: OSX implementation doesn't have O_CLOEXEC Macro

Hi!

Are you sure you want to use FD_CLOEXEC over O_CLOSEXEC? I think you are thinking of fcntl.

Cheers,
 -Brian

On May 5, 2012, at 4:36 PM, Paulo Lellis wrote:

> in time:
>
> I replace the macro O_CLOSEXEC by FD_CLOEXEC as below:
>
> pidfile.cc
> 121 int file;
> 122 if ((file = open(_filename.c_str(), O_CREAT|O_WRONLY|O_TRUNC|FD_CLOEXEC, S_IRWXU|S_IRGRP|S_IROTH)) < 0)
>
> Note that the trink must consider if it's a LINUX or a OSX box.
>
> --
> You received this bug notification because you are subscribed to
> Gearman.
> https://bugs.launchpad.net/bugs/995301
>
> Title:
> OSX implementation doesn't have O_CLOEXEC Macro
>
> Status in Gearman Server and Client Libraries:
> New
>
> Bug description:
> It's usual that the O_CLOEXEC macro definition resides in the file
> 'fcntl.h', usually located at /usr/include/sys/
>
> In the OSX, the equivalent macro is FD_CLOEXEC instead.
>
> In the file $TRUNK/util/pidfile.cc I just replaced the macro and
> everything worked out just well.
>
> I never commit this change to the main trunk. Another option id to add
> the -DFD_CLOEXEC=1 in the makefile definitions.
>
> Regards,
> Lellis
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/gearmand/+bug/995301/+subscriptions