cvs: php4 /ext/standard basic_functions.c basic_functions.h file.c
| From: | Sascha Schumann | Date: | Fri, 18 May 2001 23:38:47 +0000 |
| Subject: | cvs: php4 /ext/standard basic_functions.c basic_functions.h file.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-5832@lists.php.net to get a copy of this message | ||
sas Fri May 18 16:38:47 2001 EDT
Modified files:
/php4/ext/standard basic_functions.c basic_functions.h file.c
Log:
munmap() file in RSHUTDOWN, if PHPWRITE fails.
Index: php4/ext/standard/basic_functions.c
diff -u php4/ext/standard/basic_functions.c:1.339 php4/ext/standard/basic_functions.c:1.340
--- php4/ext/standard/basic_functions.c:1.339 Tue May 15 16:43:18 2001
+++ php4/ext/standard/basic_functions.c Fri May 18 16:38:46 2001
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: basic_functions.c,v 1.339 2001/05/15 23:43:18 jon Exp $ */
+/* $Id: basic_functions.c,v 1.340 2001/05/18 23:38:46 sas Exp $ */
#include "php.h"
#include "php_main.h"
@@ -48,6 +48,9 @@
#if HAVE_LOCALE_H
#include <locale.h>
#endif
+#if HAVE_SYS_MMAN_H
+#include <sys/mman.h>
+#endif
#include "safe_mode.h"
#ifdef PHP_WIN32
#include "win32/unistd.h"
@@ -830,6 +833,9 @@
BG(user_compare_func_name) = NULL;
BG(array_walk_func_name) = NULL;
BG(incomplete_class) = NULL;
+#ifdef HAVE_MMAP
+ BG(mmap_file) = NULL;
+#endif
BG(page_uid) = -1;
BG(page_inode) = -1;
BG(page_mtime) = -1;
@@ -896,6 +902,12 @@
efree(BG(user_tick_functions));
BG(user_tick_functions) = NULL;
}
+
+#ifdef HAVE_MMAP
+ if (BG(mmap_file)) {
+ munmap(BG(mmap_file), BG(mmap_len));
+ }
+#endif
return SUCCESS;
}
Index: php4/ext/standard/basic_functions.h
diff -u php4/ext/standard/basic_functions.h:1.76 php4/ext/standard/basic_functions.h:1.77
--- php4/ext/standard/basic_functions.h:1.76 Wed May 9 13:06:39 2001
+++ php4/ext/standard/basic_functions.h Fri May 18 16:38:46 2001
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: basic_functions.h,v 1.76 2001/05/09 20:06:39 andrei Exp $ */
+/* $Id: basic_functions.h,v 1.77 2001/05/18 23:38:46 sas Exp $ */
#ifndef BASIC_FUNCTIONS_H
#define BASIC_FUNCTIONS_H
@@ -187,6 +187,11 @@
url_adapt_state_t url_adapt_state;
/* url_scanner_ex.re */
url_adapt_state_ex_t url_adapt_state_ex;
+#endif
+
+#ifdef HAVE_MMAP
+ void *mmap_file;
+ size_t mmap_len;
#endif
} php_basic_globals;
Index: php4/ext/standard/file.c
diff -u php4/ext/standard/file.c:1.159 php4/ext/standard/file.c:1.160
--- php4/ext/standard/file.c:1.159 Fri May 18 10:48:43 2001
+++ php4/ext/standard/file.c Fri May 18 16:38:46 2001
@@ -21,7 +21,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: file.c,v 1.159 2001/05/18 17:48:43 sas Exp $ */
+/* $Id: file.c,v 1.160 2001/05/18 23:38:46 sas Exp $ */
/* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */
@@ -33,6 +33,7 @@
#include "ext/standard/exec.h"
#include "ext/standard/php_filestat.h"
#include "php_open_temporary_file.h"
+#include "ext/standard/basic_functions.h"
#include <stdio.h>
#include <stdlib.h>
@@ -1548,7 +1549,11 @@
len = sbuf.st_size - off;
p = mmap(0, len, PROT_READ, MAP_SHARED, fd, off);
if (p != (void *) MAP_FAILED) {
+ BLS_FETCH();
+ BG(mmap_file) = p;
+ BG(mmap_len) = len;
PHPWRITE(p, len);
+ BG(mmap_file) = NULL;
munmap(p, len);
bcount += len;
ready = 1;