You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by "zzby0 (via GitHub)" <gi...@apache.org> on 2023/07/31 05:05:29 UTC

[GitHub] [nuttx] zzby0 commented on a diff in pull request #9923: ltp: sigprocmask fix

zzby0 commented on code in PR #9923:
URL: https://github.com/apache/nuttx/pull/9923#discussion_r1278796260


##########
sched/signal/sig_procmask.c:
##########
@@ -187,8 +187,27 @@ int nxsig_procmask(int how, FAR const sigset_t *set, FAR sigset_t *oset)
 
 int sigprocmask(int how, FAR const sigset_t *set, FAR sigset_t *oset)
 {
+  sigset_t nset;
   int ret;
 
+  /* SIGKILL and SIGSTOP should not be added to signal mask */
+
+  if (set != NULL)
+    {
+      nset = *set;
+      if (nxsig_ismember(&nset, SIGKILL))
+        {
+          nxsig_delset(&nset, SIGKILL);
+        }
+
+      if (nxsig_ismember(&nset, SIGSTOP))
+        {
+          nxsig_delset(&nset, SIGSTOP);
+        }
+

Review Comment:
   > The nxsig_delset() is rather expensive; nxsig_member not so much. The code is fine here, but you might want to consider using a single nxsig_nandset. I am not sure if that is an improvment or not.
   
   nxsig_delset() requires only one operation, but nxsig_nandset() needs to traverse the entire set. Maybe nxsig_delset() is not such expensive?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org