version 1.7, 2006/01/26 08:36:50 |
version 1.9, 2020/10/07 07:47:23 |
|
|
/* $OpenXM: OpenXM/src/kxx/ox100start.c,v 1.6 2004/02/28 12:27:15 takayama Exp $ */ |
/* $OpenXM: OpenXM/src/kxx/ox100start.c,v 1.8 2016/03/31 05:27:34 takayama Exp $ */ |
/* Moved from misc-2003/07/cygwin/test.c */ |
/* Moved from misc-2003/07/cygwin/test.c */ |
#include <stdio.h> |
#include <stdio.h> |
#include <sys/types.h> |
#include <sys/types.h> |
|
|
#include <sys/wait.h> |
#include <sys/wait.h> |
#include <signal.h> |
#include <signal.h> |
#include <ctype.h> |
#include <ctype.h> |
|
#include <string.h> |
#include "ox_pathfinder.h" |
#include "ox_pathfinder.h" |
|
#include "mysig.h" |
|
|
static void usage(void); |
static void usage(void); |
static int forkExec(char **argv); |
static int forkExec(char **argv); |
|
|
static int EngineLogToStdout = 0; |
static int EngineLogToStdout = 0; |
extern char **environ; |
extern char **environ; |
|
|
main(int argc,char *argv[]) { |
void main(int argc,char *argv[]) { |
char *s; |
char *s; |
char s2[1024]; |
char s2[1024]; |
char buf[1024]; |
char buf[1024]; |
Line 82 static void myforkwait() { |
|
Line 84 static void myforkwait() { |
|
int status; |
int status; |
int pid; |
int pid; |
int i,j; |
int i,j; |
signal(SIGCHLD,SIG_IGN); |
mysignal(SIGCHLD,SIG_IGN); |
pid = wait(&status); |
pid = wait(&status); |
fprintf(stderr,"Child process %d is exiting.\n",pid); |
fprintf(stderr,"Child process %d is exiting.\n",pid); |
for (i=0; i<Myforkcp; i++) { |
for (i=0; i<Myforkcp; i++) { |
Line 93 static void myforkwait() { |
|
Line 95 static void myforkwait() { |
|
if (Myforkcp > 0) Myforkcp--; |
if (Myforkcp > 0) Myforkcp--; |
} |
} |
} |
} |
signal(SIGCHLD,myforkwait); |
mysignal(SIGCHLD,myforkwait); |
} |
} |
|
|
static void usage() { |
static void usage() { |
Line 116 static int forkExec(char **argv) { |
|
Line 118 static int forkExec(char **argv) { |
|
if (m&2) { |
if (m&2) { |
/* Do not call singal to turn around a trouble on cygwin. BUG. */ |
/* Do not call singal to turn around a trouble on cygwin. BUG. */ |
}else{ |
}else{ |
signal(SIGCHLD,myforkwait); /* to kill Zombie */ |
mysignal(SIGCHLD,myforkwait); /* to kill Zombie */ |
} |
} |
Myforkchildren[Myforkcp++] = pid; |
Myforkchildren[Myforkcp++] = pid; |
if (Myforkcp >= MYFORKCP_SIZE-1) { |
if (Myforkcp >= MYFORKCP_SIZE-1) { |