Changeset 680 for trunk/zoo-project/zoo-kernel/service_internal.c
- Timestamp:
- Jun 24, 2015, 1:58:17 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/zoo-project/zoo-kernel/service_internal.c
r654 r680 23 23 */ 24 24 25 #include "fcgi_stdio.h"26 25 #include "service_internal.h" 27 26 #ifdef USE_MS … … 90 89 ){ 91 90 #ifdef WIN32 92 return NULL 91 return NULL; 93 92 #else 94 93 return -1; … … 96 95 } 97 96 if(lockShm(lockid)<0){ 97 #ifdef WIN32 98 return NULL; 99 #else 98 100 if(itn<ZOO_LOCK_MAX_RETRY){ 99 101 itn++; 100 102 goto toRetry1; 101 103 }else 102 #ifdef WIN32 103 return NULL 104 #else 105 return -1; 104 return -1; 106 105 #endif 107 106 }else … … 211 210 free(fbkpid); 212 211 if(stat!=NULL){ 212 #ifndef WIN32 213 213 removeShmLock(conf,1); 214 #else 215 unlockShm(lockid); 216 #endif 214 217 free(stat); 215 218 } … … 271 274 if(stat!=NULL){ 272 275 lockid=acquireLock(conf); 273 if(lockid<0) 276 if(lockid<0){ 277 dumpMap(status); 274 278 return ZOO_LOCK_ACQUIRE_FAILED; 279 } 275 280 } 276 281 FILE* fstatus=fopen(fbkpid,"w"); … … 292 297 #ifdef WIN32 293 298 294 #include <windows.h>295 #include <fcgi_stdio.h>296 #include <stdio.h>297 #include <conio.h>298 #include <tchar.h>299 300 299 #define SHMEMSIZE 4096 301 300 … … 308 307 map *tmpMap=getMapFromMaps(conf,"lenv","lid"); 309 308 if(tmpMap==NULL) 310 309 tmpMap=getMapFromMaps(conf,"lenv","osid"); 311 310 312 311 if(tmpMap!=NULL){ 313 312 snprintf(key, length, "zoo_sem_%s", tmpMap->value); 314 313 } 315 314 else { 316 strncpy(key, "-1", length); 315 strncpy(key, "-1", length); 317 316 } 318 317 return strlen(key); … … 321 320 322 321 semid 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; 339 337 } 340 338
Note: See TracChangeset
for help on using the changeset viewer.