From d3700649c0c078ab0eaeb594a0df4e6ac5d90653 Mon Sep 17 00:00:00 2001 From: Yoshinori Sugino Date: Fri, 6 Nov 2020 15:37:05 +0900 Subject: [PATCH] sched/sched/sched_waitid.c: Allow WNOHANG In the current implementation of waitid, WEXITED is mandatory and WNOHANG is optional. --- sched/sched/sched_waitid.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sched/sched/sched_waitid.c b/sched/sched/sched_waitid.c index a03cbe2edb..b8fb630b9c 100644 --- a/sched/sched/sched_waitid.c +++ b/sched/sched/sched_waitid.c @@ -127,7 +127,12 @@ int nx_waitid(int idtype, id_t id, FAR siginfo_t *info, int options) * distinguish any other events. */ - if (options != WEXITED) + if ((options & WEXITED) == 0) + { + return -ENOSYS; + } + + if ((options & ~(WEXITED | WNOHANG)) != 0) { return -ENOSYS; }