test/poll: ignore parent dying
The parent may well die before the child is done, as long as it wrote to the pipe, we're fine. Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
10
test/poll.c
10
test/poll.c
@@ -21,11 +21,11 @@ static void sig_alrm(int sig)
|
|||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
pid_t parent = getpid(), p;
|
|
||||||
struct io_uring_cqe *cqe;
|
struct io_uring_cqe *cqe;
|
||||||
struct io_uring_sqe *sqe;
|
struct io_uring_sqe *sqe;
|
||||||
struct io_uring ring;
|
struct io_uring ring;
|
||||||
int pipe1[2];
|
int pipe1[2];
|
||||||
|
pid_t p;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (pipe(pipe1) != 0) {
|
if (pipe(pipe1) != 0) {
|
||||||
@@ -69,11 +69,11 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
do {
|
do {
|
||||||
if (getppid() != parent) {
|
|
||||||
printf("parent died\n");
|
|
||||||
exit(2);
|
|
||||||
}
|
|
||||||
ret = io_uring_wait_completion(&ring, &cqe);
|
ret = io_uring_wait_completion(&ring, &cqe);
|
||||||
|
if (ret < 0) {
|
||||||
|
printf("child: wait completion %d\n", ret);
|
||||||
|
break;
|
||||||
|
}
|
||||||
} while (ret != 0);
|
} while (ret != 0);
|
||||||
|
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
|
|||||||
Reference in New Issue
Block a user