com php-src: Fix shm api detection test for opcache module on FreeBSD: ext/opcache/config.m4 ext/opcache/shared_alloc_shm.c
| From: | Nikita Popov | Date: | Mon, 11 Mar 2019 09:19:35 +0000 |
| Subject: | com php-src: Fix shm api detection test for opcache module on FreeBSD: ext/opcache/config.m4 ext/opcache/shared_alloc_shm.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-105068@lists.php.net to get a copy of this message | ||
Commit: f8a24975848848c9bfaccc174aeeb673e6f946a5
Author: David Carlier <devnexen@gmail.com> Fri, 1 Mar 2019 11:33:29 +0000
Committer: Nikita Popov <nikita.ppv@gmail.com> Mon, 11 Mar 2019 10:19:35 +0100
Parents: df6e9fae8f85f9799866e76fafc82f90373574e7
Branches: PHP-7.4 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=f8a24975848848c9bfaccc174aeeb673e6f946a5
Log:
Fix shm api detection test for opcache module on FreeBSD
Per man page the shm_open path should start with / and contain no
further slashes.
Changed paths:
M ext/opcache/config.m4
M ext/opcache/shared_alloc_shm.c
Diff:
diff --git a/ext/opcache/config.m4 b/ext/opcache/config.m4
index a137c61..314a4fe 100644
--- a/ext/opcache/config.m4
+++ b/ext/opcache/config.m4
@@ -225,7 +225,7 @@ int main() {
char *shm;
char tmpname[4096];
- sprintf(tmpname,"test.shm.%dXXXXXX", getpid());
+ sprintf(tmpname,"/opcache.test.shm.%dXXXXXX", getpid());
if (mktemp(tmpname) == NULL) {
return 1;
}
@@ -294,7 +294,7 @@ int main() {
char *shm;
char tmpname[4096];
- sprintf(tmpname,"test.shm.%dXXXXXX", getpid());
+ sprintf(tmpname,"/opcache.test.shm.%dXXXXXX", getpid());
if (mktemp(tmpname) == NULL) {
return 1;
}
diff --git a/ext/opcache/shared_alloc_shm.c b/ext/opcache/shared_alloc_shm.c
index 4d93b3f..29225be 100644
--- a/ext/opcache/shared_alloc_shm.c
+++ b/ext/opcache/shared_alloc_shm.c
@@ -60,13 +60,13 @@ static int create_segments(size_t requested_size, zend_shared_segment_shm ***sha
int shmget_flags;
zend_shared_segment_shm *shared_segments;
- seg_allocate_size = SEG_ALLOC_SIZE_MAX;
- /* determine segment size we _really_ need:
- * no more than to include requested_size
- */
- while (requested_size * 2 <= seg_allocate_size && seg_allocate_size >
SEG_ALLOC_SIZE_MIN) {
- seg_allocate_size >>= 1;
- }
+ seg_allocate_size = SEG_ALLOC_SIZE_MAX;
+ /* determine segment size we _really_ need:
+ * no more than to include requested_size
+ */
+ while (requested_size * 2 <= seg_allocate_size && seg_allocate_size >
SEG_ALLOC_SIZE_MIN) {
+ seg_allocate_size >>= 1;
+ }
shmget_flags = IPC_CREAT|SHM_R|SHM_W|IPC_EXCL;