From: Marcus Boerger Date: Mon, 11 Nov 2002 20:52:09 +0000 (+0000) Subject: -make the flock() emulation a separate function named php_flock() X-Git-Tag: php-4.3.0RC1~101 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1554bb6db6897325f99245d04bb5d6848b862f44;p=php -make the flock() emulation a separate function named php_flock() -use a define to make php_flock() available as flock() when necessary # The emulated php_flock even works on NFS this will be used elsewhere. --- diff --git a/ext/standard/flock_compat.c b/ext/standard/flock_compat.c index 44f0b5c6ac..2f03bcc856 100644 --- a/ext/standard/flock_compat.c +++ b/ext/standard/flock_compat.c @@ -41,7 +41,10 @@ #endif #ifndef HAVE_FLOCK -PHPAPI int flock(int fd, int operation) +/* defines flock as php_flock */ +#endif /* !defined(HAVE_FLOCK) */ + +PHPAPI int php_flock(int fd, int operation) #if HAVE_STRUCT_FLOCK { struct flock flck; @@ -157,7 +160,6 @@ PHPAPI int flock(int fd, int operation) return 0; } #endif -#endif /* !defined(HAVE_FLOCK) */ #if !(HAVE_INET_ATON) /* {{{ inet_aton diff --git a/ext/standard/flock_compat.h b/ext/standard/flock_compat.h index 4b67b5cb04..457e469eaa 100644 --- a/ext/standard/flock_compat.h +++ b/ext/standard/flock_compat.h @@ -21,12 +21,18 @@ #ifndef FLOCK_COMPAT_H #define FLOCK_COMPAT_H +/* php_flock internally uses fcntl whther or not flock is available + * This way our php_flock even works on NFS files. + * More info: /usr/src/linux/Documentation + */ +PHPAPI int php_flock(int fd, int operation); + #ifndef HAVE_FLOCK # define LOCK_SH 1 # define LOCK_EX 2 # define LOCK_NB 4 # define LOCK_UN 8 -PHPAPI int flock(int fd, int operation); +# define flock php_flock #endif #ifdef PHP_WIN32