[Top] [All Lists]

Re: ah...

To: (Mike Shaver)
Subject: Re: ah...
From: Ralf Baechle <>
Date: Fri, 30 May 1997 20:04:37 +0200 (MET DST)
In-reply-to: <> from "Mike Shaver" at May 30, 97 01:43:30 pm
> Thus spake Ralf Baechle:
> > Hurz...  Looks like you either you disabled TCI/IP networking or libc
> > and the kernel use different constants for the arguments of socket(2).
> I've added some more verbosity, and the constants are AF_INET=2,
> TCP is correct, but SOCK_STREAM in my kernel headers is 1, SOCK_DGRAM being
> 2.  That'd explain the UDP thing, anyway.

One of the fun things with SGI...  Long time ago checked two SGI machines
running different OS versions for reference.  In one of them the values
for SOCK_STREAM and SOCK_DGRAM are swapped compared to the other.  I wonder
why.  But anyway, at that time I choose to clone the constants from the
newer one.

> Yup, my test program works if I force SOCK_STREAM to be 1.
> I guess I'll try and find the bogosity in the headers, then.


No, the kernel and the kernel use different values:
>From asm-mips/socket.h:
/* Types of sockets.  */
enum __socket_type
  SOCK_DGRAM = 1,               /* Connectionless, unreliable datagrams
                                   of fixed maximum length.  */
  SOCK_STREAM = 2,              /* Sequenced, reliable, connection-based
                                   byte streams.  */
  SOCK_RAW = 3,                 /* Raw protocol interface.  */
  SOCK_RDM = 4,                 /* Reliably-delivered messages.  */
  SOCK_SEQPACKET = 5,           /* Sequenced, reliable, connection-based,
                                   datagrams of fixed maximum length.  */
  SOCK_PACKET = 10,             /* linux specific way of getting packets at
                                   the dev level.  For writing rarp and
                                   other similar things on the user level.  */

Grrr...  I somewhen moved the definitions of these constants from the
generic header files to the machine specific header files and somehow
lost the appropriate change to the library.  I did change this with an
eye into the future (IRIX / ABI compatibility) so we wouldn't need some
stupid conversion routine.  Actually I wonder why I was able to use
bind, so I'll have to enquire my setup a bit closer.

Thanks anyway ...


<Prev in Thread] Current Thread [Next in Thread>