[Vm-dev] [commit][3748] Mantis 0007819: Add Systemd socket activation patch for the VM in SocketPlugin

Fabio Niephaus lists at fniephaus.com
Sun Aug 28 16:56:10 UTC 2016


Shouldn't this patch go to the new OpenSmalltalk-VM repository at:
https://github.com/OpenSmalltalk/opensmalltalk-vm ?

Best,
Fabio

-- 

On Sun, Aug 28, 2016 at 5:56 PM <commits at squeakvm.org> 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 */
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20160828/ac4d4261/attachment.htm


More information about the Vm-dev mailing list