cvs: php4(PHP_4_0_6) /ext/standard basic_functions.c basic_functions.h file.c

From: Date: Sat, 19 May 2001 07:43:26 +0000
Subject: cvs: php4(PHP_4_0_6) /ext/standard basic_functions.c basic_functions.h file.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-5834@lists.php.net to get a copy of this message
sas Sat May 19 00:43:26 2001 EDT Modified files: (Branch: PHP_4_0_6) /php4/ext/standard basic_functions.c basic_functions.h file.c Log: MFH munmap() file in RSHUTDOWN, if PHPWRITE fails. Files should be shared among processes. Index: php4/ext/standard/basic_functions.c diff -u php4/ext/standard/basic_functions.c:1.331 php4/ext/standard/basic_functions.c:1.331.2.1 --- php4/ext/standard/basic_functions.c:1.331 Wed May 9 13:06:39 2001 +++ php4/ext/standard/basic_functions.c Sat May 19 00:43:25 2001 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: basic_functions.c,v 1.331 2001/05/09 20:06:39 andrei Exp $ */ +/* $Id: basic_functions.c,v 1.331.2.1 2001/05/19 07:43:25 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" @@ -828,6 +831,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; @@ -894,6 +900,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.76.2.1 --- php4/ext/standard/basic_functions.h:1.76 Wed May 9 13:06:39 2001 +++ php4/ext/standard/basic_functions.h Sat May 19 00:43:25 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.76.2.1 2001/05/19 07:43:25 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.156 php4/ext/standard/file.c:1.156.2.1 --- php4/ext/standard/file.c:1.156 Thu May 10 18:47:46 2001 +++ php4/ext/standard/file.c Sat May 19 00:43:25 2001 @@ -20,7 +20,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: file.c,v 1.156 2001/05/11 01:47:46 jason Exp $ */ +/* $Id: file.c,v 1.156.2.1 2001/05/19 07:43:25 sas Exp $ */ /* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */ @@ -32,6 +32,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> @@ -1540,9 +1541,13 @@ if (sbuf.st_size > sizeof(buf)) { off = ftell(fp); len = sbuf.st_size - off; - p = mmap(0, len, PROT_READ, MAP_PRIVATE, fd, 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;

« previous php.cvs (#5834) next »