Import upstream 2.3.14
[packages/xinetd.git] / libs / src / xlog / filelog.h
1 /*
2  * (c) Copyright 1992, 1993 by Panagiotis Tsirigotis
3  * All rights reserved.  The file named COPYRIGHT specifies the terms 
4  * and conditions for redistribution.
5  */
6
7
8 /*
9  * $Id: filelog.h,v 1.2 2003/03/09 19:29:21 steveg Exp $
10  */
11
12 #ifndef __FILELOG_H
13 #define __FILELOG_H
14
15 #include "impl.h"
16
17 /*
18  * The file can be either open or closed.
19  * When the file is closed, the state is always FL_CLOSED.
20  * When the file is open, the state is:
21  *              FL_OPEN:                        if everything is ok
22  *              FL_SIZE:                        if the hard limit was exceeded
23  *              FL_ERROR:               if an error occured
24  */
25 typedef enum { FL_CLOSED = 0, FL_OPEN, FL_SIZE, FL_ERROR } filelog_state_e ;
26
27 struct filelog_s
28 {
29         int                                     fl_fd ;
30         filelog_state_e fl_state ;
31         int                                     fl_error ;                              /* error code when in FL_ERROR          */
32         bool_int                                fl_size_control ;               /* enabled or not                                                       */
33         bool_int                                fl_issued_warning ;     /* when the soft limit was exceeded     */
34         unsigned                        fl_size ;            /* current size                    */
35         unsigned                                fl_soft_limit ;
36         unsigned                                fl_hard_limit ;
37 } ;
38
39 #define FILELOG_ENABLE_SIZE_CONTROL( flp )      (flp)->fl_size_control = TRUE
40 #define FILELOG_DISABLE_SIZE_CONTROL( flp )     (flp)->fl_size_control = FALSE
41 #define FILELOG_SIZE_CONTROL( flp )             ( (flp)->fl_size_control )
42
43 #define FILELOG( xp )                   ((struct filelog_s *)xp->xl_data)
44
45 #endif
46