[7] | 1 | /* $Id: log_reader.h 323 2010-09-21 21:31:29Z mmatloka $ */ |
---|
| 2 | /* |
---|
| 3 | * FedStage DRMAA for PBS Pro |
---|
| 4 | * Copyright (C) 2006-2009 FedStage Systems |
---|
| 5 | * |
---|
| 6 | * This program is free software: you can redistribute it and/or modify |
---|
| 7 | * it under the terms of the GNU General Public License as published by |
---|
| 8 | * the Free Software Foundation, either version 3 of the License, or |
---|
| 9 | * (at your option) any later version. |
---|
| 10 | * |
---|
| 11 | * This program is distributed in the hope that it will be useful, |
---|
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 14 | * GNU General Public License for more details. |
---|
| 15 | * |
---|
| 16 | * You should have received a copy of the GNU General Public License |
---|
| 17 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
---|
| 18 | */ |
---|
| 19 | |
---|
| 20 | #ifndef __PBS_DRMAA__LOG_READER_H |
---|
| 21 | #define __PBS_DRMAA__LOG_READER_H |
---|
| 22 | |
---|
| 23 | #ifdef HAVE_CONFIG_H |
---|
| 24 | # include <config.h> |
---|
| 25 | #endif |
---|
| 26 | |
---|
| 27 | #include <drmaa_utils/job.h> |
---|
| 28 | #include <drmaa_utils/session.h> |
---|
| 29 | |
---|
| 30 | typedef struct pbsdrmaa_log_reader_s pbsdrmaa_log_reader_t; |
---|
| 31 | |
---|
| 32 | pbsdrmaa_log_reader_t * |
---|
| 33 | pbsdrmaa_log_reader_new ( fsd_drmaa_session_t * session, fsd_job_t * job ); |
---|
| 34 | |
---|
| 35 | void |
---|
| 36 | pbsdrmaa_log_reader_destroy ( pbsdrmaa_log_reader_t * self ); |
---|
| 37 | |
---|
| 38 | struct pbsdrmaa_log_reader_s { |
---|
| 39 | fsd_drmaa_session_t *volatile session ; |
---|
| 40 | fsd_job_t *volatile job; |
---|
| 41 | |
---|
| 42 | void (* |
---|
| 43 | read_log) ( pbsdrmaa_log_reader_t * self ); |
---|
| 44 | |
---|
| 45 | void (* |
---|
| 46 | chose_file) ( pbsdrmaa_log_reader_t * self ); |
---|
| 47 | |
---|
| 48 | ssize_t (* |
---|
| 49 | read_line) ( pbsdrmaa_log_reader_t * self , char * buffer , ssize_t size ); |
---|
| 50 | |
---|
| 51 | /* specifies if function should run */ |
---|
| 52 | bool run_flag; |
---|
| 53 | |
---|
| 54 | /* date of current file */ |
---|
| 55 | time_t t; |
---|
| 56 | |
---|
| 57 | /* for job_on_missing - available log files */ |
---|
| 58 | char ** log_files; |
---|
| 59 | |
---|
| 60 | /* for job_on_missing - number of log files */ |
---|
| 61 | int log_files_number; |
---|
| 62 | |
---|
| 63 | /* log file descriptor */ |
---|
| 64 | int volatile fd; |
---|
| 65 | |
---|
| 66 | /* for job_on_missing - log file size when function was ran */ |
---|
| 67 | off_t log_file_initial_size; |
---|
| 68 | |
---|
| 69 | /* for job_on_missing - read lines size */ |
---|
| 70 | off_t log_file_read_size; |
---|
| 71 | |
---|
| 72 | /* for wait_thread - day changed */ |
---|
| 73 | bool volatile date_changed; |
---|
| 74 | |
---|
| 75 | /* for wait_thread - log file first open */ |
---|
| 76 | bool volatile first_open; |
---|
| 77 | |
---|
| 78 | char * name; |
---|
| 79 | }; |
---|
| 80 | |
---|
| 81 | #endif /* __PBS_DRMAA__LOG_READER_H */ |
---|