Ignore:
Timestamp:
May 7, 2019, 2:17:08 PM (5 years ago)
Author:
djay
Message:

Merge prototype-v0 branch in trunk

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/zoo-project/zoo-kernel/service_internal.h

    r680 r917  
    6363 * Number of time the ZOO-Kernel will try to acquire lock
    6464 */
    65 #define ZOO_LOCK_MAX_RETRY 10
     65#define ZOO_LOCK_MAX_RETRY 180
    6666
    6767#include <sys/stat.h>
    6868#include <sys/types.h>
    69 #include "cgic.h"
    7069#ifndef WIN32
    7170#include <sys/ipc.h>
     
    8281#endif
    8382#ifndef WIN32
    84 #include <xlocale.h>
     83#include <locale.h>
    8584#endif
    8685
     86#include <fcntl.h>
     87 
    8788#include "service.h"
    8889
     
    9495#endif
    9596
     97#ifdef WIN32
     98// fcntl flock definitions
     99#define F_SETLK  8   // Non-Blocking set or clear a lock
     100#define F_SETLKW 9   // Blocking set or clear a lock
     101#define F_GETLK 10
     102#define F_RDLCK  1   // read lock
     103#define F_WRLCK  2   // write lock
     104#define F_UNLCK  3   // remove lock
     105struct flock {
     106    short l_type;   // F_RDLCK, F_WRLCK, or F_UNLCK
     107    short l_whence; // flag to choose starting offset, must be SEEK_SET
     108    long  l_start;  // relative offset, in bytes, must be 0
     109    long  l_len;    // length, in bytes; 0 means lock to EOF, must be 0
     110    short l_pid;    // unused (returned with the unsupported F_GETLK)
     111    short l_xxx;    // reserved for future use
     112};
     113#endif
     114
     115/**
     116 * The lock structure used by the ZOO-Kernel to ensure atomicity of operations
     117 *
     118 */
     119typedef struct zooLock{
     120  struct flock lock; //!< The lock
     121  FILE* lockfile;    //!< The pointer to the lock file
     122  char* filename;    //!< The filename to lock
     123} zooLock;
     124
     125static zooLock** zoo_file_locks=NULL;
     126static int zoo_file_locks_cnt=0;
     127
    96128#ifdef __cplusplus
    97129extern "C" {
    98130#endif
    99131
     132 
    100133  ZOO_DLL_EXPORT char *readVSIFile(maps*,const char*);
    101134  ZOO_DLL_EXPORT int  setOutputValue( maps*, const char*, char*, size_t);
    102135  ZOO_DLL_EXPORT char* getInputValue( maps*,const char*,size_t*);
     136
     137  ZOO_DLL_EXPORT struct zooLock* lockFile(maps*,const char*,const char);
     138  ZOO_DLL_EXPORT int unlockFile(maps*,struct zooLock*);
    103139
    104140  ZOO_DLL_EXPORT void unhandleStatus(maps*);
     
    125161  ZOO_DLL_EXPORT int unlockShm(semid);
    126162
     163  ZOO_DLL_EXPORT char* file_exists(const char* dir, const char* name);
     164
    127165#ifdef __cplusplus
    128166}
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