Version française
Home     About     Download     Resources     Contact us    
Browse thread
Looking for stubs for sendmsg/recvmsg
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Dave Scott <Dave.Scott@e...>
Subject: RE: [Caml-list] Looking for stubs for sendmsg/recvmsg
> Hi,
> 
> I'm looking for stubs for
> 
>        ssize_t sendmsg(int sockfd, const struct msghdr *msg, int flags);
>        ssize_t recvmsg(int sockfd, struct msghdr *msg, int flags);
> 
> Specifically I need those to send (among normal messages) an
> Unix.file_descr over a Unix Domain Socket.
> 
> Does anyone know of a module that has them?

We have some bindings for those:

https://github.com/xen-org/xen-api-libs/blob/master/stdext/unixext.mli

external send_fd : Unix.file_descr -> string -> int -> int -> Unix.msg_flag list -> Unix.file_descr -> int = "stub_unix_send_fd_bytecode" "stub_unix_send_fd"
external recv_fd : Unix.file_descr -> string -> int -> int -> Unix.msg_flag list -> int * Unix.sockaddr * Unix.file_descr = "stub_unix_recv_fd"

You might prefer to extract the relevant functions from the code -- there's a lot of other misc stuff in that repo which you're probably not interested in.

We use those functions quite a lot so hopefully they'll work for you.

Cheers,
Dave