Changes: Disable out of memory adjustments command line parameter added to invoker, code refactoring

RevBy: Antti Kervinen
pull/1/head
Alexey Shilov 15 years ago
parent d5a0a4994e
commit 47653f4e4a

3
debian/changelog vendored

@ -1,6 +1,7 @@
applauncherd (0.21.0) unstable; urgency=low
*
* Changes: Disable out of memory adjustments command line parameter added to invoker
* Changes: AppData code refactoring
-- Jussi Lind <jussi.lind@nokia.com> Fri, 04 Mar 2011 14:08:07 +0200

@ -22,7 +22,6 @@
#include <stdint.h>
const uint32_t INVOKER_MSG_MASK = 0xffff0000;
const uint32_t INVOKER_MSG_MAGIC = 0xb0070000;
const uint32_t INVOKER_MSG_MAGIC_VERSION_MASK = 0x0000ff00;
const uint32_t INVOKER_MSG_MAGIC_VERSION = 0x00000300;
@ -32,6 +31,10 @@ const uint32_t INVOKER_MSG_MAGIC_OPTION_DLOPEN_GLOBAL = 0x00000002;
const uint32_t INVOKER_MSG_MAGIC_OPTION_DLOPEN_DEEP = 0x00000004;
const uint32_t INVOKER_MSG_MAGIC_OPTION_SINGLE_INSTANCE = 0x00000008;
const uint32_t INVOKER_MSG_MAGIC_OPTION_SPLASH_SCREEN = 0x00000010;
const uint32_t INVOKER_MSG_MAGIC_OPTION_OOM_ADJ_DISABLE = 0x00000020;
const uint32_t INVOKER_MSG_MASK = 0xffff0000;
const uint32_t INVOKER_MSG_NAME = 0x5a5e0000;
const uint32_t INVOKER_MSG_EXEC = 0xe8ec0000;
const uint32_t INVOKER_MSG_ARGS = 0xa4650000;

@ -430,6 +430,8 @@ static void usage(int status)
" Show splash screen from the LANDSCAPE-FILE\n"
" in case the device is in landscape orientation.\n"
" (To be implemented)\n"
" -o, --oom-adj-disable Disable default out of memory killing adjustments \n"
" for launched process. \n"
" -h, --help Print this help.\n\n"
"Example: %s --type=m /usr/bin/helloworld\n\n",
PROG_NAME_INVOKER, PROG_NAME_LAUNCHER, DEFAULT_DELAY, RESPAWN_DELAY, MAX_RESPAWN_DELAY, PROG_NAME_INVOKER);
@ -610,6 +612,7 @@ int main(int argc, char *argv[])
{"global-syms", no_argument, NULL, 'G'},
{"deep-syms", no_argument, NULL, 'D'},
{"single-instance", no_argument, NULL, 's'},
{"oom-adj-disable", no_argument, NULL, 'o'},
{"type", required_argument, NULL, 't'},
{"delay", required_argument, NULL, 'd'},
{"respawn", required_argument, NULL, 'r'},
@ -621,7 +624,7 @@ int main(int argc, char *argv[])
// Parse options
// TODO: Move to a function
int opt;
while ((opt = getopt_long(argc, argv, "hcwnGDsd:t:r:S:L:", longopts, NULL)) != -1)
while ((opt = getopt_long(argc, argv, "hcwnGDsod:t:r:S:L:", longopts, NULL)) != -1)
{
switch(opt)
{
@ -637,6 +640,10 @@ int main(int argc, char *argv[])
// nothing to do, it's by default now
break;
case 'o':
magic_options |= INVOKER_MSG_MAGIC_OPTION_OOM_ADJ_DISABLE;
break;
case 'n':
wait_term = false;
magic_options &= (~INVOKER_MSG_MAGIC_OPTION_WAIT);

@ -53,21 +53,26 @@ int AppData::options() const
return m_options;
}
bool AppData::dlopenGlobal()
bool AppData::dlopenGlobal() const
{
return (m_options & INVOKER_MSG_MAGIC_OPTION_DLOPEN_GLOBAL) != 0;
}
bool AppData::dlopenDeep()
bool AppData::dlopenDeep() const
{
return (m_options & INVOKER_MSG_MAGIC_OPTION_DLOPEN_DEEP) != 0;
}
bool AppData::singleInstance()
bool AppData::singleInstance() const
{
return (m_options & INVOKER_MSG_MAGIC_OPTION_SINGLE_INSTANCE) != 0;
}
bool AppData::disableOutOfMemAdj() const
{
return (m_options & INVOKER_MSG_MAGIC_OPTION_OOM_ADJ_DISABLE) != 0;
}
void AppData::setArgc(int newArgc)
{
m_argc = newArgc;
@ -133,7 +138,7 @@ void AppData::setDelay(int newDelay)
m_delay = newDelay;
}
int AppData::delay()
int AppData::delay() const
{
return m_delay;
}

@ -54,13 +54,16 @@ public:
int options() const;
//! Return whether or not RTLD_GLOBAL should be used in dlopen
bool dlopenGlobal();
bool dlopenGlobal() const;
//! Return whether or not RTLD_DEEPBIND should be used in dlopen
bool dlopenDeep();
bool dlopenDeep() const;
//! Return whether or not application should be launched as a single instance application
bool singleInstance();
bool singleInstance() const;
//! Return whether or not disable default out of memory killing adjustments for application process
bool disableOutOfMemAdj() const;
//! Set argument count
void setArgc(int argc);
@ -102,7 +105,7 @@ public:
void setDelay(int delay);
//!Return respawn delay
int delay();
int delay() const;
//! Set entry point for the application
void setEntry(entry_t entry);

@ -323,6 +323,7 @@ void Booster::setEnvironmentBeforeLaunch()
setegid(orig);
// Reset out-of-memory killer adjustment
if (!m_appData->disableOutOfMemAdj())
resetOomAdj();
#ifdef HAVE_CREDS

Loading…
Cancel
Save