[BACK]Return to oxmain.c CVS log [TXT][DIR] Up to [local] / OpenXM / src / kxx

Diff for /OpenXM/src/kxx/oxmain.c between version 1.28 and 1.30

version 1.28, 2016/08/27 00:11:27 version 1.30, 2020/10/07 07:47:23
Line 1 
Line 1 
 /*  $OpenXM: OpenXM/src/kxx/oxmain.c,v 1.27 2016/03/30 21:34:03 takayama Exp $  */  /*  $OpenXM: OpenXM/src/kxx/oxmain.c,v 1.29 2016/09/26 11:43:38 takayama Exp $  */
 /*  Note on IntelMac. [2006.06.05]  /*  Note on IntelMac. [2006.06.05]
     SIGINT does not seem to be blocked on the rosetta emulator of ppc      SIGINT does not seem to be blocked on the rosetta emulator of ppc
     on the IntelMac's. "ox" should be universal binary.      on the IntelMac's. "ox" should be universal binary.
Line 15 
Line 15 
 #include <sys/socket.h>  #include <sys/socket.h>
 #include <sys/time.h>  #include <sys/time.h>
 #include <sys/resource.h>  #include <sys/resource.h>
   #include <sys/wait.h>
 #include <netinet/in.h>  #include <netinet/in.h>
 #include <netdb.h>  #include <netdb.h>
 #include <signal.h>  #include <signal.h>
Line 26 
Line 27 
   
 #define SERVERNAME "ox_sm1"  #define SERVERNAME "ox_sm1"
   
   void oxmainUsage();
   void parentServerMain(int fdControl, int fdStream);
   int childServerMain(int fdControl, int fdStream);
   void unlockCtrlCForOx();
   void restoreLockCtrlCForOx();
   
   
 extern char **environ;  extern char **environ;
 int OxCritical = 0;  int OxCritical = 0;
 int OxInterruptFlag = 0;  int OxInterruptFlag = 0;
Line 54  void *sGC_malloc(int n) {
Line 62  void *sGC_malloc(int n) {
   return (void *)malloc(n);    return (void *)malloc(n);
 }  }
   
 main(int argc, char *argv[]) {  void main(int argc, char *argv[]) {
   int fd;    int fd;
   int size;    int size;
   char sname[1024];    char sname[1024];
Line 184  main(int argc, char *argv[]) {
Line 192  main(int argc, char *argv[]) {
         sprintf(stmp,"%s/.openxm/tmp.opt/%s",(char *)getenv("HOME"),passControl);          sprintf(stmp,"%s/.openxm/tmp.opt/%s",(char *)getenv("HOME"),passControl);
         fp = fopen(stmp,"r");          fp = fopen(stmp,"r");
         if (fp == NULL) { fprintf(stderr,"passControl file %s is not found.\n",stmp); exit(1);}          if (fp == NULL) { fprintf(stderr,"passControl file %s is not found.\n",stmp); exit(1);}
         fgets(stmp,127,fp); passControl = stmp; fclose(fp);          {char *rrr; rrr=fgets(stmp,127,fp);} passControl = stmp; fclose(fp);
   
         stmp = (char *)sGC_malloc(strlen(getenv("HOME"))+strlen(passControl)+          stmp = (char *)sGC_malloc(strlen(getenv("HOME"))+strlen(passControl)+
                                                           strlen(passData)+128);                                                            strlen(passData)+128);
         sprintf(stmp,"%s/.openxm/tmp.opt/%s",(char *)getenv("HOME"),passData);          sprintf(stmp,"%s/.openxm/tmp.opt/%s",(char *)getenv("HOME"),passData);
         fp = fopen(stmp,"r");          fp = fopen(stmp,"r");
         if (fp == NULL) { fprintf(stderr,"passData file %s is not found.\n",stmp); exit(1);}          if (fp == NULL) { fprintf(stderr,"passData file %s is not found.\n",stmp); exit(1);}
         fgets(stmp,127,fp); passData = stmp; fclose(fp);          {char *rrr; rrr=fgets(stmp,127,fp);} passData = stmp; fclose(fp);
   }    }
   
   if (reverse) {    if (reverse) {
Line 330  static void errorToStartEngine(void) {
Line 338  static void errorToStartEngine(void) {
   exit(-1);    exit(-1);
 }  }
   
 oxmainUsage() {  void oxmainUsage() {
   fprintf(stderr,"Usage: \n");    fprintf(stderr,"Usage: \n");
   fprintf(stderr,"  ox [-ox serverprogram -host name -data portnum -control portnum -monitor]\n");    fprintf(stderr,"  ox [-ox serverprogram -host name -data portnum -control portnum -monitor]\n");
   fprintf(stderr," [-insecure -portfile fname -reverse -passControl xxxyyyzzz -passData pppqqqrrr]");    fprintf(stderr," [-insecure -portfile fname -reverse -passControl xxxyyyzzz -passData pppqqqrrr]");
Line 362  oxmainUsage() {
Line 370  oxmainUsage() {
   fprintf(stderr,"\n");    fprintf(stderr,"\n");
 }  }
   
 parentServerMain(int fdControl, int fdStream) {  void parentServerMain(int fdControl, int fdStream) {
   int id;    int id;
   int mtag;    int mtag;
   int size;    int size;
Line 370  parentServerMain(int fdControl, int fdStream) {
Line 378  parentServerMain(int fdControl, int fdStream) {
   int r;    int r;
   int message = 1;    int message = 1;
   int controlByteOrder;    int controlByteOrder;
   extern OxTerminateMode;    extern int OxTerminateMode;
   extern void myServerExit(int m);    extern void myServerExit(int m);
   
   int sigchld[]={SIGCHLD,-1};    int sigchld[]={SIGCHLD,-1};
Line 390  parentServerMain(int fdControl, int fdStream) {
Line 398  parentServerMain(int fdControl, int fdStream) {
   /* Set the network byte order. */    /* Set the network byte order. */
   fprintf(stderr,"controlByteOrder=%x\n",controlByteOrder);    fprintf(stderr,"controlByteOrder=%x\n",controlByteOrder);
   
   int sigint[]={SIGINT,-1};    /*  int sigint[]={SIGINT,-1};
   set_signal(sigint[0],myServerExit);    set_signal(sigint[0],myServerExit);
   unblock_signal(sigint);    unblock_signal(sigint);
     */
     mysignal(SIGINT,SIG_IGN);
   while(1) {    while(1) {
     mtag = oxfdGetOXheader(fdControl,&SerialCurrentControl);      mtag = oxfdGetOXheader(fdControl,&SerialCurrentControl);
     /* get the message_tag */      /* get the message_tag */
Line 412  parentServerMain(int fdControl, int fdStream) {
Line 422  parentServerMain(int fdControl, int fdStream) {
       r=kill(MyServerPid,SIGUSR1);        r=kill(MyServerPid,SIGUSR1);
       if (message) printf("Result = %d\n",r);        if (message) printf("Result = %d\n",r);
       if (Ox_protocol_1999) {        if (Ox_protocol_1999) {
         if (message) printf("[obsolete protocol of ox-rfc-100 in 1999] Sending the result packet to the control channel.\n",r);          if (message) printf("[obsolete protocol of ox-rfc-100 in 1999] Sending the result packet to the control channel. r=%d\n",r);
         oxSendResultOfControlInt32(fdControl,0);          oxSendResultOfControlInt32(fdControl,0);
       }        }
       fflush(NULL);        fflush(NULL);
Line 433  void myServerExit(int m) {
Line 443  void myServerExit(int m) {
   exit(0);    exit(0);
 }  }
   
 childServerMain(int fdControl, int fdStream) {  int childServerMain(int fdControl, int fdStream) {
   int i;    int i;
   struct rlimit res;    struct rlimit res;
   close(fdControl);   /* close(0); dup(fdStream); */    close(fdControl);   /* close(0); dup(fdStream); */
Line 482  childServerMain(int fdControl, int fdStream) {
Line 492  childServerMain(int fdControl, int fdStream) {
         setrlimit(RLIMIT_STACK,&res);          setrlimit(RLIMIT_STACK,&res);
   }    }
   
   int sigint[]={SIGINT,-1};    //  int sigint[]={SIGINT,-1};
   if (IgnoreSIGINT) { block_signal(sigint); fprintf(stderr,"SIGING\n");}    //  if (IgnoreSIGINT) { block_signal(sigint); fprintf(stderr,"SIGING\n");}
     if (IgnoreSIGINT) { mysignal(SIGINT,SIG_IGN); fprintf(stderr,"SIG_ING\n");}
   
   if (PacketMonitor) {    if (PacketMonitor) {
     if (execle(ServerName,ServerName,"-monitor",NULL,environ)) {      if (execle(ServerName,ServerName,"-monitor",NULL,environ)) {
Line 503  childServerMain(int fdControl, int fdStream) {
Line 514  childServerMain(int fdControl, int fdStream) {
   
   
 /* These are dummy.  It is defined in stackmachine.c */  /* These are dummy.  It is defined in stackmachine.c */
 unlockCtrlCForOx() { ; }  void unlockCtrlCForOx() { ; }
 restoreLockCtrlCForOx() { ; }  void restoreLockCtrlCForOx() { ; }
   
 static int findOxServer(char *server) {  static int findOxServer(char *server) {
   char *p;    char *p;

Legend:
Removed from v.1.28  
changed lines
  Added in v.1.30

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>