diff --git a/www/pecl-APC-devel/Makefile b/www/pecl-APC-devel/Makefile index 3b7354a1616f..20e429e0829e 100644 --- a/www/pecl-APC-devel/Makefile +++ b/www/pecl-APC-devel/Makefile @@ -7,6 +7,7 @@ PORTNAME= APC DISTVERSION= 3.0.16 +PORTREVISION= 1 CATEGORIES= www MASTER_SITES= http://pecl.php.net/get/ PKGNAMEPREFIX= pecl- @@ -27,6 +28,7 @@ CONFIGURE_ARGS= --enable-apc OPTIONS= MMAP "Enable mmap memory support (default: IPC shm)" off \ SEMAPHORES "Enable sysv IPC semaphores (default: fcntl())" off \ + FILEHITS "Enable per request cache info" off \ PHP4_OPT "Little optimization to PHP4" off PORTDOCS= * @@ -41,6 +43,10 @@ CONFIGURE_ARGS+= --enable-apc-mmap CONFIGURE_ARGS+= --enable-apc-sem .endif +.if defined(WITH_FILEHITS) +CONFIGURE_ARGS+= --enable-apc-filehits +.endif + .if defined(WITH_PHP4_OPT) .if ${PHP_VER} == 4 .if exists(${LOCALBASE}/include/apache/httpd.h) diff --git a/www/pecl-APC-devel/files/patch-apc_sem.c b/www/pecl-APC-devel/files/patch-apc_sem.c new file mode 100644 index 000000000000..d83ba6d5a51f --- /dev/null +++ b/www/pecl-APC-devel/files/patch-apc_sem.c @@ -0,0 +1,35 @@ +# +# Fix http://pecl.php.net/bugs/bug.php?id=5280 +# +--- apc_sem.c.orig 2008-01-25 00:32:24.000000000 -0200 ++++ apc_sem.c 2008-01-25 00:35:28.000000000 -0200 +@@ -82,12 +82,16 @@ + } + } + +- if ((semid = semget(key, 1, IPC_CREAT | IPC_EXCL | perms)) >= 0) { ++ if ((semid = semget(key, 2, IPC_CREAT | IPC_EXCL | perms)) >= 0) { + /* sempahore created for the first time, initialize now */ + arg.val = initval; + if (semctl(semid, 0, SETVAL, arg) < 0) { + apc_eprint("apc_sem_create: semctl(%d,...) failed:", semid); + } ++ arg.val = getpid(); ++ if (semctl(semid, 1, SETVAL, arg) < 0) { ++ apc_eprint("apc_sem_create: semctl(%d,...) failed:", semid); ++ } + } + else if (errno == EEXIST) { + /* sempahore already exists, don't initialize */ +@@ -107,7 +111,10 @@ + { + /* we expect this call to fail often, so we do not check */ + union semun arg; +- semctl(semid, 0, IPC_RMID, arg); ++ int semPid = semctl(semid, 1, GETVAL, 0); ++ if (semPid == getpid()) { ++ semctl(semid, 0, IPC_RMID, arg); ++ } + } + + void apc_sem_lock(int semid) diff --git a/www/pecl-APC/Makefile b/www/pecl-APC/Makefile index 3b7354a1616f..20e429e0829e 100644 --- a/www/pecl-APC/Makefile +++ b/www/pecl-APC/Makefile @@ -7,6 +7,7 @@ PORTNAME= APC DISTVERSION= 3.0.16 +PORTREVISION= 1 CATEGORIES= www MASTER_SITES= http://pecl.php.net/get/ PKGNAMEPREFIX= pecl- @@ -27,6 +28,7 @@ CONFIGURE_ARGS= --enable-apc OPTIONS= MMAP "Enable mmap memory support (default: IPC shm)" off \ SEMAPHORES "Enable sysv IPC semaphores (default: fcntl())" off \ + FILEHITS "Enable per request cache info" off \ PHP4_OPT "Little optimization to PHP4" off PORTDOCS= * @@ -41,6 +43,10 @@ CONFIGURE_ARGS+= --enable-apc-mmap CONFIGURE_ARGS+= --enable-apc-sem .endif +.if defined(WITH_FILEHITS) +CONFIGURE_ARGS+= --enable-apc-filehits +.endif + .if defined(WITH_PHP4_OPT) .if ${PHP_VER} == 4 .if exists(${LOCALBASE}/include/apache/httpd.h) diff --git a/www/pecl-APC/files/patch-apc_sem.c b/www/pecl-APC/files/patch-apc_sem.c new file mode 100644 index 000000000000..d83ba6d5a51f --- /dev/null +++ b/www/pecl-APC/files/patch-apc_sem.c @@ -0,0 +1,35 @@ +# +# Fix http://pecl.php.net/bugs/bug.php?id=5280 +# +--- apc_sem.c.orig 2008-01-25 00:32:24.000000000 -0200 ++++ apc_sem.c 2008-01-25 00:35:28.000000000 -0200 +@@ -82,12 +82,16 @@ + } + } + +- if ((semid = semget(key, 1, IPC_CREAT | IPC_EXCL | perms)) >= 0) { ++ if ((semid = semget(key, 2, IPC_CREAT | IPC_EXCL | perms)) >= 0) { + /* sempahore created for the first time, initialize now */ + arg.val = initval; + if (semctl(semid, 0, SETVAL, arg) < 0) { + apc_eprint("apc_sem_create: semctl(%d,...) failed:", semid); + } ++ arg.val = getpid(); ++ if (semctl(semid, 1, SETVAL, arg) < 0) { ++ apc_eprint("apc_sem_create: semctl(%d,...) failed:", semid); ++ } + } + else if (errno == EEXIST) { + /* sempahore already exists, don't initialize */ +@@ -107,7 +111,10 @@ + { + /* we expect this call to fail often, so we do not check */ + union semun arg; +- semctl(semid, 0, IPC_RMID, arg); ++ int semPid = semctl(semid, 1, GETVAL, 0); ++ if (semPid == getpid()) { ++ semctl(semid, 0, IPC_RMID, arg); ++ } + } + + void apc_sem_lock(int semid)