You should have received a copy of the GNU General Public License
along with GNUnet; see the file COPYING. If not, write to the
- Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA.
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
*/
/**
}
return 0;
#else
- LOG (GNUNET_ERROR_TYPE_DEBUG, "Sending signal %d to pid: %u via system call\n", sig, proc->pid);
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "Sending signal %d to pid: %u via system call\n",
+ sig,
+ proc->pid);
return PLIBC_KILL (proc->pid, sig);
#endif
default:
if (NULL != proc->control_pipe)
GNUNET_DISK_file_close (proc->control_pipe);
#if defined (WINDOWS)
- if (proc->handle != NULL)
+ if (NULL != proc->handle)
CloseHandle (proc->handle);
#endif
GNUNET_free (proc);
* (when they are non-NULL).
* @param pipe_stdin pipe to use to send input to child process (or NULL)
* @param pipe_stdout pipe to use to get output from child process (or NULL)
+ * @param pipe_stderr pipe to use for stderr for child process (or NULL)
* @param lsocks array of listen sockets to dup systemd-style (or NULL);
* must be NULL on platforms where dup is not supported
* @param filename name of the binary
if (NULL == (wcmd = u8_to_u16 ((uint8_t *) cmd, 1 + strlen (cmd), NULL, &wcmd_len)))
{
LOG (GNUNET_ERROR_TYPE_DEBUG,
- "Failed to convert `%s' from UTF-8 to UTF-16: %d\n", cmd, errno);
+ "Failed to convert `%s' from UTF-8 to UTF-16: %d\n",
+ cmd,
+ errno);
GNUNET_free (env_block);
GNUNET_free (cmd);
free (wpath);
SetHandleInformation (stdeh, HANDLE_FLAG_INHERIT, stdef);
if (!bresult)
- LOG (GNUNET_ERROR_TYPE_ERROR, "CreateProcess(%s, %s) failed: %lu\n", path, cmd, error_code);
+ LOG (GNUNET_ERROR_TYPE_ERROR,
+ "CreateProcess(%s, %s) failed: %lu\n",
+ path,
+ cmd,
+ error_code);
GNUNET_free (env_block);
GNUNET_free (cmd);
* @param proc process ID
* @param type status type
* @param code return code/signal number
- * @return GNUNET_OK on success, GNUNET_NO if the process is still running, GNUNET_SYSERR otherwise
+ * @return #GNUNET_OK on success, #GNUNET_NO if the process is still running, #GNUNET_SYSERR otherwise
*/
int
GNUNET_OS_process_status (struct GNUNET_OS_Process *proc,
/**
- * Wait for a process
+ * Wait for a process to terminate. The return code is discarded.
+ * You must not use #GNUNET_OS_process_status() on the same process
+ * after calling this function! This function is blocking and should
+ * thus only be used if the child process is known to have terminated
+ * or to terminate very soon.
*
* @param proc pointer to process structure
- * @return GNUNET_OK on success, GNUNET_SYSERR otherwise
+ * @return #GNUNET_OK on success, #GNUNET_SYSERR otherwise
*/
int
GNUNET_OS_process_wait (struct GNUNET_OS_Process *proc)
(EINTR == errno) ) ;
if (pid != ret)
{
- LOG_STRERROR (GNUNET_ERROR_TYPE_WARNING, "waitpid");
+ LOG_STRERROR (GNUNET_ERROR_TYPE_WARNING,
+ "waitpid");
return GNUNET_SYSERR;
}
return GNUNET_OK;
h = proc->handle;
if (NULL == h)
{
- LOG (GNUNET_ERROR_TYPE_WARNING, "Invalid process information {%d, %08X}\n",
+ LOG (GNUNET_ERROR_TYPE_WARNING,
+ "Invalid process information {%d, %08X}\n",
proc->pid, h);
return GNUNET_SYSERR;
}
GNUNET_OS_LineProcessor proc;
/**
- * Closure for 'proc'.
+ * Closure for @e proc.
*/
void *proc_cls;
/**
* Task reading from pipe.
*/
- struct GNUNET_SCHEDULER_Task * rtask;
+ struct GNUNET_SCHEDULER_Task *rtask;
/**
* When to time out.
* for each line of the output.
*
* @param proc function to call for each line of the output
- * @param proc_cls closure for proc
+ * @param proc_cls closure for @a proc
* @param timeout when to time out
* @param binary command to run
* @param ... arguments to command
* @return NULL on error
*/
struct GNUNET_OS_CommandHandle *
-GNUNET_OS_command_run (GNUNET_OS_LineProcessor proc, void *proc_cls,
- struct GNUNET_TIME_Relative timeout, const char *binary,
+GNUNET_OS_command_run (GNUNET_OS_LineProcessor proc,
+ void *proc_cls,
+ struct GNUNET_TIME_Relative timeout,
+ const char *binary,
...)
{
struct GNUNET_OS_CommandHandle *cmd;