🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #60231

Re: cnfs file size > 2Gb problem

#60231
From: Miquel van Smoorenburg
Date: Wed, 04 Sep 2002 21:12
64 lines
3531 bytes
In article <al4oua$1e3$2@ncc1701.cistron.net>,
Miquel van Smoorenburg <miquels.at.cistron.nl.spamtrap@netscum.nl> wrote:
>I'm now toying with the idea of hacking storage/cnfs/cnfs.c so
>that I can compile it with -D_LARGEFILE_SOURCE but NOT with
>-D_FILE_OFFSET_BITS=64, i.e. adding support for mmap64(),
>pread64(), stat64() and so on so that INN can be compiled
>without LFS yet cnfs.c knows about files > 2GB. Seems to be
>the best solution for now.

The patch below compiles, perhaps you can try if it works.
Apply with patch -p0 < cnfs64.patch in storage/cnfs

diff --exclude 00-orig --exclude *.o -ruN 00-orig/Makefile ./Makefile
--- 00-orig/Makefile	Mon Jul  9 11:14:45 2001
+++ ./Makefile	Wed Sep  4 18:47:27 2002
@@ -2,7 +2,7 @@
 
 include ../../Makefile.global
 
-CFLAGS	 = $(GCFLAGS) -I../../include -I.. 
+CFLAGS	 = $(GCFLAGS) -I../../include -I..  -D_LARGEFILE64_SOURCE
 
 SOURCES  = cnfs.c
 OBJECTS  = cnfs.o
diff --exclude 00-orig --exclude *.o -ruN 00-orig/cnfs-private.h ./cnfs-private.h
--- 00-orig/cnfs-private.h	Wed Apr  4 16:18:10 2001
+++ ./cnfs-private.h	Wed Sep  4 18:47:12 2002
@@ -13,8 +13,14 @@
 /* These values may have to be changed for 64-bit support on systems that
    don't support compilation options that increase the size of off_t and the
    size lseek() can handle (like Solaris does). */
-typedef off_t           CYCBUFF_OFF_T;
-#define	CNFSseek        lseek
+#if _LARGEFILE64_SOURCE && FILE_OFFSET_BITS != 64
+  typedef off64_t	CYCBUFF_OFF_T;
+# define CNFSseek	lseek64
+# define CNFS64
+#else
+  typedef off_t		CYCBUFF_OFF_T;
+# define CNFSseek	lseek
+#endif
 
 /* Page boundary on which to mmap() the CNFS article usage header.  Should
    be a multiple of the pagesize for all the architectures you expect might
diff --exclude 00-orig --exclude *.o -ruN 00-orig/cnfs.c ./cnfs.c
--- 00-orig/cnfs.c	Mon Oct 22 15:39:50 2001
+++ ./cnfs.c	Wed Sep  4 18:44:01 2002
@@ -27,6 +27,14 @@
 #include "cnfs.h"
 #include "cnfs-private.h"
 
+#ifdef CNFS64
+#  define mmap		mmap64
+#  define pread		pread64
+#  define pwrite	pwrite64
+#  define stat		stat64
+#  define open		open64
+#endif
+
 typedef struct {
     /**** Stuff to be cleaned up when we're done with the article */
     char		*base;		/* Base of mmap()ed art */

Technical Details
Message-ID: <al5sv5$79n$1@ncc1701.cistron.net>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!kibo.news.demon.net!demon!news2.euro.net!newsgate.cistron.nl!news.cistron.nl!not-for-mail
References: <al4h1g$gkl$1@news.ust.hk> <al4oua$1e3$2@ncc1701.cistron.net>

Show Full Headers
Complete Article Headers
Message-ID: <al5sv5$79n$1@ncc1701.cistron.net>
Subject: Re: cnfs file size > 2Gb problem
Date: Wed, 04 Sep 2002 21:12:05 +0000
From: "Miquel van Smoorenburg" <miquels.at.cistron.nl.spamtrap@netscum.nl>
References: <al4h1g$gkl$1@news.ust.hk> <al4oua$1e3$2@ncc1701.cistron.net>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!kibo.news.demon.net!demon!news2.euro.net!newsgate.cistron.nl!news.cistron.nl!not-for-mail
Newsgroups: news.software.nntp
Organization: Cistron
Lines: 63
Reply-To: miquels@cistron.nl
NNTP-Posting-Host: traveler.cistron-office.nl
Content-Type: text/plain; charset=iso-8859-15
X-Trace: ncc1701.cistron.net 1031173925 7479 62.216.29.67 (4 Sep 2002 21:12:05 GMT)
X-Complaints-To: abuse@cistron.nl
NNTP-Posting-Date: Wed, 4 Sep 2002 21:12:05 +0000 (UTC)
X-Newsreader: trn 4.0-test76 (Apr 2, 2001)
Originator: miquels@cistron-office.nl (Miquel van Smoorenburg)