[LTP] [PATCH] pipe/pipe15.c: Adjust fd check for pipe creation
xuwenjie04
xuwenjie04@baidu.com
Fri Mar 1 03:12:10 CET 2024
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
More information about the ltp
mailing list