Click here to Skip to main content
15,885,216 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I know windows system programming. In Windows, we can implement all Inter-process Communication(IPC) methods like DDE, Clipboard, Pipe, Mailslot,... with messaging. I read somewhere that windows has message-based structure. In windows, every process has a message queue that it can contain any messages about one of the IPC methodes.
Is linux message-based like something that I explained about windows? Can I intercept messages in linux?
Posted

On Linux, as on all other Unix-like OS, windowed sub-system with messaging is based on X Window: http://en.wikipedia.org/wiki/X_Window_System[^].

Now, a particular system may of may not include X Window System, as well as other sub-systems based on it. Unix and Linux is not anything fixed. Also, a particular Linux distro also is not the indication of any particular windowed sub-system configuration, which may vary; for example, Ubuntu server does not have it, and there are variations of desktop Ubuntu preferring different desktop enviromnents; even if some distro is already installed, the desktop environment can be later replaced.

A particular system is the superposition of a number of optional components, such as X-Window, a desktop environment on top of that, such as GNOME, KDE or Unity. Please see:
http://en.wikipedia.org/wiki/Desktop_environment[^].

These layers do not belong to any particular Linux distro but are shared by many of them. At the same time, different distro provide different sets of those layers and typically offer the optional sets of features.

—SA
 
Share this answer
 
v2
Comments
Raheleh14 26-Nov-14 3:57am    
Sergey Thanks for your solution. I'm wondering if I can use something like a hook on Linux? Does it depend on desktop environment?
Sergey Alexandrovich Kryukov 26-Nov-14 10:44am    
It depends on what do you want to hook on. Certainly, it's always possible to hook the input events, because their always present, as they are originated in the device drivers and are dispatched to the UI, no matter what it is. At the very least, it's possible to capture those events at the kernel level. I never tried to do it, but this article will give you the idea: https://www.thc.org/papers/writing-linux-kernel-keylogger.txt.
I don't know good documentation on this, but people recommend to look at the include file "linux/include/input.h"...
—SA
The common mistake most people make. Windows is the name as the os and also of the distribution. In the linux world is is more clear that for example Ubuntu is a distribution of a Linux OS. There are several implementations for messaging available. Have a look at the wiki:
http://en.wikipedia.org/wiki/Event_loop#Xlib_event_loop[^]

Good luck!
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 24-Nov-14 11:38am    
This is a good point, about the most common mistake. But the readers can be mislead by your mention of distributions. In fact, there are layers in UI window sub-system shared by different distros. Please see my Solution 2 where I tried to clarify this point.
—SA
E.F. Nijboer 24-Nov-14 12:41pm    
Mentioning distributions could indeed be somewhat misleading. I didn't have time to elaborate as much as you did ;-)
Sergey Alexandrovich Kryukov 24-Nov-14 13:43pm    
:-)
Short answer: no, Linux has not the same message infrastructure Windows provides. On the other hand, Linux does provide many IPC facilities.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900