Return-Path: X-Original-To: apmail-apr-dev-archive@www.apache.org Delivered-To: apmail-apr-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 1CCBD101DA for ; Fri, 24 Jan 2014 23:51:28 +0000 (UTC) Received: (qmail 23240 invoked by uid 500); 24 Jan 2014 23:51:20 -0000 Delivered-To: apmail-apr-dev-archive@apr.apache.org Received: (qmail 23066 invoked by uid 500); 24 Jan 2014 23:51:19 -0000 Mailing-List: contact dev-help@apr.apache.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Id: Delivered-To: mailing list dev@apr.apache.org Received: (qmail 23047 invoked by uid 99); 24 Jan 2014 23:51:19 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 24 Jan 2014 23:51:19 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=5.0 tests=RCVD_IN_DNSWL_NONE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy includes SPF record at spf.trusted-forwarder.org) Received: from [76.96.30.48] (HELO qmta05.emeryville.ca.mail.comcast.net) (76.96.30.48) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 24 Jan 2014 23:51:14 +0000 Received: from omta13.emeryville.ca.mail.comcast.net ([76.96.30.52]) by qmta05.emeryville.ca.mail.comcast.net with comcast id HzZl1n00517UAYkA5zquyL; Fri, 24 Jan 2014 23:50:54 +0000 Received: from [192.168.199.10] ([69.251.80.74]) by omta13.emeryville.ca.mail.comcast.net with comcast id Hzqr1n00f1cCKD98ZzqsaB; Fri, 24 Jan 2014 23:50:54 +0000 Content-Type: text/plain; charset=iso-8859-1 Mime-Version: 1.0 (Mac OS X Mail 7.2 \(1865.1\)) Subject: Re: ftok (Was: Re: svn commit: r1561150 - /httpd/httpd/trunk/server/core.c) From: Jim Jagielski In-Reply-To: Date: Fri, 24 Jan 2014 18:50:50 -0500 Cc: httpd , apr Content-Transfer-Encoding: quoted-printable Message-Id: <044453D1-31AE-4B6D-BC6A-9F7FFA6458F7@jaguNET.com> References: <20140124202437.12DBC2388900@eris.apache.org> To: Yann Ylavic X-Mailer: Apple Mail (2.1865.1) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net; s=q20121106; t=1390607454; bh=VQrZqwNR5LXGher9oD60HYQ/SK4mTd4ACfk+bIRdlMk=; h=Received:Received:Content-Type:Mime-Version:Subject:From:Date: Message-Id:To; b=eqGGWtBHFuwjqlVkXWAx3SO2CbHapph21Gy20z7ACdjmb0+gqwX4KDtjfTCKBd7cf n8DO4WbJkKEtpcpCYp+aUpvQ/WWwXHLjYB3+A+CAPCr051PnopRVB/qQpwsxnT3rFX ikbgOUJqlRPfZZD0qPEnWeGs4Pmb9ncgiIxxXyuixCL8meLHyBNUnZjXm0B2UxhsjN M/KNOZO6oRyQyMESUXGlzgkIou9MZY2itgcC2Lq50Ybmf/Bz8NoGoKuygmiYDf3auC r/uRamZC72r8ChgRljFHIPaNSAmwxUkQszWXt78EEl+pN9Budk3ApjPxjs2AzJ5Fij jYmwA+T2AN8Vg== X-Virus-Checked: Checked by ClamAV on apache.org I think it could be debated on whether or not ftok(...,1) is part of the ABI or not. The more I think about it, it's not. But the fact that both slotmem and mod_fcgid, which are *our* projects, "use" that knowledge, makes me wonder who else makes that assumption. What do others think...? It would be easy to make our generation of a shmkey more robust by "breaking" that agreement, and to handle slotmem we add apr_shm_perms() to APR 1.5.1 and have httpd 2.4.8 require 1.5.1 or later... Or we just consider it all a limitation of SysV based shm and just keep things as is. On Jan 24, 2014, at 6:40 PM, Yann Ylavic wrote: > Why couldn't APR document on using ftok(filename, = filename[strlen(filename)-1]) for released versions, and do the right = thing in trunk? > Is ftok(filename, 1) part of the ABI since the change would break = existing consumers? > I can't see any solution if that's the case. >=20 >=20 > On Sat, Jan 25, 2014 at 12:20 AM, Jim Jagielski = wrote: > It's easy to generate something unique... the problem is that > external APR users (such as mod_fcgid, etc) occasionally need > to adjust the segment resources, and thus call ftok(...). Unless > both APR *and* the users use the same proj_id, then they won't > get the right segment (if at all). >=20 > I just couldn't think of an easy way to get around that > except for having 1.5.1 break ABI. >=20 > What we need is apr_shm_ftok() that replaces ftok, both > internally to unix/shmem.c as well as to users. We still > would need to worry about versioning there as well since > APR consumers would need to be aware if that function > exists or not. >=20 > On Jan 24, 2014, at 6:00 PM, Yann Ylavic wrote: >=20 > > According to the man = (http://pubs.opengroup.org/onlinepubs/009696899/functions/ftok.html), = ftok() uses only the low-order 8-bits of the id. > > Maybe the APR could use the last char of the filename instead, so = that the users knows and can choose it. > > For APR's internal/choosen filenames (if any), this byte could be = generated randomly. > > > > > > On Fri, Jan 24, 2014 at 10:57 PM, Jim Jagielski = wrote: > > On httpd there was a discussion regarding versioning, and > > this got me thinking... > > > > Included in the APR 1.5.1 changes is an internal change > > to how apr_shm_create(), when using APR_USE_SHMEM_SHMGET, > > calculates the key (via ftok())... > > > > The problem (see the Bugz report) was that using the constant > > 1 would cause collisions, so I adjusted it to use a hash > > of the filename. The problem there is that any external > > APR users that needed to also determine the key needs to > > be aware of that. And from what I can see, there is no > > easy way to do that. > > > > So I will be pulling that from 2.0-dev and 1.5-dev until > > we can figure out a better way. Ideas appreciated. > > >=20 >=20