Standardized routines for forking processes (keeps all the specialized code in one place).

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@114188 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Tilghman Lesher
2008-04-16 22:57:54 +00:00
parent 752f6681b1
commit 123ac5fd64
13 changed files with 163 additions and 137 deletions

View File

@@ -480,6 +480,15 @@ int ast_record_review(struct ast_channel *chan, const char *playfile, const char
/*! \brief Decode an encoded control or extended ASCII character */
int ast_get_encoded_char(const char *stream, char *result, size_t *consumed);
/*! \brief Common routine for child processes, to close all fds prior to exec(2) */
void ast_close_fds_above_n(int n);
/*! \brief Common routine to safely fork without a chance of a signal handler firing badly in the child */
int ast_safe_fork(int stop_reaper);
/*! \brief Common routine to cleanup after fork'ed process is complete (if reaping was stopped) */
void ast_safe_fork_cleanup(void);
#if defined(__cplusplus) || defined(c_plusplus)
}
#endif

View File

@@ -78,6 +78,9 @@ void ast_queue_log(const char *queuename, const char *callid, const char *agent,
void ast_verbose(const char *fmt, ...)
__attribute__ ((format (printf, 1, 2)));
void ast_child_verbose(int level, const char *fmt, ...)
__attribute__ ((format (printf, 2, 3)));
int ast_register_verbose(void (*verboser)(const char *string));
int ast_unregister_verbose(void (*verboser)(const char *string));