Return-Path: X-Original-To: apmail-httpd-modules-dev-archive@minotaur.apache.org Delivered-To: apmail-httpd-modules-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id DD21D7C7C for ; Tue, 29 Nov 2011 09:09:00 +0000 (UTC) Received: (qmail 19236 invoked by uid 500); 29 Nov 2011 09:09:00 -0000 Delivered-To: apmail-httpd-modules-dev-archive@httpd.apache.org Received: (qmail 19187 invoked by uid 500); 29 Nov 2011 09:08:57 -0000 Mailing-List: contact modules-dev-help@httpd.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: modules-dev@httpd.apache.org Delivered-To: mailing list modules-dev@httpd.apache.org Received: (qmail 19175 invoked by uid 99); 29 Nov 2011 09:08:57 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 29 Nov 2011 09:08:57 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of ignazb@gmail.com designates 209.85.215.173 as permitted sender) Received: from [209.85.215.173] (HELO mail-ey0-f173.google.com) (209.85.215.173) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 29 Nov 2011 09:08:49 +0000 Received: by eaai10 with SMTP id i10so4362220eaa.18 for ; Tue, 29 Nov 2011 01:08:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; bh=CXIuyCN5lWCy2DUBWHVQheiL92vIFDnbGe9CpPF7QuE=; b=lDN57RHP88W0XqnmMahb0TxH+nJrXj/euCgdOVAX5yZnrIm9szut2350dsGuW7Gb62 KVGj+s28D0c3HuFpW9qwbCCQYdxjlPT7yDV3RcZ3sggZ6hwInqXrq4+tsLNb5vDJeaoJ WhwMEpWGfJKHyIoM/561IRKnGJYEPApNv4Hzg= MIME-Version: 1.0 Received: by 10.180.106.65 with SMTP id gs1mr39910581wib.42.1322557709473; Tue, 29 Nov 2011 01:08:29 -0800 (PST) Received: by 10.180.20.100 with HTTP; Tue, 29 Nov 2011 01:08:29 -0800 (PST) In-Reply-To: References: Date: Tue, 29 Nov 2011 10:08:29 +0100 Message-ID: Subject: Re: Binary Tree Shared Memory Problem From: Ignaz Birnstingl To: modules-dev@httpd.apache.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org > Hi, is there any example mod_slotmem codes that we can understand the > usage? Or could you give me an usage example? Sorry, I can't. I haven't used it myself but someone mentioned it in one of your previous threads. > And i want to ask a question, > is it a problem to create > > typedef struct node { > =A0 =A0ELEMENT node_element; > =A0 =A0struct node *left; > =A0 =A0struct node *right; > }NODE; > > kind of struct. A struct that has two struct elements. As I said before the pointers will not work if another process attaches to the shared memory segment. If only Apache child processes use the shared memory segment then IMHO the mapping should be the same (as fork() preserves mappings) and it might be safe to use pointers. You will need to take a look at your newNode() function: That will always return the same address; you could keep a counter (inside the shared memory segment) which tells you where to "allocate" the next bytes from. -- Ignaz