Enabling mouse on X Server
Hi, I have ported X server on to my reference board based on Intel's Strong Arm, When I connected a USB optical wheel mouse to the USB port the mouse doesn't work: The mouse pointer appears on the screen, dmesg cmd also show that the system has identified the device (including details like manufacturer etc) But the GUI doesn't respond to the mouse. I even tried linking ln -s /dev/usb /dev/mouse but wouldn't work has anyone face this problem and any idea how to locate the issue. Thanks in Advance Regards Suresh
Re: [PATCH] Make MAXSCREENS run-time configurable
On Wed, Mar 24, 2004 at 11:29:03AM -0500, Rik Faith wrote: >On Tue 23 Mar 2004 21:48:31 -0500, > David Dawes <[EMAIL PROTECTED]> wrote: >> The affect on data structures that may be part of the module >> interfaces is potentially more serious. It might also be a non-issue >> if none of the affected data structures are part of module interfaces. > >I haven't looked at all of the module interfaces, but here are some >thoughts for the two kinds of compatibility: > >1) You compile a module with a dynamic-MAXSCREENS server and want to run > it on an old X server. There's appears to be no hope here, since the > MAXSCREENS variable isn't exported. > > This may be a detectable case, however, and ELF loader magic might be > able to provide a MAXSCREENS set to 16. This could solve some of the > problems, but I don't think all of them (see below). In any case, I > don't believe this is worth the work or complexity involved. Compatibility in this direction is never guaranteed. It isn't unusual for drivers to make use of new interfaces. Most of the module ABI minor revisions would be bumped along with a change like this. >2) You compile a module with a static-MAXSCREENS server and want to run > it on a dynamic-MAXSCREENS server. > > If the module API passes vectors of "type var[MAXSCREENS]", then that > part should work ok, because only a pointer is being passed. > > If pointers to structures are being passed, and those structures > contain elements of "type var[MAXSCREENS]", then the structure sizes > will be wrong, so you will not be able to index into a list of > structures. Further, elements after var in the struct will be at > different locations, so they will not be accessible. I haven't tried > to audit all of these cases. > > The larger problem will be globals that are initialized in the new > InitGlobals routine: dixScreenOrigins, savedScreenInfo, > screenInfo.screens. I think modules that use these symbols will be > expecting the address of the start of the data, but the > dynamic-MAXSCREENS server will be providing the address of a pointer > to the start of the data (i.e., and will require an extra > dereference). This is the compatibility direction that is more important. I expect that it can be handled though. David ___ Devel mailing list [EMAIL PROTECTED] http://XFree86.Org/mailman/listinfo/devel
Re: how to convert a window ID to a linux process ID?
On Wed, 24 Mar 2004 18:13:58 +0100 Marcus Schaefer <[EMAIL PROTECTED]> babbled: (B (B> Hi, (B> (B> > >I tried your example because I don't know the _NET_WM_PID property (B> > >and was interested in it. Unfortunately the call to XGetWindowProperty() (B> > >never filled the &prop data. Your code is checking against the return (B> > >code of XGetWindowProperty() which is fine but prop equals to (nil) in (B> > >all my tests. I was using metacity as suggested windowmanger. (B> > > (B> > >Do you have any idea why it fails ? (B> > > (B> > >The window Id which is required of course is obtained from a (B> > >"xwininfo" call. I passed the information from this command to (B> > (B> > Using this (removed the uid stuff) works here: (B> > (B> > [EMAIL PROTECTED] fer]$ gcc test.c -L/usr/X11R6/lib/ -I/usr/X11R6/include/ -lX11 (B> > -o [EMAIL PROTECTED] fer]$ xwininfo (B> > (B> > xwininfo: Please select the window about which you (B> > would like information by clicking the (B> > mouse in that window. (B> > (B> > xwininfo: Window id: 0x1e00012 "[EMAIL PROTECTED]:~" (B> > [...] (B> > [EMAIL PROTECTED] fer]$ ./a.out 0x1e00012 (B> > pid of window 0x1e00012 = 24109 (B> (B> Hmm, yes I see, I did it the same way but it doesn't work for me. (B> The code I use is as follows: (B> (B> snip (B> #include (B> #include (B> #include (B> #include (B> #include (B> #include (B> (B> #include (B> #include (B> (B> (B> int main (int argc, char*argv[]) { (B> Atom atom,actual_type; (B> Display *dpy; (B> int screen; (B> char *atom_name; (B> int actual_format; (B> unsigned long nitems; (B> unsigned long bytes_after; (B> unsigned char *prop; (B> int status; (B> int pid; (B> Window w=0; (B> (B> dpy = XOpenDisplay((char*)getenv("DISPLAY")); (B> screen = DefaultScreen(dpy); (B> if (argc!=2) { (B> printf("Usage %s window-id\n",argv[0]); (B> exit(-1); (B> } (B> sscanf(argv[1],"0x%x",(unsigned int*)(&w)); (B> atom = XInternAtom(dpy, "_NET_WM_PID", True); (B> atom_name = XGetAtomName (dpy,atom); (B> status = XGetWindowProperty( (B> dpy, w, atom, 0, 1024, (B> False, AnyPropertyType, (B> &actual_type, (B> &actual_format, &nitems, (B> &bytes_after, (B> &prop (B> ); (B> (B> if (status!=0) { (B> printf("Cannot get _NET_WM_PID"); (B> exit(-2); (B> } (B> if (! prop) { (B> printf ("No properties\n"); (B> exit (-3); (B> } (B> (B> pid = prop[1] * 256; (B> pid += prop[0]; (B> printf("pid of window 0x%x = %d\n",(unsigned int)w,pid); (B> (B> return 0; (B> } (B> snap--- (B> (B> gcc id.c -L/usr/X11R6/lib/ -I/usr/X11R6/include/ -lX11 -o bla (B> (B> I'm running XFree86 Version 4.3.99.902 (4.4.0 RC 2) on kernel (B> 2.6.4-6-default. (B> (B> any ideas ? (B (B_NET_WM_PID is a VOLUNTARY property set by some apps if they want to. not all x (Bapps will set this - so windows wont necessarily have this property. see my (BLD_PRELOAD hack for forcing a process id property to be set on ALL toplevel (Bwindows of apps run under the preload (B (B-- (B- Codito, ergo sum - "I code, therefore I am" -- (BThe Rasterman (Carsten Haitzler)[EMAIL PROTECTED] $B7'<*(B - $Bhttp://XFree86.Org/mailman/listinfo/devel
Re: how to convert a window ID to a linux process ID?
Hi! Am 24.03.2004 um 19:48 schrieb Eamon Walsh: On the server side, in os/access.c, is a function LocalClientCred() that you can use to get the UID and GID of a local client. This function could be extended to return the PID as well since the structure returned by the SO_PEERCRED sockopt has the PID in it. It probably only works for UNIX domain sockets. I never heard about about TCP/IP-Sockets transfering stuff like UID/GID or the PID during communication. Using the ident protocol could be an option to retrieve the UID but it does not reveal the PID. 73, Mario ___ Devel mailing list [EMAIL PROTECTED] http://XFree86.Org/mailman/listinfo/devel
Re: how to convert a window ID to a linux process ID?
On Wed, 24 Mar 2004, [iso-8859-1] Måns Rullgård wrote: > Fernando Herrera <[EMAIL PROTECTED]> writes: > > > If you are running a window manager setting the _NET_WM_PID > > property correctly (metacity does it, dunno about others) you can do the > > mapping easily. > > How does it handle windows owned by remote processes connected over > the network? And what happens to remote applications displaying over an ssh tunnel ? Do they all share the pid of the ssh client ? -- Andrew C. Aitchison Cambridge [EMAIL PROTECTED] ___ Devel mailing list [EMAIL PROTECTED] http://XFree86.Org/mailman/listinfo/devel
Re: how to convert a window ID to a linux process ID?
On Wed, 2004-03-24 at 03:52, dave giffin wrote: > I need to be able to tell which process a given window > was created by. (Window ID=>Process ID) On the server side, in os/access.c, is a function LocalClientCred() that you can use to get the UID and GID of a local client. This function could be extended to return the PID as well since the structure returned by the SO_PEERCRED sockopt has the PID in it. Take a look at it; there's already a bunch of _XTrans stuff dealing with this sort of thing. --Eamon > > 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 ___ Devel mailing list [EMAIL PROTECTED] http://XFree86.Org/mailman/listinfo/devel
Re: how to convert a window ID to a linux process ID?
Fernando Herrera <[EMAIL PROTECTED]> writes: > Wed, Mar 24, 2004 at 12:52:28AM -0800, dave giffin escribió: > >>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). > > If you are running a window manager setting the _NET_WM_PID > property correctly (metacity does it, dunno about others) you can do the > mapping easily. How does it handle windows owned by remote processes connected over the network? -- Måns Rullgård [EMAIL PROTECTED] ___ Devel mailing list [EMAIL PROTECTED] http://XFree86.Org/mailman/listinfo/devel
Re: how to convert a window ID to a linux process ID?
Hi, > >I tried your example because I don't know the _NET_WM_PID property > >and was interested in it. Unfortunately the call to XGetWindowProperty() > >never filled the &prop data. Your code is checking against the return > >code of XGetWindowProperty() which is fine but prop equals to (nil) in > >all my tests. I was using metacity as suggested windowmanger. > > > >Do you have any idea why it fails ? > > > >The window Id which is required of course is obtained from a > >"xwininfo" call. I passed the information from this command to > > Using this (removed the uid stuff) works here: > > [EMAIL PROTECTED] fer]$ gcc test.c -L/usr/X11R6/lib/ -I/usr/X11R6/include/ -lX11 -o > test > [EMAIL PROTECTED] fer]$ xwininfo > > xwininfo: Please select the window about which you > would like information by clicking the > mouse in that window. > > xwininfo: Window id: 0x1e00012 "[EMAIL PROTECTED]:~" > [...] > [EMAIL PROTECTED] fer]$ ./a.out 0x1e00012 > pid of window 0x1e00012 = 24109 Hmm, yes I see, I did it the same way but it doesn't work for me. The code I use is as follows: snip #include #include #include #include #include #include #include #include int main (int argc, char*argv[]) { Atom atom,actual_type; Display *dpy; int screen; char *atom_name; int actual_format; unsigned long nitems; unsigned long bytes_after; unsigned char *prop; int status; int pid; Window w=0; dpy = XOpenDisplay((char*)getenv("DISPLAY")); screen = DefaultScreen(dpy); if (argc!=2) { printf("Usage %s window-id\n",argv[0]); exit(-1); } sscanf(argv[1],"0x%x",(unsigned int*)(&w)); atom = XInternAtom(dpy, "_NET_WM_PID", True); atom_name = XGetAtomName (dpy,atom); status = XGetWindowProperty( dpy, w, atom, 0, 1024, False, AnyPropertyType, &actual_type, &actual_format, &nitems, &bytes_after, &prop ); if (status!=0) { printf("Cannot get _NET_WM_PID"); exit(-2); } if (! prop) { printf ("No properties\n"); exit (-3); } pid = prop[1] * 256; pid += prop[0]; printf("pid of window 0x%x = %d\n",(unsigned int)w,pid); return 0; } snap--- gcc id.c -L/usr/X11R6/lib/ -I/usr/X11R6/include/ -lX11 -o bla I'm running XFree86 Version 4.3.99.902 (4.4.0 RC 2) on kernel 2.6.4-6-default. any ideas ? Regards Marcus -- Public Key available Marcus Schäfer (Res. & Dev.) SUSE LINUX AG Tel: 0911-740 53 0 Maxfeldstrasse 5 FAX: 0911-741 77 55D-90409 Nürnberg http://www.suse.de Germany ___ Devel mailing list [EMAIL PROTECTED] http://XFree86.Org/mailman/listinfo/devel
Re: how to convert a window ID to a linux process ID?
Wed, Mar 24, 2004 at 05:16:59PM +0100, Marcus Schaefer escribió: >I tried your example because I don't know the _NET_WM_PID property >and was interested in it. Unfortunately the call to XGetWindowProperty() >never filled the &prop data. Your code is checking against the return >code of XGetWindowProperty() which is fine but prop equals to (nil) in >all my tests. I was using metacity as suggested windowmanger. > >Do you have any idea why it fails ? > >The window Id which is required of course is obtained from a >"xwininfo" call. I passed the information from this command to Using this (removed the uid stuff) works here: [EMAIL PROTECTED] fer]$ gcc test.c -L/usr/X11R6/lib/ -I/usr/X11R6/include/ -lX11 -o test [EMAIL PROTECTED] fer]$ xwininfo xwininfo: Please select the window about which you would like information by clicking the mouse in that window. xwininfo: Window id: 0x1e00012 "[EMAIL PROTECTED]:~" [...] [EMAIL PROTECTED] fer]$ ./a.out 0x1e00012 pid of window 0x1e00012 = 24109 Salu2 -- Fernando Herrera de las Heras Onírica: análisis, diseño e implantación de soluciones informáticas http://www.onirica.com ___ Devel mailing list [EMAIL PROTECTED] http://XFree86.Org/mailman/listinfo/devel
Re: [PATCH] Make MAXSCREENS run-time configurable
On Tue 23 Mar 2004 21:48:31 -0500, David Dawes <[EMAIL PROTECTED]> wrote: > The affect on data structures that may be part of the module > interfaces is potentially more serious. It might also be a non-issue > if none of the affected data structures are part of module interfaces. I haven't looked at all of the module interfaces, but here are some thoughts for the two kinds of compatibility: 1) You compile a module with a dynamic-MAXSCREENS server and want to run it on an old X server. There's appears to be no hope here, since the MAXSCREENS variable isn't exported. This may be a detectable case, however, and ELF loader magic might be able to provide a MAXSCREENS set to 16. This could solve some of the problems, but I don't think all of them (see below). In any case, I don't believe this is worth the work or complexity involved. 2) You compile a module with a static-MAXSCREENS server and want to run it on a dynamic-MAXSCREENS server. If the module API passes vectors of "type var[MAXSCREENS]", then that part should work ok, because only a pointer is being passed. If pointers to structures are being passed, and those structures contain elements of "type var[MAXSCREENS]", then the structure sizes will be wrong, so you will not be able to index into a list of structures. Further, elements after var in the struct will be at different locations, so they will not be accessible. I haven't tried to audit all of these cases. The larger problem will be globals that are initialized in the new InitGlobals routine: dixScreenOrigins, savedScreenInfo, screenInfo.screens. I think modules that use these symbols will be expecting the address of the start of the data, but the dynamic-MAXSCREENS server will be providing the address of a pointer to the start of the data (i.e., and will require an extra dereference). ___ Devel mailing list [EMAIL PROTECTED] http://XFree86.Org/mailman/listinfo/devel
Re: how to convert a window ID to a linux process ID?
Hi, > >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). > > If you are running a window manager setting the _NET_WM_PID > property correctly (metacity does it, dunno about others) you can do the > mapping easily. The next example get that prop from the Window ID, and > then converts the PID to the UID of user running the process (it uses > libgtop for doing that): I tried your example because I don't know the _NET_WM_PID property and was interested in it. Unfortunately the call to XGetWindowProperty() never filled the &prop data. Your code is checking against the return code of XGetWindowProperty() which is fine but prop equals to (nil) in all my tests. I was using metacity as suggested windowmanger. Do you have any idea why it fails ? The window Id which is required of course is obtained from a "xwininfo" call. I passed the information from this command to the example. Did I something stupid ? Thanks Regards Marcus -- Public Key available Marcus Schäfer (Res. & Dev.) SUSE LINUX AG Tel: 0911-740 53 0 Maxfeldstrasse 5 FAX: 0911-741 77 55D-90409 Nürnberg http://www.suse.de Germany ___ Devel mailing list [EMAIL PROTECTED] http://XFree86.Org/mailman/listinfo/devel
Re: how to convert a window ID to a linux process ID?
Wed, Mar 24, 2004 at 12:52:28AM -0800, dave giffin escribió: >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). If you are running a window manager setting the _NET_WM_PID property correctly (metacity does it, dunno about others) you can do the mapping easily. The next example get that prop from the Window ID, and then converts the PID to the UID of user running the process (it uses libgtop for doing that): Salu2 #include #include #include #include #include #include #include #include #include #include int main (int argc, char*argv[]) { Atom atom,actual_type; Display *dpy; int screen; char *atom_name; int actual_format; unsigned long nitems; unsigned long bytes_after; unsigned char *prop; int status; int pid; glibtop_proc_uid proc_uid; Window w=0; //dpy = XOpenDisplay(":0"); dpy = XOpenDisplay(getenv("DISPLAY")); screen = DefaultScreen(dpy); if (argc!=2) { printf("Usage %s window-id\n",argv[0]); exit(-1); } sscanf(argv[1],"0x%x",&w); atom = XInternAtom(dpy, "_NET_WM_PID", True); atom_name = XGetAtomName (dpy,atom); status = XGetWindowProperty(dpy, w, atom, 0, 1024, False, AnyPropertyType, &actual_type, &actual_format, &nitems, &bytes_after, &prop); if (status!=0) { printf("Cannot get _NET_WM_PID"); exit(-2); } pid = prop[1] * 256; pid += prop[0]; printf("pid of window 0x%x = %d\n",w,pid); glibtop_get_proc_uid (&proc_uid, pid); printf("uid = %d, euid = %d\n",proc_uid.uid, proc_uid.euid); return 0; } -- Fernando Herrera de las Heras Onírica: análisis, diseño e implantación de soluciones informáticas http://www.onirica.com ___ Devel mailing list [EMAIL PROTECTED] http://XFree86.Org/mailman/listinfo/devel
(no subject)
Dear Sir, I install mydb2 on RH9. After that I remove it by delete the folder, so when I want to reinstall it again it give me the package already installed. I search all file related with mydb2 and remove it, but the problem still. Please can you help me to solve this problem. Thanks and regards Hamad
Re: how to convert a window ID to a linux process ID?
dave giffin wrote: > > > 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 This does indeed sound like the 'hard way'... There has been some work on various window manager projects to tie this information together. For example, in the development code for enlightenment, the direction taken was to tag application windows on launch with their process id as a property. Then the window manager has no trouble retrieving this information at a later time. Would something like that work for you? Or is there some reason you feel it needs to be done at the xfree86 level? -- Kevin ___ Devel mailing list [EMAIL PROTECTED] http://XFree86.Org/mailman/listinfo/devel
Re: how to convert a window ID to a linux process ID?
On Wed, 24 Mar 2004 00:52:28 -0800 (PST) dave giffin <[EMAIL PROTECTED]> (Bbabbled: (B (B (B (Bmuch much much cleaner: (Bcompile the attached 2 files into a .so shared library and use it as an (BLD_PRELOAD when running ALL x applications (or make appropriate changes to Xlib (Bitself). this is a non invasive method that doesnt change the xserver or xlib - (Bit simply forces window creates (and reparents) to root to have that window (Bcarry some extra properites - one of which is the process id (also machine name, (Busername etc. is done too). (B (Bif you dont know about LD_PRELOAD i'd highly suggest reading up about it - its a (Bgreat way to do the most evil of hacks :) (B (B (B (B> I need to be able to tell which process a given window (B> was created by. (Window ID=>Process ID) (B> (B> Apparently, X servers don't know which process a (B> client is, they just get a socket (b/c of X's network (B> transparency). (B> (B> It has been suggested that I could run a program like (B> netstat on the client machine(which in my case is the (B> same machine running the server) to get a list of (B> which sockets belong to which processes. (B> (B> Then, I need to get the ID of the foreign socket (B> (socket ID on client end) from which a window was (B> created. (B> (B> What would work well is if the socket ID and the (B> client/window ID could be written to STDOUT or STDIN (B> when the window is created. Then I can have a script (B> read the server's STDOUT or STDIN and compare it to (B> the list of socket IDs and process IDs from netstat on (B> the client machine (which for my purposes is on the (B> same machine as the server). (B> (B> MY PROBLEM: I don't know how to get XFree86 to write (B> the socket ID and client ID when a window is created! (B> (B> Today, I was looking at the XFree86(4.3.0) source code (B> for the first time and trying some different hacks to (B> get the info I wanted to print. (B> (B> In xc/programs/Xserver/dix/dispatch.c, I found (B> ProcCreateWindow and the ClientPtr structure. I was (B> able to get X to print client->index and (B> client->OsPrivate->fd when a new window was created. (B> (B> Which is what I want, except that the client index (B> that is printed is always 2 and the socket ID is (B> always 13. 13 is the ID of the socket that X listens (B> on and I think 2 is the server client? (B> (B> What am I doing wrong? (B> (B> How can I print the Window ID and foreign/from socket (B> ID of a client when a window is created? (B> (B> (B> :) thanx (B> (B> PS: I'm thinking of making a sourceforge project to (B> publish the XFree86 modification and some associated (B> scripts so that others will be able to see which (B> process created which window. How does the project (B> name XTracer sound? (B> (B> __ (B> Do you Yahoo!? (B> Yahoo! Finance Tax Center - File online. File on time. (B> http://taxes.yahoo.com/filing.html (B> ___ (B> Devel mailing list (B> [EMAIL PROTECTED] (B> http://XFree86.Org/mailman/listinfo/devel (B (B (B-- (B- Codito, ergo sum - "I code, therefore I am" -- (BThe Rasterman (Carsten Haitzler)[EMAIL PROTECTED] $B7'<*(B - $B#include "config.h" #include "e_hack.h" /* prototypes */ static void __e_hack_set_properties(Display *display, Window window); /* dlopened xlib so we can find the symbols in the real xlib to call them */ static void *lib_xlib = NULL; /* the function that actually sets the properties on toplevel window */ static void __e_hack_set_properties(Display *display, Window window) { static Atom a_launch_id = 0; static Atom a_launch_path = 0; static Atom a_user_id = 0; static Atom a_process_id = 0; static Atom a_p_process_id = 0; static Atom a_machine_name = 0; static Atom a_user_name = 0; char *env = NULL; if (!a_launch_id)a_launch_id= XInternAtom(display, "_E_HACK_LAUNCH_ID", False); if (!a_launch_path) a_launch_path = XInternAtom(display, "_E_HACK_LAUNCH_PATH", False); if (!a_user_id) a_user_id = XInternAtom(display, "_E_HACK_USER_ID", False); if (!a_process_id) a_process_id = XInternAtom(display, "_E_HACK_PROCESS_ID", False); if (!a_p_process_id) a_p_process_id = XInternAtom(display, "_E_HACK_PARENT_PROCESS_ID", False); if (!a_machine_name) a_machine_name = XInternAtom(display, "_E_HACK_MACHINE_NAME", False); if (!a_user_name)a_user_name= XInternAtom(display, "_E_HACK_USER_NAME", False); if ((env = getenv("E_HACK_LAUNCH_ID"))) XChangeProperty(display, window, a_launch_id, XA_STRING, 8, PropModeReplace, env, strlen(env)); if ((env = getenv("E_HACK_LAUNCH_PATH"))) XChangeProperty(display, window, a_launch_path, XA_STRING, 8, PropModeReplace, env, strlen(env)); { uid_t uid; pid_t pid, ppid; struct utsname ubuf; char buf[4096]; uid = getuid(); pid = getpid(
how to convert a window ID to a linux process ID?
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