mirror of
https://github.com/apache/nuttx.git
synced 2026-05-28 03:45:50 +08:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user