summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcus Boerger <helly@php.net>2002-11-11 20:52:09 +0000
committerMarcus Boerger <helly@php.net>2002-11-11 20:52:09 +0000
commit1554bb6db6897325f99245d04bb5d6848b862f44 (patch)
tree45c110e147174c2ba8725e3e6e8b2eb18eae29fb
parent1cee814da0aab8c0140d7ff098938cb6e738a235 (diff)
downloadphp-git-1554bb6db6897325f99245d04bb5d6848b862f44.tar.gz
-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.
-rw-r--r--ext/standard/flock_compat.c6
-rw-r--r--ext/standard/flock_compat.h8
2 files changed, 11 insertions, 3 deletions
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