Re: Distingushing X process in all the system processes.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Dec 13, 2006 at 11:27:12AM +0900, Seongsu Lee wrote:
> How can I distinguish the X related proccesses (X server or
> X clients) among the all processes in the system?

Can you share with the list *why* you want to do that? It sounds like a
quite insane idea.

> For example, I think the follows are some candidate to distinguish
> the X related processes:
> 
>   1) They use specific system calls to manupulate the display.

The X server *sometimes* uses a special syscall, iopl, to get access to
the graphics card. But eg. the framebuffer driver does not.

>   2) Specific network port number(or UNIX domain sockets) is 
>      used to communicate between X server and X clients.

Yes, you could use this. It would actually work even from userland,
because you can find open sockets by reading data in /proc -- see how
lsof and netstat work.

>   3) They refer specific environmental variables such as DISPLAY.

You are out of luck here. The environment, as a whole, is passed along
with program arguments and noone from outside can look how the program
uses it.

> What do you think of this?

Another alternative would be looking for descendants of the 'xinit'
process, which you can probably find simply by looking which processes
are executing /usr/bin/xinit.

> Any ideas?

It really depends on why you want that information.

You should be aware, that you can't ever reach all X clients of some
server, because they can be running on other machines.

--------------------------------------------------------------------------------
                  				- Jan Hudec `Bulb' <bulb@xxxxxx>

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux