ZOO-Project
|
#include "cpl_vsi.h"
#include "service_internal.h"
#include "service_callback.h"
#include "dirent.h"
Data Structures | |
union | semun |
arg for semctl system calls. More... | |
Macros | |
#define | _LARGEFILE64_SOURCE 1 |
#define | ERROR_MSG_MAX_LENGTH 1024 |
#define | MAX_RETRIES 10 |
Number of time to try to access a semaphores set. More... | |
Functions | |
struct zooLock * | lockFile (maps *conf, const char *filename, const char mode) |
Lock a file for read, write and upload. More... | |
int | unlockFile (maps *conf, struct zooLock *s) |
Remove a lock. More... | |
char * | getStatusId (maps *conf, char *pid) |
Read the sid file attached of a service if any. More... | |
semid | acquireLock (maps *conf) |
Acquire the global lock. More... | |
char * | _getStatusFile (maps *conf, char *pid) |
Read the cache file of a running service. More... | |
char * | _getStatus (maps *conf, char *lid) |
Get the ongoing status of a running service. More... | |
void | unhandleStatus (maps *conf) |
Stop handling status repport. More... | |
int | _updateStatus (maps *conf) |
Update the current status of the running service. More... | |
int | getKeyValue (maps *conf) |
Set in the pre-allocated key the zoo_sem_[OSID] string where [OSID] is the lid (if any) or osid value from the [lenv] section. More... | |
int | getShmLockId (maps *conf, int nsems) |
Try to create or access a semaphore set. More... | |
int | removeShmLock (maps *conf, int nsems) |
Try to remove a semaphore set. More... | |
int | lockShm (int id) |
Lock a semaphore set. More... | |
int | unlockShm (int id) |
unLock a semaphore set. More... | |
char * | getStatus (int pid) |
Get the current status of the running service. More... | |
int | updateStatus (maps *conf, const int percentCompleted, const char *message) |
Update the status of an ongoing service. More... | |
char * | getInputValue (maps *inputs, const char *parameterName, size_t *numberOfBytes) |
Access an input value. More... | |
char * | readVSIFile (maps *conf, const char *dataSource) |
Read a file using the GDAL VSI API. More... | |
int | setOutputValue (maps *outputs, const char *parameterName, char *data, size_t numberOfBytes) |
Set an output value. More... | |
char * | file_exists (const char *dir, const char *name) |
Check if file exists in specified folder. More... | |
Data Structure Documentation
union semun |
Macro Definition Documentation
#define _LARGEFILE64_SOURCE 1 |
#define ERROR_MSG_MAX_LENGTH 1024 |
#define MAX_RETRIES 10 |
Number of time to try to access a semaphores set.
- See also
- getShmLockId
Function Documentation
char* _getStatus | ( | maps * | conf, |
char * | lid | ||
) |
Get the ongoing status of a running service.
- Parameters
-
conf the maps containing the setting of the main.cfg file pid the service identifier (usid key from the [lenv] section)
- Returns
- the reported status char* (MESSAGE|POURCENTAGE)
char* _getStatusFile | ( | maps * | conf, |
char * | pid | ||
) |
Read the cache file of a running service.
- Parameters
-
conf the maps containing the setting of the main.cfg file pid the service identifier (usid key from the [lenv] section)
- Returns
- the reported status char* (temporary/final result)
int _updateStatus | ( | maps * | conf | ) |
Update the current status of the running service.
- See also
- acquireLock, lockShm
- Parameters
-
conf the map containing the setting of the main.cfg file
- Returns
- 0 on success, -2 if shmget failed, -1 if shmat failed
Acquire the global lock.
- Parameters
-
conf the maps containing the setting of the main.cfg file
- Returns
- a semid
char* file_exists | ( | const char * | dir, |
const char * | name | ||
) |
Check if file exists in specified folder.
- Parameters
-
dir the folder in which to search for file name the name of the file (not full path)
- Returns
- a character string with the full path [dir/name], or NULL if the file does not exist
- Attention
- Caller is responsible for applying free() to the returned pointer
char* getInputValue | ( | maps * | inputs, |
const char * | parameterName, | ||
size_t * | numberOfBytes | ||
) |
Access an input value.
- Parameters
-
inputs the maps to search for the input value parameterName the input name to fetch the value numberOfBytes the resulting size of the value to add (for binary values), -1 for basic char* data
- Returns
- a pointer to the input value if found, NULL in other case.
int getKeyValue | ( | maps * | conf | ) |
Set in the pre-allocated key the zoo_sem_[OSID] string where [OSID] is the lid (if any) or osid value from the [lenv] section.
- Parameters
-
conf the map containing the setting of the main.cfg file
int getShmLockId | ( | maps * | conf, |
int | nsems | ||
) |
Try to create or access a semaphore set.
- See also
- getKeyValue
- Parameters
-
conf the map containing the setting of the main.cfg file nsems number of semaphores
- Returns
- a semaphores set indentifier on success, -1 in other case
char* getStatus | ( | int | pid | ) |
Get the current status of the running service.
- See also
- getKeyValue, getShmLockId, lockShm
- Parameters
-
pid the semaphores
- Returns
- 0 on success, -2 if shmget failed, -1 if shmat failed
char* getStatusId | ( | maps * | conf, |
char * | pid | ||
) |
Read the sid file attached of a service if any.
- Parameters
-
conf the maps containing the setting of the main.cfg file pid the service identifier (usid key from the [lenv] section)
- Returns
- the reported status char* (temporary/final result)
Lock a file for read, write and upload.
- Parameters
-
conf the main configuration maps filename the file to lock mode define access: 'r' for read, 'w' for write
- Returns
- a new zooLock structure on sucess, NULL on failure
int lockShm | ( | int | id | ) |
Lock a semaphore set.
- Parameters
-
id the semaphores set indetifier
- Returns
- 0 if the semaphore can be locked, -1 in other case.
char* readVSIFile | ( | maps * | conf, |
const char * | dataSource | ||
) |
Read a file using the GDAL VSI API.
- Parameters
-
conf the maps containing the settings of the main.cfg file dataSource the datasource name to read
- Warning
- make sure to free resources returned by this function
int removeShmLock | ( | maps * | conf, |
int | nsems | ||
) |
Try to remove a semaphore set.
- Parameters
-
conf the map containing the setting of the main.cfg file nsems number of semaphores
- Returns
- 0 if the semaphore can be removed, -1 in other case.
int setOutputValue | ( | maps * | outputs, |
const char * | parameterName, | ||
char * | data, | ||
size_t | numberOfBytes | ||
) |
Set an output value.
- Parameters
-
outputs the maps to define the output value parameterName the output name to set the value data the value to set numberOfBytes size of the value to add (for binary values), -1 for basic char* data
- Returns
- 0
void unhandleStatus | ( | maps * | conf | ) |
Stop handling status repport.
- Parameters
-
conf the map containing the setting of the main.cfg file
Remove a lock.
- Parameters
-
conf the main configuration maps s the zooLock structure
- Returns
- 0 on success, -1 on failure.
int unlockShm | ( | int | id | ) |
unLock a semaphore set.
- Parameters
-
id the semaphores set indetifier
- Returns
- 0 if the semaphore can be locked, -1 in other case.
int updateStatus | ( | maps * | conf, |
const int | percentCompleted, | ||
const char * | message | ||
) |
Update the status of an ongoing service.
- Parameters
-
conf the maps containing the settings of the main.cfg file percentCompleted percentage of completude of execution of the service message information about the current step executed
- Returns
- the value of _updateStatus
- See also
- _updateStatus
Generated on Wed Feb 5 2025 13:01:44 for ZOO-Project by 1.8.9.1