1 | /* |
---|
2 | * OpenPBS (Portable Batch System) v2.3 Software License |
---|
3 | * |
---|
4 | * Copyright (c) 1999-2000 Veridian Information Solutions, Inc. |
---|
5 | * All rights reserved. |
---|
6 | * |
---|
7 | * --------------------------------------------------------------------------- |
---|
8 | * For a license to use or redistribute the OpenPBS software under conditions |
---|
9 | * other than those described below, or to purchase support for this software, |
---|
10 | * please contact Veridian Systems, PBS Products Department ("Licensor") at: |
---|
11 | * |
---|
12 | * www.OpenPBS.org +1 650 967-4675 sales@OpenPBS.org |
---|
13 | * 877 902-4PBS (US toll-free) |
---|
14 | * --------------------------------------------------------------------------- |
---|
15 | * |
---|
16 | * This license covers use of the OpenPBS v2.3 software (the "Software") at |
---|
17 | * your site or location, and, for certain users, redistribution of the |
---|
18 | * Software to other sites and locations. Use and redistribution of |
---|
19 | * OpenPBS v2.3 in source and binary forms, with or without modification, |
---|
20 | * are permitted provided that all of the following conditions are met. |
---|
21 | * After December 31, 2001, only conditions 3-6 must be met: |
---|
22 | * |
---|
23 | * 1. Commercial and/or non-commercial use of the Software is permitted |
---|
24 | * provided a current software registration is on file at www.OpenPBS.org. |
---|
25 | * If use of this software contributes to a publication, product, or |
---|
26 | * service, proper attribution must be given; see www.OpenPBS.org/credit.html |
---|
27 | * |
---|
28 | * 2. Redistribution in any form is only permitted for non-commercial, |
---|
29 | * non-profit purposes. There can be no charge for the Software or any |
---|
30 | * software incorporating the Software. Further, there can be no |
---|
31 | * expectation of revenue generated as a consequence of redistributing |
---|
32 | * the Software. |
---|
33 | * |
---|
34 | * 3. Any Redistribution of source code must retain the above copyright notice |
---|
35 | * and the acknowledgment contained in paragraph 6, this list of conditions |
---|
36 | * and the disclaimer contained in paragraph 7. |
---|
37 | * |
---|
38 | * 4. Any Redistribution in binary form must reproduce the above copyright |
---|
39 | * notice and the acknowledgment contained in paragraph 6, this list of |
---|
40 | * conditions and the disclaimer contained in paragraph 7 in the |
---|
41 | * documentation and/or other materials provided with the distribution. |
---|
42 | * |
---|
43 | * 5. Redistributions in any form must be accompanied by information on how to |
---|
44 | * obtain complete source code for the OpenPBS software and any |
---|
45 | * modifications and/or additions to the OpenPBS software. The source code |
---|
46 | * must either be included in the distribution or be available for no more |
---|
47 | * than the cost of distribution plus a nominal fee, and all modifications |
---|
48 | * and additions to the Software must be freely redistributable by any party |
---|
49 | * (including Licensor) without restriction. |
---|
50 | * |
---|
51 | * 6. All advertising materials mentioning features or use of the Software must |
---|
52 | * display the following acknowledgment: |
---|
53 | * |
---|
54 | * "This product includes software developed by NASA Ames Research Center, |
---|
55 | * Lawrence Livermore National Laboratory, and Veridian Information |
---|
56 | * Solutions, Inc. |
---|
57 | * Visit www.OpenPBS.org for OpenPBS software support, |
---|
58 | * products, and information." |
---|
59 | * |
---|
60 | * 7. DISCLAIMER OF WARRANTY |
---|
61 | * |
---|
62 | * THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. ANY EXPRESS |
---|
63 | * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
---|
64 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT |
---|
65 | * ARE EXPRESSLY DISCLAIMED. |
---|
66 | * |
---|
67 | * IN NO EVENT SHALL VERIDIAN CORPORATION, ITS AFFILIATED COMPANIES, OR THE |
---|
68 | * U.S. GOVERNMENT OR ANY OF ITS AGENCIES BE LIABLE FOR ANY DIRECT OR INDIRECT, |
---|
69 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
---|
70 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, |
---|
71 | * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
---|
72 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
---|
73 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, |
---|
74 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
---|
75 | * |
---|
76 | * This license will be governed by the laws of the Commonwealth of Virginia, |
---|
77 | * without reference to its choice of law rules. |
---|
78 | */ |
---|
79 | |
---|
80 | /* |
---|
81 | * include file for error/event logging |
---|
82 | */ |
---|
83 | |
---|
84 | #ifndef LOG_H |
---|
85 | #define LOG_H |
---|
86 | |
---|
87 | #include <pthread.h> |
---|
88 | #define LOG_BUF_SIZE 16384 |
---|
89 | #define LOCAL_LOG_BUF_SIZE 5096 |
---|
90 | |
---|
91 | /* The following macro assist in sharing code between the Server and Mom */ |
---|
92 | #define LOG_EVENT log_event |
---|
93 | |
---|
94 | /* |
---|
95 | ** Set up a debug print macro. |
---|
96 | */ |
---|
97 | #ifdef NDEBUG |
---|
98 | #define DBPRT(x) |
---|
99 | #else |
---|
100 | #define DBPRT(x) printf x; |
---|
101 | #endif /* END NDEBUG */ |
---|
102 | |
---|
103 | #if SYSLOG |
---|
104 | #include <syslog.h> |
---|
105 | #endif /* SYSLOG */ |
---|
106 | |
---|
107 | #if !SYSLOG |
---|
108 | /* define syslog constants that can be used in code regardless of whether we |
---|
109 | * are using syslog or not! */ |
---|
110 | |
---|
111 | #ifndef LOG_EMERG |
---|
112 | #define LOG_EMERG 1 |
---|
113 | #endif |
---|
114 | |
---|
115 | #ifndef LOG_ALERT |
---|
116 | #define LOG_ALERT 2 |
---|
117 | #endif |
---|
118 | |
---|
119 | #ifndef LOG_CRIT |
---|
120 | #define LOG_CRIT 3 |
---|
121 | #endif |
---|
122 | |
---|
123 | #ifndef LOG_ERR |
---|
124 | #define LOG_ERR 4 |
---|
125 | #endif |
---|
126 | |
---|
127 | #ifndef LOG_ERR |
---|
128 | #define LOG_ERR 5 |
---|
129 | #endif |
---|
130 | |
---|
131 | #ifndef LOG_WARNING |
---|
132 | #define LOG_WARNING 6 |
---|
133 | #endif |
---|
134 | |
---|
135 | #ifndef LOG_NOTICE |
---|
136 | #define LOG_NOTICE 7 |
---|
137 | #endif |
---|
138 | |
---|
139 | #ifndef LOG_INFO |
---|
140 | #define LOG_INFO 8 |
---|
141 | #endif |
---|
142 | |
---|
143 | #ifndef LOG_DEBUG |
---|
144 | #define LOG_DEBUG 9 |
---|
145 | #endif |
---|
146 | #endif /* SYSLOG */ |
---|
147 | |
---|
148 | #define MAXLINE 1024 |
---|
149 | |
---|
150 | enum getter_setter { GETV, SETV }; |
---|
151 | typedef enum getter_setter SGetter; |
---|
152 | |
---|
153 | /* HvB |
---|
154 | extern int LOGLEVEL; |
---|
155 | */ |
---|
156 | |
---|
157 | extern long *log_event_mask; |
---|
158 | extern pthread_mutex_t log_mutex; |
---|
159 | extern pthread_mutex_t job_log_mutex; |
---|
160 | |
---|
161 | /* set this to non-zero in calling app if errors go to stderr */ |
---|
162 | extern int chk_file_sec_stderr; |
---|
163 | |
---|
164 | /* extern void log_close (int); */ |
---|
165 | /* extern void job_log_close (int); */ |
---|
166 | void log_err (int, const char *, const char *); |
---|
167 | void log_ext (int, const char *, const char *,int); |
---|
168 | void log_event (int, int, const char *, const char *); |
---|
169 | /* extern int log_open (char *, char *); */ |
---|
170 | /* extern int job_log_open (char *, char *); */ |
---|
171 | |
---|
172 | void log_record (int, int, const char *, const char *); |
---|
173 | |
---|
174 | /* HvB */ |
---|
175 | bool log_available(int eventtype); |
---|
176 | |
---|
177 | /* extern void log_roll (int); */ |
---|
178 | /* extern long log_size (void); */ |
---|
179 | /* extern long job_log_size (void); */ |
---|
180 | /* extern int log_remove_old (char *,unsigned long); */ |
---|
181 | extern char log_buffer[LOG_BUF_SIZE]; |
---|
182 | /* int log_init (char *, char *); */ |
---|
183 | |
---|
184 | /* extern int IamRoot (void); */ |
---|
185 | /* #ifdef __CYGWIN__ */ |
---|
186 | /* extern int IamAdminByName (char *); */ |
---|
187 | /* extern int IamUser (void); */ |
---|
188 | /* extern int IamUserByName (char *); */ |
---|
189 | /* #endif __CYGWIN__ */ |
---|
190 | |
---|
191 | /* extern int chk_file_sec (char *, int, int, int, int, char *); */ |
---|
192 | /* extern int setup_env (char *); */ |
---|
193 | |
---|
194 | |
---|
195 | /* Event types */ |
---|
196 | |
---|
197 | #define PBSEVENT_ERROR 0x0001 /* internal errors */ |
---|
198 | #define PBSEVENT_SYSTEM 0x0002 /* system (server) & (trqauthd) events */ |
---|
199 | #define PBSEVENT_ADMIN 0x0004 /* admin events */ |
---|
200 | #define PBSEVENT_JOB 0x0008 /* job related events */ |
---|
201 | #define PBSEVENT_JOB_USAGE 0x0010 /* End of Job accounting */ |
---|
202 | #define PBSEVENT_SECURITY 0x0020 /* security violation events */ |
---|
203 | #define PBSEVENT_SCHED 0x0040 /* scheduler events */ |
---|
204 | #define PBSEVENT_DEBUG 0x0080 /* common debug messages */ |
---|
205 | #define PBSEVENT_DEBUG2 0x0100 /* less needed debug messages */ |
---|
206 | #define PBSEVENT_CLIENTAUTH 0X0200 /* TRQAUTHD login events */ |
---|
207 | #define PBSEVENT_SYSLOG 0x0400 /* pass this event to the syslog as well (if defined) */ |
---|
208 | #define PBSEVENT_FORCE 0x8000 /* set to force a message */ |
---|
209 | |
---|
210 | /* Event Object Classes, see array class_names[] in ../lib/Liblog/pbs_log.c */ |
---|
211 | |
---|
212 | #define PBS_EVENTCLASS_SERVER 1 /* The server itself */ |
---|
213 | #define PBS_EVENTCLASS_QUEUE 2 /* Queues */ |
---|
214 | #define PBS_EVENTCLASS_JOB 3 /* Jobs */ |
---|
215 | #define PBS_EVENTCLASS_REQUEST 4 /* Batch Requests */ |
---|
216 | #define PBS_EVENTCLASS_FILE 5 /* A Job related File */ |
---|
217 | #define PBS_EVENTCLASS_ACCT 6 /* Accounting info */ |
---|
218 | #define PBS_EVENTCLASS_NODE 7 /* Nodes */ |
---|
219 | #define PBS_EVENTCLASS_TRQAUTHD 8 /* trqauthd */ |
---|
220 | |
---|
221 | /* Logging Masks */ |
---|
222 | |
---|
223 | #define PBSEVENT_MASK 0x01ff |
---|
224 | |
---|
225 | /* definition's for pbs_log.c's log_remove_old() function */ |
---|
226 | #define MAX_PATH_LEN 1024 /* maximum possible length of any path */ |
---|
227 | #define SECS_PER_DAY 86400 |
---|
228 | |
---|
229 | #if !defined(TRUE) || !defined(FALSE) |
---|
230 | #define TRUE 1 |
---|
231 | #define FALSE 0 |
---|
232 | #endif /* !defined(TRUE) || !defined(FALSE) */ |
---|
233 | |
---|
234 | #endif /* ifndef LOG_H */ |
---|