Skip to content

Commit 90f43ca

Browse files
committed
The "flock" structure has to be writable on AIX.
1 parent 0ea2bfb commit 90f43ca

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

ext/opcache/ZendAccelerator.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,11 @@ static inline void accel_restart_enter(TSRMLS_D)
482482
#ifdef ZEND_WIN32
483483
INCREMENT(restart_in);
484484
#else
485+
# ifdef _AIX
486+
static FLOCK_STRUCTURE(restart_in_progress, F_WRLCK, SEEK_SET, 2, 1);
487+
# else
485488
static const FLOCK_STRUCTURE(restart_in_progress, F_WRLCK, SEEK_SET, 2, 1);
489+
#endif
486490

487491
if (fcntl(lock_file, F_SETLK, &restart_in_progress) == -1) {
488492
zend_accel_error(ACCEL_LOG_DEBUG, "RestartC(+1): %s (%d)", strerror(errno), errno);
@@ -497,7 +501,11 @@ static inline void accel_restart_leave(TSRMLS_D)
497501
ZCSG(restart_in_progress) = 0;
498502
DECREMENT(restart_in);
499503
#else
504+
# ifdef _AIX
505+
static FLOCK_STRUCTURE(restart_finished, F_UNLCK, SEEK_SET, 2, 1);
506+
# else
500507
static const FLOCK_STRUCTURE(restart_finished, F_UNLCK, SEEK_SET, 2, 1);
508+
# endif
501509

502510
ZCSG(restart_in_progress) = 0;
503511
if (fcntl(lock_file, F_SETLK, &restart_finished) == -1) {
@@ -535,7 +543,11 @@ static inline void accel_activate_add(TSRMLS_D)
535543
#ifdef ZEND_WIN32
536544
INCREMENT(mem_usage);
537545
#else
546+
# ifdef _AIX
547+
static FLOCK_STRUCTURE(mem_usage_lock, F_RDLCK, SEEK_SET, 1, 1);
548+
# else
538549
static const FLOCK_STRUCTURE(mem_usage_lock, F_RDLCK, SEEK_SET, 1, 1);
550+
# endif
539551

540552
if (fcntl(lock_file, F_SETLK, &mem_usage_lock) == -1) {
541553
zend_accel_error(ACCEL_LOG_DEBUG, "UpdateC(+1): %s (%d)", strerror(errno), errno);
@@ -552,7 +564,11 @@ static inline void accel_deactivate_sub(TSRMLS_D)
552564
ZCG(counted) = 0;
553565
}
554566
#else
567+
# ifdef _AIX
568+
static FLOCK_STRUCTURE(mem_usage_unlock, F_UNLCK, SEEK_SET, 1, 1);
569+
# else
555570
static const FLOCK_STRUCTURE(mem_usage_unlock, F_UNLCK, SEEK_SET, 1, 1);
571+
# endif
556572

557573
if (fcntl(lock_file, F_SETLK, &mem_usage_unlock) == -1) {
558574
zend_accel_error(ACCEL_LOG_DEBUG, "UpdateC(-1): %s (%d)", strerror(errno), errno);
@@ -565,7 +581,11 @@ static inline void accel_unlock_all(TSRMLS_D)
565581
#ifdef ZEND_WIN32
566582
accel_deactivate_sub(TSRMLS_C);
567583
#else
584+
# ifdef _AIX
585+
static FLOCK_STRUCTURE(mem_usage_unlock_all, F_UNLCK, SEEK_SET, 0, 0);
586+
# else
568587
static const FLOCK_STRUCTURE(mem_usage_unlock_all, F_UNLCK, SEEK_SET, 0, 0);
588+
# endif
569589

570590
if (fcntl(lock_file, F_SETLK, &mem_usage_unlock_all) == -1) {
571591
zend_accel_error(ACCEL_LOG_DEBUG, "UnlockAll: %s (%d)", strerror(errno), errno);

0 commit comments

Comments
 (0)