Re: broken OpenBSD <net/if.h> [was: [PATCH] Include some extra headers needed for OpenBSD.]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 09/04/2012 11:23 AM, Jasper Lievisse Adriaanse wrote:
> On Tue, Sep 04, 2012 at 11:08:30AM -0600, Eric Blake wrote:
>> [adding gnulib]
>>
>> Ouch.  The POSIX definition of <net/if.h> doesn't include any interface
>> that needs to use struct sockaddr.  Which OpenBSD extension function is
>> triggering this warning? According to POSIX, this .c file should compile:
>>
>> #define _POSIX_C_SOURCE 200809L
>> #include <net/if.h>
>> #include <sys/socket.h>
>> struct if_nameindex i;
>>

> That snippet of example code does not compile on OpenBSD:
> 
> In file included from foo.c:2:
> /usr/include/net/if.h:112: error: expected specifier-qualifier-list before 'u_int'

> 
> Could you please reference where POSIX states it should, so this can hopefully
> get fixed in OpenBSD.

http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/net_if.h.html#tag_13_30
doesn't mention any prerequisite headers for <net/if.h>.  Furthermore,
looking at each of the functions in that header, none of them call out a
prerequisite:
http://pubs.opengroup.org/onlinepubs/9699919799/functions/if_freenameindex.html#
http://pubs.opengroup.org/onlinepubs/9699919799/functions/if_indextoname.html#
http://pubs.opengroup.org/onlinepubs/9699919799/functions/if_nameindex.html#
http://pubs.opengroup.org/onlinepubs/9699919799/functions/if_nametoindex.html#

If a header cannot be used in isolation, then POSIX would call out
multiple headers.  For comparison, here's a case where POSIX 2008 _does_
call out multiple headers:
http://pubs.opengroup.org/onlinepubs/9699919799/functions/creat.html

creat() cannot use the S_IRUSR and other constants for its mode_t
argument unless you also include <sys/stat.h>, since <fcntl.h> was not
required to be self-contained on that front (there's talk underway about
getting that fixed in the next version of POSIX, but that's another
story... http://austingroupbugs.net/view.php?id=591)

-- 
Eric Blake   eblake@xxxxxxxxxx    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]