about summary refs log tree commit diff
path: root/sysdeps/htl/pt-attr-setschedparam.c
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2022-01-15 17:35:51 +0100
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2022-01-15 21:31:08 +0100
commit1bd7a06a958e93dbd10d99d30ee9ad82fca13f48 (patch)
tree07a368ec2acde2179d376eebd0a871f737a69144 /sysdeps/htl/pt-attr-setschedparam.c
parentc1105e34aced53b26f02176b973079eb30fc54b1 (diff)
downloadglibc-1bd7a06a958e93dbd10d99d30ee9ad82fca13f48.tar.gz
glibc-1bd7a06a958e93dbd10d99d30ee9ad82fca13f48.tar.xz
glibc-1bd7a06a958e93dbd10d99d30ee9ad82fca13f48.zip
htl: Hide __pthread_attr's __schedparam type [BZ #23088]
The content of the structure is only used internally, so we can make
__pthread_attr_getschedparam and __pthread_attr_setschedparam convert
between the public sched_param type and an internal __sched_param.

This allows to avoid to spuriously expose the sched_param type.

This fixes BZ #23088.
Diffstat (limited to 'sysdeps/htl/pt-attr-setschedparam.c')
-rw-r--r--sysdeps/htl/pt-attr-setschedparam.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sysdeps/htl/pt-attr-setschedparam.c b/sysdeps/htl/pt-attr-setschedparam.c
index 52d39126f4..d9b4731fed 100644
--- a/sysdeps/htl/pt-attr-setschedparam.c
+++ b/sysdeps/htl/pt-attr-setschedparam.c
@@ -26,9 +26,9 @@ int
 __pthread_attr_setschedparam (pthread_attr_t *attr,
 			      const struct sched_param *param)
 {
-  if (memcmp (param, &__pthread_default_attr.__schedparam, sizeof *param) == 0)
+  if (param->sched_priority == __pthread_default_attr.__schedparam.__sched_priority)
     {
-      memcpy (&attr->__schedparam, param, sizeof *param);
+      attr->__schedparam.__sched_priority = param->sched_priority;
       return 0;
     }