Changes: splash command line parameters and invoker-applauncherd protocol added

RevBy: Antti Kervinen
pull/1/head
Juha Lintula 15 years ago
parent 1dbd4a8963
commit 5a8cdff0cf

7
debian/changelog vendored

@ -1,3 +1,10 @@
applauncherd (0.19.0) unstable; urgency=low
* Splash command line parameters added to invoker
* Implemented: SWP#DUI-5050
-- Juha Lintula <juha.lintula@nokia.com> Fri, 25 Feb 2011 13:48:05 +0200
applauncherd (0.18.4) stable; urgency=low
* Fixes: NB#229925 - applauncherd-single-instance is missing debug symbols

@ -31,6 +31,7 @@ const uint32_t INVOKER_MSG_MAGIC_OPTION_WAIT = 0x00000001;
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_NAME = 0x5a5e0000;
const uint32_t INVOKER_MSG_EXEC = 0xe8ec0000;
const uint32_t INVOKER_MSG_ARGS = 0xa4650000;
@ -41,6 +42,7 @@ const uint32_t INVOKER_MSG_IDS = 0xb2df4000;
const uint32_t INVOKER_MSG_IO = 0x10fd0000;
const uint32_t INVOKER_MSG_END = 0xdead0000;
const uint32_t INVOKER_MSG_PID = 0x1d1d0000;
const uint32_t INVOKER_MSG_SPLASH = 0x5b1a0000;
const uint32_t INVOKER_MSG_EXIT = 0xe4170000;
const uint32_t INVOKER_MSG_ACK = 0x600d0000;
const uint32_t INVOKER_MSG_BAD_CREDS = 0x60035800;

@ -278,14 +278,18 @@ static void invoker_send_magic(int fd, uint32_t options)
// Sends the process name to be invoked.
static void invoker_send_name(int fd, char *name)
{
// Send action.
invoke_send_msg(fd, INVOKER_MSG_NAME);
invoke_send_str(fd, name);
}
static void invoker_send_splash_file(int fd, char *filename)
{
invoke_send_msg(fd, INVOKER_MSG_SPLASH);
invoke_send_str(fd, filename);
}
static void invoker_send_exec(int fd, char *exec)
{
// Send action.
invoke_send_msg(fd, INVOKER_MSG_EXEC);
invoke_send_str(fd, exec);
}
@ -294,7 +298,6 @@ static void invoker_send_args(int fd, int argc, char **argv)
{
int i;
// Send action.
invoke_send_msg(fd, INVOKER_MSG_ARGS);
invoke_send_msg(fd, argc);
for (i = 0; i < argc; i++)
@ -306,7 +309,6 @@ static void invoker_send_args(int fd, int argc, char **argv)
static void invoker_send_prio(int fd, int prio)
{
// Send action.
invoke_send_msg(fd, INVOKER_MSG_PRIO);
invoke_send_msg(fd, prio);
}
@ -314,7 +316,6 @@ static void invoker_send_prio(int fd, int prio)
// Sends booster respawn delay
static void invoker_send_delay(int fd, int delay)
{
// Send action.
invoke_send_msg(fd, INVOKER_MSG_DELAY);
invoke_send_msg(fd, delay);
}
@ -322,7 +323,6 @@ static void invoker_send_delay(int fd, int delay)
// Sends UID and GID
static void invoker_send_ids(int fd, int uid, int gid)
{
// Send action.
invoke_send_msg(fd, INVOKER_MSG_IDS);
invoke_send_msg(fd, uid);
invoke_send_msg(fd, gid);
@ -336,7 +336,6 @@ static void invoker_send_env(int fd)
// Count environment variables.
for (n_vars = 0; environ[n_vars] != NULL; n_vars++) ;
// Send action.
invoke_send_msg(fd, INVOKER_MSG_ENV);
invoke_send_msg(fd, n_vars);
@ -389,7 +388,6 @@ static void invoker_send_io(int fd)
// Sends the END message
static void invoker_send_end(int fd)
{
// Send action.
invoke_send_msg(fd, INVOKER_MSG_END);
invoke_recv_ack(fd);
@ -420,6 +418,11 @@ static void usage(int status)
" -s, --single-instance Launch the application as a single instance.\n"
" The existing application window will be activated\n"
" if already launched.\n"
" -S, --splash FILE Show splash screen from the FILE.\n"
" -L, --splash-landscape LANDSCAPE-FILE\n"
" Show splash screen from the LANDSCAPE-FILE\n"
" in case the device is in landscape orientation.\n"
" (To be implemented)\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);
@ -482,7 +485,8 @@ void invoke_fallback(char **prog_argv, char *prog_name, bool wait_term)
// "normal" invoke through a socket connection
int invoke_remote(int fd, int prog_argc, char **prog_argv, char *prog_name,
uint32_t magic_options, bool wait_term, unsigned int respawn_delay)
uint32_t magic_options, bool wait_term, unsigned int respawn_delay,
char *splash_file)
{
int status = 0;
@ -503,6 +507,8 @@ int invoke_remote(int fd, int prog_argc, char **prog_argv, char *prog_name,
invoker_send_prio(fd, prog_prio);
invoker_send_delay(fd, respawn_delay);
invoker_send_ids(fd, getuid(), getgid());
if (( magic_options & INVOKER_MSG_MAGIC_OPTION_SPLASH_SCREEN ) != 0)
invoker_send_splash_file(fd, splash_file);
invoker_send_io(fd);
invoker_send_env(fd);
invoker_send_end(fd);
@ -533,7 +539,8 @@ int invoke_remote(int fd, int prog_argc, char **prog_argv, char *prog_name,
// Invokes the given application
static int invoke(int prog_argc, char **prog_argv, char *prog_name,
enum APP_TYPE app_type, uint32_t magic_options, bool wait_term, unsigned int respawn_delay)
enum APP_TYPE app_type, uint32_t magic_options, bool wait_term, unsigned int respawn_delay,
char *splash_file)
{
int status = 0;
@ -551,7 +558,8 @@ static int invoke(int prog_argc, char **prog_argv, char *prog_name,
else
{
status = invoke_remote(fd, prog_argc, prog_argv, prog_name,
magic_options, wait_term, respawn_delay);
magic_options, wait_term, respawn_delay,
splash_file);
close(fd);
}
}
@ -569,6 +577,7 @@ int main(int argc, char *argv[])
unsigned int respawn_delay = RESPAWN_DELAY;
char **prog_argv = NULL;
char *prog_name = NULL;
char *splash_file = NULL;
struct stat file_stat;
// wait-term parameter by default
@ -597,13 +606,15 @@ int main(int argc, char *argv[])
{"type", required_argument, NULL, 't'},
{"delay", required_argument, NULL, 'd'},
{"respawn", required_argument, NULL, 'r'},
{"splash", required_argument, NULL, 'S'},
{"splash-landscape", required_argument, NULL, 'L'},
{0, 0, 0, 0}
};
// Parse options
// TODO: Move to a function
int opt;
while ((opt = getopt_long(argc, argv, "hcwnGDsd:t:r:", longopts, NULL)) != -1)
while ((opt = getopt_long(argc, argv, "hcwnGDsd:t:r:S:L:", longopts, NULL)) != -1)
{
switch(opt)
{
@ -663,6 +674,16 @@ int main(int argc, char *argv[])
magic_options |= INVOKER_MSG_MAGIC_OPTION_SINGLE_INSTANCE;
break;
case 'S':
magic_options |= INVOKER_MSG_MAGIC_OPTION_SPLASH_SCREEN;
splash_file = optarg;
break;
case 'L':
// Just a placeholder for future development
// of landscape splash screen
break;
case '?':
usage(1);
}
@ -712,7 +733,7 @@ int main(int argc, char *argv[])
// Send commands to the launcher daemon
info("Invoking execution: '%s'\n", prog_name);
int ret_val = invoke(prog_argc, prog_argv, prog_name, app_type, magic_options, wait_term, respawn_delay);
int ret_val = invoke(prog_argc, prog_argv, prog_name, app_type, magic_options, wait_term, respawn_delay, splash_file);
// Sleep for delay before exiting
if (delay)

@ -36,7 +36,8 @@ AppData::AppData() :
m_entry(NULL),
m_ioDescriptors(),
m_gid(0),
m_uid(0)
m_uid(0),
m_splashFileName("")
#if defined (HAVE_CREDS)
, m_peerCreds(NULL)
#endif
@ -107,6 +108,16 @@ const string & AppData::fileName() const
return m_fileName;
}
void AppData::setSplashFileName(const string & fileName)
{
m_splashFileName = fileName;
}
const string & AppData::splashFileName() const
{
return m_splashFileName;
}
void AppData::setPriority(int newPriority)
{
m_prio = newPriority;

@ -86,6 +86,12 @@ public:
//! Return file name
const string & fileName() const;
//! Set file name of the image shown as splash screen
void setSplashFileName(const string & fileName);
//! Return file name of the image shown as splash screen
const string & splashFileName() const;
//! Set priority
void setPriority(int priority);
@ -149,6 +155,7 @@ private:
vector<int> m_ioDescriptors;
gid_t m_gid;
uid_t m_uid;
string m_splashFileName;
#if defined (HAVE_CREDS)
creds_t m_peerCreds;

@ -36,7 +36,6 @@
#include <sys/types.h>
#include <grp.h>
#ifdef HAVE_CREDS
#include <sys/creds.h>

@ -37,6 +37,7 @@ Connection::Connection(int socketFd, bool testMode) :
m_fd(-1),
m_curSocket(socketFd),
m_fileName(""),
m_splashFileName(""),
m_argc(0),
m_argv(NULL),
m_priority(0),
@ -295,6 +296,17 @@ bool Connection::receiveExec()
return true;
}
bool Connection::receiveSplash()
{
const char* filename = recvStr();
if (!filename)
return false;
m_splashFileName = filename;
delete [] filename;
return true;
}
bool Connection::receivePriority()
{
recvMsg(&m_priority);
@ -503,6 +515,10 @@ bool Connection::receiveActions()
receiveIDs();
break;
case INVOKER_MSG_SPLASH:
receiveSplash();
break;
case INVOKER_MSG_END:
sendMsg(INVOKER_MSG_ACK);
@ -544,6 +560,7 @@ bool Connection::receiveApplicationData(AppData* appData)
appData->setDelay(m_delay);
appData->setArgc(m_argc);
appData->setArgv(m_argv);
appData->setSplashFileName(m_splashFileName);
appData->setIODescriptors(vector<int>(m_io, m_io + IO_DESCRIPTOR_COUNT));
appData->setIDs(m_uid, m_gid);
}

@ -125,6 +125,9 @@ private:
//! Receive booster respawn delay
bool receiveDelay();
//! Receive filename used as splash screen image
bool receiveSplash();
//! Send process pid
bool sendPid(pid_t pid);
@ -156,6 +159,7 @@ private:
uint32_t m_priority;
uint32_t m_delay;
bool m_sendPid;
string m_splashFileName;
gid_t m_gid;
uid_t m_uid;

Loading…
Cancel
Save