source: devel/C/log.h @ 309

Last change on this file since 309 was 309, checked in by bas, 9 years ago

Checkin the pbs swig development files

File size: 7.1 KB
Line 
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#define LOG_BUF_SIZE  16384
88
89/* The following macro assist in sharing code between the Server and Mom */
90#define LOG_EVENT log_event
91
92/*
93** Set up a debug print macro.
94*/
95#ifdef NDEBUG
96#define DBPRT(x)
97#else
98#define DBPRT(x) printf x;
99#endif  /* END NDEBUG */
100
101#if SYSLOG
102#include <syslog.h>
103#endif /* SYSLOG */
104
105#if !SYSLOG
106/* define syslog constants that can be used in code regardless of whether we
107 * are using syslog or not! */
108
109#ifndef LOG_EMERG
110#define LOG_EMERG 1
111#endif
112
113#ifndef LOG_ALERT
114#define LOG_ALERT 2
115#endif
116
117#ifndef LOG_CRIT
118#define LOG_CRIT 3
119#endif
120
121#ifndef LOG_ERR
122#define LOG_ERR 4
123#endif
124
125#ifndef LOG_ERR
126#define LOG_ERR 5
127#endif
128
129#ifndef LOG_WARNING
130#define LOG_WARNING 6
131#endif
132
133#ifndef LOG_NOTICE
134#define LOG_NOTICE 7
135#endif
136
137#ifndef LOG_INFO
138#define LOG_INFO 8
139#endif
140
141#ifndef LOG_DEBUG
142#define LOG_DEBUG 9
143#endif
144#endif /* SYSLOG */
145
146extern long *log_event_mask;
147
148/* set this to non-zero in calling app if errors go to stderr */
149extern int   chk_file_sec_stderr;
150
151
152extern void log_close(int);
153extern void log_err(int, char *, char *);
154extern void log_event(int, int, char *, char *);
155extern int  log_open(char *, char *);
156extern void log_record(int, int, char *, char *);
157extern void log_roll(int);
158extern long log_size(void);
159
160extern char log_buffer[LOG_BUF_SIZE];
161
162extern int  chk_file_sec(char *, int, int, int, int, char *);
163extern int  setup_env(char *);
164
165#ifdef TORQUE_2_4
166extern void log_ext(int,char *,char *,int);
167int log_init(char *, char *);
168extern int  log_remove_old(char *,unsigned long);
169#endif
170
171/* Event types */
172
173#define PBSEVENT_ERROR  0x0001  /* internal errors       */
174#define PBSEVENT_SYSTEM  0x0002  /* system (server) events     */
175#define PBSEVENT_ADMIN  0x0004  /* admin events        */
176#define PBSEVENT_JOB  0x0008  /* job related events       */
177#define PBSEVENT_JOB_USAGE 0x0010  /* End of Job accounting      */
178#define PBSEVENT_SECURITY 0x0020  /* security violation events  */
179#define PBSEVENT_SCHED  0x0040  /* scheduler events       */
180#define PBSEVENT_DEBUG  0x0080  /* common debug messages      */
181#define PBSEVENT_DEBUG2  0x0100  /* less needed debug messages */
182#define PBSEVENT_FORCE  0x8000  /* set to force a messag      */
183
184/* Event Object Classes, see array class_names[] in ../lib/Liblog/pbs_log.c   */
185
186#define PBS_EVENTCLASS_SERVER 1 /* The server itself */
187#define PBS_EVENTCLASS_QUEUE 2 /* Queues  */
188#define PBS_EVENTCLASS_JOB 3 /* Jobs   */
189#define PBS_EVENTCLASS_REQUEST 4 /* Batch Requests */
190#define PBS_EVENTCLASS_FILE 5 /* A Job related File */
191#define PBS_EVENTCLASS_ACCT 6 /* Accounting info */
192#define PBS_EVENTCLASS_NODE 7 /* Nodes           */
193
194/* Logging Masks */
195
196#define PBSEVENT_MASK  0x01ff
197
198/* definition's for pbs_log.c's log_remove_old() function */
199#define MAX_PATH_LEN    1024  /* maximum possible length of any path */
200#define SECS_PER_DAY     86400
201
202#if !defined(TRUE) || !defined(FALSE)
203#define TRUE 1
204#define FALSE 0
205#endif /* !defined(TRUE) || !defined(FALSE) */
206
207/* HvB:
208 *   msg_daemonname is extern declared in liblog.a. So define it here
209*/
210char *msg_daemonname = "pbs_python";
211
212#endif /* ifndef LOG_H */
Note: See TracBrowser for help on using the repository browser.