Re: git: 160b4b922b60 - main - Add real sched.h

From: Konstantin Belousov <kostikbel_at_gmail.com>
Date: Thu, 11 Nov 2021 08:06:34 UTC
On Thu, Nov 11, 2021 at 07:29:19AM +0000, Antoine Brodin wrote:
> On Wed, Nov 10, 2021 at 7:34 PM Konstantin Belousov <kib@freebsd.org> wrote:
> >
> > The branch main has been updated by kib:
> >
> > URL: https://cgit.FreeBSD.org/src/commit/?id=160b4b922b6021848b6b48afc894d16b879b7af2
> >
> > commit 160b4b922b6021848b6b48afc894d16b879b7af2
> > Author:     Konstantin Belousov <kib@FreeBSD.org>
> > AuthorDate: 2021-10-22 15:17:21 +0000
> > Commit:     Konstantin Belousov <kib@FreeBSD.org>
> > CommitDate: 2021-11-10 19:18:53 +0000
> >
> >     Add real sched.h
> >
> >     It is required by IEEE Std 1003.1-2008 AKA POSIX.
> >
> >     Put some Linux compatibility stuff under BSD_VISIBLE namespace, in
> >     particular, sys/cpuset.h definitions.  Also, if user really want
> >     Linux compatibility, she can request cpu_set_t typedef with
> >     _WITH_CPU_SET_T define.
> >
> >     Reviewed by:    jhb
> >     Sponsored by:   The FreeBSD Foundation
> >     MFC after:      1 week
> >     Differential revision:  https://reviews.freebsd.org/D32901
> > ---
> >  include/Makefile |  5 +++--
> >  include/sched.h  | 46 ++++++++++++++++++++++++++++++++++++++++++++++
> >  2 files changed, 49 insertions(+), 2 deletions(-)
> 
> Hi,
> 
> It seems that this broke some ports:
> http://gohan03.nyi.freebsd.org/data/main-amd64-default-baseline/p913ccecf2a92_s448bcd01dc/logs/errors/ninja-1.10.2,2.log
> http://gohan03.nyi.freebsd.org/data/main-amd64-default-baseline/p913ccecf2a92_s448bcd01dc/logs/errors/ghc-8.10.7.log
> http://gohan03.nyi.freebsd.org/data/main-amd64-default-baseline/p913ccecf2a92_s448bcd01dc/logs/errors/openpgm-5.2.122_6.log
> http://gohan03.nyi.freebsd.org/data/main-amd64-default-baseline/p913ccecf2a92_s448bcd01dc/logs/errors/guile2-2.2.7_1.log
> http://gohan03.nyi.freebsd.org/data/main-amd64-default-baseline/p913ccecf2a92_s448bcd01dc/logs/errors/liburcu-0.12.1.log
> http://gohan03.nyi.freebsd.org/data/main-amd64-default-baseline/p913ccecf2a92_s448bcd01dc/logs/errors/guile-3.0.7.log
> http://gohan03.nyi.freebsd.org/data/main-amd64-default-baseline/p913ccecf2a92_s448bcd01dc/logs/errors/squid-4.15.log
> ...

Could you please try this?  My intent was that cpu_set_t would be requested
as needed by consumers with _WITH_CPU_SET_T.

commit b6bb08f09dc7cf2796c35015f5aee93dedf33018
Author: Konstantin Belousov <kib@FreeBSD.org>
Date:   Thu Nov 11 10:01:54 2021 +0200

    sched.h: Make cpu_set_t compat typedef visible unconditionally
    
    or rather, visible if BSD namespace is enabled, instead of requiring
    _WITH_CPU_SET_T define to expose it.  It seems a lot of code assumes
    that presence of sched_getaffinity() implies existence of cpu_set_t.
    
    Reported by:    portmgr (antoine)
    Sponsored by:   The FreeBSD Foundation
    MFC after:      1 week

diff --git a/include/sched.h b/include/sched.h
index 1c41cda79046..2d4f301c9718 100644
--- a/include/sched.h
+++ b/include/sched.h
@@ -34,13 +34,8 @@
 #include <sys/sched.h>
 #if __BSD_VISIBLE
 #include <sys/cpuset.h>
-#endif /* __BSD_VISIBLE */
-
-#if __BSD_VISIBLE
-#ifdef _WITH_CPU_SET_T
 struct _cpuset;
 typedef struct _cpuset cpu_set_t;
-#endif /* _WITH_CPU_SET_T */
 #endif /* __BSD_VISIBLE */
 
 __BEGIN_DECLS