From c71007323e4ad182372b256f61b887ee1df20ea8 Mon Sep 17 00:00:00 2001 From: zhangyuan21 Date: Mon, 5 Jun 2023 23:10:20 +0800 Subject: [PATCH] fs/vfs: Proper use of sigisemptyset Use sigandset function instead of & operation, because the sigset_t structure has been changed. This PR is to adapt to the changes made in #8885. Signed-off-by: zhangyuan21 --- fs/vfs/fs_signalfd.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/fs/vfs/fs_signalfd.c b/fs/vfs/fs_signalfd.c index 62e4963468..edb4992d00 100644 --- a/fs/vfs/fs_signalfd.c +++ b/fs/vfs/fs_signalfd.c @@ -175,8 +175,9 @@ static ssize_t signalfd_file_read(FAR struct file *filep, return -EINVAL; } - pendmask = nxsig_pendingset(NULL) & dev->sigmask; - if (pendmask == 0) + pendmask = nxsig_pendingset(NULL); + sigandset(&pendmask, &pendmask, &dev->sigmask); + if (sigisemptyset(&pendmask)) { if (filep->f_oflags & O_NONBLOCK) { @@ -208,9 +209,10 @@ static ssize_t signalfd_file_read(FAR struct file *filep, siginfo->ssi_int = info.si_value.sival_int; siginfo->ssi_ptr = (uint64_t)(uintptr_t)info.si_value.sival_ptr; siginfo++; - pendmask = nxsig_pendingset(NULL) & dev->sigmask; + pendmask = nxsig_pendingset(NULL); + sigandset(&pendmask, &pendmask, &dev->sigmask); } - while (--count != 0 && pendmask != 0); + while (--count != 0 && !sigisemptyset(&pendmask)); errout: len = (FAR char *)siginfo - buffer; @@ -221,6 +223,7 @@ static int signalfd_file_poll(FAR struct file *filep, FAR struct pollfd *fds, bool setup) { FAR struct signalfd_priv_s *dev = filep->f_priv; + sigset_t mask; int ret = 0; int i; @@ -264,7 +267,9 @@ static int signalfd_file_poll(FAR struct file *filep, /* Notify the POLLIN event if the counter is not zero */ - if ((nxsig_pendingset(NULL) & dev->sigmask) != 0) + mask = nxsig_pendingset(NULL); + sigandset(&mask, &mask, &dev->sigmask); + if (!sigisemptyset(&mask)) { poll_notify(dev->fds, CONFIG_SIGNAL_FD_NPOLLWAITERS, POLLIN); }