large stack variables in shttpd

Joel Sherrill joel.sherrill at oarcorp.com
Tue Jul 31 18:34:16 UTC 2007


Aaron J. Grier wrote:
> On Tue, Jul 31, 2007 at 10:19:14AM -0500, Joel Sherrill wrote:
>   
>> In building for the avr and h8300, there were errors building.  When I
>> investigated, I came across this in shttpd:
>>
>> defs.h:#define  URI_MAX         32768           /* Maximum URI size */
>> log.c:  char    date[64], buf[URI_MAX];
>> log.c:  char                    date[64], buf[URI_MAX], *q1 = "\"", *q2 = "\"";
>> shttpd.c:       char            path[URI_MAX], buf[1024];
>>
>> So there are 3 places where shttpd puts 32K on the
>> stack.  Two are for logging.
>>
>> Any thoughts on what to do?
>>     
>
> move them out of the function and declare them static; that should at
> least put them in .bss.  or cut down URI_MAX to something more
> reasonable.
>
>   
I thought about making them static but was concerned
about reentrancy.  I guess it is time to ask the shttpd
folks why URI_MAX is so large and what to do about it.
> AVR == AVR32, I assume?  or is RTEMS running on 8bit AVR now?
>   
There is a partial port to the AVR.  The smallest AVR
models are still too small for RTEMS but RTEMS
is appropriate for some of the models. 

One RTEMS user has reported a 14K ticker executable
size with some tinkering.  You can get to around 30K
hello's with the standard build options on some CPU/BSP
combinations now.  So progress is being made.

--joel




More information about the users mailing list