[Vm-dev] Unix socket plugin patch for systemd
David T. Lewis
lewis at mail.msen.com
Thu May 2 21:57:53 UTC 2013
On Thu, May 02, 2013 at 10:13:45PM +0200, Max Leske wrote:
> > On Thu, May 02, 2013 at 05:22:07PM +0200, Max Leske wrote:
> > >
> > > We've created a patch for the unix socket plugin that allows for socket activation via systemd.
> > >
> > > This is how it works:
> > > 1. tell systemd to link a socket to the vm (e.g. 8080)
> > > 2. send a request to the socket
> > > 3. systemd will launch the vm and hold the request until the image is connected to the port
> > > 4. (here's where the patch comes in) connect to the socket in the image (e.g. by starting WAKom - WAKom startOn: 8080)
> > >
> > > The patch is necessary because the primitive would fail when connecting to the socket (the plugin thinks that the socket is already in use).
> > >
> > > So here's my question: who is responsible for the plugin or would like to integrate the patch?
> > Hi Max,
> > You've come to the right place. I'm guessing that your patches involve both the Smalltalk
> > (slang) and the platform C code.
> Yes, correct. The (hacky) version right now adds a new type of socket for systemd (now new primitive, maybe you'll want to do that). Then on the image side there's a bit of logic to determine the kind of socket and a consistency check of the systemd environment variable. So all in all it's really quite simple.
> > If so, it may be easiest if you just post the patches to the list for starters, and then we can sort out what needs to be done by whom.
> I'll try to post the patches next week.
> > Please also let us know which code base you are working with (trunk interpreter VM, Cog, other?).
> We use the 4.0.3-2202 interpreter VM and patched the plugin there for now. We also took a look at the newest version from http://gitorious.org/cogvm/blessed/trees/master/platforms/unix/plugins/SocketPlugin and found that there weren't many differences. So we thought to apply the patch to that file. I think it shouldn't be much work to backport the patch to the interpreter VM after that (?).
> Actually, now that I think about it, it would probably make more sense to patch the interpreter VM trunk. That makes it easier for us to test before we post it. Anyway, I'll get back to you.
Yes, and I would suggest that you just post your updated version of sqUnixSocket.c
based on your 4.0.3-2202 source code base. This is the standard Unix VM, and I don't
think that sqUnixSocket.c has changed since 22.214.171.1242. Ian Piumarta (the author)
prefers that we provide him with complete files rather than diffs, and we can easily
sort out whatever differences there are (if any) with the Cog code base and various
Pharo supported versions.
For the Smalltalk changes, a change set or fileout is fine, or you can just provide
a pointer to a Monticello repository if you prefer.
If you want to use the latest code versions, you can work from the up to date code
in Subversion (svn co http://squeakvm.org/svn/squeak) and Monticello VMMaker
(http://source.squeak.org/VMMaker). But it probably does not make any difference
in this case, so I'd suggest to just post whatever you have from the 4.0.3-2202 code
if that is easier for you to do.
> > For more information on contributing to the Unix VM, see Ian's documentation here:
> > http://squeakvm.org/unix/download.html#caveats
> > http://squeakvm.org/cgi-bin/viewvc.cgi/squeak/trunk/platforms/unix/doc/README.Contributing?view=markup
> > There are currently several branches of VM development that will be impacted by
> > a change to SocketPlugin, so we'll make sure they all get updated appropriately.
> That would be awesome!
> > Thanks!
> > Dave
More information about the Vm-dev