CVS update: php31/ext/standard
| From: | shane | Date: | Fri, 28 Aug 1998 20:35:30 +0000 |
| Subject: | CVS update: php31/ext/standard | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-645@lists.php.net to get a copy of this message | ||
Date: Friday August 28, 1998 @ 16:35
Author: shane
Update of /repository/php31/ext/standard
In directory asf:/u2/tmp/cvs-serv14420/ext/standard
Modified Files:
dl.c dl.h
Log Message:
fix some major threading issues in our dl functions. odbc was loading
m$ odbc dlls which created new threads, and calling our dllmain which
would then initialize php all over. A LOT of overhead is now gone. Still
trying to figure out why certain odbc support dlls are getting loaded with
each hit, even though were no longer calling dlopen on each thread.
Also fixes to scanners for my flex fix
Index: php31/ext/standard/dl.c
diff -c php31/ext/standard/dl.c:2.4 php31/ext/standard/dl.c:2.5
*** php31/ext/standard/dl.c:2.4 Thu Aug 27 18:16:16 1998
--- php31/ext/standard/dl.c Fri Aug 28 16:35:28 1998
***************
*** 63,69 ****
cross-thread handling of dl's loading from ini file,
we will come up with something more platform independant
later */
! dl_plist *dllist=NULL,*newdl=NULL;
#endif
function_entry dl_functions[] = {
--- 63,69 ----
cross-thread handling of dl's loading from ini file,
we will come up with something more platform independant
later */
! void *dllist=NULL;
#endif
function_entry dl_functions[] = {
***************
*** 99,111 ****
/* FIXME HELPME we need to have some way to check if the dl is already
loaded before going through all this stuff. */
! _php3_dl(file->value.str.val,MODULE_TEMPORARY,return_value _INLINE_TLS);
}
}
! void _php3_dl(char *file,int type,pval *return_value INLINE_TLS)
{
void *handle;
char filename[MAXPATHLEN + 1];
--- 99,111 ----
/* FIXME HELPME we need to have some way to check if the dl is already
loaded before going through all this stuff. */
! _php3_dl(file->value.str.val,MODULE_TEMPORARY,return_value,NULL _INLINE_TLS);
}
}
! int _php3_dl(char *file,int type,pval *return_value, dl_plist *thisdl INLINE_TLS)
{
void *handle;
char filename[MAXPATHLEN + 1];
***************
*** 117,129 ****
/*allowing dl's to be loaded from extension_dir if safe_mode is enabled
because an isp can shut them off completely with enable_dl*/
php3_error(E_ERROR, "Dynamically loaded extensions aren't allowed when running in SAFE
MODE.");
! RETURN_FALSE;
}
/*verify not using ../ or ./ in path*/
if (strstr(file,"./")){
php3_error(E_ERROR, "Invalid Path loading Dynamic Module!");
! RETURN_FALSE;
}
if (!strstr(file,DL_EXT)){
--- 117,129 ----
/*allowing dl's to be loaded from extension_dir if safe_mode is enabled
because an isp can shut them off completely with enable_dl*/
php3_error(E_ERROR, "Dynamically loaded extensions aren't allowed when running in SAFE
MODE.");
! return FAILURE;
}
/*verify not using ../ or ./ in path*/
if (strstr(file,"./")){
php3_error(E_ERROR, "Invalid Path loading Dynamic Module!");
! return FAILURE;
}
if (!strstr(file,DL_EXT)){
***************
*** 154,175 ****
#else
php3_error(E_ERROR,"Unable to load dynamic library '%s' -
%s",libpath,dlerror());
#endif
! RETURN_FALSE;
}
get_module = (php3_module_entry *(*)(void)) dlsym(handle, "get_module");
if (!get_module) {
dlclose(handle);
php3_error(E_CORE_WARNING,"Invalid library (maybe not a PHP3 library) '%s'
",file);
! RETURN_FALSE;
}
module_entry = get_module();
module_entry->type = type;
if(_php3_load_module(module_entry, handle)==FAILURE){
! dlclose(handle);
! RETURN_FALSE;
}
! RETURN_TRUE;
}
int _php3_load_module(php3_module_entry *module_entry, void *handle){
--- 154,178 ----
#else
php3_error(E_ERROR,"Unable to load dynamic library '%s' -
%s",libpath,dlerror());
#endif
! return FAILURE;
}
get_module = (php3_module_entry *(*)(void)) dlsym(handle, "get_module");
if (!get_module) {
dlclose(handle);
php3_error(E_CORE_WARNING,"Invalid library (maybe not a PHP3 library) '%s'
",file);
! return FAILURE;
}
module_entry = get_module();
module_entry->type = type;
if(_php3_load_module(module_entry, handle)==FAILURE){
! return FAILURE;
}
! if(thisdl){
! thisdl->handle=handle;
! thisdl->module_entry=module_entry;
! }
! return SUCCESS;
}
int _php3_load_module(php3_module_entry *module_entry, void *handle){
***************
*** 223,233 ****
pval dummy;
if(dllist){
! ins=dllist->next;
do{
! _php3_dl(ins->dlname,MODULE_PERSISTENT,&dummy _INLINE_TLS);
ins=ins->next;
! }while(ins!=dllist->next);
}
}
--- 226,240 ----
pval dummy;
if(dllist){
! ins=(dl_plist *)dllist;
do{
! if(!ins->handle){
! _php3_dl(ins->dlname,MODULE_PERSISTENT,&dummy,ins _INLINE_TLS);
! }else{
! _php3_load_module(ins->module_entry,ins->handle);
! }
ins=ins->next;
! }while(ins!=(dl_plist *)dllist);
}
}
***************
*** 238,252 ****
loaded in module startup for each thread
*/
void php3_dladd(char *dlname){
- newdl=malloc(sizeof(dl_plist));
newdl->dlname=strdup(dlname);
if(!dllist){
! dllist=newdl;
newdl->next=newdl;
}else{
! newdl->next=dllist->next;
! dllist->next=newdl;
}
}
--- 245,262 ----
loaded in module startup for each thread
*/
void php3_dladd(char *dlname){
+ dl_plist *main=(dl_plist *)dllist;
+ dl_plist *newdl=malloc(sizeof(dl_plist));
newdl->dlname=strdup(dlname);
+ newdl->handle=NULL;
+ newdl->module_entry=NULL;
if(!dllist){
! dllist=(void *)newdl;
newdl->next=newdl;
}else{
! newdl->next=main;
! main->next=newdl;
}
}
***************
*** 254,260 ****
void php3_dllist_clear(){
dl_plist *next, *tmp, *end;
if(dllist){
! next=dllist->next;
end=next;
do{
tmp=(dl_plist *)next->next;
--- 264,270 ----
void php3_dllist_clear(){
dl_plist *next, *tmp, *end;
if(dllist){
! next=(dl_plist *)dllist;
end=next;
do{
tmp=(dl_plist *)next->next;
Index: php31/ext/standard/dl.h
diff -c php31/ext/standard/dl.h:2.1 php31/ext/standard/dl.h:2.2
*** php31/ext/standard/dl.h:2.1 Thu Aug 27 18:16:16 1998
--- php31/ext/standard/dl.h Fri Aug 28 16:35:29 1998
***************
*** 30,44 ****
*/
! /* $Id: dl.h,v 2.1 1998/08/27 22:16:16 shane Exp $ */
#ifndef _DL_H
#define _DL_H
- extern void _php3_dl(char *file,int type,pval *return_value INLINE_TLS);
- extern void php3_dlload(INLINE_TLS_VOID);
- extern void php3_dladd(char *dlname);
- extern void php3_dllist_clear(void);
#if HAVE_LIBDL
--- 30,40 ----
*/
! /* $Id: dl.h,v 2.2 1998/08/28 20:35:29 shane Exp $ */
#ifndef _DL_H
#define _DL_H
#if HAVE_LIBDL
***************
*** 49,54 ****
--- 45,52 ----
#ifdef THREAD_SAFE
typedef struct{
char *dlname;
+ void *handle;
+ php3_module_entry *module_entry;
void *next;
}dl_plist;
***************
*** 60,65 ****
--- 58,67 ----
extern int php3_mshutdown_dl(void);
extern int php3_rshutdown_dl(void);
extern void php3_info_dl(void);
+ extern int _php3_dl(char *file,int type,pval *return_value, dl_plist *ins INLINE_TLS);
+ extern void php3_dlload(INLINE_TLS_VOID);
+ extern void php3_dladd(char *dlname);
+ extern void php3_dllist_clear(void);
#else
--
PHP Development Mailing List http://www.php.net/
To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net
For help: php-dev-help@lists.php.net