From cf9063f92b8d361e0dfd0fc9464f58a06f1f1242 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Sun, 14 Sep 2014 12:12:48 -0500 Subject: [PATCH] ntk: Clean up console spawning * Fix a few incorrect header dependencies --- src/SConscript | 3 ++- src/gmap.h | 1 + src/map.h | 1 + src/netsukuku.c | 12 +++++------- src/{ntk-console-bindings.c => ntk-console-server.c} | 9 +++++++-- src/ntk-console-server.h | 8 ++++++++ 6 files changed, 24 insertions(+), 10 deletions(-) rename src/{ntk-console-bindings.c => ntk-console-server.c} (98%) create mode 100644 src/ntk-console-server.h diff --git a/src/SConscript b/src/SConscript index 98bdb4e..3d86c17 100644 --- a/src/SConscript +++ b/src/SConscript @@ -35,7 +35,8 @@ sources_netsukuku = Split("""accept.c llist.c ipv6-gmp.c inet.c request.c map.c dnslib.c andns.c andns_net.c andns_snsd.c ll_map.c libnetlink.c if.c krnl_route.c krnl_rule.c iptunnel.c route.c conf.c dns_wrapper.c igs.c mark.c - libiptc/libip4tc.c libping.c netsukuku.c""") + sources_common + libiptc/libip4tc.c libping.c ntk-console-server.c + netsukuku.c""") + sources_common sources_ntkresolv = sources_common + Split("""andns_lib.c ntkresolv.c andns_net.c crypto.c snsd_cache.c inet.c ll_map.c libnetlink.c diff --git a/src/gmap.h b/src/gmap.h index cd78c8c..a1a2983 100644 --- a/src/gmap.h +++ b/src/gmap.h @@ -19,6 +19,7 @@ #ifndef GMAP_H #define GMAP_H +#include "includes.h" #include "llist.c" #include "map.h" diff --git a/src/map.h b/src/map.h index ecba315..d12f0e6 100644 --- a/src/map.h +++ b/src/map.h @@ -19,6 +19,7 @@ #ifndef MAP_H #define MAP_H +#include "includes.h" #include "inet.h" /* Generic map defines */ diff --git a/src/netsukuku.c b/src/netsukuku.c index 59975c6..7fd5d93 100644 --- a/src/netsukuku.c +++ b/src/netsukuku.c @@ -40,7 +40,7 @@ #include "radar.h" #include "hook.h" #include "rehook.h" -#include "ntk-console-bindings.c" +#include "ntk-console-server.h" #include @@ -420,16 +420,14 @@ check_excluded(); freeifaddrs(addrs); } -void *console_recv_send1(void *void_ptr){ - console_recv_send(); -} -int ntk_thread_creatation(void) { +void +ntk_thread_creatation(void) { int x; pthread_t console_recv_send_thread; - if(pthread_create(&console_recv_send_thread, NULL, console_recv_send1, &x)) { + if(pthread_create(&console_recv_send_thread, NULL, &console_recv_send, &x)) { fprintf(stderr, "Error creating thread\n"); - return -1; + exit(-1); } } diff --git a/src/ntk-console-bindings.c b/src/ntk-console-server.c similarity index 98% rename from src/ntk-console-bindings.c rename to src/ntk-console-server.c index ee5d7f4..690504d 100644 --- a/src/ntk-console-bindings.c +++ b/src/ntk-console-server.c @@ -3,6 +3,7 @@ #include +#include #include #include @@ -203,9 +204,13 @@ wait_session(int server_fd) } -void -console_recv_send(void) +void* +console_recv_send(void *arg) { + char* uargv; + opensocket(); wait_session(serverfd); + + return uargv; } diff --git a/src/ntk-console-server.h b/src/ntk-console-server.h new file mode 100644 index 0000000..6c9db65 --- /dev/null +++ b/src/ntk-console-server.h @@ -0,0 +1,8 @@ +#ifndef NTKCONSOLESERVER_H +#define NTKCONSOLESERVER_H + + +void* console_recv_send(void *arg); + + +#endif /* NTKCONSOLESERVER_H */