[squeak-dev] Using OSProcess

David T. Lewis lewis at mail.msen.com
Sun Nov 21 04:17:45 UTC 2010


On Sat, Nov 20, 2010 at 10:52:20AM -0800, Eliot Miranda wrote:
> 
> On Sat, Nov 20, 2010 at 9:07 AM, David T. Lewis <lewis at mail.msen.com> wrote:
> >
> > As far as I know, then only part of OSProcess/CommandShell that
> > does not work in Cog is the #forkSqueak methods. Unfortunately,
> > #forkSqueak is used extensively in the unit tests, so be careful
> > about running those under Cog. But all other OSProcess and CommandShell
> > functions seem to work fine in Cog.
> >
> 
> Any idea what it is about forkSqueak that breaks Cog?

First, I need to be clear in saying that the Cog VM is not crashing, the
OSPP plugin is doing something that is *causing* the VM to crash. The
#forkSqueak method in the primitive turns off the interval timer prior
to doing the fork() and reestablishes if afterwards. This is to prevent
the child Squeak process from crashing on a timer interrupt. Timers are
reestablished in both the parent and child after the fork(), and both
processes carry on happily afterwards. Presumably this is doing something
nasty to the Cog VM, but I'm not sure exactly where the problem is (oddly,
it shows up as a X protocol error, but that's clearly not the root cause).

Aside from the VM crash problem, which clearly needs to be fixed in OSPP,
there is the secondary issue of making #forkSqueak actually work properly
on a Cog VM. I have not really looked into this, but I expect it to be
non-trivial because Cog requires pthreads to perform timer functions for
the VM, and I don't think that pthreads survive a fork(). So I expect at
minimum we would need some function callable from a primitive that will
initialize a new timer thread in a newly forked Cog VM. But I need to
emphasize that I have not actually looked at this, I'm just speculating
as to what would need to be done.

To be prefectly honest I have been stumped by libtool, which so far has
been unwilling to permit me to build a 32 bit Cog VM on my 64 bit Linux
system. I suspect that this may be part of the reason that Ian dumped the
old build system in favor of CMake. I'm sure I'm doing something dumb here,
but for the moment I can't debug OSPP because I can't built a 32-bit
Cog VM with the old build system on my 64-bit Linux system.

FWIW, I am feeding this to the configure script, which is enough to get
the interpreter to build, but the plugins (including vm-display-X11) are
still barfing on 32/64 bit build issues:

../../platforms/unix/config/configure LDPATH="/lib:/usr/lib" LDFLAGS="-m32" CFLAGS="-g -O2 -m32 -msse2 -D_GNU_SOURCE -DNDEBUG -DITIMER_HEARTBEAT=1 -DNO_VM_PROFILE=1 -DCOGMTVM=0 -DDEBUGVM=0" LIBS=-lpthread

Dave




More information about the Squeak-dev mailing list