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 AC1BD81799 for ; Sat, 27 Jul 2013 09:05:55 +0200 (CEST) Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of dra-news@metastack.com) identity=pra; client-ip=81.103.221.47; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="dra-news@metastack.com"; x-sender="dra-news@metastack.com"; x-conformance=sidf_compatible Received-SPF: Neutral (mail2-smtp-roc.national.inria.fr: domain of dra-news@metastack.com does not assert whether or not 81.103.221.47 is permitted sender) identity=mailfrom; client-ip=81.103.221.47; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="dra-news@metastack.com"; x-sender="dra-news@metastack.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@mtaout01-winn.ispmail.ntl.com) identity=helo; client-ip=81.103.221.47; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="dra-news@metastack.com"; x-sender="postmaster@mtaout01-winn.ispmail.ntl.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AkUBALxw81FRZ90vlGdsb2JhbABbgmVWUL1cgRUWDgEBAQEHDQkJFAMlgiQBAQEDATpECwIBCBgKFBAyFwENAgQbiAIHAwi4dY5IgQQ4gxZvA5dfgSmTN4FoQg X-IPAS-Result: AkUBALxw81FRZ90vlGdsb2JhbABbgmVWUL1cgRUWDgEBAQEHDQkJFAMlgiQBAQEDATpECwIBCBgKFBAyFwENAgQbiAIHAwi4dY5IgQQ4gxZvA5dfgSmTN4FoQg X-IronPort-AV: E=Sophos;i="4.89,756,1367964000"; d="scan'208";a="27496549" Received: from mtaout01-winn.ispmail.ntl.com ([81.103.221.47]) by mail2-smtp-roc.national.inria.fr with ESMTP; 27 Jul 2013 09:05:54 +0200 Received: from aamtaout04-winn.ispmail.ntl.com ([81.103.221.35]) by mtaout01-winn.ispmail.ntl.com (InterMail vM.7.08.04.00 201-2186-134-20080326) with ESMTP id <20130727070554.QWRK4711.mtaout01-winn.ispmail.ntl.com@aamtaout04-winn.ispmail.ntl.com> for ; Sat, 27 Jul 2013 08:05:54 +0100 Received: from romulus.metastack.com ([81.98.252.242]) by aamtaout04-winn.ispmail.ntl.com (InterMail vG.3.00.04.00 201-2196-133-20080908) with ESMTP id <20130727070554.JGFN21648.aamtaout04-winn.ispmail.ntl.com@romulus.metastack.com> for ; Sat, 27 Jul 2013 08:05:54 +0100 Received: from remus.metastack.local (remus.metastack.com [172.16.0.1]) by romulus.metastack.com (8.14.2/8.14.2) with ESMTP id r6R75pB9025688 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=FAIL) for ; Sat, 27 Jul 2013 08:05:51 +0100 Received: from Remus.metastack.local ([fe80::547c:3c42:e1da:eda2]) by Remus.metastack.local ([fe80::547c:3c42:e1da:eda2%10]) with mapi id 14.03.0123.003; Sat, 27 Jul 2013 08:05:51 +0100 From: David Allsopp To: "caml-list@inria.fr" Thread-Topic: [Caml-list] Re: portable truncate Thread-Index: AQHOipPKnY3uNnYCZUG5OPDxI/2GuZl4F9Og Date: Sat, 27 Jul 2013 07:05:49 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [172.16.0.18] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Organization: MetaStack Solutions Ltd. X-Scanned-By: MIMEDefang 2.65 on 172.16.0.20 X-Cloudmark-Analysis: v=1.1 cv=GaEGOwq9FwezmTggA+b6yC6zDZF2HYaK6RN/tSqdnVA= c=1 sm=0 a=IXlcok0kcmcA:10 a=VV7cZ3Qo45gA:10 a=cTs9vV391PwA:10 a=kj9zAlcOel0A:10 a=xqWC_Br6kY4A:10 a=ZOzjf2MOAAAA:8 a=yMhMjlubAAAA:8 a=Nvbk9eye2riTUi7xnrUA:9 a=CjuIK1q_8ugA:10 a=afu3mC3GKDcA:10 a=9HoI85csCRAA:10 a=HpAAvcLHHh0Zw7uRqdWCyQ==:117 Subject: RE: [Caml-list] Re: portable truncate Florent Monnier wrote: =20 > 2013/07/26, Florent Monnier wrote: > [...] > > 1) I thought that the module Unix only contains portable things for > > Windows, so it's not true? >=20 > This page indeed gives a list of unimplemented functions at the end: > [1] http://caml.inria.fr/pub/docs/manual-ocaml-4.00/manual036.html >=20 > but it depends which ocaml variants is used. >=20 > This page above says: > "The Cygwin port of OCaml fully implements all functions from the Unix > module. > The native Win32 ports implement a subset of them." >=20 > So this page talks about 2 ocaml variants: > - Cygwin ocaml, > - and native Win32 ocaml. >=20 > This other page, gives informations for 3 ocanl variants: > [2] http://caml.inria.fr/ocaml/portability.en.html That page is slightly out of date as it doesn't refer to the 64 bit MinGW p= ort :o) > which are > - native Microsoft > - native MinGW > - and Cygwin >=20 > I should probably understand frm this that both "native Microsoft" and > "native MinGW" are native Win32 ocaml. Correct > I made the error to think that native Win32 port only refers to ocaml > compiled with MSVC, while it seems that it also include protz's ocaml that > is a MinGW variant. Native in this context means "not Cygwin", indeed. > I'm still not sure though that compiling with MSVC or MinGW can be > considered equivalent. > And actually they seem not considering this page: > [2] http://caml.inria.fr/ocaml/portability.en.html I've done some limited Googling, so may be barking up the wrong tree. I bel= ieve that in Microsoft C world, the function ftrunctate is called _chsize (= http://msdn.microsoft.com/en-gb/library/aa246710(v=3Dvs.60).aspx) in io.h a= nd that MinGW defined a compatible ftruncate in unistd.h a long time ago. I= expect that the reason for not implementing ftruncate in win32unix origina= lly was either that whoever wrote it didn't know about _chsize or at the ti= me it didn't work properly (e.g. on Windows 9x). The Windows API functions = SetEndOfFile/SetFileValidData (which actually implement this) look comparat= ively new (Windows XP+), although Microsoft annoyingly altered the "Minimum= supported" sections of MSDN a while ago so "minimum" no longer means "intr= oduced". Altering unix is relatively easy if you've compiled your own OCaml - edit f= iles in otherlibs/win32unix and use make -f Makefile.nt [opt] to recompile.= You can simply copy the replacement files into your ocaml lib directory wh= ile experimenting. Patches adding missing functionality to win32unix tend t= o be accepted quite quickly in my experience... David