unbound 1.4.6 起動時にwarning: increased limit(open files)

環境:CentOS 6.2, unbound-1.4.16(epelより入手)

unbound サービス起動時に

warning: increased limit(open files) from 1024 to 8246

が出てくるのでイライラしてた。
「increased ってことは増やしたんだろうけど、なんでwariningなんだ?」って思って確認。

http://unbound.nlnetlabs.nl/svn/trunk/daemon/unbound.c の278-279行目に

		log_warn("increased limit(open files) from %u to %u",
			(unsigned)avail, (unsigned)total+10);

の記述を発見。これだな!

それより前を追っかけてみると、214行目で

	size_t total = numthread * perthread + misc;

はいはい、ここでコンフィグから必要なファイルディスクリプタ数を準備するのね。
それから、247-250行目で

	if(getrlimit(RLIMIT_NOFILE, &rlim) < 0) {
		log_warn("getrlimit: %s", strerror(errno));
		return;
	}

現在のulimit -n の値をとってくると。
CentOS6.2だから、デフォルトで1024が返ってくるはず。

さらに、253行目で

	if((size_t)rlim.rlim_cur < total) {

このルートに入るのね。

んで、257-280行目が

#ifdef HAVE_SETRLIMIT
		if(setrlimit(RLIMIT_NOFILE, &rlim) < 0) {
			log_warn("setrlimit: %s", strerror(errno));
#else
		if(1) {
#endif
			log_warn("cannot increase max open fds from %u to %u",
				(unsigned)avail, (unsigned)total+10);
			/* check that calculation below does not underflow,
			 * with 15 as margin */
			if(numthread*perthread_noudp+15 > avail)
				fatal_exit("too much tcp. not enough fds.");
			cfg->outgoing_num_ports = (int)((avail 
				- numthread*perthread_noudp 
				- 10 /* safety margin */) /numthread);
			log_warn("continuing with less udp ports: %u",
				cfg->outgoing_num_ports);
			log_warn("increase ulimit or decrease threads, "
				"ports in config to remove this warning");
			return;
		}
		log_warn("increased limit(open files) from %u to %u",
			(unsigned)avail, (unsigned)total+10);
	}

これと。
んー、HAVE_SETRLIMITしてあるかはわかんないけど、少なし"setrlimit: "なwariningや"cannnot increase max open fds"って出てないからこのルートには来てない。
んで、log_warn()で"increased limit(open files)"を吐くルートに来てるのね。

…正常にulimitのNOFILE最大値を増やせてるってことか。

Warningだすなー!!!!!
INFOでいいじゃねえかー!!!!

ふぅ
ってことで、「うまく最大値を増やせましたよ」ってことで理解して、warningは無視することにしよう。