diff options
author | Lucas De Marchi <lucas.demarchi@intel.com> | 2019-04-04 15:16:11 -0700 |
---|---|---|
committer | Lucas De Marchi <lucas.demarchi@intel.com> | 2019-04-05 10:00:45 -0700 |
commit | 8bc80862603bd5d1b0dcb7a0472935215f167f09 (patch) | |
tree | f095731ce601ac3492add9a876cb5d108b22135e /tests/i915/gem_exec_reuse.c | |
parent | 019f892e5d1a0a9643cb726c47ce2d99c14b444f (diff) |
lib: add igt_allow_unlimited_files()
Share the implementation to tweak the maximum number of open files.
The version in tests/i915/gem_exec_reuse.c was a little bit different,
but I don't think it needs to be because it would still return a
failure if any of the calls to setrlimit() fail. So I'm using the other
one.
Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'tests/i915/gem_exec_reuse.c')
-rw-r--r-- | tests/i915/gem_exec_reuse.c | 25 |
1 files changed, 1 insertions, 24 deletions
diff --git a/tests/i915/gem_exec_reuse.c b/tests/i915/gem_exec_reuse.c index 55904718..9cba1354 100644 --- a/tests/i915/gem_exec_reuse.c +++ b/tests/i915/gem_exec_reuse.c @@ -56,29 +56,6 @@ static void noop(struct noop *n, gem_execbuf(n->fd, &execbuf); } -static bool allow_unlimited_files(void) -{ - struct rlimit rlim; - unsigned nofile_rlim = 1024*1024; - - FILE *file = fopen("/proc/sys/fs/file-max", "r"); - if (file) { - igt_assert(fscanf(file, "%u", &nofile_rlim) == 1); - fclose(file); - } - - if (getrlimit(RLIMIT_NOFILE, &rlim)) - return false; - - rlim.rlim_cur = rlim.rlim_max; - if (setrlimit(RLIMIT_NOFILE, &rlim)) - return false; - - rlim.rlim_cur = nofile_rlim; - rlim.rlim_max = nofile_rlim; - return setrlimit(RLIMIT_NOFILE, &rlim) == 0; -} - static uint64_t vfs_file_max(void) { long long unsigned max = 80000; @@ -126,7 +103,7 @@ igt_main uint32_t bbe = MI_BATCH_BUFFER_END; unsigned engine; - allow_unlimited_files(); + igt_allow_unlimited_files(); no.fd = drm_open_driver(DRIVER_INTEL); igt_require_gem(no.fd); |