Version française
Home     About     Download     Resources     Contact us    
Browse thread
ocamlnet: EAFNOSUPPORT on Max OSX
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Gerd Stolpmann <info@g...>
Subject: Re: [Caml-list] Solved! (was Re: Mac OSX getsocketpair/getsockname and IPv6)
Am Samstag, den 05.05.2007, 16:16 +0100 schrieb Joel Reymont:
> The culprit is in alloc_sockaddr [1].
> 
> adr->s_gen.sa_family is 0 which stands for AF_UNSPEC in my /usr/ 
> include/sys/socket.h.
> 
> alloc_sockaddr does not handle this family type and throws EAFNOSUPPORT.
> 
> I'm inclined to think that ocamlnet should be fixed and not the OCaml  
> library, although it would be helpful if an error different from  
> EAFNOSUPPORT was used.

Yes, this is true, EAFNOSUPPORT is misleading because it means that the
whole address family is not supported. A better code would be EOPNOTSUPP
which is generally used when a certain socket operation cannot be
performed for the type of socket (and the Single Unix Spec documents it
for getsockname/getpeername). Or Unix.sockaddr is extended by an extra
case for the inaccessible address.


>    default:
>      if (close_on_error != -1) close (close_on_error);
>      unix_error(EAFNOSUPPORT, "", Nothing);
>    }

Gerd
-- 
------------------------------------------------------------
Gerd Stolpmann * Viktoriastr. 45 * 64293 Darmstadt * Germany 
gerd@gerd-stolpmann.de          http://www.gerd-stolpmann.de
Phone: +49-6151-153855                  Fax: +49-6151-997714
------------------------------------------------------------