public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* [ECOS] uipc_socket.c
@ 2005-06-15 22:39 Will Lentz
  2005-06-16  7:06 ` [ECOS] uipc_socket.c (and cyg_tcp_maxidle) Hans Hübner
  0 siblings, 1 reply; 9+ messages in thread
From: Will Lentz @ 2005-06-15 22:39 UTC (permalink / raw)
  To: ecos-discuss; +Cc: Will Lentz

Hi,

I may have found a potential bug in
packages/net/bsd_tcpip/current/src/sys/kern/uipc_socket.c (or I may be
completely wrong :-).

At the end of sodealloc(), the following code exists:
       zfreei(so->so_zone, so);
       wakeup(so->so_zone);
The problem is that zfreei() changes so->so_zone.  Shouldn't wakeup() be
done on the original so->so_zone?  I only noticed this problem by:
1- while(1) { 
   sock = socket( AF_INET, SOCK_STREAM, IPPROTO_TCP );
   connect( sock, ... );
   close( sock );
   }
   Eventually this pauses in socket() (in cyg_tsleep()) when you run out
of eCos sockets.  

2- After 2*MSL or so, cyg_wakeup() gets called with chan == 0x0.  Why?
The zfreei() call in sodealloc() changes so->so_zone to 0 before the
wakeup() call.

The following diff solves the problem for me by making the wakeup() work
on the so_zone that was freed:

--- uipc_socket.c       Thu Jul 24 11:04:25 2003
+++ new_uipc_socket.c   Wed Jun 15 14:54:20 2005
@@ -202,8 +202,12 @@
                FREE(so->so_accf, M_ACCF);
        }
 #endif /* INET */
-       zfreei(so->so_zone, so);
-        wakeup(so->so_zone);
+       {
+               struct vm_zone *tmp = so->so_zone;
+
+               zfreei(so->so_zone, so);
+               wakeup(tmp);
+       }
 }

Any ideas?  Suggestions?

Thanks,
Will


-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

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

end of thread, other threads:[~2005-06-17 21:00 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-06-15 22:39 [ECOS] uipc_socket.c Will Lentz
2005-06-16  7:06 ` [ECOS] uipc_socket.c (and cyg_tcp_maxidle) Hans Hübner
2005-06-16 15:36   ` Will Lentz
2005-06-16 15:51     ` Hans Hübner
2005-06-16 16:06       ` Will Lentz
     [not found]         ` <20050616183534.N69813@web.m68k.de>
2005-06-16 23:45           ` Will Lentz
2005-06-17  7:15             ` Andrew Lunn
2005-06-17 20:12   ` Andrew Lunn
2005-06-17 21:00     ` Will Lentz

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 read-only IMAP folder(s) and NNTP newsgroup(s).