sched/sched/sched_getcpu.c: Implement non-standard interface.

If SMP is enabled this function will return the number of the CPU that the thread is running on.  This is non-standard but follows GLIBC if __GNU_SOURCE is enabled.  The returned CPU number is, however, worthless since it returns the CPU number of the CPU that was executing the task when the function was called.  The application can never know the true CPU number of the CPU tht it is running on since that value is volatile and change change at any time.
This commit is contained in:
Gregory Nutt
2020-01-31 20:25:15 +00:00
committed by Ouss4
parent 80277d1630
commit 2def8035db
7 changed files with 108 additions and 13 deletions
+1
View File
@@ -119,6 +119,7 @@
"rewinddir","dirent.h","","void","FAR DIR*"
"rmdir","unistd.h","!defined(CONFIG_DISABLE_MOUNTPOINT)","int","FAR const char*"
"rmmod","nuttx/module.h","defined(CONFIG_MODULE)","int","FAR void *"
"sched_getcpu","sched.h","defined(CONFIG_SMP)","int"
"sched_getparam","sched.h","","int","pid_t","struct sched_param*"
"sched_getscheduler","sched.h","","int","pid_t"
"sched_getstreams","nuttx/sched.h","CONFIG_NFILE_STREAMS > 0","FAR struct streamlist*"
1 _exit unistd.h void int
119 rewinddir dirent.h void FAR DIR*
120 rmdir unistd.h !defined(CONFIG_DISABLE_MOUNTPOINT) int FAR const char*
121 rmmod nuttx/module.h defined(CONFIG_MODULE) int FAR void *
122 sched_getcpu sched.h defined(CONFIG_SMP) int
123 sched_getparam sched.h int pid_t
124 sched_getscheduler sched.h int pid_t
125 sched_getstreams nuttx/sched.h CONFIG_NFILE_STREAMS > 0 FAR struct streamlist*