cvs: php4 /ext/standard flock_compat.c flock_compat.h
| From: | Marcus Boerger | Date: | Mon, 11 Nov 2002 20:52:09 +0000 |
| Subject: | cvs: php4 /ext/standard flock_compat.c flock_compat.h | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-16001@lists.php.net to get a copy of this message | ||
helly Mon Nov 11 15:52:09 2002 EDT
Modified files:
/php4/ext/standard flock_compat.c flock_compat.h
Log:
-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.
Index: php4/ext/standard/flock_compat.c
diff -u php4/ext/standard/flock_compat.c:1.18 php4/ext/standard/flock_compat.c:1.19
--- php4/ext/standard/flock_compat.c:1.18 Mon Nov 11 11:43:19 2002
+++ php4/ext/standard/flock_compat.c Mon Nov 11 15:52:09 2002
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: flock_compat.c,v 1.18 2002/11/11 16:43:19 helly Exp $ */
+/* $Id: flock_compat.c,v 1.19 2002/11/11 20:52:09 helly Exp $ */
#include <php.h>
#include <errno.h>
@@ -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 @@
return 0;
}
#endif
-#endif /* !defined(HAVE_FLOCK) */
#if !(HAVE_INET_ATON)
/* {{{ inet_aton
Index: php4/ext/standard/flock_compat.h
diff -u php4/ext/standard/flock_compat.h:1.14 php4/ext/standard/flock_compat.h:1.15
--- php4/ext/standard/flock_compat.h:1.14 Mon Nov 11 11:43:19 2002
+++ php4/ext/standard/flock_compat.h Mon Nov 11 15:52:09 2002
@@ -16,17 +16,23 @@
+----------------------------------------------------------------------+
*/
-/* $Id: flock_compat.h,v 1.14 2002/11/11 16:43:19 helly Exp $ */
+/* $Id: flock_compat.h,v 1.15 2002/11/11 20:52:09 helly Exp $ */
#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