public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: Lucas De Marchi <lucas.demarchi@intel.com>
Subject: [igt-dev] [PATCH i-g-t] tests/gem_fd_exhaustion: Remove broken exit handler
Date: Tue,  9 Apr 2019 09:46:58 +0300	[thread overview]
Message-ID: <20190409064658.1764-1-arkadiusz.hiler@intel.com> (raw)

With the introduction of igt_allow_unlimited_files() the way the
original implementation that set RLIMIT_NOFILE and then restored it got
half-removed.

The new way of setting was used, but the old exit handler was still in place,
resetting the value to uninitialized variable.

Since we seem to not care about restoring the original limit in multiple
other places let's not do that here and instead ponder on doing that
elsewhere.

Fixes: 8bc80862603b ("lib: add igt_allow_unlimited_files()")
Cc: Lucas De Marchi <lucas.demarchi@intel.com>
Signed-off-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
---
 tests/i915/gem_fd_exhaustion.c | 35 ----------------------------------
 1 file changed, 35 deletions(-)

diff --git a/tests/i915/gem_fd_exhaustion.c b/tests/i915/gem_fd_exhaustion.c
index 9704fa02..23602b98 100644
--- a/tests/i915/gem_fd_exhaustion.c
+++ b/tests/i915/gem_fd_exhaustion.c
@@ -33,39 +33,6 @@
 #include <fcntl.h>
 #include <limits.h>
 
-unsigned int original_nr_open;
-
-static int read_sysctl(const char *path)
-{
-	unsigned int val;
-	FILE *f = fopen(path, "r");
-
-	if (f) {
-		igt_assert(fscanf(f, "%u", &val) == 1);
-		fclose(f);
-		return val;
-	}
-	return -errno;
-}
-
-static int write_sysctl(const char *path, unsigned int val)
-{
-	FILE *f = fopen(path, "w");
-
-	if (f) {
-		igt_assert(fprintf(f, "%u", val));
-		fclose(f);
-		return 0;
-	}
-	return -errno;
-}
-
-static void restore_original_sysctl(int sig)
-{
-	if (original_nr_open > 0)
-		write_sysctl("/proc/sys/fs/nr_open", original_nr_open);
-}
-
 igt_simple_main
 {
 	int fd;
@@ -74,8 +41,6 @@ igt_simple_main
 
 	fd = drm_open_driver(DRIVER_INTEL);
 
-	igt_install_exit_handler(restore_original_sysctl);
-
 	igt_fork(n, 1) {
 		igt_drop_root();
 
-- 
2.20.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

             reply	other threads:[~2019-04-09  6:47 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-09  6:46 Arkadiusz Hiler [this message]
2019-04-09  7:34 ` [igt-dev] ✓ Fi.CI.BAT: success for tests/gem_fd_exhaustion: Remove broken exit handler Patchwork
2019-04-09 11:38 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2019-04-30 17:22 ` [igt-dev] [PATCH i-g-t] " Lucas De Marchi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190409064658.1764-1-arkadiusz.hiler@intel.com \
    --to=arkadiusz.hiler@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=lucas.demarchi@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox