aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configure.ac4
-rw-r--r--src/dns/gnunet-service-dns.c3
-rw-r--r--src/exit/gnunet-daemon-exit.c3
-rw-r--r--src/fs/fs_dirmetascan.c3
-rw-r--r--src/include/gnunet_helper_lib.h4
-rw-r--r--src/testbed/test_gnunet_testbed_helper.c3
-rw-r--r--src/testbed/testbed_api.c6
-rw-r--r--src/transport/plugin_transport_wlan.c9
-rw-r--r--src/transport/test_plugin_transport.c3
-rw-r--r--src/util/common_allocation.c10
-rw-r--r--src/util/helper.c19
-rw-r--r--src/vpn/gnunet-service-vpn.c3
12 files changed, 45 insertions, 25 deletions
diff --git a/configure.ac b/configure.ac
index 9b4a0119c..be8209869 100644
--- a/configure.ac
+++ b/configure.ac
@@ -444,7 +444,7 @@ AC_HEADER_STDC
444AC_CHECK_HEADERS([fcntl.h math.h errno.h ctype.h limits.h stdio.h stdlib.h string.h unistd.h stdarg.h signal.h locale.h sys/stat.h sys/types.h],,AC_MSG_ERROR([Compiling GNUnet requires standard UNIX headers files])) 444AC_CHECK_HEADERS([fcntl.h math.h errno.h ctype.h limits.h stdio.h stdlib.h string.h unistd.h stdarg.h signal.h locale.h sys/stat.h sys/types.h],,AC_MSG_ERROR([Compiling GNUnet requires standard UNIX headers files]))
445 445
446# Checks for headers that are only required on some systems or opional (and where we do NOT abort if they are not there) 446# Checks for headers that are only required on some systems or opional (and where we do NOT abort if they are not there)
447AC_CHECK_HEADERS([langinfo.h sys/param.h sys/mount.h sys/statvfs.h sys/select.h sockLib.h sys/mman.h sys/msg.h sys/vfs.h arpa/inet.h fcntl.h libintl.h netdb.h netinet/in.h netinet/in_systm.h sys/ioctl.h sys/socket.h sys/time.h unistd.h kstat.h sys/sysinfo.h kvm.h sys/file.h sys/resource.h ifaddrs.h mach/mach.h stddef.h sys/timeb.h terminos.h argz.h ucred.h endian.h sys/endian.h execinfo.h]) 447AC_CHECK_HEADERS([malloc.h langinfo.h sys/param.h sys/mount.h sys/statvfs.h sys/select.h sockLib.h sys/mman.h sys/msg.h sys/vfs.h arpa/inet.h fcntl.h libintl.h netdb.h netinet/in.h netinet/in_systm.h sys/ioctl.h sys/socket.h sys/time.h unistd.h kstat.h sys/sysinfo.h kvm.h sys/file.h sys/resource.h ifaddrs.h mach/mach.h stddef.h sys/timeb.h terminos.h argz.h ucred.h endian.h sys/endian.h execinfo.h])
448 448
449SAVE_LDFLAGS=$LDFLAGS 449SAVE_LDFLAGS=$LDFLAGS
450SAVE_CPPFLAGS=$CPPFLAGS 450SAVE_CPPFLAGS=$CPPFLAGS
@@ -717,7 +717,7 @@ AC_FUNC_VPRINTF
717AC_HEADER_SYS_WAIT 717AC_HEADER_SYS_WAIT
718AC_TYPE_OFF_T 718AC_TYPE_OFF_T
719AC_TYPE_UID_T 719AC_TYPE_UID_T
720AC_CHECK_FUNCS([atoll stat64 strnlen mremap setrlimit sysconf initgroups strndup gethostbyname2 getpeerucred getpeereid setresuid $funcstocheck getifaddrs freeifaddrs getresgid mallinfo]) 720AC_CHECK_FUNCS([atoll stat64 strnlen mremap setrlimit sysconf initgroups strndup gethostbyname2 getpeerucred getpeereid setresuid $funcstocheck getifaddrs freeifaddrs getresgid mallinfo malloc_usable_size])
721 721
722# restore LIBS 722# restore LIBS
723LIBS=$SAVE_LIBS 723LIBS=$SAVE_LIBS
diff --git a/src/dns/gnunet-service-dns.c b/src/dns/gnunet-service-dns.c
index b13f156a9..8fa30b335 100644
--- a/src/dns/gnunet-service-dns.c
+++ b/src/dns/gnunet-service-dns.c
@@ -1337,7 +1337,8 @@ run (void *cls, struct GNUNET_SERVER_Handle *server,
1337 mesh_handlers, 1337 mesh_handlers,
1338 mesh_types); 1338 mesh_types);
1339 } 1339 }
1340 hijacker = GNUNET_HELPER_start ("gnunet-helper-dns", 1340 hijacker = GNUNET_HELPER_start (GNUNET_NO,
1341 "gnunet-helper-dns",
1341 helper_argv, 1342 helper_argv,
1342 &process_helper_messages, 1343 &process_helper_messages,
1343 NULL, NULL); 1344 NULL, NULL);
diff --git a/src/exit/gnunet-daemon-exit.c b/src/exit/gnunet-daemon-exit.c
index 4f583c5bd..79c1f8435 100644
--- a/src/exit/gnunet-daemon-exit.c
+++ b/src/exit/gnunet-daemon-exit.c
@@ -3210,7 +3210,8 @@ run (void *cls, char *const *args GNUNET_UNUSED,
3210 GNUNET_SCHEDULER_shutdown (); 3210 GNUNET_SCHEDULER_shutdown ();
3211 return; 3211 return;
3212 } 3212 }
3213 helper_handle = GNUNET_HELPER_start ("gnunet-helper-exit", 3213 helper_handle = GNUNET_HELPER_start (GNUNET_NO,
3214 "gnunet-helper-exit",
3214 exit_argv, 3215 exit_argv,
3215 &message_token, 3216 &message_token,
3216 NULL, NULL); 3217 NULL, NULL);
diff --git a/src/fs/fs_dirmetascan.c b/src/fs/fs_dirmetascan.c
index 3e2512206..fb20a2b37 100644
--- a/src/fs/fs_dirmetascan.c
+++ b/src/fs/fs_dirmetascan.c
@@ -454,7 +454,8 @@ GNUNET_FS_directory_scan_start (const char *filename,
454 ds->args[1] = ds->filename_expanded; 454 ds->args[1] = ds->filename_expanded;
455 ds->args[2] = ds->ex_arg; 455 ds->args[2] = ds->ex_arg;
456 ds->args[3] = NULL; 456 ds->args[3] = NULL;
457 ds->helper = GNUNET_HELPER_start ("gnunet-helper-fs-publish", 457 ds->helper = GNUNET_HELPER_start (GNUNET_NO,
458 "gnunet-helper-fs-publish",
458 ds->args, 459 ds->args,
459 &process_helper_msgs, 460 &process_helper_msgs,
460 NULL, ds); 461 NULL, ds);
diff --git a/src/include/gnunet_helper_lib.h b/src/include/gnunet_helper_lib.h
index 12a4d3fe1..7f43f1a64 100644
--- a/src/include/gnunet_helper_lib.h
+++ b/src/include/gnunet_helper_lib.h
@@ -51,6 +51,7 @@ typedef void (*GNUNET_HELPER_ExceptionCallback) (void *cls);
51 * restarted when it dies except when it is stopped using GNUNET_HELPER_stop() 51 * restarted when it dies except when it is stopped using GNUNET_HELPER_stop()
52 * or when the exp_cb callback is not NULL. 52 * or when the exp_cb callback is not NULL.
53 * 53 *
54 * @param with_control_pipe does the helper support the use of a control pipe for signalling?
54 * @param binary_name name of the binary to run 55 * @param binary_name name of the binary to run
55 * @param binary_argv NULL-terminated list of arguments to give when starting the binary (this 56 * @param binary_argv NULL-terminated list of arguments to give when starting the binary (this
56 * argument must not be modified by the client for 57 * argument must not be modified by the client for
@@ -62,7 +63,8 @@ typedef void (*GNUNET_HELPER_ExceptionCallback) (void *cls);
62 * @return the new Handle, NULL on error 63 * @return the new Handle, NULL on error
63 */ 64 */
64struct GNUNET_HELPER_Handle * 65struct GNUNET_HELPER_Handle *
65GNUNET_HELPER_start (const char *binary_name, 66GNUNET_HELPER_start (int with_control_pipe,
67 const char *binary_name,
66 char *const binary_argv[], 68 char *const binary_argv[],
67 GNUNET_SERVER_MessageTokenizerCallback cb, 69 GNUNET_SERVER_MessageTokenizerCallback cb,
68 GNUNET_HELPER_ExceptionCallback exp_cb, 70 GNUNET_HELPER_ExceptionCallback exp_cb,
diff --git a/src/testbed/test_gnunet_testbed_helper.c b/src/testbed/test_gnunet_testbed_helper.c
index a0e1dd619..0026b4923 100644
--- a/src/testbed/test_gnunet_testbed_helper.c
+++ b/src/testbed/test_gnunet_testbed_helper.c
@@ -204,7 +204,8 @@ run (void *cls, char *const *args, const char *cfgfile,
204 }; 204 };
205 const char *controller_name = "127.0.0.1"; 205 const char *controller_name = "127.0.0.1";
206 206
207 helper = GNUNET_HELPER_start ("gnunet-testbed-helper", 207 helper = GNUNET_HELPER_start (GNUNET_YES,
208 "gnunet-testbed-helper",
208 binary_argv, 209 binary_argv,
209 &mst_cb, &exp_cb, NULL); 210 &mst_cb, &exp_cb, NULL);
210 GNUNET_assert (NULL != helper); 211 GNUNET_assert (NULL != helper);
diff --git a/src/testbed/testbed_api.c b/src/testbed/testbed_api.c
index f302cb57b..7012be775 100644
--- a/src/testbed/testbed_api.c
+++ b/src/testbed/testbed_api.c
@@ -1054,7 +1054,8 @@ GNUNET_TESTBED_controller_start (const char *controller_ip,
1054 "gnunet-testbed-helper", NULL 1054 "gnunet-testbed-helper", NULL
1055 }; 1055 };
1056 1056
1057 cp->helper = GNUNET_HELPER_start ("gnunet-testbed-helper", binary_argv, 1057 cp->helper = GNUNET_HELPER_start (GNUNET_YES,
1058 "gnunet-testbed-helper", binary_argv,
1058 &helper_mst, &helper_exp_cb, cp); 1059 &helper_mst, &helper_exp_cb, cp);
1059 } 1060 }
1060 else 1061 else
@@ -1082,7 +1083,8 @@ GNUNET_TESTBED_controller_start (const char *controller_ip,
1082 remote_args[argp++] = "gnunet-testbed-helper"; 1083 remote_args[argp++] = "gnunet-testbed-helper";
1083 remote_args[argp++] = NULL; 1084 remote_args[argp++] = NULL;
1084 GNUNET_assert (argp == 8); 1085 GNUNET_assert (argp == 8);
1085 cp->helper = GNUNET_HELPER_start ("ssh", remote_args, 1086 cp->helper = GNUNET_HELPER_start (GNUNET_NO,
1087 "ssh", remote_args,
1086 &helper_mst, &helper_exp_cb, cp); 1088 &helper_mst, &helper_exp_cb, cp);
1087 } 1089 }
1088 if (NULL == cp->helper) 1090 if (NULL == cp->helper)
diff --git a/src/transport/plugin_transport_wlan.c b/src/transport/plugin_transport_wlan.c
index 780c60479..ae1c9f972 100644
--- a/src/transport/plugin_transport_wlan.c
+++ b/src/transport/plugin_transport_wlan.c
@@ -1722,7 +1722,8 @@ libgnunet_plugin_transport_wlan_init (void *cls)
1722 plugin->helper_argv[0] = (char *) "gnunet-helper-transport-wlan"; 1722 plugin->helper_argv[0] = (char *) "gnunet-helper-transport-wlan";
1723 plugin->helper_argv[1] = interface; 1723 plugin->helper_argv[1] = interface;
1724 plugin->helper_argv[2] = NULL; 1724 plugin->helper_argv[2] = NULL;
1725 plugin->suid_helper = GNUNET_HELPER_start ("gnunet-helper-transport-wlan", 1725 plugin->suid_helper = GNUNET_HELPER_start (GNUNET_NO,
1726 "gnunet-helper-transport-wlan",
1726 plugin->helper_argv, 1727 plugin->helper_argv,
1727 &handle_helper_message, 1728 &handle_helper_message,
1728 NULL, 1729 NULL,
@@ -1732,7 +1733,8 @@ libgnunet_plugin_transport_wlan_init (void *cls)
1732 plugin->helper_argv[0] = (char *) "gnunet-helper-transport-wlan-dummy"; 1733 plugin->helper_argv[0] = (char *) "gnunet-helper-transport-wlan-dummy";
1733 plugin->helper_argv[1] = (char *) "1"; 1734 plugin->helper_argv[1] = (char *) "1";
1734 plugin->helper_argv[2] = NULL; 1735 plugin->helper_argv[2] = NULL;
1735 plugin->suid_helper = GNUNET_HELPER_start ("gnunet-helper-transport-wlan-dummy", 1736 plugin->suid_helper = GNUNET_HELPER_start (GNUNET_NO,
1737 "gnunet-helper-transport-wlan-dummy",
1736 plugin->helper_argv, 1738 plugin->helper_argv,
1737 &handle_helper_message, 1739 &handle_helper_message,
1738 NULL, 1740 NULL,
@@ -1742,7 +1744,8 @@ libgnunet_plugin_transport_wlan_init (void *cls)
1742 plugin->helper_argv[0] = (char *) "gnunet-helper-transport-wlan-dummy"; 1744 plugin->helper_argv[0] = (char *) "gnunet-helper-transport-wlan-dummy";
1743 plugin->helper_argv[1] = (char *) "2"; 1745 plugin->helper_argv[1] = (char *) "2";
1744 plugin->helper_argv[2] = NULL; 1746 plugin->helper_argv[2] = NULL;
1745 plugin->suid_helper = GNUNET_HELPER_start ("gnunet-helper-transport-wlan-dummy", 1747 plugin->suid_helper = GNUNET_HELPER_start (GNUNET_NO,
1748 "gnunet-helper-transport-wlan-dummy",
1746 plugin->helper_argv, 1749 plugin->helper_argv,
1747 &handle_helper_message, 1750 &handle_helper_message,
1748 NULL, 1751 NULL,
diff --git a/src/transport/test_plugin_transport.c b/src/transport/test_plugin_transport.c
index f195d0369..4934dcdad 100644
--- a/src/transport/test_plugin_transport.c
+++ b/src/transport/test_plugin_transport.c
@@ -531,7 +531,8 @@ run (void *cls, char *const *args, const char *cfgfile,
531 helper_argv[0] = (char *) "gnunet-helper-transport-wlan-dummy"; 531 helper_argv[0] = (char *) "gnunet-helper-transport-wlan-dummy";
532 helper_argv[1] = (char *) "2"; 532 helper_argv[1] = (char *) "2";
533 helper_argv[2] = NULL; 533 helper_argv[2] = NULL;
534 suid_helper = GNUNET_HELPER_start ("gnunet-helper-transport-wlan-dummy", 534 suid_helper = GNUNET_HELPER_start (GNUNET_NO,
535 "gnunet-helper-transport-wlan-dummy",
535 helper_argv, 536 helper_argv,
536 &handle_helper_message, 537 &handle_helper_message,
537 NULL, 538 NULL,
diff --git a/src/util/common_allocation.c b/src/util/common_allocation.c
index a385450b9..90af6e091 100644
--- a/src/util/common_allocation.c
+++ b/src/util/common_allocation.c
@@ -23,9 +23,11 @@
23 * @brief wrapper around malloc/free 23 * @brief wrapper around malloc/free
24 * @author Christian Grothoff 24 * @author Christian Grothoff
25 */ 25 */
26
27#include "platform.h" 26#include "platform.h"
28#include "gnunet_common.h" 27#include "gnunet_common.h"
28#if HAVE_MALLOC_H
29#include <malloc.h>
30#endif
29 31
30#define LOG(kind,...) GNUNET_log_from (kind, "util",__VA_ARGS__) 32#define LOG(kind,...) GNUNET_log_from (kind, "util",__VA_ARGS__)
31 33
@@ -192,11 +194,7 @@ GNUNET_xrealloc_ (void *ptr, size_t n, const char *filename, int linenumber)
192#if WINDOWS 194#if WINDOWS
193#define MSIZE(p) _msize (p) 195#define MSIZE(p) _msize (p)
194#endif 196#endif
195#if LINUX 197#if HAVE_MALLOC_USABLE_SIZE
196/* FIXME: manpage claims that this function is a GNU extension,
197 * but googling shows that it is available on many platforms via
198 * inclusion of various headers. For now let's make it Linux-only.
199 */
200#define MSIZE(p) malloc_usable_size (p) 198#define MSIZE(p) malloc_usable_size (p)
201#endif 199#endif
202 200
diff --git a/src/util/helper.c b/src/util/helper.c
index 64b014994..9faf2ee50 100644
--- a/src/util/helper.c
+++ b/src/util/helper.c
@@ -152,6 +152,12 @@ struct GNUNET_HELPER_Handle
152 * Restart task. 152 * Restart task.
153 */ 153 */
154 GNUNET_SCHEDULER_TaskIdentifier restart_task; 154 GNUNET_SCHEDULER_TaskIdentifier restart_task;
155
156 /**
157 * Does the helper support the use of a control pipe for signalling?
158 */
159 int with_control_pipe;
160
155}; 161};
156 162
157 163
@@ -341,10 +347,10 @@ start_helper (struct GNUNET_HELPER_Handle *h)
341 h->fh_to_helper = 347 h->fh_to_helper =
342 GNUNET_DISK_pipe_handle (h->helper_in, GNUNET_DISK_PIPE_END_WRITE); 348 GNUNET_DISK_pipe_handle (h->helper_in, GNUNET_DISK_PIPE_END_WRITE);
343 h->helper_proc = 349 h->helper_proc =
344 GNUNET_OS_start_process_vap (GNUNET_YES, GNUNET_OS_INHERIT_STD_ERR, 350 GNUNET_OS_start_process_vap (h->with_control_pipe, GNUNET_OS_INHERIT_STD_ERR,
345 h->helper_in, h->helper_out, 351 h->helper_in, h->helper_out,
346 h->binary_name, 352 h->binary_name,
347 h->binary_argv); 353 h->binary_argv);
348 if (NULL == h->helper_proc) 354 if (NULL == h->helper_proc)
349 { 355 {
350 /* failed to start process? try again later... */ 356 /* failed to start process? try again later... */
@@ -385,6 +391,7 @@ restart_task (void *cls,
385 * restarted when it dies except when it is stopped using GNUNET_HELPER_stop() 391 * restarted when it dies except when it is stopped using GNUNET_HELPER_stop()
386 * or when the exp_cb callback is not NULL. 392 * or when the exp_cb callback is not NULL.
387 * 393 *
394 * @param with_control_pipe does the helper support the use of a control pipe for signalling?
388 * @param binary_name name of the binary to run 395 * @param binary_name name of the binary to run
389 * @param binary_argv NULL-terminated list of arguments to give when starting the binary (this 396 * @param binary_argv NULL-terminated list of arguments to give when starting the binary (this
390 * argument must not be modified by the client for 397 * argument must not be modified by the client for
@@ -396,7 +403,8 @@ restart_task (void *cls,
396 * @return the new Handle, NULL on error 403 * @return the new Handle, NULL on error
397 */ 404 */
398struct GNUNET_HELPER_Handle * 405struct GNUNET_HELPER_Handle *
399GNUNET_HELPER_start (const char *binary_name, 406GNUNET_HELPER_start (int with_control_pipe,
407 const char *binary_name,
400 char *const binary_argv[], 408 char *const binary_argv[],
401 GNUNET_SERVER_MessageTokenizerCallback cb, 409 GNUNET_SERVER_MessageTokenizerCallback cb,
402 GNUNET_HELPER_ExceptionCallback exp_cb, 410 GNUNET_HELPER_ExceptionCallback exp_cb,
@@ -405,6 +413,7 @@ GNUNET_HELPER_start (const char *binary_name,
405 struct GNUNET_HELPER_Handle*h; 413 struct GNUNET_HELPER_Handle*h;
406 414
407 h = GNUNET_malloc (sizeof (struct GNUNET_HELPER_Handle)); 415 h = GNUNET_malloc (sizeof (struct GNUNET_HELPER_Handle));
416 h->with_control_pipe = with_control_pipe;
408 h->binary_name = binary_name; 417 h->binary_name = binary_name;
409 h->binary_argv = binary_argv; 418 h->binary_argv = binary_argv;
410 h->cb_cls = cb_cls; 419 h->cb_cls = cb_cls;
diff --git a/src/vpn/gnunet-service-vpn.c b/src/vpn/gnunet-service-vpn.c
index 6138e9c1e..48de1de46 100644
--- a/src/vpn/gnunet-service-vpn.c
+++ b/src/vpn/gnunet-service-vpn.c
@@ -3180,7 +3180,8 @@ run (void *cls,
3180 &tunnel_cleaner, 3180 &tunnel_cleaner,
3181 mesh_handlers, 3181 mesh_handlers,
3182 types); 3182 types);
3183 helper_handle = GNUNET_HELPER_start ("gnunet-helper-vpn", vpn_argv, 3183 helper_handle = GNUNET_HELPER_start (GNUNET_NO,
3184 "gnunet-helper-vpn", vpn_argv,
3184 &message_token, NULL, NULL); 3185 &message_token, NULL, NULL);
3185 nc = GNUNET_SERVER_notification_context_create (server, 1); 3186 nc = GNUNET_SERVER_notification_context_create (server, 1);
3186 GNUNET_SERVER_add_handlers (server, service_handlers); 3187 GNUNET_SERVER_add_handlers (server, service_handlers);