* [PATCH][DCCP 1/1] Implement SIOCINQ/FIONREAD
@ 2007-10-23 22:51 Arnaldo Carvalho de Melo
2007-10-23 23:51 ` Ian McDonald
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Arnaldo Carvalho de Melo @ 2007-10-23 22:51 UTC (permalink / raw)
To: dccp
Just like UDP.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Leandro Melo de Sales <leandroal@gmail.com>
diff --git a/net/dccp/proto.c b/net/dccp/proto.c
index cc9bf1c..723c29e 100644
--- a/net/dccp/proto.c
+++ b/net/dccp/proto.c
@@ -26,6 +26,7 @@
#include <net/sock.h>
#include <net/xfrm.h>
+#include <asm/ioctls.h>
#include <asm/semaphore.h>
#include <linux/spinlock.h>
#include <linux/timer.h>
@@ -377,9 +378,37 @@ unsigned int dccp_poll(struct file *file, struct socket *sock,
EXPORT_SYMBOL_GPL(dccp_poll);
int dccp_ioctl(struct sock *sk, int cmd, unsigned long arg)
-{
- dccp_pr_debug("entry\n");
- return -ENOIOCTLCMD;
+{
+ int rc = -ENOTCONN;
+
+ lock_sock(sk);
+
+ if (sk->sk_state = DCCP_LISTEN)
+ goto out;
+
+ switch (cmd) {
+ case SIOCINQ: {
+ struct sk_buff *skb;
+ unsigned long amount = 0;
+
+ skb = skb_peek(&sk->sk_receive_queue);
+ if (skb != NULL) {
+ /*
+ * We will only return the amount of this packet since
+ * that is all that will be read.
+ */
+ amount = skb->len;
+ }
+ rc = put_user(amount, (int __user *)arg);
+ }
+ break;
+ default:
+ rc = -ENOIOCTLCMD;
+ break;
+ }
+out:
+ release_sock(sk);
+ return rc;
}
EXPORT_SYMBOL_GPL(dccp_ioctl);
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH][DCCP 1/1] Implement SIOCINQ/FIONREAD
2007-10-23 22:51 [PATCH][DCCP 1/1] Implement SIOCINQ/FIONREAD Arnaldo Carvalho de Melo
@ 2007-10-23 23:51 ` Ian McDonald
2007-10-24 0:25 ` Łeandro Sales
2007-10-24 3:23 ` David Miller
2 siblings, 0 replies; 4+ messages in thread
From: Ian McDonald @ 2007-10-23 23:51 UTC (permalink / raw)
To: dccp
On 10/24/07, Arnaldo Carvalho de Melo <acme@ghostprotocols.net> wrote:
> Just like UDP.
>
> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> Signed-off-by: Leandro Melo de Sales <leandroal@gmail.com>
>
Signed-off-by: Ian McDonald <ian.mcdonald@jandi.co.nz>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH][DCCP 1/1] Implement SIOCINQ/FIONREAD
2007-10-23 22:51 [PATCH][DCCP 1/1] Implement SIOCINQ/FIONREAD Arnaldo Carvalho de Melo
2007-10-23 23:51 ` Ian McDonald
@ 2007-10-24 0:25 ` Łeandro Sales
2007-10-24 3:23 ` David Miller
2 siblings, 0 replies; 4+ messages in thread
From: Łeandro Sales @ 2007-10-24 0:25 UTC (permalink / raw)
To: dccp
Em 23/10/07, Ian McDonald<ian.mcdonald@jandi.co.nz> escreveu:
> On 10/24/07, Arnaldo Carvalho de Melo <acme@ghostprotocols.net> wrote:
> > Just like UDP.
> >
> > Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> > Signed-off-by: Leandro Melo de Sales <leandroal@gmail.com>
> >
> Signed-off-by: Ian McDonald <ian.mcdonald@jandi.co.nz>
>
Signed-off-by: Leandro Melo de Sales <leandroal@gmail.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH][DCCP 1/1] Implement SIOCINQ/FIONREAD
2007-10-23 22:51 [PATCH][DCCP 1/1] Implement SIOCINQ/FIONREAD Arnaldo Carvalho de Melo
2007-10-23 23:51 ` Ian McDonald
2007-10-24 0:25 ` Łeandro Sales
@ 2007-10-24 3:23 ` David Miller
2 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2007-10-24 3:23 UTC (permalink / raw)
To: dccp
From: "£eandro_Sales" <leandroal@gmail.com>
Date: Tue, 23 Oct 2007 21:25:36 -0300
> Em 23/10/07, Ian McDonald<ian.mcdonald@jandi.co.nz> escreveu:
> > On 10/24/07, Arnaldo Carvalho de Melo <acme@ghostprotocols.net> wrote:
> > > Just like UDP.
> > >
> > > Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> > > Signed-off-by: Leandro Melo de Sales <leandroal@gmail.com>
> > >
> > Signed-off-by: Ian McDonald <ian.mcdonald@jandi.co.nz>
> >
>
> Signed-off-by: Leandro Melo de Sales <leandroal@gmail.com>
Applied, thanks everyone.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2007-10-24 3:23 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-23 22:51 [PATCH][DCCP 1/1] Implement SIOCINQ/FIONREAD Arnaldo Carvalho de Melo
2007-10-23 23:51 ` Ian McDonald
2007-10-24 0:25 ` Łeandro Sales
2007-10-24 3:23 ` David Miller
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.