[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r3300 - in GNUnet: . src/applications/datastore src/applica
From: |
grothoff |
Subject: |
[GNUnet-SVN] r3300 - in GNUnet: . src/applications/datastore src/applications/fs/tools src/applications/state src/applications/stats src/applications/tbench src/applications/template src/applications/tracekit src/applications/transport src/include src/server src/setup src/util/config_impl src/util/getopt src/util/loggers src/util/os |
Date: |
Thu, 24 Aug 2006 18:22:13 -0700 (PDT) |
Author: grothoff
Date: 2006-08-24 18:22:00 -0700 (Thu, 24 Aug 2006)
New Revision: 3300
Modified:
GNUnet/src/applications/datastore/datastore.c
GNUnet/src/applications/fs/tools/gnunet-directory.c
GNUnet/src/applications/fs/tools/gnunet-download.c
GNUnet/src/applications/fs/tools/gnunet-insert.c
GNUnet/src/applications/fs/tools/gnunet-pseudonym.c
GNUnet/src/applications/fs/tools/gnunet-search.c
GNUnet/src/applications/fs/tools/gnunet-unindex.c
GNUnet/src/applications/state/state.c
GNUnet/src/applications/stats/gnunet-stats.c
GNUnet/src/applications/tbench/gnunet-tbench.c
GNUnet/src/applications/template/gnunet-template.c
GNUnet/src/applications/tracekit/gnunet-tracekit.c
GNUnet/src/applications/transport/transport.c
GNUnet/src/include/gnunet_directories.h
GNUnet/src/include/gnunet_transport.h
GNUnet/src/include/gnunet_util_getopt.h
GNUnet/src/server/gnunet-peer-info.c
GNUnet/src/server/gnunet-transport-check.c
GNUnet/src/server/gnunet-update.c
GNUnet/src/server/gnunetd.c
GNUnet/src/setup/gnunet-setup.c
GNUnet/src/util/config_impl/impl.c
GNUnet/src/util/getopt/setoption.c
GNUnet/src/util/loggers/file.c
GNUnet/src/util/os/daemon.c
GNUnet/src/util/os/installpath.c
GNUnet/src/util/os/statuscalls.c
GNUnet/todo
Log:
various bugfixes
Modified: GNUnet/src/applications/datastore/datastore.c
===================================================================
--- GNUnet/src/applications/datastore/datastore.c 2006-08-25 01:02:17 UTC
(rev 3299)
+++ GNUnet/src/applications/datastore/datastore.c 2006-08-25 01:22:00 UTC
(rev 3300)
@@ -359,7 +359,7 @@
}
sq = capi->requestService("sqstore");
if (sq == NULL) {
- GE_BREAK(coreAPI->ectx, 0);
+ GE_BREAK(capi->ectx, 0);
return NULL;
}
coreAPI = capi;
Modified: GNUnet/src/applications/fs/tools/gnunet-directory.c
===================================================================
--- GNUnet/src/applications/fs/tools/gnunet-directory.c 2006-08-25 01:02:17 UTC
(rev 3299)
+++ GNUnet/src/applications/fs/tools/gnunet-directory.c 2006-08-25 01:22:00 UTC
(rev 3300)
@@ -32,6 +32,8 @@
#include "gnunet_util_config_impl.h"
#include "gnunet_util_error_loggers.h"
+static char * cfgFilename;
+
static int do_list;
static int do_kill;
@@ -135,7 +137,7 @@
* All gnunet-directory command line options
*/
static struct CommandLineOption gnunetdirectoryOptions[] = {
- COMMAND_LINE_OPTION_CFG_FILE, /* -c */
+ COMMAND_LINE_OPTION_CFG_FILE(&cfgFilename), /* -c */
COMMAND_LINE_OPTION_HELP(gettext_noop("Perform directory related
operations.")), /* -h */
{ 'k', "kill", NULL,
gettext_noop("remove all entries from the directory database and stop
tracking URIs"),
Modified: GNUnet/src/applications/fs/tools/gnunet-download.c
===================================================================
--- GNUnet/src/applications/fs/tools/gnunet-download.c 2006-08-25 01:02:17 UTC
(rev 3299)
+++ GNUnet/src/applications/fs/tools/gnunet-download.c 2006-08-25 01:22:00 UTC
(rev 3300)
@@ -37,6 +37,8 @@
static int do_recursive;
+static char * cfgFilename;
+
static char * filename;
static unsigned int anonymity = 1;
@@ -54,7 +56,7 @@
{ 'a', "anonymity", "LEVEL",
gettext_noop("set the desired LEVEL of sender-anonymity"),
1, &gnunet_getopt_configure_set_uint, &anonymity },
- COMMAND_LINE_OPTION_CFG_FILE, /* -c */
+ COMMAND_LINE_OPTION_CFG_FILE(&cfgFilename), /* -c */
COMMAND_LINE_OPTION_HELP(gettext_noop("Download files from GNUnet.")), /* -h
*/
COMMAND_LINE_OPTION_HOSTNAME, /* -H */
COMMAND_LINE_OPTION_LOGGING, /* -L */
Modified: GNUnet/src/applications/fs/tools/gnunet-insert.c
===================================================================
--- GNUnet/src/applications/fs/tools/gnunet-insert.c 2006-08-25 01:02:17 UTC
(rev 3299)
+++ GNUnet/src/applications/fs/tools/gnunet-insert.c 2006-08-25 01:22:00 UTC
(rev 3300)
@@ -50,15 +50,14 @@
static struct FSUI_Context * ctx;
-/**
- * The main upload
- */
static struct FSUI_UploadList * ul;
static cron_t start_time;
/* ************ config options ******** */
+static char * cfgFilename;
+
static struct ECRS_MetaData * meta;
static struct ECRS_URI * topKeywords;
@@ -224,7 +223,7 @@
{ 'a', "anonymity", "LEVEL",
gettext_noop("set the desired LEVEL of sender-anonymity"),
1, &gnunet_getopt_configure_set_uint, &anonymity },
- COMMAND_LINE_OPTION_CFG_FILE, /* -c */
+ COMMAND_LINE_OPTION_CFG_FILE(&cfgFilename), /* -c */
{ 'C', "copy", NULL,
gettext_noop("even if gnunetd is running on the local machine, force the"
" creation of a copy instead of making a link to the GNUnet
share directory"),
Modified: GNUnet/src/applications/fs/tools/gnunet-pseudonym.c
===================================================================
--- GNUnet/src/applications/fs/tools/gnunet-pseudonym.c 2006-08-25 01:02:17 UTC
(rev 3299)
+++ GNUnet/src/applications/fs/tools/gnunet-pseudonym.c 2006-08-25 01:22:00 UTC
(rev 3300)
@@ -57,6 +57,8 @@
static unsigned int expiration;
+static char * cfgFilename;
+
static struct ECRS_MetaData * meta;
static struct ECRS_URI * advertisement;
@@ -71,7 +73,7 @@
{ 'A', "automate", NULL,
gettext_noop("automate creation of a namespace by starting a
collection"),
0, &gnunet_getopt_configure_set_one, &start_collection },
- COMMAND_LINE_OPTION_CFG_FILE, /* -c */
+ COMMAND_LINE_OPTION_CFG_FILE(&cfgFilename), /* -c */
{ 'C', "create", "NICKNAME",
gettext_noop("create a new pseudonym under the given NICKNAME"),
1, &gnunet_getopt_configure_set_string, &create_name },
Modified: GNUnet/src/applications/fs/tools/gnunet-search.c
===================================================================
--- GNUnet/src/applications/fs/tools/gnunet-search.c 2006-08-25 01:02:17 UTC
(rev 3299)
+++ GNUnet/src/applications/fs/tools/gnunet-search.c 2006-08-25 01:22:00 UTC
(rev 3300)
@@ -43,6 +43,8 @@
static unsigned int max_results;
+static char * cfgFilename;
+
static char * output_filename;
typedef struct {
@@ -126,7 +128,7 @@
{ 'a', "anonymity", "LEVEL",
gettext_noop("set the desired LEVEL of sender-anonymity"),
1, &gnunet_getopt_configure_set_uint, &anonymity },
- COMMAND_LINE_OPTION_CFG_FILE, /* -c */
+ COMMAND_LINE_OPTION_CFG_FILE(&cfgFilename), /* -c */
COMMAND_LINE_OPTION_HELP(gettext_noop("Create new pseudonyms, delete
pseudonyms or list existing pseudonyms.")), /* -h */
COMMAND_LINE_OPTION_HOSTNAME, /* -H */
COMMAND_LINE_OPTION_LOGGING, /* -L */
Modified: GNUnet/src/applications/fs/tools/gnunet-unindex.c
===================================================================
--- GNUnet/src/applications/fs/tools/gnunet-unindex.c 2006-08-25 01:02:17 UTC
(rev 3299)
+++ GNUnet/src/applications/fs/tools/gnunet-unindex.c 2006-08-25 01:22:00 UTC
(rev 3300)
@@ -44,6 +44,8 @@
static int errorCode;
+static char * cfgFilename;
+
/**
* Print progess message.
*/
@@ -94,7 +96,7 @@
* All gnunet-unindex command line options
*/
static struct CommandLineOption gnunetunindexOptions[] = {
- COMMAND_LINE_OPTION_CFG_FILE, /* -c */
+ COMMAND_LINE_OPTION_CFG_FILE(&cfgFilename), /* -c */
COMMAND_LINE_OPTION_HELP(gettext_noop("Unindex files.")), /* -h */
COMMAND_LINE_OPTION_HOSTNAME, /* -H */
COMMAND_LINE_OPTION_LOGGING, /* -L */
Modified: GNUnet/src/applications/state/state.c
===================================================================
--- GNUnet/src/applications/state/state.c 2006-08-25 01:02:17 UTC (rev
3299)
+++ GNUnet/src/applications/state/state.c 2006-08-25 01:22:00 UTC (rev
3300)
@@ -246,8 +246,8 @@
size_t n;
if (-1 == GC_get_configuration_value_string(capi->cfg,
+ "GNUNETD",
"GNUNETD_HOME",
- "GNUNETD",
VAR_DAEMON_DIRECTORY,
&dir))
return NULL;
@@ -257,9 +257,14 @@
FREE(dir);
if (dbh == NULL)
return NULL;
- n = strlen(dir) + strlen(DIR_EXT) + 5;
+ n = strlen(dbh) + strlen(DIR_EXT) + 5;
handle = MALLOC(n);
- SNPRINTF(handle, n, "%s/%s/", dir, DIR_EXT);
+ SNPRINTF(handle,
+ n,
+ "%s/%s/",
+ dbh,
+ DIR_EXT);
+ FREE(dbh);
if (SYSERR == disk_directory_create(capi->ectx,
handle)) {
FREE(handle);
Modified: GNUnet/src/applications/stats/gnunet-stats.c
===================================================================
--- GNUnet/src/applications/stats/gnunet-stats.c 2006-08-25 01:02:17 UTC
(rev 3299)
+++ GNUnet/src/applications/stats/gnunet-stats.c 2006-08-25 01:22:00 UTC
(rev 3300)
@@ -34,6 +34,8 @@
static int lastIp2p = 42; /* not YES or NO */
+static char * cfgFilename;
+
/**
* Print statistics received.
*
@@ -84,7 +86,7 @@
* All gnunet-transport-check command line options
*/
static struct CommandLineOption gnunetstatsOptions[] = {
- COMMAND_LINE_OPTION_CFG_FILE, /* -c */
+ COMMAND_LINE_OPTION_CFG_FILE(&cfgFilename), /* -c */
COMMAND_LINE_OPTION_HELP(gettext_noop("Print statistics about GNUnet
operations.")), /* -h */
COMMAND_LINE_OPTION_HOSTNAME, /* -H */
COMMAND_LINE_OPTION_LOGGING, /* -L */
Modified: GNUnet/src/applications/tbench/gnunet-tbench.c
===================================================================
--- GNUnet/src/applications/tbench/gnunet-tbench.c 2006-08-25 01:02:17 UTC
(rev 3299)
+++ GNUnet/src/applications/tbench/gnunet-tbench.c 2006-08-25 01:22:00 UTC
(rev 3300)
@@ -40,20 +40,28 @@
#define OF_GNUPLOT_INPUT 1
static unsigned long long messageSize = DEFAULT_MESSAGE_SIZE;
+
static unsigned long long messageCnt = 1;
+
static char * messageReceiver;
+
static unsigned long long messageIterations = 1;
+
static unsigned long long messageTrainSize = 1;
+
static cron_t messageTimeOut = DEFAULT_TIMEOUT;
+
static cron_t messageSpacing = DEFAULT_SPACING;
+
static int outputFormat = OF_HUMAN_READABLE;
+static char * cfgFilename;
/**
* All gnunet-tbench command line options
*/
static struct CommandLineOption gnunettbenchOptions[] = {
- COMMAND_LINE_OPTION_CFG_FILE, /* -c */
+ COMMAND_LINE_OPTION_CFG_FILE(&cfgFilename), /* -c */
COMMAND_LINE_OPTION_HELP(gettext_noop("Start GNUnet transport benchmarking
tool.")), /* -h */
{ 'g', "gnuplot", NULL,
gettext_noop("output in gnuplot format"), 0,
Modified: GNUnet/src/applications/template/gnunet-template.c
===================================================================
--- GNUnet/src/applications/template/gnunet-template.c 2006-08-25 01:02:17 UTC
(rev 3299)
+++ GNUnet/src/applications/template/gnunet-template.c 2006-08-25 01:22:00 UTC
(rev 3300)
@@ -34,12 +34,13 @@
static struct SEMAPHORE * doneSem;
+static char * cfgFilename;
/**
* All gnunetd command line options
*/
static struct CommandLineOption gnunettemplateOptions[] = {
- COMMAND_LINE_OPTION_CFG_FILE, /* -c */
+ COMMAND_LINE_OPTION_CFG_FILE(&cfgFilename), /* -c */
COMMAND_LINE_OPTION_HELP(gettext_noop("Template description.")), /* -h */
COMMAND_LINE_OPTION_HOSTNAME, /* -H */
COMMAND_LINE_OPTION_LOGGING, /* -L */
Modified: GNUnet/src/applications/tracekit/gnunet-tracekit.c
===================================================================
--- GNUnet/src/applications/tracekit/gnunet-tracekit.c 2006-08-25 01:02:17 UTC
(rev 3299)
+++ GNUnet/src/applications/tracekit/gnunet-tracekit.c 2006-08-25 01:22:00 UTC
(rev 3300)
@@ -34,6 +34,8 @@
static struct SEMAPHORE * doneSem;
+static char * cfgFilename;
+
static struct GE_Context * ectx;
static struct GC_Configuration * cfg;
@@ -42,7 +44,7 @@
* All gnunet-tracekit command line options
*/
static struct CommandLineOption gnunettracekitOptions[] = {
- COMMAND_LINE_OPTION_CFG_FILE, /* -c */
+ COMMAND_LINE_OPTION_CFG_FILE(&cfgFilename), /* -c */
{ 'D', "depth", "DEPTH",
gettext_noop("probe network to the given DEPTH"), 1,
&gnunet_getopt_configure_set_option, "GNUNET-TRACEKIT:HOPS" },
Modified: GNUnet/src/applications/transport/transport.c
===================================================================
--- GNUnet/src/applications/transport/transport.c 2006-08-25 01:02:17 UTC
(rev 3299)
+++ GNUnet/src/applications/transport/transport.c 2006-08-25 01:22:00 UTC
(rev 3300)
@@ -545,8 +545,12 @@
return NULL;
}
coreAPI = capi;
- ctapi.version = 0;
+ ctapi.version = 1;
ctapi.myIdentity = coreAPI->myIdentity;
+ ctapi.ectx = coreAPI->ectx;
+ ctapi.cfg = coreAPI->cfg;
+ ctapi.load_monitor = coreAPI->load_monitor;
+ ctapi.cron = coreAPI->cron;
ctapi.receive = NULL; /* initialized LATER! */
ctapi.requestService = coreAPI->requestService;
ctapi.releaseService = coreAPI->releaseService;
@@ -605,6 +609,10 @@
continue;
}
tapi = tptr(&ctapi);
+ if (tapi == NULL) {
+ os_plugin_unload(lib);
+ continue;
+ }
tapi->libHandle = lib;
tapi->transName = STRDUP(pos);
addTransport(tapi);
Modified: GNUnet/src/include/gnunet_directories.h
===================================================================
--- GNUnet/src/include/gnunet_directories.h 2006-08-25 01:02:17 UTC (rev
3299)
+++ GNUnet/src/include/gnunet_directories.h 2006-08-25 01:22:00 UTC (rev
3300)
@@ -33,8 +33,6 @@
#define DEFAULT_DAEMON_CONFIG_FILE DEFAULT_DAEMON_DIR"/gnunetd.conf"
#define VAR_DIRECTORY "/var/lib"
#define VAR_DAEMON_DIRECTORY VAR_DIRECTORY"/gnunet"
-#define VAR_DAEMON_CONFIG_FILE VAR_DAEMON_DIRECTORY"/gnunetd.conf"
#define GNUNET_HOME_DIRECTORY "~/.gnunet"
-#define HOME_DAEMON_CONFIG_FILE GNUNET_HOME_DIRECTORY"/gnunetd.conf"
#endif
Modified: GNUnet/src/include/gnunet_transport.h
===================================================================
--- GNUnet/src/include/gnunet_transport.h 2006-08-25 01:02:17 UTC (rev
3299)
+++ GNUnet/src/include/gnunet_transport.h 2006-08-25 01:22:00 UTC (rev
3300)
@@ -98,7 +98,7 @@
typedef struct {
/**
- * The version of the CORE API. For now, always "0".
+ * The version of the CORE API. For now, always "1".
*/
unsigned int version;
Modified: GNUnet/src/include/gnunet_util_getopt.h
===================================================================
--- GNUnet/src/include/gnunet_util_getopt.h 2006-08-25 01:02:17 UTC (rev
3299)
+++ GNUnet/src/include/gnunet_util_getopt.h 2006-08-25 01:22:00 UTC (rev
3300)
@@ -168,8 +168,8 @@
/**
* Set the configuration option for the configuration file.
*/
-#define COMMAND_LINE_OPTION_CFG_FILE \
- { 'c', "config", "FILENAME", gettext_noop("use configuration file
FILENAME"), 1, &gnunet_getopt_configure_set_option, "GNUNET:CONFIGFILE" }
+#define COMMAND_LINE_OPTION_CFG_FILE(fn) \
+ { 'c', "config", "FILENAME", gettext_noop("use configuration file
FILENAME"), 1, &gnunet_getopt_configure_set_string, fn }
/**
* Set the configuration option for the configuration file.
Modified: GNUnet/src/server/gnunet-peer-info.c
===================================================================
--- GNUnet/src/server/gnunet-peer-info.c 2006-08-25 01:02:17 UTC (rev
3299)
+++ GNUnet/src/server/gnunet-peer-info.c 2006-08-25 01:22:00 UTC (rev
3300)
@@ -27,6 +27,7 @@
#include "platform.h"
#include "gnunet_util.h"
#include "gnunet_protocols.h"
+#include "gnunet_directories.h"
#include "gnunet_transport_service.h"
#include "gnunet_identity_service.h"
#include "gnunet_core.h"
@@ -41,11 +42,13 @@
static struct GE_Context * ectx;
+static char * cfgFilename = DEFAULT_DAEMON_CONFIG_FILE;
+
/**
* All gnunet-peer-info command line options
*/
static struct CommandLineOption gnunetpeerinfoOptions[] = {
- COMMAND_LINE_OPTION_CFG_FILE, /* -c */
+ COMMAND_LINE_OPTION_CFG_FILE(&cfgFilename), /* -c */
COMMAND_LINE_OPTION_HELP(gettext_noop("Print information about GNUnet
peers.")), /* -h */
COMMAND_LINE_OPTION_HOSTNAME, /* -H */
COMMAND_LINE_OPTION_LOGGING, /* -L */
@@ -122,6 +125,12 @@
GE_free_context(ectx);
return -1;
}
+ if (-1 == GC_parse_configuration(cfg,
+ cfgFilename)) {
+ GC_free(cfg);
+ GE_free_context(ectx);
+ return -1;
+ }
GE_ASSERT(ectx,
0 == GC_set_configuration_value_string(cfg,
ectx,
Modified: GNUnet/src/server/gnunet-transport-check.c
===================================================================
--- GNUnet/src/server/gnunet-transport-check.c 2006-08-25 01:02:17 UTC (rev
3299)
+++ GNUnet/src/server/gnunet-transport-check.c 2006-08-25 01:22:00 UTC (rev
3300)
@@ -31,6 +31,7 @@
#include "gnunet_util.h"
#include "gnunet_util_config_impl.h"
#include "gnunet_util_error_loggers.h"
+#include "gnunet_directories.h"
#include "gnunet_protocols.h"
#include "gnunet_transport_service.h"
#include "gnunet_identity_service.h"
@@ -69,6 +70,8 @@
static struct CronManager * cron;
+static char * cfgFilename = DEFAULT_DAEMON_CONFIG_FILE;
+
static void semUp(struct SEMAPHORE * sem) {
terminate = YES;
SEMAPHORE_UP(sem);
@@ -343,7 +346,7 @@
* All gnunet-transport-check command line options
*/
static struct CommandLineOption gnunettransportcheckOptions[] = {
- COMMAND_LINE_OPTION_CFG_FILE, /* -c */
+ COMMAND_LINE_OPTION_CFG_FILE(&cfgFilename), /* -c */
COMMAND_LINE_OPTION_HELP(gettext_noop("Tool to test if GNUnet transport
services are operational.")), /* -h */
COMMAND_LINE_OPTION_HOSTNAME, /* -H */
COMMAND_LINE_OPTION_LOGGING, /* -L */
@@ -404,7 +407,12 @@
GE_free_context(ectx);
return -1;
}
-
+ if (-1 == GC_parse_configuration(cfg,
+ cfgFilename)) {
+ GC_free(cfg);
+ GE_free_context(ectx);
+ return -1;
+ }
if (OK != changeUser(ectx, cfg)) {
GC_free(cfg);
GE_free_context(ectx);
Modified: GNUnet/src/server/gnunet-update.c
===================================================================
--- GNUnet/src/server/gnunet-update.c 2006-08-25 01:02:17 UTC (rev 3299)
+++ GNUnet/src/server/gnunet-update.c 2006-08-25 01:22:00 UTC (rev 3300)
@@ -29,6 +29,7 @@
#include "gnunet_util_config_impl.h"
#include "gnunet_util_error_loggers.h"
#include "gnunet_util_cron.h"
+#include "gnunet_directories.h"
#include "gnunet_core.h"
#include "core.h"
#include "startup.h"
@@ -53,6 +54,8 @@
static UpdateAPI uapi;
+static char * cfgFilename = DEFAULT_DAEMON_CONFIG_FILE;
+
/**
* Allow the module named "pos" to update.
* @return OK on success, SYSERR on error
@@ -210,7 +213,7 @@
* All gnunet-update command line options
*/
static struct CommandLineOption gnunetupdateOptions[] = {
- COMMAND_LINE_OPTION_CFG_FILE, /* -c */
+ COMMAND_LINE_OPTION_CFG_FILE(&cfgFilename), /* -c */
{ 'g', "get", "",
gettext_noop("ping peers from HOSTLISTURL that match transports"),
0, &gnunet_getopt_configure_set_option, "GNUNET-UPDATE:GET" },
@@ -251,6 +254,12 @@
GE_free_context(ectx);
return -1;
}
+ if (-1 == GC_parse_configuration(cfg,
+ cfgFilename)) {
+ GC_free(cfg);
+ GE_free_context(ectx);
+ return -1;
+ }
if (OK != changeUser(ectx, cfg)) {
GC_free(cfg);
GE_free_context(ectx);
Modified: GNUnet/src/server/gnunetd.c
===================================================================
--- GNUnet/src/server/gnunetd.c 2006-08-25 01:02:17 UTC (rev 3299)
+++ GNUnet/src/server/gnunetd.c 2006-08-25 01:22:00 UTC (rev 3300)
@@ -44,25 +44,17 @@
static struct CronManager * cron;
+static char * cfgFilename = DEFAULT_DAEMON_CONFIG_FILE;
+
+static int debug_flag;
+
/**
* Cron job that triggers re-reading of the configuration.
*/
static void reread_config_helper(void * unused) {
- char * filename;
-
- filename = NULL;
- if (-1 == GC_get_configuration_value_filename(cfg,
- "GNUNET",
- "CONFIGFILE",
- DEFAULT_DAEMON_CONFIG_FILE,
- &filename)) {
- GE_BREAK(NULL, 0); /* should never happen */
- return;
- }
- GE_ASSERT(NULL, filename != NULL);
+ GE_ASSERT(NULL, cfgFilename != NULL);
GC_parse_configuration(cfg,
- filename);
- FREE(filename);
+ cfgFilename);
}
/**
@@ -99,25 +91,24 @@
struct LoadMonitor * mon;
struct SignalHandlerContext * shc_hup;
int filedes[2]; /* pipe between client and parent */
- int debug_flag;
-
- debug_flag = GC_get_configuration_value_yesno(cfg,
- "GNUNETD",
- "DEBUG",
- NO);
if ( (NO == debug_flag) &&
(OK != os_terminal_detach(ectx,
filedes)) )
return SYSERR;
mon = os_network_monitor_create(ectx,
cfg);
+ GE_ASSERT(ectx,
+ mon != NULL);
cron = cron_create(ectx);
+ GE_ASSERT(ectx,
+ cron != NULL);
shc_hup = signal_handler_install(SIGHUP, &reread_config);
- initCore(ectx,
- cfg,
- cron,
- mon);
+ GE_ASSERT(ectx,
+ OK == initCore(ectx,
+ cfg,
+ cron,
+ mon));
initConnection(ectx, cfg, mon, cron);
loadApplicationModules();
writePIDFile(ectx, cfg);
@@ -147,14 +138,14 @@
* All gnunetd command line options
*/
static struct CommandLineOption gnunetdOptions[] = {
- COMMAND_LINE_OPTION_CFG_FILE, /* -c */
+ COMMAND_LINE_OPTION_CFG_FILE(&cfgFilename), /* -c */
{ '@', "win-service", NULL, gettext_noop(""), 0,
&gnunet_getopt_configure_set_option, "GNUNETD:WINSERVICE" },
{ 'd', "debug", NULL,
gettext_noop("run in debug mode; gnunetd will "
"not daemonize and error messages will "
"be written to stderr instead of a logfile"),
- 0, &gnunet_getopt_configure_set_option, "GNUNETD:DEBUG" },
+ 0, &gnunet_getopt_configure_set_one, &debug_flag },
COMMAND_LINE_OPTION_HELP(gettext_noop("Starts the gnunetd daemon.")), /* -h
*/
COMMAND_LINE_OPTION_HOSTNAME, /* -H */
COMMAND_LINE_OPTION_LOGGING, /* -L */
@@ -202,6 +193,12 @@
GE_free_context(ectx);
return -1;
}
+ if (-1 == GC_parse_configuration(cfg,
+ cfgFilename)) {
+ GC_free(cfg);
+ GE_free_context(ectx);
+ return -1;
+ }
if (OK != changeUser(ectx, cfg)) {
GC_free(cfg);
GE_free_context(ectx);
@@ -216,7 +213,7 @@
GC_free(cfg);
GE_free_context(ectx);
return 1;
- }
+ }
ret = gnunet_main(ectx);
GC_free(cfg);
os_done();
Modified: GNUnet/src/setup/gnunet-setup.c
===================================================================
--- GNUnet/src/setup/gnunet-setup.c 2006-08-25 01:02:17 UTC (rev 3299)
+++ GNUnet/src/setup/gnunet-setup.c 2006-08-25 01:22:00 UTC (rev 3300)
@@ -49,11 +49,13 @@
static struct GNS_Context * gns;
+static char * cfgFilename;
+
/**
* All gnunet-setup command line options
*/
static struct CommandLineOption gnunetsetupOptions[] = {
- COMMAND_LINE_OPTION_CFG_FILE, /* -c */
+ COMMAND_LINE_OPTION_CFG_FILE(&cfgFilename), /* -c */
{ 'd', "daemon", NULL,
gettext_noop("generate configuration for gnunetd, the GNUnet daemon"),
0, &gnunet_getopt_configure_set_one, &config_daemon },
@@ -122,7 +124,6 @@
const char * argv[]) {
const char * operation;
int done;
- char * filename;
char * dirname;
char * specname;
int i;
@@ -165,19 +166,11 @@
operation = argv[i];
}
- filename = NULL;
- if (-1 == GC_get_configuration_value_filename(cfg,
- "GNUNET",
- "CONFIGFILE",
- config_daemon
- ? DEFAULT_DAEMON_CONFIG_FILE
- : DEFAULT_CLIENT_CONFIG_FILE,
- &filename)) {
- GE_BREAK(ectx, 0); /* should never happen */
- return -1;
- }
- GE_ASSERT(ectx, filename != NULL);
- dirname = STRDUP(filename);
+ if (cfgFilename == NULL)
+ cfgFilename = config_daemon
+ ? DEFAULT_DAEMON_CONFIG_FILE
+ : DEFAULT_CLIENT_CONFIG_FILE;
+ dirname = STRDUP(cfgFilename);
i = strlen(dirname) - 1;
while (i > -1) {
char ch = dirname[i];
@@ -188,7 +181,7 @@
i--;
}
disk_directory_create(ectx, dirname);
- if ( ( (0 == ACCESS(filename, W_OK)) ||
+ if ( ( (0 == ACCESS(cfgFilename, W_OK)) ||
( (errno == ENOENT) &&
(0 == ACCESS(dirname, W_OK))) ) )
GE_DIE_STRERROR_FILE(ectx,
@@ -197,9 +190,9 @@
dirname);
FREE(dirname);
- if(0 == ACCESS(filename, F_OK))
+ if(0 == ACCESS(cfgFilename, F_OK))
GC_parse_configuration(cfg,
- filename);
+ cfgFilename);
dirname = os_get_installation_path(IPK_DATADIR);
specname = MALLOC(strlen(dirname) + strlen("config-daemon.scm") + 1);
strcpy(specname, dirname);
@@ -215,7 +208,7 @@
if (gns == NULL) {
GC_free(cfg);
GE_free_context(ectx);
- FREE(filename);
+ FREE(cfgFilename);
return -1;
}
@@ -228,7 +221,7 @@
modules[i+2],
argc,
argv,
- filename) != YES) {
+ cfgFilename) != YES) {
GE_LOG(ectx,
GE_FATAL | GE_USER | GE_ADMIN | GE_IMMEDIATE,
_("`%s' is not available."),
@@ -236,7 +229,7 @@
GNS_free_specification(gns);
GC_free(cfg);
GE_free_context(ectx);
- FREE(filename);
+ FREE(cfgFilename);
return -1;
} else {
done = YES;
@@ -244,7 +237,7 @@
}
i += 3;
}
- FREE(filename);
+ FREE(cfgFilename);
if (done == NO) {
fprintf(stderr,
_("Unknown operation `%s'\n"),
Modified: GNUnet/src/util/config_impl/impl.c
===================================================================
--- GNUnet/src/util/config_impl/impl.c 2006-08-25 01:02:17 UTC (rev 3299)
+++ GNUnet/src/util/config_impl/impl.c 2006-08-25 01:22:00 UTC (rev 3300)
@@ -141,7 +141,7 @@
for (j=0;j<sec->size;j++) {
e = &sec->entries[j];
FREE(e->key);
- FREE(e->val);
+ FREENONNULL(e->val);
GE_ASSERT(cfg->data->ectx,
e->dirty_val == NULL);
}
@@ -459,6 +459,11 @@
} else {
if (def == NULL) {
MUTEX_UNLOCK(cfg->data->lock);
+ GE_LOG(cfg->data->ectx,
+ GE_USER | GE_IMMEDIATE | GE_ERROR,
+ "Configuration value for option `%s' in section `%s' required.\n",
+ option,
+ section);
return -1;
}
*value = STRDUP(def);
@@ -560,7 +565,7 @@
} else {
e->dirty_val = STRDUP(value);
i = data->lsize - 1;
- while (i > 0) {
+ while (i >= 0) {
if (0 != data->listeners[i].listener(data->listeners[i].ctx,
cfg,
ectx,
@@ -569,7 +574,7 @@
break; /* update refused */
i--;
}
- if (i != 0) {
+ if (i >= 0) {
/* update refused, revert! */
FREE(e->dirty_val);
e->dirty_val = NULL;
@@ -586,11 +591,19 @@
ret = -1; /* error -- update refused */
} else {
/* all confirmed, commit! */
+ FREENONNULL(e->val);
e->val = e->dirty_val;
e->dirty_val = NULL;
ret = 0;
}
}
+ if (ret == -1)
+ GE_LOG(ectx,
+ GE_USER | GE_BULK | GE_WARNING,
+ _("Setting option `%s' in section `%s' to value `%s' was
refused.\n"),
+ option,
+ section,
+ value);
MUTEX_UNLOCK(data->lock);
return ret;
}
Modified: GNUnet/src/util/getopt/setoption.c
===================================================================
--- GNUnet/src/util/getopt/setoption.c 2006-08-25 01:02:17 UTC (rev 3299)
+++ GNUnet/src/util/getopt/setoption.c 2006-08-25 01:22:00 UTC (rev 3300)
@@ -44,13 +44,27 @@
option != NULL);
option[0] = '\0';
option++;
+ if (value == NULL)
+ value = "YES";
ret = GC_set_configuration_value_string(cfg,
ctx->ectx,
section,
option,
value);
+
+ if (ret != 0) {
+ GE_LOG(ctx->ectx,
+ GE_USER | GE_BULK | GE_ERROR,
+ _("Setting option `%s' in section `%s' to `%s' when processing
command line option `%s' was denied.\n"),
+ option,
+ section,
+ value,
+ cmdLineOption);
+ FREE(section);
+ return SYSERR;
+ }
FREE(section);
- return ret;
+ return OK;
}
int gnunet_getopt_configure_increment_value(CommandLineProcessorContext * ctx,
@@ -102,8 +116,8 @@
const char * option,
const char * value) {
char ** val = scls;
- if (value == NULL)
- return SYSERR;
+
+ GE_ASSERT(NULL, value != NULL);
*val = STRDUP(value);
return OK;
}
Modified: GNUnet/src/util/loggers/file.c
===================================================================
--- GNUnet/src/util/loggers/file.c 2006-08-25 01:02:17 UTC (rev 3299)
+++ GNUnet/src/util/loggers/file.c 2006-08-25 01:22:00 UTC (rev 3300)
@@ -224,13 +224,13 @@
}
if (fctx->logdate) {
ret = fprintf(fctx->handle,
- "%s: %s %s\n",
+ "%s: %s %s",
GE_kindToString(kind & GE_EVENTKIND),
date,
msg);
} else {
ret = fprintf(fctx->handle,
- "%s: %s\n",
+ "%s: %s",
GE_kindToString(kind & GE_EVENTKIND),
msg);
}
Modified: GNUnet/src/util/os/daemon.c
===================================================================
--- GNUnet/src/util/os/daemon.c 2006-08-25 01:02:17 UTC (rev 3299)
+++ GNUnet/src/util/os/daemon.c 2006-08-25 01:22:00 UTC (rev 3300)
@@ -37,7 +37,6 @@
* daemonized sucessfully, -1 on error
*/
static pid_t launchWithExec(struct GE_Context * ectx,
- const char * binary_home,
const char * cfgFile,
int daemonize) {
pid_t pid;
@@ -50,27 +49,19 @@
int i;
path = NULL;
- cp = STRDUP(binary_home);
+ cp = os_get_installation_path(IPK_BINDIR);
i = strlen(cp);
- while ( (i >= 0) &&
- (cp[i] != DIR_SEPARATOR) )
- i--;
- if ( i != -1 ) {
- cp[i+1] = '\0';
- path = MALLOC(i+2+strlen("gnunetd"));
- strcpy(path, cp);
- strcat(path, "gnunetd");
- if (ACCESS(path, X_OK) == 0) {
- args[0] = path;
- } else {
- FREE(path);
- path = NULL;
- args[0] = "gnunetd";
- }
- FREE(cp);
+ path = MALLOC(i+2+strlen("gnunetd"));
+ strcpy(path, cp);
+ strcat(path, "gnunetd");
+ if (ACCESS(path, X_OK) == 0) {
+ args[0] = path;
} else {
+ FREE(path);
+ path = NULL;
args[0] = "gnunetd";
}
+ FREE(cp);
if (cfgFile != NULL) {
args[1] = "-c";
args[2] = cfgFile;
@@ -146,21 +137,9 @@
const char * cfgFile,
int daemonize) {
#if LINUX || OSX || SOLARIS || SOMEBSD
- int ret;
- char * binName;
-
- if (0 != GC_get_configuration_value_string(cfg,
- "ARGV",
- "0",
- NULL,
- &binName))
- return -1;
- ret = launchWithExec(ectx,
- cfgFile,
- binName,
- daemonize);
- FREE(binName);
- return ret;
+ return launchWithExec(ectx,
+ cfgFile,
+ daemonize);
#elif MINGW
char szCall[_MAX_PATH + 1], szWd[_MAX_PATH + 1], szCWd[_MAX_PATH + 1];
char *args[1], *cp = NULL;
@@ -177,8 +156,11 @@
args[0] = "-d";
idx = 1;
- cp = GC_get_configuration_value_string(cfg, "GNUNET", "GNUNETD-CONFIG",
- NULL, &cp);
+ cp = GC_get_configuration_value_string(cfg,
+ "GNUNET",
+ "GNUNETD-CONFIG",
+ NULL,
+ &cp);
if (cp) {
args[1] = "-c";
args[2] = cp;
@@ -197,8 +179,9 @@
return (daemonize == NO) ? pid : 0;
#else
/* any system out there that does not support THIS!? */
- system("gnunetd"); /* we may not have nice,
- so let's be minimalistic here. */
+ if (-1 == system("gnunetd")) /* we may not have nice,
+ so let's be minimalistic here. */
+ return -1;
return 0;
#endif
}
Modified: GNUnet/src/util/os/installpath.c
===================================================================
--- GNUnet/src/util/os/installpath.c 2006-08-25 01:02:17 UTC (rev 3299)
+++ GNUnet/src/util/os/installpath.c 2006-08-25 01:22:00 UTC (rev 3300)
@@ -221,16 +221,16 @@
dirname = "";
break;
case IPK_BINDIR:
- dirname = "bin/";
+ dirname = "/bin/";
break;
case IPK_LIBDIR:
- dirname = "lib/GNUnet/";
+ dirname = "/lib/GNUnet/";
break;
case IPK_DATADIR:
- dirname = "share/GNUnet/";
+ dirname = "/share/GNUnet/";
break;
case IPK_LOCALEDIR:
- dirname = "share/locale/";
+ dirname = "/share/locale/";
break;
default:
FREE(execpath);
Modified: GNUnet/src/util/os/statuscalls.c
===================================================================
--- GNUnet/src/util/os/statuscalls.c 2006-08-25 01:02:17 UTC (rev 3299)
+++ GNUnet/src/util/os/statuscalls.c 2006-08-25 01:22:00 UTC (rev 3300)
@@ -255,22 +255,18 @@
struct GE_Context * ectx,
const char * sect,
const char * op) {
- static const char * yesno[] = { "YES", "NO", NULL };
struct LoadMonitor * monitor = cls;
- const char * y;
char * interfaces;
int i;
int numInterfaces;
int basic;
- if (-1 == GC_get_configuration_value_choice(cfg,
- "LOAD",
- "BASICLIMITING",
- yesno,
- "NO",
- &y))
+ basic = GC_get_configuration_value_yesno(cfg,
+ "LOAD",
+ "BASICLIMITING",
+ NO);
+ if (basic == SYSERR)
return SYSERR;
- basic = (y == "YES") ? YES : NO;
if (-1 == GC_get_configuration_value_string(cfg,
"LOAD",
"INTERFACES",
@@ -334,7 +330,7 @@
50000,
&monitor->maxNetUpBPS);
MUTEX_UNLOCK(monitor->statusMutex);
- return OK;
+ return 0;
}
/**
@@ -441,17 +437,12 @@
PROC_NET_DEV);
#endif
monitor->statusMutex = MUTEX_CREATE(NO);
- if (OK != resetStatusCalls(monitor,
- cfg,
- ectx,
- NULL,
- NULL)) {
+ if (-1 == GC_attach_change_listener(cfg,
+ &resetStatusCalls,
+ monitor)) {
os_network_monitor_destroy(monitor);
return NULL;
}
- GC_attach_change_listener(cfg,
- &resetStatusCalls,
- monitor);
return monitor;
}
Modified: GNUnet/todo
===================================================================
--- GNUnet/todo 2006-08-25 01:02:17 UTC (rev 3299)
+++ GNUnet/todo 2006-08-25 01:22:00 UTC (rev 3300)
@@ -18,6 +18,7 @@
+ network/io: load monitor support
+ loggers: SMTP logger
+ config: call GC change listeners on entire config on registration!!!
+ + make testcases compile & pass again!
* transports:
+ SMTP/HTTP: do not yet compile (commented out from build)
o libcurl / libwebserver-gnunet & libesmtp?
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r3300 - in GNUnet: . src/applications/datastore src/applications/fs/tools src/applications/state src/applications/stats src/applications/tbench src/applications/template src/applications/tracekit src/applications/transport src/include src/server src/setup src/util/config_impl src/util/getopt src/util/loggers src/util/os,
grothoff <=