You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2022/03/21 22:48:44 UTC

[GitHub] [incubator-nuttx] pkarashchenko opened a new pull request #5819: pid_t: unify usage of special task IDs

pkarashchenko opened a new pull request #5819:
URL: https://github.com/apache/incubator-nuttx/pull/5819


   ## Summary
   Unify usage of special task IDs
   
   ## Impact
   None. Refactoring only
   
   ## Testing
   Pass CI


-- 
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



[GitHub] [incubator-nuttx] xiaoxiang781216 merged pull request #5819: pid_t: unify usage of special task IDs

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 merged pull request #5819:
URL: https://github.com/apache/incubator-nuttx/pull/5819


   


-- 
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



[GitHub] [incubator-nuttx] pkarashchenko commented on a change in pull request #5819: pid_t: unify usage of special task IDs

Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on a change in pull request #5819:
URL: https://github.com/apache/incubator-nuttx/pull/5819#discussion_r832140265



##########
File path: sched/task/task_posixspawn.c
##########
@@ -410,7 +410,7 @@ int posix_spawn(FAR pid_t *pid, FAR const char *path,
    * for use within the OS.
    */
 
-  ret = nx_waitpid(proxy, &status, 0);
+  ret = nx_waitpid((pid_t)proxy, &status, 0);

Review comment:
       Yes. This can be an option. I will implement the change




-- 
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



[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #5819: pid_t: unify usage of special task IDs

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #5819:
URL: https://github.com/apache/incubator-nuttx/pull/5819#discussion_r831718956



##########
File path: drivers/syslog/syslog_device.c
##########
@@ -768,9 +768,10 @@ void syslog_dev_uninitialize(FAR struct syslog_channel_s *channel)
    * interrupt context.
    */
 
-  if (up_interrupt_context() || getpid() == 0)
+  if (up_interrupt_context() || getpid() == IDLE_TASK_PROCESS_ID)

Review comment:
       sched_idle_task->sched_idletask




-- 
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



[GitHub] [incubator-nuttx] gustavonihei commented on pull request #5819: pid_t: unify usage of special task IDs

Posted by GitBox <gi...@apache.org>.
gustavonihei commented on pull request #5819:
URL: https://github.com/apache/incubator-nuttx/pull/5819#issuecomment-1075146692


   By the way, nice work @pkarashchenko!
   It is a pleasure to see these inconsistencies being fixed throughout the NuttX code base.


-- 
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



[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #5819: pid_t: unify usage of special task IDs

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #5819:
URL: https://github.com/apache/incubator-nuttx/pull/5819#discussion_r831707115



##########
File path: include/nuttx/sched.h
##########
@@ -79,7 +79,7 @@
 
 /* Special task IDS.  Any negative PID is invalid. */
 
-#define NULL_TASK_PROCESS_ID       (pid_t)0

Review comment:
       should we change to IDLE_PROCESS_ID to algin with INVALID_PROCESS_ID?

##########
File path: drivers/syslog/syslog_device.c
##########
@@ -768,9 +768,10 @@ void syslog_dev_uninitialize(FAR struct syslog_channel_s *channel)
    * interrupt context.
    */
 
-  if (up_interrupt_context() || getpid() == 0)
+  if (up_interrupt_context() || getpid() == IDLE_TASK_PROCESS_ID)
     {
-      DEBUGASSERT(!up_interrupt_context() && getpid() != 0);
+      DEBUGASSERT(!up_interrupt_context() &&
+                  getpid() != IDLE_TASK_PROCESS_ID);

Review comment:
       ditto

##########
File path: drivers/syslog/syslog_device.c
##########
@@ -768,9 +768,10 @@ void syslog_dev_uninitialize(FAR struct syslog_channel_s *channel)
    * interrupt context.
    */
 
-  if (up_interrupt_context() || getpid() == 0)
+  if (up_interrupt_context() || getpid() == IDLE_TASK_PROCESS_ID)

Review comment:
       should call sched_idle_task here

##########
File path: drivers/syslog/syslog_device.c
##########
@@ -321,7 +321,7 @@ static int syslog_dev_outputready(FAR struct syslog_dev_s *syslog_dev)
 
   /* Cases (4) and (5) */
 
-  if (up_interrupt_context() || getpid() == 0)
+  if (up_interrupt_context() || getpid() == IDLE_TASK_PROCESS_ID)

Review comment:
       ditto




-- 
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



[GitHub] [incubator-nuttx] gustavonihei commented on a change in pull request #5819: pid_t: unify usage of special task IDs

Posted by GitBox <gi...@apache.org>.
gustavonihei commented on a change in pull request #5819:
URL: https://github.com/apache/incubator-nuttx/pull/5819#discussion_r832107045



##########
File path: sched/task/task_posixspawn.c
##########
@@ -410,7 +410,7 @@ int posix_spawn(FAR pid_t *pid, FAR const char *path,
    * for use within the OS.
    */
 
-  ret = nx_waitpid(proxy, &status, 0);
+  ret = nx_waitpid((pid_t)proxy, &status, 0);

Review comment:
       How about keeping `proxy` as `pid_t` and instead receive the return from `kthread_create` with the `ret` local?




-- 
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



[GitHub] [incubator-nuttx] pkarashchenko commented on a change in pull request #5819: pid_t: unify usage of special task IDs

Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on a change in pull request #5819:
URL: https://github.com/apache/incubator-nuttx/pull/5819#discussion_r832053081



##########
File path: arch/ceva/src/common/up_assert.c
##########
@@ -296,7 +296,7 @@ static void _up_assert(int errorcode)
 
   /* Are we in an interrupt handler or the idle task? */
 
-  if (CURRENT_REGS || running_task()->pid == 0)
+  if (up_interrupt_context() || sched_idletask())

Review comment:
       @xiaoxiang781216 please review this place. Change seems to be equivalent, but maybe there is something that I miss.




-- 
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