From patchwork Sat Jan 15 20:33:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 1580397 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4Jbqcb1tzfz9t6h for ; Sun, 16 Jan 2022 07:33:19 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B62753858417 for ; Sat, 15 Jan 2022 20:33:15 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from hera.aquilenet.fr (hera.aquilenet.fr [IPv6:2a0c:e300::1]) by sourceware.org (Postfix) with ESMTPS id 273FF3858417 for ; Sat, 15 Jan 2022 20:33:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 273FF3858417 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=ens-lyon.org Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=ens-lyon.org Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 548AD3B6; Sat, 15 Jan 2022 21:33:06 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at aquilenet.fr Received: from hera.aquilenet.fr ([127.0.0.1]) by localhost (hera.aquilenet.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id d5VQFLY3kna3; Sat, 15 Jan 2022 21:33:05 +0100 (CET) Received: from begin (unknown [IPv6:2a01:cb19:956:1b00:de41:a9ff:fe47:ec49]) by hera.aquilenet.fr (Postfix) with ESMTPSA id 56DD518A; Sat, 15 Jan 2022 21:33:05 +0100 (CET) Received: from samy by begin with local (Exim 4.95) (envelope-from ) id 1n8pjU-0029pm-Lh; Sat, 15 Jan 2022 21:33:04 +0100 From: Samuel Thibault To: libc-alpha@sourceware.org Subject: [hurd, commited] htl: Hide __pthread_attr's __schedparam type [BZ #23088] Date: Sat, 15 Jan 2022 21:33:04 +0100 Message-Id: <20220115203304.514451-1-samuel.thibault@ens-lyon.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Spamd-Bar: ++++ X-Rspamd-Server: hera Authentication-Results: hera.aquilenet.fr; none X-Rspamd-Queue-Id: 548AD3B6 X-Spamd-Result: default: False [4.90 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; R_MISSING_CHARSET(2.50)[]; BROKEN_CONTENT_TYPE(1.50)[]; RCVD_COUNT_THREE(0.00)[3]; MID_CONTAINS_FROM(1.00)[]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_LAST(0.00)[] X-Spam-Status: No, score=-11.8 required=5.0 tests=BAYES_00, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_NEUTRAL, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: commit-hurd@gnu.org Errors-To: libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org Sender: "Libc-alpha" 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. --- .../htl/bits/types/struct___pthread_attr.h | 8 ++- sysdeps/htl/pt-attr-getschedparam.c | 2 +- sysdeps/htl/pt-attr-setschedparam.c | 4 +- sysdeps/htl/pt-attr.c | 2 +- sysdeps/htl/timer_routines.h | 4 +- sysdeps/mach/hurd/i386/Makefile | 70 ------------------- 6 files changed, 11 insertions(+), 79 deletions(-) diff --git a/sysdeps/htl/bits/types/struct___pthread_attr.h b/sysdeps/htl/bits/types/struct___pthread_attr.h index ec4d6485c8..9ec7ccc5b6 100644 --- a/sysdeps/htl/bits/types/struct___pthread_attr.h +++ b/sysdeps/htl/bits/types/struct___pthread_attr.h @@ -19,8 +19,6 @@ #ifndef _BITS_TYPES_STRUCT___PTHREAD_ATTR #define _BITS_TYPES_STRUCT___PTHREAD_ATTR 1 -#include - #define __need_size_t #include @@ -28,11 +26,15 @@ enum __pthread_detachstate; enum __pthread_inheritsched; enum __pthread_contentionscope; +struct __sched_param { + int __sched_priority; +}; + /* This structure describes the attributes of a POSIX thread. Note that not all of them are supported on all systems. */ struct __pthread_attr { - struct sched_param __schedparam; + struct __sched_param __schedparam; void *__stackaddr; size_t __stacksize; size_t __guardsize; diff --git a/sysdeps/htl/pt-attr-getschedparam.c b/sysdeps/htl/pt-attr-getschedparam.c index 714998abbc..59e7c6d538 100644 --- a/sysdeps/htl/pt-attr-getschedparam.c +++ b/sysdeps/htl/pt-attr-getschedparam.c @@ -26,7 +26,7 @@ int __pthread_attr_getschedparam (const pthread_attr_t *attr, struct sched_param *param) { - memcpy (param, &attr->__schedparam, sizeof *param); + param->sched_priority = attr->__schedparam.__sched_priority; return 0; } 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; } diff --git a/sysdeps/htl/pt-attr.c b/sysdeps/htl/pt-attr.c index 385347ccb2..c460be2156 100644 --- a/sysdeps/htl/pt-attr.c +++ b/sysdeps/htl/pt-attr.c @@ -24,7 +24,7 @@ #include struct __pthread_attr __pthread_default_attr = { - __schedparam: { sched_priority: 0 }, + __schedparam: { __sched_priority: 0 }, __stacksize: 0, __stackaddr: NULL, #ifdef PAGESIZE diff --git a/sysdeps/htl/timer_routines.h b/sysdeps/htl/timer_routines.h index 8d0bec84a9..fa69d9e963 100644 --- a/sysdeps/htl/timer_routines.h +++ b/sysdeps/htl/timer_routines.h @@ -32,8 +32,8 @@ thread_attr_compare (const pthread_attr_t * left, const pthread_attr_t * right) struct __pthread_attr *ileft = (struct __pthread_attr *) left; struct __pthread_attr *iright = (struct __pthread_attr *) right; - return ileft->__schedparam.sched_priority - == iright->__schedparam.sched_priority + return ileft->__schedparam.__sched_priority + == iright->__schedparam.__sched_priority && ileft->__stackaddr == iright->__stackaddr && ileft->__stacksize == iright->__stacksize && ileft->__guardsize == iright->__guardsize diff --git a/sysdeps/mach/hurd/i386/Makefile b/sysdeps/mach/hurd/i386/Makefile index f725114619..ec58bb18f6 100644 --- a/sysdeps/mach/hurd/i386/Makefile +++ b/sysdeps/mach/hurd/i386/Makefile @@ -23,76 +23,6 @@ ifeq ($(subdir),conform) # For bugs 23081, 23082, 23083, 23084, 23085, 23086. # (type conformance) conformtest-xfail-conds += i386-gnu - -# For bug 23088 -# (sched_* visibility) -test-xfail-POSIX/fcntl.h/conform = yes -test-xfail-POSIX/signal.h/conform = yes -test-xfail-POSIX/semaphore.h/conform = yes -test-xfail-POSIX/regex.h/conform = yes -test-xfail-POSIX/aio.h/conform = yes -test-xfail-POSIX/mqueue.h/conform = yes -test-xfail-POSIX/sys/types.h/conform = yes -test-xfail-UNIX98/fcntl.h/conform = yes -test-xfail-UNIX98/netdb.h/conform = yes -test-xfail-UNIX98/signal.h/conform = yes -test-xfail-UNIX98/semaphore.h/conform = yes -test-xfail-UNIX98/regex.h/conform = yes -test-xfail-UNIX98/aio.h/conform = yes -test-xfail-UNIX98/ftw.h/conform = yes -test-xfail-UNIX98/mqueue.h/conform = yes -test-xfail-UNIX98/netinet/in.h/conform = yes -test-xfail-UNIX98/sys/wait.h/conform = yes -test-xfail-UNIX98/sys/sem.h/conform = yes -test-xfail-UNIX98/sys/uio.h/conform = yes -test-xfail-UNIX98/sys/socket.h/conform = yes -test-xfail-UNIX98/sys/types.h/conform = yes -test-xfail-UNIX98/stdlib.h/conform = yes -test-xfail-UNIX98/arpa/inet.h/conform = yes -test-xfail-POSIX2008/fcntl.h/conform = yes -test-xfail-POSIX2008/netdb.h/conform = yes -test-xfail-POSIX2008/signal.h/conform = yes -test-xfail-POSIX2008/semaphore.h/conform = yes -test-xfail-POSIX2008/regex.h/conform = yes -test-xfail-POSIX2008/aio.h/conform = yes -test-xfail-POSIX2008/mqueue.h/conform = yes -test-xfail-POSIX2008/netinet/in.h/conform = yes -test-xfail-POSIX2008/sys/wait.h/conform = yes -test-xfail-POSIX2008/sys/socket.h/conform = yes -test-xfail-POSIX2008/sys/types.h/conform = yes -test-xfail-POSIX2008/arpa/inet.h/conform = yes -test-xfail-XOPEN2K/fcntl.h/conform = yes -test-xfail-XOPEN2K/netdb.h/conform = yes -test-xfail-XOPEN2K/signal.h/conform = yes -test-xfail-XOPEN2K/semaphore.h/conform = yes -test-xfail-XOPEN2K/regex.h/conform = yes -test-xfail-XOPEN2K/aio.h/conform = yes -test-xfail-XOPEN2K/ftw.h/conform = yes -test-xfail-XOPEN2K/mqueue.h/conform = yes -test-xfail-XOPEN2K/netinet/in.h/conform = yes -test-xfail-XOPEN2K/sys/wait.h/conform = yes -test-xfail-XOPEN2K/sys/sem.h/conform = yes -test-xfail-XOPEN2K/sys/uio.h/conform = yes -test-xfail-XOPEN2K/sys/socket.h/conform = yes -test-xfail-XOPEN2K/sys/types.h/conform = yes -test-xfail-XOPEN2K/stdlib.h/conform = yes -test-xfail-XOPEN2K/arpa/inet.h/conform = yes -test-xfail-XOPEN2K8/fcntl.h/conform = yes -test-xfail-XOPEN2K8/netdb.h/conform = yes -test-xfail-XOPEN2K8/signal.h/conform = yes -test-xfail-XOPEN2K8/semaphore.h/conform = yes -test-xfail-XOPEN2K8/regex.h/conform = yes -test-xfail-XOPEN2K8/aio.h/conform = yes -test-xfail-XOPEN2K8/ftw.h/conform = yes -test-xfail-XOPEN2K8/mqueue.h/conform = yes -test-xfail-XOPEN2K8/netinet/in.h/conform = yes -test-xfail-XOPEN2K8/sys/wait.h/conform = yes -test-xfail-XOPEN2K8/sys/sem.h/conform = yes -test-xfail-XOPEN2K8/sys/uio.h/conform = yes -test-xfail-XOPEN2K8/sys/socket.h/conform = yes -test-xfail-XOPEN2K8/sys/types.h/conform = yes -test-xfail-XOPEN2K8/stdlib.h/conform = yes -test-xfail-XOPEN2K8/arpa/inet.h/conform = yes endif # For bug 23286