From: Carsten Schoenert <c.schoenert@gmail.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH] Raspberry Pi - WiringPi Library Package
Date: Thu, 11 Jul 2013 09:42:28 +0200 [thread overview]
Message-ID: <51DE61E4.7030400@googlemail.com> (raw)
In-Reply-To: <20130711063845.GA7655@enterprise.localdomain>
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 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
O_CLOEXEC.
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)
#else
if ((fd = open ("/dev/mem", O_RDWR | O_SYNC | O_CLOEXEC) ) < 0)
#endif
The guys from linux-wireless do a lot of this to get the wireless
package working om different kernel versions.
Regards
Carsten
next prev parent reply other threads:[~2013-07-11 7:42 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CAPeEpDpMY2sRjGdd+TgPz5S--Pws+5hUNrV8jpiznxBqFZ7zDg@mail.gmail.com>
2013-07-11 5:17 ` [Buildroot] [PATCH] Raspberry Pi - WiringPi Library Package Guillermo A. Amaral
2013-07-11 5:19 ` Guillermo A. Amaral
2013-07-11 5:33 ` Baruch Siach
2013-07-11 6:00 ` Guillermo A. Amaral
2013-07-11 6:04 ` Baruch Siach
2013-07-11 6:38 ` Guillermo A. Amaral
2013-07-11 7:42 ` Carsten Schoenert [this message]
2013-07-11 17:55 ` Guillermo Amaral
2013-07-11 18:06 ` Baruch Siach
2013-07-11 18:22 ` Guillermo Amaral
2013-07-12 3:24 ` Baruch Siach
2013-07-12 4:30 ` Guillermo Amaral
2013-07-12 6:47 ` Baruch Siach
2013-07-12 6:54 ` Guillermo A. Amaral
2013-07-10 7:12 Guillermo A. Amaral
2013-07-10 9:26 ` Thomas Petazzoni
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=51DE61E4.7030400@googlemail.com \
--to=c.schoenert@gmail.com \
--cc=buildroot@busybox.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox