From: Eric Sesterhenn <snakebyte@gmx.de>
To: netdev@vger.kernel.org
Subject: [Patch] Incorrect time conversion in TIPC
Date: Sat, 8 Dec 2007 13:49:57 +0100 [thread overview]
Message-ID: <20071208124957.GB4757@alice> (raw)
hi,
the timeouts in tipc/socket.c dont match if HZ is not 1000,
this patch changes it to use the proper conversion functions.
Signed-off-by: Eric Sesterhenn <snakebyte@gmx.de>
--- linux-2.6.24-rc3/net/tipc/socket.c.orig 2007-12-07 20:07:11.000000000 +0100
+++ linux-2.6.24-rc3/net/tipc/socket.c 2007-12-07 20:11:15.000000000 +0100
@@ -209,7 +209,7 @@ static int tipc_create(struct net *net,
sock_init_data(sock, sk);
init_waitqueue_head(sk->sk_sleep);
- sk->sk_rcvtimeo = 8 * HZ; /* default connect timeout = 8s */
+ sk->sk_rcvtimeo = msecs_to_jiffies(8000); /* default connect timeout = 8s */
tsock = tipc_sk(sk);
port = tipc_get_port(ref);
@@ -1535,7 +1535,7 @@ static int setsockopt(struct socket *soc
res = tipc_set_portunreturnable(tsock->p->ref, value);
break;
case TIPC_CONN_TIMEOUT:
- sock->sk->sk_rcvtimeo = (value * HZ / 1000);
+ sock->sk->sk_rcvtimeo = msecs_to_jiffies(value);
break;
default:
res = -EINVAL;
@@ -1588,7 +1588,7 @@ static int getsockopt(struct socket *soc
res = tipc_portunreturnable(tsock->p->ref, &value);
break;
case TIPC_CONN_TIMEOUT:
- value = (sock->sk->sk_rcvtimeo * 1000) / HZ;
+ value = jiffies_to_msecs(sock->sk->sk_rcvtimeo);
break;
default:
res = -EINVAL;
reply other threads:[~2007-12-08 12:49 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20071208124957.GB4757@alice \
--to=snakebyte@gmx.de \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).