[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    Re: [PATCH v2 1/2] time applet: fix a build problem with kernel versions missing O_CLOEXEC symbol
From:       Denys Vlasenko <vda.linux () googlemail ! com>
Date:       2017-10-27 17:07:16
Message-ID: CAK1hOcMFsdypqsrzUqXUs1dRdju6FadNSsEN-dKDi7kpweXu=g () mail ! gmail ! com
[Download RAW message or body]

On Thu, Oct 19, 2017 at 12:05 AM, Eugene Rudoy <gene.devel@gmail.com> wrote:
> Kernel versions < 2.6.23 do not support/provide O_CLOEXEC symbol
> causing the time applet not to compile:
>
>  time.c: In function 'time_main':
>  time.c:445:28: error: 'O_CLOEXEC' undeclared (first use in this function)
>  time.c:445:28: note: each undeclared identifier is reported only once for each function it appears in

This is not a kernel problem, it's toolchain.
I'm going with this:

+#ifndef O_CLOEXEC
+# define O_CLOEXEC 0
+#endif
                output_fd = xopen(output_filename,
                        (opt & OPT_a) /* append? */
                        ? (O_CREAT | O_WRONLY | O_CLOEXEC | O_APPEND)
                        : (O_CREAT | O_WRONLY | O_CLOEXEC | O_TRUNC)
                );
+               if (!O_CLOEXEC)
+                       close_on_exec_on(output_fd);

since it will not pessimize code for newer toolchains.
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic