On 1 Mar 2016, at 10:44, Ludovic Rousseau <ludovic.rouss...@gmail.com> wrote:

> So I need a way to communicate from a process running as _tokend to a process 
> with access to the graphical interface, a process started as the logged in 
> user.

Do you care whether this GUI process is running all the time?  If not, you can 
just create a launchd agent and have it connect to your daemon.  When the 
daemon needs help, it can send a message to the appropriate connected agent (or 
send a message to /all/ the connected agents).

If you want the agents to /not/ be running all the time you can configure the 
agents to listen for a Darwin notification (see <x-man-page://3/notify> and 
<x-man-page://3/xpc_events>).  The daemon can then post that notification when 
it needs help.  This will launch the agents, and they can then connect to the 
daemon as above.

Regardless, you can use XPC (or the higher-level NSXPCConnection) to 
communicate between your daemon and agents.  An launchd daemon can advertise an 
XPC service via a MachServices property in the launchd property list.

Share and Enjoy
--
Quinn "The Eskimo!"                    <http://www.apple.com/developer/>
Apple Developer Relations, Developer Technical Support, Core OS/Hardware


_______________________________________________
launchd-dev mailing list
launchd-dev@lists.macosforge.org
https://lists.macosforge.org/mailman/listinfo/launchd-dev

Reply via email to