You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ac...@apache.org on 2023/07/07 20:39:53 UTC

[nuttx] 09/10: nuttx: replace getpid() with nxsched_getpid() in kernel code

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

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

commit 3fe371f60f2e1183b8b2c664313c3aa08732afda
Author: Petro Karashchenko <pe...@gmail.com>
AuthorDate: Fri Jul 7 12:41:46 2023 +0300

    nuttx: replace getpid() with nxsched_getpid() in kernel code
    
    Signed-off-by: Petro Karashchenko <pe...@gmail.com>
---
 net/netlink/netlink_attr.c   | 6 +++---
 sched/pthread/pthread_join.c | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/net/netlink/netlink_attr.c b/net/netlink/netlink_attr.c
index 4d82c10b26..a969e23cb0 100644
--- a/net/netlink/netlink_attr.c
+++ b/net/netlink/netlink_attr.c
@@ -29,8 +29,8 @@
 #include <assert.h>
 #include <errno.h>
 #include <debug.h>
-#include <unistd.h>
 
+#include <nuttx/sched.h>
 #include <nuttx/net/netlink.h>
 
 #include "netlink.h"
@@ -129,7 +129,7 @@ static int validate_nla(FAR const struct nlattr *nla, int maxtype,
   if (g_nla_attr_len[pt->type] && attrlen != g_nla_attr_len[pt->type])
     {
       nwarn("netlink: '%d': attribute type %d has an invalid length.\n",
-            getpid(), type);
+            nxsched_getpid(), type);
       return -EINVAL;
     }
 
@@ -324,7 +324,7 @@ int nla_parse(FAR struct nlattr **tb, int maxtype,
   if (rem > 0)
     {
       nwarn("netlink: %d bytes leftover after parsing attributes in "
-            "pid `%d'.\n", rem, getpid());
+            "pid `%d'.\n", rem, nxsched_getpid());
     }
 
 errout:
diff --git a/sched/pthread/pthread_join.c b/sched/pthread/pthread_join.c
index 7eda733cd4..9c27cde9aa 100644
--- a/sched/pthread/pthread_join.c
+++ b/sched/pthread/pthread_join.c
@@ -88,7 +88,7 @@ int pthread_join(pthread_t thread, FAR pthread_addr_t *pexit_value)
    * ourself.
    */
 
-  if ((pid_t)thread == gettid())
+  if ((pid_t)thread == nxsched_gettid())
     {
       leave_cancellation_point();
       return EDEADLK;