add file locking under windows

change win build to use common clock compat files
This commit is contained in:
Rob Richards 2007-04-18 09:38:59 +00:00
parent bb489851e9
commit b6b312c020
3 changed files with 7 additions and 3 deletions

View File

@ -16,5 +16,5 @@ EXTENSION("standard", "array.c base64.c basic_functions.c browscap.c \
url_scanner_ex.c ftp_fopen_wrapper.c http_fopen_wrapper.c \
php_fopen_wrapper.c credits.c css.c var_unserializer.c ftok.c sha1.c \
user_filters.c uuencode.c filters.c proc_open.c \
streamsfuncs.c http.c", false /* never shared */);
streamsfuncs.c http.c flock_compat.c", false /* never shared */);

View File

@ -63,6 +63,7 @@
#ifdef PHP_WIN32
#include <io.h>
#include "win32/php_registry.h"
#include "ext/standard/flock_compat.h"
#endif
#include "php_syslog.h"
#include "Zend/zend_exceptions.h"
@ -362,8 +363,11 @@ PHPAPI void php_log_err(char *log_message TSRMLS_DC)
time(&error_time);
strftime(error_time_str, sizeof(error_time_str), "%d-%b-%Y %H:%M:%S", php_localtime_r(&error_time, &tmbuf));
len = spprintf(&tmp, 0, "[%s] %s%s", error_time_str, log_message, PHP_EOL);
#ifdef PHP_WIN32
php_flock(fd, 2);
#endif
write(fd, tmp, len);
efree(tmp);
efree(tmp);
close(fd);
return;
}

View File

@ -309,7 +309,7 @@ ADD_SOURCES("main", "main.c snprintf.c spprintf.c safe_mode.c fopen_wrappers.c \
ADD_SOURCES("main/streams", "streams.c cast.c memory.c filter.c plain_wrapper.c \
userspace.c transports.c xp_socket.c mmap.c");
ADD_SOURCES("win32", "crypt_win32.c flock.c glob.c md5crypt.c readdir.c \
ADD_SOURCES("win32", "crypt_win32.c glob.c md5crypt.c readdir.c \
registry.c select.c sendmail.c time.c wfile.c winutil.c wsyslog.c globals.c");
ADD_SOURCES("regex", "regcomp.c regerror.c regexec.c regfree.c");