Author: adrian.chadd
Date: Thu Jul  9 20:23:21 2009
New Revision: 14168

Modified:
    playpen/LUSCA_HEAD_storework/libhelper/ipc.c
    playpen/LUSCA_HEAD_storework/libhelper/ipc.h

Log:
Add "ipcClose()" which closes the given IPC helper.



Modified: playpen/LUSCA_HEAD_storework/libhelper/ipc.c
==============================================================================
--- playpen/LUSCA_HEAD_storework/libhelper/ipc.c        (original)
+++ playpen/LUSCA_HEAD_storework/libhelper/ipc.c        Thu Jul  9 20:23:21 2009
@@ -42,6 +42,7 @@
  #include <math.h>
  #include <fcntl.h>
  #include <ctype.h>
+#include <signal.h>
  #include <sys/errno.h>
  #include <sys/socket.h>
  #include <netinet/in.h>
@@ -380,4 +381,16 @@
      debug(54, 0) ("ipcCreate: %s: %s\n", prog, xstrerror());
      _exit(1);
      return 0;
+}
+
+void
+ipcClose(pid_t pid, int rfd, int wfd)
+{
+       if (rfd == wfd)
+               comm_close(rfd);
+       else {
+               comm_close(rfd);
+               comm_close(wfd);
+       }
+       kill(pid, SIGTERM);
  }

Modified: playpen/LUSCA_HEAD_storework/libhelper/ipc.h
==============================================================================
--- playpen/LUSCA_HEAD_storework/libhelper/ipc.h        (original)
+++ playpen/LUSCA_HEAD_storework/libhelper/ipc.h        Thu Jul  9 20:23:21 2009
@@ -27,5 +27,6 @@

  extern pid_t ipcCreate(int type, const char *prog, const char *const  
args[], const char *name,
      int sleep_after_fork, int *rfd, int *wfd, void **hIpc);
+extern void ipcClose(pid_t pid, int rfd, int wfd);

  #endif

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"lusca-commit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/lusca-commit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to