void-packages/srcpkgs/lsof/patches/fix-epoll-test.patch

87 lines
2.2 KiB
Diff

This patch has been upstreamed already, and should be
unnecessary in the next release.
https://github.com/lsof-org/lsof/commit/5ca335ff9ae6510cba0a94a62fbaa46709f7cb16
--- a/dialects/linux/tests/case-20-epoll.bash
+++ b/dialects/linux/tests/case-20-epoll.bash
@@ -8,9 +8,9 @@
fi
$TARGET 2>> $report | {
- read pid epfd
- if [[ -z "$pid" || -z "$epfd" ]]; then
- echo "unexpected output form target ( $TARGET )" >> $report
+ read pid epfd evp0 evp1
+ if [[ -z "$pid" || -z "$epfd" || -z "$evp0" || -z "$evp1" ]]; then
+ echo "unexpected output from target ( $TARGET )" >> $report
exit 1
fi
if ! [ -e "/proc/$pid" ]; then
@@ -25,7 +25,7 @@
echo done
} >> $report
if $lsof -p $pid -a -d $epfd |
- grep -q "epoll *[0-9]* *.* *${epfd}u *a_inode *[0-9]*,[0-9]* *[0-9]* *[0-9]* *\[eventpoll:5,6\]"; then
+ grep -q "epoll *[0-9]* *.* *${epfd}u *a_inode *[0-9]*,[0-9]* *[0-9]* *[0-9]* *\[eventpoll:${evp0},${evp1}\]"; then
kill $pid
exit 0
else
--- a/dialects/linux/tests/epoll.c
+++ b/dialects/linux/tests/epoll.c
@@ -14,42 +14,42 @@
return 1;
}
- struct epoll_event ev;
- int fd[2];
- if (pipe(fd) < 0)
- if (fd < 0)
+ int pipefd[2];
+ if (pipe(pipefd) < 0)
{
perror ("pipe");
return 1;
}
- if (dup2(fd[0], 5) < 0)
+ int evfd[2];
+ if ((evfd[0] = dup(pipefd[0])) < 0)
{
- perror ("dup2(fd[0], 5)");
+ perror ("dup(pipefd[0])");
return 1;
}
- if (dup2(fd[1], 6) < 0)
+ if ((evfd[1] = dup(pipefd[1])) < 0)
{
- perror ("dup2(fd[1], 6)");
+ perror ("dup(pipefd[1])");
return 1;
}
+ struct epoll_event ev;
ev.events = EPOLLOUT;
- ev.data.fd = 6;
+ ev.data.fd = evfd[1];
if (epoll_ctl (epfd, EPOLL_CTL_ADD, ev.data.fd, &ev) < 0)
{
- perror ("epoll_ctl<6>");
+ perror ("epoll_ctl<evfd[1]>");
return 1;
}
ev.events = EPOLLIN;
- ev.data.fd = 5;
+ ev.data.fd = evfd[0];
if (epoll_ctl (epfd, EPOLL_CTL_ADD, ev.data.fd, &ev) < 0)
{
- perror ("epoll_ctl<5>");
+ perror ("epoll_ctl<evfd[0]>");
return 1;
}
- printf ("%d %d\n", getpid(), epfd);
+ printf ("%d %d %d %d\n", getpid(), epfd, evfd[0], evfd[1]);
fflush (stdout);
pause ();
return 0;