aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--docs/afm-user-daemon.md47
-rw-r--r--docs/overview.md6
-rw-r--r--docs/quick-tutorial.md24
-rwxr-xr-xscripts/afm-util12
-rw-r--r--src/afm-main-binding.c16
-rw-r--r--src/afm-run.c26
-rw-r--r--src/afm-run.h4
-rw-r--r--src/afm-user-daemon.c43
8 files changed, 110 insertions, 68 deletions
diff --git a/docs/afm-user-daemon.md b/docs/afm-user-daemon.md
index ad625e9..cb54b10 100644
--- a/docs/afm-user-daemon.md
+++ b/docs/afm-user-daemon.md
@@ -24,8 +24,7 @@ applications on behalf of a user. Its main tasks are:
- list current runnable or running applications
- - stop (aka pause), continue (aka resume), terminate
- a running instance of a given application
+ - pause, resume, terminate a running instance of a given application
- transfer requests for installation/uninstallation
of applications to the corresponding system daemon
@@ -115,8 +114,8 @@ that it launched.
When owning the right permissions, a client can get the list
of running instances and details about a specific
-running instance. It can also terminates, stops or
-continues a given application.
+running instance. It can also terminate, pause or
+resume a given application.
### Installing and uninstalling applications ###
@@ -400,7 +399,7 @@ The **afm-user-daemon** is listening on destination name
***org.AGL.afm.user*** at object path ***/org/AGL/afm/user***
on interface ***org.AGL.afm.user*** for following members:
***runnables***, ***detail***, ***start***, ***terminate***,
-***stop***, ***continue***, ***runners***, ***state***,
+***pause***, ***resume***, ***runners***, ***state***,
***install*** and ***uninstall***.
D-Bus is mainly used for signaling and discovery. Its optimized
@@ -469,13 +468,13 @@ Here is the summary of ***afm-util***:
terminate the running instance rid
- - **afm-util stop rid **:
+ - **afm-util pause rid **:
- stop the running instance rid
+ pause the running instance rid
- - **afm-util continue rid **:
+ - **afm-util resume rid **:
- continue the previously rid
+ resume the previously paused rid
- **afm-util state rid **:
@@ -647,19 +646,37 @@ The field "mode" is a string equal to either "local" or "remote".
#### Method org.AGL.afm.user.stop
-**Description**: Stops the application attached to *runid* until terminate or continue.
+Obsolete since 8th November 2016 (2016/11/08).
+Kept for compatibility.
-**Input**: The *runid* (integer) of the running instance to stop.
+Use **org.AGL.afm.user.pause** instead.
+
+---
+
+#### Method org.AGL.afm.user.continue
+
+Obsolete since 8th November 2016 (2016/11/08).
+Kept for compatibility.
+
+Use **org.AGL.afm.user.resume** instead.
+
+---
+
+#### Method org.AGL.afm.user.pause
+
+**Description**: Pauses the application attached to *runid* until terminate or resume.
+
+**Input**: The *runid* (integer) of the running instance to pause.
**output**: the value 'true'.
---
-#### Method org.AGL.afm.user.continue
+#### Method org.AGL.afm.user.resume
-**Description**: Continues the application attached to *runid* previously stopped.
+**Description**: Resumes the application attached to *runid* previously paused.
-**Input**: The *runid* (integer) of the running instance to continue.
+**Input**: The *runid* (integer) of the running instance to resume.
**output**: the value 'true'.
@@ -674,7 +691,7 @@ The field "mode" is a string equal to either "local" or "remote".
**output**: An object describing instance state. It contains:
the runid (integer), the pids of the processes as an array starting
with the group leader, the id of the running application (string),
-the state of the application (string either: "starting", "running", "stopped").
+the state of the application (string either: "starting", "running", "paused").
Example of returned state:
diff --git a/docs/overview.md b/docs/overview.md
index d39e66e..99dcc1d 100644
--- a/docs/overview.md
+++ b/docs/overview.md
@@ -77,7 +77,7 @@ the dependencies and with minor architectural improvements for AGL.
These components are **afm-system-daemon** and **afm-user-daemon**.
They provides infrastructure for installing, uninstalling,
-launching, terminating, stopping and resuming applications in
+launching, terminating, pausing and resuming applications in
a multi user secure environment.
A third component exists in the framework, the binder **afb-daemon**.
@@ -197,7 +197,7 @@ the components are:
* ***afm-system-daemon***: in charge of installing and uninstalling applications.
* ***afm-user-daemon***: in charge of listing applications, querying application details,
- starting, terminating, stopping, resuming applications and their instances
+ starting, terminating, pausing, resuming applications and their instances
for a given user context.
* ***afb-binder***: in charge of serving resources and features through an
@@ -219,7 +219,7 @@ to ensure security and privacy. It also includes features of reporting
using audit features and by managing logs and alerts.
The application framework manages the applications:
-installing, uninstalling, starting, stopping, listing ...
+installing, uninstalling, starting, pausing, listing ...
The application framework uses the security model/framework
to ensure the security and the privacy of the applications that
diff --git a/docs/quick-tutorial.md b/docs/quick-tutorial.md
index cd23c22..081dfe5 100644
--- a/docs/quick-tutorial.md
+++ b/docs/quick-tutorial.md
@@ -47,7 +47,7 @@ We can see that there are two daemons running:
* **afm-system-daemon** runs with a system user 'afm' and is responsible for installing/uninstalling packages
* **afm-user-daemon** runs as a user daemon (currently as root because it's the only real user on the target board) and is responsible for the whole lifecycle of the applications running inside the user session.
-The application framework has a tool running on the Command Line Interface (CLI). Using the **afm-util** command, you can install, uninstall, list, run, stop ... applications.
+The application framework has a tool running on the Command Line Interface (CLI). Using the **afm-util** command, you can install, uninstall, list, run, pause ... applications.
To begin, run '**afm-util help**' to get a quick help on commands:
@@ -75,16 +75,16 @@ To begin, run '**afm-util help**' to get a quick help on commands:
start id start an instance of the widget of id
kill rid
- terminate rid terminate the running instance rid
+ terminate rid terminate the running instance rid
stop rid
- pause rid stop the running instance rid
+ pause rid pause the running instance rid
resume rid
- continue rid continue the previously rid
+ continue rid resume the previously rid
status rid
- state rid get status of the running instance rid
+ state rid get status of the running instance rid
### Install an application
@@ -144,15 +144,15 @@ To check for running applications, just run:
root@porter:~# afm-util ps
[ { "runid": 1, "state": "running", "id": "webapps-annex@0.0" } ]
-The 'runid' is the application instance ID and is used as an argument for the subcommands controlling the application runtime state (kill/stop/resume/status)
+The 'runid' is the application instance ID and is used as an argument for the subcommands controlling the application runtime state (kill/pause/resume/status)
-### Stop application
-To stop the application that was just started (the one with RUNID 1), just run the stop command:
+### Pause application
+To pause the application that was just started (the one with RUNID 1), just run the pause command:
root@porter:~# afm-util terminate 1
true
-The application is now stopped, as confirmed by a list of running apps:
+The application is now paused, as confirmed by a list of running apps:
root@porter:~# afm-util ps
[ ]
@@ -172,7 +172,7 @@ Then list the installed apps to confirm the removal:
afm-client: a sample HTML5 'Homescreen'
---------------------------------------
-**afm-client** is a HTML5 UI that allows to install/uninstall applications as well as starting/stopping them as already demonstrated with afm-util.
+**afm-client** is a HTML5 UI that allows to install/uninstall applications as well as starting/pausing them as already demonstrated with afm-util.
The HTML5 UI is accessible remotely through this URL:
http://[board_ip]:1234/opa?token=132456789
@@ -193,9 +193,9 @@ In the toolbar, click on the button representing the Rabbit application. You'll
Click on the 'start' item: the application starts and should be visible as a webview on the target board display. Note that at this point, we could also run the application remotely, that is in the same browser as the Homescreen app. By default, the application framework is configured to run applications 'locally' on the board display.
-### Stopping an application
+### Pausing an application
-In the Homescreen application, click again on the Rabbit application button, then select 'stop': the application then stops.
+In the Homescreen application, click again on the Rabbit application button, then select 'pause': the application then pauses.
### Uninstalling an application
diff --git a/scripts/afm-util b/scripts/afm-util
index 60434a7..243b43c 100755
--- a/scripts/afm-util
+++ b/scripts/afm-util
@@ -59,12 +59,12 @@ case "$1" in
stop|pause)
i=$2
- send stop "$i"
+ send pause "$i"
;;
resume|continue)
i=$2
- send continue "$i"
+ send resume "$i"
;;
state|status)
@@ -97,16 +97,16 @@ The commands are:
start id start an instance of the widget of id
kill rid
- terminate rid terminate the running instance rid
+ terminate rid terminate the running instance rid
stop rid
- pause rid stop the running instance rid
+ pause rid pause the running instance rid
resume rid
- continue rid continue the previously rid
+ continue rid continue the previously paused rid
status rid
- state rid get status of the running instance rid
+ state rid get status of the running instance rid
EOC
;;
diff --git a/src/afm-main-binding.c b/src/afm-main-binding.c
index 6d90624..701354c 100644
--- a/src/afm-main-binding.c
+++ b/src/afm-main-binding.c
@@ -34,7 +34,9 @@ static const char _id_[] = "id";
static const char _install_[] = "install";
static const char _local_[] = "local";
static const char _mode_[] = "mode";
+static const char _pause_[] = "pause";
static const char _remote_[] = "remote";
+static const char _resume_[] = "resume";
static const char _runid_[] = "runid";
static const char _runnables_[] = "runnables";
static const char _runners_[] = "runners";
@@ -298,14 +300,14 @@ static void terminate(struct afb_req request)
call_runid(request, _terminate_);
}
-static void stop(struct afb_req request)
+static void pause(struct afb_req request)
{
- call_runid(request, _stop_);
+ call_runid(request, _pause_);
}
-static void continue_(struct afb_req request)
+static void resume(struct afb_req request)
{
- call_runid(request, _continue_);
+ call_runid(request, _resume_);
}
static void runners(struct afb_req request)
@@ -375,8 +377,10 @@ static const struct afb_verb_desc_v1 verbs[] =
{_detail_ , AFB_SESSION_CHECK, detail, "Get the details for one application"},
{_start_ , AFB_SESSION_CHECK, start, "Start an application"},
{_terminate_, AFB_SESSION_CHECK, terminate, "Terminate a running application"},
- {_stop_ , AFB_SESSION_CHECK, stop, "Stop (pause) a running application"},
- {_continue_ , AFB_SESSION_CHECK, continue_, "Continue (resume) a stopped application"},
+ {_pause_ , AFB_SESSION_CHECK, pause, "Pause a running application"},
+ {_resume_ , AFB_SESSION_CHECK, resume, "Resume a paused application"},
+ {_stop_ , AFB_SESSION_CHECK, pause, "Obsolete since 2016/11/08, use 'pause' instead"},
+ {_continue_ , AFB_SESSION_CHECK, resume, "Obsolete since 2016/11/08, use 'resume' instead"},
{_runners_ , AFB_SESSION_CHECK, runners, "Get the list of running applications"},
{_state_ , AFB_SESSION_CHECK, state, "Get the state of a running application"},
{_install_ , AFB_SESSION_CHECK, install, "Install an application using a widget file"},
diff --git a/src/afm-run.c b/src/afm-run.c
index 4de0fd2..131f9cb 100644
--- a/src/afm-run.c
+++ b/src/afm-run.c
@@ -51,7 +51,7 @@
enum appstate {
as_starting, /* start in progress */
as_running, /* started and running */
- as_stopped, /* stopped */
+ as_paused, /* paused */
as_terminating, /* termination in progress */
as_terminated /* terminated */
};
@@ -279,11 +279,11 @@ static void started(int runid)
{
}
-static void stopped(int runid)
+static void paused(int runid)
{
}
-static void continued(int runid)
+static void resumed(int runid)
{
}
@@ -302,7 +302,7 @@ static void removed(int runid)
* for 'runid' and put the runner's state to 'tostate'
* in case of success.
*
- * Only processes in the state 'as_running' or 'as_stopped'
+ * Only processes in the state 'as_running' or 'as_paused'
* can be signalled.
*
* Returns 0 in case of success or -1 in case of error.
@@ -315,7 +315,7 @@ static int killrunner(int runid, int sig, enum appstate tostate)
errno = ENOENT;
rc = -1;
}
- else if (runner->state != as_running && runner->state != as_stopped) {
+ else if (runner->state != as_running && runner->state != as_paused) {
errno = EINVAL;
rc = -1;
}
@@ -354,13 +354,13 @@ static void on_sigchld(int signum, siginfo_t *info, void *uctxt)
pgid_remove(runner);
runner->next_by_pgid = terminated_runners;
terminated_runners = runner;
- /* ensures that all the group stops */
+ /* ensures that all the group terminates */
killpg(runner->pids[0], SIGKILL);
break;
case CLD_STOPPED:
/* update the state */
- runner->state = as_stopped;
+ runner->state = as_paused;
break;
case CLD_CONTINUED:
@@ -437,7 +437,7 @@ static json_object *mkstate(struct apprun *runner)
switch(runner->state) {
case as_starting:
case as_running:
- case as_stopped:
+ case as_paused:
pids = j_add_new_array(result, "pids");
if (!pids)
goto error2;
@@ -456,8 +456,8 @@ static json_object *mkstate(struct apprun *runner)
case as_running:
state = "running";
break;
- case as_stopped:
- state = "stopped";
+ case as_paused:
+ state = "paused";
break;
default:
state = "terminated";
@@ -558,9 +558,9 @@ int afm_run_terminate(int runid)
*
* Returns 0 in case of success or -1 in case of error
*/
-int afm_run_stop(int runid)
+int afm_run_pause(int runid)
{
- return killrunner(runid, SIGSTOP, as_stopped);
+ return killrunner(runid, SIGSTOP, as_paused);
}
/*
@@ -568,7 +568,7 @@ int afm_run_stop(int runid)
*
* Returns 0 in case of success or -1 in case of error
*/
-int afm_run_continue(int runid)
+int afm_run_resume(int runid)
{
return killrunner(runid, SIGCONT, as_running);
}
diff --git a/src/afm-run.h b/src/afm-run.h
index 5b2e2b8..6e3469a 100644
--- a/src/afm-run.h
+++ b/src/afm-run.h
@@ -18,8 +18,8 @@
extern int afm_run_start(struct json_object *appli, enum afm_launch_mode mode, char **uri);
extern int afm_run_terminate(int runid);
-extern int afm_run_stop(int runid);
-extern int afm_run_continue(int runid);
+extern int afm_run_pause(int runid);
+extern int afm_run_resume(int runid);
extern struct json_object *afm_run_list();
extern struct json_object *afm_run_state(int runid);
diff --git a/src/afm-user-daemon.c b/src/afm-user-daemon.c
index aecea8d..e71e011 100644
--- a/src/afm-user-daemon.c
+++ b/src/afm-user-daemon.c
@@ -246,7 +246,7 @@ static void on_start(struct sd_bus_message *smsg, struct json_object *obj, void
&& j_add_string(resp, "uri", uri))
jbus_reply_j(smsg, resp);
else {
- afm_run_stop(runid);
+ afm_run_terminate(runid);
jbus_reply_error_s(smsg, error_system);
}
json_object_put(resp);
@@ -254,30 +254,48 @@ static void on_start(struct sd_bus_message *smsg, struct json_object *obj, void
}
/*
- * On query "stop" from 'smsg' with parameters of 'obj'.
+ * On query "pause" from 'smsg' with parameters of 'obj'.
*/
-static void on_stop(struct sd_bus_message *smsg, struct json_object *obj, void *unused)
+static void on_pause(struct sd_bus_message *smsg, struct json_object *obj, void *unused)
{
int runid, status;
- if (onrunid(smsg, obj, "stop", &runid)) {
- status = afm_run_stop(runid);
+ if (onrunid(smsg, obj, "pause", &runid)) {
+ status = afm_run_pause(runid);
reply_status(smsg, status, error_not_found);
}
}
/*
- * On query "continue" from 'smsg' with parameters of 'obj'.
+ * On query "resume" from 'smsg' with parameters of 'obj'.
*/
-static void on_continue(struct sd_bus_message *smsg, struct json_object *obj, void *unused)
+static void on_resume(struct sd_bus_message *smsg, struct json_object *obj, void *unused)
{
int runid, status;
- if (onrunid(smsg, obj, "continue", &runid)) {
- status = afm_run_continue(runid);
+ if (onrunid(smsg, obj, "resume", &runid)) {
+ status = afm_run_resume(runid);
reply_status(smsg, status, error_not_found);
}
}
/*
+ * On query "stop" from 'smsg' with parameters of 'obj'.
+ */
+static void on_stop(struct sd_bus_message *smsg, struct json_object *obj, void *unused)
+{
+ NOTICE("call to obsolete 'stop'");
+ on_pause(smsg, obj, unused);
+}
+
+/*
+ * On query "continue" from 'smsg' with parameters of 'obj'.
+ */
+static void on_continue(struct sd_bus_message *smsg, struct json_object *obj, void *unused)
+{
+ NOTICE("call to obsolete 'continue'");
+ on_resume(smsg, obj, unused);
+}
+
+/*
* On query "terminate" from 'smsg' with parameters of 'obj'.
*/
static void on_terminate(struct sd_bus_message *smsg, struct json_object *obj, void *unused)
@@ -583,17 +601,20 @@ int main(int ac, char **av)
|| jbus_add_service_j(user_bus, "detail", on_detail, NULL)
|| jbus_add_service_j(user_bus, "start", on_start, NULL)
|| jbus_add_service_j(user_bus, "terminate", on_terminate, NULL)
+ || jbus_add_service_j(user_bus, "pause", on_pause, NULL)
+ || jbus_add_service_j(user_bus, "resume", on_resume, NULL)
|| jbus_add_service_j(user_bus, "stop", on_stop, NULL)
|| jbus_add_service_j(user_bus, "continue", on_continue, NULL)
|| jbus_add_service_j(user_bus, "runners", on_runners, NULL)
|| jbus_add_service_j(user_bus, "state", on_state, NULL)
#if defined(EXPLICIT_CALL)
|| jbus_add_service_s(user_bus, "install", on_install, NULL)
- || jbus_add_service_s(user_bus, "uninstall", on_uninstall, NULL)) {
+ || jbus_add_service_s(user_bus, "uninstall", on_uninstall, NULL)
#else
|| jbus_add_service_s(user_bus, "install", (void (*)(struct sd_bus_message *, const char *, void *))propagate, "install")
- || jbus_add_service_s(user_bus, "uninstall", (void (*)(struct sd_bus_message *, const char *, void *))propagate, "uninstall")) {
+ || jbus_add_service_s(user_bus, "uninstall", (void (*)(struct sd_bus_message *, const char *, void *))propagate, "uninstall")
#endif
+ ) {
ERROR("adding services failed");
return 1;
}