Changeset 384 for trunk/zoo-project/zoo-kernel/service_internal.c
- Timestamp:
- Jan 9, 2013, 11:52:44 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/zoo-project/zoo-kernel/service_internal.c
r383 r384 78 78 79 79 void updateStatus(maps *conf){ 80 fprintf(stderr,"OK Final 1 \n"); 81 fflush(stderr); 82 LPWSTR lpszTmp; 83 BOOL fInit; 84 char *s=NULL; 85 map *tmpMap=getMapFromMaps(conf,"lenv","sid"); 86 fprintf(stderr,"OK Final 11 \n"); 87 fflush(stderr); 88 if(hMapObjectG==NULL) 89 hMapObjectG = CreateFileMapping( 90 INVALID_HANDLE_VALUE, // use paging file 91 NULL, // default security attributes 92 PAGE_READWRITE, // read/write access 93 0, // size: high 32-bits 94 SHMEMSIZE, // size: low 32-bits 95 TEXT(tmpMap->value)); // name of map object 96 if (hMapObjectG == NULL){ 97 fprintf(stderr,"Unable to create share memory segment %s !! \n",tmpMap->value); 98 return ; 99 } 100 fprintf(stderr,"OK Final 2 \n"); 101 fflush(stderr); 102 fInit = (GetLastError() != ERROR_ALREADY_EXISTS); 103 if(lpvMemG==NULL) 104 lpvMemG = MapViewOfFile( 105 hMapObjectG, // object to map view of 106 FILE_MAP_WRITE, // read/write access 107 0, // high offset: map from 108 0, // low offset: beginning 109 0); // default: map entire file 110 if (lpvMemG == NULL){ 111 fprintf(stderr,"Unable to create or access the shared memory segment %s !! \n",tmpMap->value); 112 return ; 113 } 114 fprintf(stderr,"OK Final 3 \n"); 115 fflush(stderr); 116 if (fInit) 117 memset(lpvMemG, '\0', SHMEMSIZE); 118 fprintf(stderr,"OK Final 4 \n"); 119 fflush(stderr); 120 tmpMap=getMapFromMaps(conf,"lenv","status"); 121 lpszTmp = (LPWSTR) lpvMemG; 122 for(s=tmpMap->value;*s!=NULL;s++) 123 *lpszTmp++ = *s; 124 *lpszTmp = '\0'; 80 LPWSTR lpszTmp; 81 BOOL fInit; 82 char *s=NULL; 83 map *tmpMap=getMapFromMaps(conf,"lenv","sid"); 84 if(hMapObjectG==NULL) 85 hMapObjectG = CreateFileMapping( 86 INVALID_HANDLE_VALUE, // use paging file 87 NULL, // default security attributes 88 PAGE_READWRITE, // read/write access 89 0, // size: high 32-bits 90 SHMEMSIZE, // size: low 32-bits 91 TEXT(tmpMap->value)); // name of map object 92 if (hMapObjectG == NULL){ 93 fprintf(stderr,"Unable to create share memory segment %s !! \n",tmpMap->value); 94 return ; 95 } 96 fInit = (GetLastError() != ERROR_ALREADY_EXISTS); 97 if(lpvMemG==NULL) 98 lpvMemG = MapViewOfFile( 99 hMapObjectG, // object to map view of 100 FILE_MAP_WRITE, // read/write access 101 0, // high offset: map from 102 0, // low offset: beginning 103 0); // default: map entire file 104 if (lpvMemG == NULL){ 105 fprintf(stderr,"Unable to create or access the shared memory segment %s !! \n",tmpMap->value); 106 return ; 107 } 108 if (fInit) 109 memset(lpvMemG, '\0', SHMEMSIZE); 110 tmpMap=getMapFromMaps(conf,"lenv","status"); 111 lpszTmp = (LPWSTR) lpvMemG; 112 for(s=tmpMap->value;*s!=NULL;s++) 113 *lpszTmp++ = *s; 114 *lpszTmp = '\0'; 125 115 } 126 116 … … 159 149 return "-1"; 160 150 lpszTmp = (LPWSTR) lpvMem; 161 while (*lpszTmp!=NULL) 162 *lpszBuf++ = *lpszTmp++; 163 *lpszBuf = '\0'; 164 fIgnore = UnmapViewOfFile(lpvMem); 165 fIgnore = CloseHandle(hMapObject); 166 return (char*)lpszBuf; 151 return (char*)lpszTmp; 167 152 } 168 153 … … 1391 1376 char *encoding=getEncoding(m); 1392 1377 if(pid==getpid()){ 1378 printHeaders(m); 1393 1379 printf("Content-Type: text/xml; charset=%s\r\nStatus: 200 OK\r\n\r\n",encoding); 1394 1380 } … … 1745 1731 xmlNodePtr n; 1746 1732 1747 printHeaders(m);1748 1733 doc = xmlNewDoc(BAD_CAST "1.0"); 1749 1734 maps* tmpMap=getMaps(m,"main"); … … 1752 1737 map *tmpSid=getMapFromMaps(m,"lenv","sid"); 1753 1738 if(tmpSid!=NULL){ 1754 if( getpid()==atoi(tmpSid->value) ) 1739 if( getpid()==atoi(tmpSid->value) ){ 1740 printHeaders(m); 1755 1741 printf("Content-Type: text/xml; charset=%s\r\nStatus: 200 OK\r\n\r\n",encoding); 1756 } 1757 else 1742 } 1743 } 1744 else{ 1745 printHeaders(m); 1758 1746 printf("Content-Type: text/xml; charset=%s\r\nStatus: 200 OK\r\n\r\n",encoding); 1747 } 1759 1748 }else 1760 1749 printf("Content-Type: text/xml; charset=%s\r\nStatus: 200 OK\r\n\r\n",encoding); … … 1862 1851 } 1863 1852 1864 printHeaders(m);1865 1866 1853 if(asRaw==0){ 1867 1854 #ifdef DEBUG … … 2007 1994 if(rs!=NULL) 2008 1995 printf("Content-Length: %s\r\n",rs->value); 2009 1996 printHeaders(m); 2010 1997 char mime[1024]; 2011 1998 map* mi=getMap(tmpI->content,"mimeType");
Note: See TracChangeset
for help on using the changeset viewer.