summaryrefslogtreecommitdiff
path: root/legacy/ecore
diff options
context:
space:
mode:
authorrbdpngn <rbdpngn>2006-01-11 05:13:23 +0000
committerrbdpngn <rbdpngn@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>2006-01-11 05:13:23 +0000
commitf1bc839522d1b4c8af7f9e6c49d527efd4a5a799 (patch)
treec96b3b696f7349e8188d2889089a4da8e1c9b318 /legacy/ecore
parent702c78bb8205352a8d066513f04f70276921e8c5 (diff)
Revert disown call and force the parent to check if it created the socket
before unlinking it. SVN revision: 19714
Diffstat (limited to '')
-rw-r--r--legacy/ecore/src/lib/ecore_con/Ecore_Con.h1
-rw-r--r--legacy/ecore/src/lib/ecore_con/ecore_con.c23
-rw-r--r--legacy/ecore/src/lib/ecore_con/ecore_con_private.h1
-rw-r--r--legacy/ecore/src/lib/ecore_ipc/Ecore_Ipc.h1
-rw-r--r--legacy/ecore/src/lib/ecore_ipc/ecore_ipc.c20
5 files changed, 3 insertions, 43 deletions
diff --git a/legacy/ecore/src/lib/ecore_con/Ecore_Con.h b/legacy/ecore/src/lib/ecore_con/Ecore_Con.h
index 2701116629..de02560554 100644
--- a/legacy/ecore/src/lib/ecore_con/Ecore_Con.h
+++ b/legacy/ecore/src/lib/ecore_con/Ecore_Con.h
@@ -151,7 +151,6 @@ extern "C" {
151 EAPI int ecore_con_server_connected_get(Ecore_Con_Server *svr); 151 EAPI int ecore_con_server_connected_get(Ecore_Con_Server *svr);
152 EAPI int ecore_con_server_send(Ecore_Con_Server *svr, void *data, int size); 152 EAPI int ecore_con_server_send(Ecore_Con_Server *svr, void *data, int size);
153 EAPI void ecore_con_server_client_limit_set(Ecore_Con_Server *svr, int client_limit, char reject_excess_clients); 153 EAPI void ecore_con_server_client_limit_set(Ecore_Con_Server *svr, int client_limit, char reject_excess_clients);
154 EAPI void ecore_con_server_disown(Ecore_Con_Server *svr);
155 154
156 EAPI int ecore_con_client_send(Ecore_Con_Client *cl, void *data, int size); 155 EAPI int ecore_con_client_send(Ecore_Con_Client *cl, void *data, int size);
157 EAPI Ecore_Con_Server *ecore_con_client_server_get(Ecore_Con_Client *cl); 156 EAPI Ecore_Con_Server *ecore_con_client_server_get(Ecore_Con_Client *cl);
diff --git a/legacy/ecore/src/lib/ecore_con/ecore_con.c b/legacy/ecore/src/lib/ecore_con/ecore_con.c
index 096eda8c0b..6f8d43c17f 100644
--- a/legacy/ecore/src/lib/ecore_con/ecore_con.c
+++ b/legacy/ecore/src/lib/ecore_con/ecore_con.c
@@ -318,6 +318,7 @@ ecore_con_server_add(Ecore_Con_Type compl_type,
318 svr->reject_excess_clients = 0; 318 svr->reject_excess_clients = 0;
319 svr->client_limit = -1; 319 svr->client_limit = -1;
320 svr->clients = ecore_list_new(); 320 svr->clients = ecore_list_new();
321 svr->ppid = getpid();
321 ecore_list_append(servers, svr); 322 ecore_list_append(servers, svr);
322 ECORE_MAGIC_SET(svr, ECORE_MAGIC_CON_SERVER); 323 ECORE_MAGIC_SET(svr, ECORE_MAGIC_CON_SERVER);
323 return svr; 324 return svr;
@@ -606,26 +607,6 @@ ecore_con_server_client_limit_set(Ecore_Con_Server *svr, int client_limit, char
606} 607}
607 608
608/** 609/**
609 * Flag the server as not owned by this process, important to use after
610 * forking so child processes do not remove a parents socket path.
611 * Beware that if you set this in the parent, stale sockets may be left
612 * around.
613 * @param svr The given server.
614 * @ingroup Ecore_Con_Server_Group
615 */
616void
617ecore_con_server_disown(Ecore_Con_Server *svr)
618{
619 if (!ECORE_MAGIC_CHECK(svr, ECORE_MAGIC_CON_SERVER))
620 {
621 ECORE_MAGIC_FAIL(svr, ECORE_MAGIC_CON_SERVER,
622 "ecore_con_server_client_limit_set");
623 return;
624 }
625 svr->created = 0;
626}
627
628/**
629 * @defgroup Ecore_Con_Client_Group Ecore Connection Client Functions 610 * @defgroup Ecore_Con_Client_Group Ecore Connection Client Functions
630 * 611 *
631 * Functions that operate on Ecore connection client objects. 612 * Functions that operate on Ecore connection client objects.
@@ -777,7 +758,7 @@ _ecore_con_server_free(Ecore_Con_Server *svr)
777 while (!ecore_list_is_empty(svr->clients)) 758 while (!ecore_list_is_empty(svr->clients))
778 _ecore_con_client_free(ecore_list_remove_first(svr->clients)); 759 _ecore_con_client_free(ecore_list_remove_first(svr->clients));
779 ecore_list_destroy(svr->clients); 760 ecore_list_destroy(svr->clients);
780 if ((svr->created) && (svr->path)) unlink(svr->path); 761 if ((svr->created) && (svr->path) && (svr->ppid == getpid())) unlink(svr->path);
781 if (svr->fd >= 0) close(svr->fd); 762 if (svr->fd >= 0) close(svr->fd);
782#if USE_OPENSSL 763#if USE_OPENSSL
783 if (svr->ssl) 764 if (svr->ssl)
diff --git a/legacy/ecore/src/lib/ecore_con/ecore_con_private.h b/legacy/ecore/src/lib/ecore_con/ecore_con_private.h
index 62dfd8863b..8df44de53c 100644
--- a/legacy/ecore/src/lib/ecore_con/ecore_con_private.h
+++ b/legacy/ecore/src/lib/ecore_con/ecore_con_private.h
@@ -67,6 +67,7 @@ struct _Ecore_Con_Server
67 char connecting : 1; 67 char connecting : 1;
68 char reject_excess_clients : 1; 68 char reject_excess_clients : 1;
69 int client_limit; 69 int client_limit;
70 pid_t ppid;
70 71
71#if USE_OPENSSL 72#if USE_OPENSSL
72 SSL_CTX *ssl_ctx; 73 SSL_CTX *ssl_ctx;
diff --git a/legacy/ecore/src/lib/ecore_ipc/Ecore_Ipc.h b/legacy/ecore/src/lib/ecore_ipc/Ecore_Ipc.h
index 52455c684c..9071cacc2c 100644
--- a/legacy/ecore/src/lib/ecore_ipc/Ecore_Ipc.h
+++ b/legacy/ecore/src/lib/ecore_ipc/Ecore_Ipc.h
@@ -297,7 +297,6 @@ EAPI unsigned long long _ecore_ipc_swap_64(unsigned long long v);
297 /* FIXME: this needs to become an ipc message */ 297 /* FIXME: this needs to become an ipc message */
298 EAPI int ecore_ipc_server_send(Ecore_Ipc_Server *svr, int major, int minor, int ref, int ref_to, int response, void *data, int size); 298 EAPI int ecore_ipc_server_send(Ecore_Ipc_Server *svr, int major, int minor, int ref, int ref_to, int response, void *data, int size);
299 EAPI void ecore_ipc_server_client_limit_set(Ecore_Ipc_Server *svr, int client_limit, char reject_excess_clients); 299 EAPI void ecore_ipc_server_client_limit_set(Ecore_Ipc_Server *svr, int client_limit, char reject_excess_clients);
300 EAPI void ecore_ipc_server_disown(Ecore_Ipc_Server *svr);
301 300
302 /* FIXME: this needs to become an ipc message */ 301 /* FIXME: this needs to become an ipc message */
303 EAPI int ecore_ipc_client_send(Ecore_Ipc_Client *cl, int major, int minor, int ref, int ref_to, int response, void *data, int size); 302 EAPI int ecore_ipc_client_send(Ecore_Ipc_Client *cl, int major, int minor, int ref, int ref_to, int response, void *data, int size);
diff --git a/legacy/ecore/src/lib/ecore_ipc/ecore_ipc.c b/legacy/ecore/src/lib/ecore_ipc/ecore_ipc.c
index 207c850df5..47da681761 100644
--- a/legacy/ecore/src/lib/ecore_ipc/ecore_ipc.c
+++ b/legacy/ecore/src/lib/ecore_ipc/ecore_ipc.c
@@ -600,26 +600,6 @@ ecore_ipc_server_client_limit_set(Ecore_Ipc_Server *svr, int client_limit, char
600 ecore_con_server_client_limit_set(svr->server, client_limit, reject_excess_clients); 600 ecore_con_server_client_limit_set(svr->server, client_limit, reject_excess_clients);
601} 601}
602 602
603/**
604 * Flag the server as not owned by this process, important to use after
605 * forking so child processes do not remove a parents socket path.
606 * Beware that if you set this in the parent, stale sockets may be left
607 * around.
608 * @param svr The given server.
609 * @ingroup Ecore_Ipc_Server_Group
610 */
611void
612ecore_ipc_server_disown(Ecore_Ipc_Server *svr)
613{
614 if (!ECORE_MAGIC_CHECK(svr, ECORE_MAGIC_IPC_SERVER))
615 {
616 ECORE_MAGIC_FAIL(svr, ECORE_MAGIC_IPC_SERVER,
617 "ecore_ipc_server_client_limit_set");
618 return;
619 }
620 ecore_con_server_disown(svr->server);
621}
622
623#define CLENC(_member) \ 603#define CLENC(_member) \
624 d = _ecore_ipc_dlt_int(msg._member, cl->prev.o._member, &md); \ 604 d = _ecore_ipc_dlt_int(msg._member, cl->prev.o._member, &md); \
625 if (md >= DLT_SET) \ 605 if (md >= DLT_SET) \