From patchwork Mon Oct 4 15:38:26 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alban Crequy X-Patchwork-Id: 66705 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 7A28AB70CB for ; Tue, 5 Oct 2010 02:43:05 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756309Ab0JDPmj (ORCPT ); Mon, 4 Oct 2010 11:42:39 -0400 Received: from bhuna.collabora.co.uk ([93.93.128.226]:45462 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756292Ab0JDPmi (ORCPT ); Mon, 4 Oct 2010 11:42:38 -0400 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: alban) with ESMTPSA id B70B3601260 From: Alban Crequy Cc: Lennart Poettering , Alban Crequy , "David S. Miller" , Stephen Hemminger , Eric Dumazet , Cyrill Gorcunov , Alexey Dobriyan , linux-kernel@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH] AF_UNIX: Implement SO_TIMESTAMP and SO_TIMETAMPNS on Unix sockets Date: Mon, 4 Oct 2010 16:38:26 +0100 Message-Id: <1286206706-25733-1-git-send-email-alban.crequy@collabora.co.uk> X-Mailer: git-send-email 1.7.1 To: unlisted-recipients:; (no To-header on input) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Userspace applications can already request to receive timestamps with: setsockopt(sockfd, SOL_SOCKET, SO_TIMESTAMP, ...) Although setsockopt() returns zero (success), timestamps are not added to the ancillary data. This patch fixes that. Signed-off-by: Alban Crequy --- net/unix/af_unix.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index 617bea4..142ccea 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c @@ -1697,6 +1697,8 @@ static int unix_dgram_recvmsg(struct kiocb *iocb, struct socket *sock, if (err) goto out_free; + sock_recv_timestamp(msg, sk, skb); + if (!siocb->scm) { siocb->scm = &tmp_scm; memset(&tmp_scm, 0, sizeof(tmp_scm)); @@ -1877,6 +1879,8 @@ static int unix_stream_recvmsg(struct kiocb *iocb, struct socket *sock, copied += chunk; size -= chunk; + sock_recv_timestamp(msg, sk, skb); + /* Mark read part of skb as used */ if (!(flags & MSG_PEEK)) { skb_pull(skb, chunk);