 The below patch adds BIGFILE64 support to Phobos, so that file sizes of +2GB
 can be used under Linux.

 BEWARE: most of the changes haven't undergone any testing at all

diff -ur dmd-1.014/src/phobos/std/c/linux/linux.d dmd-1.014_bigfile64/src/phobos/std/c/linux/linux.d
--- dmd-1.014/src/phobos/std/c/linux/linux.d	2007-04-26 23:57:26.000000000 +0200
+++ dmd-1.014_bigfile64/src/phobos/std/c/linux/linux.d	2007-04-28 19:29:59.000000000 +0200
@@ -14,7 +14,8 @@
 private import std.c.stdio;
 
 alias int pid_t;
-alias int off_t;
+alias ptrdiff_t off_t;
+alias long off64_t;
 alias uint mode_t;
 
 alias uint uid_t;
@@ -74,6 +75,30 @@
     O_APPEND = 02000,
 }
 
+
+
+import std.stdint;
+align(1) struct struct_stat64{
+	uint64_t st_dev;
+	uint32_t __pad1;
+	uint32_t __st_ino;
+	uint32_t st_mode;
+	uint32_t st_nlink;
+	uint32_t st_uid;
+	uint32_t st_gid;
+	uint64_t st_rdev;
+	uint32_t __pad2;
+	uint64_t st_size;
+	uint32_t st_blksize;
+	uint64_t st_blocks;
+	uint64_t st_atime;
+	uint64_t st_mtime;
+	uint64_t st_ctime;
+	uint64_t st_ino;
+}
+
+static assert(96 == struct_stat64.sizeof);
+
 struct struct_stat	// distinguish it from the stat() function
 {
     ulong st_dev;	/// device
@@ -125,13 +150,18 @@
 {
     int access(char*, int);
     int open(char*, int, ...);
+    int open64(char*, int, ...);
     int read(int, void*, int);
     int write(int, void*, int);
     int close(int);
     int lseek(int, int, int);
+    int lseek64(int, off64_t, int);
     int fstat(int, struct_stat*);
+    int fstat64(int, struct_stat64*);
     int lstat(char*, struct_stat*);
+    int lstat64(char*, struct_stat64*);
     int stat(char*, struct_stat*);
+    int stat64(char*, struct_stat64*);
     int chdir(char*);
     int mkdir(char*, int);
     int rmdir(char*);
@@ -151,6 +181,7 @@
     int chroot(char*);
     size_t confstr(int, char*, size_t);
     int creat(char*, mode_t);
+    int creat64(char*, mode_t);
     char* ctermid(char*);
     int dirfd(DIR*);
     char* dirname(char*);
@@ -274,6 +305,7 @@
 extern (C)
 {
 void* mmap(void*, size_t, int, int, int, off_t);
+void* mmap64(void*, size_t, int, int, int, off64_t);
 const void* MAP_FAILED = cast(void*)-1;
 
 int munmap(void*, size_t);
@@ -316,6 +348,15 @@
 	char[256] d_name;
     }
     
+    struct dirent64
+    {
+	long d_ino;
+	off64_t d_off;
+	ushort d_reclen;
+	ubyte d_type;
+	char[256] d_name;
+    }
+    
     struct DIR
     {
 	// Managed by OS.
@@ -324,6 +365,7 @@
     DIR* opendir(char* name);
     int closedir(DIR* dir);
     dirent* readdir(DIR* dir);
+    dirent64* readdir64(DIR* dir);
     void rewinddir(DIR* dir);
     off_t telldir(DIR* dir);
     void seekdir(DIR* dir, off_t offset);
diff -ur dmd-1.014/src/phobos/std/c/stdio.d dmd-1.014_bigfile64/src/phobos/std/c/stdio.d
--- dmd-1.014/src/phobos/std/c/stdio.d	2007-04-26 23:57:24.000000000 +0200
+++ dmd-1.014_bigfile64/src/phobos/std/c/stdio.d	2007-04-28 18:50:29.000000000 +0200
@@ -165,12 +165,16 @@
 }
 
 alias int fpos_t;	///
+alias long fpos64_t;	///
 
 char *	 tmpnam(char *);	///
 FILE *	 fopen(char *,char *);	///
+FILE *	 fopen64(char *,char *);	///
 FILE *	 _fsopen(char *,char *,int );	///
 FILE *	 freopen(char *,char *,FILE *);	///
+FILE *	 freopen64(char *,char *,FILE *);	///
 int	 fseek(FILE *,int,int);	///
+int	 fseek64(FILE *,long,int);	///
 int	 ftell(FILE *);	///
 char *	 fgets(char *,int,FILE *);	///
 int	 fgetc(FILE *);	///
@@ -200,7 +204,9 @@
 int	 rename(char *,char *);	///
 void	 perror(char *);	///
 int	 fgetpos(FILE *,fpos_t *);	///
+int	 fgetpos64(FILE *,fpos64_t *);	///
 int	 fsetpos(FILE *,fpos_t *);	///
+int	 fsetpos64(FILE *,fpos64_t *);	///
 FILE *	 tmpfile();	///
 int	 _rmtmp();
 int      _fillbuf(FILE *);
diff -ur dmd-1.014/src/phobos/std/file.d dmd-1.014_bigfile64/src/phobos/std/file.d
--- dmd-1.014/src/phobos/std/file.d	2007-04-26 23:57:24.000000000 +0200
+++ dmd-1.014_bigfile64/src/phobos/std/file.d	2007-04-28 19:30:35.000000000 +0200
@@ -882,11 +882,11 @@
 void[] read(char[] name)
 {
     uint numread;
-    struct_stat statbuf;
+    struct_stat64 statbuf;
 
     auto namez = toStringz(name);
     //printf("file.read('%s')\n",namez);
-    auto fd = std.c.linux.linux.open(namez, O_RDONLY);
+    auto fd = std.c.linux.linux.open64(namez, O_RDONLY);
     if (fd == -1)
     {
         //printf("\topen error, errno = %d\n",getErrno());
@@ -894,12 +894,16 @@
     }
 
     //printf("\tfile opened\n");
-    if (std.c.linux.linux.fstat(fd, &statbuf))
+    if (std.c.linux.linux.fstat64(fd, &statbuf))
     {
         //printf("\tfstat error, errno = %d\n",getErrno());
         goto err2;
     }
-    auto size = statbuf.st_size;
+    size_t size = cast(size_t) statbuf.st_size;
+    if(size != statbuf.st_size){
+    	std.c.linux.linux.close(fd);
+	throw new FileException(name, "file too large");
+    }
     auto buf = std.gc.malloc(size);
     if (buf.ptr)
 	std.gc.hasNoPointers(buf.ptr);
@@ -972,7 +976,7 @@
     char *namez;
 
     namez = toStringz(name);
-    fd = std.c.linux.linux.open(namez, O_APPEND | O_WRONLY | O_CREAT, 0660);
+    fd = std.c.linux.linux.open64(namez, O_APPEND | O_WRONLY | O_CREAT, 0660);
     if (fd == -1)
         goto err;
 
@@ -1023,14 +1027,14 @@
 
 ulong getSize(char[] name)
 {
-    uint size;
+    ulong size;
     int fd;
-    struct_stat statbuf;
+    struct_stat64 statbuf;
     char *namez;
 
     namez = toStringz(name);
     //printf("file.getSize('%s')\n",namez);
-    fd = std.c.linux.linux.open(namez, O_RDONLY);
+    fd = std.c.linux.linux.open64(namez, O_RDONLY);
     if (fd == -1)
     {
         //printf("\topen error, errno = %d\n",getErrno());
@@ -1038,7 +1042,7 @@
     }
 
     //printf("\tfile opened\n");
-    if (std.c.linux.linux.fstat(fd, &statbuf))
+    if (std.c.linux.linux.fstat64(fd, &statbuf))
     {
         //printf("\tfstat error, errno = %d\n",getErrno());
         goto err2;
@@ -1067,11 +1071,11 @@
 
 uint getAttributes(char[] name)
 {
-    struct_stat statbuf;
+    struct_stat64 statbuf;
     char *namez;
 
     namez = toStringz(name);
-    if (std.c.linux.linux.stat(namez, &statbuf))
+    if (std.c.linux.linux.stat64(namez, &statbuf))
     {
 	throw new FileException(name, getErrno());
     }
@@ -1086,11 +1090,11 @@
 
 void getTimes(char[] name, out d_time ftc, out d_time fta, out d_time ftm)
 {
-    struct_stat statbuf;
+    struct_stat64 statbuf;
     char *namez;
 
     namez = toStringz(name);
-    if (std.c.linux.linux.stat(namez, &statbuf))
+    if (std.c.linux.linux.stat64(namez, &statbuf))
     {
 	throw new FileException(name, getErrno());
     }
@@ -1266,11 +1270,11 @@
     void doStat()
     {
 	int fd;
-	struct_stat statbuf;
+	struct_stat64 statbuf;
 	char* namez;
 
 	namez = toStringz(name);
-	if (std.c.linux.linux.stat(namez, &statbuf))
+	if (std.c.linux.linux.stat64(namez, &statbuf))
 	{
 	    //printf("\tstat error, errno = %d\n",getErrno());
 	    return;
@@ -1392,13 +1396,13 @@
 {
   version (all)
   {
-    struct_stat statbuf;
+    struct_stat64 statbuf;
 
     char* fromz = toStringz(from);
     char* toz = toStringz(to);
     //printf("file.copy(from='%s', to='%s')\n", fromz, toz);
 
-    int fd = std.c.linux.linux.open(fromz, O_RDONLY);
+    int fd = std.c.linux.linux.open64(fromz, O_RDONLY);
     if (fd == -1)
     {
         //printf("\topen error, errno = %d\n",getErrno());
@@ -1406,13 +1410,13 @@
     }
 
     //printf("\tfile opened\n");
-    if (std.c.linux.linux.fstat(fd, &statbuf))
+    if (std.c.linux.linux.fstat64(fd, &statbuf))
     {
         //printf("\tfstat error, errno = %d\n",getErrno());
         goto err2;
     }
 
-    int fdw = std.c.linux.linux.open(toz, O_CREAT | O_WRONLY | O_TRUNC, 0660);
+    int fdw = std.c.linux.linux.open64(toz, O_CREAT | O_WRONLY | O_TRUNC, 0660);
     if (fdw == -1)
     {
         //printf("\topen error, errno = %d\n",getErrno());
@@ -1431,8 +1435,8 @@
         goto err4;
     }
 
-    for (size_t size = statbuf.st_size; size; )
-    {	size_t toread = (size > BUFSIZ) ? BUFSIZ : size;
+    for (ulong size = statbuf.st_size; size; )
+    {	size_t toread = (size > BUFSIZ) ? BUFSIZ : cast(size_t) size;
 
 	auto n = std.c.linux.linux.read(fd, buf, toread);
 	if (n != toread)
