Re: NET_WM_PID is broken (was: NET_WM_PID and client leader)
- From: Havoc Pennington <hp redhat com>
- To: Mathias Hasselmann <mathias hasselmann gmx de>
- Cc: "wm-spec-list gnome org" <wm-spec-list gnome org>
- Subject: Re: NET_WM_PID is broken (was: NET_WM_PID and client leader)
- Date: 16 Aug 2001 14:27:47 -0400
Hi,
Sorry for the slow reply; I was just reminded that I needed to reply
by the traffic on this list. ;-)
I somewhat modified your proposed wm-spec.sgml patch and propose the
following patch instead.
I basically made two changes:
- I think you meant WM_CLIENT_MACHINE instead of WM_CLIENT_NAME in
a couple places?
- I don't think the spec should require a specific implementation;
instead I wrote that the "fully-qualified domain name" must be
used.
I think the FQDN is a well-understood concept, e.g. here is the
definition from the GNU libc manual:
In DNS, the full host name is properly called the FQDN (Fully
Qualified Domain Name) and consists of the hostname, then a period,
then the domain name. The domain name itself usually has multiple
components separated by periods. So for example, a system's
hostname may be `chicken' and its domain name might be
`ai.mit.edu', so its FQDN (which is its host name) is
`chicken.ai.mit.edu'.
Then I moved your text about gethostname() and uname() to
implementation notes.
I think this is more appropriate for a spec, we are just supposed to
specify behavior, not what you have to do to get that behavior. If
clients have some better way to get FQDN then they should feel free to
do so.
Havoc
Index: wm-spec.sgml
===================================================================
RCS file: /home/freedesktop/wm-spec/wm-spec.sgml,v
retrieving revision 1.12
diff -u -p -u -r1.12 wm-spec.sgml
--- wm-spec.sgml 2001/05/09 02:55:08 1.12
+++ wm-spec.sgml 2001/08/16 12:31:17
@@ -788,6 +788,14 @@ window. This MAY be used by the Window
respond to the _NET_WM_PING protocol.
</para>
<para>
+If _NET_WM_PID is set, the ICCCM-specified property WM_CLIENT_MACHINE
+MUST also be set. While the ICCCM only requests that WM_CLIENT_MACHINE is set
+<quote> to a string that forms the name of the machine running the client as
+seen from the machine running the server</quote> conformance to this
+specification requires that WM_CLIENT_MACHINE be set to the fully-qualified domain
+name of the client's host.
+ </para>
+ <para>
See also the implementation notes on <link linkend="KILLINGWINDOWS">killing hung processes</link>.
</para>
</sect2>
@@ -1092,8 +1100,47 @@ was the frame for this window.
</sect2>
<sect2 id="KILLINGWINDOWS">
<title>Killing Hung Processes</title>
+ <para>
+If processes fail to respond to the _NET_WM_PING protocol _NET_WM_PID may be
+used in combination with the ICCCM specified WM_CLIENT_MACHINE to
+attempt to kill a process.
+ </para>
+
+ <para>
+WM_CLIENT_MACHINE must be set to the fully-qualified domain name of the client's
+host. This would normally be retrieved using gethostname(2). When gethostname()
+is not available on the client's platform implementors may use the value of the
+nodename field of struct utsname as returned by uname(2). An example of how to
+retrieve a value for WM_CLIENT_MACHINE:
+ </para>
<para>
-If processes fail to respond to the _NET_WM_PING protocol _NET_WM_PID may be used in combination with the ICCCM specified WM_CLIENT_MACHINE(STRING) to attempt to kill a process.
+ <programlisting><![CDATA[
+int net_get_hostname (char *buf, size_t maxlen)
+{
+#ifdef HAVE_GETHOSTNAME
+ if (buf == NULL) return 0;
+
+ gethostname (buf, maxlen);
+ buf [maxlen - 1] = '\0';
+
+ return strlen(buf);
+#else
+ struct utsname name;
+ size_t len;
+
+ if (buf == NULL) return 0;
+
+ uname (&name);
+ len = strlen (name.nodename);
+
+ if (len >= maxlen) len = maxlen - 1;
+ strncpy (buf, name.nodename, len);
+ buf[len] = '\0';
+
+ return len;
+#endif
+}
+]]></programlisting>
</para>
</sect2>
</Sect1>
@@ -1166,6 +1213,17 @@ OR OTHER DEALINGS IN THE SOFTWARE.
</sect1>
<Sect1>
<title>Change history</title>
+ <sect2>
+ <title>Changes since 1.1</title>
+ <itemizedlist>
+ <listitem><para>
+ Changed WM_CLIENT_NAME(STRING) from suggested to required for _NET_WM_PID.
+ </para></listitem>
+ <listitem><para>
+ Specification and sample code for the content of WM_CLIENT_NAME(STRING).
+ </para></listitem>
+ </itemizedlist>
+ </sect2>
<sect2>
<title>Changes since 1.0</title>
<itemizedlist>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]