From e7ddfb1da4ad1edd71a937893adf10e8d60c7ab8 Mon Sep 17 00:00:00 2001 From: Sheng Yong Date: Wed, 21 Jan 2015 21:38:21 +0800 Subject: [PATCH] test: decrease memfd_count by 1 because all fds take one item When test E2BIG using memfd_count, we should consider that all fds will take one item. So the number of left item, which will trigger E2BIG is (KDBUG_MSG_MAX_ITEMs - 1). Signed-off-by: Sheng Yong Signed-off-by: Djalal Harouni --- test/test-fd.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/test/test-fd.c b/test/test-fd.c index 261cfc8..462be1d 100644 --- a/test/test-fd.c +++ b/test/test-fd.c @@ -544,10 +544,13 @@ static int kdbus_send_multiple_fds(struct kdbus_conn *conn_src, memfds, 100); ASSERT_RETURN(ret == -EMFILE); - /* Combine multiple 253 fds and 128 + 1 memfds */ + /* + * Combine multiple 253 fds and (128 - 1) + 1 memfds, + * all fds take one item, while each memfd takes one item + */ ret = send_fds_memfds(conn_src, conn_dst->id, fds, KDBUS_MSG_MAX_FDS, - memfds, KDBUS_MSG_MAX_ITEMS + 1); + memfds, (KDBUS_MSG_MAX_ITEMS - 1) + 1); ASSERT_RETURN(ret == -E2BIG); ret = send_fds_memfds(conn_src, conn_dst->id, -- 2.34.1