style improvments wrt Mantis 1614 patch
authorChristian Grothoff <christian@grothoff.org>
Wed, 3 Nov 2010 21:38:45 +0000 (21:38 +0000)
committerChristian Grothoff <christian@grothoff.org>
Wed, 3 Nov 2010 21:38:45 +0000 (21:38 +0000)
47 files changed:
src/arm/arm_api.c
src/arm/do_start_process.c
src/arm/gnunet-service-arm.c
src/core/test_core_api.c
src/core/test_core_api_reliability.c
src/core/test_core_api_start_only.c
src/datastore/perf_datastore_api.c
src/datastore/test_datastore_api.c
src/datastore/test_datastore_api_management.c
src/dht/test_dht_api.c
src/fs/test_fs.c
src/fs/test_fs_download.c
src/fs/test_fs_download_indexed.c
src/fs/test_fs_download_persistence.c
src/fs/test_fs_download_recursive.c
src/fs/test_fs_list_indexed.c
src/fs/test_fs_namespace.c
src/fs/test_fs_namespace_list_updateable.c
src/fs/test_fs_publish.c
src/fs/test_fs_publish_persistence.c
src/fs/test_fs_search.c
src/fs/test_fs_search_persistence.c
src/fs/test_fs_search_ranking.c
src/fs/test_fs_start_stop.c
src/fs/test_fs_unindex.c
src/fs/test_fs_unindex_persistence.c
src/hostlist/test_gnunet_daemon_hostlist.c
src/hostlist/test_gnunet_daemon_hostlist_learning.c
src/include/gnunet_os_lib.h
src/include/gnunet_testing_lib.h
src/peerinfo/perf_peerinfo_api.c
src/peerinfo/test_peerinfo_api.c
src/statistics/test_statistics_api.c
src/statistics/test_statistics_api_loop.c
src/testing/test_testing_topology.c
src/testing/testing_group.c
src/transport/plugin_transport_tcp.c
src/transport/plugin_transport_udp.c
src/transport/plugin_transport_wlan.c
src/transport/test_quota_compliance.c
src/transport/test_transport_api.c
src/transport/test_transport_api_reliability.c
src/util/crypto_random.c
src/util/os_priority.c
src/util/test_os_start_process.c
src/util/test_resolver_api.c
src/vpn/gnunet-daemon-vpn.c

index 81f1c2d5c4c498e1ebcebc1f221f7d0087c01589..e404f8d27741b504ecdc28437f212bac7d6843b9 100644 (file)
@@ -375,7 +375,7 @@ arm_service_report (void *cls,
                    const struct GNUNET_SCHEDULER_TaskContext *tc)
 {
   struct RequestContext *pos = cls;
-  GNUNET_OS_Process *proc;
+  struct GNUNET_OS_Process *proc;
   char *binary;
   char *config;
   char *loprefix;
index 7d691ce60a9af309e8df62793f09b441543d9d02..139d0c42983c80908dbe662d02d1121d07601c76 100644 (file)
@@ -12,7 +12,7 @@
  * @param ... more arguments, NULL terminated
  * @return PID of the started process, -1 on error
  */
-static GNUNET_OS_Process *
+static struct GNUNET_OS_Process *
 do_start_process (const int *lsocks,
                  const char *first_arg, ...)
 {
@@ -24,7 +24,7 @@ do_start_process (const int *lsocks,
   char *pos;
   char *cp;
   const char *last;
-  GNUNET_OS_Process *proc;
+  struct GNUNET_OS_Process *proc;
 
   argv_size = 1;
   va_start (ap, first_arg);
index 543e655573e807e272aaddc9893c3654d7a9179b..ab4db97c7ce4fc54778f3f8380e32886a0358729 100644 (file)
@@ -93,7 +93,7 @@ struct ServiceList
   /**
    * Process structure pointer of the child.
    */
-  GNUNET_OS_Process *proc;
+  struct GNUNET_OS_Process *proc;
 
   /**
    * Last time the config of this service was
@@ -434,12 +434,10 @@ start_process (struct ServiceList *sl,
                sl->name);
   else
     GNUNET_log (GNUNET_ERROR_TYPE_INFO, 
-               _("Starting service `%s' (PID: %d)\n"), 
-               sl->name,
-               (int) GNUNET_OS_process_get_pid (sl->proc));
+               _("Starting service `%s'\n"), 
+               sl->name);
   GNUNET_free (loprefix);
   GNUNET_free (options);
-  /* FIXME: should check sl->proc */
 }
 
 
@@ -735,9 +733,8 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
       if (pos->proc != NULL)
        {
          GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-                     "Stopping service `%s' (PID: %d)\n",
-                     pos->name,
-                     GNUNET_OS_process_get_pid (pos->proc));
+                     "Stopping service `%s'\n",
+                     pos->name);
          if (0 != GNUNET_OS_process_kill (pos->proc, SIGTERM))
            GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill");
        }
index a4c3b0a78521eee5c5e933a0c509f8798afc3465..eb7bc60f64cd6a7eede37f53352e92a083155763 100644 (file)
@@ -54,7 +54,7 @@ struct PeerContext
   struct GNUNET_MessageHeader *hello;
   int connect_status;
 #if START_ARM
-  GNUNET_OS_Process *arm_proc;
+  struct GNUNET_OS_Process *arm_proc;
 #endif
 };
 
index 0b3be2f823cecf8cb534b99cfdf2937caeba404e..49fe8f9de3d26dfc2a34a9aaf360d4598276feba 100644 (file)
@@ -74,7 +74,7 @@ struct PeerContext
   struct GNUNET_MessageHeader *hello;
   int connect_status;
 #if START_ARM
-  GNUNET_OS_Process *arm_proc;
+  struct GNUNET_OS_Process *arm_proc;
 #endif
 };
 
index e82f12ed38fd5c04f37d4ced9796a8e6642d0e05..958defbf978548c53a33765ad34e60eddb4e1170 100644 (file)
@@ -49,7 +49,7 @@ struct PeerContext
   struct GNUNET_CORE_Handle *ch;
   struct GNUNET_PeerIdentity id;
 #if START_ARM
-  GNUNET_OS_Process *arm_proc;
+  struct GNUNET_OS_Process *arm_proc;
 #endif
 };
 
index 07bb16016f42fc2aae2ce92ebd0c9262faa18b16..8dd7e6680d1bb3cfb7015d89c8c5c9dfa3fec38d 100644 (file)
@@ -372,7 +372,7 @@ run (void *cls,
 static int
 check ()
 {
-  GNUNET_OS_Process *proc;
+  struct GNUNET_OS_Process *proc;
   char cfg_name[128];
   char *const argv[] = { 
     "perf-datastore-api",
index feba0b7ac94ab6c79ff01b05775f0043812cf1c0..3b7202005168dec4ba44749a82b24653c7681d60 100644 (file)
@@ -641,7 +641,7 @@ check ()
 {
   char cfg_name[128];
 #if START_DATASTORE
-  GNUNET_OS_Process *proc;
+  struct GNUNET_OS_Process *proc;
 #endif
   char *const argv[] = {
     "test-datastore-api",
index fbb8795a6070d5e0c9f6adc84040977738222cd6..81450d12ad092a4eacdf2faa689d58ab3782df90 100644 (file)
@@ -350,7 +350,7 @@ run (void *cls,
 static int
 check ()
 {
-  GNUNET_OS_Process *proc;
+  struct GNUNET_OS_Process *proc;
   char cfg_name[128];
   char *const argv[] = { 
     "test-datastore-api-management",
index 5ef70407c9454d785f88563287da796a8fb6fb1b..5eeb44d1393365515876cc0c799a7266f0df1a9d 100644 (file)
@@ -85,7 +85,7 @@ struct PeerContext
   struct GNUNET_DHT_FindPeerHandle *find_peer_handle;
 
 #if START_ARM
-  GNUNET_OS_Process *arm_proc;
+  struct GNUNET_OS_Process *arm_proc;
 #endif
 };
 
index a97faf94fb1d2a2900c4b4dba8f26aeedaa7428a..41a155407083b64a7044aae74f0e377a20dd1026 100644 (file)
@@ -104,7 +104,7 @@ int
 main (int argc, char *argv[])
 {
 #if START_DAEMON
-  GNUNET_OS_Process *daemon;
+  struct GNUNET_OS_Process *daemon;
 #endif
   int ok;
   struct GNUNET_ECRS_URI *uri;
index 305dee07e71eba18221066dcfeadddaa3f564d72..4bcedcb4d5ab4f91fdf5b009ce902273a80b3d68 100644 (file)
@@ -52,7 +52,7 @@ struct PeerContext
 {
   struct GNUNET_CONFIGURATION_Handle *cfg;
 #if START_ARM
-  GNUNET_OS_Process *arm_proc;
+  struct GNUNET_OS_Process *arm_proc;
 #endif
 };
 
index b55f2221b6cb95bda8cb91ea849d1a4431b46cbd..21d95d584576bb48d6d9ceaafe99bafa95f7e137 100644 (file)
@@ -52,7 +52,7 @@ struct PeerContext
 {
   struct GNUNET_CONFIGURATION_Handle *cfg;
 #if START_ARM
-  GNUNET_OS_Process *arm_proc;
+  struct GNUNET_OS_Process *arm_proc;
 #endif
 };
 
index 6bb4ab865ca6243b373d78e534c196e1d8afde41..966d524127c6cdb04aee2188bb5509a5a5758036 100644 (file)
@@ -52,7 +52,7 @@ struct PeerContext
 {
   struct GNUNET_CONFIGURATION_Handle *cfg;
 #if START_ARM
-  GNUNET_OS_Process *arm_proc;
+  struct GNUNET_OS_Process *arm_proc;
 #endif
 };
 
index a60a2da9aaab7cbed79329c182562f6c7415880c..ee320640c6ba574ddc65e30a9c42c5a0b30e52a8 100644 (file)
@@ -256,7 +256,7 @@ int
 main (int argc, char *argv[])
 {
 #if START_DAEMON
-  GNUNET_OS_Process *daemon;
+  struct GNUNET_OS_Process *daemon;
 #endif
   int ok;
   char *fn = NULL;
index 1221ff6c4476f008da5cc84a49a2cad5c7406aea..0e46336df6320087d77756ba1ddad799b5a49a01 100644 (file)
@@ -56,7 +56,7 @@ struct PeerContext
 {
   struct GNUNET_CONFIGURATION_Handle *cfg;
 #if START_ARM
-  GNUNET_OS_Process *arm_proc;
+  struct GNUNET_OS_Process *arm_proc;
 #endif
 };
 
index efe44af0b550aa2b8c8b8b52ef7073ebd33f4b8b..b7641ab3bf325e1fa197c1935e3bc16ce3ac3253 100644 (file)
@@ -59,7 +59,7 @@ struct PeerContext
 {
   struct GNUNET_CONFIGURATION_Handle *cfg;
 #if START_ARM
-  GNUNET_OS_Process *arm_proc;
+  struct GNUNET_OS_Process *arm_proc;
 #endif
 };
 
index 1cf8653bbc72519b9fc1ef3b6075e59602f1ae62..2637b1665c9c613086332a698b78cdecd7b917b4 100644 (file)
@@ -55,7 +55,7 @@ struct PeerContext
 {
   struct GNUNET_CONFIGURATION_Handle *cfg;
 #if START_ARM
-  GNUNET_OS_Process *arm_proc;
+  struct GNUNET_OS_Process *arm_proc;
 #endif
 };
 
index 4e65e7590098a31b8455aff23205626f0af4ce67..b5472ca93a42cf8db401d54905a633228bcce745 100644 (file)
@@ -53,7 +53,7 @@ struct PeerContext
 {
   struct GNUNET_CONFIGURATION_Handle *cfg;
 #if START_ARM
-  GNUNET_OS_Process *arm_proc;
+  struct GNUNET_OS_Process *arm_proc;
 #endif
 };
 
index afbee2ec8c30d8c14e9dc811984b7d0a017501ae..b1260456bcf4af46397185527957144934711adb 100644 (file)
@@ -52,7 +52,7 @@ struct PeerContext
 {
   struct GNUNET_CONFIGURATION_Handle *cfg;
 #if START_ARM
-  GNUNET_OS_Process *arm_proc;
+  struct GNUNET_OS_Process *arm_proc;
 #endif
 };
 
index 5157306894f4ecd18eec5a9dc9ac13ac1df6ec61..1609cd8e3ec6483071a56ebfc287e43235e3b20a 100644 (file)
@@ -53,7 +53,7 @@ struct PeerContext
   struct GNUNET_CONFIGURATION_Handle *cfg;
   struct GNUNET_PeerIdentity id;   
 #if START_ARM
-  GNUNET_OS_Process *arm_proc;
+  struct GNUNET_OS_Process *arm_proc;
 #endif
 };
 
index c2af22de4fdf9054c7c46218a1a54bfe5f727df2..d755a95829d22190866c4f3c1dc4344838e301b4 100644 (file)
@@ -53,7 +53,7 @@ struct PeerContext
   struct GNUNET_CONFIGURATION_Handle *cfg;
   struct GNUNET_PeerIdentity id;   
 #if START_ARM
-  GNUNET_OS_Process *arm_proc;
+  struct GNUNET_OS_Process *arm_proc;
 #endif
 };
 
index 06a069a32882aa3515e93c08ce520ac342704354..06c37dfc25b0550c029216942e1ce3ea4c11b52f 100644 (file)
@@ -126,7 +126,7 @@ int
 main (int argc, char *argv[])
 {
 #if START_DAEMON
-  GNUNET_OS_Process *daemon;
+  struct GNUNET_OS_Process *daemon;
 #endif
   int ok;
   char *fn = NULL;
index 22fb64ae7aa342fc04af0ba0c95fcd6490492089..f64596061bf8ed4cdb8b37760517a2d55a6cfdc5 100644 (file)
@@ -41,7 +41,7 @@ struct PeerContext
 {
   struct GNUNET_CONFIGURATION_Handle *cfg;
 #if START_ARM
-  GNUNET_OS_Process *arm_proc;
+  struct GNUNET_OS_Process *arm_proc;
 #endif
 };
 
index 0afed8f063d6606ae410eb2301962321c04a530e..7adc4d229a8dec54a003de77932e470f84e5669a 100644 (file)
@@ -52,7 +52,7 @@ struct PeerContext
 {
   struct GNUNET_CONFIGURATION_Handle *cfg;
 #if START_ARM
-  GNUNET_OS_Process *arm_proc;
+  struct GNUNET_OS_Process *arm_proc;
 #endif
 };
 
index d33ecb5fc08b4d2756b5c1b8d371827ec68831b4..42f047b70c0d948c80e35a32dd49e6896410b344 100644 (file)
@@ -51,7 +51,7 @@ struct PeerContext
 {
   struct GNUNET_CONFIGURATION_Handle *cfg;
 #if START_ARM
-  GNUNET_OS_Process *arm_proc;
+  struct GNUNET_OS_Process *arm_proc;
 #endif
 };
 
index a13f58a65e33c1b03c65fc5e18947ab75ecccc5a..63ba53b69c20ffe23bc97cc08d1c94ceb03d6ea0 100644 (file)
@@ -49,7 +49,7 @@ struct PeerContext
   struct GNUNET_TRANSPORT_Handle *th;
   struct GNUNET_MessageHeader *hello;
 #if START_ARM
-  GNUNET_OS_Process *arm_proc;
+  struct GNUNET_OS_Process *arm_proc;
 #endif
 };
 
index b5e6ca0bfa85443e279574146fe2dd52fb53e062..aa4e6b9ab6ddbef2538c952bf24523403e2e52c1 100644 (file)
@@ -71,7 +71,7 @@ struct PeerContext
   struct GNUNET_CORE_Handle *core;
   struct GNUNET_STATISTICS_Handle *stats;
 #if START_ARM
-  GNUNET_OS_Process *arm_proc;
+  struct GNUNET_OS_Process *arm_proc;
 #endif
 };
 
index 2152b279c24b566f4295ddc408521fae541f2403..bb29e89df807fa418c083f7e8c3aed07146e1fc8 100644 (file)
@@ -47,7 +47,7 @@ extern "C"
 /**
  * Process information (OS-dependent)
  */
-typedef struct _GNUNET_OS_Process GNUNET_OS_Process;
+struct GNUNET_OS_Process;
 
 
 /**
@@ -175,15 +175,6 @@ void GNUNET_OS_network_interfaces_list (GNUNET_OS_NetworkInterfaceProcessor
 #define GNUNET_OS_get_hostname_max_length() 255
 #endif
 
-/**
- * Allocates new process structure
- *
- * Should be made internal?
- *
- * @return pointer to allocated structure
- */
-GNUNET_OS_Process *GNUNET_OS_process_alloc ();
-
 
 /**
  * Get process structure for current process
@@ -193,7 +184,7 @@ GNUNET_OS_Process *GNUNET_OS_process_alloc ();
  *
  * @return pointer to the process sturcutre for this process
  */
-GNUNET_OS_Process *GNUNET_OS_process_current ();
+struct GNUNET_OS_Process *GNUNET_OS_process_current (void);
 
 
 /**
@@ -203,56 +194,16 @@ GNUNET_OS_Process *GNUNET_OS_process_current ();
  * @param sig signal
  * @return 0 on success, -1 on error
  */
-int GNUNET_OS_process_kill (GNUNET_OS_Process *proc, int sig);
-
-/**
- * Get process ID
- *
- * Should be made internal?
- *
- * @param proc pointer to process structure
- * @return process ID
- */
-pid_t GNUNET_OS_process_get_pid (GNUNET_OS_Process *proc);
-
-/**
- * Set process ID
- *
- * Should be made internal?
- *
- * @param proc pointer to process structure
- * @param pid process ID
- */
-void GNUNET_OS_process_set_pid (GNUNET_OS_Process *proc, pid_t pid);
+int GNUNET_OS_process_kill (struct GNUNET_OS_Process *proc, int sig);
 
-#if WINDOWS
-/**
- * Get process handle
- *
- * Should be made internal?
- *
- * @param proc pointer to process structure
- * @return process handle
- */
-HANDLE GNUNET_OS_process_get_handle (GNUNET_OS_Process *proc);
-
-/**
- * Set process handle
- *
- * Should be made internal?
- *
- * @param proc pointer to process structure
- * @param handle process handle
- */
-void GNUNET_OS_process_set_handle(GNUNET_OS_Process *proc, HANDLE handle);
-#endif
 
 /**
  * Cleans up process structure contents (OS-dependent) and deallocates it
  *
  * @param proc pointer to process structure
  */
-void GNUNET_OS_process_close (GNUNET_OS_Process *proc);
+void GNUNET_OS_process_close (struct GNUNET_OS_Process *proc);
+
 
 /**
  * Set process priority
@@ -261,7 +212,7 @@ void GNUNET_OS_process_close (GNUNET_OS_Process *proc);
  * @param prio priority value
  * @return GNUNET_OK on success, GNUNET_SYSERR on error
  */
-int GNUNET_OS_set_process_priority (GNUNET_OS_Process *proc,
+int GNUNET_OS_set_process_priority (struct GNUNET_OS_Process *proc,
                                     enum GNUNET_SCHEDULER_Priority prio);
 
 
@@ -274,7 +225,7 @@ int GNUNET_OS_set_process_priority (GNUNET_OS_Process *proc,
  * @param ... NULL-terminated list of arguments to the process
  * @return pointer to process structure of the new process, NULL on error
  */
-GNUNET_OS_Process *
+struct GNUNET_OS_Process *
 GNUNET_OS_start_process (struct GNUNET_DISK_PipeHandle *pipe_stdin, 
                         struct GNUNET_DISK_PipeHandle *pipe_stdout, 
                         const char *filename, ...);
@@ -290,7 +241,7 @@ GNUNET_OS_start_process (struct GNUNET_DISK_PipeHandle *pipe_stdin,
  *             including the process name as the first argument
  * @return pointer to process structure of the new process, NULL on error
  */
-GNUNET_OS_Process *
+struct GNUNET_OS_Process *
 GNUNET_OS_start_process_v (const int *lsocks, const char *filename,
                           char *const argv[]);
 
@@ -302,8 +253,8 @@ GNUNET_OS_start_process_v (const int *lsocks, const char *filename,
  * @param code return code/signal number
  * @return GNUNET_OK on success, GNUNET_NO if the process is still running, GNUNET_SYSERR otherwise
  */
-int GNUNET_OS_process_status (GNUNET_OS_Process *proc,
-    enum GNUNET_OS_ProcessStatusType *type, unsigned long *code);
+int GNUNET_OS_process_status (struct GNUNET_OS_Process *proc,
+                             enum GNUNET_OS_ProcessStatusType *type, unsigned long *code);
 
 
 /**
@@ -311,7 +262,7 @@ int GNUNET_OS_process_status (GNUNET_OS_Process *proc,
  * @param proc pointer to process structure of the process to wait for
  * @return GNUNET_OK on success, GNUNET_SYSERR otherwise
  */
-int GNUNET_OS_process_wait (GNUNET_OS_Process *proc);
+int GNUNET_OS_process_wait (struct GNUNET_OS_Process *proc);
 
 
 #if 0                           /* keep Emacsens' auto-indent happy */
index 3fee527b8a99699ac4c6fc8a6085e847746bce01..a00e5997654e17d0891282961ff43ca89983e879 100644 (file)
@@ -301,7 +301,7 @@ struct GNUNET_TESTING_Daemon
   /**
    * PID of the process that we started last.
    */
-  GNUNET_OS_Process *proc;
+  struct GNUNET_OS_Process *proc;
 
   /**
    * In which phase are we during the start of
index eea2eb97325b1f40975366379eb227815a658051..2c3d54109b00aea033e86d2854756dd3fb46357a 100755 (executable)
@@ -166,7 +166,7 @@ check ()
     NULL
   };
 #if START_SERVICE
-  GNUNET_OS_Process *proc;
+  struct GNUNET_OS_Process *proc;
   struct GNUNET_GETOPT_CommandLineOption options[] = {
     GNUNET_GETOPT_OPTION_END
   };
index b2e95d7679296acdd24793070d6d5543e7afdae6..eae448bbfef83752fa33d7ac9990f5b7daefc0b9 100644 (file)
@@ -165,7 +165,7 @@ static int
 check ()
 {
   int ok = 3;
-  GNUNET_OS_Process *proc;
+  struct GNUNET_OS_Process *proc;
   char *const argv[] = { "test-peerinfo-api",
     "-c",
     "test_peerinfo_api_data.conf",
index 6a45e3b102c33eecf9a9b879249eb13e77b6004c..cce90146c0e055c03b9a33b5049224ee6633c8ec 100644 (file)
@@ -157,7 +157,7 @@ check ()
     GNUNET_GETOPT_OPTION_END
   };
 #if START_SERVICE
-  GNUNET_OS_Process *proc;
+  struct GNUNET_OS_Process *proc;
   proc = GNUNET_OS_start_process (NULL, NULL, "gnunet-service-statistics",
                                  "gnunet-service-statistics",
 #if DEBUG_STATISTICS
index b4e7ae7ab29eaa4fc69de9d80bae36131c771931..7eaa9d27b7ec607b4e6e62ad003df26737a3c2e8 100644 (file)
@@ -96,7 +96,7 @@ check ()
     GNUNET_GETOPT_OPTION_END
   };
 #if START_SERVICE
-  GNUNET_OS_Process *proc;
+  struct GNUNET_OS_Process *proc;
   proc = GNUNET_OS_start_process (NULL, NULL, "gnunet-service-statistics",
                                  "gnunet-service-statistics",
 #if DEBUG_STATISTICS
index ed1f2d591dc41871c217552660df3e22a69b10e5..7ca58faf1af7297b99088e8850b7ff4472c7d948 100644 (file)
@@ -179,7 +179,7 @@ static void gather_log_data ()
 {
   char *peer_number;
   char *connect_number;
-  GNUNET_OS_Process *mem_process;
+  struct GNUNET_OS_Process *mem_process;
   GNUNET_asprintf(&peer_number, "%llu", num_peers);
   GNUNET_asprintf(&connect_number, "%llu", expected_connections);
   mem_process = GNUNET_OS_start_process (NULL, NULL, "./memsize.pl",
index 4b34a21de2158eb06223787755af8d44ec6e7000..7322fc44a65a0165cc104fffeefb8e5fb90396bb 100644 (file)
@@ -1937,7 +1937,7 @@ create_and_copy_friend_files (struct GNUNET_TESTING_PeerGroup *pg)
   FILE *temp_friend_handle;
   unsigned int pg_iter;
   char *temp_service_path;
-  GNUNET_OS_Process **procarr;
+  struct GNUNET_OS_Process **procarr;
   char *arg;
   char * mytemp;
   enum GNUNET_OS_ProcessStatusType type;
@@ -1946,7 +1946,7 @@ create_and_copy_friend_files (struct GNUNET_TESTING_PeerGroup *pg)
   int ret;
   int max_wait = 10;
 
-  procarr = GNUNET_malloc(sizeof(GNUNET_OS_Process *) * pg->total);
+  procarr = GNUNET_malloc(sizeof(struct GNUNET_OS_Process *) * pg->total);
   for (pg_iter = 0; pg_iter < pg->total; pg_iter++)
     {
       mytemp = GNUNET_DISK_mktemp("friends");
@@ -2064,7 +2064,7 @@ create_and_copy_blacklist_files (struct GNUNET_TESTING_PeerGroup *pg, const char
   static struct BlacklistContext blacklist_ctx;
   unsigned int pg_iter;
   char *temp_service_path;
-  GNUNET_OS_Process **procarr;
+  struct GNUNET_OS_Process **procarr;
   char *arg;
   char *mytemp;
   enum GNUNET_OS_ProcessStatusType type;
@@ -2077,7 +2077,7 @@ create_and_copy_blacklist_files (struct GNUNET_TESTING_PeerGroup *pg, const char
   char *pos;
   char *temp_transports;
 
-  procarr = GNUNET_malloc(sizeof(GNUNET_OS_Process *) * pg->total);
+  procarr = GNUNET_malloc(sizeof(struct GNUNET_OS_Process *) * pg->total);
   for (pg_iter = 0; pg_iter < pg->total; pg_iter++)
     {
       mytemp = GNUNET_DISK_mktemp("blacklist");
index d3978790020330a6b6c753b302f98bbc46b85604..1073b24b71558a0f65242963fd7821ace9e44156 100644 (file)
@@ -345,7 +345,7 @@ struct Plugin
   /**
    * The process id of the server process (if behind NAT)
    */
-  GNUNET_OS_Process *server_proc;
+  struct GNUNET_OS_Process *server_proc;
 
   /**
    * List of open TCP sessions.
@@ -958,7 +958,7 @@ run_gnunet_nat_client (struct Plugin *plugin, const char *addr, size_t addrlen)
   char inet4[INET_ADDRSTRLEN];
   char *address_as_string;
   char *port_as_string;
-  GNUNET_OS_Process *proc;
+  struct GNUNET_OS_Process *proc;
   const struct sockaddr *sa = (const struct sockaddr *)addr;
 
 #if DEBUG_TCP_NAT
index 0f53719fe11dfa07a9bb2dd2c9629bd017c5bf0d..4bd8c36d329dca135203a80ad5f58425973f4c64 100644 (file)
@@ -471,7 +471,7 @@ struct Plugin
   /**
    * The process id of the server process (if behind NAT)
    */
-  GNUNET_OS_Process *server_proc;
+  struct GNUNET_OS_Process *server_proc;
 
 };
 
@@ -702,7 +702,7 @@ run_gnunet_nat_client (struct Plugin *plugin, const char *addr, size_t addrlen)
   char addr_buf[INET_ADDRSTRLEN];
   char *address_as_string;
   char *port_as_string;
-  GNUNET_OS_Process *proc;
+  struct GNUNET_OS_Process *proc;
   const struct IPv4UdpAddress *t4;
 
   GNUNET_assert(addrlen == sizeof(struct IPv4UdpAddress));
index e53e4f3b4ef80aa580fce3c64afcd2184de62ea6..0f95f48c772610cf9734c4f4d17fb6408698d38e 100644 (file)
@@ -135,7 +135,7 @@ struct Plugin
   /**
    * The process id of the server process (if behind NAT)
    */
-  GNUNET_OS_Process *server_proc;
+  struct GNUNET_OS_Process *server_proc;
 
   /**
    * The interface of the wlan card given to us by the user.
index 39319f8d74e0952c293104750dc2972854066514..77279897d3109e73b4a8a8b41fb65fa8657a4492 100644 (file)
@@ -65,7 +65,7 @@ struct PeerContext
   struct GNUNET_TRANSPORT_Handle *th;
   struct GNUNET_PeerIdentity id;
 #if START_ARM
-  GNUNET_OS_Process *arm_proc;
+  struct GNUNET_OS_Process *arm_proc;
 #endif
 };
 
index 7a45ea0f09cb6efec85222c0e98bca4595384619..cee1da25b19df4fb83c0ac02e2f8562a60d19168 100644 (file)
@@ -60,7 +60,7 @@ struct PeerContext
   struct GNUNET_TRANSPORT_Handle *th;
   struct GNUNET_PeerIdentity id;
 #if START_ARM
-  GNUNET_OS_Process *arm_proc;
+  struct GNUNET_OS_Process *arm_proc;
 #endif
 };
 
index d9e88fe4910b6ee32fe8dac6d4e3da851f770bef..a8633e08982c19fc290b3d78162fc47bcde81af7 100644 (file)
@@ -62,7 +62,7 @@ struct PeerContext
   struct GNUNET_TRANSPORT_Handle *th;
   struct GNUNET_PeerIdentity id;
 #if START_ARM
-  GNUNET_OS_Process *arm_proc;
+  struct GNUNET_OS_Process *arm_proc;
 #endif
 };
 
index 75435a5e674c529e71dc72c9c6569ef587b2358b..6228174927a8f8eafba036e5014c7191ef70bc16 100644 (file)
@@ -188,7 +188,7 @@ GNUNET_CRYPTO_random_disable_entropy_gathering ()
  * Process ID of the "find" process that we use for
  * entropy gathering.
  */
-static GNUNET_OS_Process *genproc;
+static struct GNUNET_OS_Process *genproc;
 
 /**
  * Function called by libgcrypt whenever we are
index b9e5f010b585a9e4f6ed53f703bac708dd06fd0c..5f78e21798fe145a1edbd433502384af8fb479cf 100644 (file)
@@ -29,7 +29,7 @@
 #include "gnunet_os_lib.h"
 #include "disk.h"
 
-struct _GNUNET_OS_Process
+struct GNUNET_OS_Process
 {
   pid_t pid;
 #if WINDOWS
@@ -37,18 +37,19 @@ struct _GNUNET_OS_Process
 #endif
 };
 
-static GNUNET_OS_Process current_process;
+static struct GNUNET_OS_Process current_process;
+
 
-GNUNET_OS_Process *
-GNUNET_OS_process_alloc ()
-{
-  GNUNET_OS_Process *ret = GNUNET_malloc (sizeof (GNUNET_OS_Process));
-  ret->pid = 0;
 #if WINDOWS
-  ret->handle = NULL;
-#endif
-  return ret;
+void
+GNUNET_OS_process_set_handle(struct GNUNET_OS_Process *proc, HANDLE handle)
+{
+  if (proc->handle != NULL)
+    CloseHandle (proc->handle);
+  proc->handle = handle;
 }
+#endif
+
 
 /**
  * Get process structure for current process
@@ -58,7 +59,7 @@ GNUNET_OS_process_alloc ()
  *
  * @return pointer to the process sturcutre for this process
  */
-GNUNET_OS_Process *
+struct GNUNET_OS_Process *
 GNUNET_OS_process_current ()
 {
 #if WINDOWS
@@ -71,7 +72,7 @@ GNUNET_OS_process_current ()
 }
 
 int
-GNUNET_OS_process_kill (GNUNET_OS_Process *proc, int sig)
+GNUNET_OS_process_kill (struct GNUNET_OS_Process *proc, int sig)
 {
 #if WINDOWS
   if (sig == SIGKILL || sig == SIGTERM)
@@ -79,7 +80,10 @@ GNUNET_OS_process_kill (GNUNET_OS_Process *proc, int sig)
     HANDLE h = GNUNET_OS_process_get_handle (proc);
     if (NULL == h)
     {
-      GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Invalid process information {%d, %08X}\n", GNUNET_OS_process_get_pid (proc), h);
+      GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+                 _("Invalid process information {%d, %08X}\n"),
+                 proc->pid,
+                 h);
       return -1;
     }
     if (!TerminateProcess (h, 0))
@@ -93,40 +97,13 @@ GNUNET_OS_process_kill (GNUNET_OS_Process *proc, int sig)
   errno = EINVAL;
   return -1;
 #else
-  return kill (GNUNET_OS_process_get_pid (proc), sig);
+  return kill (proc->pid, sig);
 #endif
 }
 
-pid_t
-GNUNET_OS_process_get_pid (GNUNET_OS_Process *proc)
-{
-  return proc->pid;
-}
-
-void
-GNUNET_OS_process_set_pid (GNUNET_OS_Process *proc, pid_t pid)
-{
-  proc->pid = pid;
-}
-
-#if WINDOWS
-HANDLE
-GNUNET_OS_process_get_handle (GNUNET_OS_Process *proc)
-{
-  return proc->handle;
-}
-
-void
-GNUNET_OS_process_set_handle(GNUNET_OS_Process *proc, HANDLE handle)
-{
-  if (proc->handle != NULL)
-    CloseHandle (proc->handle);
-  proc->handle = handle;
-}
-#endif
 
 void
-GNUNET_OS_process_close (GNUNET_OS_Process *proc)
+GNUNET_OS_process_close (struct GNUNET_OS_Process *proc)
 {
 #if WINDOWS
   if (proc->handle != NULL)
@@ -147,7 +124,7 @@ extern GNUNET_SIGNAL_Handler w32_sigchld_handler;
 static DWORD WINAPI
 ChildWaitThread (void *arg)
 {
-  GNUNET_OS_Process *proc = (GNUNET_OS_Process *) arg;
+  struct GNUNET_OS_Process *proc = (struct GNUNET_OS_Process *) arg;
   WaitForSingleObject (proc->handle, INFINITE);
 
   if (w32_sigchld_handler)
@@ -165,11 +142,10 @@ ChildWaitThread (void *arg)
  * @return GNUNET_OK on success, GNUNET_SYSERR on error
  */
 int
-GNUNET_OS_set_process_priority (GNUNET_OS_Process *proc,
+GNUNET_OS_set_process_priority (struct GNUNET_OS_Process *proc,
                                 enum GNUNET_SCHEDULER_Priority prio)
 {
   int rprio;
-  pid_t pid;
 
   GNUNET_assert (prio < GNUNET_SCHEDULER_PRIORITY_COUNT);
   if (prio == GNUNET_SCHEDULER_PRIORITY_KEEP)
@@ -223,16 +199,17 @@ GNUNET_OS_set_process_priority (GNUNET_OS_Process *proc,
       return GNUNET_SYSERR;
     }
 
-  pid = GNUNET_OS_process_get_pid (proc);
-
   /* Set process priority */
 #ifdef MINGW
   {
-    HANDLE h = GNUNET_OS_process_get_handle (proc);
+    HANDLE h = proc->handle;
     GNUNET_assert (h != NULL);
     SetPriorityClass (h, rprio);
   }
 #elif LINUX 
+  pid_t pid;
+
+  pid = proc->pid;
   if ( (0 == pid) ||
        (pid == getpid () ) )
     {
@@ -251,7 +228,6 @@ GNUNET_OS_set_process_priority (GNUNET_OS_Process *proc,
   else
     {
       if (0 != setpriority (PRIO_PROCESS, pid, rprio))
-
         {
           GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING |
                                GNUNET_ERROR_TYPE_BULK, "setpriority");
@@ -274,7 +250,7 @@ GNUNET_OS_set_process_priority (GNUNET_OS_Process *proc,
  * @param ... NULL-terminated list of arguments to the process
  * @return pointer to process structure of the new process, NULL on error
  */
-GNUNET_OS_Process *
+struct GNUNET_OS_Process *
 GNUNET_OS_start_process (struct GNUNET_DISK_PipeHandle *pipe_stdin, 
                         struct GNUNET_DISK_PipeHandle *pipe_stdout,
                         const char *filename, ...)
@@ -283,7 +259,7 @@ GNUNET_OS_start_process (struct GNUNET_DISK_PipeHandle *pipe_stdin,
 
 #ifndef MINGW
   pid_t ret;
-  GNUNET_OS_Process *gnunet_proc = NULL;
+  struct GNUNET_OS_Process *gnunet_proc = NULL;
   char **argv;
   int argc;
   int fd_stdout_write;
@@ -342,8 +318,8 @@ GNUNET_OS_start_process (struct GNUNET_DISK_PipeHandle *pipe_stdin,
             GNUNET_DISK_pipe_close_end(pipe_stdin, GNUNET_DISK_PIPE_END_READ);
           sleep (1);
 #endif
-          gnunet_proc = GNUNET_OS_process_alloc ();
-          GNUNET_OS_process_set_pid (gnunet_proc, ret);
+          gnunet_proc = GNUNET_malloc (sizeof (struct GNUNET_OS_Process));
+          gnunet_proc->pid = ret;
         }
       GNUNET_free (argv);
       return gnunet_proc;
@@ -375,7 +351,7 @@ GNUNET_OS_start_process (struct GNUNET_DISK_PipeHandle *pipe_stdin,
   int findresult;
   STARTUPINFO start;
   PROCESS_INFORMATION proc;
-  GNUNET_OS_Process *gnunet_proc = NULL;
+  struct GNUNET_OS_Process *gnunet_proc = NULL;
 
   HANDLE stdin_handle;
   HANDLE stdout_handle;
@@ -429,9 +405,9 @@ GNUNET_OS_start_process (struct GNUNET_DISK_PipeHandle *pipe_stdin,
       return NULL;
     }
 
-  gnunet_proc = GNUNET_OS_process_alloc ();
-  GNUNET_OS_process_set_pid (gnunet_proc, proc.dwProcessId);
-  GNUNET_OS_process_set_handle (gnunet_proc, proc.hProcess);
+  gnunet_proc = GNUNET_malloc (sizeof (struct GNUNET_OS_Process));
+  gnunet_proc->pid = proc.dwProcessId;
+  gnunet_proc->handle = proc.hProcess;
 
   CreateThread (NULL, 64000, ChildWaitThread, (void *) gnunet_proc, 0, NULL);
 
@@ -455,7 +431,7 @@ GNUNET_OS_start_process (struct GNUNET_DISK_PipeHandle *pipe_stdin,
  * @param argv NULL-terminated list of arguments to the process
  * @return process ID of the new process, -1 on error
  */
-GNUNET_OS_Process *
+struct GNUNET_OS_Process *
 GNUNET_OS_start_process_v (const int *lsocks,
                           const char *filename, char *const argv[])
 {
@@ -463,7 +439,7 @@ GNUNET_OS_start_process_v (const int *lsocks,
   pid_t ret;
   char lpid[16];
   char fds[16];
-  GNUNET_OS_Process *gnunet_proc = NULL;
+  struct GNUNET_OS_Process *gnunet_proc = NULL;
   int i;
   int j;
   int k;
@@ -505,8 +481,8 @@ GNUNET_OS_start_process_v (const int *lsocks,
              be plenty in practice */
           sleep (1);
 #endif
-          gnunet_proc = GNUNET_OS_process_alloc ();
-          GNUNET_OS_process_set_pid (gnunet_proc, ret);
+          gnunet_proc = GNUNET_malloc (sizeof (struct GNUNET_OS_Process));
+          gnunet_proc->pid = ret;
         }
       GNUNET_array_grow (lscp, ls, 0);
       return gnunet_proc;
@@ -566,7 +542,7 @@ GNUNET_OS_start_process_v (const int *lsocks,
   int argcount = 0;
   char *non_const_filename = NULL;
   int filenamelen = 0;
-  GNUNET_OS_Process *gnunet_proc = NULL;
+  struct GNUNET_OS_Process *gnunet_proc = NULL;
 
   GNUNET_assert (lsocks == NULL);
   /* Count the number of arguments */
@@ -634,9 +610,9 @@ GNUNET_OS_start_process_v (const int *lsocks,
       return NULL;
     }
 
-  gnunet_proc = GNUNET_OS_process_alloc ();
-  GNUNET_OS_process_set_pid (gnunet_proc, proc.dwProcessId);
-  GNUNET_OS_process_set_handle (gnunet_proc, proc.hProcess);
+  gnunet_proc = GNUNET_malloc (sizeof (struct GNUNET_OS_Process));
+  gnunet_proc->pid = proc.dwProcessId;
+  gnunet_proc->handle = proc.hProcess;
 
   CreateThread (NULL, 64000, ChildWaitThread, (void *) gnunet_proc, 0, NULL);
 
@@ -659,7 +635,8 @@ GNUNET_OS_start_process_v (const int *lsocks,
  * @return GNUNET_OK on success, GNUNET_NO if the process is still running, GNUNET_SYSERR otherwise
  */
 int
-GNUNET_OS_process_status (GNUNET_OS_Process *proc, enum GNUNET_OS_ProcessStatusType *type,
+GNUNET_OS_process_status (struct GNUNET_OS_Process *proc, 
+                         enum GNUNET_OS_ProcessStatusType *type,
                           unsigned long *code)
 {
 #ifndef MINGW
@@ -667,7 +644,7 @@ GNUNET_OS_process_status (GNUNET_OS_Process *proc, enum GNUNET_OS_ProcessStatusT
   int ret;
 
   GNUNET_assert (0 != proc);
-  ret = waitpid (GNUNET_OS_process_get_pid (proc), &status, WNOHANG);
+  ret = waitpid (proc->pid, &status, WNOHANG);
   if (ret < 0)
     {
       GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "waitpid");
@@ -679,7 +656,7 @@ GNUNET_OS_process_status (GNUNET_OS_Process *proc, enum GNUNET_OS_ProcessStatusT
       *code = 0;
       return GNUNET_NO;
     }
-  if (GNUNET_OS_process_get_pid (proc) != ret)
+  if (proc->pid != ret)
     {
       GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "waitpid");
       return GNUNET_SYSERR;
@@ -716,7 +693,7 @@ GNUNET_OS_process_status (GNUNET_OS_Process *proc, enum GNUNET_OS_ProcessStatusT
   DWORD c, error_code, ret;
 
   h = GNUNET_OS_process_get_handle (proc);
-  ret = GNUNET_OS_process_get_pid (proc);
+  ret = proc->pid;
   if (h == NULL || ret == 0)
     {
       GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Invalid process information {%d, %08X}\n", ret, h);
@@ -753,22 +730,25 @@ GNUNET_OS_process_status (GNUNET_OS_Process *proc, enum GNUNET_OS_ProcessStatusT
  * @return GNUNET_OK on success, GNUNET_SYSERR otherwise
  */
 int
-GNUNET_OS_process_wait (GNUNET_OS_Process *proc)
+GNUNET_OS_process_wait (struct GNUNET_OS_Process *proc)
 {
-  pid_t pid = GNUNET_OS_process_get_pid (proc);
+
 #ifndef MINGW
+  pid_t pid = proc->pid;
   if (pid != waitpid (pid, NULL, 0))
     return GNUNET_SYSERR;
-
   return GNUNET_OK;
 #else
   HANDLE h;
   int ret;
 
-  h = GNUNET_OS_process_get_handle (proc);
+  h = proc->handle;
   if (NULL == h)
     {
-      GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Invalid process information {%d, %08X}\n", pid, h);
+      GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 
+                 "Invalid process information {%d, %08X}\n", 
+                 proc->pid, 
+                 h);
       return GNUNET_SYSERR;
     }
   if (h == NULL)
index bd2eb2b0974e7a5681e6faa02112a3bed70b3847..bce1c71516ca614a48d739de9d31f08c30085d26 100644 (file)
@@ -38,7 +38,7 @@
 static char *test_phrase = "HELLO WORLD";
 static int ok;
 
-static GNUNET_OS_Process *proc;
+static struct GNUNET_OS_Process *proc;
 /* Pipe to write to started processes stdin (on write end) */
 static struct GNUNET_DISK_PipeHandle *hello_pipe_stdin;
 /* Pipe to read from started processes stdout (on read end) */
index 7321ed587b83777d4adfda7aac4b8990299c5a61..734420e84ec06a3033b09dedd75f33195abd31b3 100644 (file)
@@ -360,7 +360,7 @@ check()
   int ok = 1 + 2 + 4 + 8;
   char *fn;
   char *pfx;
-  GNUNET_OS_Process *proc;
+  struct GNUNET_OS_Process *proc;
   char * const argv[] =
     { "test-resolver-api", "-c", "test_resolver_api_data.conf",
 #if VERBOSE
index a6f78d70723ea52e3f8cf9517638772175f911f9..7edd3c52f3fc5b62f9a5648f7460e74706b334cc 100644 (file)
@@ -94,7 +94,7 @@ static unsigned char restart_hijack;
 /**
  * The process id of the helper
  */
-static GNUNET_OS_Process *helper_proc;
+static struct GNUNET_OS_Process *helper_proc;
 
 /**
  * a list of outgoing dns-query-packets