campo-sirio/include/ccustio.h
alex 980fbadf0b *** empty log message ***
git-svn-id: svn://10.65.10.50/trunk@11841 c028cbd2-c16b-5b4b-a496-9718f37d4682
2004-03-12 14:52:53 +00:00

88 lines
2.4 KiB
C
Executable File

#ifndef __CCUSTIO_H
#define __CCUSTIO_H
#ifdef LINUX
#include <unistd.h>
#include <errno.h>
#endif
#ifndef __CCOMMON_H
#include "ccommon.h"
#endif
#ifndef __GENCONST_H
#include "genconst.h"
#endif
#define BlockLenIO 512
#define Valid 0
#define Deleted 1
typedef char *FileName;
typedef char *RecType;
typedef long RecNoType;
#ifdef __GNUC__
#define __PACKED__ __attribute__ ((packed))
#define __ALIGNED__ __attribute__ ((aligned(2)))
#define __PACK_1__
#else
#define __PACKED__
#define __ALIGNED__
#pragma pack(2)
#endif
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 WIN32
#define TESTLOCK(x) ((x) == 13 || (x) == 11)
#define DEADLOCK(x) ((x) == EDEADLOCK)
#else
#define TESTLOCK(x) (((x) == EACCES) || ((x) == ENOLCK))
#define DEADLOCK(x) (((x) == EDEADLOCK) || ((x) == EDEADLK))
#endif
#define BLOCKEXT(len,rec) (((((RecNoType) (len)) * ((RecNoType) (rec))) / BlockLenIO) + 1)
#ifdef WIN32
#pragma pack()
#endif
#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);*/
int excllock(char *,int);
int exclunlock(char *,int);
// int sleep_dos(int); // Killed by Guy
/* @(:) 2.3.01.325 */
BOOLEAN test_share(void);
#ifdef __cplusplus
};
#endif
#endif /* __CCUSTIO_H */