Date: Sat, 7 Nov 2015 13:21:49 +0200 From: Konstantin Belousov <kostikbel@gmail.com> To: Bruce Evans <brde@optusnet.com.au> Cc: Svatopluk Kraus <onwahe@gmail.com>, "Conrad E. Meyer" <cem@freebsd.org>, src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r290475 - in head: share/man/man9 sys/kern sys/sys Message-ID: <20151107112149.GV2257@kib.kiev.ua> In-Reply-To: <20151107205927.P1514@besplex.bde.org> References: <201511070143.tA71h13k038232@repo.freebsd.org> <CAFHCsPUagzwtFZvJ10bAeEH8y8Lkz0N1WL99fbBiBKOb=Mk-rQ@mail.gmail.com> <20151107205927.P1514@besplex.bde.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, Nov 07, 2015 at 09:25:32PM +1100, Bruce Evans wrote: > On Sat, 7 Nov 2015, Svatopluk Kraus wrote: > > > You broke buildkernel. The following patch helps: > > > > diff --git a/sys/sys/sysctl.h b/sys/sys/sysctl.h > > index 950e712..a34c890 100644 > > --- a/sys/sys/sysctl.h > > +++ b/sys/sys/sysctl.h > > @@ -37,6 +37,7 @@ > > #define _SYS_SYSCTL_H_ > > > > #include <sys/queue.h> > > +#include <sys/stdint.h> > > > > struct thread; > > /* > > This adds namespace pollution. It shouldn't be needed. <sys/stdint.h> > is standard namespace pollution in <sys/systm.h>. (It has a bogus > comment there describing only one thing that it is for.) > > This pollution is already in dnv.h, nv.h and racct.h. > > > @@ -949,7 +950,7 @@ extern char kern_ident[]; > > /* Dynamic oid handling */ > > struct sysctl_oid *sysctl_add_oid(struct sysctl_ctx_list *clist, > > struct sysctl_oid_list *parent, int nbr, const char *name, int kind, > > - void *arg1, intptr_t arg2, int (*handler)(SYSCTL_HANDLER_ARGS), > > + void *arg1, intmax_t arg2, int (*handler)(SYSCTL_HANDLER_ARGS), > > const char *fmt, const char *descr); > > int sysctl_remove_name(struct sysctl_oid *parent, const char *name, int del, > > int recurse); > > Apparently the original change wasn't tested on 32-bit arches. > > I put intptr_t in <sys/types.h> long ago, since it was more needed and > less magic than intmax_t. This was obfuscated by moving it to > <sys/_stdint.h> and including that in various places. intmax_t is > still only in <sys/stdint.h> which is much larger. It and uintmax_t > should be together with intptr_t. That is more polluting in theory > but less in practice. > > <sys/stdint.h> doesn't declare much else directly, but includes > <sys/_stdint.h> for the most important types (fixed-width ones). It > mainly declares least-width and fast-width types directly. These > should be used in most cases where fixed-width types are now used, > especially in kernels, but their usability is shown by them almost > never being used. In other words, do you suggest the following change to fix the compilation ? diff --git a/sys/sys/_stdint.h b/sys/sys/_stdint.h index d0f9249..a0fe0ad 100644 --- a/sys/sys/_stdint.h +++ b/sys/sys/_stdint.h @@ -78,5 +78,13 @@ typedef __intptr_t intptr_t; typedef __uintptr_t uintptr_t; #define _UINTPTR_T_DECLARED #endif +#ifndef _INTMAX_T_DECLARED +typedef __intmax_t intmax_t; +#define _INTMAX_T_DECLARED +#endif +#ifndef _UINTMAX_T_DECLARED +typedef __uintmax_t uintmax_t; +#define _UINTMAX_T_DECLARED +#endif #endif /* !_SYS__STDINT_H_ */ diff --git a/sys/sys/stdint.h b/sys/sys/stdint.h index 762e879..ec3698b 100644 --- a/sys/sys/stdint.h +++ b/sys/sys/stdint.h @@ -55,15 +55,6 @@ typedef __uint_fast16_t uint_fast16_t; typedef __uint_fast32_t uint_fast32_t; typedef __uint_fast64_t uint_fast64_t; -#ifndef _INTMAX_T_DECLARED -typedef __intmax_t intmax_t; -#define _INTMAX_T_DECLARED -#endif -#ifndef _UINTMAX_T_DECLARED -typedef __uintmax_t uintmax_t; -#define _UINTMAX_T_DECLARED -#endif - /* GNU and Darwin define this and people seem to think it's portable */ #if defined(UINTPTR_MAX) && defined(UINT64_MAX) && (UINTPTR_MAX == UINT64_MAX) #define __WORDSIZE 64 diff --git a/sys/sys/sysctl.h b/sys/sys/sysctl.h index 950e712..f3e2d68 100644 --- a/sys/sys/sysctl.h +++ b/sys/sys/sysctl.h @@ -949,7 +949,7 @@ extern char kern_ident[]; /* Dynamic oid handling */ struct sysctl_oid *sysctl_add_oid(struct sysctl_ctx_list *clist, struct sysctl_oid_list *parent, int nbr, const char *name, int kind, - void *arg1, intptr_t arg2, int (*handler)(SYSCTL_HANDLER_ARGS), + void *arg1, intmax_t arg2, int (*handler)(SYSCTL_HANDLER_ARGS), const char *fmt, const char *descr); int sysctl_remove_name(struct sysctl_oid *parent, const char *name, int del, int recurse);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20151107112149.GV2257>