From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by sympa.inria.fr (Postfix) with ESMTPS id 83AFD81799 for ; Sat, 27 Jul 2013 21:45:19 +0200 (CEST) Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of monnier.florent@gmail.com) identity=pra; client-ip=209.85.212.181; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="monnier.florent@gmail.com"; x-sender="monnier.florent@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail2-smtp-roc.national.inria.fr: domain of monnier.florent@gmail.com designates 209.85.212.181 as permitted sender) identity=mailfrom; client-ip=209.85.212.181; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="monnier.florent@gmail.com"; x-sender="monnier.florent@gmail.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-wi0-f181.google.com) identity=helo; client-ip=209.85.212.181; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="monnier.florent@gmail.com"; x-sender="postmaster@mail-wi0-f181.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AuoBAGAi9FHRVdS1k2dsb2JhbABbgztQvVaBEggWDgEBAQEHCwsJFAQkgiQBAQQBQAEbHQEDAQsGBQsNLiIBEQEFARwGiBABAwkGDJsFjE+Cf4N6ChknDWSHdAEFDI9xB4QFA5dfgSmOPhYphDw6 X-IPAS-Result: AuoBAGAi9FHRVdS1k2dsb2JhbABbgztQvVaBEggWDgEBAQEHCwsJFAQkgiQBAQQBQAEbHQEDAQsGBQsNLiIBEQEFARwGiBABAwkGDJsFjE+Cf4N6ChknDWSHdAEFDI9xB4QFA5dfgSmOPhYphDw6 X-IronPort-AV: E=Sophos;i="4.89,758,1367964000"; d="scan'208";a="27579487" Received: from mail-wi0-f181.google.com ([209.85.212.181]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/RC4-SHA; 27 Jul 2013 21:45:18 +0200 Received: by mail-wi0-f181.google.com with SMTP id en1so1831437wid.8 for ; Sat, 27 Jul 2013 12:45:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=c37e88BIDAJW2HTRNMtYsFXsVKRFd30618Fn48XR1fc=; b=qL9RCzMqe7+ZiUT0nL8er8kH/FflbdhoQmWiwuN0BVPTVb3l4eAoMpp2QnnA8YMqu4 NckeADSFDydSX7sboP45R3LCXAAsiYbKLOGxUqt/HMgB0BqYuHDI5myS0ayzWohgCooM esIYwRwZob9EplUVA84GpTh4Ckk/ugYAc039bMYMQRk+AUUW+VBtL0otKlAFx5QFL0Tv t90zcx9P1UxgUNetMLl20LXc8sxUiAhzh0040gqLt9iOLwILOXiSO0rfvlRcmT50pQEn A3SCbiRFYPeMAuEnaHIMeMXkFNTfdEvZdNvJqwW4VyeO5Vy0PCxlf7qIhnQs9aC3MUMk j9FQ== MIME-Version: 1.0 X-Received: by 10.180.10.138 with SMTP id i10mr2605608wib.53.1374954318447; Sat, 27 Jul 2013 12:45:18 -0700 (PDT) Received: by 10.194.80.36 with HTTP; Sat, 27 Jul 2013 12:45:18 -0700 (PDT) In-Reply-To: <20130727154347.GA3385@notk.org> References: <20130727083844.GA17235@notk.org> <20130727142320.GA26244@notk.org> <20130727154347.GA3385@notk.org> Date: Sat, 27 Jul 2013 21:45:18 +0200 Message-ID: From: Florent Monnier To: Adrien Nader Cc: caml-list@inria.fr Content-Type: text/plain; charset=ISO-8859-1 X-Validation-by: monnier.florent@gmail.com Subject: Re: [Caml-list] Re: portable truncate 2013/7/27, Adrien Nader wrote: > On Sat, Jul 27, 2013, Florent Monnier wrote: [...] >> mingw's additional lib has to be used if we're using thread for >> example if I have understood correctly. > > What makes you think so? The sentence below that is on the website of the project: "It does depend on a number of DLLs provided by Microsoft themselves, as components of the operating system; most notable among these is MSVCRT.DLL, the Microsoft C runtime library. Additionally, threaded applications must ship with a freely distributable thread support DLL, provided as part of MinGW itself" > A quick look seems to indicate the opposite. There is no specific thread > support provided by mingw*. > There are pthreads-win32 and winpthreads but I don't see the build > system use them on Windows; I see calls to CreateThead() (typical win32 > stuff) however for instance. > >> >> - truncate() DOES work on my computer >> >> - ftruncate() / _chsize() DOESN'T >> > >> > That's surprising and you should really try to see which error you get >> > throw errno. You can also try a tool like FileMonitor (or whatever it's >> > called nowadays) to see how it fails. >> >> I get EBADF >> >> http://msdn.microsoft.com/en-us/library/dk925tyb%28v=VS.80%29.aspx >> >> EBADF is if the specified file is read-only or the descriptor is invalid >> >> the file has write access for everyone. >> And the file descriptor is converted the same way than everywhere else. >> >> Then I noticed that I copied the stub from otherlibs/unix/ not from >> otherlibs/win32unix/ >> so the file descr is converted by Int_val() instead of Handle_val(). >> >> But now I still get : EBADF > > And you've opened the file as read-write too? let open_flags = [Unix.O_RDWR] O_RDWR (* Open for reading and writing *) > If so, you should maybe try Process Monitor to make sure everything was > done as expected: > http://technet.microsoft.com/en-us/sysinternals/bb896645.aspx Thanks Adrien, I'll have a look at this tomorrow. -- Regards