Re: [systemd-devel] Scheme bindings

2015-11-20 Thread Zbigniew Jędrzejewski-Szmek
On Fri, Nov 20, 2015 at 01:53:02PM +0100, Jan Synacek wrote:
> Zbigniew Jędrzejewski-Szmek  writes:
> 
> > On Fri, Nov 13, 2015 at 09:27:17AM +0100, Jan Synáček wrote:
> >> Hello,
> >> 
> >> if anybody lurking here and hacking on systemd also likes scheme, I
> >> created bindings for GNU Guile [1]. The API is far from covered, but
> >> journal API and sd_listen* stuff is usable. You can now write socket
> >> activated services in scheme!
> >> 
> >> [1] https://github.com/jsynacek/guile-systemd
> >
> > Hi,
> >
> > when you construct a list like this, do you have normal or reverse order:
> > for (i = 0; i < r; i++)
> >s_fds = scm_cons(scm_from_int(SD_LISTEN_FDS_START+i), s_fds);
> > ?
> 
> Good catch, it's reversed. But, does it really matter in practice?

Sure. Positions of sockets passed by systemd are stable if they come
from the same socket unit, so you can distinguish otherwise identical
sockets by number.

> > return sd_booted() ? SCM_BOOL_T : SCM_BOOL_F;
> > → sd_booted can return negative for error.
> 
> _public_ int sd_booted(void) {
> return laccess("/run/systemd/system/", F_OK) >= 0;
> }
> 
> This returns a "boolean" value. I'm not really sure why it would return
> anything else. But, the documentation indeed says that it can return
> negative values when it fails.

It currently doesn't, but the bindings are written to a public api,
not the implementation. Maybe sd_booted() should be documented
to never return an error.

Zbyszek
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] Scheme bindings

2015-11-20 Thread Jan Synacek
Zbigniew Jędrzejewski-Szmek  writes:

> On Fri, Nov 13, 2015 at 09:27:17AM +0100, Jan Synáček wrote:
>> Hello,
>> 
>> if anybody lurking here and hacking on systemd also likes scheme, I
>> created bindings for GNU Guile [1]. The API is far from covered, but
>> journal API and sd_listen* stuff is usable. You can now write socket
>> activated services in scheme!
>> 
>> [1] https://github.com/jsynacek/guile-systemd
>
> Hi,
>
> when you construct a list like this, do you have normal or reverse order:
> for (i = 0; i < r; i++)
>s_fds = scm_cons(scm_from_int(SD_LISTEN_FDS_START+i), s_fds);
> ?

Good catch, it's reversed. But, does it really matter in practice?

> return sd_booted() ? SCM_BOOL_T : SCM_BOOL_F;
> → sd_booted can return negative for error.

_public_ int sd_booted(void) {
return laccess("/run/systemd/system/", F_OK) >= 0;
}

This returns a "boolean" value. I'm not really sure why it would return
anything else. But, the documentation indeed says that it can return
negative values when it fails.

Cheers,
-- 
Jan Synacek
Software Engineer, Red Hat


signature.asc
Description: PGP signature
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] Scheme bindings

2015-11-20 Thread Jan Synacek
David Timothy Strauss  writes:

> Would you be interested in moving this work to the systemd umbrella project
> on GitHub? You would still manage the team, but it may get more visibility.

Sure, why not.

> On Fri, Nov 13, 2015, 19:27 Jan Synáček  wrote:
>
>> Hello,
>>
>> if anybody lurking here and hacking on systemd also likes scheme, I
>> created bindings for GNU Guile [1]. The API is far from covered, but
>> journal API and sd_listen* stuff is usable. You can now write socket
>> activated services in scheme!
>>
>> [1] https://github.com/jsynacek/guile-systemd
>>
>> Have fun,
>> --
>> Jan Synacek
>> Software Engineer, Red Hat
>> ___
>> systemd-devel mailing list
>> systemd-devel@lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/systemd-devel
>>

-- 
Jan Synacek
Software Engineer, Red Hat


signature.asc
Description: PGP signature
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] Scheme bindings

2015-11-16 Thread Zbigniew Jędrzejewski-Szmek
On Fri, Nov 13, 2015 at 09:27:17AM +0100, Jan Synáček wrote:
> Hello,
> 
> if anybody lurking here and hacking on systemd also likes scheme, I
> created bindings for GNU Guile [1]. The API is far from covered, but
> journal API and sd_listen* stuff is usable. You can now write socket
> activated services in scheme!
> 
> [1] https://github.com/jsynacek/guile-systemd

Hi,

when you construct a list like this, do you have normal or reverse order:
for (i = 0; i < r; i++)
   s_fds = scm_cons(scm_from_int(SD_LISTEN_FDS_START+i), s_fds);
?

return sd_booted() ? SCM_BOOL_T : SCM_BOOL_F;
→ sd_booted can return negative for error.


Zbyszek
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] Scheme bindings

2015-11-16 Thread David Timothy Strauss
Would you be interested in moving this work to the systemd umbrella project
on GitHub? You would still manage the team, but it may get more visibility.

On Fri, Nov 13, 2015, 19:27 Jan Synáček  wrote:

> Hello,
>
> if anybody lurking here and hacking on systemd also likes scheme, I
> created bindings for GNU Guile [1]. The API is far from covered, but
> journal API and sd_listen* stuff is usable. You can now write socket
> activated services in scheme!
>
> [1] https://github.com/jsynacek/guile-systemd
>
> Have fun,
> --
> Jan Synacek
> Software Engineer, Red Hat
> ___
> systemd-devel mailing list
> systemd-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/systemd-devel
>
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel