Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions UPGRADING.INTERNALS
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ PHP 8.7 INTERNALS UPGRADE NOTES
dependencies from PHP.

- Removed:
. The HAVE_STRUCT_FLOCK configure macro was removed.
. The ZEND_LOG_XOR() macro was removed.
. The ZEND_TRUTH() macro was removed.
. Removed zend_execute_scripts(). Manually call zend_execute_script() in a
Expand Down
1 change: 0 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,6 @@ AC_STRUCT_TIMEZONE

PHP_MISSING_TIME_R_DECL

AC_CHECK_TYPES([struct flock],,,[#include <fcntl.h>])
AC_CHECK_TYPES([socklen_t], [], [], [
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
Expand Down
12 changes: 3 additions & 9 deletions ext/opcache/zend_file_cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,16 +93,9 @@ static int zend_file_cache_flock(int fd, int op)
}
return -1;
}
#elif defined(HAVE_FLOCK)
# define zend_file_cache_flock flock
#else
# define LOCK_SH 0
# define LOCK_EX 1
# define LOCK_UN 2
static int zend_file_cache_flock(int fd, int type)
{
return 0;
}
# include "main/flock_compat.h"
# define zend_file_cache_flock flock
#endif

#ifndef O_BINARY
Expand Down Expand Up @@ -1157,6 +1150,7 @@ int zend_file_cache_script_store(zend_persistent_script *script, bool in_shm)

if (zend_file_cache_flock(fd, LOCK_EX) != 0) {
close(fd);
zend_file_cache_unlink(filename);
efree(filename);
return FAILURE;
}
Expand Down
12 changes: 2 additions & 10 deletions main/flock_compat.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ PHPAPI int flock(int fd, int operation)
#endif /* !defined(HAVE_FLOCK) */

PHPAPI int php_flock(int fd, int operation)
#ifdef HAVE_STRUCT_FLOCK /* {{{ */
#ifndef PHP_WIN32
{
struct flock flck;
int ret;
Expand Down Expand Up @@ -53,8 +53,7 @@ PHPAPI int php_flock(int fd, int operation)

return ret;
}
/* }}} */
#elif defined(PHP_WIN32) /* {{{ */
#else
/*
* Program: Unix compatibility routines
*
Expand Down Expand Up @@ -138,11 +137,4 @@ PHPAPI int php_flock(int fd, int operation)

return -1;
}
/* }}} */
#else
#warning no proper flock support for your site
{
errno = 0;
return 0;
}
#endif
10 changes: 4 additions & 6 deletions main/flock_compat.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,13 @@
#ifndef FLOCK_COMPAT_H
#define FLOCK_COMPAT_H

#ifdef HAVE_STRUCT_FLOCK
#include <unistd.h>
#include <fcntl.h>
#include <sys/file.h>
#endif

#ifdef PHP_WIN32
#include <io.h>
#include "config.w32.h"
#else
#include <unistd.h>
#include <fcntl.h>
#include <sys/file.h>
#endif

/* php_flock internally uses fcntl whether or not flock is available
Expand Down
Loading