🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #4034

Re: mmap()'ing the active file for innd and nnrpd

#4034
From: Peter da Silva
Date: Wed, 27 Dec 1995 00:00
33 lines
1934 bytes
In article <4bposb$4t1@piano.synapse.net>,
Evan Champion <evanc@synapse.net> wrote:
> I have been playing around with this a little bit on a small test
> program just to see what works and what doesn't.  The major problem I
> ran in to was how to actually represent the active file in memory.

Just mmap() it in, and build a table of pointers to it. The length of each
field is different, but they don't vary dynamically. So you could end up with
something like this:

	struct active_file_record {
		char *ng_name;	/* space terminated */
		char *ng_next;	/* fixed length unterminated ASCII */
		char *ng_first;	/* fixed length unterminated ASCII */
		char *ng_info;	/* newline terminated */
	} *afile;

	Allocate it with a central loop that looks like:

		afile[ng].ng_name = ptr;
		ptr = strchr(ptr, '\n');
		if(!ptr) break;
		ptr++;
	
	Then parse out the ng_first/ng_next as needed.
-- 
Peter da Silva    (NIC: PJD2)      `-_-'             1601 Industrial Boulevard
Bailey Network Management           'U`             Sugar Land, TX  77487-5013
+1 713 274 5180         "Har du kramat din varg idag?"                     USA
Bailey pays for my technical expertise.        My opinions probably scare them


Technical Details
Message-ID: <4bsf48$9fk@zuul.nmti.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.admin.technical.mbox.zip!not-for-mail
References: <4bp24r$ogm@piano.synapse.net> <4bposb$4t1@piano.synapse.net>

Show Full Headers
Complete Article Headers
Message-ID: <4bsf48$9fk@zuul.nmti.com>
Subject: Re: mmap()'ing the active file for innd and nnrpd
Date: Wed, 27 Dec 1995 00:00:00 +0000
From: peter@nmti.com (Peter da Silva)
References: <4bp24r$ogm@piano.synapse.net> <4bposb$4t1@piano.synapse.net>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.admin.technical.mbox.zip!not-for-mail
X-Deja-AN: 122969344
Distribution: world
Sender: zorch@ftp.UU.NET
Organization: Network/development platform support, NMTI
Newsgroups: news.software.nntp,news.admin.technical