cvs commit: modperl-2.0/src/modules/perl modperl_sys.c modperl_sys.h
dougm 2002/07/07 17:53:16 Modified:src/modules/perl modperl_sys.c modperl_sys.h Log: add modperl_sys_is_dir function Revision ChangesPath 1.4 +17 -0 modperl-2.0/src/modules/perl/modperl_sys.c Index: modperl_sys.c === RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_sys.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- modperl_sys.c 21 Jun 2002 01:32:56 - 1.3 +++ modperl_sys.c 8 Jul 2002 00:53:15 - 1.4 -1,4 +1,21 +#include modperl_largefiles.h #include mod_perl.h + +/* + * Stat_t needs flags in modperl_largefiles.h + */ +int modperl_sys_is_dir(pTHX_ SV *sv) +{ +Stat_t statbuf; +STRLEN n_a; +char *name = SvPV(sv, n_a); + +if (PerlLIO_stat(name, statbuf) 0) { +return 0; +} + +return S_ISDIR(statbuf.st_mode); +} /* * Perl does not provide this abstraction. 1.2 +3 -0 modperl-2.0/src/modules/perl/modperl_sys.h Index: modperl_sys.h === RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_sys.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- modperl_sys.h 21 Jun 2002 00:05:17 - 1.1 +++ modperl_sys.h 8 Jul 2002 00:53:15 - 1.2 -6,6 +6,9 * hopefully won't be much here since Perl/APR/Apache * take care of most portablity issues. */ + +int modperl_sys_is_dir(pTHX_ SV *sv); + int modperl_sys_dlclose(void *handle); #endif /* MODPERL_SYS_H */
cvs commit: modperl-2.0/src/modules/perl modperl_sys.c modperl_sys.h
dougm 2002/06/20 17:05:17 Added: src/modules/perl modperl_sys.c modperl_sys.h Log: rolling our own modperl_sys_dlclose() to avoid apr/pool overhead/thread issues Revision ChangesPath 1.1 modperl-2.0/src/modules/perl/modperl_sys.c Index: modperl_sys.c === #include mod_perl.h /* * Perl does not provide this abstraction. * APR does, but requires a pool. efforts to expose this area of apr * failed. so we roll our own. *sigh* */ int modperl_sys_dlclose(void *handle) { #if defined(MP_SYS_DL_DLOPEN) #ifdef I_DLFCN #include dlfcn.h #else #include nlist.h #include link.h #endif return dlclose(handle) == 0; #elif defined(MP_SYS_DL_DYLD) return NSUnlinkModule(handle, FALSE); #elif defined(MP_SYS_DL_HPUX) shl_unload((shl_t)handle); return 1; #elif defined(MP_SYS_DL_WIN32) return FreeLibrary(handle); #elif defined(MP_SYS_DL_BEOS) return unload_add_on(handle) B_NO_ERROR; #elif defined(MP_SYS_DL_DLLLOAD) return dllfree(handle) == 0; #elif defined(MP_SYS_DL_AIX) return dlclose(handle) == 0; #else #error modperl_sys_dlclose not defined on this platform return 0; #endif } 1.1 modperl-2.0/src/modules/perl/modperl_sys.h Index: modperl_sys.h === #ifndef MODPERL_SYS_H #define MODPERL_SYS_H /* * system specific type stuff. * hopefully won't be much here since Perl/APR/Apache * take care of most portablity issues. */ int modperl_sys_dlclose(void *handle); #endif /* MODPERL_SYS_H */