1995-09-11 15:31:07 +00:00
|
|
|
#ifndef __CCUSTIO_H
|
|
|
|
#define __CCUSTIO_H
|
|
|
|
|
|
|
|
#ifndef DOS
|
|
|
|
#include <unistd.h>
|
1998-03-05 13:54:51 +00:00
|
|
|
#include <errno.h>
|
1995-09-11 15:31:07 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef __CCOMMON_H
|
|
|
|
#include "ccommon.h"
|
|
|
|
#endif
|
|
|
|
#ifndef __GENCONST_H
|
|
|
|
#include "genconst.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define BlockLenIO 512
|
1998-03-05 13:54:51 +00:00
|
|
|
#define Valid 0
|
1995-09-11 15:31:07 +00:00
|
|
|
#define Deleted 1
|
|
|
|
|
|
|
|
typedef char *FileName;
|
|
|
|
typedef char *RecType;
|
|
|
|
typedef long RecNoType;
|
|
|
|
typedef struct {
|
|
|
|
int F;
|
|
|
|
FILE *Fd;
|
|
|
|
int IOR;
|
|
|
|
int LenRec;
|
|
|
|
int BaseFil;
|
|
|
|
unsigned LockMode;
|
|
|
|
RecNoType lpos;
|
|
|
|
PathSt name;
|
|
|
|
/* @(!) 2.3.01.325 */
|
|
|
|
RecNoType lkpos;
|
|
|
|
/* @(:) 2.3.01.325 */
|
|
|
|
} SecDef ;
|
|
|
|
|
|
|
|
#ifdef DOS
|
1998-03-05 13:54:51 +00:00
|
|
|
#define TESTLOCK(x) ((x) == 13 || (x) == 11)
|
|
|
|
#define DEADLOCK(x) ((x) == EDEADLOCK)
|
1995-09-11 15:31:07 +00:00
|
|
|
#else
|
1998-03-05 13:54:51 +00:00
|
|
|
#define TESTLOCK(x) (((x) == EACCES) || ((x) == EGAIN) || ((x) == ENOLCK))
|
1995-09-11 15:31:07 +00:00
|
|
|
#define DEADLOCK(x) (((x) == EDEADLOCK) || ((x) == EDEADLK))
|
|
|
|
#endif
|
|
|
|
#define BLOCKEXT(len,rec) (((((RecNoType) (len)) * ((RecNoType) (rec))) / BlockLenIO) + 1)
|
|
|
|
|
|
|
|
/* @(!) 2.3.01.325 */
|
|
|
|
#ifdef DOS
|
1998-03-05 13:54:51 +00:00
|
|
|
//#define ASPETTA(x) (sleep_dos(x))
|
1995-09-11 15:31:07 +00:00
|
|
|
#else
|
1998-03-05 13:54:51 +00:00
|
|
|
//#define ASPETTA(x) (sleep(x))
|
1995-09-11 15:31:07 +00:00
|
|
|
#endif
|
|
|
|
/* @(:) 2.3.01.325 */
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
void CLockRec(SecDef *, RecNoType, unsigned);
|
|
|
|
void CVerify(SecDef *,char *);
|
|
|
|
void COpen(SecDef *,char *, unsigned, unsigned, unsigned);
|
|
|
|
void CCreate(SecDef *,char *,unsigned ,unsigned ,RecNoType);
|
|
|
|
void CChsize(SecDef *,char *,unsigned ,unsigned ,RecNoType);
|
|
|
|
void CClose(SecDef *);
|
|
|
|
void CDelete(SecDef *,char *);
|
|
|
|
void CRead(SecDef *,RecType,RecNoType ,unsigned );
|
|
|
|
void CWrite(SecDef *,RecType,RecNoType ,unsigned );
|
|
|
|
void IDeleteRec(RecType);
|
|
|
|
void IRecallRec(RecType);
|
|
|
|
BOOLEAN IRecIsDeleted(RecType);
|
|
|
|
BOOLEAN ITestLock(int );
|
|
|
|
/* @(!) 2.3.01.325 modificata int excllock(char *,BOOLEAN);*/
|
|
|
|
/* @(!) 2.3.01.325 modificata int exclunlock(char *,BOOLEAN);*/
|
1998-03-05 13:54:51 +00:00
|
|
|
int excllock(char *,int);
|
|
|
|
int exclunlock(char *,int);
|
1995-09-11 15:31:07 +00:00
|
|
|
int sleep_dos(int);
|
|
|
|
/* @(:) 2.3.01.325 */
|
|
|
|
BOOLEAN test_share(void);
|
|
|
|
#ifdef __cplusplus
|
|
|
|
};
|
|
|
|
#endif
|
|
|
|
#endif /* __CCUSTIO_H */
|