2010-05-18 17:38:12 +02:00
|
|
|
/*
|
|
|
|
* ngIRCd -- The Next Generation IRC Daemon
|
|
|
|
* Copyright (c)2001-2010 Alexander Barton (alex@barton.de)
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
* Please read the file COPYING, README and AUTHORS for more information.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __proc_h__
|
|
|
|
#define __proc_h__
|
|
|
|
|
2010-12-27 17:14:14 +01:00
|
|
|
/**
|
|
|
|
* @file
|
|
|
|
* Process management (header)
|
|
|
|
*/
|
|
|
|
|
|
|
|
/** Process status. This struct must not be accessed directly! */
|
2010-05-18 17:38:12 +02:00
|
|
|
typedef struct _Proc_Stat {
|
2010-12-27 17:37:56 +01:00
|
|
|
pid_t pid; /**< PID of the child process or 0 if none */
|
|
|
|
int pipe_fd; /**< Pipe file descriptor or -1 if none */
|
2010-05-18 17:38:12 +02:00
|
|
|
} PROC_STAT;
|
|
|
|
|
2010-12-27 17:37:56 +01:00
|
|
|
/** Return true if sub-process is still running */
|
2010-05-18 17:38:12 +02:00
|
|
|
#define Proc_InProgress(x) ((x)->pid != 0)
|
2010-12-27 17:37:56 +01:00
|
|
|
|
|
|
|
/** Return file descriptor of pipe to sub-process (or -1 if none open) */
|
2010-05-18 17:38:12 +02:00
|
|
|
#define Proc_GetPipeFd(x) ((x)->pipe_fd)
|
|
|
|
|
|
|
|
GLOBAL void Proc_InitStruct PARAMS((PROC_STAT *proc));
|
|
|
|
|
|
|
|
GLOBAL pid_t Proc_Fork PARAMS((PROC_STAT *proc, int *pipefds,
|
2010-07-14 10:29:05 +02:00
|
|
|
void (*cbfunc)(int, short), int timeout));
|
2010-05-18 17:38:12 +02:00
|
|
|
|
2010-07-01 00:39:35 +02:00
|
|
|
GLOBAL void Proc_GenericSignalHandler PARAMS((int Signal));
|
|
|
|
|
2010-07-11 16:58:30 +02:00
|
|
|
GLOBAL size_t Proc_Read PARAMS((PROC_STAT *proc, void *buffer, size_t buflen));
|
|
|
|
|
2010-05-18 17:38:12 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/* -eof- */
|