You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ar...@apache.org on 2023/10/30 14:30:09 UTC

(nuttx) branch master updated (43be20d67e -> e935bc53bb)

This is an automated email from the ASF dual-hosted git repository.

archer pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


    from 43be20d67e Documentation: fix warning
     new 6e9e215943 sched/task: Remove spawn_proxyattrs as obsolete implementation
     new e935bc53bb task/task_spawnparms.c: Set the new process's signal mask

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 sched/task/spawn.h           | 15 ---------------
 sched/task/task_posixspawn.c |  5 -----
 sched/task/task_spawn.c      |  5 -----
 sched/task/task_spawnparms.c | 34 +++++++++++-----------------------
 4 files changed, 11 insertions(+), 48 deletions(-)


(nuttx) 01/02: sched/task: Remove spawn_proxyattrs as obsolete implementation

Posted by ar...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

archer pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 6e9e21594335dd1feced539cf940ab51f949d8d5
Author: Ville Juven <vi...@unikie.com>
AuthorDate: Wed Oct 25 15:41:05 2023 +0300

    sched/task: Remove spawn_proxyattrs as obsolete implementation
    
    Like the name implies, it is supposed to set the spawn attributes for
    the NuttX specific "spawn proxy task" which was historically used as
    a proxy to spawn new tasks. The proxy handled file actions and the signal
    mask which are inherited from the parent.
    
    The proxy task does not exist anymore, thus the proxy task attributes
    do not need to be set anymore either.
    
    Also, the function is currently still used, but the signal mask is set
    for the spawning process, not the proxy process, and this is most
    DEFINITELY an error (as the spawning process's signal mask changes
    unexpectedly).
    
    Setting the signal mask for the newly spawned process is simple, just
    set it directly, if instructed to do so. This will be done in a later
    patch!
---
 sched/task/spawn.h           | 15 ---------------
 sched/task/task_posixspawn.c |  5 -----
 sched/task/task_spawn.c      |  5 -----
 sched/task/task_spawnparms.c | 23 -----------------------
 4 files changed, 48 deletions(-)

diff --git a/sched/task/spawn.h b/sched/task/spawn.h
index e55d6d0b4e..0c6dce55b2 100644
--- a/sched/task/spawn.h
+++ b/sched/task/spawn.h
@@ -58,19 +58,4 @@
 
 int spawn_execattrs(pid_t pid, FAR const posix_spawnattr_t *attr);
 
-/****************************************************************************
- * Name: spawn_proxyattrs
- *
- * Description:
- *   Set attributes of the proxy task before it has started the new child
- *   task.
- *
- * Input Parameters:
- *
- *   attr - The attributes to use
- *
- ****************************************************************************/
-
-void spawn_proxyattrs(FAR const posix_spawnattr_t *attr);
-
 #endif /* __SCHED_TASK_SPAWN_H */
diff --git a/sched/task/task_posixspawn.c b/sched/task/task_posixspawn.c
index a0ff0c0d5d..b6000de462 100644
--- a/sched/task/task_posixspawn.c
+++ b/sched/task/task_posixspawn.c
@@ -221,11 +221,6 @@ int posix_spawn(FAR pid_t *pid, FAR const char *path,
   sinfo("pid=%p path=%s file_actions=%p attr=%p argv=%p\n",
         pid, path, file_actions, attr, argv);
 
-  if (attr != NULL)
-    {
-      spawn_proxyattrs(attr);
-    }
-
   return nxposix_spawn_exec(pid, path,
                             file_actions != NULL ?
                             *file_actions : NULL, attr, argv, envp);
diff --git a/sched/task/task_spawn.c b/sched/task/task_spawn.c
index 09591a1840..44cc924f7c 100644
--- a/sched/task/task_spawn.c
+++ b/sched/task/task_spawn.c
@@ -331,11 +331,6 @@ int task_spawn(FAR const char *name, main_t entry,
   sinfo("name=%s entry=%p file_actions=%p attr=%p argv=%p\n",
         name, entry, file_actions, attr, argv);
 
-  if (attr != NULL)
-    {
-      spawn_proxyattrs(attr);
-    }
-
   ret = nxtask_spawn_exec(&pid, name, entry,
                           file_actions != NULL ? *file_actions : NULL,
                           attr, argv, envp);
diff --git a/sched/task/task_spawnparms.c b/sched/task/task_spawnparms.c
index c3198def2e..6db333cde3 100644
--- a/sched/task/task_spawnparms.c
+++ b/sched/task/task_spawnparms.c
@@ -227,29 +227,6 @@ int spawn_execattrs(pid_t pid, FAR const posix_spawnattr_t *attr)
   return OK;
 }
 
-/****************************************************************************
- * Name: spawn_proxyattrs
- *
- * Description:
- *   Set attributes of the proxy task before it has started the new child
- *   task.
- *
- * Input Parameters:
- *
- *   attr - The attributes to use
- *
- ****************************************************************************/
-
-void spawn_proxyattrs(FAR const posix_spawnattr_t *attr)
-{
-  /* Check if we need to change the signal mask */
-
-  if (attr != NULL && (attr->flags & POSIX_SPAWN_SETSIGMASK) != 0)
-    {
-      nxsig_procmask(SIG_SETMASK, &attr->sigmask, NULL);
-    }
-}
-
 /****************************************************************************
  * Name: spawn_file_actions
  *


(nuttx) 02/02: task/task_spawnparms.c: Set the new process's signal mask

Posted by ar...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

archer pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit e935bc53bb72f7333fb8570dc043bf2f8fd92b29
Author: Ville Juven <vi...@unikie.com>
AuthorDate: Wed Oct 25 15:42:05 2023 +0300

    task/task_spawnparms.c: Set the new process's signal mask
    
    Set the newly spawned process's signal mask, if the caller has instructed
    to do so by setting POSIX_SPAWN_SETSIGMASK.
    
    This is called after the task has been created but has NOT been started
    yet.
---
 sched/task/task_spawnparms.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/sched/task/task_spawnparms.c b/sched/task/task_spawnparms.c
index 6db333cde3..cf231b78c9 100644
--- a/sched/task/task_spawnparms.c
+++ b/sched/task/task_spawnparms.c
@@ -149,6 +149,17 @@ int spawn_execattrs(pid_t pid, FAR const posix_spawnattr_t *attr)
    * return an error value, then we would also have to stop the task.
    */
 
+  /* Firstly, set the signal mask if requested to do so */
+
+  if ((attr->flags & POSIX_SPAWN_SETSIGMASK) != 0)
+    {
+      FAR struct tcb_s *tcb = nxsched_get_tcb(pid);
+      if (tcb)
+        {
+          tcb->sigprocmask = attr->sigmask;
+        }
+    }
+
   /* If we are only setting the priority, then call sched_setparm()
    * to set the priority of the of the new task.
    */