Message ID | 1299228497-21246-1-git-send-email-sledz@dresearch.de |
---|---|
State | Changes Requested, archived |
Delegated to: | David Miller |
Headers | show |
Am 04.03.2011 10:04, schrieb David Miller: > From: Steffen Sledz <sledz@dresearch.de> > Date: Fri, 4 Mar 2011 09:48:17 +0100 > >> diff --git a/include/asm-generic/ioctls.h b/include/asm-generic/ioctls.h >> index 199975f..ef2be0b 100644 >> --- a/include/asm-generic/ioctls.h >> +++ b/include/asm-generic/ioctls.h >> @@ -74,6 +74,7 @@ >> #define TCSETXW 0x5435 >> #define TIOCSIG _IOW('T', 0x36, int) /* pty: generate signal */ >> #define TIOCVHANGUP 0x5437 >> +#define TIOCOUTQNSD 0x5438 >> >> #define FIONCLEX 0x5450 >> #define FIOCLEX 0x5451 > > Hitting only asm-generic/ioctls.h is insufficient, many architectures do > not make use of this file and the build will fail for them with your patch > applied. That's not fully clear to me. We made the define similar to the existing TIOCOUTQ. What other files should be hit? Steffen Sledz
On Friday 04 March 2011 10:51:29 Steffen Sledz wrote: > Am 04.03.2011 10:04, schrieb David Miller: > > Hitting only asm-generic/ioctls.h is insufficient, many architectures do > > not make use of this file and the build will fail for them with your patch > > applied. > > That's not fully clear to me. > > We made the define similar to the existing TIOCOUTQ. What other files should be hit? > These ones: $ git grep TIOCOUTQ arch/*/include/ arch/alpha/include/asm/ioctls.h:#define TIOCOUTQ _IOR('t', 115, int) /* output queue size */ arch/mips/include/asm/ioctls.h:#define TIOCOUTQ 0x7472 /* output queue size */ arch/parisc/include/asm/ioctls.h:#define TIOCOUTQ 0x5411 arch/powerpc/include/asm/ioctls.h:#define TIOCOUTQ _IOR('t', 115, int) /* output queue size */ arch/sh/include/asm/ioctls.h:#define TIOCOUTQ _IOR('t', 115, int) /* output queue size */ arch/sparc/include/asm/ioctls.h:#define TIOCOUTQ _IOR('t', 115, int) arch/xtensa/include/asm/ioctls.h:#define TIOCOUTQ _IOR('t', 115, int) /* output queue size */ Arnd -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/include/asm-generic/ioctls.h b/include/asm-generic/ioctls.h index 199975f..ef2be0b 100644 --- a/include/asm-generic/ioctls.h +++ b/include/asm-generic/ioctls.h @@ -74,6 +74,7 @@ #define TCSETXW 0x5435 #define TIOCSIG _IOW('T', 0x36, int) /* pty: generate signal */ #define TIOCVHANGUP 0x5437 +#define TIOCOUTQNSD 0x5438 #define FIONCLEX 0x5450 #define FIOCLEX 0x5451 diff --git a/include/linux/sockios.h b/include/linux/sockios.h index 241f179..4c5ca47 100644 --- a/include/linux/sockios.h +++ b/include/linux/sockios.h @@ -23,6 +23,7 @@ /* Linux-specific socket ioctls */ #define SIOCINQ FIONREAD #define SIOCOUTQ TIOCOUTQ +#define SIOCOUTQNSD TIOCOUTQNSD /* Routing table calls. */ #define SIOCADDRT 0x890B /* add routing table entry */ diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index a17a5a7..b22d450 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; }