* from address.
*/
bool
-faxApp::runCmd(const char* cmd, bool changeIDs)
+faxApp::runCmd(const char* cmd, bool changeIDs, IOHandler* waiter)
{
pid_t pid = fork();
switch (pid) {
logError("Can not fork for \"%s\"", cmd);
return (false);
default:
+ if (waiter == NULL)
{ int status = 0;
Sys::waitpid(pid, status);
if (status != 0) {
logError("Bad exit status %#o for \'%s\'", status, cmd);
return (false);
}
+ } else
+ {
+ Dispatcher::instance().startChild(pid, waiter);
}
return (true);
}
*/
#include "Str.h"
#include "Syslog.h"
+#include "Dispatcher.h"
#include <stdarg.h>
class faxApp : public Syslog {
static const fxStr quote;
static const fxStr enquote;
- bool runCmd(const char* cmd, bool changeIDs = false);
+ bool runCmd(const char* cmd, bool changeIDs = false, IOHandler* waiter = NULL);
};
inline bool faxApp::isRunning(void) const { return running; }
);
traceServer("RECV FAX: %s", (const char*) cmd);
setProcessPriority(BASE); // lower priority
- runCmd(cmd, true);
+ runCmd(cmd, true, this);
setProcessPriority(state); // restore priority
}
| quote | dev | enquote
);
traceServer("MODEM WEDGED: %s", (const char*) cmd);
- runCmd(cmd, true);
+ runCmd(cmd, true, this);
}
void
cmd.append(buf);
}
traceServer("NOTIFY: %s", (const char*) cmd);
- runCmd(cmd, true);
+ runCmd(cmd, true, this);
}
void
va_end(ap);
}
+void faxQueueApp::childStatus(pid_t pid, int status)
+{
+ // We don't do anything here - nothing to act on.
+ traceServer("NOTIFY exit status: %#o (%u)", status, pid);
+}
+
static void
usage(const char* appName)
{
void stopTimeout(const char* whichdir);
const fxStr& pickCmd(const FaxRequest& req);
// FIFO-related stuff
+ void childStatus(pid_t, int); // Dispatcher hook
int inputReady(int); // Dispatcher hook
void openFIFOs();
void closeFIFOs();
);
traceServer("RECV POLL: %s", (const char*) cmd);
setProcessPriority(BASE); // lower priority
- runCmd(cmd, true);
+ runCmd(cmd, true, this);
setProcessPriority(state); // restore previous priority
}