Hello, first thank you for explanation.
Now regarding the answer...
On Mar 24, 2010, at 7:26 PM, Terry Lambert wrote:
The value returned into the integer mempages by the "hw.physmem" sysctl value in the "ps" program itself has gone negative because you have more than 8TB of memory installed (you don't), all of your tasks_info.resident_size have become similarly corrupt (unlikely), you are using your own "ps" program or "libc" library (more likely).
$ sysctl hw.physmem
hw.physmem: 2147483648
I'm using default ps from mac os distribution.
I can even call it directly /bin/ps, result is the same.
$ ls -la /bin/ps
-rwsr-xr-x 1 root wheel 68432 Aug 20 2006 /bin/ps
libc is also from the last official update:
$ ls -la /usr/lib/libSystem.B.dylib
-r-xr-xr-x 1 root wheel 8008576 Sep 20 2009 /usr/lib/libSystem.B.dylib
Is this an Intel system or a PPC, and if it's Intel, is this running "ps" as a PPC binary? If so, then we are probably talking about bit endienness confusion in the sysctl() implementation in Rosetta, and if so, this is not something that was intended to work.
This is Intel system. I believe I'm running intel binary as I'm calling it directly from bash. So I guess this won't be the case either.
Note that if you are popen'ing the ps program from a program where you've selected "run under Rosetta" in the Finder in order to force the program to run as a PPC binary, it will preferentially cause child subprograms to also run under Rosetta. The theory is that this would allow starting a subtask that talked to the main task using endiend dependent means, such as shared memory, data structures in files, or privately defined Mach messages.
I checked in Activity Monitor.app and there is no ppc binary running. Is there any other way to check if running programs are ppc or intel binaries?
If this is testing for a commercial product intended to run under both PPC and i386, you should either use the "arch" command on the command line, or thin the binary, rather than checking the checkbox in the Finder, in order to avoid this "affinity" behaviour. On a real PPC, this will just work as intended, while on an Inte you should be running the Intel binary preferentially.
serenity:~ toxygen$ arch
i386
It still leaves me confused. I believe the situation can be fixed by restarting the system but I would rather know what was the cause to avoid such state in future.