From: Paul Snively <psnively@mac.com>
To: Joel Reymont <joelr1@gmail.com>
Cc: OCaml List <caml-list@inria.fr>, Gerd Stolpmann <gerd@gerd-stolpmann.de>
Subject: Re: [Caml-list] Solved! (was Re: Mac OSX getsocketpair/getsockname and IPv6)
Date: Mon, 28 May 2007 10:08:41 -0700 [thread overview]
Message-ID: <8204C486-19C3-479C-A573-0EED14ADCCE4@mac.com> (raw)
In-Reply-To: <6AC4F0FE-E2D1-4EDD-87A5-2FA3CBB0FBBE@gmail.com>
So: if a Mac OS X O'Caml user wanted to solve this, what is the
actual solution? Surely it's not:
case AF_UNSPEC:
case AF_UNIX:
in socketaddr.c?
Many thanks and best regards,
Paul
On May 5, 2007, at 8:16 AM, Joel Reymont wrote:
> 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.
>
> I would have been most helpful to have a stack trace on exception
> as this would have allowed me to narrow down the source of the
> problem in no time rather than going spelunking through ocamlnet
> and OCaml networking libraries.
>
> Thanks, Joel
>
> [1] otherlibs/unix/socketaddr.c
>
> value alloc_sockaddr(union sock_addr_union * adr /*in*/,
> socklen_param_type adr_len, int close_on_error)
> {
> value res;
> switch(adr->s_gen.sa_family) {
> #ifndef _WIN32
> case AF_UNIX:
> { value n = copy_string(adr->s_unix.sun_path);
> Begin_root (n);
> res = alloc_small(1, 0);
> Field(res,0) = n;
> End_roots();
> break;
> }
> #endif
> case AF_INET:
> { value a = alloc_inet_addr(&adr->s_inet.sin_addr);
> Begin_root (a);
> res = alloc_small(2, 1);
> Field(res,0) = a;
> Field(res,1) = Val_int(ntohs(adr->s_inet.sin_port));
> End_roots();
> break;
> }
> #ifdef HAS_IPV6
> case AF_INET6:
> { value a = alloc_inet6_addr(&adr->s_inet6.sin6_addr);
> Begin_root (a);
> res = alloc_small(2, 1);
> Field(res,0) = a;
> Field(res,1) = Val_int(ntohs(adr->s_inet6.sin6_port));
> End_roots();
> break;
> }
> #endif
> default:
> if (close_on_error != -1) close (close_on_error);
> unix_error(EAFNOSUPPORT, "", Nothing);
> }
> return res;
> }
>
> --
> http://wagerlabs.com/
>
>
>
>
>
> _______________________________________________
> Caml-list mailing list. Subscription management:
> http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
> Archives: http://caml.inria.fr
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs
next prev parent reply other threads:[~2007-05-28 17:08 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-05-05 12:40 ocamlnet: EAFNOSUPPORT on Max OSX Joel Reymont
2007-05-05 12:50 ` Joel Reymont
2007-05-05 12:57 ` [Caml-list] " Richard Jones
2007-05-05 14:00 ` Joel Reymont
2007-05-05 13:53 ` Mac OSX getsocketpair/getsockname and IPv6 Joel Reymont
2007-05-05 14:13 ` Serious bug in the OCaml FFI? Joel Reymont
2007-05-05 14:56 ` [Caml-list] " Olivier Andrieu
2007-05-05 15:24 ` Joel Reymont
2007-05-05 14:31 ` Mac OSX getsocketpair/getsockname and IPv6 Joel Reymont
2007-05-05 15:16 ` Solved! (was Re: Mac OSX getsocketpair/getsockname and IPv6) Joel Reymont
2007-05-06 10:05 ` [Caml-list] " Gerd Stolpmann
2007-05-28 17:08 ` Paul Snively [this message]
2007-05-05 14:46 ` Mac OSX getsocketpair/getsockname and IPv6 Joel Reymont
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8204C486-19C3-479C-A573-0EED14ADCCE4@mac.com \
--to=psnively@mac.com \
--cc=caml-list@inria.fr \
--cc=gerd@gerd-stolpmann.de \
--cc=joelr1@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).