[libcamera-devel] libcamera: Fix compilation with uClibc and uClibc-ng

Message ID 20191108194739.1632-1-laurent.pinchart@ideasonboard.com
State Accepted
Commit b465ecb3e32b8b71ed4137656c2b8e67030fa2e1
Headers show
Series
  • [libcamera-devel] libcamera: Fix compilation with uClibc and uClibc-ng
Related show

Commit Message

Laurent Pinchart Nov. 8, 2019, 7:47 p.m. UTC
Neither uClibc nor uClibc-ng support O_TMPFILE. Define it in utils.h if
not defined.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 src/libcamera/include/utils.h | 9 +++++++++
 1 file changed, 9 insertions(+)

Is utils.h a good location, or should we create a compat.h (maybe even
one that is automatically included) for this purpose ?

Comments

Niklas Söderlund Nov. 14, 2019, 7:47 a.m. UTC | #1
Hi Laurent,

Thanks for your work.

On 2019-11-08 21:47:39 +0200, Laurent Pinchart wrote:
> Neither uClibc nor uClibc-ng support O_TMPFILE. Define it in utils.h if
> not defined.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>

> ---
>  src/libcamera/include/utils.h | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> Is utils.h a good location, or should we create a compat.h (maybe even
> one that is automatically included) for this purpose ?
> 
> diff --git a/src/libcamera/include/utils.h b/src/libcamera/include/utils.h
> index 3efb11c119c2..a80f7d096bf7 100644
> --- a/src/libcamera/include/utils.h
> +++ b/src/libcamera/include/utils.h
> @@ -16,6 +16,15 @@
>  
>  #define ARRAY_SIZE(a)	(sizeof(a) / sizeof(a[0]))
>  
> +#ifndef __DOXYGEN__
> +
> +/* uClibc and uClibc-ng don't provide O_TMPFILE */
> +#ifndef O_TMPFILE
> +#define O_TMPFILE	(020000000 | O_DIRECTORY)
> +#endif
> +
> +#endif
> +
>  namespace libcamera {
>  
>  namespace utils {
> -- 
> Regards,
> 
> Laurent Pinchart
> 
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel@lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel

Patch

diff --git a/src/libcamera/include/utils.h b/src/libcamera/include/utils.h
index 3efb11c119c2..a80f7d096bf7 100644
--- a/src/libcamera/include/utils.h
+++ b/src/libcamera/include/utils.h
@@ -16,6 +16,15 @@ 
 
 #define ARRAY_SIZE(a)	(sizeof(a) / sizeof(a[0]))
 
+#ifndef __DOXYGEN__
+
+/* uClibc and uClibc-ng don't provide O_TMPFILE */
+#ifndef O_TMPFILE
+#define O_TMPFILE	(020000000 | O_DIRECTORY)
+#endif
+
+#endif
+
 namespace libcamera {
 
 namespace utils {