[Xenomai-git] Jan Kiszka : lib/cobalt: Wrap pthread_setschedprio for proper real-time support
Module: xenomai-3 Branch: next Commit: 7b60732784e7023337010ff3b0738543e8640e4b URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=7b60732784e7023337010ff3b0738543e8640e4b Author: Jan Kiszka Date: Tue Mar 8 14:46:59 2016 +0100 lib/cobalt: Wrap pthread_setschedprio for proper real-time support Implement pthread_setschedprio on top of pthread_setschedparam_ex with the help of the new __SCHED_CURRENT policy. This ensures that prio changes are directly applied to the real-time core, and that with just a single syscall. Signed-off-by: Jan Kiszka --- include/cobalt/pthread.h |2 ++ lib/cobalt/cobalt.wrappers |1 + lib/cobalt/thread.c|9 + lib/cobalt/wrappers.c |6 ++ 4 files changed, 18 insertions(+) diff --git a/include/cobalt/pthread.h b/include/cobalt/pthread.h index f1b1c8a..3e9bd47 100644 --- a/include/cobalt/pthread.h +++ b/include/cobalt/pthread.h @@ -53,6 +53,8 @@ COBALT_DECL(int, pthread_setschedparam(pthread_t thread, int policy, const struct sched_param *param)); +COBALT_DECL(int, pthread_setschedprio(pthread_t thread, int prio)); + COBALT_DECL(int, pthread_mutex_init(pthread_mutex_t *mutex, const pthread_mutexattr_t *attr)); diff --git a/lib/cobalt/cobalt.wrappers b/lib/cobalt/cobalt.wrappers index 4f883f3..f8bda39 100644 --- a/lib/cobalt/cobalt.wrappers +++ b/lib/cobalt/cobalt.wrappers @@ -2,6 +2,7 @@ --wrap pthread_create --wrap pthread_setschedparam --wrap pthread_getschedparam +--wrap pthread_setschedprio --wrap pthread_yield --wrap sched_yield --wrap sched_get_priority_min diff --git a/lib/cobalt/thread.c b/lib/cobalt/thread.c index 908516f..62ca0a0 100644 --- a/lib/cobalt/thread.c +++ b/lib/cobalt/thread.c @@ -650,6 +650,15 @@ int pthread_setschedparam_ex(pthread_t thread, return ret; } +COBALT_IMPL(int, pthread_setschedprio, (pthread_t thread, int prio)) +{ + struct sched_param_ex param_ex = { + .sched_priority = prio, + }; + + return pthread_setschedparam_ex(thread, __SCHED_CURRENT, ¶m_ex); +} + /** * Get the scheduling policy and parameters of the specified thread. * diff --git a/lib/cobalt/wrappers.c b/lib/cobalt/wrappers.c index 8bd9190..8dd28fb 100644 --- a/lib/cobalt/wrappers.c +++ b/lib/cobalt/wrappers.c @@ -60,6 +60,12 @@ int __real_pthread_getschedparam(pthread_t thread, } __weak +int __real_pthread_setschedprio(pthread_t thread, int prio) +{ + return pthread_setschedprio(thread, prio); +} + +__weak int __real_sched_yield(void) { return sched_yield(); ___ Xenomai-git mailing list Xenomai-git@xenomai.org https://xenomai.org/mailman/listinfo/xenomai-git
[Xenomai-git] Jan Kiszka : lib/cobalt: Wrap pthread_setschedprio for proper real-time support
Module: xenomai-3 Branch: next Commit: d5ed53092d201dd055a65ba3c1b8cb5a4c21 URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=d5ed53092d201dd055a65ba3c1b8cb5a4c21 Author: Jan Kiszka Date: Tue Mar 8 14:46:59 2016 +0100 lib/cobalt: Wrap pthread_setschedprio for proper real-time support Implement pthread_setschedprio on top of pthread_setschedparam_ex with the help of the new __SCHED_CURRENT policy. This ensures that prio changes are directly applied to the real-time core, and that with just a single syscall. Signed-off-by: Jan Kiszka --- include/cobalt/pthread.h |2 ++ lib/cobalt/cobalt.wrappers |1 + lib/cobalt/thread.c|9 + lib/cobalt/wrappers.c |6 ++ 4 files changed, 18 insertions(+) diff --git a/include/cobalt/pthread.h b/include/cobalt/pthread.h index f1b1c8a..3e9bd47 100644 --- a/include/cobalt/pthread.h +++ b/include/cobalt/pthread.h @@ -53,6 +53,8 @@ COBALT_DECL(int, pthread_setschedparam(pthread_t thread, int policy, const struct sched_param *param)); +COBALT_DECL(int, pthread_setschedprio(pthread_t thread, int prio)); + COBALT_DECL(int, pthread_mutex_init(pthread_mutex_t *mutex, const pthread_mutexattr_t *attr)); diff --git a/lib/cobalt/cobalt.wrappers b/lib/cobalt/cobalt.wrappers index 4f883f3..f8bda39 100644 --- a/lib/cobalt/cobalt.wrappers +++ b/lib/cobalt/cobalt.wrappers @@ -2,6 +2,7 @@ --wrap pthread_create --wrap pthread_setschedparam --wrap pthread_getschedparam +--wrap pthread_setschedprio --wrap pthread_yield --wrap sched_yield --wrap sched_get_priority_min diff --git a/lib/cobalt/thread.c b/lib/cobalt/thread.c index 908516f..62ca0a0 100644 --- a/lib/cobalt/thread.c +++ b/lib/cobalt/thread.c @@ -650,6 +650,15 @@ int pthread_setschedparam_ex(pthread_t thread, return ret; } +COBALT_IMPL(int, pthread_setschedprio, (pthread_t thread, int prio)) +{ + struct sched_param_ex param_ex = { + .sched_priority = prio, + }; + + return pthread_setschedparam_ex(thread, __SCHED_CURRENT, ¶m_ex); +} + /** * Get the scheduling policy and parameters of the specified thread. * diff --git a/lib/cobalt/wrappers.c b/lib/cobalt/wrappers.c index 8bd9190..8dd28fb 100644 --- a/lib/cobalt/wrappers.c +++ b/lib/cobalt/wrappers.c @@ -60,6 +60,12 @@ int __real_pthread_getschedparam(pthread_t thread, } __weak +int __real_pthread_setschedprio(pthread_t thread, int prio) +{ + return pthread_setschedprio(thread, prio); +} + +__weak int __real_sched_yield(void) { return sched_yield(); ___ Xenomai-git mailing list Xenomai-git@xenomai.org https://xenomai.org/mailman/listinfo/xenomai-git
[Xenomai-git] Jan Kiszka : lib/cobalt: Wrap pthread_setschedprio for proper real-time support
Module: xenomai-3 Branch: next Commit: 51d0188d2d4ae8f8575437518d7665b16ec95122 URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=51d0188d2d4ae8f8575437518d7665b16ec95122 Author: Jan Kiszka Date: Tue Mar 8 14:46:59 2016 +0100 lib/cobalt: Wrap pthread_setschedprio for proper real-time support Implement pthread_setschedprio on top of pthread_setschedparam_ex with the help of the new __SCHED_CURRENT policy. This ensures that prio changes are directly applied to the real-time core, and that with just a single syscall. Signed-off-by: Jan Kiszka --- include/cobalt/pthread.h |2 ++ lib/cobalt/cobalt.wrappers |1 + lib/cobalt/thread.c|9 + lib/cobalt/wrappers.c |6 ++ 4 files changed, 18 insertions(+) diff --git a/include/cobalt/pthread.h b/include/cobalt/pthread.h index f1b1c8a..3e9bd47 100644 --- a/include/cobalt/pthread.h +++ b/include/cobalt/pthread.h @@ -53,6 +53,8 @@ COBALT_DECL(int, pthread_setschedparam(pthread_t thread, int policy, const struct sched_param *param)); +COBALT_DECL(int, pthread_setschedprio(pthread_t thread, int prio)); + COBALT_DECL(int, pthread_mutex_init(pthread_mutex_t *mutex, const pthread_mutexattr_t *attr)); diff --git a/lib/cobalt/cobalt.wrappers b/lib/cobalt/cobalt.wrappers index 4f883f3..f8bda39 100644 --- a/lib/cobalt/cobalt.wrappers +++ b/lib/cobalt/cobalt.wrappers @@ -2,6 +2,7 @@ --wrap pthread_create --wrap pthread_setschedparam --wrap pthread_getschedparam +--wrap pthread_setschedprio --wrap pthread_yield --wrap sched_yield --wrap sched_get_priority_min diff --git a/lib/cobalt/thread.c b/lib/cobalt/thread.c index 908516f..62ca0a0 100644 --- a/lib/cobalt/thread.c +++ b/lib/cobalt/thread.c @@ -650,6 +650,15 @@ int pthread_setschedparam_ex(pthread_t thread, return ret; } +COBALT_IMPL(int, pthread_setschedprio, (pthread_t thread, int prio)) +{ + struct sched_param_ex param_ex = { + .sched_priority = prio, + }; + + return pthread_setschedparam_ex(thread, __SCHED_CURRENT, ¶m_ex); +} + /** * Get the scheduling policy and parameters of the specified thread. * diff --git a/lib/cobalt/wrappers.c b/lib/cobalt/wrappers.c index 8bd9190..8dd28fb 100644 --- a/lib/cobalt/wrappers.c +++ b/lib/cobalt/wrappers.c @@ -60,6 +60,12 @@ int __real_pthread_getschedparam(pthread_t thread, } __weak +int __real_pthread_setschedprio(pthread_t thread, int prio) +{ + return pthread_setschedprio(thread, prio); +} + +__weak int __real_sched_yield(void) { return sched_yield(); ___ Xenomai-git mailing list Xenomai-git@xenomai.org https://xenomai.org/mailman/listinfo/xenomai-git
[Xenomai-git] Jan Kiszka : lib/cobalt: Wrap pthread_setschedprio for proper real-time support
Module: xenomai-3 Branch: next Commit: 56b4b41e569e6bbe11cbb0617c20dd1daf1f20b7 URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=56b4b41e569e6bbe11cbb0617c20dd1daf1f20b7 Author: Jan Kiszka Date: Tue Mar 8 14:46:59 2016 +0100 lib/cobalt: Wrap pthread_setschedprio for proper real-time support Implement pthread_setschedprio on top of pthread_setschedparam_ex with the help of the new __SCHED_CURRENT policy. This ensures that prio changes are directly applied to the real-time core, and that with just a single syscall. Signed-off-by: Jan Kiszka --- include/cobalt/pthread.h |2 ++ lib/cobalt/cobalt.wrappers |1 + lib/cobalt/thread.c|9 + lib/cobalt/wrappers.c |6 ++ 4 files changed, 18 insertions(+) diff --git a/include/cobalt/pthread.h b/include/cobalt/pthread.h index f1b1c8a..3e9bd47 100644 --- a/include/cobalt/pthread.h +++ b/include/cobalt/pthread.h @@ -53,6 +53,8 @@ COBALT_DECL(int, pthread_setschedparam(pthread_t thread, int policy, const struct sched_param *param)); +COBALT_DECL(int, pthread_setschedprio(pthread_t thread, int prio)); + COBALT_DECL(int, pthread_mutex_init(pthread_mutex_t *mutex, const pthread_mutexattr_t *attr)); diff --git a/lib/cobalt/cobalt.wrappers b/lib/cobalt/cobalt.wrappers index 4f883f3..f8bda39 100644 --- a/lib/cobalt/cobalt.wrappers +++ b/lib/cobalt/cobalt.wrappers @@ -2,6 +2,7 @@ --wrap pthread_create --wrap pthread_setschedparam --wrap pthread_getschedparam +--wrap pthread_setschedprio --wrap pthread_yield --wrap sched_yield --wrap sched_get_priority_min diff --git a/lib/cobalt/thread.c b/lib/cobalt/thread.c index 908516f..62ca0a0 100644 --- a/lib/cobalt/thread.c +++ b/lib/cobalt/thread.c @@ -650,6 +650,15 @@ int pthread_setschedparam_ex(pthread_t thread, return ret; } +COBALT_IMPL(int, pthread_setschedprio, (pthread_t thread, int prio)) +{ + struct sched_param_ex param_ex = { + .sched_priority = prio, + }; + + return pthread_setschedparam_ex(thread, __SCHED_CURRENT, ¶m_ex); +} + /** * Get the scheduling policy and parameters of the specified thread. * diff --git a/lib/cobalt/wrappers.c b/lib/cobalt/wrappers.c index 8bd9190..8dd28fb 100644 --- a/lib/cobalt/wrappers.c +++ b/lib/cobalt/wrappers.c @@ -60,6 +60,12 @@ int __real_pthread_getschedparam(pthread_t thread, } __weak +int __real_pthread_setschedprio(pthread_t thread, int prio) +{ + return pthread_setschedprio(thread, prio); +} + +__weak int __real_sched_yield(void) { return sched_yield(); ___ Xenomai-git mailing list Xenomai-git@xenomai.org https://xenomai.org/mailman/listinfo/xenomai-git
[Xenomai-git] Jan Kiszka : lib/cobalt: Wrap pthread_setschedprio for proper real-time support
Module: xenomai-3 Branch: next Commit: 1f693bee748a448f2373b3e24d200ee3c57c65f3 URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=1f693bee748a448f2373b3e24d200ee3c57c65f3 Author: Jan Kiszka Date: Tue Mar 8 14:46:59 2016 +0100 lib/cobalt: Wrap pthread_setschedprio for proper real-time support Implement pthread_setschedprio on top of pthread_setschedparam_ex with the help of the new __SCHED_CURRENT policy. This ensures that prio changes are directly applied to the real-time core, and that with just a single syscall. Signed-off-by: Jan Kiszka --- include/cobalt/pthread.h |2 ++ lib/cobalt/cobalt.wrappers |1 + lib/cobalt/thread.c|9 + lib/cobalt/wrappers.c |6 ++ 4 files changed, 18 insertions(+) diff --git a/include/cobalt/pthread.h b/include/cobalt/pthread.h index f1b1c8a..3e9bd47 100644 --- a/include/cobalt/pthread.h +++ b/include/cobalt/pthread.h @@ -53,6 +53,8 @@ COBALT_DECL(int, pthread_setschedparam(pthread_t thread, int policy, const struct sched_param *param)); +COBALT_DECL(int, pthread_setschedprio(pthread_t thread, int prio)); + COBALT_DECL(int, pthread_mutex_init(pthread_mutex_t *mutex, const pthread_mutexattr_t *attr)); diff --git a/lib/cobalt/cobalt.wrappers b/lib/cobalt/cobalt.wrappers index 4f883f3..f8bda39 100644 --- a/lib/cobalt/cobalt.wrappers +++ b/lib/cobalt/cobalt.wrappers @@ -2,6 +2,7 @@ --wrap pthread_create --wrap pthread_setschedparam --wrap pthread_getschedparam +--wrap pthread_setschedprio --wrap pthread_yield --wrap sched_yield --wrap sched_get_priority_min diff --git a/lib/cobalt/thread.c b/lib/cobalt/thread.c index 908516f..62ca0a0 100644 --- a/lib/cobalt/thread.c +++ b/lib/cobalt/thread.c @@ -650,6 +650,15 @@ int pthread_setschedparam_ex(pthread_t thread, return ret; } +COBALT_IMPL(int, pthread_setschedprio, (pthread_t thread, int prio)) +{ + struct sched_param_ex param_ex = { + .sched_priority = prio, + }; + + return pthread_setschedparam_ex(thread, __SCHED_CURRENT, ¶m_ex); +} + /** * Get the scheduling policy and parameters of the specified thread. * diff --git a/lib/cobalt/wrappers.c b/lib/cobalt/wrappers.c index 8bd9190..8dd28fb 100644 --- a/lib/cobalt/wrappers.c +++ b/lib/cobalt/wrappers.c @@ -60,6 +60,12 @@ int __real_pthread_getschedparam(pthread_t thread, } __weak +int __real_pthread_setschedprio(pthread_t thread, int prio) +{ + return pthread_setschedprio(thread, prio); +} + +__weak int __real_sched_yield(void) { return sched_yield(); ___ Xenomai-git mailing list Xenomai-git@xenomai.org https://xenomai.org/mailman/listinfo/xenomai-git
[Xenomai-git] Jan Kiszka : lib/cobalt: Wrap pthread_setschedprio for proper real-time support
Module: xenomai-3 Branch: next Commit: 100c895f348d753abc4d654f7929c1be0b592a02 URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=100c895f348d753abc4d654f7929c1be0b592a02 Author: Jan Kiszka Date: Tue Mar 8 14:46:59 2016 +0100 lib/cobalt: Wrap pthread_setschedprio for proper real-time support Implement pthread_setschedprio on top of pthread_setschedparam_ex with the help of the new __SCHED_CURRENT policy. This ensures that prio changes are directly applied to the real-time core, and that with just a single syscall. Signed-off-by: Jan Kiszka --- include/cobalt/pthread.h |2 ++ lib/cobalt/cobalt.wrappers |1 + lib/cobalt/thread.c|9 + lib/cobalt/wrappers.c |6 ++ 4 files changed, 18 insertions(+) diff --git a/include/cobalt/pthread.h b/include/cobalt/pthread.h index f1b1c8a..3e9bd47 100644 --- a/include/cobalt/pthread.h +++ b/include/cobalt/pthread.h @@ -53,6 +53,8 @@ COBALT_DECL(int, pthread_setschedparam(pthread_t thread, int policy, const struct sched_param *param)); +COBALT_DECL(int, pthread_setschedprio(pthread_t thread, int prio)); + COBALT_DECL(int, pthread_mutex_init(pthread_mutex_t *mutex, const pthread_mutexattr_t *attr)); diff --git a/lib/cobalt/cobalt.wrappers b/lib/cobalt/cobalt.wrappers index 4f883f3..f8bda39 100644 --- a/lib/cobalt/cobalt.wrappers +++ b/lib/cobalt/cobalt.wrappers @@ -2,6 +2,7 @@ --wrap pthread_create --wrap pthread_setschedparam --wrap pthread_getschedparam +--wrap pthread_setschedprio --wrap pthread_yield --wrap sched_yield --wrap sched_get_priority_min diff --git a/lib/cobalt/thread.c b/lib/cobalt/thread.c index 908516f..62ca0a0 100644 --- a/lib/cobalt/thread.c +++ b/lib/cobalt/thread.c @@ -650,6 +650,15 @@ int pthread_setschedparam_ex(pthread_t thread, return ret; } +COBALT_IMPL(int, pthread_setschedprio, (pthread_t thread, int prio)) +{ + struct sched_param_ex param_ex = { + .sched_priority = prio, + }; + + return pthread_setschedparam_ex(thread, __SCHED_CURRENT, ¶m_ex); +} + /** * Get the scheduling policy and parameters of the specified thread. * diff --git a/lib/cobalt/wrappers.c b/lib/cobalt/wrappers.c index 8bd9190..8dd28fb 100644 --- a/lib/cobalt/wrappers.c +++ b/lib/cobalt/wrappers.c @@ -60,6 +60,12 @@ int __real_pthread_getschedparam(pthread_t thread, } __weak +int __real_pthread_setschedprio(pthread_t thread, int prio) +{ + return pthread_setschedprio(thread, prio); +} + +__weak int __real_sched_yield(void) { return sched_yield(); ___ Xenomai-git mailing list Xenomai-git@xenomai.org https://xenomai.org/mailman/listinfo/xenomai-git
[Xenomai-git] Jan Kiszka : lib/cobalt: Wrap pthread_setschedprio for proper real-time support
Module: xenomai-3 Branch: next Commit: 9ae777e3c847968b46e01119b47b0562e144f936 URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=9ae777e3c847968b46e01119b47b0562e144f936 Author: Jan Kiszka Date: Tue Mar 8 14:46:59 2016 +0100 lib/cobalt: Wrap pthread_setschedprio for proper real-time support Implement pthread_setschedprio on top of pthread_setschedparam_ex with the help of the new __SCHED_CURRENT policy. This ensures that prio changes are directly applied to the real-time core, and that with just a single syscall. Signed-off-by: Jan Kiszka --- include/cobalt/pthread.h |2 ++ lib/cobalt/cobalt.wrappers |1 + lib/cobalt/thread.c|9 + lib/cobalt/wrappers.c |6 ++ 4 files changed, 18 insertions(+) diff --git a/include/cobalt/pthread.h b/include/cobalt/pthread.h index f1b1c8a..3e9bd47 100644 --- a/include/cobalt/pthread.h +++ b/include/cobalt/pthread.h @@ -53,6 +53,8 @@ COBALT_DECL(int, pthread_setschedparam(pthread_t thread, int policy, const struct sched_param *param)); +COBALT_DECL(int, pthread_setschedprio(pthread_t thread, int prio)); + COBALT_DECL(int, pthread_mutex_init(pthread_mutex_t *mutex, const pthread_mutexattr_t *attr)); diff --git a/lib/cobalt/cobalt.wrappers b/lib/cobalt/cobalt.wrappers index 4f883f3..f8bda39 100644 --- a/lib/cobalt/cobalt.wrappers +++ b/lib/cobalt/cobalt.wrappers @@ -2,6 +2,7 @@ --wrap pthread_create --wrap pthread_setschedparam --wrap pthread_getschedparam +--wrap pthread_setschedprio --wrap pthread_yield --wrap sched_yield --wrap sched_get_priority_min diff --git a/lib/cobalt/thread.c b/lib/cobalt/thread.c index 908516f..62ca0a0 100644 --- a/lib/cobalt/thread.c +++ b/lib/cobalt/thread.c @@ -650,6 +650,15 @@ int pthread_setschedparam_ex(pthread_t thread, return ret; } +COBALT_IMPL(int, pthread_setschedprio, (pthread_t thread, int prio)) +{ + struct sched_param_ex param_ex = { + .sched_priority = prio, + }; + + return pthread_setschedparam_ex(thread, __SCHED_CURRENT, ¶m_ex); +} + /** * Get the scheduling policy and parameters of the specified thread. * diff --git a/lib/cobalt/wrappers.c b/lib/cobalt/wrappers.c index 8bd9190..8dd28fb 100644 --- a/lib/cobalt/wrappers.c +++ b/lib/cobalt/wrappers.c @@ -60,6 +60,12 @@ int __real_pthread_getschedparam(pthread_t thread, } __weak +int __real_pthread_setschedprio(pthread_t thread, int prio) +{ + return pthread_setschedprio(thread, prio); +} + +__weak int __real_sched_yield(void) { return sched_yield(); ___ Xenomai-git mailing list Xenomai-git@xenomai.org https://xenomai.org/mailman/listinfo/xenomai-git
[Xenomai-git] Jan Kiszka : lib/cobalt: Wrap pthread_setschedprio for proper real-time support
Module: xenomai-3 Branch: next Commit: f707121ae13bd84aa61dc4b7309e246e6b8c219d URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=f707121ae13bd84aa61dc4b7309e246e6b8c219d Author: Jan Kiszka Date: Tue Mar 8 14:46:59 2016 +0100 lib/cobalt: Wrap pthread_setschedprio for proper real-time support Implement pthread_setschedprio on top of pthread_setschedparam_ex with the help of the new __SCHED_CURRENT policy. This ensures that prio changes are directly applied to the real-time core, and that with just a single syscall. Signed-off-by: Jan Kiszka --- include/cobalt/pthread.h |2 ++ lib/cobalt/cobalt.wrappers |1 + lib/cobalt/thread.c|9 + lib/cobalt/wrappers.c |6 ++ 4 files changed, 18 insertions(+) diff --git a/include/cobalt/pthread.h b/include/cobalt/pthread.h index f1b1c8a..3e9bd47 100644 --- a/include/cobalt/pthread.h +++ b/include/cobalt/pthread.h @@ -53,6 +53,8 @@ COBALT_DECL(int, pthread_setschedparam(pthread_t thread, int policy, const struct sched_param *param)); +COBALT_DECL(int, pthread_setschedprio(pthread_t thread, int prio)); + COBALT_DECL(int, pthread_mutex_init(pthread_mutex_t *mutex, const pthread_mutexattr_t *attr)); diff --git a/lib/cobalt/cobalt.wrappers b/lib/cobalt/cobalt.wrappers index 4f883f3..f8bda39 100644 --- a/lib/cobalt/cobalt.wrappers +++ b/lib/cobalt/cobalt.wrappers @@ -2,6 +2,7 @@ --wrap pthread_create --wrap pthread_setschedparam --wrap pthread_getschedparam +--wrap pthread_setschedprio --wrap pthread_yield --wrap sched_yield --wrap sched_get_priority_min diff --git a/lib/cobalt/thread.c b/lib/cobalt/thread.c index 908516f..62ca0a0 100644 --- a/lib/cobalt/thread.c +++ b/lib/cobalt/thread.c @@ -650,6 +650,15 @@ int pthread_setschedparam_ex(pthread_t thread, return ret; } +COBALT_IMPL(int, pthread_setschedprio, (pthread_t thread, int prio)) +{ + struct sched_param_ex param_ex = { + .sched_priority = prio, + }; + + return pthread_setschedparam_ex(thread, __SCHED_CURRENT, ¶m_ex); +} + /** * Get the scheduling policy and parameters of the specified thread. * diff --git a/lib/cobalt/wrappers.c b/lib/cobalt/wrappers.c index bf1fdf4..51f470f 100644 --- a/lib/cobalt/wrappers.c +++ b/lib/cobalt/wrappers.c @@ -60,6 +60,12 @@ int __real_pthread_getschedparam(pthread_t thread, } __weak +int __real_pthread_setschedprio(pthread_t thread, int prio) +{ + return pthread_setschedprio(thread, prio); +} + +__weak int __real_sched_yield(void) { return sched_yield(); ___ Xenomai-git mailing list Xenomai-git@xenomai.org https://xenomai.org/mailman/listinfo/xenomai-git
[Xenomai-git] Jan Kiszka : lib/cobalt: Wrap pthread_setschedprio for proper real-time support
Module: xenomai-3 Branch: next Commit: 971a2d413fb6f42ea7d224e114f7e669fa80f465 URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=971a2d413fb6f42ea7d224e114f7e669fa80f465 Author: Jan Kiszka Date: Tue Mar 8 14:46:59 2016 +0100 lib/cobalt: Wrap pthread_setschedprio for proper real-time support Implement pthread_setschedprio on top of pthread_setschedparam_ex with the help of the new __SCHED_CURRENT policy. This ensures that prio changes are directly applied to the real-time core, and that with just a single syscall. Signed-off-by: Jan Kiszka --- include/cobalt/pthread.h |2 ++ lib/cobalt/cobalt.wrappers |1 + lib/cobalt/thread.c|9 + lib/cobalt/wrappers.c |6 ++ 4 files changed, 18 insertions(+) diff --git a/include/cobalt/pthread.h b/include/cobalt/pthread.h index f1b1c8a..3e9bd47 100644 --- a/include/cobalt/pthread.h +++ b/include/cobalt/pthread.h @@ -53,6 +53,8 @@ COBALT_DECL(int, pthread_setschedparam(pthread_t thread, int policy, const struct sched_param *param)); +COBALT_DECL(int, pthread_setschedprio(pthread_t thread, int prio)); + COBALT_DECL(int, pthread_mutex_init(pthread_mutex_t *mutex, const pthread_mutexattr_t *attr)); diff --git a/lib/cobalt/cobalt.wrappers b/lib/cobalt/cobalt.wrappers index 4f883f3..f8bda39 100644 --- a/lib/cobalt/cobalt.wrappers +++ b/lib/cobalt/cobalt.wrappers @@ -2,6 +2,7 @@ --wrap pthread_create --wrap pthread_setschedparam --wrap pthread_getschedparam +--wrap pthread_setschedprio --wrap pthread_yield --wrap sched_yield --wrap sched_get_priority_min diff --git a/lib/cobalt/thread.c b/lib/cobalt/thread.c index 908516f..62ca0a0 100644 --- a/lib/cobalt/thread.c +++ b/lib/cobalt/thread.c @@ -650,6 +650,15 @@ int pthread_setschedparam_ex(pthread_t thread, return ret; } +COBALT_IMPL(int, pthread_setschedprio, (pthread_t thread, int prio)) +{ + struct sched_param_ex param_ex = { + .sched_priority = prio, + }; + + return pthread_setschedparam_ex(thread, __SCHED_CURRENT, ¶m_ex); +} + /** * Get the scheduling policy and parameters of the specified thread. * diff --git a/lib/cobalt/wrappers.c b/lib/cobalt/wrappers.c index bf1fdf4..51f470f 100644 --- a/lib/cobalt/wrappers.c +++ b/lib/cobalt/wrappers.c @@ -60,6 +60,12 @@ int __real_pthread_getschedparam(pthread_t thread, } __weak +int __real_pthread_setschedprio(pthread_t thread, int prio) +{ + return pthread_setschedprio(thread, prio); +} + +__weak int __real_sched_yield(void) { return sched_yield(); ___ Xenomai-git mailing list Xenomai-git@xenomai.org https://xenomai.org/mailman/listinfo/xenomai-git
[Xenomai-git] Jan Kiszka : lib/cobalt: Wrap pthread_setschedprio for proper real-time support
Module: xenomai-3 Branch: next Commit: 2b8fef05f61fd11463257412746c6b2673525a6d URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=2b8fef05f61fd11463257412746c6b2673525a6d Author: Jan Kiszka Date: Tue Mar 8 14:46:59 2016 +0100 lib/cobalt: Wrap pthread_setschedprio for proper real-time support Implement pthread_setschedprio on top of pthread_setschedparam_ex with the help of the new __SCHED_CURRENT policy. This ensures that prio changes are directly applied to the real-time core, and that with just a single syscall. Signed-off-by: Jan Kiszka --- include/cobalt/pthread.h |2 ++ lib/cobalt/cobalt.wrappers |1 + lib/cobalt/thread.c|9 + lib/cobalt/wrappers.c |6 ++ 4 files changed, 18 insertions(+) diff --git a/include/cobalt/pthread.h b/include/cobalt/pthread.h index f1b1c8a..3e9bd47 100644 --- a/include/cobalt/pthread.h +++ b/include/cobalt/pthread.h @@ -53,6 +53,8 @@ COBALT_DECL(int, pthread_setschedparam(pthread_t thread, int policy, const struct sched_param *param)); +COBALT_DECL(int, pthread_setschedprio(pthread_t thread, int prio)); + COBALT_DECL(int, pthread_mutex_init(pthread_mutex_t *mutex, const pthread_mutexattr_t *attr)); diff --git a/lib/cobalt/cobalt.wrappers b/lib/cobalt/cobalt.wrappers index 4f883f3..f8bda39 100644 --- a/lib/cobalt/cobalt.wrappers +++ b/lib/cobalt/cobalt.wrappers @@ -2,6 +2,7 @@ --wrap pthread_create --wrap pthread_setschedparam --wrap pthread_getschedparam +--wrap pthread_setschedprio --wrap pthread_yield --wrap sched_yield --wrap sched_get_priority_min diff --git a/lib/cobalt/thread.c b/lib/cobalt/thread.c index 908516f..62ca0a0 100644 --- a/lib/cobalt/thread.c +++ b/lib/cobalt/thread.c @@ -650,6 +650,15 @@ int pthread_setschedparam_ex(pthread_t thread, return ret; } +COBALT_IMPL(int, pthread_setschedprio, (pthread_t thread, int prio)) +{ + struct sched_param_ex param_ex = { + .sched_priority = prio, + }; + + return pthread_setschedparam_ex(thread, __SCHED_CURRENT, ¶m_ex); +} + /** * Get the scheduling policy and parameters of the specified thread. * diff --git a/lib/cobalt/wrappers.c b/lib/cobalt/wrappers.c index 09c74e5..1f1664e 100644 --- a/lib/cobalt/wrappers.c +++ b/lib/cobalt/wrappers.c @@ -60,6 +60,12 @@ int __real_pthread_getschedparam(pthread_t thread, } __weak +int __real_pthread_setschedprio(pthread_t thread, int prio) +{ + return pthread_setschedprio(thread, prio); +} + +__weak int __real_sched_yield(void) { return sched_yield(); ___ Xenomai-git mailing list Xenomai-git@xenomai.org https://xenomai.org/mailman/listinfo/xenomai-git
[Xenomai-git] Jan Kiszka : lib/cobalt: Wrap pthread_setschedprio for proper real-time support
Module: xenomai-3 Branch: next Commit: 03e71ef3ea82c6dfe4d936b5625b3171f8a07de1 URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=03e71ef3ea82c6dfe4d936b5625b3171f8a07de1 Author: Jan Kiszka Date: Tue Mar 8 14:46:59 2016 +0100 lib/cobalt: Wrap pthread_setschedprio for proper real-time support Implement pthread_setschedprio on top of pthread_setschedparam_ex with the help of the new __SCHED_CURRENT policy. This ensures that prio changes are directly applied to the real-time core, and that with just a single syscall. Signed-off-by: Jan Kiszka --- include/cobalt/pthread.h |2 ++ lib/cobalt/cobalt.wrappers |1 + lib/cobalt/thread.c|9 + lib/cobalt/wrappers.c |6 ++ 4 files changed, 18 insertions(+) diff --git a/include/cobalt/pthread.h b/include/cobalt/pthread.h index f1b1c8a..3e9bd47 100644 --- a/include/cobalt/pthread.h +++ b/include/cobalt/pthread.h @@ -53,6 +53,8 @@ COBALT_DECL(int, pthread_setschedparam(pthread_t thread, int policy, const struct sched_param *param)); +COBALT_DECL(int, pthread_setschedprio(pthread_t thread, int prio)); + COBALT_DECL(int, pthread_mutex_init(pthread_mutex_t *mutex, const pthread_mutexattr_t *attr)); diff --git a/lib/cobalt/cobalt.wrappers b/lib/cobalt/cobalt.wrappers index 4f883f3..f8bda39 100644 --- a/lib/cobalt/cobalt.wrappers +++ b/lib/cobalt/cobalt.wrappers @@ -2,6 +2,7 @@ --wrap pthread_create --wrap pthread_setschedparam --wrap pthread_getschedparam +--wrap pthread_setschedprio --wrap pthread_yield --wrap sched_yield --wrap sched_get_priority_min diff --git a/lib/cobalt/thread.c b/lib/cobalt/thread.c index 908516f..62ca0a0 100644 --- a/lib/cobalt/thread.c +++ b/lib/cobalt/thread.c @@ -650,6 +650,15 @@ int pthread_setschedparam_ex(pthread_t thread, return ret; } +COBALT_IMPL(int, pthread_setschedprio, (pthread_t thread, int prio)) +{ + struct sched_param_ex param_ex = { + .sched_priority = prio, + }; + + return pthread_setschedparam_ex(thread, __SCHED_CURRENT, ¶m_ex); +} + /** * Get the scheduling policy and parameters of the specified thread. * diff --git a/lib/cobalt/wrappers.c b/lib/cobalt/wrappers.c index 65dc3bd..fc9d790 100644 --- a/lib/cobalt/wrappers.c +++ b/lib/cobalt/wrappers.c @@ -61,6 +61,12 @@ int __real_pthread_getschedparam(pthread_t thread, } __weak +int __real_pthread_setschedprio(pthread_t thread, int prio) +{ + return pthread_setschedprio(thread, prio); +} + +__weak int __real_sched_yield(void) { return sched_yield(); ___ Xenomai-git mailing list Xenomai-git@xenomai.org https://xenomai.org/mailman/listinfo/xenomai-git
[Xenomai-git] Jan Kiszka : lib/cobalt: Wrap pthread_setschedprio for proper real-time support
Module: xenomai-3 Branch: next Commit: 63fd227d50cfa967f68deaf0d885cf13b2829229 URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=63fd227d50cfa967f68deaf0d885cf13b2829229 Author: Jan Kiszka Date: Tue Mar 8 14:46:59 2016 +0100 lib/cobalt: Wrap pthread_setschedprio for proper real-time support Implement pthread_setschedprio on top of pthread_setschedparam_ex with the help of the new __SCHED_CURRENT policy. This ensures that prio changes are directly applied to the real-time core, and that with just a single syscall. Signed-off-by: Jan Kiszka --- include/cobalt/pthread.h |2 ++ lib/cobalt/cobalt.wrappers |1 + lib/cobalt/thread.c|9 + lib/cobalt/wrappers.c |6 ++ 4 files changed, 18 insertions(+) diff --git a/include/cobalt/pthread.h b/include/cobalt/pthread.h index f1b1c8a..3e9bd47 100644 --- a/include/cobalt/pthread.h +++ b/include/cobalt/pthread.h @@ -53,6 +53,8 @@ COBALT_DECL(int, pthread_setschedparam(pthread_t thread, int policy, const struct sched_param *param)); +COBALT_DECL(int, pthread_setschedprio(pthread_t thread, int prio)); + COBALT_DECL(int, pthread_mutex_init(pthread_mutex_t *mutex, const pthread_mutexattr_t *attr)); diff --git a/lib/cobalt/cobalt.wrappers b/lib/cobalt/cobalt.wrappers index 4f883f3..f8bda39 100644 --- a/lib/cobalt/cobalt.wrappers +++ b/lib/cobalt/cobalt.wrappers @@ -2,6 +2,7 @@ --wrap pthread_create --wrap pthread_setschedparam --wrap pthread_getschedparam +--wrap pthread_setschedprio --wrap pthread_yield --wrap sched_yield --wrap sched_get_priority_min diff --git a/lib/cobalt/thread.c b/lib/cobalt/thread.c index 908516f..62ca0a0 100644 --- a/lib/cobalt/thread.c +++ b/lib/cobalt/thread.c @@ -650,6 +650,15 @@ int pthread_setschedparam_ex(pthread_t thread, return ret; } +COBALT_IMPL(int, pthread_setschedprio, (pthread_t thread, int prio)) +{ + struct sched_param_ex param_ex = { + .sched_priority = prio, + }; + + return pthread_setschedparam_ex(thread, __SCHED_CURRENT, ¶m_ex); +} + /** * Get the scheduling policy and parameters of the specified thread. * diff --git a/lib/cobalt/wrappers.c b/lib/cobalt/wrappers.c index 65dc3bd..fc9d790 100644 --- a/lib/cobalt/wrappers.c +++ b/lib/cobalt/wrappers.c @@ -61,6 +61,12 @@ int __real_pthread_getschedparam(pthread_t thread, } __weak +int __real_pthread_setschedprio(pthread_t thread, int prio) +{ + return pthread_setschedprio(thread, prio); +} + +__weak int __real_sched_yield(void) { return sched_yield(); ___ Xenomai-git mailing list Xenomai-git@xenomai.org https://xenomai.org/mailman/listinfo/xenomai-git
[Xenomai-git] Jan Kiszka : lib/cobalt: Wrap pthread_setschedprio for proper real-time support
Module: xenomai-3 Branch: next Commit: 57059034e9e86131ab42c8b02628b4ac03a7bfae URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=57059034e9e86131ab42c8b02628b4ac03a7bfae Author: Jan Kiszka Date: Tue Mar 8 14:46:59 2016 +0100 lib/cobalt: Wrap pthread_setschedprio for proper real-time support Implement pthread_setschedprio on top of pthread_setschedparam_ex with the help of the new __SCHED_CURRENT policy. This ensures that prio changes are directly applied to the real-time core, and that with just a single syscall. Signed-off-by: Jan Kiszka --- include/cobalt/pthread.h |2 ++ lib/cobalt/cobalt.wrappers |1 + lib/cobalt/thread.c|9 + lib/cobalt/wrappers.c |6 ++ 4 files changed, 18 insertions(+) diff --git a/include/cobalt/pthread.h b/include/cobalt/pthread.h index f1b1c8a..3e9bd47 100644 --- a/include/cobalt/pthread.h +++ b/include/cobalt/pthread.h @@ -53,6 +53,8 @@ COBALT_DECL(int, pthread_setschedparam(pthread_t thread, int policy, const struct sched_param *param)); +COBALT_DECL(int, pthread_setschedprio(pthread_t thread, int prio)); + COBALT_DECL(int, pthread_mutex_init(pthread_mutex_t *mutex, const pthread_mutexattr_t *attr)); diff --git a/lib/cobalt/cobalt.wrappers b/lib/cobalt/cobalt.wrappers index 75f29d6..19153ae 100644 --- a/lib/cobalt/cobalt.wrappers +++ b/lib/cobalt/cobalt.wrappers @@ -2,6 +2,7 @@ --wrap pthread_create --wrap pthread_setschedparam --wrap pthread_getschedparam +--wrap pthread_setschedprio --wrap pthread_yield --wrap sched_yield --wrap sched_get_priority_min diff --git a/lib/cobalt/thread.c b/lib/cobalt/thread.c index 908516f..62ca0a0 100644 --- a/lib/cobalt/thread.c +++ b/lib/cobalt/thread.c @@ -650,6 +650,15 @@ int pthread_setschedparam_ex(pthread_t thread, return ret; } +COBALT_IMPL(int, pthread_setschedprio, (pthread_t thread, int prio)) +{ + struct sched_param_ex param_ex = { + .sched_priority = prio, + }; + + return pthread_setschedparam_ex(thread, __SCHED_CURRENT, ¶m_ex); +} + /** * Get the scheduling policy and parameters of the specified thread. * diff --git a/lib/cobalt/wrappers.c b/lib/cobalt/wrappers.c index 09c74e5..1f1664e 100644 --- a/lib/cobalt/wrappers.c +++ b/lib/cobalt/wrappers.c @@ -60,6 +60,12 @@ int __real_pthread_getschedparam(pthread_t thread, } __weak +int __real_pthread_setschedprio(pthread_t thread, int prio) +{ + return pthread_setschedprio(thread, prio); +} + +__weak int __real_sched_yield(void) { return sched_yield(); ___ Xenomai-git mailing list Xenomai-git@xenomai.org https://xenomai.org/mailman/listinfo/xenomai-git
[Xenomai-git] Jan Kiszka : lib/cobalt: Wrap pthread_setschedprio for proper real-time support
Module: xenomai-3 Branch: next Commit: 0d80c668e113a3dc23e28fd1816c6893059f77f6 URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=0d80c668e113a3dc23e28fd1816c6893059f77f6 Author: Jan Kiszka Date: Tue Mar 8 14:46:59 2016 +0100 lib/cobalt: Wrap pthread_setschedprio for proper real-time support Implement pthread_setschedprio on top of pthread_setschedparam_ex with the help of the new __SCHED_CURRENT policy. This ensures that prio changes are directly applied to the real-time core, and that with just a single syscall. Signed-off-by: Jan Kiszka --- include/cobalt/pthread.h |2 ++ lib/cobalt/cobalt.wrappers |1 + lib/cobalt/thread.c|9 + lib/cobalt/wrappers.c |6 ++ 4 files changed, 18 insertions(+) diff --git a/include/cobalt/pthread.h b/include/cobalt/pthread.h index f1b1c8a..3e9bd47 100644 --- a/include/cobalt/pthread.h +++ b/include/cobalt/pthread.h @@ -53,6 +53,8 @@ COBALT_DECL(int, pthread_setschedparam(pthread_t thread, int policy, const struct sched_param *param)); +COBALT_DECL(int, pthread_setschedprio(pthread_t thread, int prio)); + COBALT_DECL(int, pthread_mutex_init(pthread_mutex_t *mutex, const pthread_mutexattr_t *attr)); diff --git a/lib/cobalt/cobalt.wrappers b/lib/cobalt/cobalt.wrappers index 75f29d6..19153ae 100644 --- a/lib/cobalt/cobalt.wrappers +++ b/lib/cobalt/cobalt.wrappers @@ -2,6 +2,7 @@ --wrap pthread_create --wrap pthread_setschedparam --wrap pthread_getschedparam +--wrap pthread_setschedprio --wrap pthread_yield --wrap sched_yield --wrap sched_get_priority_min diff --git a/lib/cobalt/thread.c b/lib/cobalt/thread.c index 908516f..62ca0a0 100644 --- a/lib/cobalt/thread.c +++ b/lib/cobalt/thread.c @@ -650,6 +650,15 @@ int pthread_setschedparam_ex(pthread_t thread, return ret; } +COBALT_IMPL(int, pthread_setschedprio, (pthread_t thread, int prio)) +{ + struct sched_param_ex param_ex = { + .sched_priority = prio, + }; + + return pthread_setschedparam_ex(thread, __SCHED_CURRENT, ¶m_ex); +} + /** * Get the scheduling policy and parameters of the specified thread. * diff --git a/lib/cobalt/wrappers.c b/lib/cobalt/wrappers.c index 09c74e5..1f1664e 100644 --- a/lib/cobalt/wrappers.c +++ b/lib/cobalt/wrappers.c @@ -60,6 +60,12 @@ int __real_pthread_getschedparam(pthread_t thread, } __weak +int __real_pthread_setschedprio(pthread_t thread, int prio) +{ + return pthread_setschedprio(thread, prio); +} + +__weak int __real_sched_yield(void) { return sched_yield(); ___ Xenomai-git mailing list Xenomai-git@xenomai.org https://xenomai.org/mailman/listinfo/xenomai-git
[Xenomai-git] Jan Kiszka : lib/cobalt: Wrap pthread_setschedprio for proper real-time support
Module: xenomai-3 Branch: next Commit: 1820ff5fa82dd0a823e0192fce778ee21e27f322 URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=1820ff5fa82dd0a823e0192fce778ee21e27f322 Author: Jan Kiszka Date: Tue Mar 8 14:46:59 2016 +0100 lib/cobalt: Wrap pthread_setschedprio for proper real-time support Implement pthread_setschedprio on top of pthread_setschedparam_ex with the help of the new __SCHED_CURRENT policy. This ensures that prio changes are directly applied to the real-time core, and that with just a single syscall. Signed-off-by: Jan Kiszka --- include/cobalt/pthread.h |2 ++ lib/cobalt/cobalt.wrappers |1 + lib/cobalt/thread.c|9 + lib/cobalt/wrappers.c |6 ++ 4 files changed, 18 insertions(+) diff --git a/include/cobalt/pthread.h b/include/cobalt/pthread.h index f1b1c8a..3e9bd47 100644 --- a/include/cobalt/pthread.h +++ b/include/cobalt/pthread.h @@ -53,6 +53,8 @@ COBALT_DECL(int, pthread_setschedparam(pthread_t thread, int policy, const struct sched_param *param)); +COBALT_DECL(int, pthread_setschedprio(pthread_t thread, int prio)); + COBALT_DECL(int, pthread_mutex_init(pthread_mutex_t *mutex, const pthread_mutexattr_t *attr)); diff --git a/lib/cobalt/cobalt.wrappers b/lib/cobalt/cobalt.wrappers index 75f29d6..19153ae 100644 --- a/lib/cobalt/cobalt.wrappers +++ b/lib/cobalt/cobalt.wrappers @@ -2,6 +2,7 @@ --wrap pthread_create --wrap pthread_setschedparam --wrap pthread_getschedparam +--wrap pthread_setschedprio --wrap pthread_yield --wrap sched_yield --wrap sched_get_priority_min diff --git a/lib/cobalt/thread.c b/lib/cobalt/thread.c index 908516f..62ca0a0 100644 --- a/lib/cobalt/thread.c +++ b/lib/cobalt/thread.c @@ -650,6 +650,15 @@ int pthread_setschedparam_ex(pthread_t thread, return ret; } +COBALT_IMPL(int, pthread_setschedprio, (pthread_t thread, int prio)) +{ + struct sched_param_ex param_ex = { + .sched_priority = prio, + }; + + return pthread_setschedparam_ex(thread, __SCHED_CURRENT, ¶m_ex); +} + /** * Get the scheduling policy and parameters of the specified thread. * diff --git a/lib/cobalt/wrappers.c b/lib/cobalt/wrappers.c index 09c74e5..1f1664e 100644 --- a/lib/cobalt/wrappers.c +++ b/lib/cobalt/wrappers.c @@ -60,6 +60,12 @@ int __real_pthread_getschedparam(pthread_t thread, } __weak +int __real_pthread_setschedprio(pthread_t thread, int prio) +{ + return pthread_setschedprio(thread, prio); +} + +__weak int __real_sched_yield(void) { return sched_yield(); ___ Xenomai-git mailing list Xenomai-git@xenomai.org https://xenomai.org/mailman/listinfo/xenomai-git
[Xenomai-git] Jan Kiszka : lib/cobalt: Wrap pthread_setschedprio for proper real-time support
Module: xenomai-3 Branch: next Commit: b2a7a51667ee98d968b42962c08c0a354c8b4c4c URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=b2a7a51667ee98d968b42962c08c0a354c8b4c4c Author: Jan Kiszka Date: Tue Mar 8 14:46:59 2016 +0100 lib/cobalt: Wrap pthread_setschedprio for proper real-time support Implement pthread_setschedprio on top of pthread_setschedparam_ex with the help of the new __SCHED_CURRENT policy. This ensures that prio changes are directly applied to the real-time core, and that with just a single syscall. Signed-off-by: Jan Kiszka --- include/cobalt/pthread.h |2 ++ lib/cobalt/cobalt.wrappers |1 + lib/cobalt/thread.c|9 + lib/cobalt/wrappers.c |6 ++ 4 files changed, 18 insertions(+) diff --git a/include/cobalt/pthread.h b/include/cobalt/pthread.h index f1b1c8a..3e9bd47 100644 --- a/include/cobalt/pthread.h +++ b/include/cobalt/pthread.h @@ -53,6 +53,8 @@ COBALT_DECL(int, pthread_setschedparam(pthread_t thread, int policy, const struct sched_param *param)); +COBALT_DECL(int, pthread_setschedprio(pthread_t thread, int prio)); + COBALT_DECL(int, pthread_mutex_init(pthread_mutex_t *mutex, const pthread_mutexattr_t *attr)); diff --git a/lib/cobalt/cobalt.wrappers b/lib/cobalt/cobalt.wrappers index 75f29d6..19153ae 100644 --- a/lib/cobalt/cobalt.wrappers +++ b/lib/cobalt/cobalt.wrappers @@ -2,6 +2,7 @@ --wrap pthread_create --wrap pthread_setschedparam --wrap pthread_getschedparam +--wrap pthread_setschedprio --wrap pthread_yield --wrap sched_yield --wrap sched_get_priority_min diff --git a/lib/cobalt/thread.c b/lib/cobalt/thread.c index 908516f..62ca0a0 100644 --- a/lib/cobalt/thread.c +++ b/lib/cobalt/thread.c @@ -650,6 +650,15 @@ int pthread_setschedparam_ex(pthread_t thread, return ret; } +COBALT_IMPL(int, pthread_setschedprio, (pthread_t thread, int prio)) +{ + struct sched_param_ex param_ex = { + .sched_priority = prio, + }; + + return pthread_setschedparam_ex(thread, __SCHED_CURRENT, ¶m_ex); +} + /** * Get the scheduling policy and parameters of the specified thread. * diff --git a/lib/cobalt/wrappers.c b/lib/cobalt/wrappers.c index 09c74e5..1f1664e 100644 --- a/lib/cobalt/wrappers.c +++ b/lib/cobalt/wrappers.c @@ -60,6 +60,12 @@ int __real_pthread_getschedparam(pthread_t thread, } __weak +int __real_pthread_setschedprio(pthread_t thread, int prio) +{ + return pthread_setschedprio(thread, prio); +} + +__weak int __real_sched_yield(void) { return sched_yield(); ___ Xenomai-git mailing list Xenomai-git@xenomai.org https://xenomai.org/mailman/listinfo/xenomai-git
[Xenomai-git] Jan Kiszka : lib/cobalt: Wrap pthread_setschedprio for proper real-time support
Module: xenomai-3 Branch: next Commit: 2041cb0ece325e0209fe906d867015fc922f957a URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=2041cb0ece325e0209fe906d867015fc922f957a Author: Jan Kiszka Date: Tue Mar 8 14:46:59 2016 +0100 lib/cobalt: Wrap pthread_setschedprio for proper real-time support Implement pthread_setschedprio on top of pthread_setschedparam_ex with the help of the new __SCHED_CURRENT policy. This ensures that prio changes are directly applied to the real-time core, and that with just a single syscall. Signed-off-by: Jan Kiszka --- include/cobalt/pthread.h |2 ++ lib/cobalt/cobalt.wrappers |1 + lib/cobalt/thread.c|9 + lib/cobalt/wrappers.c |6 ++ 4 files changed, 18 insertions(+) diff --git a/include/cobalt/pthread.h b/include/cobalt/pthread.h index f1b1c8a..3e9bd47 100644 --- a/include/cobalt/pthread.h +++ b/include/cobalt/pthread.h @@ -53,6 +53,8 @@ COBALT_DECL(int, pthread_setschedparam(pthread_t thread, int policy, const struct sched_param *param)); +COBALT_DECL(int, pthread_setschedprio(pthread_t thread, int prio)); + COBALT_DECL(int, pthread_mutex_init(pthread_mutex_t *mutex, const pthread_mutexattr_t *attr)); diff --git a/lib/cobalt/cobalt.wrappers b/lib/cobalt/cobalt.wrappers index 75f29d6..19153ae 100644 --- a/lib/cobalt/cobalt.wrappers +++ b/lib/cobalt/cobalt.wrappers @@ -2,6 +2,7 @@ --wrap pthread_create --wrap pthread_setschedparam --wrap pthread_getschedparam +--wrap pthread_setschedprio --wrap pthread_yield --wrap sched_yield --wrap sched_get_priority_min diff --git a/lib/cobalt/thread.c b/lib/cobalt/thread.c index 908516f..62ca0a0 100644 --- a/lib/cobalt/thread.c +++ b/lib/cobalt/thread.c @@ -650,6 +650,15 @@ int pthread_setschedparam_ex(pthread_t thread, return ret; } +COBALT_IMPL(int, pthread_setschedprio, (pthread_t thread, int prio)) +{ + struct sched_param_ex param_ex = { + .sched_priority = prio, + }; + + return pthread_setschedparam_ex(thread, __SCHED_CURRENT, ¶m_ex); +} + /** * Get the scheduling policy and parameters of the specified thread. * diff --git a/lib/cobalt/wrappers.c b/lib/cobalt/wrappers.c index 09c74e5..1f1664e 100644 --- a/lib/cobalt/wrappers.c +++ b/lib/cobalt/wrappers.c @@ -60,6 +60,12 @@ int __real_pthread_getschedparam(pthread_t thread, } __weak +int __real_pthread_setschedprio(pthread_t thread, int prio) +{ + return pthread_setschedprio(thread, prio); +} + +__weak int __real_sched_yield(void) { return sched_yield(); ___ Xenomai-git mailing list Xenomai-git@xenomai.org https://xenomai.org/mailman/listinfo/xenomai-git
[Xenomai-git] Jan Kiszka : lib/cobalt: Wrap pthread_setschedprio for proper real-time support
Module: xenomai-3 Branch: next Commit: 5c53137eecf791920618d0401e2ffbb6c130c7cf URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=5c53137eecf791920618d0401e2ffbb6c130c7cf Author: Jan Kiszka Date: Tue Mar 8 14:46:59 2016 +0100 lib/cobalt: Wrap pthread_setschedprio for proper real-time support Implement pthread_setschedprio on top of pthread_setschedparam_ex with the help of the new __SCHED_CURRENT policy. This ensures that prio changes are directly applied to the real-time core, and that with just a single syscall. Signed-off-by: Jan Kiszka --- include/cobalt/pthread.h |2 ++ lib/cobalt/cobalt.wrappers |1 + lib/cobalt/thread.c|9 + lib/cobalt/wrappers.c |6 ++ 4 files changed, 18 insertions(+) diff --git a/include/cobalt/pthread.h b/include/cobalt/pthread.h index f1b1c8a..3e9bd47 100644 --- a/include/cobalt/pthread.h +++ b/include/cobalt/pthread.h @@ -53,6 +53,8 @@ COBALT_DECL(int, pthread_setschedparam(pthread_t thread, int policy, const struct sched_param *param)); +COBALT_DECL(int, pthread_setschedprio(pthread_t thread, int prio)); + COBALT_DECL(int, pthread_mutex_init(pthread_mutex_t *mutex, const pthread_mutexattr_t *attr)); diff --git a/lib/cobalt/cobalt.wrappers b/lib/cobalt/cobalt.wrappers index 75f29d6..19153ae 100644 --- a/lib/cobalt/cobalt.wrappers +++ b/lib/cobalt/cobalt.wrappers @@ -2,6 +2,7 @@ --wrap pthread_create --wrap pthread_setschedparam --wrap pthread_getschedparam +--wrap pthread_setschedprio --wrap pthread_yield --wrap sched_yield --wrap sched_get_priority_min diff --git a/lib/cobalt/thread.c b/lib/cobalt/thread.c index 908516f..62ca0a0 100644 --- a/lib/cobalt/thread.c +++ b/lib/cobalt/thread.c @@ -650,6 +650,15 @@ int pthread_setschedparam_ex(pthread_t thread, return ret; } +COBALT_IMPL(int, pthread_setschedprio, (pthread_t thread, int prio)) +{ + struct sched_param_ex param_ex = { + .sched_priority = prio, + }; + + return pthread_setschedparam_ex(thread, __SCHED_CURRENT, ¶m_ex); +} + /** * Get the scheduling policy and parameters of the specified thread. * diff --git a/lib/cobalt/wrappers.c b/lib/cobalt/wrappers.c index 09c74e5..1f1664e 100644 --- a/lib/cobalt/wrappers.c +++ b/lib/cobalt/wrappers.c @@ -60,6 +60,12 @@ int __real_pthread_getschedparam(pthread_t thread, } __weak +int __real_pthread_setschedprio(pthread_t thread, int prio) +{ + return pthread_setschedprio(thread, prio); +} + +__weak int __real_sched_yield(void) { return sched_yield(); ___ Xenomai-git mailing list Xenomai-git@xenomai.org https://xenomai.org/mailman/listinfo/xenomai-git
[Xenomai-git] Jan Kiszka : lib/cobalt: Wrap pthread_setschedprio for proper real-time support
Module: xenomai-3 Branch: wip/dovetail Commit: f96f0548cce9b54eac5f60cab543c9598f4f2386 URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=f96f0548cce9b54eac5f60cab543c9598f4f2386 Author: Jan Kiszka Date: Tue Mar 8 14:46:59 2016 +0100 lib/cobalt: Wrap pthread_setschedprio for proper real-time support Implement pthread_setschedprio on top of pthread_setschedparam_ex with the help of the new __SCHED_CURRENT policy. This ensures that prio changes are directly applied to the real-time core, and that with just a single syscall. Signed-off-by: Jan Kiszka --- include/cobalt/pthread.h |2 ++ lib/cobalt/cobalt.wrappers |1 + lib/cobalt/thread.c|9 + lib/cobalt/wrappers.c |6 ++ 4 files changed, 18 insertions(+) diff --git a/include/cobalt/pthread.h b/include/cobalt/pthread.h index f1b1c8a..3e9bd47 100644 --- a/include/cobalt/pthread.h +++ b/include/cobalt/pthread.h @@ -53,6 +53,8 @@ COBALT_DECL(int, pthread_setschedparam(pthread_t thread, int policy, const struct sched_param *param)); +COBALT_DECL(int, pthread_setschedprio(pthread_t thread, int prio)); + COBALT_DECL(int, pthread_mutex_init(pthread_mutex_t *mutex, const pthread_mutexattr_t *attr)); diff --git a/lib/cobalt/cobalt.wrappers b/lib/cobalt/cobalt.wrappers index 75f29d6..19153ae 100644 --- a/lib/cobalt/cobalt.wrappers +++ b/lib/cobalt/cobalt.wrappers @@ -2,6 +2,7 @@ --wrap pthread_create --wrap pthread_setschedparam --wrap pthread_getschedparam +--wrap pthread_setschedprio --wrap pthread_yield --wrap sched_yield --wrap sched_get_priority_min diff --git a/lib/cobalt/thread.c b/lib/cobalt/thread.c index 908516f..62ca0a0 100644 --- a/lib/cobalt/thread.c +++ b/lib/cobalt/thread.c @@ -650,6 +650,15 @@ int pthread_setschedparam_ex(pthread_t thread, return ret; } +COBALT_IMPL(int, pthread_setschedprio, (pthread_t thread, int prio)) +{ + struct sched_param_ex param_ex = { + .sched_priority = prio, + }; + + return pthread_setschedparam_ex(thread, __SCHED_CURRENT, ¶m_ex); +} + /** * Get the scheduling policy and parameters of the specified thread. * diff --git a/lib/cobalt/wrappers.c b/lib/cobalt/wrappers.c index 09c74e5..1f1664e 100644 --- a/lib/cobalt/wrappers.c +++ b/lib/cobalt/wrappers.c @@ -60,6 +60,12 @@ int __real_pthread_getschedparam(pthread_t thread, } __weak +int __real_pthread_setschedprio(pthread_t thread, int prio) +{ + return pthread_setschedprio(thread, prio); +} + +__weak int __real_sched_yield(void) { return sched_yield(); ___ Xenomai-git mailing list Xenomai-git@xenomai.org https://xenomai.org/mailman/listinfo/xenomai-git
[Xenomai-git] Jan Kiszka : lib/cobalt: Wrap pthread_setschedprio for proper real-time support
Module: xenomai-3 Branch: next Commit: f96f0548cce9b54eac5f60cab543c9598f4f2386 URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=f96f0548cce9b54eac5f60cab543c9598f4f2386 Author: Jan Kiszka Date: Tue Mar 8 14:46:59 2016 +0100 lib/cobalt: Wrap pthread_setschedprio for proper real-time support Implement pthread_setschedprio on top of pthread_setschedparam_ex with the help of the new __SCHED_CURRENT policy. This ensures that prio changes are directly applied to the real-time core, and that with just a single syscall. Signed-off-by: Jan Kiszka --- include/cobalt/pthread.h |2 ++ lib/cobalt/cobalt.wrappers |1 + lib/cobalt/thread.c|9 + lib/cobalt/wrappers.c |6 ++ 4 files changed, 18 insertions(+) diff --git a/include/cobalt/pthread.h b/include/cobalt/pthread.h index f1b1c8a..3e9bd47 100644 --- a/include/cobalt/pthread.h +++ b/include/cobalt/pthread.h @@ -53,6 +53,8 @@ COBALT_DECL(int, pthread_setschedparam(pthread_t thread, int policy, const struct sched_param *param)); +COBALT_DECL(int, pthread_setschedprio(pthread_t thread, int prio)); + COBALT_DECL(int, pthread_mutex_init(pthread_mutex_t *mutex, const pthread_mutexattr_t *attr)); diff --git a/lib/cobalt/cobalt.wrappers b/lib/cobalt/cobalt.wrappers index 75f29d6..19153ae 100644 --- a/lib/cobalt/cobalt.wrappers +++ b/lib/cobalt/cobalt.wrappers @@ -2,6 +2,7 @@ --wrap pthread_create --wrap pthread_setschedparam --wrap pthread_getschedparam +--wrap pthread_setschedprio --wrap pthread_yield --wrap sched_yield --wrap sched_get_priority_min diff --git a/lib/cobalt/thread.c b/lib/cobalt/thread.c index 908516f..62ca0a0 100644 --- a/lib/cobalt/thread.c +++ b/lib/cobalt/thread.c @@ -650,6 +650,15 @@ int pthread_setschedparam_ex(pthread_t thread, return ret; } +COBALT_IMPL(int, pthread_setschedprio, (pthread_t thread, int prio)) +{ + struct sched_param_ex param_ex = { + .sched_priority = prio, + }; + + return pthread_setschedparam_ex(thread, __SCHED_CURRENT, ¶m_ex); +} + /** * Get the scheduling policy and parameters of the specified thread. * diff --git a/lib/cobalt/wrappers.c b/lib/cobalt/wrappers.c index 09c74e5..1f1664e 100644 --- a/lib/cobalt/wrappers.c +++ b/lib/cobalt/wrappers.c @@ -60,6 +60,12 @@ int __real_pthread_getschedparam(pthread_t thread, } __weak +int __real_pthread_setschedprio(pthread_t thread, int prio) +{ + return pthread_setschedprio(thread, prio); +} + +__weak int __real_sched_yield(void) { return sched_yield(); ___ Xenomai-git mailing list Xenomai-git@xenomai.org https://xenomai.org/mailman/listinfo/xenomai-git
[Xenomai-git] Jan Kiszka : lib/cobalt: Wrap pthread_setschedprio for proper real-time support
Module: xenomai-jki Branch: for-forge Commit: 5d2eda526d74cff937241ab7e191485f62708355 URL: http://git.xenomai.org/?p=xenomai-jki.git;a=commit;h=5d2eda526d74cff937241ab7e191485f62708355 Author: Jan Kiszka Date: Tue Mar 8 14:46:59 2016 +0100 lib/cobalt: Wrap pthread_setschedprio for proper real-time support Implement pthread_setschedprio on top of pthread_setschedparam_ex with the help of the new __SCHED_CURRENT policy. This ensures that prio changes are directly applied to the real-time core, and that with just a single syscall. Signed-off-by: Jan Kiszka --- include/cobalt/pthread.h |2 ++ lib/cobalt/cobalt.wrappers |1 + lib/cobalt/thread.c|9 + lib/cobalt/wrappers.c |6 ++ 4 files changed, 18 insertions(+) diff --git a/include/cobalt/pthread.h b/include/cobalt/pthread.h index f1b1c8a..3e9bd47 100644 --- a/include/cobalt/pthread.h +++ b/include/cobalt/pthread.h @@ -53,6 +53,8 @@ COBALT_DECL(int, pthread_setschedparam(pthread_t thread, int policy, const struct sched_param *param)); +COBALT_DECL(int, pthread_setschedprio(pthread_t thread, int prio)); + COBALT_DECL(int, pthread_mutex_init(pthread_mutex_t *mutex, const pthread_mutexattr_t *attr)); diff --git a/lib/cobalt/cobalt.wrappers b/lib/cobalt/cobalt.wrappers index 75f29d6..19153ae 100644 --- a/lib/cobalt/cobalt.wrappers +++ b/lib/cobalt/cobalt.wrappers @@ -2,6 +2,7 @@ --wrap pthread_create --wrap pthread_setschedparam --wrap pthread_getschedparam +--wrap pthread_setschedprio --wrap pthread_yield --wrap sched_yield --wrap sched_get_priority_min diff --git a/lib/cobalt/thread.c b/lib/cobalt/thread.c index 908516f..62ca0a0 100644 --- a/lib/cobalt/thread.c +++ b/lib/cobalt/thread.c @@ -650,6 +650,15 @@ int pthread_setschedparam_ex(pthread_t thread, return ret; } +COBALT_IMPL(int, pthread_setschedprio, (pthread_t thread, int prio)) +{ + struct sched_param_ex param_ex = { + .sched_priority = prio, + }; + + return pthread_setschedparam_ex(thread, __SCHED_CURRENT, ¶m_ex); +} + /** * Get the scheduling policy and parameters of the specified thread. * diff --git a/lib/cobalt/wrappers.c b/lib/cobalt/wrappers.c index 09c74e5..1f1664e 100644 --- a/lib/cobalt/wrappers.c +++ b/lib/cobalt/wrappers.c @@ -60,6 +60,12 @@ int __real_pthread_getschedparam(pthread_t thread, } __weak +int __real_pthread_setschedprio(pthread_t thread, int prio) +{ + return pthread_setschedprio(thread, prio); +} + +__weak int __real_sched_yield(void) { return sched_yield(); ___ Xenomai-git mailing list Xenomai-git@xenomai.org https://xenomai.org/mailman/listinfo/xenomai-git
[Xenomai-git] Jan Kiszka : lib/cobalt: Wrap pthread_setschedprio for proper real-time support
Module: xenomai-jki Branch: for-forge Commit: aae48a645c6638b297e9d1739ae299ca6a9ae20f URL: http://git.xenomai.org/?p=xenomai-jki.git;a=commit;h=aae48a645c6638b297e9d1739ae299ca6a9ae20f Author: Jan Kiszka Date: Tue Mar 8 14:46:59 2016 +0100 lib/cobalt: Wrap pthread_setschedprio for proper real-time support Implement pthread_setschedprio on top of pthread_setschedparam_ex with the help of the new __SCHED_CURRENT policy. This ensures that prio changes are directly applied to the real-time core, and that with just a single syscall. Signed-off-by: Jan Kiszka --- include/cobalt/pthread.h |2 ++ lib/cobalt/cobalt.wrappers |1 + lib/cobalt/thread.c|9 + lib/cobalt/wrappers.c |6 ++ 4 files changed, 18 insertions(+) diff --git a/include/cobalt/pthread.h b/include/cobalt/pthread.h index f1b1c8a..3e9bd47 100644 --- a/include/cobalt/pthread.h +++ b/include/cobalt/pthread.h @@ -53,6 +53,8 @@ COBALT_DECL(int, pthread_setschedparam(pthread_t thread, int policy, const struct sched_param *param)); +COBALT_DECL(int, pthread_setschedprio(pthread_t thread, int prio)); + COBALT_DECL(int, pthread_mutex_init(pthread_mutex_t *mutex, const pthread_mutexattr_t *attr)); diff --git a/lib/cobalt/cobalt.wrappers b/lib/cobalt/cobalt.wrappers index 75f29d6..19153ae 100644 --- a/lib/cobalt/cobalt.wrappers +++ b/lib/cobalt/cobalt.wrappers @@ -2,6 +2,7 @@ --wrap pthread_create --wrap pthread_setschedparam --wrap pthread_getschedparam +--wrap pthread_setschedprio --wrap pthread_yield --wrap sched_yield --wrap sched_get_priority_min diff --git a/lib/cobalt/thread.c b/lib/cobalt/thread.c index 908516f..62ca0a0 100644 --- a/lib/cobalt/thread.c +++ b/lib/cobalt/thread.c @@ -650,6 +650,15 @@ int pthread_setschedparam_ex(pthread_t thread, return ret; } +COBALT_IMPL(int, pthread_setschedprio, (pthread_t thread, int prio)) +{ + struct sched_param_ex param_ex = { + .sched_priority = prio, + }; + + return pthread_setschedparam_ex(thread, __SCHED_CURRENT, ¶m_ex); +} + /** * Get the scheduling policy and parameters of the specified thread. * diff --git a/lib/cobalt/wrappers.c b/lib/cobalt/wrappers.c index 09c74e5..1f1664e 100644 --- a/lib/cobalt/wrappers.c +++ b/lib/cobalt/wrappers.c @@ -60,6 +60,12 @@ int __real_pthread_getschedparam(pthread_t thread, } __weak +int __real_pthread_setschedprio(pthread_t thread, int prio) +{ + return pthread_setschedprio(thread, prio); +} + +__weak int __real_sched_yield(void) { return sched_yield(); ___ Xenomai-git mailing list Xenomai-git@xenomai.org https://xenomai.org/mailman/listinfo/xenomai-git
[Xenomai-git] Jan Kiszka : lib/cobalt: Wrap pthread_setschedprio for proper real-time support
Module: xenomai-jki Branch: for-forge Commit: b839ae85aab927c54da45f32203c299858e23f24 URL: http://git.xenomai.org/?p=xenomai-jki.git;a=commit;h=b839ae85aab927c54da45f32203c299858e23f24 Author: Jan Kiszka Date: Tue Mar 8 14:46:59 2016 +0100 lib/cobalt: Wrap pthread_setschedprio for proper real-time support Implement pthread_setschedprio on top of pthread_setschedparam_ex with the help of the new __SCHED_CURRENT policy. This ensures that prio changes are directly applied to the real-time core, and that with just a single syscall. Signed-off-by: Jan Kiszka --- include/cobalt/pthread.h |2 ++ lib/cobalt/cobalt.wrappers |1 + lib/cobalt/thread.c|9 + lib/cobalt/wrappers.c |6 ++ 4 files changed, 18 insertions(+) diff --git a/include/cobalt/pthread.h b/include/cobalt/pthread.h index f1b1c8a..3e9bd47 100644 --- a/include/cobalt/pthread.h +++ b/include/cobalt/pthread.h @@ -53,6 +53,8 @@ COBALT_DECL(int, pthread_setschedparam(pthread_t thread, int policy, const struct sched_param *param)); +COBALT_DECL(int, pthread_setschedprio(pthread_t thread, int prio)); + COBALT_DECL(int, pthread_mutex_init(pthread_mutex_t *mutex, const pthread_mutexattr_t *attr)); diff --git a/lib/cobalt/cobalt.wrappers b/lib/cobalt/cobalt.wrappers index 75f29d6..19153ae 100644 --- a/lib/cobalt/cobalt.wrappers +++ b/lib/cobalt/cobalt.wrappers @@ -2,6 +2,7 @@ --wrap pthread_create --wrap pthread_setschedparam --wrap pthread_getschedparam +--wrap pthread_setschedprio --wrap pthread_yield --wrap sched_yield --wrap sched_get_priority_min diff --git a/lib/cobalt/thread.c b/lib/cobalt/thread.c index 908516f..62ca0a0 100644 --- a/lib/cobalt/thread.c +++ b/lib/cobalt/thread.c @@ -650,6 +650,15 @@ int pthread_setschedparam_ex(pthread_t thread, return ret; } +COBALT_IMPL(int, pthread_setschedprio, (pthread_t thread, int prio)) +{ + struct sched_param_ex param_ex = { + .sched_priority = prio, + }; + + return pthread_setschedparam_ex(thread, __SCHED_CURRENT, ¶m_ex); +} + /** * Get the scheduling policy and parameters of the specified thread. * diff --git a/lib/cobalt/wrappers.c b/lib/cobalt/wrappers.c index 09c74e5..1f1664e 100644 --- a/lib/cobalt/wrappers.c +++ b/lib/cobalt/wrappers.c @@ -60,6 +60,12 @@ int __real_pthread_getschedparam(pthread_t thread, } __weak +int __real_pthread_setschedprio(pthread_t thread, int prio) +{ + return pthread_setschedprio(thread, prio); +} + +__weak int __real_sched_yield(void) { return sched_yield(); ___ Xenomai-git mailing list Xenomai-git@xenomai.org https://xenomai.org/mailman/listinfo/xenomai-git
[Xenomai-git] Jan Kiszka : lib/cobalt: Wrap pthread_setschedprio for proper real-time support
Module: xenomai-jki Branch: for-forge Commit: cada7dad232bdb7cb78dcca9815abbd0f9b19a39 URL: http://git.xenomai.org/?p=xenomai-jki.git;a=commit;h=cada7dad232bdb7cb78dcca9815abbd0f9b19a39 Author: Jan Kiszka Date: Tue Mar 8 14:46:59 2016 +0100 lib/cobalt: Wrap pthread_setschedprio for proper real-time support Implement pthread_setschedprio on top of pthread_setschedparam_ex with the help of the new __SCHED_CURRENT policy. This ensures that prio changes are directly applied to the real-time core, and that with just a single syscall. Signed-off-by: Jan Kiszka --- include/cobalt/pthread.h |2 ++ lib/cobalt/cobalt.wrappers |1 + lib/cobalt/thread.c|9 + lib/cobalt/wrappers.c |6 ++ 4 files changed, 18 insertions(+) diff --git a/include/cobalt/pthread.h b/include/cobalt/pthread.h index f1b1c8a..3e9bd47 100644 --- a/include/cobalt/pthread.h +++ b/include/cobalt/pthread.h @@ -53,6 +53,8 @@ COBALT_DECL(int, pthread_setschedparam(pthread_t thread, int policy, const struct sched_param *param)); +COBALT_DECL(int, pthread_setschedprio(pthread_t thread, int prio)); + COBALT_DECL(int, pthread_mutex_init(pthread_mutex_t *mutex, const pthread_mutexattr_t *attr)); diff --git a/lib/cobalt/cobalt.wrappers b/lib/cobalt/cobalt.wrappers index 75f29d6..19153ae 100644 --- a/lib/cobalt/cobalt.wrappers +++ b/lib/cobalt/cobalt.wrappers @@ -2,6 +2,7 @@ --wrap pthread_create --wrap pthread_setschedparam --wrap pthread_getschedparam +--wrap pthread_setschedprio --wrap pthread_yield --wrap sched_yield --wrap sched_get_priority_min diff --git a/lib/cobalt/thread.c b/lib/cobalt/thread.c index 908516f..62ca0a0 100644 --- a/lib/cobalt/thread.c +++ b/lib/cobalt/thread.c @@ -650,6 +650,15 @@ int pthread_setschedparam_ex(pthread_t thread, return ret; } +COBALT_IMPL(int, pthread_setschedprio, (pthread_t thread, int prio)) +{ + struct sched_param_ex param_ex = { + .sched_priority = prio, + }; + + return pthread_setschedparam_ex(thread, __SCHED_CURRENT, ¶m_ex); +} + /** * Get the scheduling policy and parameters of the specified thread. * diff --git a/lib/cobalt/wrappers.c b/lib/cobalt/wrappers.c index 09c74e5..1f1664e 100644 --- a/lib/cobalt/wrappers.c +++ b/lib/cobalt/wrappers.c @@ -60,6 +60,12 @@ int __real_pthread_getschedparam(pthread_t thread, } __weak +int __real_pthread_setschedprio(pthread_t thread, int prio) +{ + return pthread_setschedprio(thread, prio); +} + +__weak int __real_sched_yield(void) { return sched_yield(); ___ Xenomai-git mailing list Xenomai-git@xenomai.org https://xenomai.org/mailman/listinfo/xenomai-git
[Xenomai-git] Jan Kiszka : lib/cobalt: Wrap pthread_setschedprio for proper real-time support
Module: xenomai-jki Branch: for-forge Commit: 3c17feb1cc6066e6adca727c2b198546087a8bd8 URL: http://git.xenomai.org/?p=xenomai-jki.git;a=commit;h=3c17feb1cc6066e6adca727c2b198546087a8bd8 Author: Jan Kiszka Date: Tue Mar 8 14:46:59 2016 +0100 lib/cobalt: Wrap pthread_setschedprio for proper real-time support Implement pthread_setschedprio on top of pthread_setschedparam_ex with the help of the new __SCHED_CURRENT policy. This ensures that prio changes are directly applied to the real-time core, and that with just a single syscall. Signed-off-by: Jan Kiszka --- include/cobalt/pthread.h |2 ++ lib/cobalt/cobalt.wrappers |1 + lib/cobalt/thread.c|9 + lib/cobalt/wrappers.c |6 ++ 4 files changed, 18 insertions(+) diff --git a/include/cobalt/pthread.h b/include/cobalt/pthread.h index 386c337..ea5210e 100644 --- a/include/cobalt/pthread.h +++ b/include/cobalt/pthread.h @@ -53,6 +53,8 @@ COBALT_DECL(int, pthread_setschedparam(pthread_t thread, int policy, const struct sched_param *param)); +COBALT_DECL(int, pthread_setschedprio(pthread_t thread, int prio)); + COBALT_DECL(int, pthread_mutex_init(pthread_mutex_t *mutex, const pthread_mutexattr_t *attr)); diff --git a/lib/cobalt/cobalt.wrappers b/lib/cobalt/cobalt.wrappers index 9480f34..6a5db57 100644 --- a/lib/cobalt/cobalt.wrappers +++ b/lib/cobalt/cobalt.wrappers @@ -2,6 +2,7 @@ --wrap pthread_create --wrap pthread_setschedparam --wrap pthread_getschedparam +--wrap pthread_setschedprio --wrap pthread_yield --wrap sched_yield --wrap sched_get_priority_min diff --git a/lib/cobalt/thread.c b/lib/cobalt/thread.c index aab2c81..567972d 100644 --- a/lib/cobalt/thread.c +++ b/lib/cobalt/thread.c @@ -674,6 +674,15 @@ int pthread_setschedparam_ex(pthread_t thread, return ret; } +COBALT_IMPL(int, pthread_setschedprio, (pthread_t thread, int prio)) +{ + struct sched_param_ex param_ex = { + .sched_priority = prio, + }; + + return pthread_setschedparam_ex(thread, __SCHED_CURRENT, ¶m_ex); +} + /** * Get the scheduling policy and parameters of the specified thread. * diff --git a/lib/cobalt/wrappers.c b/lib/cobalt/wrappers.c index 09c74e5..1f1664e 100644 --- a/lib/cobalt/wrappers.c +++ b/lib/cobalt/wrappers.c @@ -60,6 +60,12 @@ int __real_pthread_getschedparam(pthread_t thread, } __weak +int __real_pthread_setschedprio(pthread_t thread, int prio) +{ + return pthread_setschedprio(thread, prio); +} + +__weak int __real_sched_yield(void) { return sched_yield(); ___ Xenomai-git mailing list Xenomai-git@xenomai.org https://xenomai.org/mailman/listinfo/xenomai-git