diff -ruN old/thttpd-2.26/fdwatch.c new/thttpd-2.26/fdwatch.c --- old/thttpd-2.26/fdwatch.c 2014-08-05 02:45:49.000000000 +0400 +++ new/thttpd-2.26/fdwatch.c 2014-12-10 23:51:36.000000000 +0300 @@ -278,7 +278,7 @@ { if ( secs > 0 ) syslog( - LOG_INFO, " fdwatch - %ld %ss (%g/sec)", + LOG_NOTICE, " fdwatch - %ld %ss (%g/sec)", nwatches, WHICH, (float) nwatches / secs ); nwatches = 0; } diff -ruN old/thttpd-2.26/libhttpd.c new/thttpd-2.26/libhttpd.c --- old/thttpd-2.26/libhttpd.c 2014-08-05 02:41:30.000000000 +0400 +++ new/thttpd-2.26/libhttpd.c 2014-12-10 23:53:07.000000000 +0300 @@ -2658,7 +2658,7 @@ pid = (pid_t) client_data.i; if ( kill( pid, SIGKILL ) == 0 ) - syslog( LOG_ERR, "hard-killed CGI process %d", pid ); + syslog( LOG_WARNING, "hard-killed CGI process %d", pid ); } static void @@ -2669,7 +2669,7 @@ pid = (pid_t) client_data.i; if ( kill( pid, SIGINT ) == 0 ) { - syslog( LOG_ERR, "killed CGI process %d", pid ); + syslog( LOG_WARNING, "killed CGI process %d", pid ); /* In case this isn't enough, schedule an uncatchable kill. */ if ( tmr_create( nowP, cgi_kill2, client_data, 5 * 1000L, 0 ) == (Timer*) 0 ) { @@ -4273,7 +4273,7 @@ httpd_logstats( long secs ) { if ( str_alloc_count > 0 ) - syslog( LOG_INFO, + syslog( LOG_NOTICE, " libhttpd - %d strings allocated, %lu bytes (%g bytes/str)", str_alloc_count, (unsigned long) str_alloc_size, (float) str_alloc_size / str_alloc_count ); diff -ruN old/thttpd-2.26/mmc.c new/thttpd-2.26/mmc.c --- old/thttpd-2.26/mmc.c 2014-08-05 02:42:37.000000000 +0400 +++ new/thttpd-2.26/mmc.c 2014-12-10 23:53:22.000000000 +0300 @@ -1,6 +1,6 @@ /* mmc.c - mmap cache ** -** Copyright © 1998,2001 by Jef Poskanzer . +** Copyright © 1998,2001,2014 by Jef Poskanzer . ** All rights reserved. ** ** Redistribution and use in source and binary forms, with or without @@ -395,7 +395,7 @@ void -mmc_destroy( void ) +mmc_term( void ) { Map* m; @@ -523,7 +523,7 @@ mmc_logstats( long secs ) { syslog( - LOG_INFO, " map cache - %d allocated, %d active (%lld bytes), %d free; hash size: %d; expire age: %ld", + LOG_NOTICE, " map cache - %d allocated, %d active (%lld bytes), %d free; hash size: %d; expire age: %ld", alloc_count, map_count, (long long) mapped_bytes, free_count, hash_size, expire_age ); if ( map_count + free_count != alloc_count ) diff -ruN old/thttpd-2.26/mmc.h new/thttpd-2.26/mmc.h --- old/thttpd-2.26/mmc.h 2014-07-10 03:45:47.000000000 +0400 +++ new/thttpd-2.26/mmc.h 2014-12-10 23:50:35.000000000 +0300 @@ -1,6 +1,6 @@ /* mmc.h - header file for mmap cache package ** -** Copyright © 1998 by Jef Poskanzer . +** Copyright © 1998,2014 by Jef Poskanzer . ** All rights reserved. ** ** Redistribution and use in source and binary forms, with or without @@ -47,7 +47,7 @@ void mmc_cleanup( struct timeval* nowP ); /* Free all storage, usually in preparation for exitting. */ -void mmc_destroy( void ); +void mmc_term( void ); /* Generate debugging statistics syslog message. */ void mmc_logstats( long secs ); diff -ruN old/thttpd-2.26/scripts/500.thttpd-rotate new/thttpd-2.26/scripts/500.thttpd-rotate --- old/thttpd-2.26/scripts/500.thttpd-rotate 2003-11-18 00:02:17.000000000 +0300 +++ new/thttpd-2.26/scripts/500.thttpd-rotate 2015-02-03 18:15:29.000000000 +0300 @@ -6,12 +6,14 @@ # tells thttpd to re-open its log file. cd /usr/local/www/chroot/logs -rm -f thttpd_log.7 -mv thttpd_log.6 thttpd_log.7 -mv thttpd_log.5 thttpd_log.6 -mv thttpd_log.4 thttpd_log.5 -mv thttpd_log.3 thttpd_log.4 -mv thttpd_log.2 thttpd_log.3 -mv thttpd_log.1 thttpd_log.2 +rm -f thttpd_log.7.gz +mv thttpd_log.6.gz thttpd_log.7.gz +mv thttpd_log.5.gz thttpd_log.6.gz +mv thttpd_log.4.gz thttpd_log.5.gz +mv thttpd_log.3.gz thttpd_log.4.gz +mv thttpd_log.2.gz thttpd_log.3.gz +mv thttpd_log.1.gz thttpd_log.2.gz mv thttpd_log thttpd_log.1 kill -HUP `cat /var/run/thttpd.pid` +sleep 1 +gzip -f thttpd_log.1 diff -ruN old/thttpd-2.26/scripts/thttpd.sh new/thttpd-2.26/scripts/thttpd.sh --- old/thttpd-2.26/scripts/thttpd.sh 2004-05-06 20:43:23.000000000 +0400 +++ new/thttpd-2.26/scripts/thttpd.sh 2015-02-04 17:30:36.000000000 +0300 @@ -3,30 +3,46 @@ # thttpd.sh - startup script for thttpd on FreeBSD # # This goes in /usr/local/etc/rc.d and gets run at boot-time. - -. /etc/rc.conf - -case "${thttpd_enable}" in - [Yy][Ee][Ss]) ;; - *) exit ;; -esac - -case "$1" in - - start) - if [ -x /usr/local/sbin/thttpd_wrapper ] ; then - echo -n " thttpd" - /usr/local/sbin/thttpd_wrapper & +# +# Variables available: +# thttpd_enable='YES/NO' +# thttpd_program='path' +# thttpd_pidfile='path' +# thttpd_devfs='path' +# +# PROVIDE: thttpd +# REQUIRE: LOGIN FILESYSTEMS +# KEYWORD: shutdown + +. /etc/rc.subr + +name='thttpd' +rcvar='thttpd_enable' + +load_rc_config "$name" + +# Defaults. +thttpd_enable="${thttpd_enable:-'NO'}" +thttpd_program="${thttpd_program:-'/usr/local/sbin/thttpd'}" +thttpd_pidfile="${thttpd_pidfile:-'/var/run/thttpd.pid'}" + +thttpd_precmd () + { + if [ '' != "$thttpd_devfs" ] ; then + mount -t devfs devfs "$thttpd_devfs" + devfs -m "$thttpd_devfs" rule -s 1 applyset + devfs -m "$thttpd_devfs" rule -s 2 applyset fi - ;; + } - stop) - kill -USR1 `cat /var/run/thttpd.pid` - ;; - - *) - echo "usage: $0 { start | stop }" >&2 - exit 1 - ;; +thttpd_stop () + { + kill -USR1 `cat "$pidfile"` + } + +command="$thttpd_program" +pidfile="$thttpd_pidfile" +start_precmd='thttpd_precmd' +stop_cmd='thttpd_stop' -esac +run_rc_command "$1" diff -ruN old/thttpd-2.26/thttpd.c new/thttpd-2.26/thttpd.c --- old/thttpd-2.26/thttpd.c 2014-08-05 02:38:01.000000000 +0400 +++ new/thttpd-2.26/thttpd.c 2014-12-10 23:52:36.000000000 +0300 @@ -1484,8 +1484,8 @@ fdwatch_del_fd( ths->listen6_fd ); httpd_terminate( ths ); } - mmc_destroy(); - tmr_destroy(); + mmc_term(); + tmr_term(); free( (void*) connects ); if ( throttles != (throttletab*) 0 ) free( (void*) throttles ); @@ -2154,7 +2154,7 @@ if ( stats_secs == 0 ) stats_secs = 1; /* fudge */ stats_time = now; - syslog( LOG_INFO, + syslog( LOG_NOTICE, "up %ld seconds, stats for %ld seconds:", up_secs, stats_secs ); thttpd_logstats( stats_secs ); @@ -2170,7 +2170,7 @@ thttpd_logstats( long secs ) { if ( secs > 0 ) - syslog( LOG_INFO, + syslog( LOG_NOTICE, " thttpd - %ld connections (%g/sec), %d max simultaneous, %lld bytes (%g/sec), %d httpd_conns allocated", stats_connections, (float) stats_connections / secs, stats_simultaneous, (long long) stats_bytes, diff -ruN old/thttpd-2.26/timers.c new/thttpd-2.26/timers.c --- old/thttpd-2.26/timers.c 2014-07-10 04:23:11.000000000 +0400 +++ new/thttpd-2.26/timers.c 2014-12-10 23:49:30.000000000 +0300 @@ -1,6 +1,6 @@ /* timers.c - simple timer routines ** -** Copyright © 1995,1998,2000 by Jef Poskanzer . +** Copyright © 1995,1998,2000,2014 by Jef Poskanzer . ** All rights reserved. ** ** Redistribution and use in source and binary forms, with or without @@ -328,7 +328,7 @@ void -tmr_destroy( void ) +tmr_term( void ) { int h; @@ -344,7 +344,7 @@ tmr_logstats( long secs ) { syslog( - LOG_INFO, " timers - %d allocated, %d active, %d free", + LOG_NOTICE, " timers - %d allocated, %d active, %d free", alloc_count, active_count, free_count ); if ( active_count + free_count != alloc_count ) syslog( LOG_ERR, "timer counts don't add up!" ); diff -ruN old/thttpd-2.26/timers.h new/thttpd-2.26/timers.h --- old/thttpd-2.26/timers.h 2014-07-10 03:46:52.000000000 +0400 +++ new/thttpd-2.26/timers.h 2014-12-10 23:48:55.000000000 +0300 @@ -1,6 +1,6 @@ /* timers.h - header file for timers package ** -** Copyright © 1995,1998,1999,2000 by Jef Poskanzer . +** Copyright © 1995,1998,1999,2000,2014 by Jef Poskanzer . ** All rights reserved. ** ** Redistribution and use in source and binary forms, with or without @@ -100,8 +100,8 @@ /* Clean up the timers package, freeing any unused storage. */ void tmr_cleanup( void ); -/* Cancel all timers and free storage, usually in preparation for exitting. */ -void tmr_destroy( void ); +/* Cancel all timers and free storage, usually in preparation for exiting. */ +void tmr_term( void ); /* Generate debugging statistics syslog message. */ void tmr_logstats( long secs );