syscalls/splice05: check if splice supports af_unix sockets
On some older kernel(e.g, 3.10.0), test result should be TCONF instead
of TFAIL when splice does not support stream af_unix sockets as input.
This implement is introduced in kernel:
'2b514574f7e8(net: af_unix: implement splice for stream af_unix sockets)'
Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
diff --git a/testcases/kernel/syscalls/splice/splice05.c b/testcases/kernel/syscalls/splice/splice05.c
index decf7ae..4cd1c5f 100644
--- a/testcases/kernel/syscalls/splice/splice05.c
+++ b/testcases/kernel/syscalls/splice/splice05.c
@@ -24,6 +24,7 @@
*/
#define _GNU_SOURCE
+#include <errno.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/stat.h>
@@ -90,7 +91,12 @@
for (i = num_len_data; i > 0; i = i - ret) {
ret = splice(sv[1], 0, pp2[1], NULL, i, 0);
if (ret == -1) {
- tst_res(TFAIL | TERRNO, "splice error");
+ if (errno == EINVAL) {
+ tst_res(TCONF, "splice does not support "
+ "af_unix sockets");
+ } else {
+ tst_res(TFAIL | TERRNO, "splice error");
+ }
goto exit;
}
SAFE_READ(1, pp2[0], arr_out + num_len_data - i, ret);