File: sacct.h

package info (click to toggle)
dpm-postgres 1.7.4.7-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 13,788 kB
  • ctags: 10,782
  • sloc: ansic: 146,136; sh: 13,362; perl: 11,142; python: 5,529; cpp: 5,113; sql: 1,790; makefile: 955; fortran: 113
file content (453 lines) | stat: -rw-r--r-- 11,362 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
/*
 * $Id: sacct.h,v 1.3 2008/01/10 08:27:59 dhsmith Exp $
 */

/*
 * Copyright (C) 1994-2002 by CERN/IT/PDP/DM
 * All rights reserved
 */

/*
 * @(#)$RCSfile: sacct.h,v $ $Revision: 1.3 $ $Date: 2008/01/10 08:27:59 $ CERN IT-PDP/DM   Jean-Philippe Baud
 */
/* Include file for CASTOR software accounting */

#include "Castor_limits.h"
#if defined(OLD_STAGER)
#include "stage_limits.h"
#endif
#include "osdep.h"

struct accthdr {	/* header for accounting record */
	time_t	timestamp;
	int	package;
	int	len;
};

			/* package identifiers */

#define ACCTSYSTEM      0
#define	ACCTRFIO	1
#define	ACCTTAPE	2
#define	ACCTRTCOPY	3
#define	ACCTSTAGE	4
#define	ACCTNQS		5
#define ACCTRTCPTIM     6
#define	ACCTSTAGE2	7
#define	ACCTSTAGE64	8
#define	ACCTRFIO64	11
#define	ACCTRFIO64IPV46	12

struct  acctsystem      {
	int     subtype;
};

#ifndef MAXPATH
#define MAXPATH 80
#endif

struct acctrfio {       /* accounting record for rfio software */
	int	reqtype;
        int     uid;
        int     gid;
        int     jid;
        int     accept_socket;
        union {
	  struct {
	    int     flag1;
	    int     flag2;
	  } anonymous;
	  struct {
	    int     flags;
	    int     mode;
	  } accesstypes;
	  struct {
	    int     owner;
	    int     group;
	  } chowntype;
	  struct {
	    int     function;
	    int     operation;
	  } lockftype;
	} flags;
        int     nb_read;
        int     nb_write;
        int     nb_ahead;
        int     nb_stat;
        int     nb_seek;
        int     nb_preseek;
        int     read_size;
        int     write_size;
        int     remote_addr;
        int     local_addr;
        int     status;
        int     rc;
        int     len1;
        int     len2;
        char    filename[2*MAXPATH+1];
};

struct acctrfio64 {       /* accounting record for rfio64 software */
	int	reqtype;
        int     uid;
        int     gid;
        int     jid;
        int     accept_socket;
        union {
	  struct {
	    int     flag1;
	    int     flag2;
	  } anonymous;
	  struct {
	    int     flags;
	    int     mode;
	  } accesstypes;
	  struct {
	    int     owner;
	    int     group;
	  } chowntype;
	  struct {
	    int     function;
	    int     operation;
	  } lockftype;
	} flags;
        int     nb_read;
        int     nb_write;
        int     nb_ahead;
        int     nb_stat;
        int     nb_seek;
        int     nb_preseek;
        int     padding;
        signed64 read_size;
        signed64 write_size;
        int     remote_addr;
        int     local_addr;
        int     status;
        int     rc;
        int     len1;
        int     len2;
        char    filename[2*MAXPATH+1];
};

struct acctrfio64ipv46 {       /* accounting record for rfio64 IPv4/6 enabled software */
	int	reqtype;
        int     uid;
        int     gid;
        int     jid;
        int     accept_socket;
        union {
	  struct {
	    int     flag1;
	    int     flag2;
	  } anonymous;
	  struct {
	    int     flags;
	    int     mode;
	  } accesstypes;
	  struct {
	    int     owner;
	    int     group;
	  } chowntype;
	  struct {
	    int     function;
	    int     operation;
	  } lockftype;
	} flags;
        int     nb_read;
        int     nb_write;
        int     nb_ahead;
        int     nb_stat;
        int     nb_seek;
        int     nb_preseek;
        int     padding;
        signed64 read_size;
        signed64 write_size;
        int     af;
        union {
          struct {
            int     remote_addr;
            int     local_addr;
            unsigned char padding[24];
          } ipv4;
          struct {
            unsigned char remote_addr[16];
            unsigned char local_addr[16];
          } ipv6;
        } addr;
        int     status;
        int     rc;
        int     len1;
        int     len2;
        char    filename[2*MAXPATH+1];
};

struct accttape {	/* accounting record for tape software */
	int	subtype;
#if defined(_WIN32)
	int     uid;
	int     gid;
#else
	uid_t	uid;
	gid_t	gid;
#endif /* _WIN32 */
	int	jid;
	char	filler[16];
	char	dgn[CA_MAXDGNLEN+1];	/* CART, 8500, SMCF... */
	char	drive[CA_MAXUNMLEN+1];	/* drive name */
	char	vid[CA_MAXVIDLEN+1];
	int	fseq;
	int	reason;
};

			/* subtypes for system records */

#define SYSSHUTDOWN     0
#define SYSSTARTUP      1

			/* subtypes for tape accounting records */

#define	TPDSTART	0	/* tpdaemon started */
#define	TPASSIGN	1	/* drive assigned */
#define	TP2MOUNT	2	/* tape to be mounted */
#define	TPMOUNTED	3	/* tape mounted */
#define	TPPOSIT		4	/* tape positionned to requested file */
#define	TPUNLOAD	5	/* tape is unloading */
#define	TPFREE		6	/* drive freed */
#define	TPCONFUP	7	/* drive configured up */
#define	TPCONFDN	8	/* drive configured down */
#define	TPDGQ		9	/* device group queue */

			/* tape remount reasons */

#define	TPM_NORM	0	/* normal mount */
#define	TPM_WNGR	1	/* wrong ring */
#define	TPM_WNGV	2	/* wrong vsn */
#define	TPM_RSLT	3	/* reselect */

			/* tape unload reason */

#define	TPU_NORM	0	/* normal unload */
#define	TPU_WNGR	1	/* wrong ring */
#define	TPU_WNGV	2	/* wrong vsn */
#define	TPU_RSLT	3	/* reselect */

			/* tpconfig down reason */

#define	TPCD_START	0	/* startup */
#define	TPCD_CLN	1	/* cleaning */
#define	TPCD_TST	2	/* test */
#define	TPCD_HWF	3	/* HW failure */
#define	TPCD_SYS	4	/* by system */
#define	TPCD_SUS	5	/* drive suspect */
#define	TPCD_UPG	6	/* drive upgrade */
#define	TPCD_OPS	7	/* operational reason */

			/* tpconfig up reason */

#define	TPCU_START	0	/* startup */
#define	TPCU_CLN	1	/* cleaned */
#define	TPCU_RPL	2	/* replaced */
#define	TPCU_RPR	3	/* repaired */
#define	TPCU_PRV	4	/* preventive */
#define	TPCU_UPG	5	/* drive upgraded */
#define	TPCU_OPS	6	/* operational reason */

struct acctrtcp {	/* accounting record for rtcopy software */
	int	subtype;
#if defined(_WIN32)
	int     uid;
	int     gid;
#else
	uid_t	uid;
	gid_t	gid;
#endif /* _WIN32 */
	int	jid;
	int	stgreqid;	/* stager request id */
	char	reqtype;	/* R -> tpread, W -> tpwrite, D -> dumptape */
	char	ifce[5];	/* network interface used for data transfer */
	char	vid[CA_MAXVIDLEN+1];
	int	size;           /* MBytes */
	int	retryn;		/* retry number */
	int	exitcode;
	char	clienthost[CA_MAXHOSTNAMELEN+1];
	char	dsksrvr[CA_MAXHOSTNAMELEN+1];
        int     fseq;           /* Tape file sequence number */
	char    errmsgtxt[CA_MAXLINELEN+1];
};

struct acctrtcp_timing {
    int jid;
    int disk_KB;                       /* Disk file size (KBytes)*/
    int tape_KB;                       /* Tape file size (KBytes) */
    int host_KB;                       /* KBytes transferred to/from host */
    int TStartPosition;                /* Start time for position to this file */
    int TEndPosition;                  /* End time for position to this file */
    int TStartTransferDisk;            /* Start time for transfer to/from disk */
    int TEndTransferDisk;              /* End time for transfer to/from disk */
    int TStartTransferTape;            /* Start time for tranfser to/from tape */
    int TEndTransferTape;              /* End time for tranfser to/from tape */
    int TStartRequest;                  /* Start time of request (set by client) */
    int TStartRtcpd;                    /* Time when request is received by rtcpd server */
    int TStartMount;                    /* Time when mount request is sent to Ctape */
    int TEndMount;                      /* Time when mount request returns */
    int TStartUnmount;                  /* Time when unmount request is sent to Ctape */
    int TEndUnmount;                    /* Time when unmount request returns */
};


			/* subtypes for rtcopy accounting records */

#define	RTCPCMDR	1	/* command received */
#define	RTCPPRC		2	/* completion of partial request */
#define	RTCPCMDC	3	/* command completed (with success or not) */
#define	RTCPPRR		4	/* retry of partial request */
#define	RTCPTPR		5	/* retry of tape mount */
#define RTCPCMDD	6 	/* Decrypted command line */
#define RTCPEMSG        7       /* Error message */

#ifndef MAXFSEQ
#define MAXFSEQ 15
#endif

#if defined(OLD_STAGER)
struct acctstage {	/* accounting record for stage software */
	int	subtype;
#if defined(_WIN32)
	int     uid;
	int     gid;
#else
	uid_t	uid;
	gid_t	gid;
#endif /* _WIN32 */
	int	reqid;
	int	req_type;
	int	retryn;		/* retry number */
	int	exitcode;
	union {
		char clienthost[CA_MAXHOSTNAMELEN+1];
		struct {
			char poolname[CA_MAXPOOLNAMELEN+1];
			char t_or_d;
			off_t actual_size;
			int nbaccesses;
			union {
				struct {		/* tape specific info */
					char dgn[CA_MAXDGNLEN+1];
					char fseq[CA_MAXFSEQLEN+1];
					char vid[CA_MAXVIDLEN+1];
					char tapesrvr[CA_MAXHOSTNAMELEN+1];
				} t;
				struct {		/* info for disk file stageing */
					char xfile[CA_MAXHOSTNAMELEN+MAXPATH+1];
				} d;
				struct {		/* info for disk file stageing */
					char xfile[STAGE_MAX_HSMLENGTH+1];
				} m;
				struct {		/* info for disk file stageing */
					char xfile[STAGE_MAX_HSMLENGTH+1];
					u_signed64 fileid;
				} h;
			} u1;
	    } s;
	} u2;
};

struct acctstage2 {	/* accounting record for stage software */
	int	subtype;
#if defined(_WIN32)
	int     uid;
	int     gid;
#else
	uid_t	uid;
	gid_t	gid;
#endif /* _WIN32 */
	int	reqid;
	int	req_type;
	int	retryn;		/* retry number */
	int	exitcode;
	union {
		char clienthost[CA_MAXHOSTNAMELEN+1];
		struct {
			char poolname[CA_MAXPOOLNAMELEN+1];
			char t_or_d;
			off_t actual_size;
			time_t c_time;
			int nbaccesses;
			union {
				struct {		/* tape specific info */
					int  side;
					char dgn[CA_MAXDGNLEN+1];
					char fseq[CA_MAXFSEQLEN+1];
					char vid[CA_MAXVIDLEN+1];
					char tapesrvr[CA_MAXHOSTNAMELEN+1];
				} t;
				struct {		/* info for disk file stageing */
					char xfile[CA_MAXHOSTNAMELEN+MAXPATH+1];
				} d;
				struct {		/* info for disk file stageing */
					char xfile[STAGE_MAX_HSMLENGTH+1];
				} m;
				struct {		/* info for disk file stageing */
					char xfile[STAGE_MAX_HSMLENGTH+1];
					u_signed64 fileid;
				} h;
			} u1;
	    } s;
	} u2;
};

struct acctstage64 {	/* accounting record for stage 64BITS software */
	int	subtype;
#if defined(_WIN32)
	int     uid;
	int     gid;
#else
	uid_t	uid;
	gid_t	gid;
#endif /* _WIN32 */
	int	reqid;
	int	req_type;
	int	retryn;		/* retry number */
	int	exitcode;
	union {
		char clienthost[CA_MAXHOSTNAMELEN+1];
		struct {
			char poolname[CA_MAXPOOLNAMELEN+1];
			char t_or_d;
			u_signed64 actual_size;
			TIME_T c_time;
			int nbaccesses;
			union {
				struct {		/* tape specific info */
					int  side;
					char dgn[CA_MAXDGNLEN+1];
					char fseq[CA_MAXFSEQLEN+1];
					char vid[CA_MAXVIDLEN+1];
					char tapesrvr[CA_MAXHOSTNAMELEN+1];
				} t;
				struct {		/* info for disk file stageing */
					char xfile[CA_MAXHOSTNAMELEN+MAXPATH+1];
				} d;
				struct {		/* info for disk file stageing */
					char xfile[STAGE_MAX_HSMLENGTH+1];
				} m;
				struct {		/* info for disk file stageing */
					char xfile[STAGE_MAX_HSMLENGTH+1];
					u_signed64 fileid;
				} h;
			} u1;
	    } s;
	} u2;
};

			/* subtypes for stage accounting records */

#define	STGSTART	0	/* stgdaemon started */
#define	STGCMDR		1	/* command received */
#define	STGFILS		2	/* file staged */
#define	STGCMDC		3	/* command completed (with success or not) */
#define	STGCMDS		4	/* stager started */
#define	STGFILC		5	/* file cleared */
#endif