From owner-freebsd-hackers Mon Jan 12 11:41:06 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.7/8.8.7) id LAA18624 for hackers-outgoing; Mon, 12 Jan 1998 11:41:06 -0800 (PST) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from omega.noc.easynet.net (omega.noc.easynet.net [193.131.248.227]) by hub.freebsd.org (8.8.7/8.8.7) with SMTP id LAA18596 for ; Mon, 12 Jan 1998 11:40:52 -0800 (PST) (envelope-from chrisy@omega.noc.easynet.net) Received: (qmail 29298 invoked by uid 1001); 12 Jan 1998 19:40:53 -0000 Message-ID: <19980112194053.29382@flix.net> Date: Mon, 12 Jan 1998 19:40:53 +0000 From: Chrisy Luke To: Tom Cc: joelh@gnu.org, freebsd-hackers@FreeBSD.ORG Subject: Re: sharable static arrays? References: <19980112112455.48744@flix.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.88 In-Reply-To: ; from Tom on Mon, Jan 12, 1998 at 11:16:48AM -0800 Organization: The Flirble Internet Exchange X-URL: http://www.flix.net/ X-MOD1: X X-MOD2: X X-Fortune: "The more data I punch in this card, the lighter it becomes, and the lower the mailing cost." -- Stan Kelly-Bootle, "The Devil's DP Dictionary" X-FTP: ftp://ftp.flirble.org/ Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk Tom wrote (on Jan 12): > > On Mon, 12 Jan 1998, Chrisy Luke wrote: > > > Joel Ray Holveck wrote (on Jan 12): > > > Are static arrays shared across multiple invocations of a program? > > > > Not intrinsicly. You'll have to either use SYS-V style shared > > memory (options SYSVSHM SYSVSEM SYSVMSG in a kernel config and > > shmget(2) etc) or use BSD style mapped memory (mmap(2)). > > Remember these are _static_ arrays, which mean they are directly coded He said static, not const. There's a difference. Static data can be modified, it's just by inference hidden from higher scopes. Static memory is shared (it's setup by the C startup module) in so far as the initial state is the same. Any changes will not be seen across multiple invokations. For that, you need shared memory of some nature. In this case, of course, the area should be marked volatile... :-) Chris. -- == chris@easynet.net, chrisy@flix.net, chrisy@flirble.org. == Head of Systems for Easynet Group PLC.