sched/task/task_getpid: getpid should return process id not thread id

Summary:
   implement the right semantics:
1. getpid should return the main thread id
2. gettid should return the current thread id

Refer to:
 https://github.com/apache/incubator-nuttx/issues/2499
 https://github.com/apache/incubator-nuttx/pull/2518

Signed-off-by: qinwei1 <qinwei1@xiaomi.com>
This commit is contained in:
qinwei1
2022-11-15 14:37:20 +08:00
committed by Xiang Xiao
parent 5a367ad59d
commit 8021dfece6
28 changed files with 56 additions and 76 deletions
+3 -3
View File
@@ -1484,7 +1484,7 @@ static int proc_open(FAR struct file *filep, FAR const char *relpath,
if (strncmp(relpath, "self", 4) == 0)
{
tmp = (unsigned long)getpid(); /* Get the PID of the calling task */
tmp = gettid(); /* Get the TID of the calling task */
ptr = (FAR char *)relpath + 4; /* Discard const */
}
else
@@ -1792,7 +1792,7 @@ static int proc_opendir(FAR const char *relpath,
if (strncmp(relpath, "self", 4) == 0)
{
tmp = (unsigned long)getpid(); /* Get the PID of the calling task */
tmp = gettid(); /* Get the TID of the calling task */
ptr = (FAR char *)relpath + 4; /* Discard const */
}
else
@@ -2032,7 +2032,7 @@ static int proc_stat(const char *relpath, struct stat *buf)
if (strncmp(relpath, "self", 4) == 0)
{
tmp = (unsigned long)getpid(); /* Get the PID of the calling task */
tmp = gettid(); /* Get the TID of the calling task */
ptr = (FAR char *)relpath + 4; /* Discard const */
}
else