linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* tcp_recvmsg() in 2.4.4
@ 2001-06-07 17:59 Eric Barton
  2001-06-08 15:29 ` David S. Miller
  2001-06-25  4:43 ` Is SIOCGIFCOUNT implemented under 2.4.0 Nagendra Singh Tomar
  0 siblings, 2 replies; 4+ messages in thread
From: Eric Barton @ 2001-06-07 17:59 UTC (permalink / raw)
  To: linux-kernel


If there are no packets on sk->recieve_queue, and nothing has been copied
to userland yet, it seems to me there is a redundant test of sk->done.

About line 1461 in net/ipv4/tcp.c:

		/* Well, if we have backlog, try to process it now yet. */

		if (copied >= target && sk->backlog.tail == NULL)
			break;

		if (copied) {
			if (sk->err ||
			    sk->state == TCP_CLOSE ||
			    (sk->shutdown & RCV_SHUTDOWN) ||
			    !timeo ||
			    (flags & MSG_PEEK))
				break;
		} else {
			if (sk->done)
				break;

			if (sk->err) {
				copied = sock_error(sk);
				break;
			}

			if (sk->shutdown & RCV_SHUTDOWN)
				break;

			if (sk->state == TCP_CLOSE) {
				if (!sk->done) {
					/* This occurs when user tries to read
					 * from never connected socket.
					 */
					copied = -ENOTCONN;
					break;
				}
				break;
			}

			if (!timeo) {
				copied = -EAGAIN;
				break;
			}
		}

When it get to if(sk->state == TCP_CLOSE), surely sk->done has already been
tested (and the socket is locked), so -ENOTCONN could be returned
immediately.

Actually I'd really appreciate it if someone could explain the order of
tests for sk->done, sk->err, sk->shutdown and sk->state...

--

                Cheers,
                        Eric

----------------------------------------------------
|Eric Barton        Barton Software                |
|9 York Gardens     Tel:    +44 (117) 923 9831     |
|Clifton            Mobile: +44 (7909) 680 356     |
|Bristol BS8 4LL    Fax:    call first             |
|United Kingdom     E-Mail: eric@bartonsoftware.com|
----------------------------------------------------


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: tcp_recvmsg() in 2.4.4
  2001-06-07 17:59 tcp_recvmsg() in 2.4.4 Eric Barton
@ 2001-06-08 15:29 ` David S. Miller
  2001-06-08 17:08   ` Alan Cox
  2001-06-25  4:43 ` Is SIOCGIFCOUNT implemented under 2.4.0 Nagendra Singh Tomar
  1 sibling, 1 reply; 4+ messages in thread
From: David S. Miller @ 2001-06-08 15:29 UTC (permalink / raw)
  To: Eric Barton; +Cc: linux-kernel


Eric Barton writes:
 > When it get to if(sk->state == TCP_CLOSE), surely sk->done has already been
 > tested (and the socket is locked), so -ENOTCONN could be returned
 > immediately.

We sleep and drop the lock during these loops, so we need to retest
this each time we wake back up.

 > Actually I'd really appreciate it if someone could explain the order of
 > tests for sk->done, sk->err, sk->shutdown and sk->state...

Most of the error test ordering is specified by POSIX somewhere.

Alan would know better.

Later,
David S. Miller
davem@redhat.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: tcp_recvmsg() in 2.4.4
  2001-06-08 15:29 ` David S. Miller
@ 2001-06-08 17:08   ` Alan Cox
  0 siblings, 0 replies; 4+ messages in thread
From: Alan Cox @ 2001-06-08 17:08 UTC (permalink / raw)
  To: David S. Miller; +Cc: Eric Barton, linux-kernel

>  > Actually I'd really appreciate it if someone could explain the order of
>  > tests for sk->done, sk->err, sk->shutdown and sk->state...
> 
> Most of the error test ordering is specified by POSIX somewhere.

I ordered them that way to match the list given in the posix 1003.1g draft 6.4
specification. 


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Is SIOCGIFCOUNT implemented under 2.4.0
  2001-06-07 17:59 tcp_recvmsg() in 2.4.4 Eric Barton
  2001-06-08 15:29 ` David S. Miller
@ 2001-06-25  4:43 ` Nagendra Singh Tomar
  1 sibling, 0 replies; 4+ messages in thread
From: Nagendra Singh Tomar @ 2001-06-25  4:43 UTC (permalink / raw)
  To: linux-kernel

Hi All !
	Just wanted to know whether SIOCGIFCOUNT ioctl is implemented in
linux kernel >= 2.4.0. It gives me EINVAL, I browsed thru the code and
concluded that this ioctl is not implemented. Am I correct ???

regards
tom



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2001-06-25  4:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-06-07 17:59 tcp_recvmsg() in 2.4.4 Eric Barton
2001-06-08 15:29 ` David S. Miller
2001-06-08 17:08   ` Alan Cox
2001-06-25  4:43 ` Is SIOCGIFCOUNT implemented under 2.4.0 Nagendra Singh Tomar

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).