Re: Fire Engine??

Andi Kleen
2003-11-26T22:29:14Z

On Wed, 26 Nov 2003 12:03:16 -0800
"David S. Miller" <davem@redhat.com> wrote:

> On Wed, 26 Nov 2003 11:58:44 -0800
> Paul Menage <menage@google.com> wrote:
>
> > How about tracking the number of current sockets that have had timestamp
> > requests for them? If this number is zero, don't bother with the
> > timestamps. The first time you get a SIOCGSTAMP ioctl on a given socket,
> > bump the count and set a flag; decrement the count when the socket is
> > destroyed if the flag is set.
>
> Reread what I said please, the user can ask for timestamps using CMSG
> objects via the recvmsg() system call, there are no ioctls or socket
> controls done on the socket. It is completely dynamic and
> unpredictable.

The user sets the SO_TIMESTAMP setsockopt to 1 and then you get the cmsg.
That's per socket state. The other way is to use the SIOCGTSTAMP ioctl.
That is a bit more ugly because it has no state, but you can do
a heuristic and assume that an process that does SIOCGTSTAMP once
will do it in future too and set a flag in this case.

The first SIOCGTSTAMP would be inaccurate, but the following (after
all untimestamped packets have been flushed) would be ok.

Doing for IP would be relatively easy, the only major user of the
timestamp seems to be DECnet and the bridge, but I supose those could be
converted to use jiffies too.

-Andi