From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,29e13b74b6411821 X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!news.germany.com!news-stu1.dfn.de!news.uni-stuttgart.de!not-for-mail From: Stefan Bellon Newsgroups: comp.lang.ada Subject: Re: Ada.Directories.Size wraps on over 2Gb files Date: Mon, 10 Dec 2007 23:28:46 +0100 Organization: Comp.Center (RUS), U of Stuttgart, FRG Message-ID: <20071210232846.480b5898@cube.tz.axivion.com> References: <0db40dde-17f0-40a9-9dc0-55f9b0a8e1b1@x69g2000hsx.googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Trace: infosun2.rus.uni-stuttgart.de 1197325872 16694 129.69.226.24 (10 Dec 2007 22:31:12 GMT) X-Complaints-To: news@news.uni-stuttgart.de NNTP-Posting-Date: Mon, 10 Dec 2007 22:31:12 +0000 (UTC) X-Newsreader: Sylpheed-Claws 2.6.0 (GTK+ 2.8.20; i486-pc-linux-gnu) X-URL: http://www.axivion.com/ Xref: g2news1.google.com comp.lang.ada:18872 Date: 2007-12-10T23:28:46+01:00 List-Id: On Mo, 10 Dez, gpriv@axonx.com wrote: [2GB limitation] > Types are all seem to be long integers, so it looks like truncation is > being made somewhere in C code (?) I cannot speak for Ada.Directories.Size as I have not looked closer at it, but the same 2 GB restriction is present on other parts of the GNAT libraries at present as well (i.e. the whole of adaint.c does not make use of O_LARGEFILE), so we ended up in coding our own binding to the open/read/write/close category of functions with something like this: #define _LARGEFILE_SOURCE #define _LARGEFILE64_SOURCE #define _FILE_OFFSET_BITS 64 #include #include #include #include #ifndef __MINGW32__ #define PERM (S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH) #define O_BINARY 0 #else #define PERM (S_IREAD | S_IWRITE) #define O_LARGEFILE 0 #endif And later on we do something like the following: int my_open(const char *pathname) { return open (pathname, O_RDONLY | O_BINARY | O_LARGEFILE); } int my_create(const char *pathname) { return open (pathname, O_CREAT | O_WRONLY | O_TRUNC | O_BINARY | O_LARGEFILE, PERM); } NB: This is just an excerpt and only part of the code for illustration purposes. -- Stefan Bellon