A simple demonstration of Sys V message queues

osi-certifiedThis is a simple utility that demonstrate the use of Sys V IPC message queues and one can use the “type” bit to represent a priority to get priority message queues.

Get the tarball here: msgqueue.tar.bz2

 

 

A hack for giving an application real time priority

This little hack uses the fact that POSIX scheduling policy and real time priority survive fork() to create a small utility that allow one to run any application in a given real time priority.

This can be useful, for example, when you’re using an MP3 player like XMMS and the sound becomes jittery when you compile or do other activities.

WARNING: giving a process which has not been written for it specifically real time priority is dangerous and can easily freeze you whole system! Use this at your own caution. I usually try new application by first opening a shell with real time priority which is higher then the priority I give to the process I try so I can kill it if it causes the system to get stuck.

Get the source file here: realtime.c

 

 

A hack for binding an application to a device

This little hack serves two purposes: it demonstrate how to write a library for the purpose of symbol hijacking using the LD_PRELOAD mechanism, and how to bind a socket to a specific network device regardless of routing table using the SO_BINDTODEVICE socket option.

Combined, the above two provide a library that once loaded (using LD_PRELOAD_bindtodevice.so) will cause an application to be bounded to a specific device by overriding all the socket() calls it makes.

Please note that this is a mere proof of concept. If you want to use it for something real it is advised to handle both parameter passing and error condition in a more sane fashion… 😉

Get the source file here: bindtodevice.c