qemu/net
Michael Tokarev 3294ce1893 do not include <libutil.h> needlessly or if it doesn't exist
<libutil.h> and <util.h> on *BSD (some have one, some another)
were #included just for openpty() declaration.  The only file
where this function is actually used is qemu-char.c.

In vl.c and net/tap-bsd.c, none of functions declared in libutil.h
(login logout logwtmp timdomain openpty forkpty uu_lock realhostname
fparseln and a few others depending on version) are used.

Initially the code which is currently in qemu-char.c was in vl.c,
it has been removed into separate file in commit 0e82f34d07
Fri Oct 31 18:44:40 2008, but the #includes were left in vl.c.
So with vl.c, we just remove includes - libutil.h, util.h and
pty.h (which declares only openpty() and forkpty()) from there.

The code in net/tap-bsd.c, which come from net/tap.c, had this

commit 5281d757ef
Author: Mark McLoughlin <markmc@redhat.com>
Date:   Thu Oct 22 17:49:07 2009 +0100

    net: split all the tap code out into net/tap.c

Note this commit not only moved stuff out of net.c to net/tap.c,
but also rewrote large portions of the tap code, and added these
completely unnecessary #includes -- as usual, I question why such
a misleading commit messages are allowed.

Again, no functions defined in libutil.h or util.h on *BSD are
used by neither net/tap.c nor net/tap-bsd.c.  Removing them.

And finally, the only real user for these #includes, qemu-char.c,
which actually uses openpty().  There, the #ifdef logic is wrong.
A GLIBC-based system has <pty.h>, even if it is a variant of *BSD.
So __GLIBC__ should be checked first, and instead of trying to
include <libutil.h> or <util.h>, we include <pty.h>.  If it is not
GLIBC-based, we check for variations between <*util.h> as before.

This patch fixes build of qemu 1.1 on Debian/kFreebsd (well, one
of the two problems): it is a distribution with a FreeBSD kernel,
so it #defines at least __FreeBSD_kernel__, but since it is based
on GLIBC, it has <pty.h>, but current version does not have neither
<util.h> nor <libutil.h>, which the code tries to include 3 times
but uses only once.

Signed-off-By: Michael Tokarev <mjt@tls.msk.ru>
Cc: Aurelien Jarno <aurelien@aurel32.net>

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-06-09 10:30:08 +00:00
..
Makefile.objs build: move net/ objects to nested Makefile.objs 2012-06-07 09:21:13 +02:00
checksum.c Change license from GPLv2 to GPLv2+ 2012-02-01 16:24:54 -06:00
checksum.h net: move net-checksum.c under net/ 2009-10-30 08:39:26 -05:00
dump.c net: purge the monitor object from all init functions 2012-06-04 13:49:35 -03:00
dump.h net: purge the monitor object from all init functions 2012-06-04 13:49:35 -03:00
queue.c Use glib memory allocation and free functions 2011-08-20 23:01:08 -05:00
queue.h net: move net-queue.[ch] under net/ 2009-10-30 08:39:26 -05:00
slirp.c net: purge the monitor object from all init functions 2012-06-04 13:49:35 -03:00
slirp.h net: purge the monitor object from all init functions 2012-06-04 13:49:35 -03:00
socket.c net: purge the monitor object from all init functions 2012-06-04 13:49:35 -03:00
socket.h net: purge the monitor object from all init functions 2012-06-04 13:49:35 -03:00
tap-aix.c tap: add APIs for vnet header length 2010-09-07 20:27:33 +03:00
tap-bsd.c do not include <libutil.h> needlessly or if it doesn't exist 2012-06-09 10:30:08 +00:00
tap-haiku.c tap: Add stub for Haiku 2010-10-03 06:31:41 +00:00
tap-linux.c net: tap-linux: Fix unhelpful error message 2011-11-01 06:23:48 +00:00
tap-linux.h tap: add APIs for vnet header length 2010-09-07 20:27:33 +03:00
tap-solaris.c fix typo: delete redundant semicolon 2011-12-06 09:56:41 +00:00
tap-win32.c net: purge the monitor object from all init functions 2012-06-04 13:49:35 -03:00
tap.c net: purge the monitor object from all init functions 2012-06-04 13:49:35 -03:00
tap.h net: purge the monitor object from all init functions 2012-06-04 13:49:35 -03:00
util.c net: move parse_macaddr() to net/util.[ch] 2009-12-03 09:41:34 -06:00
util.h net: move parse_macaddr() to net/util.[ch] 2009-12-03 09:41:34 -06:00
vde.c net: purge the monitor object from all init functions 2012-06-04 13:49:35 -03:00
vde.h net: purge the monitor object from all init functions 2012-06-04 13:49:35 -03:00