Revision: 3748 Author: lewis Date: 2016-08-28 08:56:19 -0700 (Sun, 28 Aug 2016) Log Message: ----------- Mantis 0007819: Add Systemd socket activation patch for the VM in SocketPlugin Patch by Max Leske <maxleske at gmail.com> and Nik Lutz, with socket type definitions as per oscog branch. Note that ProvidedTCPSocketType is now defined as 65536, whereas the original patch (as implemented for cmsbox) defined it as 2. This update is already present in oscog for Cog and Spur VMs. Modified Paths: -------------- trunk/platforms/unix/plugins/SocketPlugin/sqUnixSocket.c Modified: trunk/platforms/unix/plugins/SocketPlugin/sqUnixSocket.c =================================================================== --- trunk/platforms/unix/plugins/SocketPlugin/sqUnixSocket.c 2016-08-10 19:32:25 UTC (rev 3747) +++ trunk/platforms/unix/plugins/SocketPlugin/sqUnixSocket.c 2016-08-28 15:56:19 UTC (rev 3748) @@ -93,6 +93,12 @@ # define MAXHOSTNAMELEN 256 #endif +#ifdef HAVE_SD_DAEMON +# include <systemd/sd-daemon.h> +#else +# define SD_LISTEN_FDS_START 3 +# define sd_listen_fds(u) 0 +#endif /* debugging stuff. can probably be deleted */ @@ -117,10 +123,22 @@ /*** Socket types ***/ -#define TCPSocketType 0 -#define UDPSocketType 1 +#define TCPSocketType 0 /* SOCK_STREAM on AF_INET or AF_INET6 */ +#define UDPSocketType 1 /* SOCK_DGRAM on AF_INET or AF_INET6 */ +#define RAWSocketType 2 /* SOCK_RAW on AF_INET or AF_INET6 */ +#define SeqPacketSocketType 3 /* SOCK_SEQPACKET on AF_INET or AF_INET6 */ +#define ReliableDGramSocketType 4 /* SOCK_RDM on AF_INET or AF_INET6 */ +#define ReuseExistingSocket 65536 +#define ProvidedTCPSocketType (TCPSocketType + ReuseExistingSocket) +#define ProvidedUDPSocketType (UDPSocketType + ReuseExistingSocket) +#define ProvidedRAWSocketType (RAWSocketType + ReuseExistingSocket) +#define ProvidedSeqPacketSocketType (SeqPacketSocketType + ReuseExistingSocket) +#define ProvidedReliableDGramSocketType (ReliableDGramSocketType + ReuseExistingSocket) + + + /*** Resolver states ***/ #define ResolverUninitialised 0 @@ -549,6 +567,20 @@ /* --- UDP --- */ newSocket= socket(domain, SOCK_DGRAM, 0); } + else if (ProvidedTCPSocketType == socketType) + { + /* --- Existing socket --- */ + if (sd_listen_fds(0) == 0) + { + socketType = TCPSocketType; + newSocket= SD_LISTEN_FDS_START + 0; + } + else + { + interpreterProxy->success(false); + return; + } + } if (-1 == newSocket) { /* socket() failed, or incorrect socketType */ |
Shouldn't this patch go to the new OpenSmalltalk-VM repository at:
Best, Fabio -- On Sun, Aug 28, 2016 at 5:56 PM <[hidden email]> wrote:
|
On Sun, Aug 28, 2016 at 04:56:10PM +0000, Fabio Niephaus wrote: > > Shouldn't this patch go to the new OpenSmalltalk-VM repository at: > https://github.com/OpenSmalltalk/opensmalltalk-vm ? Is anyone interested in building context interpreter VMs from the platforms tree on Github and/or making the Cmake build process work in that environment? The Cmake build for interpreter VM expects to use the SVN repository, and I certainly would like to keep that healthy if possible. I don't know if there is any interest in updating that code in Github, given that stack interpreter VMs are intended to replace the context interpreter anyway. Comments? Dave > > Best, > Fabio > > -- > > On Sun, Aug 28, 2016 at 5:56 PM <[hidden email]> wrote: > > > > > Revision: 3748 > > Author: lewis > > Date: 2016-08-28 08:56:19 -0700 (Sun, 28 Aug 2016) > > Log Message: > > ----------- > > Mantis 0007819: Add Systemd socket activation patch for the VM in > > SocketPlugin > > > > Patch by Max Leske <maxleske at gmail.com> and Nik Lutz, with socket type > > definitions as per oscog branch. > > > > Note that ProvidedTCPSocketType is now defined as 65536, whereas the > > original patch (as implemented for cmsbox) defined it as 2. > > > > This update is already present in oscog for Cog and Spur VMs. > > > > Modified Paths: > > -------------- > > trunk/platforms/unix/plugins/SocketPlugin/sqUnixSocket.c > > > > Modified: trunk/platforms/unix/plugins/SocketPlugin/sqUnixSocket.c > > =================================================================== > > --- trunk/platforms/unix/plugins/SocketPlugin/sqUnixSocket.c 2016-08-10 > > 19:32:25 UTC (rev 3747) > > +++ trunk/platforms/unix/plugins/SocketPlugin/sqUnixSocket.c 2016-08-28 > > 15:56:19 UTC (rev 3748) > > @@ -93,6 +93,12 @@ > > # define MAXHOSTNAMELEN 256 > > #endif > > > > +#ifdef HAVE_SD_DAEMON > > +# include <systemd/sd-daemon.h> > > +#else > > +# define SD_LISTEN_FDS_START 3 > > +# define sd_listen_fds(u) 0 > > +#endif > > > > /* debugging stuff. can probably be deleted */ > > > > @@ -117,10 +123,22 @@ > > > > /*** Socket types ***/ > > > > -#define TCPSocketType 0 > > -#define UDPSocketType 1 > > +#define TCPSocketType 0 /* SOCK_STREAM on AF_INET or > > AF_INET6 */ > > +#define UDPSocketType 1 /* SOCK_DGRAM on AF_INET or > > AF_INET6 */ > > +#define RAWSocketType 2 /* SOCK_RAW on AF_INET or > > AF_INET6 */ > > +#define SeqPacketSocketType 3 /* SOCK_SEQPACKET on AF_INET or > > AF_INET6 */ > > +#define ReliableDGramSocketType 4 /* SOCK_RDM on AF_INET or > > AF_INET6 */ > > > > +#define ReuseExistingSocket 65536 > > > > +#define ProvidedTCPSocketType (TCPSocketType + > > ReuseExistingSocket) > > +#define ProvidedUDPSocketType (UDPSocketType + > > ReuseExistingSocket) > > +#define ProvidedRAWSocketType (RAWSocketType + > > ReuseExistingSocket) > > +#define ProvidedSeqPacketSocketType (SeqPacketSocketType + > > ReuseExistingSocket) > > +#define ProvidedReliableDGramSocketType (ReliableDGramSocketType + > > ReuseExistingSocket) > > + > > + > > + > > /*** Resolver states ***/ > > > > #define ResolverUninitialised 0 > > @@ -549,6 +567,20 @@ > > /* --- UDP --- */ > > newSocket= socket(domain, SOCK_DGRAM, 0); > > } > > + else if (ProvidedTCPSocketType == socketType) > > + { > > + /* --- Existing socket --- */ > > + if (sd_listen_fds(0) == 0) > > + { > > + socketType = TCPSocketType; > > + newSocket= SD_LISTEN_FDS_START + 0; > > + } > > + else > > + { > > + interpreterProxy->success(false); > > + return; > > + } > > + } > > if (-1 == newSocket) > > { > > /* socket() failed, or incorrect socketType */ > > > > |
Free forum by Nabble | Edit this page |