[LTP] [RFC][PATCH 1/2] runtest/ipc: Enable named pipes on non-blocking IO
Cyril Hrubis
chrubis@suse.cz
Tue Apr 8 20:37:26 CEST 2025
Hi!
> Tests were disabled from the start (edab67b3a0 in 2001) due EAGAIN.
> Tests are working now even on very old SLE12-SP3 based 4.4 kernel,
> therefore enable them.
My guess is that it much more depends on number of CPUs. It's more
likely that reader/write would starve on single CPU system.
But I've spend quite a bit of time reading the tlibio.c code (after I've
cleaned up the messy ifdefs) and the test (by default) passes method =
0. Which means that for write we do:
while (1) {
if (((ret = write(fd, buffer, size)) == -1)
&& errno != EAGAIN && errno != EINTR) {
sprintf(Errormsg,
"%s/%d write(%d, buf, %d) ret:-1, errno=%d %s",
__FILE__, __LINE__, fd, size, errno,
strerror(errno));
return -errno;
}
if (ret != -1) {
if (ret != size) {
sprintf(Errormsg,
"%s/%d write(%d, buf, %d) returned=%d",
__FILE__, __LINE__,
fd, size, ret);
size -= ret;
buffer += ret;
totally_written += ret;
} else {
if (Debug_level > 1)
printf
("DEBUG %s/%d: write completed without error (ret %d)\n",
__FILE__, __LINE__, ret);
return totally_written + ret;
}
}
wait4sync_io(fd, 0);
}
And wait4sync_io() does select() to wait for the file descriptor to
became ready for reading. The corresponding part that reads look
similar. So it at least looks like the code properly handles the EAGAIN
case in the tlibio.c library and that it should be safe to enable the
non-blocking case.
Acked-by: Cyril Hrubis <chrubis@suse.cz>
--
Cyril Hrubis
chrubis@suse.cz
More information about the ltp
mailing list