| author | Alberto Bertogli
<albertito@blitiri.com.ar> 2026-11-23 20:26:26 UTC |
| committer | Alberto Bertogli
<albertito@blitiri.com.ar> 2026-11-23 20:31:06 UTC |
| parent | b64dc432bf4e5229805686b06bea227ac3520ea5 |
| preload/posix/modules/linux.io.mod | +11 | -0 |
| tests/utils/test-basic_ctrl.py | +8 | -3 |
diff --git a/preload/posix/modules/linux.io.mod b/preload/posix/modules/linux.io.mod index 5a6ac83..fdf11a2 100644 --- a/preload/posix/modules/linux.io.mod +++ b/preload/posix/modules/linux.io.mod @@ -14,3 +14,14 @@ int sync_file_range(int fd, off_t offset, off_t nbytes, \ v: #endif +# splice() is linux-only. +v: #ifdef __linux__ + +ssize_t splice(int fd_in, off64_t *off_in, int fd_out, off64_t *off_out, \ + size_t len, unsigned int flags); + on error: -1 + valid errnos: EAGAIN EBADF EINVAL ENOMEM ESPIPE + reduce: len + +v: #endif + diff --git a/tests/utils/test-basic_ctrl.py b/tests/utils/test-basic_ctrl.py index 3938548..3f322c2 100755 --- a/tests/utils/test-basic_ctrl.py +++ b/tests/utils/test-basic_ctrl.py @@ -48,22 +48,27 @@ assert out == 'test\n', out assert err == '', err # Launch and then make I/O fail at runtime. +# We enable linux/io/* too, because newer versions of GNU cat use splice() to +# copy between pipes. p = launch_sh() -fiu_ctrl(p, ["-c", "enable name=posix/io/*"]) +fiu_ctrl(p, ["-c", "enable name=posix/io/*", + "-c", "enable name=linux/io/*"]) out, err = send_cmd(p, "test\n") assert out == '', out assert 'error' in err, err # Same, but with failinfo. p = launch_sh() -fiu_ctrl(p, ["-c", "enable name=posix/io/*,failinfo=3"]) +fiu_ctrl(p, ["-c", "enable name=posix/io/*,failinfo=3", + "-c", "enable name=linux/io/*,failinfo=3"]) out, err = send_cmd(p, "test\n") assert out == '', out assert 'error' in err, err # Same, but with probability. p = launch_sh() -fiu_ctrl(p, ["-c", "enable_random name=posix/io/*,probability=0.999"]) +fiu_ctrl(p, ["-c", "enable_random name=posix/io/*,probability=0.999", + "-c", "enable_random name=linux/io/*,probability=0.999"]) out, err = send_cmd(p, "test\n") assert out == '', out assert 'error' in err, err