| version 1.19, 2015/10/08 11:49:38 |
version 1.24, 2016/08/28 02:43:15 |
|
|
| /* $OpenXM: OpenXM/src/kxx/oxserver00.c,v 1.18 2015/10/08 08:14:25 takayama Exp $ */ |
/* $OpenXM: OpenXM/src/kxx/oxserver00.c,v 1.23 2016/03/31 05:27:34 takayama Exp $ */ |
| /* nullserver01 */ |
/* nullserver01 */ |
| #include <stdio.h> |
#include <stdio.h> |
| #include <sys/types.h> |
#include <sys/types.h> |
|
|
| #include <netdb.h> |
#include <netdb.h> |
| #include <signal.h> |
#include <signal.h> |
| #include <setjmp.h> |
#include <setjmp.h> |
| |
#include <stdlib.h> |
| /* -lnsl -lsocket /usr/ucblib/libucb.a */ |
/* -lnsl -lsocket /usr/ucblib/libucb.a */ |
| #include "ox_kan.h" |
#include "ox_kan.h" |
| #include "serversm.h" |
#include "serversm.h" |
| Line 131 nullserver(int fdStreamIn,int fdStreamOut) { |
|
| Line 132 nullserver(int fdStreamIn,int fdStreamOut) { |
|
| if (PacketMonitor) fp2watch(ostreamOut,stdout); |
if (PacketMonitor) fp2watch(ostreamOut,stdout); |
| } |
} |
| |
|
| fprintf(stderr,"Hello world.\n"); OXprintMessage = 1; |
/* fprintf(stderr,"Hello world.\n"); OXprintMessage = 1; |
| JmpMessage = 1; |
JmpMessage = 1; */ |
| |
|
| aaa : ; |
aaa : ; |
| #if defined(__CYGWIN__) |
#if defined(__CYGWIN__) |
| Line 151 nullserver(int fdStreamIn,int fdStreamOut) { |
|
| Line 152 nullserver(int fdStreamIn,int fdStreamOut) { |
|
| } |
} |
| Calling_ctrlC_hook = 0; |
Calling_ctrlC_hook = 0; |
| KSexecuteString(" (Computation is interrupted.) "); |
KSexecuteString(" (Computation is interrupted.) "); |
| signal(SIGUSR1,controlResetHandler); goto aaa; |
mysignal(SIGUSR1,controlResetHandler); goto aaa; |
| } else { |
} else { |
| if (JmpMessage) fprintf(stderr,"Set EnvOfChildServer.\n"); |
if (JmpMessage) fprintf(stderr,"Set EnvOfChildServer.\n"); |
| signal(SIGUSR1,controlResetHandler); |
mysignal(SIGUSR1,controlResetHandler); |
| } |
} |
| #if defined(__CYGWIN__) |
#if defined(__CYGWIN__) |
| if (MYSIGSETJMP(EnvOfStackMachine,1)) { |
if (MYSIGSETJMP(EnvOfStackMachine,1)) { |
| Line 181 nullserver(int fdStreamIn,int fdStreamOut) { |
|
| Line 182 nullserver(int fdStreamIn,int fdStreamOut) { |
|
| RestrictedMode = RestrictedMode_saved; |
RestrictedMode = RestrictedMode_saved; |
| } |
} |
| Calling_ctrlC_hook = 0; |
Calling_ctrlC_hook = 0; |
| signal(SIGUSR1,controlResetHandler); goto aaa ; |
mysignal(SIGUSR1,controlResetHandler); goto aaa ; |
| } else { |
} else { |
| if (JmpMessage) fprintf(stderr,"Set EnvOfStackMachine.\n"); |
if (JmpMessage) fprintf(stderr,"Set EnvOfStackMachine.\n"); |
| if (signal(SIGUSR1,SIG_IGN) != SIG_IGN) { |
if (mysignal(SIGUSR1,SIG_IGN) != SIG_IGN) { |
| signal(SIGUSR1,controlResetHandler); |
mysignal(SIGUSR1,controlResetHandler); |
| } |
} |
| } |
} |
| |
|
| Line 300 nullserverCommand(ox_stream ostreamIn,ox_stream ostrea |
|
| Line 301 nullserverCommand(ox_stream ostreamIn,ox_stream ostrea |
|
| }else{ |
}else{ |
| iresult = Sm1_executeStringByLocalParser(); |
iresult = Sm1_executeStringByLocalParser(); |
| } |
} |
| OxCritical = 1; signal(SIGUSR1,controlResetHandler); |
OxCritical = 1; mysignal(SIGUSR1,controlResetHandler); |
| if (iresult < 0) { |
if (iresult < 0) { |
| emsg = Sm1_popErrorMessage("executeString: "); |
emsg = Sm1_popErrorMessage("executeString: "); |
| Sm1_pushError2(SerialCurrent,-1,emsg); |
Sm1_pushError2(SerialCurrent,-1,emsg); |
| Line 314 nullserverCommand(ox_stream ostreamIn,ox_stream ostrea |
|
| Line 315 nullserverCommand(ox_stream ostreamIn,ox_stream ostrea |
|
| }else{ |
}else{ |
| iresult = Sm1_executeStringByLocalParser(); |
iresult = Sm1_executeStringByLocalParser(); |
| } |
} |
| OxCritical = 1; signal(SIGUSR1,controlResetHandler); |
OxCritical = 1; mysignal(SIGUSR1,controlResetHandler); |
| if (iresult < 0) { |
if (iresult < 0) { |
| emsg = Sm1_popErrorMessage("executeFunction: "); |
emsg = Sm1_popErrorMessage("executeFunction: "); |
| Sm1_pushError2(SerialCurrent,-1,emsg); |
Sm1_pushError2(SerialCurrent,-1,emsg); |
| Line 328 nullserverCommand(ox_stream ostreamIn,ox_stream ostrea |
|
| Line 329 nullserverCommand(ox_stream ostreamIn,ox_stream ostrea |
|
| }else{ |
}else{ |
| iresult = Sm1_executeStringByLocalParser(); |
iresult = Sm1_executeStringByLocalParser(); |
| } |
} |
| OxCritical = 1; signal(SIGUSR1,controlResetHandler); |
OxCritical = 1; mysignal(SIGUSR1,controlResetHandler); |
| if (iresult < 0) { |
if (iresult < 0) { |
| emsg = Sm1_popErrorMessage("executeFunctionWithOptionalArgument: "); |
emsg = Sm1_popErrorMessage("executeFunctionWithOptionalArgument: "); |
| Sm1_pushError2(SerialCurrent,-1,emsg); |
Sm1_pushError2(SerialCurrent,-1,emsg); |
| Line 354 nullserverCommand(ox_stream ostreamIn,ox_stream ostrea |
|
| Line 355 nullserverCommand(ox_stream ostreamIn,ox_stream ostrea |
|
| fprintf(stderr,"This command has not yet been implemented.\n"); |
fprintf(stderr,"This command has not yet been implemented.\n"); |
| return(-1); |
return(-1); |
| break; |
break; |
| |
case SM_nop: |
| |
break; |
| default: |
default: |
| fprintf(stderr,"Fatal error. Unknown function_id %d\n",id); |
fprintf(stderr,"Fatal error. Unknown function_id %d\n",id); |
| return(-1); |
return(-1); |
| Line 375 nullserver_simplest(int fd) { |
|
| Line 378 nullserver_simplest(int fd) { |
|
| void controlResetHandler(sig) |
void controlResetHandler(sig) |
| int sig; |
int sig; |
| { |
{ |
| signal(sig,SIG_IGN); |
mysignal(sig,SIG_IGN); |
| cancelAlarm(); |
cancelAlarm(); |
| fprintf(stderr,"From controlResetHandler. OxCritical = %d\n",OxCritical); |
fprintf(stderr,"From controlResetHandler. OxCritical = %d\n",OxCritical); |
| OxInterruptFlag = 1; |
OxInterruptFlag = 1; |
| Line 386 void controlResetHandler(sig) |
|
| Line 389 void controlResetHandler(sig) |
|
| #if defined(__CYGWIN__) || defined(__MSYS__) |
#if defined(__CYGWIN__) || defined(__MSYS__) |
| MYSIGLONGJMP(EnvOfChildServer,2); /* returns 2 for ctrl-C */ |
MYSIGLONGJMP(EnvOfChildServer,2); /* returns 2 for ctrl-C */ |
| #else |
#else |
| LONGJMP(EnvOfChildServer,2); /* returns 2 for ctrl-C */ |
MYLONGJMP(EnvOfChildServer,2); /* returns 2 for ctrl-C */ |
| #endif |
#endif |
| } |
} |
| } |
} |