mailing list of musl libc
 help / color / mirror / code / Atom feed
* [musl] [PATCH] add check for pthread_attr_setschedpolicy
@ 2024-12-24  7:06 yan.li.cn
  2024-12-24  9:45 ` Rich Felker
  0 siblings, 1 reply; 2+ messages in thread
From: yan.li.cn @ 2024-12-24  7:06 UTC (permalink / raw)
  To: musl; +Cc: yan.li.cn

From: Yan Li <yan.li.cn@windriver.com>

---
 src/thread/pthread_attr_setschedpolicy.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
 mode change 100644 => 100755 src/thread/pthread_attr_setschedpolicy.c

diff --git a/src/thread/pthread_attr_setschedpolicy.c b/src/thread/pthread_attr_setschedpolicy.c
old mode 100644
new mode 100755
index bb71f393..f943e3c5
--- a/src/thread/pthread_attr_setschedpolicy.c
+++ b/src/thread/pthread_attr_setschedpolicy.c
@@ -2,6 +2,10 @@
 
 int pthread_attr_setschedpolicy(pthread_attr_t *a, int policy)
 {
-	a->_a_policy = policy;
-	return 0;
+    if (policy != SCHED_OTHER && policy != SCHED_FIFO && policy != SCHED_RR){
+        return EINVAL;
+    }
+
+    a->_a_policy = policy;
+    return 0;
 }
-- 
2.34.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [musl] [PATCH] add check for pthread_attr_setschedpolicy
  2024-12-24  7:06 [musl] [PATCH] add check for pthread_attr_setschedpolicy yan.li.cn
@ 2024-12-24  9:45 ` Rich Felker
  0 siblings, 0 replies; 2+ messages in thread
From: Rich Felker @ 2024-12-24  9:45 UTC (permalink / raw)
  To: yan.li.cn; +Cc: musl

On Tue, Dec 24, 2024 at 03:06:23PM +0800, yan.li.cn@windriver.com wrote:
> From: Yan Li <yan.li.cn@windriver.com>
> 
> ---
>  src/thread/pthread_attr_setschedpolicy.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
>  mode change 100644 => 100755 src/thread/pthread_attr_setschedpolicy.c
> 
> diff --git a/src/thread/pthread_attr_setschedpolicy.c b/src/thread/pthread_attr_setschedpolicy.c
> old mode 100644
> new mode 100755
> index bb71f393..f943e3c5
> --- a/src/thread/pthread_attr_setschedpolicy.c
> +++ b/src/thread/pthread_attr_setschedpolicy.c
> @@ -2,6 +2,10 @@
>  
>  int pthread_attr_setschedpolicy(pthread_attr_t *a, int policy)
>  {
> -	a->_a_policy = policy;
> -	return 0;
> +    if (policy != SCHED_OTHER && policy != SCHED_FIFO && policy != SCHED_RR){
> +        return EINVAL;
> +    }
> +
> +    a->_a_policy = policy;
> +    return 0;
>  }
> -- 
> 2.34.1

This is also a MAY FAIL condition, and as written it breaks support for
all of the Linux-extension scheduling policies. Even if you included
all of those, it would break running newer binaries using a
newly-added policy with an older libc.so.

Aside: It seems either you've replaced tabs with 4 spaces or your mail
software is corrupting the patches you send. Please use tabs for
indention and if your mailer can't guarantee they make it through
intact, attach them as MIME attachments.

Rich

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-12-24  9:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-12-24  7:06 [musl] [PATCH] add check for pthread_attr_setschedpolicy yan.li.cn
2024-12-24  9:45 ` Rich Felker

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).