[PATCH] posix: Use alias for pthread_self()

Sebastian Huber sebastian.huber at embedded-brains.de
Tue Apr 27 09:12:33 UTC 2021


This may reduce the code size a bit.
---
 cpukit/Makefile.am                | 1 -
 cpukit/rtems/src/taskself.c       | 4 ++++
 spec/build/cpukit/librtemscpu.yml | 1 -
 3 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/cpukit/Makefile.am b/cpukit/Makefile.am
index a8cce3c287..2ae7057d21 100644
--- a/cpukit/Makefile.am
+++ b/cpukit/Makefile.am
@@ -627,7 +627,6 @@ librtemscpu_a_SOURCES += posix/src/pthreadgetschedparam.c
 librtemscpu_a_SOURCES += posix/src/pthreadinitthreads.c
 librtemscpu_a_SOURCES += posix/src/pthreadjoin.c
 librtemscpu_a_SOURCES += posix/src/pthreadonce.c
-librtemscpu_a_SOURCES += posix/src/pthreadself.c
 librtemscpu_a_SOURCES += posix/src/pthreadsetaffinitynp.c
 librtemscpu_a_SOURCES += posix/src/pthreadsetnamenp.c
 librtemscpu_a_SOURCES += posix/src/pthreadsetschedparam.c
diff --git a/cpukit/rtems/src/taskself.c b/cpukit/rtems/src/taskself.c
index 193e691ce5..2eb282ce8d 100644
--- a/cpukit/rtems/src/taskself.c
+++ b/cpukit/rtems/src/taskself.c
@@ -22,7 +22,11 @@
 
 #include <rtems/rtems/tasksimpl.h>
 
+#include <pthread.h>
+
 rtems_id rtems_task_self(void)
 {
    return _Thread_Get_executing()->Object.id;
 }
+
+RTEMS_ALIAS( rtems_task_self ) pthread_t pthread_self( void );
diff --git a/spec/build/cpukit/librtemscpu.yml b/spec/build/cpukit/librtemscpu.yml
index a3a9ee42e3..5842bf7ac2 100644
--- a/spec/build/cpukit/librtemscpu.yml
+++ b/spec/build/cpukit/librtemscpu.yml
@@ -1119,7 +1119,6 @@ source:
 - cpukit/posix/src/pthreadinitthreads.c
 - cpukit/posix/src/pthreadjoin.c
 - cpukit/posix/src/pthreadonce.c
-- cpukit/posix/src/pthreadself.c
 - cpukit/posix/src/pthreadsetaffinitynp.c
 - cpukit/posix/src/pthreadsetnamenp.c
 - cpukit/posix/src/pthreadsetschedparam.c
-- 
2.26.2



More information about the devel mailing list