aboutsummaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2011-07-08 08:04:11 +0000
committerChristian Grothoff <christian@grothoff.org>2011-07-08 08:04:11 +0000
commita523a55e37ee7652beb391f75e3bfad92419db79 (patch)
treeeec23bd20b9a75e4c3d56021a5f82eff7bde18a2 /src/include
parente3955d0f3a4a9410a2498ff85a765ca4ebc32d95 (diff)
downloadgnunet-a523a55e37ee7652beb391f75e3bfad92419db79.tar.gz
gnunet-a523a55e37ee7652beb391f75e3bfad92419db79.zip
additional process start fun
Diffstat (limited to 'src/include')
-rw-r--r--src/include/gnunet_os_lib.h64
1 files changed, 63 insertions, 1 deletions
diff --git a/src/include/gnunet_os_lib.h b/src/include/gnunet_os_lib.h
index 85d666892..36e7a563b 100644
--- a/src/include/gnunet_os_lib.h
+++ b/src/include/gnunet_os_lib.h
@@ -1,6 +1,6 @@
1/* 1/*
2 This file is part of GNUnet. 2 This file is part of GNUnet.
3 (C) 2001, 2002, 2003, 2004, 2005, 2006 Christian Grothoff (and other contributing authors) 3 (C) 2001, 2002, 2003, 2004, 2005, 2006, 2011 Christian Grothoff (and other contributing authors)
4 4
5 GNUnet is free software; you can redistribute it and/or modify 5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published 6 it under the terms of the GNU General Public License as published
@@ -243,6 +243,21 @@ GNUNET_OS_start_process (struct GNUNET_DISK_PipeHandle *pipe_stdin,
243/** 243/**
244 * Start a process. 244 * Start a process.
245 * 245 *
246 * @param pipe_stdin pipe to use to send input to child process (or NULL)
247 * @param pipe_stdout pipe to use to get output from child process (or NULL)
248 * @param filename name of the binary
249 * @param va NULL-terminated list of arguments to the process
250 * @return pointer to process structure of the new process, NULL on error
251 */
252struct GNUNET_OS_Process *
253GNUNET_OS_start_process_va (struct GNUNET_DISK_PipeHandle *pipe_stdin,
254 struct GNUNET_DISK_PipeHandle *pipe_stdout,
255 const char *filename,
256 va_list va);
257
258/**
259 * Start a process.
260 *
246 * @param lsocks array of listen sockets to dup systemd-style (or NULL); 261 * @param lsocks array of listen sockets to dup systemd-style (or NULL);
247 * must be NULL on platforms where dup is not supported 262 * must be NULL on platforms where dup is not supported
248 * @param filename name of the binary 263 * @param filename name of the binary
@@ -256,6 +271,53 @@ GNUNET_OS_start_process_v (const int *lsocks, const char *filename,
256 271
257 272
258/** 273/**
274 * Handle to a command action.
275 */
276struct GNUNET_OS_CommandHandle;
277
278/**
279 * Type of a function to process a line of output.
280 *
281 * @param cls closure
282 * @param line line of output from a command, NULL for the end
283 */
284typedef void (*GNUNET_OS_LineProcessor)(void *cls,
285 const char *line);
286
287/**
288 * Stop/kill a command.
289 *
290 * @param cmd handle to the process
291 * @param type status type
292 * @param code return code/signal number
293 * @return GNUNET_OK on success, GNUNET_NO if we killed the process
294 */
295int
296GNUNET_OS_command_stop (struct GNUNET_OS_CommandHandle *cmd,
297 enum GNUNET_OS_ProcessStatusType *type,
298 unsigned long *code);
299
300
301/**
302 * Run the given command line and call the given function
303 * for each line of the output.
304 *
305 * @param proc function to call for each line of the output
306 * @param proc_cls closure for proc
307 * @param timeout when to time out
308 * @param binary command to run
309 * @param ... arguments to command
310 * @return NULL on error
311 */
312struct GNUNET_OS_CommandHandle *
313GNUNET_OS_command_run (GNUNET_OS_LineProcessor proc,
314 void *proc_cls,
315 struct GNUNET_TIME_Relative timeout,
316 const char *binary,
317 ...);
318
319
320/**
259 * Retrieve the status of a process 321 * Retrieve the status of a process
260 * @param proc pointer to process structure 322 * @param proc pointer to process structure
261 * @param type status type 323 * @param type status type