Re: Fire Engine??

From: Andi Kleen
Date: Wed Nov 26 2003 - 17:30:16 EST


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

> On Wed, 26 Nov 2003 11:58:44 -0800
> Paul Menage <menage@xxxxxxxxxx> 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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/