netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Deepa Dinamani <deepa.kernel@gmail.com>
To: Ran Rozenstein <ranro@mellanox.com>
Cc: "davem@davemloft.net" <davem@davemloft.net>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"arnd@arndb.de" <arnd@arndb.de>,
	"y2038@lists.linaro.org" <y2038@lists.linaro.org>,
	"chris@zankel.net" <chris@zankel.net>,
	"fenghua.yu@intel.com" <fenghua.yu@intel.com>,
	"rth@twiddle.net" <rth@twiddle.net>,
	"tglx@linutronix.de" <tglx@linutronix.de>,
	"ubraun@linux.ibm.com" <ubraun@linux.ibm.com>,
	"linux-alpha@vger.kernel.org" <linux-alpha@vger.kernel.org>,
	"linux-arch@vger.kernel.org" <linux-arch@vger.kernel.org>,
	"linux-ia64@vger.kernel.org" <linux-ia64@vger.kernel.org>,
	"linux-mips@linux-mips.org" <linux-mips@linux-mips.org>,
	"linux-s390@vger.kernel.org" <linux-s390@vger.kernel.org>,
	"linux-xtensa@linux-xtensa.org" <linux-xtensa@linux-xtensa.org>,
	"sparclinux@vger.kernel.org" <sparclinux@vger.kernel.org>
Subject: Re: [PATCH net-next v5 09/12] socket: Add SO_TIMESTAMPING_NEW
Date: Tue, 12 Feb 2019 11:08:52 -0800	[thread overview]
Message-ID: <CABeXuvomXSgYQaFQgv71xQu837J_HUYR4NvMqXPyh4Z3Btnprg@mail.gmail.com> (raw)
In-Reply-To: <CABeXuvqMR7T=3ORvXPihkz-WbTN+oFeHkCu9uvebEq9wTLpJuQ@mail.gmail.com>

On Sun, Feb 10, 2019 at 7:21 PM Deepa Dinamani <deepa.kernel@gmail.com> wrote:
>
> On Feb 10, 2019, at 7:43 AM, Ran Rozenstein <ranro@mellanox.com> wrote:
>
> >> Subject: [PATCH net-next v5 09/12] socket: Add SO_TIMESTAMPING_NEW
> >>
> >> Add SO_TIMESTAMPING_NEW variant of socket timestamp options.
> >> This is the y2038 safe versions of the SO_TIMESTAMPING_OLD for all
> >> architectures.
> >>
> >> Signed-off-by: Deepa Dinamani <deepa.kernel@gmail.com>
> >> Acked-by: Willem de Bruijn <willemb@google.com>
> >
> >
> > Hi,
> >
> > I have app that include:
> >    #include <linux/errqueue.h>
> >
> > It now fail with this error:
> >    In file included from timestamping.c:6:0:
> >    /usr/include/linux/errqueue.h:46:27: error: array type has incomplete element type 'struct __kernel_timespec'
> >      struct __kernel_timespec ts[3];
> >                                       ^~
> > I tried to do the trivial fix, to include time.h:
> > In include/uapi/linux/errqueue.h
> >    #include <linux/time.h>
> >    #include <linux/types.h>
> >
> > But it just add some other noises:
> >                In file included from /usr/include/linux/errqueue.h:5:0,
> >                                 from timestamping.c:6:
> >                /usr/include/linux/time.h:10:8: error: redefinition of ?struct timespec?
> >                 struct timespec {
> >                        ^~~~~~~~
> >                In file included from /usr/include/sys/select.h:39:0,
> >                                 from /usr/include/sys/types.h:197,
> >                                 from /usr/include/stdlib.h:279,
> >                                 from timestamping.c:2:
> >                /usr/include/bits/types/struct_timespec.h:8:8: note: originally defined here
> >                 struct timespec
> >                        ^~~~~~~~
> >                In file included from /usr/include/linux/errqueue.h:5:0,
> >                                 from timestamping.c:6:
> >                /usr/include/linux/time.h:16:8: error: redefinition of ?struct timeval?
> >                 struct timeval {
> >                        ^~~~~~~
> >                In file included from /usr/include/sys/select.h:37:0,
> >                                 from /usr/include/sys/types.h:197,
> >                                 from /usr/include/stdlib.h:279,
> >                                 from timestamping.c:2:
> >                /usr/include/bits/types/struct_timeval.h:8:8: note: originally defined here
> >                 struct timeval
> >                        ^~~~~~~
> >
> >
> > Can you please advise how to solve it?
> >
> > Thanks,
> > Ran
>
> The errqueue.h already had the same issue reported previously:
> https://lore.kernel.org/netdev/CAF=yD-L2ntuH54J_SwN9WcpBMgkV_v0e-Q2Pu2mrQ3+1RozGFQ@mail.gmail.com/
>
> Earlier when I tested this with kernel selftests such as
> tools/testing/selftests/networking/timestamping/rxtimestamp(the test
> was broken to begin with because of  missing include of unistd.h), I
> was using make.cross to build.
> This does not put the headers in the right place
> (obj-$ARCH/usr/include instead of usr/include). Hence, I did not
> realize that this breaks the inclusion of errqueue.h due to the
> missing __kernel_timespec definition.
> I forgot that nobody seems to be using linux/time.h.
>
> But, if I include guards( #ifndef __KERNEL__) for struct timespec,
> struct timeval etc for linux/time.h, then we can include it from
> userspace/ errqueue.h for __kernel_timespec:
>
> --- a/include/uapi/linux/errqueue.h
> +++ b/include/uapi/linux/errqueue.h
> @@ -2,7 +2,7 @@
>  #ifndef _UAPI_LINUX_ERRQUEUE_H
>  #define _UAPI_LINUX_ERRQUEUE_H
>
> -#include <linux/types.h>
> +#include <linux/time.h>
>
>  struct sock_extended_err {
>         __u32   ee_errno;
> diff --git a/include/uapi/linux/time.h b/include/uapi/linux/time.h
> index a6aca9aaab80..40913d9a5bc8 100644
> --- a/include/uapi/linux/time.h
> +++ b/include/uapi/linux/time.h
> @@ -5,6 +5,8 @@
>  #include <linux/types.h>
>
>
> +#ifdef __KERNEL__
> +
>  #ifndef _STRUCT_TIMESPEC
>  #define _STRUCT_TIMESPEC
>  struct timespec {
> @@ -42,6 +44,8 @@ struct itimerval {
>         struct timeval it_value;        /* current value */
>  };
>
> +#endif /* __KERNEL__ */
>
> Arnd,
>
> I forgot how we plan to include the definition for __kernel_timespec
> for libc or userspace. Does this seem right to you?
> Also these changes to errqueue.h needs to be reverted probably as this
> breaks userspace.

Arnd and I talked about this today morning.
We agreed that we could introduce a new time_types.h along the lines
of posix_types.h. We will move all the time definitions that we plan
to keep in the kernel uapi headers to this header. This header will
also not have any overlap with the sys/time.h and can be included
along with it from userspace.
I will post this patch shortly.

This should fix Ran's issue.

-Deepa

  reply	other threads:[~2019-02-12 19:09 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-02 15:34 [PATCH net-next v5 00/12] net: y2038-safe socket timestamps Deepa Dinamani
2019-02-02 15:34 ` [PATCH net-next v5 01/12] selftests: add missing include unistd Deepa Dinamani
2019-02-02 15:34 ` [PATCH net-next v5 02/12] socket: move compat timeout handling into sock.c Deepa Dinamani
2019-02-02 15:34 ` [PATCH net-next v5 03/12] arch: Use asm-generic/socket.h when possible Deepa Dinamani
2019-02-02 15:34 ` [PATCH net-next v5 04/12] sockopt: Rename SO_TIMESTAMP* to SO_TIMESTAMP*_OLD Deepa Dinamani
2019-02-02 15:34 ` [PATCH net-next v5 05/12] arch: sparc: Override struct __kernel_old_timeval Deepa Dinamani
2019-02-02 15:34 ` [PATCH net-next v5 06/12] socket: Use old_timeval types for socket timestamps Deepa Dinamani
2019-02-02 15:34 ` [PATCH net-next v5 07/12] socket: Add struct __kernel_sock_timeval Deepa Dinamani
2019-02-02 15:34 ` [PATCH net-next v5 08/12] socket: Add SO_TIMESTAMP[NS]_NEW Deepa Dinamani
2019-02-02 15:34 ` [PATCH net-next v5 09/12] socket: Add SO_TIMESTAMPING_NEW Deepa Dinamani
2019-02-10 15:43   ` Ran Rozenstein
2019-02-11  3:21     ` Deepa Dinamani
2019-02-12 19:08       ` Deepa Dinamani [this message]
2019-02-02 15:34 ` [PATCH net-next v5 10/12] socket: Update timestamping Documentation Deepa Dinamani
2019-02-02 15:34 ` [PATCH net-next v5 11/12] socket: Rename SO_RCVTIMEO/ SO_SNDTIMEO with _OLD suffixes Deepa Dinamani
2019-02-06 11:58   ` Michael Ellerman
2019-02-02 15:34 ` [PATCH net-next v5 12/12] sock: Add SO_RCVTIMEO_NEW and SO_SNDTIMEO_NEW Deepa Dinamani
2019-02-02 17:15   ` Oliver Hartkopp
2019-02-03  2:47     ` Deepa Dinamani
2019-02-06 11:56   ` Michael Ellerman
2019-02-09  1:44     ` Deepa Dinamani
2019-02-10 22:12       ` Michael Ellerman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CABeXuvomXSgYQaFQgv71xQu837J_HUYR4NvMqXPyh4Z3Btnprg@mail.gmail.com \
    --to=deepa.kernel@gmail.com \
    --cc=arnd@arndb.de \
    --cc=chris@zankel.net \
    --cc=davem@davemloft.net \
    --cc=fenghua.yu@intel.com \
    --cc=linux-alpha@vger.kernel.org \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-ia64@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@linux-mips.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=linux-xtensa@linux-xtensa.org \
    --cc=netdev@vger.kernel.org \
    --cc=ranro@mellanox.com \
    --cc=rth@twiddle.net \
    --cc=sparclinux@vger.kernel.org \
    --cc=tglx@linutronix.de \
    --cc=ubraun@linux.ibm.com \
    --cc=y2038@lists.linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).