~ubuntu-branches/ubuntu/utopic/gridengine/utopic

« back to all changes in this revision

Viewing changes to source/libs/comm/lists/cl_list_types.h

  • Committer: Bazaar Package Importer
  • Author(s): Mark Hymers
  • Date: 2008-06-25 22:36:13 UTC
  • Revision ID: james.westby@ubuntu.com-20080625223613-tvd9xlhuoct9kyhm
Tags: upstream-6.2~beta2
ImportĀ upstreamĀ versionĀ 6.2~beta2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef __CL_LIST_TYPES_H
 
2
#define __CL_LIST_TYPES_H
 
3
 
 
4
/*___INFO__MARK_BEGIN__*/
 
5
/*************************************************************************
 
6
 * 
 
7
 *  The Contents of this file are made available subject to the terms of
 
8
 *  the Sun Industry Standards Source License Version 1.2
 
9
 * 
 
10
 *  Sun Microsystems Inc., March, 2001
 
11
 * 
 
12
 * 
 
13
 *  Sun Industry Standards Source License Version 1.2
 
14
 *  =================================================
 
15
 *  The contents of this file are subject to the Sun Industry Standards
 
16
 *  Source License Version 1.2 (the "License"); You may not use this file
 
17
 *  except in compliance with the License. You may obtain a copy of the
 
18
 *  License at http://gridengine.sunsource.net/Gridengine_SISSL_license.html
 
19
 * 
 
20
 *  Software provided under this License is provided on an "AS IS" basis,
 
21
 *  WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
 
22
 *  WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
 
23
 *  MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
 
24
 *  See the License for the specific provisions governing your rights and
 
25
 *  obligations concerning the Software.
 
26
 * 
 
27
 *   The Initial Developer of the Original Code is: Sun Microsystems, Inc.
 
28
 * 
 
29
 *   Copyright: 2001 by Sun Microsystems, Inc.
 
30
 * 
 
31
 *   All Rights Reserved.
 
32
 * 
 
33
 ************************************************************************/
 
34
/*___INFO__MARK_END__*/
 
35
 
 
36
#include <sys/time.h>
 
37
#include <pthread.h>
 
38
 
 
39
#define CL_THREAD_LIST 1
 
40
#define CL_LOG_LIST    2
 
41
typedef struct cl_thread_settings_type  cl_thread_settings_t;
 
42
typedef struct cl_thread_condition_type cl_thread_condition_t;
 
43
/***********************************************************************/
 
44
/* RAW_LIST */
 
45
/***********************************************************************/
 
46
typedef struct cl_raw_list_elem_type cl_raw_list_elem_t;
 
47
struct cl_raw_list_elem_type {
 
48
  void* data;                         /* pointer to data */ 
 
49
  cl_raw_list_elem_t* next;
 
50
  cl_raw_list_elem_t* last;
 
51
};
 
52
 
 
53
 
 
54
typedef struct cl_raw_list_type {
 
55
   char*                 list_name;       /* name of list */
 
56
   int                   list_type;       /* type of list CL_THREAD_LIST, CL_LOG_LIST */
 
57
   pthread_mutex_t*      list_mutex;      /* list lock mutex */
 
58
   unsigned long         elem_count;      /* number of list entries */
 
59
   void*                 list_data;       /* user list data */
 
60
 
 
61
#ifdef CL_DO_COMMLIB_DEBUG
 
62
   char* last_locker;
 
63
   unsigned long         lock_count;
 
64
   unsigned long         unlock_count;
 
65
#endif
 
66
   cl_raw_list_elem_t*   first_elem;
 
67
   cl_raw_list_elem_t*   last_elem;
 
68
} cl_raw_list_t;
 
69
 
 
70
/***********************************************************************/
 
71
 
 
72
 
 
73
/***********************************************************************/
 
74
/* THREAD_LIST */
 
75
/***********************************************************************/
 
76
typedef struct cl_thread_list_elem_type cl_thread_list_elem_t;
 
77
struct cl_thread_list_elem_type {
 
78
   cl_thread_settings_t* thread_config;   /* data */
 
79
   cl_raw_list_elem_t*   raw_elem;
 
80
};
 
81
 
 
82
 
 
83
 
 
84
 
 
85
/***********************************************************************/
 
86
 
 
87
typedef enum cl_log_type {
 
88
   CL_LOG_OFF = 0,
 
89
   CL_LOG_ERROR,
 
90
   CL_LOG_WARNING,
 
91
   CL_LOG_INFO,
 
92
   CL_LOG_DEBUG
 
93
} cl_log_t;
 
94
 
 
95
typedef enum cl_bool_def {
 
96
   CL_FALSE = 0,
 
97
   CL_TRUE
 
98
} cl_bool_t;
 
99
 
 
100
/***********************************************************************/
 
101
/* LOG_LIST */
 
102
/***********************************************************************/
 
103
typedef struct cl_log_list_elem_type cl_log_list_elem_t;
 
104
struct cl_log_list_elem_type {                      /* list element specific data */
 
105
   char*                 log_parameter;                  /* additional parameter */
 
106
   char*                 log_message;                    /* log message */
 
107
   char*                 log_thread_name;                /* name of thread  */
 
108
   int                   log_thread_id;                  /* thread id   */
 
109
   int                   log_thread_state;               /* state of thread */
 
110
   cl_log_t              log_type;                       /* log level type */
 
111
   char*                 log_module_name;                /* name of c - module */
 
112
   cl_raw_list_elem_t*   raw_elem;
 
113
};
 
114
 
 
115
typedef struct cl_application_error_list_elem_t {
 
116
   cl_raw_list_elem_t*   raw_elem;         /* commlib internal list pointer to raw list element */
 
117
   int                   cl_error;         /* commlib error code 
 
118
                                              (use cl_get_error_text() to resolve error string) */
 
119
   char*                 cl_info;          /* additional error information */
 
120
   struct timeval        cl_log_time;      /* time when the message was added */
 
121
   cl_bool_t             cl_already_logged;/* CL_TRUE when this error was logged the last 
 
122
                                              CL_DEFINE_MESSAGE_DUP_LOG_TIMEOUT seconds */
 
123
   cl_log_t              cl_err_type;      /* commlib error message type */
 
124
} cl_application_error_list_elem_t;
 
125
 
 
126
typedef enum cl_log_list_flush_method_type {
 
127
   CL_LOG_FLUSHED,        /* flushing is done when ever user calls cl_log_list_flush() */
 
128
   CL_LOG_IMMEDIATE       /* cl_log_list_flush() is called on each log  */
 
129
} cl_log_list_flush_method_t;
 
130
 
 
131
 
 
132
/* function return value  function typedef              func parameter */
 
133
typedef int               (*cl_log_func_t)              (cl_raw_list_t* log_list);
 
134
typedef unsigned long     (*cl_app_status_func_t)       (char** info_message);
 
135
typedef void              (*cl_error_func_t)            (const cl_application_error_list_elem_t* commlib_error);
 
136
typedef const char*       (*cl_tag_name_func_t)         (unsigned long tag);
 
137
typedef void              (*cl_app_debug_client_func_t) (int cl_connected, int debug_level);
 
138
 
 
139
 
 
140
typedef struct cl_log_list_data_type {                      /* list specific data */
 
141
   cl_log_t                    current_log_level;           /* current log level */
 
142
   cl_log_list_flush_method_t  flush_type;                  /* flushing type */
 
143
   cl_log_func_t               flush_function;              /* function called for flushing */
 
144
   cl_thread_settings_t*       list_creator_settings;       /* log list creator thread settings */
 
145
} cl_log_list_data_t;
 
146
 
 
147
/***********************************************************************/
 
148
 
 
149
 
 
150
 
 
151
#endif /* __CL_LIST_TYPES_H */
 
152