[Mono-list] Some bugfixes for mono

Jaroslaw Kowalski jarek@atm.com.pl
Sun, 28 Apr 2002 22:28:13 +0200


This is a multi-part message in MIME format.

------=_NextPart_000_000A_01C1EF03.FBBECB50
Content-Type: text/plain;
	charset="iso-8859-2"
Content-Transfer-Encoding: 7bit

This weekend I've been hacking on socket- and exception- related code:

Here come some patches, I'd like to be introduced in mono (only verified on
RedHat Linux 7.2)

1. Fixed an error where TcpClient returned from
TcpListener::AcceptTcpClient() would return null from GetStream() instead of
correct NetworkStream object.

[patch1.txt]

2. Improved Win32Exception error messages a bit by scanning through source
code looking for WSASetLastError() and adding errors along with their
descriptions to Win32Exception.cs file

[patch2.txt]

3. Attempted to fix a problem where send() to a closed socket resulted in a
signal being raised. Fixed this by including MSG_NOSIGNAL flag in a call to
send(). Also fixed some diagnostics in bind() call.

[patch3.txt]

4. Attempted to fix a problem with assert() being called when an exception
was thrown in a thread (JIT-only). exc_cleanup_id TLS Entry needs to be
filled for newly created threads. I added init_tls() function that is no-op
in MINT code and sets up the required TLS entry in JIT mode.

[patch4.txt]

Hope it helps someone,
Regards,

Jarek

------=_NextPart_000_000A_01C1EF03.FBBECB50
Content-Type: text/plain;
	name="patch3.txt"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="patch3.txt"

Index: sockets.c=0A=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A=
RCS file: /mono/mono/mono/io-layer/sockets.c,v=0A=
retrieving revision 1.7=0A=
diff -r1.7 sockets.c=0A=
304a305,309=0A=
> 	=0A=
> 		case EADDRINUSE:=0A=
> 			WSASetLastError(WSAEADDRINUSE);=0A=
> 			break;=0A=
> =0A=
611a617,619=0A=
> #ifdef MSG_NOSIGNAL=0A=
> 	ret=3Dsend(socket_handle->fd, msg, len, send_flags | MSG_NOSIGNAL);=0A=
> #else=0A=
612a621,622=0A=
> #endif=0A=
> =0A=

------=_NextPart_000_000A_01C1EF03.FBBECB50
Content-Type: text/plain;
	name="patch1.txt"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="patch1.txt"

Index: TcpClient.cs=0A=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A=
RCS file: /mono/mcs/class/System/System.Net.Sockets/TcpClient.cs,v=0A=
retrieving revision 1.3=0A=
diff -r1.3 TcpClient.cs=0A=
95c95=0A=
< 			set { client =3D value; } //TODO: should we be able to set the =
socket like this?=0A=
---=0A=
> 			set { client =3D value; }=0A=
106c106,107=0A=
< 			Client =3D s; // client or Client?  They are the same at the moment=0A=
---=0A=
> 			client =3D s;=0A=
> 			stream =3D new NetworkStream(client, true);=0A=

------=_NextPart_000_000A_01C1EF03.FBBECB50
Content-Type: text/plain;
	name="patch2.txt"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="patch2.txt"

Index: Win32Exception.cs=0A=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A=
RCS file: =
/mono/mcs/class/System/System.ComponentModel/Win32Exception.cs,v=0A=
retrieving revision 1.3=0A=
diff -r1.3 Win32Exception.cs=0A=
74a75,125=0A=
> 			w32_errors.Add(10004,=0A=
> 			    Locale.GetText("interrupted"));=0A=
> =0A=
> 			w32_errors.Add(10013,=0A=
> 			    Locale.GetText("WSAEACCES"));=0A=
> 			w32_errors.Add(11002,=0A=
> 			    Locale.GetText("WSATRY_AGAIN"));=0A=
> 			w32_errors.Add(10022,=0A=
> 			    Locale.GetText("Invalid arguments"));=0A=
> 			w32_errors.Add(10014,=0A=
> 			    Locale.GetText("WSAEFAULT"));=0A=
> 			w32_errors.Add(11003,=0A=
> 			    Locale.GetText("WSANO_RECOVERY"));=0A=
> 			w32_errors.Add(11004,=0A=
> 			    Locale.GetText("WSANO_DATA"));=0A=
> 			w32_errors.Add(10040,=0A=
> 			    Locale.GetText("WSAEMSGSIZE"));=0A=
> 			w32_errors.Add(10024,=0A=
> 			    Locale.GetText("WSAEMFILE"));=0A=
> 			w32_errors.Add(10042,=0A=
> 			    Locale.GetText("WSAENOPROTOOPT"));=0A=
> 			w32_errors.Add(10050,=0A=
> 			    Locale.GetText("Network subsystem is down"));=0A=
> 			w32_errors.Add(10051,=0A=
> 			    Locale.GetText("WSAENETUNREACH"));=0A=
> 			w32_errors.Add(10035,=0A=
> 			    Locale.GetText("WSAEWOULDBLOCK"));=0A=
> 			w32_errors.Add(10036,=0A=
> 			    Locale.GetText("WSAEINPROGRESS"));=0A=
> 			w32_errors.Add(10060,=0A=
> 			    Locale.GetText("WSAETIMEDOUT"));=0A=
> 			w32_errors.Add(10037,=0A=
> 			    Locale.GetText("WSAEALREADY"));=0A=
> 			w32_errors.Add(10061,=0A=
> 			    Locale.GetText("Connection refused"));=0A=
> 			w32_errors.Add(10045,=0A=
> 			    Locale.GetText("WSAEOPNOTSUPP"));=0A=
> 			w32_errors.Add(10038,=0A=
> 			    Locale.GetText("The descriptor is not a socket"));=0A=
> 			w32_errors.Add(10055,=0A=
> 			    Locale.GetText("Not enough buffer space is available"));=0A=
> 			w32_errors.Add(10056,=0A=
> 			    Locale.GetText("Socket is already connected"));=0A=
> 			w32_errors.Add(10048,=0A=
> 			    Locale.GetText("Address already in use"));=0A=
> 			w32_errors.Add(10057,=0A=
> 			    Locale.GetText("The socket is not connected"));=0A=
> 			w32_errors.Add(10058,=0A=
> 			    Locale.GetText("The socket has been shut down"));=0A=
> 			w32_errors.Add(10093,=0A=
> 			    Locale.GetText("Winsock not initialized"));=0A=

------=_NextPart_000_000A_01C1EF03.FBBECB50
Content-Type: text/plain;
	name="patch4.txt"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="patch4.txt"

? metadata/new_threads.c=0A=
? metadata/patches.txt=0A=
Index: metadata/threads.c=0A=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A=
RCS file: /mono/mono/mono/metadata/threads.c,v=0A=
retrieving revision 1.18=0A=
diff -r1.18 threads.c=0A=
79a80=0A=
> 	init_tls();=0A=
Index: metadata/threads.h=0A=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A=
RCS file: /mono/mono/mono/metadata/threads.h,v=0A=
retrieving revision 1.13=0A=
diff -r1.13 threads.h=0A=
20a21=0A=
> extern void init_tls(void);=0A=
Index: jit/jit.c=0A=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A=
RCS file: /mono/mono/mono/jit/jit.c,v=0A=
retrieving revision 1.155=0A=
diff -r1.155 jit.c=0A=
3688a3689,3701=0A=
> void thread_unhandled_exception_cleanup(MonoObject *exc)=0A=
> {=0A=
> 	/* fixme: anything more? */=0A=
> 	=0A=
> 	ExitThread(0);=0A=
> }=0A=
> =0A=
> void =0A=
> init_tls()=0A=
> {=0A=
> 	/* this function is called in the context of newly-created thread */=0A=
> 	TlsSetValue (exc_cleanup_id, thread_unhandled_exception_cleanup);=0A=
> }=0A=
Index: interpreter/interp.c=0A=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A=
RCS file: /mono/mono/mono/interpreter/interp.c,v=0A=
retrieving revision 1.172=0A=
diff -r1.172 interp.c=0A=
3986a3987,3992=0A=
> void =0A=
> init_tls()=0A=
> {=0A=
> 	/* this function is called in the context of newly-created thread */=0A=
> }=0A=
> =0A=

------=_NextPart_000_000A_01C1EF03.FBBECB50--