[squeak-dev] Re: [Vm-dev] OSProcess in Cog

Rob Withers reefedjib at yahoo.com
Mon Jul 26 03:01:12 UTC 2010



--------------------------------------------------
From: "David T. Lewis" <lewis at mail.msen.com>
Sent: Sunday, July 25, 2010 3:01 PM
To: "The general-purpose Squeak developers list" 
<squeak-dev at lists.squeakfoundation.org>
Cc: "Squeak Virtual Machine Development Discussion" 
<vm-dev at lists.squeakfoundation.org>
Subject: Re: [squeak-dev] Re: [Vm-dev] OSProcess in Cog

>
> On Sun, Jul 25, 2010 at 12:24:33PM -0400, Rob Withers wrote:
>>
>> --------------------------------------------------
>> From: "David T. Lewis" <lewis at mail.msen.com>
>> Sent: Sunday, July 25, 2010 11:58 AM
>> To: "Squeak Virtual Machine Development Discussion"
>> <vm-dev at lists.squeakfoundation.org>
>> Cc: "Squeak Dev" <squeak-dev at lists.squeakfoundation.org>
>> Subject: Re: [Vm-dev] OSProcess in Cog
>>
>> >
>> >On Sun, Jul 25, 2010 at 10:59:04AM -0400, Rob Withers wrote:
>> >>
>> >>I am trying to load and run OSProcess in Cog.  I loaded:
>> >>
>> >>   OSProcess-Base
>> >>   OSProcess-AIO
>> >>   OSProcess-Win32
>> >>   OSProcess-Unix
>> >>   OSProcess-Tests
>> >>
>> >>Then ran the tests.  Many failures.
>> >>
>> >>I looked at the vm and there is no ProcessPlugin or OSProcessPlugin.
>> >>Should there be?
>> >
>> >OSProcess will not work without the OSProcessPlugin. AFAIK no one has
>> >tried this yet (including me - sorry I've been quite busy lately).
>> >
>>
>> What about the AIOPlugin?
>
> AIOPlugin is Unix only, and totally optional. OSProcess and CommandShell
> will both work without it.
>

I see.  I am including in hopes that I get the cross-platform thing working 
for unix.

>> >>What should I do?
>> >
>> >If you are compiling your own COG VM, then load OSProcessPlugin from
>> >SqueakSource and give it a try. But just to set expectations, I will
>> >be (pleasantly) surprised if it works the first time without
>> >modifications,
>> >so consider it pre-alpha at this point.
>>
>> I loaded the OSProcessPlugin package and generated sources under Windows.
>> I built using Cygwin.  It gave me a Win32OSProcessPlugin.dll.
>>
>> I ran the tests.  It said I don't have the AIOPlugin so it was using
>> polling (I think that is what it  said).  Tests failed in
>> AioEventHandlerTestCase (failures) and OSPipeTestCase (errors).  Many
>> OSPipeTestCase failures have to do with AttachableFileStream being 
>> closed.
>>
>> I tried the following code and it failed because stdout was closed:
>>
>> ThisOSProcess thisOSProcess openConsole.
>> ThisOSProcess thisOSProcess stdOut
>> nextPutAll: ('error count: ',
>> CryptoDESTest suite run errorCount asString);
>> flush.
>>
>> Which is what I need OSProcess for.
>
> On Windows, you will need to do one hack in order for this to work.
> In the platforms sources, edit platforms/win32/vm/sqWin32HandleTable.h
> and disable the handle registry checking. IIRC, you can just hack
> the IsHandleInTable() function to always return true.
>

I did this, recompiled, launched Cog with my test image, and I am still 
getting the same failures and errors.

>> Another issue: I am trying to generate sources so I can move them from
>> Win32 to Unix and compile the vm there.  I cannot run VMMaker on linux - 
>> it
>> is headless/no X.  I noticed that the OSProcessPlugin generates per
>> platform, and in fact there is platform support code.  So under Windows, 
>> we
>> generate a Win32OSProcessPlugin.  Under Unix I assume it generates a
>> UnixOSProcessPlugin.  Is there any way I can generate a 
>> UnixOSProcessPlugin
>> under Windows?
>
> Open your VMMaker window in Squeak, click the "Find platform" button,
> and change from "Win32" to "unix". Generate your sources, and you
> should have the Unix variant of OSProcessPlugin rather than the Windows
> flavor.
>

First thing is Cog doesn't use the window, it uses this script:

	(VMMaker
		generate: CoInterpreter
		to: (FileDirectory default / '..\src') fullName
		platformDir: (FileDirectory default / '..\platforms') fullName
		excluding:#(BrokenPlugin IA32ABIPluginSimulator SlangTestPlugin 
TestOSAPlugin))

Second, I tried using the window, changes the intepreterClass to 
'CoInterpreter', set the platform path, set the sources path, and clicked 
"Find platform" and selected "unix".  This did not change the text entry 
value.

Third, I set self halts in UnixOSProcessPlugin class>>#shouldBeTranslated 
and Win32OSProcessPlugin class>>#shouldBeTranslated.   The unix side 
eventually calls:

UnixOSProcessPlugin class>>#isResponsibleForThisPlatform
	"Answer true is this is an instance of the class which is responsible for 
representing
	the OS process for the Squeak VM running on the current platform. A false 
answer is
	usually the result of running the image on a different platform and VM.
	Note: Keep this method is sync with OSProcess>>isUnix."

	| numericOsVersion |

	^ (self platformName = 'unix') or:
		[numericOsVersion := self osVersion asInteger ifNil: [0].
		(self platformName = 'Mac OS') and: [numericOsVersion >= 1000]]

and this calls:

OSProcessPlugin class>>#platformName
	"After Squeak version 3.6, #platformName was moved to SmalltalkImage "

	^ ((Smalltalk classNamed: 'SmalltalkImage')
		ifNil: [^ Smalltalk platformName]) current platformName

which kills any hope of being a cross-compiled source.

I would really like to fix the Win32 bugs first.  Could you help me with 
that?

Thanks,
Rob

> In principle should should work for all of the sources, although
> I have not tried. It definitely should produce correct Unix sources
> for OSProcessPlugin, AIOPlugin, and XDisplayControlPlugin (though
> I don't have a Windows system handy to check).
>
> Note that the handle registry issue mentioned above applies only
> for building the Windows plugin to run on a Windows platform. There
> is no such handle registry on Unix and Mac.
>
> Dave
> 



More information about the Squeak-dev mailing list