Listing processes that are terminated
might be disturbing. So it is now removed.
In some future, it should be good to return on
option even terminated processes with an indication
of their termination status.
Bug-AGL: SPEC-728
Change-Id: I89bff7f880e6a5717c1572e3ee80cfe7dec8e594
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
pid = systemd_unit_pid_of_dpath(isuser, udpath);
if (pid > 0 && j_read_string_at(appli, "id", &id)) {
state = systemd_unit_state_of_dpath(isuser, udpath);
pid = systemd_unit_pid_of_dpath(isuser, udpath);
if (pid > 0 && j_read_string_at(appli, "id", &id)) {
state = systemd_unit_state_of_dpath(isuser, udpath);
- desc = mkstate(id, pid, pid, state);
- if (desc && json_object_array_add(result, desc) == -1) {
- ERROR("can't add desc %s to result", json_object_get_string(desc));
- json_object_put(desc);
+ if (state == SysD_State_Active) {
+ desc = mkstate(id, pid, pid, state);
+ if (desc && json_object_array_add(result, desc) == -1) {
+ ERROR("can't add desc %s to result", json_object_get_string(desc));
+ json_object_put(desc);
+ }
/* get the dpath */
dpath = systemd_unit_dpath_by_pid(1 /* TODO: isuser? */, (unsigned)runid);
if (!dpath) {
/* get the dpath */
dpath = systemd_unit_dpath_by_pid(1 /* TODO: isuser? */, (unsigned)runid);
if (!dpath) {
errno = EINVAL;
WARNING("searched runid %d not found", runid);
} else {
errno = EINVAL;
WARNING("searched runid %d not found", runid);
} else {
&& j_read_string_at(appli, "id", &id)) {
pid = systemd_unit_pid_of_dpath(isuser, udpath);
state = systemd_unit_state_of_dpath(isuser, dpath);
&& j_read_string_at(appli, "id", &id)) {
pid = systemd_unit_pid_of_dpath(isuser, udpath);
state = systemd_unit_state_of_dpath(isuser, dpath);
- result = mkstate(id, runid, pid, state);
+ if (state == SysD_State_Active)
+ result = mkstate(id, runid, pid, state);
errno = ENOENT;
WARNING("searched runid %d of dpath %s isn't an applications", runid, dpath);
end:
errno = ENOENT;
WARNING("searched runid %d of dpath %s isn't an applications", runid, dpath);
end: