diff options
| author | Michael Kerrisk <mtk.manpages@gmail.com> | 2005-12-08 16:36:30 +0000 |
|---|---|---|
| committer | Michael Kerrisk <mtk.manpages@gmail.com> | 2005-12-08 16:36:30 +0000 |
| commit | 7b5c3d0a78a9718130ef57ceaef6b98fb9029279 (patch) | |
| tree | c126e7d030fef7406c391e67928abbf3c1c8e0e7 /man7/socket.7 | |
| parent | 17d960985864eb126d909ec763d13af4b7d689f8 (diff) | |
| download | man-pages-7b5c3d0a78a9718130ef57ceaef6b98fb9029279.tar.gz | |
Von: Urs Thuermann <urs@isnogud.escape.de>
An: "Michael Kerrisk" <mtk-manpages@gmx.net>
Betreff: Re: PATCH: man-pages-2.15, socket option SO_TIMESTAMP
Datum: 02 Dec 2005 08:00:11 +0100
Hello Michael,
> Okay -- let me know if your patch is still good to go after you've
> done your reading/testing. Maybe I will try to do another
> man-page release tomorrow, if you you can confirm the details in 2.6.
I have compared 2.4 and 2.6 src again and wrote two small test
programs (one sending udp packets, one receiving the packets and
calling SIOCGSTAMP w/ and w/o SO_TIMESTAMP). Both, 2.4 and 2.6 have
the same behavior, which may be considered a bug.
When a packet is received its timestamp is stored in the sock
structure in kernel for SIOCGSTAMP to be retreived if SO_TIMESTAMP is
not set, otherwise it is written into a cmsg structure to be returned
with the recvmsg syscall.
Therefore, SIOCGSTAMP doesn't get the correct timestamp, when
SO_TIMESTAMP is set. Instead, SIOCGSTAMP returns an ENOENT error, if
there has never been a packet reception while SO_TIMESTAMP unset,
since the field in the sock structure in the kernel is initialized to
"no timestamp" (0 in 2.4, -1 in 2.6). Otherwise, SIOCGSTAMP returns
the timestamp found in the sock structure which is from the last
packet when SO_TIMESTAMP was not set, i.e. it may not be the timestamp
of the last packet received.
I have updated the man page socket(7) accordingly. Patch is below.
urs
Diffstat (limited to 'man7/socket.7')
| -rw-r--r-- | man7/socket.7 | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/man7/socket.7 b/man7/socket.7 index c547afcf78..040452155a 100644 --- a/man7/socket.7 +++ b/man7/socket.7 @@ -425,6 +425,21 @@ capability. Get and clear the pending socket error. Only valid as a .BR getsockopt (). Expects an integer. +.TP +.B SO_TIMESTAMP +Enable or disable the receiving of the +.B SO_TIMESTAMP +control message. +The time stamp control message is sent with level +.B SOL_SOCKET +and the +.I cmsg_data field is a +.I "struct timeval" +indicating the +reception time of the last packet passed to the user in this call. +See +.BR cmsg (3) +for details on control messages. .SH SIGNALS When writing onto a connection-oriented socket that has been shut down (by the local or the remote end) @@ -518,12 +533,20 @@ These operations can be accessed using .B SIOCGSTAMP Return a .I struct timeval -with the receive timestamp of the last packet passed to the user. This is useful -for accurate round trip time measurements. See +with the receive timestamp of the last packet passed to the user. +This is useful for accurate round trip time measurements. +See .BR setitimer (2) for a description of .IR "struct timeval" . .\" +This ioctl should only be used if the +.B SO_TIMESTAMP +socket option has not been set on the socket. +Otherwise, it returns the time stamp of the last packet received without +.B SO_TIMESTAMP +being set or it returns +.BR ENOENT . .TP .BR SIOCSPGRP Set the process or process group to send |
