| |||
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] |
On Dec 15, 2007, at 7:40 PM, John Koren wrote:
Others have already answered this question in this thread, but I'll give you my answer, because I am the one that made this change. The real answer to this question is "The socket name has the format that it does because it was the easiest way to make this work." It required no code changes whatsoever to launchd, and only 20 or so lines of code change to Xtrans. It may help if you see how this is done; if you look at /System/Library/LaunchAgents/org.x.X11.plist, you'll see <key>Sockets</key> <dict> <key>:0</key> <dict> <key>SecureSocketWithKey</key> <string>DISPLAY</string> </dict> </dict> The man page for 'launchd.plist' explains what this means: Sockets <dictionary of dictionaries... OR dictionary of array of dictionaries...> This optional key is used to specify launch on demand sockets that can be used to let launchd know when to run the job. The job must check-in to get a copy of the file descriptors using APIs outlined in launch(3). The keys of the top level Sockets dictionary can be anything. [...] SockPathName <string> This optional key implies SockFamily is set to "Unix". It specifies the path to connect(2) or bind(2) to. SecureSocketWithKey <string> This optional key is a variant of SockPathName. Instead of binding to a known path, a securely generated socket is created and the path is assigned to the environment variable that is inherited by all jobs spawned by launchd. Therefore, I was able to use SecureSocketWithKey -- a functionality provided by launchd for anybody who wants to use it -- to get launchd to automatically create a socket for me, inside of a securely-created directory, named ':0', and then it would automatically set the environment variable 'DISPLAY' to that pathname. If you'd like to see another part of OS X that uses this functionality, take a look at /System/Library/LaunchAgents/org.openbsd.ssh-agent.plist. This also neatly sidesteps the issue of deciding what socket to use if /tmp/.X11-unix/X0 already exists.
If you are hard-coding the value 'DISPLAY=:0' on any multi-user system, you are already committing a gross hack by making two bad assumptions: 1) that the X server is already running (this is a reasonable assumption on other platforms, because often you start programs from within X11. In that case, why do you need to set DISPLAY at all?) 2) that you are the only person running X on your machine, and that someone else will not be using DISPLAY :0. -- Ben Byer CoreOS / BSD Technology Group, XDarwin maintainer |
_______________________________________________ Do not post admin requests to the list. They will be ignored. X11-users mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/x11-users/email@hidden This email sent to email@hidden
| References: | |
| >Re: 2.1.1 and xterm (From: "John Koren" <email@hidden>) | |
| >Re: 2.1.1 and xterm (From: Merle Reinhart <email@hidden>) | |
| >Re: 2.1.1 and xterm (From: "John Koren" <email@hidden>) | |
| >Re: 2.1.1 and xterm (From: Merle Reinhart <email@hidden>) | |
| >Re: 2.1.1 and xterm (From: "John Koren" <email@hidden>) | |
| >Re: 2.1.1 and xterm (From: William Mortensen <email@hidden>) | |
| >Re: 2.1.1 and xterm (From: "John Koren" <email@hidden>) |
| Home | Archives | FAQ | Terms/Conditions | Contact | RSS | Lists | About |
Visit the Apple Store online or at retail locations.
1-800-MY-APPLE
Contact Apple | Terms of Use | Privacy Policy
Copyright © 2007 Apple Inc. All rights reserved.