Givertcap was created to overcome the lack of capability support in Linux file systems. Once the Linux file systems start to have the necessary functions themselves, this apps becomes unnecessary.
To use this app you need to compile it and make it setuid-root. After this other applications can use this mini-app to gain capabilities that are necessary for real-time operation.
This page has information on how to get the software, how to to install/uninstall it and how to use it in your own software.
The kernel is patched by changing two lines from header "linux/capability.h":
#define CAP_INIT_EFF_SET ( ~0 ) #define CAP_INIT_INH_SET ( ~0 )I used to recemmend the following, but it seems that it won't work with some new compiler/kernel combinations:
#define CAP_INIT_EFF_SET { ~0 } #define CAP_INIT_INH_SET { ~0 }(For further information see chapter 10 of the capfaq-0.2 document ftp.kernel.org/pub/linux/libs/security/linux-privs/kernel-2.4/capfaq-0.2.txt)
INSTALLING LIBCAP
ftp.kernel.org/pub/linux/libs/security/linux-privs/kernel-2.4/). You may also find precompiled packages for your Linux distribution in some other places like www.rpmfind.net.
Here is a ready-made search from rpmfind.net for you. And this is a Google search for you.
g++ -Wall -O2 givertcap.C -o givertcap -lcap cp givertcap /usr/local/bin/ chown root /usr/local/bin/givertcap; chgrp users /usr/local/bin/givertcap; chmod 4755 /usr/local/bin/givertcap; |
rm /usr/local/bin/givertcap |
1) Create group "rtusers" 2) Run the following commands: chown root /usr/local/bin/givertcap; chgrp rtusers /usr/local/bin/givertcap; chmod 4750 /usr/local/bin/givertcap; |
The following code is taken directly from Mustajuuri. I encourage the usage of environment variable "GIVERTCAP" to be used so that users can override the default path if necessary.
/** The path to the application that gives us the necessary capabilities. The "capability application" should be able to pass this application the necessary capabilities without any command line arguments. If this variable is null then the system tries to get the path of the application from environment variable "GIVERTCAP". If the variable is not defined, then default path is used: "/usr/local/bin/givertcap". This variable is used in MJ_RootPowers::getCapabilities. */ const char *MJ_RootPowers::m_capApplication = 0; /** Get real-time capabilities to this process. This method is only useful on Linux. This method is also defined on other systems but it does nothing on them. @see MJ_RootPowers::m_capApplication. */ void MJ_RootPowers::getCapabilities() { #ifdef __linux__ const char * app = m_capApplication; if(!app) app = getenv("GIVERTCAP"); if(!app) app = "/usr/local/bin/givertcap"; system(app); #endif // __linux__ } |
It seems some other projects are using it as well, for example MusE.