don't know how to use the LD_PRELOAD hack to get the id of a process creating a window

2004-03-25 Thread dave giffin
I appreciate all the feedback from people so quickly
on my previous message.

I read Carsten Haitzler's message about creating a
library and getting x apps to load it via the
LD_PRELOAD environment variable.

This sounds like the best option for me.

But, I'm not sure how to actually do it. 

I compiled the library and set my LD_PRELOAD environ
variable to its path. Then i ran a copy of xterm and
used the code that Marcus Schaefer provided to get the
_NET_WM_PID property, but that property wasn't found.
I ran xterm under strace and it seems to open the
library I put into LD_PRELOAD.

Could someone provide some detailed instructions that
I could follow? 

(and possibly code, I haven't used LD_PRELOAD before
or done much programming directly w/ Xlib) 

:) thanx

__
Do you Yahoo!?
Yahoo! Finance Tax Center - File online. File on time.
http://taxes.yahoo.com/filing.html
___
Devel mailing list
[EMAIL PROTECTED]
http://XFree86.Org/mailman/listinfo/devel


how to convert a window ID to a linux process ID?

2004-03-24 Thread dave giffin
I need to be able to tell which process a given window
was created by. (Window ID=Process ID)

Apparently, X servers don't know which process a
client is, they just get a socket (b/c of X's network
transparency).

It has been suggested that I could run a program like
netstat on the client machine(which in my case is the
same machine running the server) to get a list of
which sockets belong to which processes.

Then, I need to get the ID of the foreign socket
(socket ID on client end) from which a window was
created.

What would work well is if the socket ID and the
client/window ID could be written to STDOUT or STDIN
when the window is created. Then I can have a script
read the server's STDOUT or STDIN and compare it to
the list of socket IDs and process IDs from netstat on
the client machine (which for my purposes is on the
same machine as the server).

MY PROBLEM: I don't know how to get XFree86 to write
the socket ID and client ID when a window is created!

Today, I was looking at the XFree86(4.3.0) source code
for the first time and trying some different hacks to
get the info I wanted to print. 

In xc/programs/Xserver/dix/dispatch.c, I found
ProcCreateWindow and the ClientPtr structure. I was
able to get X to print client-index and
client-OsPrivate-fd when a new window was created.

Which is what I want, except that the client index
that is printed is always 2 and the socket ID is
always 13. 13 is the ID of the socket that X listens
on and I think 2 is the server client?

What am I doing wrong?

How can I print the Window ID and foreign/from socket
ID of a client when a window is created?


:) thanx

PS: I'm thinking of making a sourceforge project to
publish the XFree86 modification and some associated
scripts so that others will be able to see which
process created which window. How does the project
name XTracer sound?

__
Do you Yahoo!?
Yahoo! Finance Tax Center - File online. File on time.
http://taxes.yahoo.com/filing.html
___
Devel mailing list
[EMAIL PROTECTED]
http://XFree86.Org/mailman/listinfo/devel