diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2007-09-09 02:39:34 -0400 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2007-09-09 02:39:34 -0400 |
commit | 767c5eb5d35aeb85987143f0a730bc21d3ecfb3d (patch) | |
tree | f292706a782bfb8d768a3c6f96871b3ba9e5dc81 /net/bluetooth/hci_sock.c | |
parent | 26a4a06e7ff2874154eb3f4b4ba0514dc563b100 (diff) |
[Bluetooth] Add compat handling for timestamp structure
The timestamp structure needs special handling in case of compat
programs. Use the same wrapping method the network core uses.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/bluetooth/hci_sock.c')
-rw-r--r-- | net/bluetooth/hci_sock.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/net/bluetooth/hci_sock.c b/net/bluetooth/hci_sock.c index 1dae3dfc66a9..68198a788969 100644 --- a/net/bluetooth/hci_sock.c +++ b/net/bluetooth/hci_sock.c | |||
@@ -37,6 +37,7 @@ | |||
37 | #include <linux/skbuff.h> | 37 | #include <linux/skbuff.h> |
38 | #include <linux/workqueue.h> | 38 | #include <linux/workqueue.h> |
39 | #include <linux/interrupt.h> | 39 | #include <linux/interrupt.h> |
40 | #include <linux/compat.h> | ||
40 | #include <linux/socket.h> | 41 | #include <linux/socket.h> |
41 | #include <linux/ioctl.h> | 42 | #include <linux/ioctl.h> |
42 | #include <net/sock.h> | 43 | #include <net/sock.h> |
@@ -342,9 +343,23 @@ static inline void hci_sock_cmsg(struct sock *sk, struct msghdr *msg, struct sk_ | |||
342 | 343 | ||
343 | if (mask & HCI_CMSG_TSTAMP) { | 344 | if (mask & HCI_CMSG_TSTAMP) { |
344 | struct timeval tv; | 345 | struct timeval tv; |
346 | void *data; | ||
347 | int len; | ||
345 | 348 | ||
346 | skb_get_timestamp(skb, &tv); | 349 | skb_get_timestamp(skb, &tv); |
347 | put_cmsg(msg, SOL_HCI, HCI_CMSG_TSTAMP, sizeof(tv), &tv); | 350 | |
351 | if (msg->msg_flags & MSG_CMSG_COMPAT) { | ||
352 | struct compat_timeval ctv; | ||
353 | ctv.tv_sec = tv.tv_sec; | ||
354 | ctv.tv_usec = tv.tv_usec; | ||
355 | data = &ctv; | ||
356 | len = sizeof(ctv); | ||
357 | } else { | ||
358 | data = &tv; | ||
359 | len = sizeof(tv); | ||
360 | } | ||
361 | |||
362 | put_cmsg(msg, SOL_HCI, HCI_CMSG_TSTAMP, len, data); | ||
348 | } | 363 | } |
349 | } | 364 | } |
350 | 365 | ||