[DTrace-devel] [PATCH] test/triggers: ensure bogus-ioctl has a reasonable fd limit

Kris Van Hees kris.van.hees at oracle.com
Wed Jul 31 15:03:30 UTC 2024


The bogus-ioctl trigger has a loop to close all possible fds, and it
was limit by rlim_max.  On some systems, that was such a high limit
that the loop was taking too long, causing tests to time out.  Set
the limit to 1024, so that the loop will end in reasonable time.

Signed-off-by: Kris Van Hees <kris.van.hees at oracle.com>
---
 test/triggers/bogus-ioctl.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/test/triggers/bogus-ioctl.c b/test/triggers/bogus-ioctl.c
index 25933229..f1546445 100644
--- a/test/triggers/bogus-ioctl.c
+++ b/test/triggers/bogus-ioctl.c
@@ -38,7 +38,10 @@ main(void)
 	sigaction(SIGUSR1, &act, NULL);
 
 	getrlimit(RLIMIT_NOFILE, &rl);
-	for (i = 0; i < rl.rlim_max; i++)
+	rl.rlim_cur = 1024;
+	setrlimit(RLIMIT_NOFILE, &rl);
+	getrlimit(RLIMIT_NOFILE, &rl);
+	for (i = 0; i < rl.rlim_cur; i++)
 		close(i);
 	n = 0;
 
-- 
2.45.2




More information about the DTrace-devel mailing list