#include "fault_manager.h"
#include "group.h"
#include "xmonitor.h"
-#include "liveinfo.h"
+#include "widget-mgr.h"
#include "io.h"
#include "event.h"
#include "dead_monitor.h"
return result;
}
-static struct packet *liveinfo_hello(pid_t pid, int handle, const struct packet *packet)
+static struct packet *widget_mgr_hello(pid_t pid, int handle, const struct packet *packet)
{
- struct liveinfo *info;
+ struct widget_mgr *info;
struct packet *result;
int ret;
const char *fifo_name;
goto out;
}
- info = liveinfo_create(pid, handle);
+ info = widget_mgr_create(pid, handle);
if (!info) {
- ErrPrint("Failed to create a liveinfo object\n");
+ ErrPrint("Failed to create a widget_mgr object\n");
fifo_name = "";
ret = WIDGET_ERROR_INVALID_PARAMETER;
goto out;
}
ret = 0;
- fifo_name = liveinfo_filename(info);
+ fifo_name = widget_mgr_filename(info);
DbgPrint("FIFO Created: %s (Serve for %d)\n", fifo_name, pid);
out:
Eina_List *l;
struct slave_node *slave;
- liveinfo_open_fifo(info);
- fp = liveinfo_fifo(info);
+ widget_mgr_open_fifo(info);
+ fp = widget_mgr_fifo(info);
if (!fp) {
- liveinfo_close_fifo(info);
+ widget_mgr_close_fifo(info);
return ECORE_CALLBACK_CANCEL;
}
}
fprintf(fp, "EOD\n");
- liveinfo_close_fifo(info);
+ widget_mgr_close_fifo(info);
return ECORE_CALLBACK_CANCEL;
}
-static struct packet *liveinfo_slave_list(pid_t pid, int handle, const struct packet *packet)
+static struct packet *widget_mgr_slave_list(pid_t pid, int handle, const struct packet *packet)
{
- struct liveinfo *info;
+ struct widget_mgr *info;
double timestamp;
if (packet_get(packet, "d", ×tamp) != 1) {
goto out;
}
- info = liveinfo_find_by_pid(pid);
+ info = widget_mgr_find_by_pid(pid);
if (!info) {
ErrPrint("Invalid request\n");
goto out;
Eina_List *inst_list;
struct inst_info *inst;
- pkgname = liveinfo_data(info);
+ pkgname = widget_mgr_data(info);
if (!pkgname) {
return ECORE_CALLBACK_CANCEL;
}
- liveinfo_open_fifo(info);
- fp = liveinfo_fifo(info);
+ widget_mgr_open_fifo(info);
+ fp = widget_mgr_fifo(info);
if (!fp) {
ErrPrint("Invalid fp\n");
- liveinfo_close_fifo(info);
+ widget_mgr_close_fifo(info);
free(pkgname);
return ECORE_CALLBACK_CANCEL;
}
close_out:
fprintf(fp, "EOD\n");
- liveinfo_close_fifo(info);
+ widget_mgr_close_fifo(info);
return ECORE_CALLBACK_CANCEL;
}
-static struct packet *liveinfo_inst_list(pid_t pid, int handle, const struct packet *packet)
+static struct packet *widget_mgr_inst_list(pid_t pid, int handle, const struct packet *packet)
{
const char *pkgname;
char *dup_pkgname;
- struct liveinfo *info;
+ struct widget_mgr *info;
if (packet_get(packet, "s", &pkgname) != 1) {
ErrPrint("Invalid argument\n");
goto out;
}
- info = liveinfo_find_by_pid(pid);
+ info = widget_mgr_find_by_pid(pid);
if (!info) {
ErrPrint("Invalid request\n");
goto out;
goto out;
}
- liveinfo_set_data(info, dup_pkgname);
+ widget_mgr_set_data(info, dup_pkgname);
inst_list_cb(info);
out:
const char *slavename;
pid_t pid;
- liveinfo_open_fifo(info);
- fp = liveinfo_fifo(info);
+ widget_mgr_open_fifo(info);
+ fp = widget_mgr_fifo(info);
if (!fp) {
DbgPrint("Failed to open a pipe\n");
- liveinfo_close_fifo(info);
+ widget_mgr_close_fifo(info);
return ECORE_CALLBACK_CANCEL;
}
fprintf(fp, "EOD\n");
DbgPrint("EOD\n");
- liveinfo_close_fifo(info);
+ widget_mgr_close_fifo(info);
return ECORE_CALLBACK_CANCEL;
}
-static struct packet *liveinfo_pkg_list(pid_t pid, int handle, const struct packet *packet)
+static struct packet *widget_mgr_pkg_list(pid_t pid, int handle, const struct packet *packet)
{
- struct liveinfo *info;
+ struct widget_mgr *info;
double timestamp;
if (packet_get(packet, "d", ×tamp) != 1) {
DbgPrint("Package List: %lf\n", timestamp);
- info = liveinfo_find_by_pid(pid);
+ info = widget_mgr_find_by_pid(pid);
if (!info) {
ErrPrint("Invalid request\n");
goto out;
return NULL;
}
-static struct packet *liveinfo_slave_ctrl(pid_t pid, int handle, const struct packet *packet)
+static struct packet *widget_mgr_slave_ctrl(pid_t pid, int handle, const struct packet *packet)
{
return NULL;
}
static Eina_Bool pkg_ctrl_rmpack_cb(void *info)
{
FILE *fp;
- liveinfo_open_fifo(info);
- fp = liveinfo_fifo(info);
+ widget_mgr_open_fifo(info);
+ fp = widget_mgr_fifo(info);
if (!fp) {
- liveinfo_close_fifo(info);
+ widget_mgr_close_fifo(info);
return ECORE_CALLBACK_CANCEL;
}
fprintf(fp, "%d\n", ENOSYS);
fprintf(fp, "EOD\n");
- liveinfo_close_fifo(info);
+ widget_mgr_close_fifo(info);
return ECORE_CALLBACK_CANCEL;
}
{
FILE *fp;
- liveinfo_open_fifo(info);
- fp = liveinfo_fifo(info);
+ widget_mgr_open_fifo(info);
+ fp = widget_mgr_fifo(info);
if (!fp) {
- liveinfo_close_fifo(info);
+ widget_mgr_close_fifo(info);
return ECORE_CALLBACK_CANCEL;
}
- fprintf(fp, "%d\n", (int)liveinfo_data(info));
+ fprintf(fp, "%d\n", (int)widget_mgr_data(info));
fprintf(fp, "EOD\n");
- liveinfo_close_fifo(info);
+ widget_mgr_close_fifo(info);
return ECORE_CALLBACK_CANCEL;
}
{
FILE *fp;
- liveinfo_open_fifo(info);
- fp = liveinfo_fifo(info);
+ widget_mgr_open_fifo(info);
+ fp = widget_mgr_fifo(info);
if (!fp) {
- liveinfo_close_fifo(info);
+ widget_mgr_close_fifo(info);
return ECORE_CALLBACK_CANCEL;
}
- fprintf(fp, "%d\n", (int)liveinfo_data(info));
+ fprintf(fp, "%d\n", (int)widget_mgr_data(info));
fprintf(fp, "EOD\n");
- liveinfo_close_fifo(info);
+ widget_mgr_close_fifo(info);
return ECORE_CALLBACK_CANCEL;
}
-static struct packet *liveinfo_pkg_ctrl(pid_t pid, int handle, const struct packet *packet)
+static struct packet *widget_mgr_pkg_ctrl(pid_t pid, int handle, const struct packet *packet)
{
- struct liveinfo *info;
+ struct widget_mgr *info;
char *cmd;
char *pkgname;
char *id;
goto out;
}
- info = liveinfo_find_by_pid(pid);
+ info = widget_mgr_find_by_pid(pid);
if (!info) {
ErrPrint("Invalid request\n");
goto out;
struct inst_info *inst;
inst = package_find_instance_by_id(pkgname, id);
if (!inst) {
- liveinfo_set_data(info, (void *)ENOENT);
+ widget_mgr_set_data(info, (void *)ENOENT);
} else {
(void)instance_destroy(inst, WIDGET_DESTROY_TYPE_DEFAULT);
- liveinfo_set_data(info, (void *)0);
+ widget_mgr_set_data(info, (void *)0);
}
pkg_ctrl_rminst_cb(info);
struct inst_info *inst;
inst = package_find_instance_by_id(pkgname, id);
if (!inst) {
- liveinfo_set_data(info, (void *)ENOENT);
+ widget_mgr_set_data(info, (void *)ENOENT);
} else {
struct pkg_info *pkg;
pkg = instance_package(inst);
if (!pkg) {
- liveinfo_set_data(info, (void *)EFAULT);
+ widget_mgr_set_data(info, (void *)EFAULT);
} else {
(void)package_faulted(pkg, 1);
- liveinfo_set_data(info, (void *)0);
+ widget_mgr_set_data(info, (void *)0);
}
}
{
FILE *fp;
- liveinfo_open_fifo(info);
- fp = liveinfo_fifo(info);
+ widget_mgr_open_fifo(info);
+ fp = widget_mgr_fifo(info);
if (!fp) {
- liveinfo_close_fifo(info);
+ widget_mgr_close_fifo(info);
return ECORE_CALLBACK_CANCEL;
}
- fprintf(fp, "%d\nEOD\n", (int)liveinfo_data(info));
- liveinfo_close_fifo(info);
+ fprintf(fp, "%d\nEOD\n", (int)widget_mgr_data(info));
+ widget_mgr_close_fifo(info);
return ECORE_CALLBACK_CANCEL;
}
-static struct packet *liveinfo_master_ctrl(pid_t pid, int handle, const struct packet *packet)
+static struct packet *widget_mgr_master_ctrl(pid_t pid, int handle, const struct packet *packet)
{
- struct liveinfo *info;
+ struct widget_mgr *info;
char *cmd;
char *var;
char *val;
goto out;
}
- info = liveinfo_find_by_pid(pid);
+ info = widget_mgr_find_by_pid(pid);
if (!info) {
ErrPrint("Invalid request\n");
goto out;
ret = g_conf.slave_max_load;
}
- liveinfo_set_data(info, (void *)ret);
+ widget_mgr_set_data(info, (void *)ret);
master_ctrl_cb(info);
out:
static struct method s_info_table[] = {
{
.cmd = CMD_STR_INFO_HELLO,
- .handler = liveinfo_hello,
+ .handler = widget_mgr_hello,
},
{
.cmd = CMD_STR_INFO_SLAVE_LIST,
- .handler = liveinfo_slave_list,
+ .handler = widget_mgr_slave_list,
},
{
.cmd = CMD_STR_INFO_PKG_LIST,
- .handler = liveinfo_pkg_list,
+ .handler = widget_mgr_pkg_list,
},
{
.cmd = CMD_STR_INFO_INST_LIST,
- .handler = liveinfo_inst_list,
+ .handler = widget_mgr_inst_list,
},
{
.cmd = CMD_STR_INFO_SLAVE_CTRL,
- .handler = liveinfo_slave_ctrl,
+ .handler = widget_mgr_slave_ctrl,
},
{
.cmd = CMD_STR_INFO_PKG_CTRL,
- .handler = liveinfo_pkg_ctrl,
+ .handler = widget_mgr_pkg_ctrl,
},
{
.cmd = CMD_STR_INFO_MASTER_CTRL,
- .handler = liveinfo_master_ctrl,
+ .handler = widget_mgr_master_ctrl,
},
{
.cmd = NULL,
.info_list = NULL,
};
-struct liveinfo {
+struct widget_mgr {
FILE *fp;
char fifo_name[60];
pid_t pid;
void *data;
};
-HAPI int liveinfo_init(void)
+HAPI int widget_mgr_init(void)
{
return 0;
}
-HAPI void liveinfo_fini(void)
+HAPI void widget_mgr_fini(void)
{
- struct liveinfo *info;
+ struct widget_mgr *info;
EINA_LIST_FREE(s_info.info_list, info) {
if (fclose(info->fp) != 0) {
return 0;
}
- if (stat("/opt/usr/devel/usr/bin/liveinfo", &src) < 0) {
- ErrPrint("Error: %s\n", strerror(errno));
- return 0;
- }
-
- if (target.st_ino == src.st_ino) {
- return 1;
- }
-
if (stat("/opt/usr/devel/usr/bin/widget-mgr", &src) < 0) {
ErrPrint("Error: %s\n", strerror(errno));
return 0;
return target.st_ino == src.st_ino;
}
-HAPI void liveinfo_set_data(struct liveinfo *info, void *data)
+HAPI void widget_mgr_set_data(struct widget_mgr *info, void *data)
{
info->data = data;
}
-HAPI void *liveinfo_data(struct liveinfo *info)
+HAPI void *widget_mgr_data(struct widget_mgr *info)
{
return info->data;
}
-HAPI struct liveinfo *liveinfo_create(pid_t pid, int handle)
+HAPI struct widget_mgr *widget_mgr_create(pid_t pid, int handle)
{
- struct liveinfo *info;
+ struct widget_mgr *info;
if (!valid_requestor(pid)) {
ErrPrint("Invalid requestor\n");
return info;
}
-HAPI int liveinfo_open_fifo(struct liveinfo *info)
+HAPI int widget_mgr_open_fifo(struct widget_mgr *info)
{
DbgPrint("FIFO is created (%s)\n", info->fifo_name);
info->fp = fopen(info->fifo_name, "w");
return WIDGET_ERROR_NONE;
}
-HAPI void liveinfo_close_fifo(struct liveinfo *info)
+HAPI void widget_mgr_close_fifo(struct widget_mgr *info)
{
if (info->fp) {
if (fclose(info->fp) != 0) {
}
}
-HAPI void liveinfo_destroy(struct liveinfo *info)
+HAPI void widget_mgr_destroy(struct widget_mgr *info)
{
s_info.info_list = eina_list_remove(s_info.info_list, info);
- liveinfo_close_fifo(info);
+ widget_mgr_close_fifo(info);
if (unlink(info->fifo_name) < 0) {
ErrPrint("unlink: %s\n", strerror(errno));
}
DbgFree(info);
}
-HAPI pid_t liveinfo_pid(struct liveinfo *info)
+HAPI pid_t widget_mgr_pid(struct widget_mgr *info)
{
return info ? info->pid : (pid_t)-1;
}
-HAPI const char *liveinfo_filename(struct liveinfo *info)
+HAPI const char *widget_mgr_filename(struct widget_mgr *info)
{
return info ? info->fifo_name : NULL;
}
-HAPI FILE *liveinfo_fifo(struct liveinfo *info)
+HAPI FILE *widget_mgr_fifo(struct widget_mgr *info)
{
return info ? info->fp : NULL;
}
-HAPI struct liveinfo *liveinfo_find_by_pid(pid_t pid)
+HAPI struct widget_mgr *widget_mgr_find_by_pid(pid_t pid)
{
Eina_List *l;
- struct liveinfo *info;
+ struct widget_mgr *info;
EINA_LIST_FOREACH(s_info.info_list, l, info) {
if (info->pid == pid) {
return NULL;
}
-HAPI struct liveinfo *liveinfo_find_by_handle(int handle)
+HAPI struct widget_mgr *widget_mgr_find_by_handle(int handle)
{
Eina_List *l;
- struct liveinfo *info;
+ struct widget_mgr *info;
EINA_LIST_FOREACH(s_info.info_list, l, info) {
if (info->handle == handle) {