summaryrefslogtreecommitdiffstats
path: root/net/ipv4/tcp.c
diff options
context:
space:
mode:
authorMario Schuknecht <m.schuknecht@dresearch.de>2011-03-09 23:08:09 +0100
committerDavid S. Miller <davem@davemloft.net>2011-03-09 23:08:09 +0100
commit2f4e1b3970973bbb57cc3a3b9d67e67c1c648c37 (patch)
treed7b4d7d64ed8a02c3cd10064eb9d8e177d2be5c3 /net/ipv4/tcp.c
parentipv4: Lookup multicast routes by rtable using helper. (diff)
downloadlinux-2f4e1b3970973bbb57cc3a3b9d67e67c1c648c37.tar.xz
linux-2f4e1b3970973bbb57cc3a3b9d67e67c1c648c37.zip
tcp: ioctl type SIOCOUTQNSD returns amount of data not sent
In contrast to SIOCOUTQ which returns the amount of data sent but not yet acknowledged plus data not yet sent this patch only returns the data not sent. For various methods of live streaming bitrate control it may be helpful to know how much data are in the tcp outqueue are not sent yet. Signed-off-by: Mario Schuknecht <m.schuknecht@dresearch.de> Signed-off-by: Steffen Sledz <sledz@dresearch.de> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/tcp.c')
-rw-r--r--net/ipv4/tcp.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index a17a5a72b98d..b22d45010545 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -505,6 +505,15 @@ int tcp_ioctl(struct sock *sk, int cmd, unsigned long arg)
else
answ = tp->write_seq - tp->snd_una;
break;
+ case SIOCOUTQNSD:
+ if (sk->sk_state == TCP_LISTEN)
+ return -EINVAL;
+
+ if ((1 << sk->sk_state) & (TCPF_SYN_SENT | TCPF_SYN_RECV))
+ answ = 0;
+ else
+ answ = tp->write_seq - tp->snd_nxt;
+ break;
default:
return -ENOIOCTLCMD;
}