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 4FAC581799 for ; Sat, 27 Jul 2013 17:34:11 +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=74.125.82.51; 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 74.125.82.51 as permitted sender) identity=mailfrom; client-ip=74.125.82.51; 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-wg0-f51.google.com) identity=helo; client-ip=74.125.82.51; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="monnier.florent@gmail.com"; x-sender="postmaster@mail-wg0-f51.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgwEAIfn81FKfVIzk2dsb2JhbABbgztKBq8OjkoEAYEQCBYOAQEBAQcLCwkUBCSCJAEBBAFAARsdAQMBCwYFCzsiAREBBQEOAQ0GiBABAwkGBwWae4xPgn+EFwoZJw1kh3QBBQyOPB2BGAeEBQOXX4Epjj4WKYQ8OoEs X-IPAS-Result: AgwEAIfn81FKfVIzk2dsb2JhbABbgztKBq8OjkoEAYEQCBYOAQEBAQcLCwkUBCSCJAEBBAFAARsdAQMBCwYFCzsiAREBBQEOAQ0GiBABAwkGBwWae4xPgn+EFwoZJw1kh3QBBQyOPB2BGAeEBQOXX4Epjj4WKYQ8OoEs X-IronPort-AV: E=Sophos;i="4.89,757,1367964000"; d="scan'208";a="27549828" Received: from mail-wg0-f51.google.com ([74.125.82.51]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/RC4-SHA; 27 Jul 2013 17:34:10 +0200 Received: by mail-wg0-f51.google.com with SMTP id e12so1734341wgh.6 for ; Sat, 27 Jul 2013 08:34:10 -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=W7c5JfGNG7JfS+MR6D3mepvSRydZTSIufvro3KHxNt8=; b=l2w8fCqmoc5sF1QgQYDTUSMj5mOpW2MHIna5UWEvSvdOLuk/GkbCXEQXrWq8J3hJs4 57KZOzP0pGLu3P9Gy2n1WPwTqIFeUzYQJxkEjyzVeEfdkmjAvZqCre88aOJMVa2lOuhf djxvOz67M2xqenlnHP6TI7yisqI51EHSWGkKFXpSKdoRQ6Wu9jGpvu3MqN5qXDI2ALkC LMOz3vT2u+JrLlTtpzfbQ6WAmu3CxdsEfXrGzFAptreP2nEEVMPh5OCyBI+9yvY6uCig 0cH89Au0atX3q2zT3Y3W2RCZkI1GCgMa1D79NBPYXCgZZDiSkvLXROVf+Sd6bag4Sc1d iCsQ== MIME-Version: 1.0 X-Received: by 10.180.83.163 with SMTP id r3mr2299743wiy.10.1374939250214; Sat, 27 Jul 2013 08:34:10 -0700 (PDT) Received: by 10.194.80.36 with HTTP; Sat, 27 Jul 2013 08:34:10 -0700 (PDT) In-Reply-To: <20130727142320.GA26244@notk.org> References: <20130727083844.GA17235@notk.org> <20130727142320.GA26244@notk.org> Date: Sat, 27 Jul 2013 17:34:10 +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/07/27, Adrien Nader wrote: [...] > It's a very minimal layer. Microsoft CRT cannot be used for things like > printing properly long doubles or similar things. Its math > implementation is also lacking some C99 support (plus it's not that > fast). That's where the mingw CRT will provide you more things. For > others, it's the Microsoft one. mingw's additional lib has to be used if we're using thread for example if I have understood correctly. >> - 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 >> Don't you think that "win32unix/" should remain as is for the MS >> compiler, and that mingw variant should just switch to >> "otherlibs/unix/" ? > > No. Mingw is not posix. Just think about fork(): it cannot exist on > Windows currently without resorting to the big layer that Cygwin > provides (along with its performance hit). > > Btw, you can have a look at this entry in the Cygwin FAQ to better > understand what "cygwin" means: > http://cygwin.com/faq.html#faq.api.fork Interesting, thanks a lot. > You can also take a look at the C files in otherlibs/win32unix: there's > quite a lot of work that is done to provide a matching API. Thanks, it made me discovered about the Handle_val() convertion that only exists in win32unix. > You can use the eval editions that are available on Microsoft's website. > They're time-limited (one month for some) and after that they will > shutdown after 1 hour but that's not an issue for testing, especially > for VMs. There are also ways to extend the original one-month period > that are documented on MSDN. > > (you can also reinstall: qemu's cache=unsafe disk parameter makes > installation insanely fast; yypkg's mingw-builds should also make > installation of a build environment much faster) Thanks a lot Adrien, your answers are very interesting! -- Regards