Re: Window -> PID

From: Alan Coopersmith (alanc_at_alum.calberkeley.org)
Date: 11/23/05


Date: Wed, 23 Nov 2005 00:37:35 +0000 (UTC)


<bunka.munka@email.si> writes in comp.unix.solaris:
|In article <dlqtg9$ql$2@agate.berkeley.edu>, alanc@alum.calberkeley.org
|says...
|> <bunka.munka@yahoo.com> writes in comp.unix.solaris:
|> |Sometimes, I have an application running in Window and want to
|> |know the PID. Is there a way I can get it somehow digging into
|> |structures, if I know the Window ID (obtained by xwininfo) ?
|>
|> Not really easily. (On most OS'es, it's a flat out no - on Solaris,
|> with Xsun, the X server knows the pid for each client in order to do the
|> IA process priority manipulations, so you can dig it out with debugger
|> magic, but that's not something you'ld want to include in a script or
|> program (though I have).)
|>
|> The best way to do this would be get the applications you care about
|> to set the _NET_WM_PID property - see the Extended WM spec at:
|> http://standards.freedesktop.org/wm-spec/wm-spec-latest.html#id2511832
|>
|>
|I am familiar with the most kernel structures (actually i am digging
|with adb into crash files many times), but didn't find any appropriate.
|
|Application are 3rd party, all runs on a host itself. They're very
|complex (about 400-500 java processes).
|Most of the time i am successfull finding one (with truss -p <assume
|pid> and moving mouse over that window produce a massive
|lwp_mutexes...), but I am pretty sure XServer has that structure
|somewhere, if not in their temporary files, it must have some kernel
|process window tree...

As I said, the X servers on Solaris do have that in memory, but there's
no way to get it out other than via poking in the X server process
memory with a debugger or similar tool. It's in the user-space process,
not the kernel, and you'ld need the X server structure definitions from
the source code, since they're not in header files shipped with the
system.

-- 
Alan Coopersmith * alanc@alum.calberkeley.org * Alan.Coopersmith@Sun.COM
  http://blogs.sun.com/alanc/ *  http://people.freedesktop.org/~alanc/
   http://del.icio.us/alanc/  *  http://www.csua.berkeley.edu/~alanc/
  Working for, but definitely not speaking for, Sun Microsystems, Inc.


Relevant Pages

  • Re: Window -> PID
    ... I have an application running in Window and want to ... > know the PID. ... Is there a way I can get it somehow digging into ... something which is interacting with the X server. ...
    (comp.unix.solaris)
  • Re: TCP Window Size
    ... terminal server, so window size wouldn't be the problem. ... network I/O, active clients, etc. ... Multiple parallel WAN links are being load ...
    (comp.dcom.sys.cisco)
  • Re: Using Outlook with Lotus Notes R7
    ... provided Outlook Connector for IBMLotusDomino. ... unsuccesful in getting myLotusNotes email and calendar to display in ... On the Server Type page of the wizard, ... closed the Mail window. ...
    (microsoft.public.outlook.interop)
  • Re: noob requesting a bit of explanation ...
    ... The X server controls access to the screen, ... Applications are clients. ... The window manager is a client. ...
    (alt.os.linux.suse)
  • Re: TCP Window Size
    ... terminal server, so window size wouldn't be the problem. ... network I/O, active clients, etc. ... Multiple parallel WAN links are being load ...
    (comp.dcom.sys.cisco)