All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH] pipe/pipe15.c: Adjust fd check for pipe creation
@ 2024-03-01  2:12 xuwenjie04 via ltp
  2024-03-01 12:41 ` Petr Vorel
  0 siblings, 1 reply; 5+ messages in thread
From: xuwenjie04 via ltp @ 2024-03-01  2:12 UTC (permalink / raw)
  To: ltp@lists.linux.it

A pipe occupies 2 fds, and considering 3 standard fds,
we should compare rlim_max with such *2+3 calculated value
to verify whether the maximum file descriptor configuration
of the current machine is sufficient.

Signed-off-by: Wenjie Xu <xuwenjie04@baidu.com>
---
testcases/kernel/syscalls/pipe/pipe15.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/testcases/kernel/syscalls/pipe/pipe15.c b/testcases/kernel/syscalls/pipe/pipe15.c
index c85ad1820..9e02fe2eb 100644
--- a/testcases/kernel/syscalls/pipe/pipe15.c
+++ b/testcases/kernel/syscalls/pipe/pipe15.c
@@ -59,7 +59,7 @@ static void setup(void)
      tst_res(TINFO, "Creating %i pipes", pipe_count);

      SAFE_GETRLIMIT(RLIMIT_NOFILE, &nfd);
-     if (nfd.rlim_max < (unsigned long)pipe_count)
+    if (nfd.rlim_max < (unsigned long)pipe_count * 2 + 3)
             tst_brk(TCONF, "NOFILE limit max too low: %lu < %i", nfd.rlim_max, pipe_count);
      if (nfd.rlim_cur < nfd.rlim_max) {
             nfd.rlim_cur = nfd.rlim_max;
--
2.41.0

--
Mailing list info: https://lists.linux.it/listinfo/ltp


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-03-07  2:55 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-01  2:12 [LTP] [PATCH] pipe/pipe15.c: Adjust fd check for pipe creation xuwenjie04 via ltp
2024-03-01 12:41 ` Petr Vorel
2024-03-05  7:20   ` Wenjie Xu via ltp
2024-03-06 12:46     ` Petr Vorel
2024-03-07  2:55       ` Wenjie Xu via ltp

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.