xrootd
Main Page
Namespaces
Classes
Files
File List
File Members
src
XrdCns
XrdCnsLogFile.hh
Go to the documentation of this file.
1
#ifndef __XRDCnsLogFile_H_
2
#define __XRDCnsLogFile_H_
3
/******************************************************************************/
4
/* */
5
/* X r d C n s L o g F i l e . h h */
6
/* */
7
/* (c) 2009 by the Board of Trustees of the Leland Stanford, Jr., University */
8
/* All Rights Reserved */
9
/* Produced by Andrew Hanushevsky for Stanford University under contract */
10
/* DE-AC02-76-SFO0515 with the Department of Energy */
11
/******************************************************************************/
12
13
// $Id$
14
15
#include "
XrdCns/XrdCnsLogRec.hh
"
16
#include "
XrdSys/XrdSysPthread.hh
"
17
18
class
XrdCnsLogFile
19
{
20
public
:
21
22
XrdCnsLogFile
*
Next
;
23
24
int
Add
(
XrdCnsLogRec
*
Rec
,
int
doSync=1);
25
26
int
Commit
();
27
28
int
Eol
();
29
30
const
char
*
FName
() {
return
logFN
;}
31
32
char
*
getLog
(
int
&Dlen) {Dlen =
logNext
-
logBuff
;
return
logBuff
;}
33
34
XrdCnsLogRec
*
getRec
();
35
36
static
void
maxRecs
(
int
nRecs) {
logRMax
= nRecs;
37
logBMax
= nRecs *
sizeof
(
XrdCnsLogRec
);
38
}
39
40
int
Open
(
int
aBuff=1, off_t thePos=0);
41
42
XrdCnsLogFile
*
Subscribe
(
const
char
*
Path
,
int
cNum);
43
44
int
Unlink
();
45
46
XrdCnsLogFile
(
const
char
*
Path
,
int
cnum=0,
int
Wait=1)
47
:
Next
(0),
logSem
(0),
subNext
(0),
48
logBuff
(0),
logNext
(0),
logFN
(strdup(Path)),
49
logFD
(-1),
logRdr
(cnum),
logWait
(Wait),
50
logOffset
(0),
recOffset
(0) {}
51
~XrdCnsLogFile
();
52
53
private
:
54
int
Read
(
char
*buff,
int
blen);
55
56
static
int
logRMax
;
57
static
int
logBMax
;
58
59
XrdSysMutex
logMutex
;
60
XrdSysSemaphore
logSem
;
61
XrdSysSemaphore
synSem
;
62
XrdCnsLogFile
*
subNext
;
63
64
XrdCnsLogRec
Rec
;
65
66
char
*
logBuff
;
67
char
*
logNext
;
68
69
char
*
logFN
;
70
int
logFD
;
71
int
logRdr
;
72
int
logWait
;
73
int
logOffset
;
74
int
recOffset
;
75
};
76
#endif
Generated by
1.8.1.2