version 1.14, 2004/03/08 08:24:42 |
version 1.19, 2015/10/08 11:49:38 |
|
|
/* $OpenXM: OpenXM/src/kxx/oxserver00.c,v 1.13 2003/11/20 11:41:44 takayama Exp $ */ |
/* $OpenXM: OpenXM/src/kxx/oxserver00.c,v 1.18 2015/10/08 08:14:25 takayama Exp $ */ |
/* nullserver01 */ |
/* nullserver01 */ |
#include <stdio.h> |
#include <stdio.h> |
#include <sys/types.h> |
#include <sys/types.h> |
Line 20 int NoExecution = 0; |
|
Line 20 int NoExecution = 0; |
|
extern int SerialOX; /* Serial number of the packets sent. */ |
extern int SerialOX; /* Serial number of the packets sent. */ |
extern int SerialCurrent; /* Current Serial number of the recieved packet. */ |
extern int SerialCurrent; /* Current Serial number of the recieved packet. */ |
extern int OXprintMessage; /* print oxmessages? */ |
extern int OXprintMessage; /* print oxmessages? */ |
|
extern int Calling_ctrlC_hook; |
|
extern int RestrictedMode, RestrictedMode_saved; |
|
|
#if defined(__CYGWIN__) |
#if defined(__CYGWIN__) || defined(__MSYS__) |
sigjmp_buf EnvOfChildServer; |
sigjmp_buf EnvOfChildServer; |
#else |
#else |
jmp_buf EnvOfChildServer; |
jmp_buf EnvOfChildServer; |
Line 97 nullserver(int fdStreamIn,int fdStreamOut) { |
|
Line 99 nullserver(int fdStreamIn,int fdStreamOut) { |
|
ox_stream ostreamOut; |
ox_stream ostreamOut; |
char sreason[1024]; |
char sreason[1024]; |
extern void controlResetHandler(); |
extern void controlResetHandler(); |
#if defined(__CYGWIN__) |
#if defined(__CYGWIN__) || defined(__MSYS__) |
extern sigjmp_buf EnvOfStackMachine; |
extern sigjmp_buf EnvOfStackMachine; |
#else |
#else |
extern jmp_buf EnvOfStackMachine; |
extern jmp_buf EnvOfStackMachine; |
Line 129 nullserver(int fdStreamIn,int fdStreamOut) { |
|
Line 131 nullserver(int fdStreamIn,int fdStreamOut) { |
|
if (PacketMonitor) fp2watch(ostreamOut,stdout); |
if (PacketMonitor) fp2watch(ostreamOut,stdout); |
} |
} |
|
|
|
fprintf(stderr,"Hello world.\n"); OXprintMessage = 1; |
|
JmpMessage = 1; |
|
|
aaa : ; |
aaa : ; |
#if defined(__CYGWIN__) |
#if defined(__CYGWIN__) |
if (sigsetjmp(EnvOfChildServer,1)) { |
if (MYSIGSETJMP(EnvOfChildServer,1)) { |
#else |
#else |
if (setjmp(EnvOfChildServer)) { |
if (MYSETJMP(EnvOfChildServer)) { |
#endif |
#endif |
fprintf(stderr,"childServerMain: jump here.\n"); |
fprintf(stderr,"childServerMain: jump here.\n"); |
if (OxInterruptFlag == 0) { |
if (OxInterruptFlag == 0) { |
fprintf(stderr," ?! \n"); fflush(NULL); |
fprintf(stderr," ?! \n"); fflush(NULL); |
} |
} |
KSexecuteString(" ctrlC-hook "); /* Execute User Defined functions. */ |
if (!Calling_ctrlC_hook) { |
|
Calling_ctrlC_hook = 1; RestrictedMode = 0; |
|
KSexecuteString(" ctrlC-hook "); /* Execute User Defined functions. */ |
|
RestrictedMode = RestrictedMode_saved; |
|
} |
|
Calling_ctrlC_hook = 0; |
KSexecuteString(" (Computation is interrupted.) "); |
KSexecuteString(" (Computation is interrupted.) "); |
signal(SIGUSR1,controlResetHandler); goto aaa; |
signal(SIGUSR1,controlResetHandler); goto aaa; |
} else { |
} else { |
Line 147 nullserver(int fdStreamIn,int fdStreamOut) { |
|
Line 157 nullserver(int fdStreamIn,int fdStreamOut) { |
|
signal(SIGUSR1,controlResetHandler); |
signal(SIGUSR1,controlResetHandler); |
} |
} |
#if defined(__CYGWIN__) |
#if defined(__CYGWIN__) |
if (sigsetjmp(EnvOfStackMachine,1)) { |
if (MYSIGSETJMP(EnvOfStackMachine,1)) { |
#else |
#else |
if (setjmp(EnvOfStackMachine)) { |
if (MYSETJMP(EnvOfStackMachine)) { |
#endif |
#endif |
fprintf(stderr,"childServerMain: jump here by EnvOfStackMachine or timeout.\n"); |
fprintf(stderr,"childServerMain: jump here by EnvOfStackMachine or timeout.\n"); |
if (OxInterruptFlag == 0) { |
if (OxInterruptFlag == 0) { |
Line 165 nullserver(int fdStreamIn,int fdStreamOut) { |
|
Line 175 nullserver(int fdStreamIn,int fdStreamOut) { |
|
*/ |
*/ |
Sm1_pushError2(SerialCurrent,-1,"Global jump by sm1 error"); |
Sm1_pushError2(SerialCurrent,-1,"Global jump by sm1 error"); |
|
|
KSexecuteString(" ctrlC-hook "); /* Execute User Defined functions. */ |
if (!Calling_ctrlC_hook) { |
|
Calling_ctrlC_hook = 1; RestrictedMode = 0; |
|
KSexecuteString(" ctrlC-hook "); /* Execute User Defined functions. */ |
|
RestrictedMode = RestrictedMode_saved; |
|
} |
|
Calling_ctrlC_hook = 0; |
signal(SIGUSR1,controlResetHandler); goto aaa ; |
signal(SIGUSR1,controlResetHandler); goto aaa ; |
} else { |
} else { |
if (JmpMessage) fprintf(stderr,"Set EnvOfStackMachine.\n"); |
if (JmpMessage) fprintf(stderr,"Set EnvOfStackMachine.\n"); |
Line 352 nullserver_simplest(int fd) { |
|
Line 367 nullserver_simplest(int fd) { |
|
int c; |
int c; |
while(1) { |
while(1) { |
c = readOneByte(fd); |
c = readOneByte(fd); |
if (c == '@') { return; } |
if (c == '@') { return 0; } |
} |
} |
} |
} |
|
|
Line 367 void controlResetHandler(sig) |
|
Line 382 void controlResetHandler(sig) |
|
if (OxCritical) { |
if (OxCritical) { |
return; |
return; |
}else{ |
}else{ |
#if defined(__CYGWIN__) |
(void) traceShowStack(); traceClearStack(); |
siglongjmp(EnvOfChildServer,2); /* returns 2 for ctrl-C */ |
#if defined(__CYGWIN__) || defined(__MSYS__) |
|
MYSIGLONGJMP(EnvOfChildServer,2); /* returns 2 for ctrl-C */ |
#else |
#else |
longjmp(EnvOfChildServer,2); /* returns 2 for ctrl-C */ |
LONGJMP(EnvOfChildServer,2); /* returns 2 for ctrl-C */ |
#endif |
#endif |
} |
} |
} |
} |