<div dir="ltr"><div dir="ltr"><div class="gmail_default" style="font-size:small"><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Sep 3, 2020 at 2:40 PM Viresh Kumar <<a href="mailto:viresh.kumar@linaro.org">viresh.kumar@linaro.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">select() returns a positive value on success if timeout hasn't happened,<br>
else returns 0. Check that and send some data to the write file<br>
descriptor for the same.<br>
<br>
Signed-off-by: Viresh Kumar <<a href="mailto:viresh.kumar@linaro.org" target="_blank">viresh.kumar@linaro.org</a>><br>
<br>
---<br>
Cyril,<br>
<br>
Is this what you were looking for ? I am not sure why, but the last<br>
test (with named pipe) times out all the time.<br>
---<br>
 testcases/kernel/syscalls/select/select01.c | 13 ++++++++++---<br>
 1 file changed, 10 insertions(+), 3 deletions(-)<br>
<br>
diff --git a/testcases/kernel/syscalls/select/select01.c b/testcases/kernel/syscalls/select/select01.c<br>
index 4367e7f3af3f..b3dcf1fff6f3 100644<br>
--- a/testcases/kernel/syscalls/select/select01.c<br>
+++ b/testcases/kernel/syscalls/select/select01.c<br>
@@ -25,24 +25,31 @@ static struct select_info {<br>
        int nfds;<br>
        fd_set *readfds;<br>
        fd_set *writefds;<br>
+       int *writefd;<br>
 } tests[] = {<br>
-       {4, &readfds_reg, NULL},<br>
-       {5, &readfds_pipe, &writefds_pipe},<br>
-       {5, &readfds_npipe, &writefds_npipe},<br>
+       {4, &readfds_reg, NULL, NULL},<br>
+       {5, &readfds_pipe, &writefds_pipe, &fds_pipe[1]},<br>
+       {5, &readfds_npipe, &writefds_npipe, &fd_npipe},<br></blockquote><div><br></div><div><div class="gmail_default" style="font-size:small">The 'nfds' should be equal to 'fd + 1', otherwise, it gets timeout as you mentioned above.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">  {7, &readfds_npipe, &writefds_npipe, &fd_npipe}</div></div><div> </div></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div>Regards,<br></div><div>Li Wang<br></div></div></div></div>