mirror of
https://github.com/apache/nuttx.git
synced 2026-05-23 14:58:13 +08:00
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:
+11
-3
@@ -71,6 +71,7 @@
|
||||
#define SYS_exit (CONFIG_SYS_RESERVED + 1)
|
||||
#define SYS_get_errno (CONFIG_SYS_RESERVED + 2)
|
||||
#define SYS_getpid (CONFIG_SYS_RESERVED + 3)
|
||||
|
||||
#define SYS_sched_getparam (CONFIG_SYS_RESERVED + 4)
|
||||
#define SYS_sched_getscheduler (CONFIG_SYS_RESERVED + 5)
|
||||
#define SYS_sched_lock (CONFIG_SYS_RESERVED + 6)
|
||||
@@ -80,9 +81,16 @@
|
||||
#define SYS_sched_setscheduler (CONFIG_SYS_RESERVED + 10)
|
||||
#define SYS_sched_unlock (CONFIG_SYS_RESERVED + 11)
|
||||
#define SYS_sched_yield (CONFIG_SYS_RESERVED + 12)
|
||||
#define SYS_set_errno (CONFIG_SYS_RESERVED + 13)
|
||||
#define SYS_uname (CONFIG_SYS_RESERVED + 14)
|
||||
#define __SYS_uid (CONFIG_SYS_RESERVED + 15)
|
||||
#ifdef CONFIG_SMP
|
||||
# define SYS_sched_getcpu (CONFIG_SYS_RESERVED + 13)
|
||||
# define __SYS_set_errno (CONFIG_SYS_RESERVED + 14)
|
||||
#else
|
||||
# define __SYS_set_errno (CONFIG_SYS_RESERVED + 13)
|
||||
#endif
|
||||
|
||||
#define SYS_set_errno (__SYS_set_errno + 0)
|
||||
#define SYS_uname (__SYS_set_errno + 1)
|
||||
#define __SYS_uid (__SYS_set_errno + 2)
|
||||
|
||||
/* User identity */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user