about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRichard Nyberg <rnyberg@murmeldjur.se>2006-01-10 17:57:03 +0000
committerRichard Nyberg <rnyberg@murmeldjur.se>2006-01-10 17:57:03 +0000
commit6f09434ea044145c3e790d21aff03aff1bcedf93 (patch)
treef60004e65aa416a7d230dbdae587c2eef42fda88
parent8aed86f7d240ca43150f5dd5e0f7e12490072389 (diff)
downloadbtpd-6f09434ea044145c3e790d21aff03aff1bcedf93.tar.gz
btpd-6f09434ea044145c3e790d21aff03aff1bcedf93.zip
Removed code dealing with child processes; btpd doesn't use them anymore.
-rw-r--r--btpd/btpd.c42
-rw-r--r--btpd/btpd.h2
2 files changed, 0 insertions, 44 deletions
diff --git a/btpd/btpd.c b/btpd/btpd.c
index 146cba0..710a184 100644
--- a/btpd/btpd.c
+++ b/btpd/btpd.c
@@ -29,20 +29,9 @@
 #include "btpd.h"
 #include "http.h"
 
-struct child {
-    pid_t pid;
-    void *arg;
-    void (*cb)(pid_t, void *);
-    BTPDQ_ENTRY(child) entry;
-};
-
-BTPDQ_HEAD(child_tq, child);
-
 static uint8_t m_peer_id[20];
 static struct event m_sigint;
 static struct event m_sigterm;
-static struct event m_sigchld;
-static struct child_tq m_kids = BTPDQ_HEAD_INITIALIZER(m_kids);
 static unsigned m_ntorrents;
 static struct torrent_tq m_torrents = BTPDQ_HEAD_INITIALIZER(m_torrents);
 
@@ -69,35 +58,6 @@ signal_cb(int signal, short type, void *arg)
 }
 
 void
-btpd_add_child(pid_t pid, void (*cb)(pid_t, void *), void *arg)
-{
-    struct child *kid = btpd_calloc(1, sizeof(*kid));
-    kid->pid = pid;
-    kid->arg = arg;
-    kid->cb = cb;
-    BTPDQ_INSERT_TAIL(&m_kids, kid, entry);
-}
-
-static void
-child_cb(int signal, short type, void *arg)
-{
-    int status;
-    pid_t pid;
-
-    while ((pid = waitpid(-1, &status, WNOHANG)) > 0) {
-        if (WIFEXITED(status) || WIFSIGNALED(status)) {
-            struct child *kid = BTPDQ_FIRST(&m_kids);
-            while (kid != NULL && kid->pid != pid)
-                kid = BTPDQ_NEXT(kid, entry);
-            assert(kid != NULL);
-            BTPDQ_REMOVE(&m_kids, kid, entry);
-            kid->cb(kid->pid, kid->arg);
-            free(kid);
-        }
-    }
-}
-
-void
 btpd_add_torrent(struct torrent *tp)
 {
     BTPDQ_INSERT_TAIL(&m_torrents, tp, entry);
@@ -271,6 +231,4 @@ btpd_init(void)
     signal_add(&m_sigint, NULL);
     signal_set(&m_sigterm, SIGTERM, signal_cb, NULL);
     signal_add(&m_sigterm, NULL);
-    signal_set(&m_sigchld, SIGCHLD, child_cb, NULL);
-    signal_add(&m_sigchld, NULL);
 }
diff --git a/btpd/btpd.h b/btpd/btpd.h
index c00469d..452087c 100644
--- a/btpd/btpd.h
+++ b/btpd/btpd.h
@@ -50,8 +50,6 @@ void *btpd_calloc(size_t nmemb, size_t size);
 
 void btpd_shutdown(void);
 
-void btpd_add_child(pid_t pid, void (*cb)(pid_t, void *), void *arg);
-
 struct torrent * btpd_get_torrent(const uint8_t *hash);
 const struct torrent_tq *btpd_get_torrents(void);
 void btpd_add_torrent(struct torrent *tp);