From owner-freebsd-hackers@freebsd.org Wed Nov 18 03:27:46 2015 Return-Path: Delivered-To: freebsd-hackers@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 83B58A2F0FB for ; Wed, 18 Nov 2015 03:27:46 +0000 (UTC) (envelope-from mark@heily.com) Received: from mail-ig0-x22e.google.com (mail-ig0-x22e.google.com [IPv6:2607:f8b0:4001:c05::22e]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4A61D14DE for ; Wed, 18 Nov 2015 03:27:46 +0000 (UTC) (envelope-from mark@heily.com) Received: by igcto18 with SMTP id to18so29138425igc.0 for ; Tue, 17 Nov 2015 19:27:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=heily-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=Kmn2bcMXgVZVJBNbkEoIquGc6pp7La33ggIjX1T08Z0=; b=oybOBAIGZNpXL5F0hOP9omX8fb1LwSDSYEaAhhtnuK4YjBGCH18oNGcQPsaFLxsfDw RcRmLObGYM/xe/QgU/H8PKiQn3fw0y84FsCz+M0xeXN9mnavG8RSqPCGYNhHbIJJC4nW vIK9T07xCWhI/o6oVKfqKVTizIsfhMpOlBrj2o0lVSCJ+Msj0ASntakTJig0KfJKAsMk Yx0nNiRiDcHzW8MX5A8KJfV3oTantDfacJEmGDx129oeapHJzoWuj2e4d7YmjHOddoG1 GNjUx9MrhLvoyPK2Zy7gGSKaD/LGptb8vt6op2I89kdbWp2HG5Sk8Tv17td/c/5/x2mZ +RyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=Kmn2bcMXgVZVJBNbkEoIquGc6pp7La33ggIjX1T08Z0=; b=YH70TCps/Yuk2lm8hW8ads0GQj/v+nKHLdyITmu5TeFhJd7sAF2rlYkZvqlcQqVIoc 97KqW7oEtQweorkHD7FEo2NnzIiaY7HbeMh9clytY6u6AYkABDStoRFZv+3zECVjWTJt kES8FGAglrqQWJskEXwRIn2hFPpHG3l/EFtqUPDbwlDO7dHAchZN8EzSoj1cLX9UzfMZ 8zqmN2c33kVRp9H7Cnm26D2hMYUt7WNvRWno3cF5e2BILqQOr/bNSfRh8SxZBqWpAn5V UfsU41KvYGB0vBzAypzhKYzUm23UOSoyQa+wobEiHlUr2gyGFcbBFclwClA0fnptxifH 3aYw== X-Gm-Message-State: ALoCoQnJ3a7zofxyOUEcNjkiapp7cRMFT7dtzJca57oGw09XWlg5pYobwwfaMG3z+2SOZZhGOB4P MIME-Version: 1.0 X-Received: by 10.50.66.69 with SMTP id d5mr5153273igt.30.1447817265475; Tue, 17 Nov 2015 19:27:45 -0800 (PST) Received: by 10.79.84.199 with HTTP; Tue, 17 Nov 2015 19:27:45 -0800 (PST) X-Originating-IP: [71.70.169.30] In-Reply-To: References: Date: Tue, 17 Nov 2015 22:27:45 -0500 Message-ID: Subject: Re: relaunchd: a portable clone of launchd From: Mark Heily To: Benno Rice Cc: freebsd-hackers@freebsd.org Content-Type: text/plain; charset=UTF-8 X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Nov 2015 03:27:46 -0000 On Mon, Nov 16, 2015 at 10:32 PM, Benno Rice 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 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" >