Porting newLISP (AIX)

Started by csstup, April 24, 2007, 11:09:33 AM

Previous topic - Next topic

Lutz

#45
Yes, 86 seems to be right. When I copy/pasted the test.html from the forum I got a trailing space after each line, so: 86 + 6 -> 92. But still, the browser should only show "Hello FISCHERS FRITZ FISCHT FRISCHE FISCHE". See your file served by Apache here: http://www.newlisp.org/test.html">http://www.newlisp.org/test.html This is how it appears also on non-AIX systems when served with newLISP server. Somehow on the AIX machine the HTTP header gets merged with the message.



In the hex-dump and telnet session everything is Ok.



This is weird. With neither compiler we see the error message coming back, but with GCC at least we get the "5" back. In both cases the log shows that the "5" has been sent (error messages don't get logged currently, but I will add this).



I wonder if things change if server and client are on different computers?



To get further to the ground of this, one would have to watch the TCP traffic, compile with debug-statements etc.



I guess we have to leave stop our experiments here. If I get hold of an AIX machine one day, I can investigate further. I believe for non-server modes you should be fine with either compile of newLISP.

nitralime

#46
I have performed the same tests with windows XP as client and AIX as server.

The result is the same as before. I don't want to bother you further.

I know that it is very difficult to make a diagnosis remotely.

I will try to solve this puzzle myself if I have more time.

Thank you very much for your kind support!

hugh.jf.chen

#47
I tried to build newlisp on AIX days ago. I managed to build it successfully after having cleaned up some macro statement in nl_filesystem.c and the result executable, newlisp, runs just fine in the machine where I built newlisp. However,when I copy the executable newlisp to another aix box and try to launch it, it just hung there and doesn't give me the prompt. After I press ctrl+c,it give me a option list with continue,abort,etc and I presss (c)ontinue, then the newlisp prompt just show up. Does any one meet such a problem and have any clue how to fix it?

Lutz

#48
What makefile are you using? There are two in the distribution, but I have never used them myself.



If you do a grep AIX *.c *.h, you will see all the changes for AIX already present. We can add your changes for nl-filesys.c.



You also should compile and run newlisp-x.x.x/util/types.c to check conformance of your AIX OS to either the LP64 or ILP32 memory model conventions. The expected results of running the types program can be found in types.c.

hugh.jf.chen

#49
I've tried the makefiles for gcc and xlc but they both generated the same result. The executale newlisp works fine on the machine I built newlisp but hung on other aix machines.



For the changes to nl_filesys.c,I will give the details once i get access to the machine.



All aix machines are 64 bits and I built it with 64 bit makefile,I just can figure out why this would happen.

hugh.jf.chen

#50
All right,I was back and got the access to the aix machine so I did some test based on lutz's suggestions.



I built the util/types.c and run it,following is the output of types.c:

type      bytes
---------------
char        1
char *      4
void *      4
short int   2
int         4
long        4
long int    4
long long int  8
size_t      4
float       4
double      8
long double 8
wchar_t     2
size_t      4
off_t       4
time_t      4

format input              output
------------------------------------------------
%d     0xffffffff               -1
%u     0xffffffff               4294967295
%d     0x7fffffff               2147483647
%u     0x7fffffff               2147483647
%d     0x80000000               -2147483648
%u     0x80000000               2147483648
%lld     0x7fffffffffffffffLL   9223372036854775807
%llu     0x7fffffffffffffffLL   9223372036854775807
%llx     0xffffffffffffffffLL   ffffffffffffffff
%llX     0x7fffffffffffffffLL   7fffffffffffffff
%llX     0x8000000000000000LL   8000000000000000
%llX   0xFFFFFFFFFFFFFFFFLL     ffffffffffffffff
%llX   0x7FFFFFFFFFFFFFFFLL     7fffffffffffffff
%llX   0x8000000000000000LL     8000000000000000
%lld   0xffffffffffffffffLL -1
%llu   0xffffffffffffffffLL 18446744073709551615
%lld   0x7fffffffffffffffLL 9223372036854775807
%llu   0x7fffffffffffffffLL 9223372036854775807
%lld   0x8000000000000000LL -9223372036854775808
%llu   0x8000000000000000LL 9223372036854775808

CPU is big endian
The constant __BIG_ENDIAN__ is defined by the compiler

size of struct {char, short int, int} is: 8
size of struct {char, int, short int} is: 12
size of struct {char, short int, long, int} is: 12
size of struct {char, long, short int, int} is: 16

9223372036854775807 * 1000 = -1000
11 % -4 = 3


Following are the changes I'd made to nl_filesys.c:
*** newlisp-10.5.3/nl-filesys.c Wed Jul 10 00:13:06 2013
--- newlisp-10.5.3.new/nl-filesys.c Wed Jul 31 14:06:39 2013
***************
*** 1615,1622 ****
--- 1615,1624 ----
  #if defined(SUNOS) || defined(LINUX) || defined(CYGWIN)
  memcpy(&thisFdSet, &myFdSet, sizeof(fd_set));
  #else
+ #ifndef AIX
  FD_COPY(&myFdSet, &thisFdSet);
  #endif
+ #endif
 
  if(mode == SELECT_READ_READY)
      ready = select(FD_SETSIZE, &thisFdSet, NULL, NULL, &tv);
***************
*** 2584,2593 ****
--- 2586,2597 ----
  struct tm *ltm;
  #ifndef SUNOS
  #ifndef OS2
+ #ifndef AIX
  INT gmtoff;
  UINT isdst;
  #endif
  #endif
+ #endif
  #else /* WINDOWS */
  TIME_ZONE_INFORMATION timeZone;
  #endif
***************
*** 2607,2618 ****
--- 2611,2626 ----
  ltm = localtime((time_t *)&tv.tv_sec);
  #ifndef SUNOS
  #ifndef OS2
+ #ifndef AIX
  isdst = ltm->tm_isdst;
+ #endif
 
  #ifdef CYGWIN
  gmtoff = _timezone/60;
  #else
+ #ifndef AIX
  gmtoff = ltm->tm_gmtoff/60;
+ #endif
  #endif
 
  #endif


I still can't figure out the hung problem. If any one can give some suggestions?

hugh.jf.chen

#51
Well,I did more tests and found that the built executable just runs find on some aix machines while hung on some aix machines. So looks like there're some execution restrictions on some machines. I'll go to our sys admin for this problem. Thanks

Lutz

#52
Glad you could figure it out Hugh. The output from types.c looks exactly as expected from the ILP32 memory model. I made a new makefile_aixILP32_utf8_gcc and also added your modifications to nl-filesys.c, but with some small changes:



Also added rickyboy's improvements to qa-libffi.



http://www.newlisp.org/downloads/development/inprogress/">http://www.newlisp.org/downloads/develo ... nprogress/">http://www.newlisp.org/downloads/development/inprogress/