From 6e9e21594335dd1feced539cf940ab51f949d8d5 Mon Sep 17 00:00:00 2001
From: Ville Juven <ville.juven@unikie.com>
Date: Wed, 25 Oct 2023 15:41:05 +0300
Subject: [PATCH] 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
  *