|
torque
2.5.12
|
00001 /* $Id: error.h,v 1.4 2006/09/08 18:18:08 ciesnik Exp $ */ 00002 /* 00003 * DRMAA library for Torque/PBS 00004 * Copyright (C) 2006 Poznan Supercomputing and Networking Center 00005 * DSP team <dsp-devel@hedera.man.poznan.pl> 00006 * 00007 * This library is free software; you can redistribute it and/or 00008 * modify it under the terms of the GNU Lesser General Public 00009 * License as published by the Free Software Foundation; either 00010 * version 2.1 of the License, or (at your option) any later version. 00011 * 00012 * This library is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00015 * Lesser General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU Lesser General Public 00018 * License along with this library; if not, write to the Free Software 00019 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00020 */ 00021 00027 #ifndef __DRMAA__ERROR_H 00028 #define __DRMAA__ERROR_H 00029 00030 #ifdef HAVE_CONFIG_H 00031 # include <pbs_config.h> 00032 #endif 00033 00034 #include <stddef.h> 00035 00036 00037 int drmaa_get_errno_error(char *error_diagnosis, size_t error_diag_len); 00038 int drmaa_get_drmaa_error(char *error_diagnosis, size_t error_diag_len, 00039 int error_code); 00040 int drmaa_get_pbs_error(char *error_diagnosis, size_t error_diag_len); 00041 00042 int drmaa_map_pbs_error(int pbs_errcode); 00043 00044 void drmaa_log(const char *fmt, ...) 00045 __attribute__((format(printf, 1, 2))); 00046 00047 00048 #if DRMAA_DEBUG 00049 # define DEBUG( args ) do{ drmaa_log args ; }while(0) 00050 #else 00051 # define DEBUG( args ) /* nothing */ 00052 #endif 00053 00054 #define STORE_ERRNO_MSG() \ 00055 do{ drmaa_get_errno_error( errmsg, errlen ); }while(0) 00056 00057 #define RAISE_ERRNO( retcode ) do { \ 00058 STORE_ERRNO_MSG(); \ 00059 return retcode; \ 00060 } while(0) 00061 00062 #define SET_DRMAA_ERROR( retcode ) \ 00063 do{ drmaa_get_drmaa_error( errmsg, errlen, (retcode) ); } while(0) 00064 00065 #define RAISE_DRMAA( retcode ) do { \ 00066 SET_DRMAA_ERROR( retcode ); \ 00067 return retcode; \ 00068 } while(0) 00069 00070 #define RAISE_NO_MEMORY() \ 00071 RAISE_DRMAA( DRMAA_ERRNO_NO_MEMORY ) 00072 00073 #define RAISE_PBS() \ 00074 do{ return drmaa_get_pbs_error( errmsg, errlen ); } while(0) 00075 00076 #define SET_PBS_ERROR( rc_var ) \ 00077 do{ (rc_var) = drmaa_get_pbs_error( errmsg, errlen ); } while(0) 00078 00079 00080 #endif /* __DRMAA__ERROR_H */ 00081
1.8.0