php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #56196 apc_sma.c "Minor #if cleanup" seems wrong
Submitted: 2004-09-23 22:25 UTC Modified: 2004-09-24 00:10 UTC
From: xuefer at 21cn dot com Assigned: rasmus (profile)
Status: Closed Package: APC (PECL)
PHP Version: Irrelevant OS: linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: xuefer at 21cn dot com
New email:
PHP Version: OS:

 

 [2004-09-23 22:25 UTC] xuefer at 21cn dot com
Description:
------------
the #if
introduced in
http://cvs.php.net/diff.php/pecl/apc/apc_sma.c?sbt=1&r1=1.8&r2=1.9&ty=h
but removed in
http://cvs.php.net/diff.php/pecl/apc/apc_sma.c?sbt=1&r1=1.16&r2=1.17&ty=h

see also apc_main.c:
int apc_module_init()
{
    TSRMLS_FETCH();
    /* apc initialization */
#if APC_MMAP
    apc_sma_init(APCG(shm_segments), APCG(shm_size)*1024*1024, APCG(mmap_file_mask));
#else
    apc_sma_init(APCG(shm_segments), APCG(shm_size)*1024*1024, NULL);
#endif

the NULL
make apc_sma.c apc_sma_init() always set sma_numseg=1
because:
=========
    if(!mmap_file_mask ||
.......
sma_numreg=1
====cut=====

i cannot set sma_numreg in php.ini



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-09-23 23:34 UTC] Rasmus@php.net
That was the intent actually.  As the comment states, having multiple anonymous mmap segments doesn't make sense to me, so when no file_mask is given it means we are doing an anonymous mmap and thus we force sma_numseg to 1.  Why do you think this is wrong?
 [2004-09-24 00:00 UTC] xuefer at 21cn dot com
(sorry for my too simple explainatoin)

i'm not using MMAP, do i still have anonymous mmap?
or do i have shm instead of mmap?
i don't go against with any changes about mmap, but should shm be limited to 1 segments?

maybe i was wrong, but i failed with:
shm_size=60 (failed to create shm)
shm_seents=1
OR
shm_size=30
shm_seents=2 (apc limit it to 1)

in another word, i can't make cache for apc

apc_main.c is ok
for apc_sma.c:
the 1st cvs url looks good, but the 2nd removed it seems wrong.


in apc_main.c
#if APC_MMAP
....
#else
    apc_sma_init(APCG(shm_segments), APCG(shm_size)*1024*1024, NULL);
#endif

when compiled without MMAP
do u see the NULL?
this will hit "if (!mmap_file_mask ||" in apc_sma.c
 [2004-09-24 00:10 UTC] Rasmus@php.net
Ah, in the non-mmap case.  Yes, I guess you are right.  I haven't tested non-mmap in ages.  Just isn't a lot of reasons to use shm instead of mmap these days.

I have fixed this in CVS now.
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Thu Apr 18 15:01:25 2019 UTC