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 mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by sympa.inria.fr (Postfix) with ESMTPS id 9826F81799 for ; Sat, 27 Jul 2013 17:43:48 +0200 (CEST) Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of adrien@notk.org) identity=pra; client-ip=91.121.71.147; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="adrien@notk.org"; x-sender="adrien@notk.org"; x-conformance=sidf_compatible Received-SPF: Pass (mail3-smtp-sop.national.inria.fr: domain of adrien@notk.org designates 91.121.71.147 as permitted sender) identity=mailfrom; client-ip=91.121.71.147; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="adrien@notk.org"; x-sender="adrien@notk.org"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@nautica.notk.org) identity=helo; client-ip=91.121.71.147; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="adrien@notk.org"; x-sender="postmaster@nautica.notk.org"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AisDABvq81FbeUeTgWdsb2JhbABbgzuDX7pOgRgWDgEBFiYogiQBAQUjVhALGAICBRMOAgIPBRgxiCcIpnmRGoEojlUHgmMzbwOXXgGBKZM5Og X-IPAS-Result: AisDABvq81FbeUeTgWdsb2JhbABbgzuDX7pOgRgWDgEBFiYogiQBAQUjVhALGAICBRMOAgIPBRgxiCcIpnmRGoEojlUHgmMzbwOXXgGBKZM5Og X-IronPort-AV: E=Sophos;i="4.89,757,1367964000"; d="scan'208";a="22450390" Received: from nautica.notk.org ([91.121.71.147]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/ADH-AES256-SHA; 27 Jul 2013 17:43:48 +0200 Received: by nautica.notk.org (Postfix, from userid 1003) id E1AC2C009; Sat, 27 Jul 2013 17:43:47 +0200 (CEST) Date: Sat, 27 Jul 2013 17:43:47 +0200 From: Adrien Nader To: Florent Monnier Cc: caml-list@inria.fr Message-ID: <20130727154347.GA3385@notk.org> References: <20130727083844.GA17235@notk.org> <20130727142320.GA26244@notk.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.20 (2009-06-14) Subject: Re: [Caml-list] Re: portable truncate On Sat, Jul 27, 2013, Florent Monnier wrote: > 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. What makes you think so? 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? 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 -- Adrien Nader