Subject: Re: sys/socket.h
To: None <erh@nimenees.com>
From: Patrick Welche <prlw1@newn.cam.ac.uk>
List: current-users
Date: 04/07/2000 20:49:46
On Fri, Apr 07, 2000 at 02:22:23PM -0500, erh@nimenees.com wrote:
> On Fri, Apr 07, 2000 at 11:09:42AM +0100, Patrick Welche wrote:
> > > On Thu, Apr 06, 2000 at 10:13:49PM +0100, Patrick Welche wrote:
> > > > #include <sys/socket.h>
> > > > int main(){return 0;}
> > > > 
> > 
> > Ah - socket(2) mentions needing types.h.. odd that I have binary that actually
> > compiled on 10 Jan without it though..
> 	Looking at the history of sys/socket.h as far back as July doesn't
> reveal any changes in what it includes.  it doesn't include anything,
> and it didn't previously.  Could it be that some other header in the source
> for the binary you compiled that used to include sys/types.h?  Did you
> actually compile this example program above?

Nope, but it starts:

#include <sys/ioctl.h>
#include <sys/socket.h>

#include <net/if.h>
#include <net/if_dl.h>
#include <netinet/in.h>
#include <arpa/inet.h>

#include <err.h>
#include <errno.h>
#include <netdb.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>

#include "dhcp.h"

char *progname;
...

Anyway, it seems the solution is to bring the netintro(4) page in line with
socket(2):

Index: netintro.4
===================================================================
RCS file: /cvsroot/sharesrc/share/man/man4/netintro.4,v
retrieving revision 1.10
diff -c -r1.10 netintro.4
*** netintro.4  1999/12/15 22:07:33     1.10
--- netintro.4  2000/04/07 19:48:48
***************
*** 40,45 ****
--- 40,46 ----
  .Nm netintro
  .Nd introduction to networking facilities
  .Sh SYNOPSIS
+ .Fd #include <sys/types.h>
  .Fd #include <sys/socket.h>
  .Fd #include <net/route.h>
  .Fd #include <net/if.h>


Cheers,

Patrick