Ignore:
Timestamp:
Jun 24, 2015, 1:58:17 AM (9 years ago)
Author:
djay
Message:

Various fixes for Windows support: generate uuid using UuidCreate?, pass usid to the created process, call TerminateProcess? on dismiss request.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/zoo-project/zoo-kernel/service_internal.c

    r654 r680  
    2323 */
    2424
    25 #include "fcgi_stdio.h"
    2625#include "service_internal.h"
    2726#ifdef USE_MS
     
    9089     ){
    9190#ifdef WIN32
    92     return NULL
     91    return NULL;
    9392#else
    9493    return -1;
     
    9695  }
    9796  if(lockShm(lockid)<0){
     97#ifdef WIN32
     98      return NULL;
     99#else
    98100    if(itn<ZOO_LOCK_MAX_RETRY){
    99101      itn++;
    100102      goto toRetry1;
    101103    }else
    102 #ifdef WIN32
    103     return NULL
    104 #else
    105     return -1;
     104      return -1;
    106105#endif
    107106  }else
     
    211210      free(fbkpid);
    212211      if(stat!=NULL){
     212#ifndef WIN32
    213213        removeShmLock(conf,1);
     214#else
     215        unlockShm(lockid);
     216#endif
    214217        free(stat);
    215218      }
     
    271274    if(stat!=NULL){
    272275      lockid=acquireLock(conf);
    273       if(lockid<0)
     276      if(lockid<0){
     277        dumpMap(status);
    274278        return ZOO_LOCK_ACQUIRE_FAILED;
     279      }
    275280    }
    276281    FILE* fstatus=fopen(fbkpid,"w");
     
    292297#ifdef WIN32
    293298
    294 #include <windows.h>
    295 #include <fcgi_stdio.h>
    296 #include <stdio.h>
    297 #include <conio.h>
    298 #include <tchar.h>
    299 
    300299#define SHMEMSIZE 4096
    301300
     
    308307  map *tmpMap=getMapFromMaps(conf,"lenv","lid");
    309308  if(tmpMap==NULL)
    310         tmpMap=getMapFromMaps(conf,"lenv","osid");
     309    tmpMap=getMapFromMaps(conf,"lenv","osid");
    311310
    312311  if(tmpMap!=NULL){
    313         snprintf(key, length, "zoo_sem_%s", tmpMap->value);     
     312    snprintf(key, length, "zoo_sem_%s", tmpMap->value);     
    314313  }
    315314  else {
    316         strncpy(key, "-1", length); 
     315    strncpy(key, "-1", length);
    317316  }
    318317  return strlen(key);
     
    321320
    322321semid getShmLockId(maps* conf, int nsems){
    323     semid sem_id;
    324     char key[MAX_PATH];
    325     getKeyValue(conf, key, MAX_PATH);
    326    
    327     sem_id = CreateSemaphore( NULL, nsems, nsems+1, key);
    328     if(sem_id==NULL){
    329 #ifdef DEBUG
    330       fprintf(stderr,"Semaphore failed to create: %s\n", getLastErrorMessage());
    331 #endif
    332       return NULL;
    333     }
    334 #ifdef DEBUG
    335     fprintf(stderr,"%s Accessed !\n",key);
    336 #endif
    337 
    338     return sem_id;
     322  semid sem_id;
     323  char key[MAX_PATH];
     324  getKeyValue(conf, key, MAX_PATH);
     325 
     326  sem_id = CreateSemaphore( NULL, nsems, nsems+1, key);
     327  if(sem_id==NULL){
     328#ifdef DEBUG
     329    fprintf(stderr,"Semaphore failed to create: %s\n", getLastErrorMessage());
     330#endif
     331    return NULL;
     332  }
     333#ifdef DEBUG
     334  fprintf(stderr,"%s Accessed !\n",key);
     335#endif
     336  return sem_id;
    339337}
    340338
Note: See TracChangeset for help on using the changeset viewer.

Search

Context Navigation

ZOO Sponsors

http://www.zoo-project.org/trac/chrome/site/img/geolabs-logo.pnghttp://www.zoo-project.org/trac/chrome/site/img/neogeo-logo.png http://www.zoo-project.org/trac/chrome/site/img/apptech-logo.png http://www.zoo-project.org/trac/chrome/site/img/3liz-logo.png http://www.zoo-project.org/trac/chrome/site/img/gateway-logo.png

Become a sponsor !

Knowledge partners

http://www.zoo-project.org/trac/chrome/site/img/ocu-logo.png http://www.zoo-project.org/trac/chrome/site/img/gucas-logo.png http://www.zoo-project.org/trac/chrome/site/img/polimi-logo.png http://www.zoo-project.org/trac/chrome/site/img/fem-logo.png http://www.zoo-project.org/trac/chrome/site/img/supsi-logo.png http://www.zoo-project.org/trac/chrome/site/img/cumtb-logo.png

Become a knowledge partner

Related links

http://zoo-project.org/img/ogclogo.png http://zoo-project.org/img/osgeologo.png