From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by yquem.inria.fr (Postfix) with ESMTP id 9B9FBBC57 for ; Fri, 19 Nov 2010 17:07:36 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AqUDAK8v5kzZSMDdX2dsb2JhbACiXAsXCQYEGgMfvTuFSwSNaQ X-IronPort-AV: E=Sophos;i="4.59,223,1288566000"; d="scan'208";a="67517247" Received: from fmmailgate01.web.de ([217.72.192.221]) by mail3-smtp-sop.national.inria.fr with ESMTP; 19 Nov 2010 17:06:56 +0100 Received: from smtp06.web.de ( [172.20.5.172]) by fmmailgate01.web.de (Postfix) with ESMTP id 0D0F317A8C66B; Fri, 19 Nov 2010 17:06:55 +0100 (CET) Received: from [78.43.204.177] (helo=frosties.localdomain) by smtp06.web.de with asmtp (TLSv1:AES256-SHA:256) (WEB.DE 4.110 #24) id 1PJTUE-0006a6-00; Fri, 19 Nov 2010 17:06:54 +0100 Received: from mrvn by frosties.localdomain with local (Exim 4.72) (envelope-from ) id 1PJTUE-0000D1-EV; Fri, 19 Nov 2010 17:06:54 +0100 From: Goswin von Brederlow To: Sylvain Le Gall Cc: caml-list@inria.fr Subject: Re: [Caml-list] Re: Looking for stubs for sendmsg/recvmsg References: <87d3q21qe4.fsf@frosties.localnet> Date: Fri, 19 Nov 2010 17:06:54 +0100 In-Reply-To: (Sylvain Le Gall's message of "Fri, 19 Nov 2010 08:56:32 +0000 (UTC)") Message-ID: <87ipztl2ld.fsf@frosties.localnet> User-Agent: Gnus/5.110009 (No Gnus v0.9) XEmacs/21.4.22 (linux, no MULE) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: goswin-v-b@web.de X-Sender: goswin-v-b@web.de X-Provags-ID: V01U2FsdGVkX185JAbs2ByyI/V+oJARxdd/3BQQ1IdQtY1pwRPS UPAKnGa5kyyQWmp6O4L1Ep2g0o3M616BByykv5SAgSzu6rEu4y 2+liApPcI= X-Spam: no; 0.00; stubs:01 le-gall:01 stubs:01 const:01 struct:01 flags:01 struct:01 flags:01 finalizer:01 finalizer:01 val:01 stderr:01 mfg:98 wrote:01 unix:01 Sylvain Le Gall writes: > On 18-11-2010, Goswin von Brederlow 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 = 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