[libvirt] [PATCH 10/12] src: add check for termios.h and conditionally include it

Pavel Hrdina phrdina at redhat.com
Tue Jan 14 15:26:47 UTC 2020


On Tue, Jan 14, 2020 at 03:21:31PM +0000, Daniel P. Berrangé wrote:
> On Tue, Jan 14, 2020 at 04:12:15PM +0100, Pavel Hrdina wrote:
> > On Fri, Jan 10, 2020 at 03:41:14PM +0000, Daniel P. Berrangé wrote:
> > > The GNULIB termios module ensures termios.h exists, but
> > > this is not neccessary and libvirt doesn't use any of its
> > > functionality on platforms where it is missing. It is
> > > thus sufficient to conditonallyinclude termios.h
> > > 
> > > Signed-off-by: Daniel P. Berrangé <berrange at redhat.com>
> > > ---
> > >  configure.ac           | 1 +
> > >  src/util/virfdstream.c | 4 +++-
> > >  src/util/virfile.c     | 4 +++-
> > >  src/util/virutil.c     | 1 -
> > >  tools/virsh.h          | 1 -
> > >  tools/vsh.h            | 4 +++-
> > >  6 files changed, 10 insertions(+), 5 deletions(-)
> > 
> > This makes the code guarded by HAVE_CFMAKERAW or by !WIN32 and the
> > header by HAVE_TERMIOS_H which makes things more confusing.
> > Should we take the opportunity to unify it?
> 
> Yeah we have alot of this kind of thing, where we could eliminate a
> whole bunch of HAVE_XXXX, in favour of just using #ifdef WIN32.
> 
> vircommand.c is a particular case in point where essentially the
> whole file should be ifdef WIN32.
> 
> Taking this kind of approach would eliminate the need to check
> some things in configure.ac and thus cut down what we need for
> meson too.
> 
> Essentially if, given our supported platform list, we can assume
> existance of a header / function on every UNIX platform we care
> about, then I think it is reasonable to use ifdef WIN32 for the
> exception on Windows.
> 
> IOW we only need HAVE_XXX checks if there is variance between UNIX
> platforms we need to identify.

That would be amazing to address all of this some day.  Anyway the
patch is correct regardless of this changes so:

Reviewed-by: Pavel Hrdina <phrdina at redhat.com>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20200114/08234f2d/attachment-0001.sig>


More information about the libvir-list mailing list