[LTP] [PATCH v2 10/13] getdtablesize01: Handle ENFILE errno

Cyril Hrubis chrubis@suse.cz
Thu Nov 30 17:20:48 CET 2017


Hi!
> >>  //Now the max files opened should be RLIMIT_NOFILE - 1 , why ? read getdtablesize man page
> >>  
> >> -	if (count > 0)
> >> -		close(count);
> >>  	if (count == (max_val_opfiles - 1))
> >>  		tst_resm(TPASS, "%d = %d", count, (max_val_opfiles - 1));
> >
> > We may also check for EMFILE here.
> 
> I don't understand what you're suggesting here.

When process has exhausted the maximal number of file descriptors it can
open we are supposted to fail with EMFILE, when that happened to the
whole system before we hit the per process limit we get ENFILE. So I was
suggesting that we may as well check that we were able to open expected
number of file descriptors and that the last open() failed with EMFILE.

-- 
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list