[libcamera-devel] [PATCH 1/2] android: Don't rely on indirect inclusion of unistd.h

Laurent Pinchart laurent.pinchart at ideasonboard.com
Thu May 27 04:52:38 CEST 2021


Hi Hiro,

On Thu, May 27, 2021 at 11:49:10AM +0900, Hirokazu Honda wrote:
> On Thu, May 27, 2021 at 10:02 AM Laurent Pinchart wrote:
> 
> > The standard C library close() and lseek() functions require inclusion
> > of the unistd.h header. Include it explicitly where needed instead of
> > relying on indirect inclusion.
> >
> > Signed-off-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
> 
> Do you know where unistd.h are indirectly included from?

Android headers, as I noticed a compilation breakage when updating them
:-)

> Reviewed-by: Hirokazu Honda <hiroh at chromium.org>
> 
> > ---
> >  src/android/camera_device.cpp            | 1 +
> >  src/android/camera_worker.cpp            | 1 +
> >  src/android/mm/generic_camera_buffer.cpp | 2 ++
> >  3 files changed, 4 insertions(+)
> >
> > diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp
> > index 7fc4ddb024c1..81509f57d1b7 100644
> > --- a/src/android/camera_device.cpp
> > +++ b/src/android/camera_device.cpp
> > @@ -15,6 +15,7 @@
> >  #include <fstream>
> >  #include <sys/mman.h>
> >  #include <tuple>
> > +#include <unistd.h>
> >  #include <vector>
> >
> >  #include <libcamera/control_ids.h>
> > diff --git a/src/android/camera_worker.cpp b/src/android/camera_worker.cpp
> > index 9f727826e23f..98dddd9eb13b 100644
> > --- a/src/android/camera_worker.cpp
> > +++ b/src/android/camera_worker.cpp
> > @@ -10,6 +10,7 @@
> >  #include <errno.h>
> >  #include <string.h>
> >  #include <sys/poll.h>
> > +#include <unistd.h>
> >
> >  #include "camera_device.h"
> >
> > diff --git a/src/android/mm/generic_camera_buffer.cpp
> > b/src/android/mm/generic_camera_buffer.cpp
> > index 334498c1867f..cca88cf3632f 100644
> > --- a/src/android/mm/generic_camera_buffer.cpp
> > +++ b/src/android/mm/generic_camera_buffer.cpp
> > @@ -7,6 +7,8 @@
> >
> >  #include "../camera_buffer.h"
> >
> > +#include <unistd.h>
> > +
> >  #include "libcamera/internal/buffer.h"
> >  #include "libcamera/internal/log.h"
> >

-- 
Regards,

Laurent Pinchart


More information about the libcamera-devel mailing list