[squeak-dev] Re: netstyle.ch, Cog, systemd, and Socket>>initialize:
maxleske at gmail.com
Wed Dec 3 20:07:21 UTC 2014
> On 03.12.2014, at 19:22, Chris Cunnington <brasspen at gmail.com> wrote:
>> On Dec 3, 2014, at 12:28 PM, Max Leske <maxleske at gmail.com <mailto:maxleske at gmail.com>> wrote:
>> Hi Chris
>>> On 03.12.2014, at 16:22, Chris Cunnington <brasspen at gmail.com <mailto:brasspen at gmail.com>> wrote:
>>> In July netstyle.ch <http://netstyle.ch/> said some exciting things about systemd and socket activation.  I have an observation and a question.
>>> The observation is that to set Real Time Priority pursuant of the README for Cog you need to add the following in your Service or you will not be able to start coglinuxht. 
>>> The question concerns the code in the systemd.cs file  which I don't think can work because it calls a non-existant primitive in the SocketPlugin. I suspect netstyle.ch <http://netstyle.ch/> wrote its patch for a very old virtual machine, one that still used #primitiveSocketCreate3Semaphores, which I don't think exists in contemporary SocketPlugin code.  In the image, there remain references to this non-existant primitive. They are employed by code in the systemd.cs file. The culprit is Socket>>initialize: used in Socket class>>newSystemd.
>> It seems you are right. We did use a Pharo1.3 image with an older VM to test the patch. However, I’m sure that we used the latest version from trunk for the patch (which was 3016 at the time). Also, if I’m not looking in the wrong place, that primitive is still there: http://squeakvm.org/cgi-bin/viewvc.cgi/squeak/trunk/src/plugins/SocketPlugin/SocketPlugin.c?view=log <http://squeakvm.org/cgi-bin/viewvc.cgi/squeak/trunk/src/plugins/SocketPlugin/SocketPlugin.c?view=log>.
>> Does that resolve the issue? If not, please get back to me and I’ll try to fix the situation.
> Hi Max,
> Thank you very much for your quick response. I have no doubt that I've made a mistake and will look at it further. I've been at this alone for a while, so I'm sure your feedback will resolve the issue. If not, in about a week, I'd like to ask another question.
> Thanks to you and the netstyle.ch <http://netstyle.ch/> team for sharing this. It's a lot of fun.
Thank you. It’s great that its something that people use and that doesn’t just collect virtual dust.
>>> So, Max, my question is, did you at netstyle.ch <http://netstyle.ch/> find a solution for this?
>>> Does anybody have an idea of how to re-route Socket>>initialize: towards a primitive that actually exists?
>>>  http://lists.squeakfoundation.org/pipermail/squeak-dev/2014-July/179015.html <http://lists.squeakfoundation.org/pipermail/squeak-dev/2014-July/179015.html>
>>>  http://www.freedesktop.org/software/systemd/man/systemd.exec.html <http://www.freedesktop.org/software/systemd/man/systemd.exec.html>
>>>  http://squeakvm.org/cgi-bin/viewvc.cgi/squeak/trunk/platforms/unix/ <http://squeakvm.org/cgi-bin/viewvc.cgi/squeak/trunk/platforms/unix/>
>>>  contents of the systemd.cs file :
>>> 'From Pharo1.3 of 16 June 2011 [Latest update: #13315] on 4 July 2014 at 3:20:20 pm'!
>>> !TcpListener methodsFor: '*systemd' stamp: 'nl 07/04/2014 15:17'!
>>> "LISTEN_FDS is set by systemd if the process/pharo-vm is started via port activation"
>>> ^ (self primEnvironmentAtSymbol: 'LISTEN_FDS')
>>> ifNotNilDo: [ :value | value asNumber = 1 ]
>>> ifNil: [ false]! !
>>> !TcpListener methodsFor: '*systemd' stamp: 'nl 07/04/2014 15:18'!
>>> pvtNewListener: backlogSize
>>> "Create a new socket that listens on our port. The backlog is how many simultaneous
>>> connections to accept at the same time
>>> Use the socket assigned by systemd if:
>>> - the command-line port number is equal to the portNumber to be opened
>>> - there is an environment variable LISTEN_FDS with value 1
>>> Otherwise use normal port allocation.
>>> | listener |
>>> listener := (self haveSystemdAssignedPort
>>> ifTrue: [ self socketClass newSystemd ]
>>> ifFalse: [ self socketClass newTCP ]).
>>> self socketsToDestroy add: listener.
>>> bind: listener
>>> withBacklogSize: backlogSize.
>>> ^ listener! !
>>> !TcpListener methodsFor: '*systemd' stamp: 'nl 04/29/2013 14:04'!
>>> primEnvironmentAtSymbol: aSymbol
>>> "Copy-paste from UnixOSProcessPlugin: Answer the value of an environment variable in the external OS process."
>>> <primitive: 'primitiveEnvironmentAtSymbol' module: 'UnixOSProcessPlugin'>
>>> ^ nil ! !
>>> !Socket class methodsFor: '*systemd' stamp: 'nl 07/04/2014 15:23'!
>>> "Create a socket assigned by systemd port activation"
>>> | SystemdSocketType |
>>> SystemdSocketType := 2.
>>> self initializeNetwork.
>>> ^[ super new initialize: SystemdSocketType ]
>>> repeatWithGCIf: [ :socket | socket isValid not ]! !
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Squeak-dev