aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth/af_bluetooth.c
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2008-07-14 14:13:50 -0400
committerMarcel Holtmann <marcel@holtmann.org>2008-07-14 14:13:50 -0400
commit3241ad820dbb172021e0268b5611031991431626 (patch)
tree628c3fbdc88f9de6c996358ebcb551176da38f1f /net/bluetooth/af_bluetooth.c
parent40be492fe4fab829951681860c2bb26fa1d5fe4a (diff)
[Bluetooth] Add timestamp support to L2CAP, RFCOMM and SCO
Enable the common timestamp functionality that the network subsystem provides for L2CAP, RFCOMM and SCO sockets. It is possible to either use SO_TIMESTAMP or the IOCTLs to retrieve the timestamp of the current packet. Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/bluetooth/af_bluetooth.c')
-rw-r--r--net/bluetooth/af_bluetooth.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/net/bluetooth/af_bluetooth.c b/net/bluetooth/af_bluetooth.c
index d366423c8392..88afe25003d8 100644
--- a/net/bluetooth/af_bluetooth.c
+++ b/net/bluetooth/af_bluetooth.c
@@ -36,6 +36,7 @@
36#include <linux/init.h> 36#include <linux/init.h>
37#include <linux/poll.h> 37#include <linux/poll.h>
38#include <net/sock.h> 38#include <net/sock.h>
39#include <asm/ioctls.h>
39 40
40#if defined(CONFIG_KMOD) 41#if defined(CONFIG_KMOD)
41#include <linux/kmod.h> 42#include <linux/kmod.h>
@@ -266,6 +267,8 @@ int bt_sock_recvmsg(struct kiocb *iocb, struct socket *sock,
266 267
267 skb_reset_transport_header(skb); 268 skb_reset_transport_header(skb);
268 err = skb_copy_datagram_iovec(skb, 0, msg->msg_iov, copied); 269 err = skb_copy_datagram_iovec(skb, 0, msg->msg_iov, copied);
270 if (err == 0)
271 sock_recv_timestamp(msg, sk, skb);
269 272
270 skb_free_datagram(sk, skb); 273 skb_free_datagram(sk, skb);
271 274
@@ -329,6 +332,31 @@ unsigned int bt_sock_poll(struct file * file, struct socket *sock, poll_table *w
329} 332}
330EXPORT_SYMBOL(bt_sock_poll); 333EXPORT_SYMBOL(bt_sock_poll);
331 334
335int bt_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
336{
337 struct sock *sk = sock->sk;
338 int err;
339
340 BT_DBG("sk %p cmd %x arg %lx", sk, cmd, arg);
341
342 switch (cmd) {
343 case SIOCGSTAMP:
344 err = sock_get_timestamp(sk, (struct timeval __user *) arg);
345 break;
346
347 case SIOCGSTAMPNS:
348 err = sock_get_timestampns(sk, (struct timespec __user *) arg);
349 break;
350
351 default:
352 err = -ENOIOCTLCMD;
353 break;
354 }
355
356 return err;
357}
358EXPORT_SYMBOL(bt_sock_ioctl);
359
332int bt_sock_wait_state(struct sock *sk, int state, unsigned long timeo) 360int bt_sock_wait_state(struct sock *sk, int state, unsigned long timeo)
333{ 361{
334 DECLARE_WAITQUEUE(wait, current); 362 DECLARE_WAITQUEUE(wait, current);