From 6fb74a8e88799ae2fc8c3e96d776ef2901fb7a8e Mon Sep 17 00:00:00 2001 From: Natanael Copa Date: Fri, 25 Apr 2014 16:06:15 +0000 Subject: main/squid: disable hardcoded --max-filedescriptors Use what ever is the system default (with ulimit) or let user configure in squid.conf ref #2850 --- main/squid/squid.initd | 36 ++++++++++++------------------------ 1 file changed, 12 insertions(+), 24 deletions(-) (limited to 'main/squid/squid.initd') diff --git a/main/squid/squid.initd b/main/squid/squid.initd index 488a45b527..6e096f5a9c 100644 --- a/main/squid/squid.initd +++ b/main/squid/squid.initd @@ -1,7 +1,7 @@ #!/sbin/runscript -# Copyright 1999-2011 Gentoo Foundation +# Copyright 1999-2013 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/net-proxy/squid/files/squid.initd,v 1.14 2011/10/23 18:45:39 polynomial-c Exp $ +# $Header: /var/cvsroot/gentoo-x86/net-proxy/squid/files/squid.initd-r3,v 1.1 2013/01/11 15:25:49 eras Exp $ extra_started_commands="reload rotate" @@ -11,25 +11,6 @@ depend() { after firewall } -upprocval() { - [ -f $1 ] || return 0 - if [ `cat $1` -lt $2 ]; then - echo $2 > $1 - fi -} - -# Try to increase the # of filedescriptors we can open. -maxfds() { - [ -n "$SQUID_MAXFD" ] || return - [ $SQUID_MAXFD -le 8192 ] || SQUID_MAXFD=8192 - local minimal_file_max=$(($SQUID_MAXFD + 4096)) - upprocval /proc/sys/fs/file-max $minimal_file_max - if /usr/sbin/squid -v | grep -q "\--enable-epoll" ; then - upprocval /proc/sys/fs/epoll/max_user_watches $minimal_file_max - fi - ulimit -n $SQUID_MAXFD -} - checkconfig() { if [ ! -f /etc/squid/${SVCNAME}.conf ]; then eerror "You need to create /etc/squid/${SVCNAME}.conf first." @@ -47,11 +28,18 @@ checkconfig() { return 1 fi - maxfds + # Maximum file descriptors squid can open is determined by: + # a basic default of N=1024 + # ... altered by ./configure --with-filedescriptors=N + # ... overridden on production by squid.conf max_filedescriptors (if, + # and only if, setrlimit() RLIMIT_NOFILE is able to be built+used). + # Since we do not configure hard coded # of filedescriptors anymore, + # there is no need for ulimit calls in the init script. + # Use max_filedescriptors in squid.conf instead. local CACHE_SWAP=$(awk '/^[ \t]*cache_dir[ \t]+/ { if ($2 == "coss" ) printf "%s/stripe ", $3 ; else printf "%s/00 ", $3; }' < /etc/squid/${SVCNAME}.conf) [ -z "$CACHE_SWAP" ] && CACHE_SWAP="/var/cache/squid/00" - + local x for x in $CACHE_SWAP ; do if [ ! -e $x ] ; then @@ -77,7 +65,7 @@ checkconfig() { break fi done - + return 0 } -- cgit v1.2.3