GNUnet  0.10.x
Macros | Functions | Variables
gnunet_testbed_mpi_spawn.c File Reference
#include "platform.h"
#include "gnunet_util_lib.h"
#include "gnunet_testbed_service.h"
Include dependency graph for gnunet_testbed_mpi_spawn.c:

Go to the source code of this file.

Macros

#define LOG(kind, ...)   GNUNET_log (kind, __VA_ARGS__)
 Generic logging shorthand. More...
 
#define LOG_DEBUG(...)   LOG (GNUNET_ERROR_TYPE_DEBUG, __VA_ARGS__)
 Debug logging shorthand. More...
 

Functions

static void shutdown_task (void *cls)
 The shutdown task. More...
 
static void terminate_task (void *cls)
 
static void child_death_task (void *cls)
 Task triggered whenever we receive a SIGCHLD (child process died). More...
 
static void destroy_hosts (struct GNUNET_TESTBED_Host **hosts, unsigned int nhosts)
 
static void run (void *cls)
 The main scheduler run task. More...
 
static void sighandler_child_death ()
 Signal handler called for SIGCHLD. More...
 
int main (int argc, char *argv[])
 Execution start point. More...
 

Variables

static int ret
 Global result. More...
 
static struct GNUNET_OS_Processchild
 The child process we spawn. More...
 
static char ** argv2
 The arguments including the binary to spawn. More...
 
static struct GNUNET_DISK_PipeHandlesigpipe
 Pipe used to communicate shutdown via signal. More...
 
static char * fn
 Filename of the unique file. More...
 
static int fh
 Handle to the unique file. More...
 
static unsigned long child_exit_code
 The return code of the binary. More...
 
static enum GNUNET_OS_ProcessStatusType child_status
 The process status of the child. More...
 
static struct GNUNET_SCHEDULER_Taskterminate_task_id
 Task to kill the child. More...
 
static struct GNUNET_SCHEDULER_Taskchild_death_task_id
 Task to kill the child. More...
 

Macro Definition Documentation

◆ LOG

#define LOG (   kind,
  ... 
)    GNUNET_log (kind, __VA_ARGS__)

Generic logging shorthand.

Definition at line 9 of file gnunet_testbed_mpi_spawn.c.

Referenced by main(), run(), shutdown_task(), and terminate_task().

◆ LOG_DEBUG

#define LOG_DEBUG (   ...)    LOG (GNUNET_ERROR_TYPE_DEBUG, __VA_ARGS__)

Debug logging shorthand.

Definition at line 15 of file gnunet_testbed_mpi_spawn.c.

Referenced by child_death_task(), and run().

Function Documentation

◆ shutdown_task()

static void shutdown_task ( void *  cls)
static

The shutdown task.

Definition at line 72 of file gnunet_testbed_mpi_spawn.c.

References child_exit_code, fh, fn, GNUNET_ERROR_TYPE_ERROR, GNUNET_ERROR_TYPE_WARNING, GNUNET_log_strerror, GNUNET_SYSERR, LOG, and ret.

Referenced by child_death_task(), and run().

73 {
74  if (0 != child_exit_code)
75  {
76  LOG (GNUNET_ERROR_TYPE_WARNING, "Child exited with error code: %lu\n",
78  ret = 128 + (int) child_exit_code;
79  }
80  if (0 != fh)
81  {
82  close (fh);
83  }
84  if ((NULL != fn) && (0 != unlink (fn)))
85  {
88  }
89 }
static unsigned long child_exit_code
The return code of the binary.
#define GNUNET_log_strerror(level, cmd)
Log an error message at log-level 'level' that indicates a failure of the command 'cmd' with the mess...
static char * fn
Filename of the unique file.
static int fh
Handle to the unique file.
#define GNUNET_SYSERR
Definition: gnunet_common.h:79
static int ret
Global result.
#define LOG(kind,...)
Generic logging shorthand.
Here is the caller graph for this function:

◆ terminate_task()

static void terminate_task ( void *  cls)
static

Definition at line 93 of file gnunet_testbed_mpi_spawn.c.

References _, GNUNET_assert, GNUNET_break, GNUNET_ERROR_TYPE_INFO, GNUNET_ERROR_TYPE_WARNING, GNUNET_OS_process_kill(), GNUNET_SCHEDULER_add_shutdown(), GNUNET_TERM_SIG, and LOG.

Referenced by run().

94 {
95  static int hard_kill;
96 
97  GNUNET_assert (NULL != child);
100  if (0 != hard_kill)
101  {
102  switch (hard_kill)
103  {
104  case 1:
105  case 2:
107  "%d more interrupts needed to send SIGKILL to the child\n",
108  3 - hard_kill);
109  hard_kill++;
110  return;
111  case 3:
112  GNUNET_break (0 == GNUNET_OS_process_kill (child, SIGKILL));
113  return;
114  }
115  }
116  hard_kill++;
118  LOG (GNUNET_ERROR_TYPE_INFO, _("Waiting for child to exit.\n"));
119 }
static void terminate_task(void *cls)
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_shutdown(GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run on shutdown, that is when a CTRL-C signal is received, or when GNUNET_SCHEDULER_shutdown() is being invoked.
Definition: scheduler.c:1293
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur...
#define _(String)
GNU gettext support macro.
Definition: platform.h:208
static struct GNUNET_SCHEDULER_Task * terminate_task_id
Task to kill the child.
static struct GNUNET_OS_Process * child
The child process we spawn.
#define LOG(kind,...)
Generic logging shorthand.
#define GNUNET_TERM_SIG
The termination signal.
Definition: platform.h:282
int GNUNET_OS_process_kill(struct GNUNET_OS_Process *proc, int sig)
Sends a signal to the process.
Definition: os_priority.c:251
Here is the call graph for this function:
Here is the caller graph for this function:

◆ child_death_task()

static void child_death_task ( void *  cls)
static

Task triggered whenever we receive a SIGCHLD (child process died).

Parameters
clsclosure, NULL if we need to self-restart

Definition at line 129 of file gnunet_testbed_mpi_spawn.c.

References child_exit_code, child_status, GNUNET_assert, GNUNET_break, GNUNET_DISK_file_read(), GNUNET_DISK_PIPE_END_READ, GNUNET_DISK_pipe_handle(), GNUNET_OK, GNUNET_OS_process_destroy(), GNUNET_OS_process_status(), GNUNET_SCHEDULER_add_now(), GNUNET_SCHEDULER_add_read_file(), GNUNET_SCHEDULER_cancel(), GNUNET_SCHEDULER_get_task_context(), GNUNET_SCHEDULER_REASON_READ_READY, GNUNET_TIME_UNIT_FOREVER_REL, LOG_DEBUG, GNUNET_SCHEDULER_TaskContext::reason, shutdown_task(), and tc.

Referenced by run().

130 {
131  const struct GNUNET_DISK_FileHandle *pr;
132  char c[16];
133  const struct GNUNET_SCHEDULER_TaskContext *tc;
134 
135 
137  child_death_task_id = NULL;
140  {
143  pr, &child_death_task, NULL);
144  return;
145  }
146  /* consume the signal */
147  GNUNET_break (0 < GNUNET_DISK_file_read (pr, &c, sizeof (c)));
148  LOG_DEBUG ("Child died\n");
150  terminate_task_id = NULL;
152  &child_exit_code));
154  child = NULL;
156 }
const struct GNUNET_SCHEDULER_TaskContext * GNUNET_SCHEDULER_get_task_context(void)
Obtain the reasoning why the current task was started.
Definition: scheduler.c:746
void GNUNET_OS_process_destroy(struct GNUNET_OS_Process *proc)
Cleans up process structure contents (OS-dependent) and deallocates it.
Definition: os_priority.c:364
ssize_t GNUNET_DISK_file_read(const struct GNUNET_DISK_FileHandle *h, void *result, size_t len)
Read the contents of a binary file into a buffer.
Definition: disk.c:881
int GNUNET_OS_process_status(struct GNUNET_OS_Process *proc, enum GNUNET_OS_ProcessStatusType *type, unsigned long *code)
Retrieve the status of a process, waiting on it if dead.
Definition: os_priority.c:1719
The reading socket is ready.
Context information passed to each scheduler task.
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
static struct GNUNET_SCHEDULER_TaskContext tc
Task context of the current task.
Definition: scheduler.c:417
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_read_file(struct GNUNET_TIME_Relative delay, const struct GNUNET_DISK_FileHandle *rfd, GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run with a specified delay or when the specified file descriptor is ready f...
Definition: scheduler.c:1643
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:78
enum GNUNET_SCHEDULER_Reason reason
Reason why the task is run now.
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur...
const struct GNUNET_DISK_FileHandle * GNUNET_DISK_pipe_handle(const struct GNUNET_DISK_PipeHandle *p, enum GNUNET_DISK_PipeEnd n)
Get the handle to a particular pipe end.
Definition: disk.c:2641
static unsigned long child_exit_code
The return code of the binary.
#define LOG_DEBUG(...)
Debug logging shorthand.
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_now(GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run as soon as possible.
Definition: scheduler.c:1273
static enum GNUNET_OS_ProcessStatusType child_status
The process status of the child.
#define GNUNET_TIME_UNIT_FOREVER_REL
Constant used to specify "forever".
The reading-end of a pipe.
static struct GNUNET_SCHEDULER_Task * terminate_task_id
Task to kill the child.
static struct GNUNET_DISK_PipeHandle * sigpipe
Pipe used to communicate shutdown via signal.
static struct GNUNET_SCHEDULER_Task * child_death_task_id
Task to kill the child.
static struct GNUNET_OS_Process * child
The child process we spawn.
static void shutdown_task(void *cls)
The shutdown task.
Handle used to access files (and pipes).
static void child_death_task(void *cls)
Task triggered whenever we receive a SIGCHLD (child process died).
void * GNUNET_SCHEDULER_cancel(struct GNUNET_SCHEDULER_Task *task)
Cancel the task with the specified identifier.
Definition: scheduler.c:965
Here is the call graph for this function:
Here is the caller graph for this function:

◆ destroy_hosts()

static void destroy_hosts ( struct GNUNET_TESTBED_Host **  hosts,
unsigned int  nhosts 
)
static

Definition at line 160 of file gnunet_testbed_mpi_spawn.c.

References GNUNET_assert, GNUNET_free, GNUNET_TESTBED_host_destroy(), and host.

Referenced by run().

161 {
162  unsigned int host;
163 
164  GNUNET_assert (NULL != hosts);
165  for (host = 0; host < nhosts; host++)
166  if (NULL != hosts[host])
167  GNUNET_TESTBED_host_destroy (hosts[host]);
168  GNUNET_free (hosts);
169  hosts = NULL;
170 }
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
void GNUNET_TESTBED_host_destroy(struct GNUNET_TESTBED_Host *host)
Destroy a host handle.
GUID host
#define GNUNET_free(ptr)
Wrapper around free.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ run()

static void run ( void *  cls)
static

The main scheduler run task.

Parameters
clsNULL

Definition at line 179 of file gnunet_testbed_mpi_spawn.c.

References _, argv2, child_death_task(), destroy_hosts(), fh, fn, getenv(), GNUNET_asprintf(), GNUNET_break, GNUNET_CONFIGURATION_create(), GNUNET_DISK_PIPE_END_READ, GNUNET_DISK_pipe_handle(), GNUNET_ERROR_TYPE_ERROR, GNUNET_ERROR_TYPE_INFO, GNUNET_free, GNUNET_log_strerror, GNUNET_malloc, GNUNET_NO, GNUNET_OK, GNUNET_OS_get_hostname_max_length, GNUNET_OS_INHERIT_STD_ALL, GNUNET_OS_start_process_vap(), GNUNET_SCHEDULER_add_now(), GNUNET_SCHEDULER_add_read_file(), GNUNET_SCHEDULER_add_shutdown(), GNUNET_SYSERR, GNUNET_TESTBED_host_get_hostname(), GNUNET_TESTBED_hosts_load_from_loadleveler(), GNUNET_TIME_UNIT_FOREVER_REL, hostname, LOG, LOG_DEBUG, ret, shutdown_task(), and terminate_task().

Referenced by main().

180 {
181  struct GNUNET_TESTBED_Host **hosts;
182  const struct GNUNET_CONFIGURATION_Handle *null_cfg;
183  char *tmpdir;
184  char *hostname;
185  size_t hostname_len;
186  unsigned int nhosts;
187 
188  null_cfg = GNUNET_CONFIGURATION_create ();
189  nhosts = GNUNET_TESTBED_hosts_load_from_loadleveler (null_cfg, &hosts);
190  if (0 == nhosts)
191  {
192  GNUNET_break (0);
193  ret = GNUNET_SYSERR;
194  return;
195  }
196  hostname_len = GNUNET_OS_get_hostname_max_length ();
197  hostname = GNUNET_malloc (hostname_len);
198  if (0 != gethostname (hostname, hostname_len))
199  {
200  LOG (GNUNET_ERROR_TYPE_ERROR, "Cannot get hostname. Exiting\n");
201  GNUNET_free (hostname);
202  destroy_hosts (hosts, nhosts);
203  ret = GNUNET_SYSERR;
204  return;
205  }
206  if (NULL == strstr (GNUNET_TESTBED_host_get_hostname (hosts[0]), hostname))
207  {
208  LOG_DEBUG ("Exiting as `%s' is not the lowest host\n", hostname);
209  GNUNET_free (hostname);
210  ret = GNUNET_OK;
211  return;
212  }
213  LOG_DEBUG ("Will be executing `%s' on host `%s'\n", argv2[0], hostname);
214  GNUNET_free (hostname);
215  destroy_hosts (hosts, nhosts);
216  tmpdir = getenv ("TMPDIR");
217  if (NULL == tmpdir)
218  tmpdir = getenv ("TMP");
219  if (NULL == tmpdir)
220  tmpdir = getenv ("TEMP");
221  if (NULL == tmpdir)
222  tmpdir = "/tmp";
223  (void) GNUNET_asprintf (&fn, "%s/gnunet-testbed-spawn.lock", tmpdir);
224  /* Open the unique file; we can create it then we can spawn the child process
225  else we exit */
226  fh = open (fn, O_CREAT | O_EXCL | O_CLOEXEC,
227  S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP);
228  if (-1 == fh)
229  {
230  if (EEXIST == errno)
231  {
232  LOG_DEBUG ("Lock file already created by other process. Exiting\n");
233  ret = GNUNET_OK;
234  return;
235  }
237  ret = GNUNET_SYSERR;
238  return;
239  }
240  /* Spawn the new process here */
241  LOG (GNUNET_ERROR_TYPE_INFO, _("Spawning process `%s'\n"), argv2[0]);
243  NULL, NULL,
244  argv2[0], argv2);
245  if (NULL == child)
246  {
247  GNUNET_break (0);
248  ret = GNUNET_SYSERR;
250  return;
251  }
252  ret = GNUNET_OK;
259  &child_death_task, NULL);
260 }
static void terminate_task(void *cls)
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_shutdown(GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run on shutdown, that is when a CTRL-C signal is received, or when GNUNET_SCHEDULER_shutdown() is being invoked.
Definition: scheduler.c:1293
#define GNUNET_NO
Definition: gnunet_common.h:81
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_read_file(struct GNUNET_TIME_Relative delay, const struct GNUNET_DISK_FileHandle *rfd, GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run with a specified delay or when the specified file descriptor is ready f...
Definition: scheduler.c:1643
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:78
struct GNUNET_CONFIGURATION_Handle * GNUNET_CONFIGURATION_create(void)
Create a new configuration object.
Opaque handle to a host running experiments managed by the testing framework.
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur...
const struct GNUNET_DISK_FileHandle * GNUNET_DISK_pipe_handle(const struct GNUNET_DISK_PipeHandle *p, enum GNUNET_DISK_PipeEnd n)
Get the handle to a particular pipe end.
Definition: disk.c:2641
static void destroy_hosts(struct GNUNET_TESTBED_Host **hosts, unsigned int nhosts)
#define _(String)
GNU gettext support macro.
Definition: platform.h:208
#define GNUNET_log_strerror(level, cmd)
Log an error message at log-level &#39;level&#39; that indicates a failure of the command &#39;cmd&#39; with the mess...
int GNUNET_asprintf(char **buf, const char *format,...)
Like asprintf, just portable.
Use this option to have all of the standard streams (stdin, stdout and stderror) be inherited...
#define LOG_DEBUG(...)
Debug logging shorthand.
#define GNUNET_OS_get_hostname_max_length()
Get maximum string length returned by gethostname()
static char * fn
Filename of the unique file.
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_now(GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run as soon as possible.
Definition: scheduler.c:1273
struct GNUNET_OS_Process * GNUNET_OS_start_process_vap(int pipe_control, enum GNUNET_OS_InheritStdioFlags std_inheritance, struct GNUNET_DISK_PipeHandle *pipe_stdin, struct GNUNET_DISK_PipeHandle *pipe_stdout, struct GNUNET_DISK_PipeHandle *pipe_stderr, const char *filename, char *const argv[])
Start a process.
Definition: os_priority.c:1321
#define GNUNET_TIME_UNIT_FOREVER_REL
Constant used to specify "forever".
The reading-end of a pipe.
static int fh
Handle to the unique file.
static char ** argv2
The arguments including the binary to spawn.
static struct GNUNET_SCHEDULER_Task * terminate_task_id
Task to kill the child.
static struct GNUNET_DISK_PipeHandle * sigpipe
Pipe used to communicate shutdown via signal.
#define GNUNET_SYSERR
Definition: gnunet_common.h:79
static int ret
Global result.
char * getenv()
static struct GNUNET_SCHEDULER_Task * child_death_task_id
Task to kill the child.
const char * GNUNET_TESTBED_host_get_hostname(const struct GNUNET_TESTBED_Host *host)
Obtain the host&#39;s hostname.
static char * hostname
Our hostname; we give this to all the peers we start.
static struct GNUNET_OS_Process * child
The child process we spawn.
static void shutdown_task(void *cls)
The shutdown task.
configuration data
Definition: configuration.c:85
unsigned int GNUNET_TESTBED_hosts_load_from_loadleveler(const struct GNUNET_CONFIGURATION_Handle *cfg, struct GNUNET_TESTBED_Host ***hosts)
Loads the set of host allocated by the LoadLeveler Job Scheduler.
#define LOG(kind,...)
Generic logging shorthand.
#define GNUNET_malloc(size)
Wrapper around malloc.
#define GNUNET_free(ptr)
Wrapper around free.
static void child_death_task(void *cls)
Task triggered whenever we receive a SIGCHLD (child process died).
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sighandler_child_death()

static void sighandler_child_death ( )
static

Signal handler called for SIGCHLD.

Definition at line 267 of file gnunet_testbed_mpi_spawn.c.

References GNUNET_break, GNUNET_DISK_file_write(), GNUNET_DISK_PIPE_END_WRITE, and GNUNET_DISK_pipe_handle().

Referenced by main().

268 {
269  static char c;
270  int old_errno = errno; /* back-up errno */
271 
272  GNUNET_break (1 ==
275  &c, sizeof (c)));
276  errno = old_errno; /* restore errno */
277 }
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur...
const struct GNUNET_DISK_FileHandle * GNUNET_DISK_pipe_handle(const struct GNUNET_DISK_PipeHandle *p, enum GNUNET_DISK_PipeEnd n)
Get the handle to a particular pipe end.
Definition: disk.c:2641
ssize_t GNUNET_DISK_file_write(const struct GNUNET_DISK_FileHandle *h, const void *buffer, size_t n)
Write a buffer to a file.
Definition: disk.c:1049
The writing-end of a pipe.
static struct GNUNET_DISK_PipeHandle * sigpipe
Pipe used to communicate shutdown via signal.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ main()

int main ( int  argc,
char *  argv[] 
)

Execution start point.

Definition at line 284 of file gnunet_testbed_mpi_spawn.c.

References argv2, fn, GNUNET_break, GNUNET_DISK_pipe(), GNUNET_DISK_pipe_close(), GNUNET_ERROR_TYPE_ERROR, GNUNET_free, GNUNET_free_non_null, GNUNET_log_setup(), GNUNET_malloc, GNUNET_NO, GNUNET_OK, GNUNET_SCHEDULER_run(), GNUNET_SIGCHLD, GNUNET_SIGNAL_handler_install(), GNUNET_SIGNAL_handler_uninstall(), GNUNET_SYSERR, LOG, ret, run(), and sighandler_child_death().

285 {
286  struct GNUNET_SIGNAL_Context *shc_chld;
287  unsigned int cnt;
288 
289  ret = -1;
290  if (argc < 2)
291  {
292  printf ("Need arguments: gnunet-testbed-mpi-spawn <cmd> <cmd_args>");
293  return 1;
294  }
295  if (GNUNET_OK != GNUNET_log_setup ("gnunet-testbed-spawn", NULL, NULL))
296  {
297  GNUNET_break (0);
298  return 1;
299  }
300  if (NULL == (sigpipe = GNUNET_DISK_pipe (GNUNET_NO, GNUNET_NO,
301  GNUNET_NO, GNUNET_NO)))
302  {
303  GNUNET_break (0);
304  ret = GNUNET_SYSERR;
305  return 1;
306  }
307  shc_chld =
309  if (NULL == shc_chld)
310  {
311  LOG (GNUNET_ERROR_TYPE_ERROR, "Cannot install a signal handler\n");
312  return 1;
313  }
314  argv2 = GNUNET_malloc (sizeof (char *) * argc);
315  for (cnt = 1; cnt < argc; cnt++)
316  argv2[cnt - 1] = argv[cnt];
317  GNUNET_SCHEDULER_run (run, NULL);
318  GNUNET_free (argv2);
320  shc_chld = NULL;
323  if (GNUNET_OK != ret)
324  return ret;
325  return 0;
326 }
#define GNUNET_SIGCHLD
Definition: platform.h:46
void GNUNET_SCHEDULER_run(GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Initialize and run scheduler.
Definition: scheduler.c:716
#define GNUNET_NO
Definition: gnunet_common.h:81
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:78
void GNUNET_SIGNAL_handler_uninstall(struct GNUNET_SIGNAL_Context *ctx)
Uninstall a previously installed signal hander.
Definition: signal.c:99
#define GNUNET_free_non_null(ptr)
Free the memory pointed to by ptr if ptr is not NULL.
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur...
static char * fn
Filename of the unique file.
static char ** argv2
The arguments including the binary to spawn.
struct GNUNET_DISK_PipeHandle * GNUNET_DISK_pipe(int blocking_read, int blocking_write, int inherit_read, int inherit_write)
Creates an interprocess channel.
Definition: disk.c:2289
static struct GNUNET_DISK_PipeHandle * sigpipe
Pipe used to communicate shutdown via signal.
struct GNUNET_SIGNAL_Context * GNUNET_SIGNAL_handler_install(int signal, GNUNET_SIGNAL_Handler handler)
Install a signal handler that will be run if the given signal is received.
Definition: signal.c:59
#define GNUNET_SYSERR
Definition: gnunet_common.h:79
static int ret
Global result.
int GNUNET_DISK_pipe_close(struct GNUNET_DISK_PipeHandle *p)
Closes an interprocess channel.
Definition: disk.c:2603
static void run(void *cls)
The main scheduler run task.
#define LOG(kind,...)
Generic logging shorthand.
int GNUNET_log_setup(const char *comp, const char *loglevel, const char *logfile)
Setup logging.
static void sighandler_child_death()
Signal handler called for SIGCHLD.
#define GNUNET_malloc(size)
Wrapper around malloc.
#define GNUNET_free(ptr)
Wrapper around free.
Here is the call graph for this function:

Variable Documentation

◆ ret

int ret
static

Global result.

Definition at line 21 of file gnunet_testbed_mpi_spawn.c.

Referenced by main(), run(), and shutdown_task().

◆ child

struct GNUNET_OS_Process* child
static

The child process we spawn.

Definition at line 26 of file gnunet_testbed_mpi_spawn.c.

Referenced by cleanup_delegation_set(), get_file_information(), and mark_as_reachable().

◆ argv2

char** argv2
static

The arguments including the binary to spawn.

Definition at line 31 of file gnunet_testbed_mpi_spawn.c.

Referenced by GNUNET_TESTBED_test_run(), main(), and run().

◆ sigpipe

struct GNUNET_DISK_PipeHandle* sigpipe
static

Pipe used to communicate shutdown via signal.

Definition at line 36 of file gnunet_testbed_mpi_spawn.c.

◆ fn

char* fn
static

◆ fh

int fh
static

◆ child_exit_code

unsigned long child_exit_code
static

The return code of the binary.

Definition at line 51 of file gnunet_testbed_mpi_spawn.c.

Referenced by child_death_task(), and shutdown_task().

◆ child_status

enum GNUNET_OS_ProcessStatusType child_status
static

The process status of the child.

Definition at line 56 of file gnunet_testbed_mpi_spawn.c.

Referenced by child_death_task().

◆ terminate_task_id

struct GNUNET_SCHEDULER_Task* terminate_task_id
static

Task to kill the child.

Definition at line 61 of file gnunet_testbed_mpi_spawn.c.

◆ child_death_task_id

struct GNUNET_SCHEDULER_Task* child_death_task_id
static

Task to kill the child.

Definition at line 66 of file gnunet_testbed_mpi_spawn.c.