summaryrefslogtreecommitdiff
path: root/sys/kern
diff options
context:
space:
mode:
authorChris Kuethe <ckuethe@cvs.openbsd.org>2008-05-02 06:49:33 +0000
committerChris Kuethe <ckuethe@cvs.openbsd.org>2008-05-02 06:49:33 +0000
commitac62022e3319b58cd03e552240772872ff219a70 (patch)
tree11d64a9c749b3f2f1d31c20967ddf7faef658b0f /sys/kern
parent7f740532bb7e0e07efa3aea9fae9139a1f135642 (diff)
Make the SO_TIMESTAMP sockopt work. When set, this allows the user to
get a timestamp of when the datagram was accepted (by udp(4), for example) rather than having to take a timestamp with gettimeofday(2) when recv(2) returns - possibly several hundreds of microseconds later. May be of use to those interested in precision network timing schemes or QoS for media applications. Tested on alpha, amd64, i386 and sparc64. manpage suggestions from jmc, ok deraadt
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/uipc_socket.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c
index c79d828130f..45728e18533 100644
--- a/sys/kern/uipc_socket.c
+++ b/sys/kern/uipc_socket.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uipc_socket.c,v 1.67 2007/12/20 17:16:50 chl Exp $ */
+/* $OpenBSD: uipc_socket.c,v 1.68 2008/05/02 06:49:32 ckuethe Exp $ */
/* $NetBSD: uipc_socket.c,v 1.21 1996/02/04 02:17:52 christos Exp $ */
/*
@@ -1001,6 +1001,7 @@ sosetopt(struct socket *so, int level, int optname, struct mbuf *m0)
case SO_REUSEPORT:
case SO_OOBINLINE:
case SO_JUMBO:
+ case SO_TIMESTAMP:
if (m == NULL || m->m_len < sizeof (int)) {
error = EINVAL;
goto bad;
@@ -1135,6 +1136,7 @@ sogetopt(struct socket *so, int level, int optname, struct mbuf **mp)
case SO_BROADCAST:
case SO_OOBINLINE:
case SO_JUMBO:
+ case SO_TIMESTAMP:
*mtod(m, int *) = so->so_options & optname;
break;