Changeset 788 for trunk/zoo-project


Ignore:
Timestamp:
Oct 12, 2016, 3:47:26 PM (7 years ago)
Author:
knut
Message:

Implemented support for PHP 7: The Zend API for PHP 7/PHPNG is substantially different from older versions. Therefore, an alternative implementation of zoo_php_support is provided in the new source file service_internal_php7.c. Presently the Zoo kernel can be built with support for either PHP 7 or older versions, see the makefiles (for Windows) nmake.opt and makefile.vc. Other makefiles have not been updated.

Fixed problem with ambiguous symbol in service_conf.y. Fixed problem with conversion of line endings yielding extra bytes in _getStatusFile on Windows platforms. Removed call to free() stack memory in zoo_service_loader.c. Fixed issue with size of structs in service.h.

Location:
trunk/zoo-project
Files:
1 added
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/zoo-project/zoo-kernel/makefile.vc

    r787 r788  
    8888service_internal_php.obj: service_internal_php.c service_internal_php.h service.h
    8989        $(CPP) /c $(CFLAGS) $(PHP_CFLAGS) service_internal_php.c
     90   
     91service_internal_php7.obj: service_internal_php7.c service_internal_php.h service.h
     92        $(CPP) /c $(CFLAGS) $(PHP_CFLAGS) service_internal_php7.c   
    9093
    9194$(LIBZOO_SERVICE): service_internal.obj service.obj sqlapi.obj
  • trunk/zoo-project/zoo-kernel/nmake.opt

    r757 r788  
    1010#PHP_DIR=C:\php-sdk\phpdev\vc12\x86\php-5.5.10-src
    1111#PHP_LIB=$(PHP_DIR)\Release_TS\php5embed.lib
     12#PHP7_DIR=C:\php-sdk\phpdev\vc14\x64\php-7.0.9-src
    1213
    1314#!IF DEFINED(MS_DIR)
     
    5657PHP_FILE=service_internal_php.obj
    5758PHP_CFLAGS=-I$(PHP_SRC) -I$(PHP_SRC)\Zend -I$(PHP_SRC)\TSRM /DPHP_WIN32 /DZEND_WIN32 /DWIN32 /D_USE_32BIT_TIME_T /DZTS /DUSE_PHP
     59!ELSE IFDEF PHP7_DIR
     60PHP_LIB=$(PHP7_DIR)\x64\Release_TS\php7embed.lib
     61PHP_CURL_LIB=
     62PHP_LDFLAGS=$(PHP_LIB) $(PHP_CURL_LIB)
     63PHP_FILE=service_internal_php7.obj
     64PHP_CFLAGS=-I$(PHP7_DIR) -I$(PHP7_DIR)\Zend -I$(PHP7_DIR)\TSRM /DPHP_WIN32 /DZEND_WIN32 /DWIN32 /DZTS /DUSE_PHP # /D_USE_32BIT_TIME_T
    5865!ENDIF
    5966
  • trunk/zoo-project/zoo-kernel/response_print.c

    r785 r788  
    23472347void outputResponse(service* s,maps* request_inputs,maps* request_outputs,
    23482348                    map* request_inputs1,int cpid,maps* m,int res){
     2349               
    23492350#ifdef DEBUG
    23502351  dumpMaps(request_inputs);
     
    23582359  map* version=getMapFromMaps(m,"main","rversion");
    23592360  int vid=getVersionId(version->value);
    2360 
    23612361  maps* tmpSess=getMaps(m,"senv");
    23622362  if(tmpSess!=NULL){
     
    24022402    }
    24032403  }
    2404  
     2404                
    24052405  if(res==SERVICE_FAILED){
    24062406    map *lenv;
     
    24292429    return;
    24302430  }
    2431 
     2431       
    24322432  map *tmp1=getMapFromMaps(m,"main","tmpPath");
    24332433  if(asRaw==0){
  • trunk/zoo-project/zoo-kernel/service.h

    r781 r788  
    143143 * The memory size to create a map
    144144 */
    145 #define MAP_SIZE (2*sizeof(char*))+sizeof(NULL)
     145//#define MAP_SIZE (2*sizeof(char*))+sizeof(NULL) // knut: size of NULL pointer may be different from regular pointer (platform dependent)
     146#define MAP_SIZE (2*sizeof(char*))+sizeof(map*)
    146147/**
    147148 * The memory size to create an iotype
    148149 */
    149 #define IOTYPE_SIZE MAP_SIZE+sizeof(NULL)
     150//#define IOTYPE_SIZE MAP_SIZE+sizeof(NULL)
     151#define IOTYPE_SIZE sizeof(map*) + sizeof(iotype*)
    150152/**
    151153 * The memory size to create a maps
    152154 */
    153 #define MAPS_SIZE (2*sizeof(char*))+sizeof(map*)+MAP_SIZE
     155//#define MAPS_SIZE (2*sizeof(char*))+sizeof(map*)+MAP_SIZE
     156#define MAPS_SIZE sizeof(char*)+sizeof(map*)+sizeof(maps*)
    154157/**
    155158 * The memory size to create a service
    156159 */
    157 #define SERVICE_SIZE (ELEMENTS_SIZE*2)+(MAP_SIZE*2)+sizeof(char*)
     160//#define SERVICE_SIZE (ELEMENTS_SIZE*2)+(MAP_SIZE*2)+sizeof(char*)
     161#define SERVICE_SIZE sizeof(char*) + 2*sizeof(map*) + 2*sizeof(elements*)
    158162/**
    159163 * The memory size to create a services
    160164 */
    161 #define SERVICES_SIZE SERVICE_SIZE+sizeof(services*)
     165//#define SERVICES_SIZE SERVICE_SIZE+sizeof(services*)
     166#define SERVICES_SIZE sizeof(service*)+sizeof(services*)
    162167/**
    163168 * The memory size to create a registry
    164169 */
    165 #define REGISTRY_SIZE SERVICES_SIZE+sizeof(char*)
     170//#define REGISTRY_SIZE SERVICES_SIZE+sizeof(char*)
     171#define REGISTRY_SIZE sizeof(char*)+sizeof(services*)+sizeof(registry*)
    166172
    167173#define SHMSZ     27
  • trunk/zoo-project/zoo-kernel/service_conf.y

    r781 r788  
    553553  fprintf(stderr,"processid (%s %d) %s\n",__FILE__,__LINE__,$1);
    554554#endif
    555   if(data==-1){
    556     data=1;
     555//  if(data==-1){
     556//    data=1;
     557  if(::data==-1){ // knut: add namespace to avoid ambiguous symbol
     558    ::data=1;   
    557559    if($1!=NULL){
    558560      char *cen=zStrdup($1);
     
    795797  wait_outputs=-1;
    796798  wait_data=false;
    797   data=-1;
     799//data=-1;
     800  ::data=-1; // knut: add namespace to avoid ambiguous symbol
    798801  previous_data=1;
    799802  current_data=0;
  • trunk/zoo-project/zoo-kernel/service_internal.c

    r781 r788  
    147147    }
    148148
    149     FILE* f0 = fopen (fileName, "r");
     149    //FILE* f0 = fopen (fileName, "r");
     150        // knut: open file in binary mode to avoid conversion of line endings (yielding extra bytes) on Windows platforms
     151        FILE* f0 = fopen(fileName, "rb");
    150152    if(f0!=NULL){
    151153      fseek (f0, 0, SEEK_END);
     
    260262 */
    261263int _updateStatus(maps *conf){
     264       
    262265  map* r_inputs = getMapFromMaps (conf, "main", "tmpPath");
    263266  map* sid = getMapFromMaps (conf, "lenv", "usid");
     267 
    264268  char* fbkpid =
    265269    (char *)
     
    272276     strlen(status->value)>0 && strlen(msg->value)>1){   
    273277    semid lockid = NULL;
     278       
    274279    char* stat=getStatusId(conf,sid->value);
    275280    if(stat!=NULL){
     
    291296    }
    292297  }
     298
    293299  return 0;
    294300}
  • trunk/zoo-project/zoo-kernel/zoo_service_loader.c

    r784 r788  
    2222 * THE SOFTWARE.
    2323 */
    24 
     24 
    2525extern "C" int yylex ();
    2626extern "C" int crlex ();
     
    104104extern char **environ;
    105105#endif
     106
    106107
    107108#ifdef WIN32
     
    668669      *eres =
    669670        zoo_php_support (&m, request_inputs, s1, &request_input_real_format,
    670                          &request_output_real_format);
     671                         &request_output_real_format);         
    671672    }
    672673  else
     
    890891runRequest (map ** inputs)
    891892{
    892 
     893 
    893894#ifndef USE_GDB
    894895#ifndef WIN32
     
    940941#endif
    941942#endif
     943
    942944  if (conf_read (conf_file, m) == 2)
    943945    {
     
    16211623    return 0;
    16221624  }
    1623  
    16241625  s1 = NULL;
    16251626  s1 = (service *) malloc (SERVICE_SIZE);
     
    19951996  dumpMap (request_inputs);
    19961997#endif
    1997 
    19981998  int ei = 1;
    19991999  char *s =
     
    20462046  }
    20472047#endif
     2048
    20482049  char *fbkp, *fbkpid, *fbkpres, *fbkp1, *flog;
    20492050  FILE *f0, *f1;
     
    20682069        return -1;
    20692070      }
    2070 
    20712071      loadServiceAndRun (&m, s1, request_inputs, &request_input_real_format,
    20722072                         &request_output_real_format, &eres);
     
    21242124            (char *)
    21252125            malloc ((strlen (r_inputs->value) +
    2126                      strlen (usid->value) + 7) * sizeof (char));
     2126                     strlen (usid->value) + 7) * sizeof (char));                   
    21272127          sprintf (fbkpres, "%s/%s.res", r_inputs->value, usid->value);
    21282128          bmap = (maps *) malloc (MAPS_SIZE);
     
    22582258  dumpMaps (request_output_real_format);
    22592259#endif
     2260
    22602261  if (eres != -1)
    22612262    outputResponse (s1, request_input_real_format,
     
    22632264                    cpid, m, eres);
    22642265  fflush (stdout);
    2265  
     2266
    22662267  /**
    22672268   * Ensure that if error occurs when freeing memory, no signal will return
     
    22772278  signal (SIGABRT, donothing);
    22782279#endif
    2279  
     2280
    22802281  if (((int) getpid ()) != cpid || cgiSid != NULL)
    22812282    {
     
    22882289      if(dumpBackFinalFile(m,fbkp,fbkp1)<0)
    22892290        return -1;
    2290 
    22912291      unlink (fbkpid);
    22922292      switch(eres){
     
    23002300        setMapInMaps(m,"lenv","fstate",wpsStatus[0]);
    23012301        break;
    2302       }
     2302      }     
    23032303#ifndef RELY_ON_DB
    23042304      dumpMapsToFile(bmap,fbkpres,1);
     
    23132313      unhandleStatus (m);
    23142314      free(fbkpid);
    2315       free(fbkpres);
    2316       free (flog);
     2315      free(fbkpres); 
     2316      free (flog);           
    23172317      free (fbkp1);
    2318       free (tmps1);
     2318      // free (tmps1); // tmps1 is stack memory and should not be freed
    23192319      if(cgiSid!=NULL)
    23202320        free(cgiSid);
  • trunk/zoo-project/zoo-services/utils/status/service.c

    r777 r788  
    2222 * THE SOFTWARE.
    2323 */
     24
    2425
    2526#include "service.h"
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