[324] | 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 extern int LOGLEVEL; |
---|
| 154 | |
---|
| 155 | extern long *log_event_mask; |
---|
| 156 | extern pthread_mutex_t log_mutex; |
---|
| 157 | extern pthread_mutex_t job_log_mutex; |
---|
| 158 | |
---|
| 159 | /* set this to non-zero in calling app if errors go to stderr */ |
---|
| 160 | extern int chk_file_sec_stderr; |
---|
| 161 | |
---|
| 162 | /* extern void log_close (int); */ |
---|
| 163 | /* extern void job_log_close (int); */ |
---|
| 164 | void log_err (int, const char *, const char *); |
---|
| 165 | void log_ext (int, const char *, const char *,int); |
---|
| 166 | void log_event (int, int, const char *, const char *); |
---|
| 167 | /* extern int log_open (char *, char *); */ |
---|
| 168 | /* extern int job_log_open (char *, char *); */ |
---|
| 169 | void log_record (int, int, const char *, const char *); |
---|
| 170 | bool log_available(int eventtype); |
---|
| 171 | /* extern void log_roll (int); */ |
---|
| 172 | /* extern long log_size (void); */ |
---|
| 173 | /* extern long job_log_size (void); */ |
---|
| 174 | /* extern int log_remove_old (char *,unsigned long); */ |
---|
| 175 | extern char log_buffer[LOG_BUF_SIZE]; |
---|
| 176 | int log_init(const char *suffix, const char *hostname); |
---|
| 177 | |
---|
| 178 | /* extern int IamRoot (void); */ |
---|
| 179 | /* #ifdef __CYGWIN__ */ |
---|
| 180 | /* extern int IamAdminByName (char *); */ |
---|
| 181 | /* extern int IamUser (void); */ |
---|
| 182 | /* extern int IamUserByName (char *); */ |
---|
| 183 | /* #endif __CYGWIN__ */ |
---|
| 184 | |
---|
| 185 | int chk_file_sec( const char *path, int isdir, int sticky, int disallow, int fullpath, char *SEMsg); |
---|
| 186 | /* extern int setup_env (char *); */ |
---|
| 187 | |
---|
| 188 | /* Event types */ |
---|
| 189 | |
---|
| 190 | #define PBSEVENT_ERROR 0x0001 /* internal errors */ |
---|
| 191 | #define PBSEVENT_SYSTEM 0x0002 /* system (server) & (trqauthd) events */ |
---|
| 192 | #define PBSEVENT_ADMIN 0x0004 /* admin events */ |
---|
| 193 | #define PBSEVENT_JOB 0x0008 /* job related events */ |
---|
| 194 | #define PBSEVENT_JOB_USAGE 0x0010 /* End of Job accounting */ |
---|
| 195 | #define PBSEVENT_SECURITY 0x0020 /* security violation events */ |
---|
| 196 | #define PBSEVENT_SCHED 0x0040 /* scheduler events */ |
---|
| 197 | #define PBSEVENT_DEBUG 0x0080 /* common debug messages */ |
---|
| 198 | #define PBSEVENT_DEBUG2 0x0100 /* less needed debug messages */ |
---|
| 199 | #define PBSEVENT_CLIENTAUTH 0X0200 /* TRQAUTHD login events */ |
---|
| 200 | #define PBSEVENT_SYSLOG 0x0400 /* pass this event to the syslog as well (if defined) */ |
---|
| 201 | #define PBSEVENT_FORCE 0x8000 /* set to force a message */ |
---|
| 202 | |
---|
| 203 | /* Event Object Classes, see array class_names[] in ../lib/Liblog/pbs_log.c */ |
---|
| 204 | |
---|
| 205 | #define PBS_EVENTCLASS_SERVER 1 /* The server itself */ |
---|
| 206 | #define PBS_EVENTCLASS_QUEUE 2 /* Queues */ |
---|
| 207 | #define PBS_EVENTCLASS_JOB 3 /* Jobs */ |
---|
| 208 | #define PBS_EVENTCLASS_REQUEST 4 /* Batch Requests */ |
---|
| 209 | #define PBS_EVENTCLASS_FILE 5 /* A Job related File */ |
---|
| 210 | #define PBS_EVENTCLASS_ACCT 6 /* Accounting info */ |
---|
| 211 | #define PBS_EVENTCLASS_NODE 7 /* Nodes */ |
---|
| 212 | #define PBS_EVENTCLASS_TRQAUTHD 8 /* trqauthd */ |
---|
| 213 | |
---|
| 214 | /* Logging Masks */ |
---|
| 215 | |
---|
| 216 | #define PBSEVENT_MASK 0x01ff |
---|
| 217 | |
---|
| 218 | /* definition's for pbs_log.c's log_remove_old() function */ |
---|
| 219 | #define MAX_PATH_LEN 1024 /* maximum possible length of any path */ |
---|
| 220 | #define SECS_PER_DAY 86400 |
---|
| 221 | |
---|
| 222 | #if !defined(TRUE) || !defined(FALSE) |
---|
| 223 | #define TRUE 1 |
---|
| 224 | #define FALSE 0 |
---|
| 225 | #endif /* !defined(TRUE) || !defined(FALSE) */ |
---|
| 226 | |
---|
| 227 | #endif /* ifndef LOG_H */ |
---|