[Buildroot] [PATCH] Raspberry Pi - WiringPi Library Package
g at maral.me
Thu Jul 11 17:55:30 UTC 2013
On Thu, Jul 11, 2013 at 09:42:28AM +0200, Carsten Schoenert wrote:
> Hello Guillermo,
> Am 11.07.2013 08:38, schrieb Guillermo A. Amaral:
> > I searched around for alternative ways around the issue when I first
> > encountered it, it seemed no-oping it would be most portable/safest approach.
> The O_CLOEXEC variable was introduced in 2.6.23.
> > O_CLOEXEC (Since Linux 2.6.23)
> > Enable the close-on-exec flag for the new file descriptor.
> > Specifying this flag permits a program to avoid additional
> > fcntl(2) F_SETFD operations to set the FD_CLOEXEC flag.
> > Additionally, use of this flag is essential in some
> > multithreaded programs since using a separate fcntl(2) F_SETFD
> > operation to set the FD_CLOEXEC flag does not suffice to avoid
> > race conditions where one thread opens a file descriptor at
> > the same time as another thread does a fork(2) plus execve(2).
> So if you use a kernel less then 2.6.23 it make no sense to definess then 2.6.23 it make no sense to define
> O_CLOEXEC to whatever you want, the kernel doesn't know this. And in the
> opposite you can't defined it to some different then already defined for
> The function 'open' can also used without the 3rd parameter.
> So I think you have to check which kernel version is used and build a
> patch which does something like
> #ifdef KERNEL_VER < 2_6_23
> if ((fd = open ("/dev/mem", O_RDWR | O_SYNC) ) < 0)
> if ((fd = open ("/dev/mem", O_RDWR | O_SYNC | O_CLOEXEC) ) < 0)
> The guys from linux-wireless do a lot of this to get the wireless
> package working om dif
The Raspberry Pi doesn't go down to 2.6.y, the oldest supported version is
So there should be no need to do the kernel check, since the package is RPi
The problem here was that O_CLOEXEC was not defined with the default uclibc
and older versions of glibc.
More information about the buildroot