From nobody@FreeBSD.org  Sat Sep 28 19:29:42 2013
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1])
	(using TLSv1 with cipher ADH-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by hub.freebsd.org (Postfix) with ESMTP id EE56F30B
	for <freebsd-gnats-submit@FreeBSD.org>; Sat, 28 Sep 2013 19:29:42 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from oldred.freebsd.org (oldred.freebsd.org [8.8.178.121])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by mx1.freebsd.org (Postfix) with ESMTPS id C24732DFC
	for <freebsd-gnats-submit@FreeBSD.org>; Sat, 28 Sep 2013 19:29:42 +0000 (UTC)
Received: from oldred.freebsd.org ([127.0.1.6])
	by oldred.freebsd.org (8.14.5/8.14.7) with ESMTP id r8SJTgCf070741
	for <freebsd-gnats-submit@FreeBSD.org>; Sat, 28 Sep 2013 19:29:42 GMT
	(envelope-from nobody@oldred.freebsd.org)
Received: (from nobody@localhost)
	by oldred.freebsd.org (8.14.5/8.14.5/Submit) id r8SJTgeW070723;
	Sat, 28 Sep 2013 19:29:42 GMT
	(envelope-from nobody)
Message-Id: <201309281929.r8SJTgeW070723@oldred.freebsd.org>
Date: Sat, 28 Sep 2013 19:29:42 GMT
From: Jan Beich <jbeich@tormail.org>
To: freebsd-gnats-submit@FreeBSD.org
Subject: [patch] make <resolv.h> self-contained
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         182466
>Category:       kern
>Synopsis:       [headers] [patch] make <resolv.h> self-contained
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Sep 28 19:30:00 UTC 2013
>Closed-Date:    
>Last-Modified:  Sun Sep 29 21:37:00 UTC 2013
>Originator:     Jan Beich
>Release:        FreeBSD 10.0-CURRENT amd64
>Organization:
>Environment:
http://cvsweb.netbsd.org/bsdweb.cgi/src/include/resolv.h.diff?r1=1.39&r2=1.40
https://bug810716.bugzilla.mozilla.org/attachment.cgi?id=808118

>Description:
Our resolv.h already includes a bunch of headers listed in resolver(3)
man page. Make the list complete by adding netinet/in.h for sockaddr_in.

This should reduce patching required when porting code written with
Linux or NetBSD in mind.

reinstating kern/85741

>How-To-Repeat:
$ cat a.c
#include <resolv.h>
int main() { return 0; }

$ cc a.c
In file included from a.c:1:
/usr/include/resolv.h:157:14: error: array has incomplete element type
      'struct sockaddr_in'
                nsaddr_list[MAXNS];     /*%< address of name server */
                           ^
/usr/include/resolv.h:156:9: note: forward declaration of 'struct sockaddr_in'
        struct sockaddr_in
               ^
/usr/include/resolv.h:171:18: error: field has incomplete type 'struct in_addr'
                struct in_addr  addr;
                                ^
/usr/include/resolv.h:171:10: note: forward declaration of 'struct in_addr'
                struct in_addr  addr;
                       ^
/usr/include/resolv.h:195:21: error: field has incomplete type 'struct sockaddr_in'
        struct sockaddr_in      sin;
                                ^
/usr/include/resolv.h:156:9: note: forward declaration of 'struct sockaddr_in'
        struct sockaddr_in
               ^
3 errors generated.

>Fix:
--- res.diff begins here ---
Index: include/resolv.h
===================================================================
--- include/resolv.h	(revision 255808)
+++ include/resolv.h	(working copy)
@@ -58,6 +58,7 @@
 #include <sys/cdefs.h>
 #include <sys/socket.h>
 #include <stdio.h>
+#include <netinet/in.h>
 #include <arpa/nameser.h>
 
 /*%
Index: lib/libc/net/resolver.3
===================================================================
--- lib/libc/net/resolver.3	(revision 255808)
+++ lib/libc/net/resolver.3	(working copy)
@@ -48,9 +48,6 @@
 .Sh LIBRARY
 .Lb libc
 .Sh SYNOPSIS
-.In sys/types.h
-.In netinet/in.h
-.In arpa/nameser.h
 .In resolv.h
 .Ft int
 .Fo res_query
--- res.diff begins here ---


>Release-Note:
>Audit-Trail:
>Unformatted:
