Re: [PATCH] Prefer sysconf(_SC_OPEN_MAX) over getrlimit(RLIMIT_NOFILE,...)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"Joachim Schmitz" <jojo@xxxxxxxxxxxxxxxxxx> writes:

>> Looks sane but it would be more readable to make this a small helper
> function,
>> so that we do not need to have #ifdef/#endif in the primary flow of the
> code.
>
> Hmm, in compat/? Worth the effort fort hat single occrence?

Compat/ is to have some systems that lack an interface we deem to be
common on platforms emulate that interface, but in this case, we
just want something like:

	static int get_max_fd_limit(void)
        {
        #ifdef _SC_OPEN_MAX
        	...
	#else
		...
	#endif
		return max_fds;
	}

and that is not emulating anybody's standard interface.

Such a helper before the definition of the function that your patch
is touching, in the same file as a file-scope static, was what I
meant.  If other places in the code want to open tons of pipes or
file descriptors for some reason, we may want to make it part of the
supporting infrastructure, and drop "static " at the beginning and
add "extern int get_max_fd_limit(void);" to cache.h for others to
use, but as you said, there is currently only one place that uses
it, so it can stay static to the file.



--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]