[igt-dev] [PATCH 1/1] lib: consolidate duplicated define of vfs_file_max(void)
Petri Latvala
petri.latvala at intel.com
Wed Apr 17 08:12:58 UTC 2019
On Tue, Apr 16, 2019 at 08:57:35AM -0700, Caz Yokoyama wrote:
> Signed-off-by: Caz Yokoyama <caz.yokoyama at intel.com>
> Cc: Arkadiusz Hiler <arkadiusz.hiler at intel.com>
> ---
> lib/igt_aux.c | 14 ++++++++++++++
> lib/igt_aux.h | 2 ++
> lib/intel_os.c | 14 --------------
> tests/i915/gem_exec_reuse.c | 14 +-------------
> 4 files changed, 17 insertions(+), 27 deletions(-)
>
> diff --git a/lib/igt_aux.c b/lib/igt_aux.c
> index 05528352..ac33875e 100644
> --- a/lib/igt_aux.c
> +++ b/lib/igt_aux.c
> @@ -1615,3 +1615,17 @@ bool igt_allow_unlimited_files(void)
> rlim.rlim_max = nofile_rlim;
> return setrlimit(RLIMIT_NOFILE, &rlim) == 0;
> }
> +
> +uint64_t vfs_file_max(void)
> +{
> + static long long unsigned max;
> + if (max == 0) {
> + FILE *file = fopen("/proc/sys/fs/file-max", "r");
> + max = 80000;
> + if (file) {
> + igt_assert(fscanf(file, "%llu", &max) == 1);
> + fclose(file);
> + }
> + }
> + return max;
> +}
Documentation for functions added to lib, please.
--
Petri Latvala
More information about the igt-dev
mailing list