SWITCH_DECLARE(void) switch_core_recovery_track(switch_core_session_t *session);
SWITCH_DECLARE(void) switch_core_recovery_flush(const char *technology, const char *profile_name);
+
+SWITCH_DECLARE(pid_t) switch_fork(void);
+
SWITCH_END_EXTERN_C
#endif
/* For Emacs:
NOTICA("incoming SMS message:>>>%s<<<\n", CELLIAX_P_LOG, p->sms_message);
pipe(fd1);
- pid1 = fork();
+ pid1 = switch_fork();
if (pid1 == 0) { //child
int err;
NOTICA("incoming SMS message:>>>%s<<<\n", CELLIAX_P_LOG, p->sms_message);
pipe(fd1);
- pid1 = fork();
+ pid1 = switch_fork();
if (pid1 == 0) { //child
int err;
}
-
#ifdef WIN32
static int switch_system_fork(const char *cmd, switch_bool_t wait)
{
return switch_system_thread(cmd, wait);
}
+SWITCH_DECLARE(pid_t) switch_fork(void)
+{
+ return -1;
+}
+
+
#else
+SWITCH_DECLARE(pid_t) switch_fork(void)
+{
+ int i = fork();
+
+ if (!i) {
+ set_low_priority();
+ }
+
+ return i;
+}
+
+
+
static int switch_system_fork(const char *cmd, switch_bool_t wait)
{
int pid;
switch_core_set_signal_handlers();
- pid = fork();
+ pid = switch_fork();
if (pid) {
if (wait) {
} else {
switch_close_extra_files(NULL, 0);
- set_low_priority();
if (system(dcmd) == -1) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to execute because of a command error : %s\n", dcmd);
}
if (pipe(fds)) {
goto end;
} else { /* good to go */
- pid = fork();
+ pid = switch_fork();
if (pid < 0) { /* ok maybe not */
close(fds[0]);