RFC on this one. I added this so that a child process can safely close an IPC server after a fork w/o affecting further connections to the parent process. As it seems to be a very limited case, I only added a single disown function. Does anyone see a use that would benefit from this being a get/set pair of calls, and to not only disown a server in a process, but to establish ownership over one as well?

On 1/8/06, enlightenment-cvs@lists.sourceforge.net < enlightenment-cvs@lists.sourceforge.net> wrote:
Enlightenment CVS committal

Author  : rbdpngn
Project : e17
Module  : libs/ecore

Dir     : e17/libs/ecore/src/lib/ecore_ipc


Modified Files:
        Ecore_Ipc.h ecore_ipc.c


Log Message:
Allow servers to disown their sockets. Allows for closing after a fork()
without unlinking the socket in the filesystem.

===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_ipc/Ecore_Ipc.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -3 -r1.12 -r1.13
--- Ecore_Ipc.h 27 Dec 2005 17:17:30 -0000      1.12
+++ Ecore_Ipc.h 8 Jan 2006 07:42:55 -0000       1.13
@@ -297,6 +297,7 @@
    /* FIXME: this needs to become an ipc message */
    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);
    EAPI void              ecore_ipc_server_client_limit_set(Ecore_Ipc_Server *svr, int client_limit, char reject_excess_clients);
+   EAPI void              ecore_ipc_server_disown(Ecore_Ipc_Server *svr);

    /* FIXME: this needs to become an ipc message */
    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);
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_ipc/ecore_ipc.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -3 - r1.24 -r1.25
--- ecore_ipc.c 6 Jan 2006 18:26:37 -0000       1.24
+++ ecore_ipc.c 8 Jan 2006 07:42:56 -0000       1.25
@@ -600,6 +600,26 @@
    ecore_con_server_client_limit_set(svr->server, client_limit, reject_excess_clients);
}

+/**
+ * Flag the server as not owned by this process, important to use after
+ * forking so child processes do not remove a parents socket path.
+ * Beware that if you set this in the parent, stale sockets may be left
+ * around.
+ * @param   svr           The given server.
+ * @ingroup Ecore_Ipc_Server_Group
+ */
+void
+ecore_ipc_server_disown(Ecore_Ipc_Server *svr)
+{
+   if (!ECORE_MAGIC_CHECK(svr, ECORE_MAGIC_IPC_SERVER))
+     {
+       ECORE_MAGIC_FAIL(svr, ECORE_MAGIC_IPC_SERVER,
+                        "ecore_ipc_server_client_limit_set");
+       return;
+     }
+   ecore_con_server_disown(svr->server);
+}
+
#define CLENC(_member) \
    d = _ecore_ipc_dlt_int(msg._member, cl->prev.o._member, &md); \
    if (md >= DLT_SET) \




-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to