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: Goswin von Brederlow <goswin-v-b@w...>
Subject: Re: [Caml-list] Re: Looking for stubs for sendmsg/recvmsg
Sylvain Le Gall <sylvain@le-gall.net> writes:

> On 18-11-2010, Goswin von Brederlow <goswin-v-b@web.de> wrote:
>> 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?
>>
>
> If you don't find one and plan to write it yourself, this would be a
> good addition to extunix:
> http://extunix.forge.ocamlcore.org
>
> Regards,
> Sylvain Le Gall

I'm thinking of changing Unix.file_descr from int to a custom block
(containing the FD) with finalizer. Unix.close would set the FD to -1
and the finalizer gives an error if FD != -1 and closes it.

Actually I want that tunable with 3 possible behaviours:

type fd_leak_mode = Silent | Complain | Fail
val set_leak_mode : fd_leak_mode -> unit = <fun>

Silent just closes the FD if it is still open, Complain (default)
outputs to stderr and closes it and Fail aborts.

That would change most of the Unix module and mean a complete fork of it.

Would that be something for extunix too?

MfG
        Goswin