discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Q] DO on AMD64(Linux, x86_64)


From: Matt Rice
Subject: Re: [Q] DO on AMD64(Linux, x86_64)
Date: Tue, 4 Oct 2005 03:34:09 -0700 (PDT)

--- Sungjin Chun <chunsj@embian.com> wrote:

> Hi,
> 
> I've freshly installed GNUstep on My AMD 64 Box
> which has x86_64  
> version of Gentoo Linux. I've installed gnustep-base
> with libffi (not  
> ffcall, if this works, I will try this). I've used
> most current CVS  
> version of gnustep and I found that DO
> applications(I try to run  
> Terminal.app and failed in GDNC related part, so I
> tested with base/ 
> Testing tools) crashes with segmentation fault
> error(Testing/ 
> {nsconnection_server,nsconnection_client}).
> 
> Is there anybody who made successful installation of
> gnustep in AMD64  
> platform?
> 
> Thanks in advance.
> 

i don't really have an amd64 machine, but worked with
some people on #gnustep who did... a while back

IIRC the attached patches fix the NSConnection issue
in most cases. when using NSPortIsMessagePort YES or
NO

though sending the output of the tests run in
dev-apps/test/Testsuite surely helps.
e.g.

# runtests.sh base gui
which will create tests.log and tests.sum files.

though there was a hairier issue when using
structs/ffcall i hadn't quite figured out, but 
tracked down to mframe_next_arg setting an alignment 
which is not a multiple of the structure size

which may effect DO.. visible with the "Can
send/return large structs" test.

iirc the patches add a bunch of new warnings,
which would lead to someone wanting to fix the
warnings,
which would likely lead to the code being broken again
and are kinda ugly, which is why i hadn't proposed
them yet...

but basically every instance of grep -E
"NSInt(Map|Hash)"
is a potential problem on x86 64.

some have been fixed already GSXML,
NSInterfaceStyle that I know of, (which i'm not sure
is really necessary anymore now that we have theme
bundle stuff?)

also worth mentioning that this doesn't usually
segfault immediately, it just seems to corrupt memory
and cause a segfault in the immediate future, so the
backtraces can lead you astray :)

again IIRC the main issue is with this type of code...

int foo = 0;
void *bar = foo;
int baz = (int)bar; /* here lies the problem */

where baz is smaller than bar on amd64, 

so i'd personally like to see NSInt{Map,Hash}...
disavowed from core, and replace internal usage of it
with the pointer callbacks, since it seems to be by
nature platform dependent, if anyone has any thoughts
wrt to that...

there are also issues in back in the
Headers/x11/XGServerWindow.h where GNUstepWMAttributes
all those should be longs if XGServerWindow.m is going
to set the format argument of XChangeProperty to 32.

anyhow..



__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
Index: NSSocketPort.m
===================================================================
RCS file: /cvsroot/gnustep/gnustep/core/base/Source/NSSocketPort.m,v
retrieving revision 1.23
diff -u -r1.23 NSSocketPort.m
--- NSSocketPort.m      8 Jul 2005 11:48:35 -0000       1.23
+++ NSSocketPort.m      24 Jul 2005 07:56:22 -0000
@@ -1837,7 +1837,7 @@
 - (void) getFds: (int*)fds count: (int*)count
 {
   NSMapEnumerator      me;
-  SOCKET               sock;
+  void                         *sock;
   GSTcpHandle          *handle;
   id                   recvSelf;
 
@@ -1864,11 +1864,11 @@
    */
   recvSelf = GS_GC_HIDE(self);
   me = NSEnumerateMapTable(handles);
-  while (NSNextMapEnumeratorPair(&me, (void*)&sock, (void*)&handle))
+  while (NSNextMapEnumeratorPair(&me, &sock, (void*)&handle))
     {
       if (handle->recvPort == recvSelf)
        {
-         fds[(*count)++] = sock;
+         fds[(*count)++] = (SOCKET)sock;
        }
     }
   NSEndMapTableEnumeration(&me);
@@ -1906,7 +1906,7 @@
                    beforeDate: (NSDate*)when
 {
   NSMapEnumerator      me;
-  SOCKET               sock;
+  void                                 *sock;
 #ifndef        BROKEN_SO_REUSEADDR
   int                  opt = 1;
 #endif
@@ -1917,7 +1917,7 @@
    * Enumerate all our socket handles, and look for one with port.
    */
   me = NSEnumerateMapTable(handles);
-  while (NSNextMapEnumeratorPair(&me, (void*)&sock, (void*)&handle))
+  while (NSNextMapEnumeratorPair(&me, &sock, (void*)&handle))
     {
       if ([handle recvPort] == recvPort)
        {
@@ -1932,7 +1932,7 @@
    * Not found ... create a new handle.
    */
   handle = nil;
-  if ((sock = socket(AF_INET, SOCK_STREAM, PF_UNSPEC)) == INVALID_SOCKET)
+  if ((sock = (void *)socket(AF_INET, SOCK_STREAM, PF_UNSPEC)) == 
INVALID_SOCKET)
     {
       NSLog(@"unable to create socket - %s", GSLastErrorStr(errno));
     }
@@ -1943,16 +1943,16 @@
    * that multiple processes can serve the same port simultaneously.
    * We don't want that broken behavior!
    */
-  else if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (char*)&opt,
+  else if (setsockopt((int)sock, SOL_SOCKET, SO_REUSEADDR, (char*)&opt,
     sizeof(opt)) < 0)
     {
-      (void)close(sock);
+      (void)close((int)sock);
       NSLog(@"unable to set reuse on socket - %s", GSLastErrorStr(errno));
     }
 #endif
-  else if ((handle = [GSTcpHandle handleWithDescriptor: sock]) == nil)
+  else if ((handle = [GSTcpHandle handleWithDescriptor: (int)sock]) == nil)
     {
-      (void)close(sock);
+      (void)close((int)sock);
       NSLog(@"unable to create GSTcpHandle - %s", GSLastErrorStr(errno));
     }
   else
Index: NSMessagePort.m
===================================================================
RCS file: /cvsroot/gnustep/gnustep/core/base/Source/NSMessagePort.m,v
retrieving revision 1.20
diff -u -r1.20 NSMessagePort.m
--- NSMessagePort.m     8 Jul 2005 11:48:34 -0000       1.20
+++ NSMessagePort.m     24 Jul 2005 07:35:56 -0000
@@ -1385,7 +1385,7 @@
 - (void) getFds: (int*)fds count: (int*)count
 {
   NSMapEnumerator      me;
-  int                  sock;
+  void                                 *sock;
   GSMessageHandle              *handle;
   id                   recvSelf;
 
@@ -1412,11 +1412,11 @@
    */
   recvSelf = GS_GC_HIDE(self);
   me = NSEnumerateMapTable(handles);
-  while (NSNextMapEnumeratorPair(&me, (void*)&sock, (void*)&handle))
+  while (NSNextMapEnumeratorPair(&me, &sock, (void*)&handle))
     {
       if (handle->recvPort == recvSelf)
        {
-         fds[(*count)++] = sock;
+         fds[(*count)++] = (int)sock;
        }
     }
   NSEndMapTableEnumeration(&me);
@@ -1453,7 +1453,7 @@
                        beforeDate: (NSDate*)when
 {
   NSMapEnumerator      me;
-  int                  sock;
+  void                         *sock;
 #ifndef        BROKEN_SO_REUSEADDR
   int                  opt = 1;
 #endif
@@ -1464,7 +1464,7 @@
    * Enumerate all our socket handles, and look for one with port.
    */
   me = NSEnumerateMapTable(handles);
-  while (NSNextMapEnumeratorPair(&me, (void*)&sock, (void*)&handle))
+  while (NSNextMapEnumeratorPair(&me, &sock, (void*)&handle))
     {
       if ([handle recvPort] == recvPort)
        {
@@ -1479,7 +1479,7 @@
    * Not found ... create a new handle.
    */
   handle = nil;
-  if ((sock = socket(PF_LOCAL, SOCK_STREAM, PF_UNSPEC)) < 0)
+  if ((sock = (void *)socket(PF_LOCAL, SOCK_STREAM, PF_UNSPEC)) < 0)
     {
       NSLog(@"unable to create socket - %s", GSLastErrorStr(errno));
     }
@@ -1490,16 +1490,16 @@
    * that multiple processes can serve the same port simultaneously.
    * We don't want that broken behavior!
    */
-  else if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (char*)&opt,
+  else if (setsockopt((int)sock, SOL_SOCKET, SO_REUSEADDR, (char*)&opt,
     sizeof(opt)) < 0)
     {
-      (void)close(sock);
+      (void)close((int)sock);
       NSLog(@"unable to set reuse on socket - %s", GSLastErrorStr(errno));
     }
 #endif
-  else if ((handle = [GSMessageHandle handleWithDescriptor: sock]) == nil)
+  else if ((handle = [GSMessageHandle handleWithDescriptor: (int)sock]) == nil)
     {
-      (void)close(sock);
+      (void)close((int)sock);
       NSLog(@"unable to create GSMessageHandle - %s", GSLastErrorStr(errno));
     }
   else

reply via email to

[Prev in Thread] Current Thread [Next in Thread]