httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dean Gaudet <dgau...@arctic.org>
Subject Re: Naughty ?
Date Wed, 21 Apr 1999 17:12:19 GMT
Ugh.  I give up on this fight against creeping featurism.  Go ahead,
reinvent unix.

d_type is non-portable.

I love how freebsd man pages mention nothing of the standards.  How
completely nice for people to develop in a vacuum where it's impossible
to write portable programs.  At least Solaris and Linux man pages
tell you when you're using an extension.

I see d_type in glibc, but a small test program reveals it doesn't work on my
linux 2.0.x kernel.  Investigating the kernel sources I see that it's
not implemented (even in 2.2.x).  Gotta love those glibc folks.  I wonder
how much extra crud there is in glibc that just isn't implemented.

Ah, I see glibc defines _DIRENT_HAVE_D_TYPE, but freebsd doesn't.

Then this is probably a nice little portable test to see if you can
use d_type:

#if defined(DT_REG) && !defined(_DIRENT_HAVE_D_TYPE)

But... you should just modify mmapfile to have a "ignore but don't
fail" option ... since it already stat()s all the stuff provided
to it.

As far as experimental notice this:

    res = core_module.translate_handler(r);

That's not nice for a module to do.

Dean

On Wed, 21 Apr 1999, Dirk-Willem van Gulik wrote:

> I know it says
> 
>  <STRONG>Note</STRONG>: don't bother asking for a for a <CODE>MMapDir</CODE>
>   directive which
>   recursively maps all the files in a directory.  Use Unix the way it was
>   meant to be used.  For example, see the
>   <A HREF="core.html#include">Include</A> directive, and consider this command:
>   <PRE>
>   find /www/htdocs -type f -print \
>   | sed -e 's/.*/mmapfile &amp;/' &gt; /www/conf/mmap.conf
>   </PRE>
>  
> But it is so useful. Anyone has a serious -1 (or a -2) against this. Even
> if I put in strong wording into the manual ? Note that it just does a flat
> directory. That is all.
> 
> And secondly; is this module really still that experimental. It does seem to
> work fine on a range of systems, Solaris, Irix and FreeBSD. Under heavy load.
> 
> dw.
> 
> -------- Original Message --------
> Date: Wed, 21 Apr 1999 18:38:53 +0200 (CEST)
> From: Dirk-Willem van Gulik <dirk.vangulik@jrc.it>
> To: dirk.vangulik@jrc.it
> 
> Index: mod_mmap_static.c
> ===================================================================
> RCS file: /home/cvs//apache-1.3/src/modules/experimental/mod_mmap_static.c,v
> retrieving revision 1.9
> diff -u -c -3 -r1.9 mod_mmap_static.c
> *** mod_mmap_static.c	1999/01/01 19:05:01	1.9
> --- mod_mmap_static.c	1999/04/21 16:38:51
> ***************
> *** 209,214 ****
> --- 209,233 ----
>       return NULL;
>   }
>   
> + static const char *mmapdir(cmd_parms *cmd, void *dummy, char * dirname)
> + {
> +     DIR * d;
> +     struct dirent * di;
> +     const char * c;
> +     /* lets not recurse.. noooo */
> +     if ((d = opendir(dirname)) == NULL) {
> + 	ap_log_error(APLOG_MARK, APLOG_WARNING, cmd->server,
> + 	    "mmap_static: unable to opendir(%s), skipping", dirname);
> + 	return NULL;
> +     }
> +     for(;di = readdir(d);) 
> + 	if (di->d_type == DT_REG) 
> + 		c = mmapfile(cmd,dummy, ap_pstrcat(cmd->pool,dirname,"/",di->d_name,NULL));
> + 
> +     closedir(d);
> +     return NULL;
> + }
> + 
>   static command_rec mmap_static_cmds[] =
>   {
>       {
> ***************
> *** 216,221 ****
> --- 235,244 ----
>   	"A space separated list of files to mmap at config time"
>       },
>       {
> + 	"mmapdir", mmapdir, NULL, RSRC_CONF, ITERATE,
> + 	"A space separated list of directories in which to mmap at config time"
> +     },
> +     {
>   	NULL
>       }
>   };
> ***************
> *** 300,305 ****
> --- 323,329 ----
>   
>       /* shortcircuit the get_path_info() stat() calls and stuff */
>       r->finfo = match->finfo;
> + 
>       return OK;
>   }
>   
> ***************
> *** 363,369 ****
>       }
>       return OK;
>   }
> - 
>   
>   static const handler_rec mmap_static_handlers[] =
>   {
> --- 387,392 ----
> 


Mime
View raw message