Browse thread
ocamlnet: EAFNOSUPPORT on Max OSX
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Joel Reymont <joelr1@g...> |
| Subject: | Re: Mac OSX getsocketpair/getsockname and IPv6 |
As Rich suggested, I ran OCaml with kernel process tracing to see
what the syscalls return.
28407 ocamlrun CALL socketpair(0x1,0x1,0,0xbffff268)
28407 ocamlrun RET socketpair 0
28407 ocamlrun CALL getsockname(0x5,0xbffff204,0xbffff200)
28407 ocamlrun RET getsockname 0
28407 ocamlrun GIO fd 1 wrote 56 bytes
"Exception: Unix.Unix_error (Unix.EAFNOSUPPORT, "", "").
So both socketpair and getsockname return 0 but OCaml still complains.
My version of getsockname.c below outputs:
unix_getsockname: sock = 5, len = 0, retcode = 0
Exception: Unix.Unix_error (Unix.EAFNOSUPPORT, "", "").
Any suggestions?
Thanks, Joel
---
CAMLprim value unix_getsockname(value sock)
{
int retcode;
union sock_addr_union addr;
socklen_param_type addr_len;
addr_len = sizeof(addr);
retcode = getsockname(Int_val(sock), &addr.s_gen, &addr_len);
printf("unix_getsockname: sock = %d, len = %d, retcode = %d\n",
Int_val(sock), addr_len, retcode);
if (retcode == -1) uerror("getsockname", Nothing);
return alloc_sockaddr(&addr, addr_len, -1);
}
--
http://wagerlabs.com/