Linux Socket Support

Chris Double chris at double.co.nz
Tue Jul 21 13:51:41 UTC 2009


I found the issue. The problem is in vm/src/unix/prims/unixPrims.cpp.
The address in set_sockaddr_in isn't copied under Linux. The fix is:

 #   if  TARGET_OS_VERSION == SOLARIS_VERSION  \
-    ||  TARGET_OS_VERSION == MACOSX_VERSION
+    ||  TARGET_OS_VERSION == MACOSX_VERSION   \
+    ||  TARGET_OS_VERSION == LINUX_VERSION
     memcpy((char*) &aLong, address, sizeof(long));
     memset(a.sin_zero, 0, sizeof(a.sin_zero));

I've put a git repository up with the following fixes:

1) The fix for the above issue
2) Added socketConstants for Linux
3) Fix to get the build working under Linux - uses flex, and modifies
an include header line for <new>.

Note that for (2) I manually edited objects/core/unix.self. I'm not
sure if this is the right way to do it. I originally did the change
under the UI but didn't know how to file it out such that it will be
recreated when bootstrapping a new image.

The changes are in my fork of the github self repository in the master
branch: git://github.com/doublec/self.git

To test it you can file in the web browser code:

  bootstrap read: 'webBrowser' From: 'applications/webBrowser'

Then in a shell:

  'http://www.w3.org/' asURL getPageForUser

Unfortunately it shows an error page since this browser doesn't
support HTTP 1.1. Just about every webserver around uses virtual hosts
and it doesn't send a Host: header. But the error page is the HTML
served from the W3C website so it shows the browser and socket code
working.

Chris.
-- 
http://www.bluishcoder.co.nz



More information about the Self-interest mailing list