Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 17 Nov 2015 22:27:45 -0500
From:      Mark Heily <mark@heily.com>
To:        Benno Rice <benno@jeamland.net>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: relaunchd: a portable clone of launchd
Message-ID:  <CAGfo=8=8Np_59AzMwzVS1abm=oJ6VzLuZH1H765s9-fF0SJ2zg@mail.gmail.com>
In-Reply-To: <F18891B6-5375-46DC-A781-3CA4B1C211DE@jeamland.net>
References:  <CAGfo=8nPxY6SW%2B04R4sN_a1udOuVRLEownM4p2Yz5Y8YGvheeA@mail.gmail.com> <F18891B6-5375-46DC-A781-3CA4B1C211DE@jeamland.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Nov 16, 2015 at 10:32 PM, Benno Rice <benno@jeamland.net> wrote:
> Hi Mark!
>
> Are you also looking at constructing equivalents to things like notifyd, configd and asld?

I've written something which blends some of the concepts behind
notifyd and configd. It's called "stated" (state dee) and it's
available here:

      https://github.com/mheily/stated

I also submitted it to the ports tree here:

     https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=204172

In a nutshell, it is a generic publish/subscribe mechanism for
programs running on a single host to share information about their
internal state and receive notifications about interesting events. I
was inspired to write it by listening to Jordan Hubbard's talk about
the problems that notifyd was trying to solve, such as programs that
constantly call stat(2) on /etc/localtime to see if someone changed
the timezone out from under them.

I haven't written any of this yet, but I'm hoping that stated will
present a unified view of all the important  OS configuration
settings, so that programs can subscribe to the ones they care about
and get notified when they change. For example, similar to how people
can run "sysctl -a" to see all kernel tunables, I'd like to be able to
run "statectl -a" and get back some JSON like this:

{
    hostname: "myhost",
    hostid: "e38a248b-8da1-11e5-b5da-382c4abedb0b",
    sshd.enable: "true",
    network.defaultrouter: "192.168.0.1",
    time.zone: "America/New_York",
    dns.fqdn: "myhost.example.com",
    dns.domain: "example.com",
    dns.nameservers: ["8.8.8.8", "8.8.4.4"],
}

Then, if a program cares deeply about using the most up-to-date
timezone setting, it can subscribe to notifications about changes in
the time.zone key, instead of constantly polling for changes to
/etc/localtime.

Notice that the above JSON isn't specific to FreeBSD, so programs
don't need to care about operating-system details like what file in
/etc is used to define the hostname. On Linux, it can be
/etc/hostname; on BSD it can be /etc/rc.conf; instead, all they need
to know is that the current value of the hostname is stored in a key
called "hostname"

>
> What are you using as your comms/RPC framework, if anything?
>

Nothing yet, but I'm thinking of using D-Bus as the RPC mechanism for
relaunchd, since a lot of open source programs are already using
D-Bus.

>
>> On Nov 15, 2015, at 18:55, Mark Heily <mark@heily.com> wrote:
>>
>> I've written a clone of the launchd framework found in Mac OS X [1].
>> It's called "relaunchd" and I would like to some help improving it and
>> getting it added to the FreeBSD ports tree [2].
>>
>> Here's the source code:
>>
>>    https://github.com/mheily/relaunchd
>>
>> One of the coolest things I've been able to do with it is to use
>> socket activation to launch an unmodified version of Apache inside of
>> a jail, pass it a socket descriptor bound to port 80 from the primary
>> network interface outside of the jail, and have it "just work" and
>> start serving web content using the pre-existing socket descriptor.
>> This eliminates the need to setup a cumbersome NAT and port forwarding
>> mechanism for each jail [3].
>>
>> This is a completely separate line of development from the work that
>> the NextBSD folks are doing to port the published Apple source code
>> for launchd and all of it's dependencies.
>>
>> I'd be happy to answer questions about relaunchd, and welcome
>> contributions from anyone who wants to help make launchd on FreeBSD a
>> reality.
>>
>> Regards,
>>
>> - Mark
>>
>> [1] https://en.wikipedia.org/wiki/Launchd
>> [2] https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=204240
>> [3] Example: http://kbeezie.com/freebsd-jail-single-ip/
>> _______________________________________________
>> freebsd-hackers@freebsd.org mailing list
>> https://lists.freebsd.org/mailman/listinfo/freebsd-hackers
>> To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org"
>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAGfo=8=8Np_59AzMwzVS1abm=oJ6VzLuZH1H765s9-fF0SJ2zg>