| 1 | /* $Id$ */ |
|---|
| 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 <stdio.h> |
|---|
| 28 | |
|---|
| 29 | #include <drmaa_utils/job.h> |
|---|
| 30 | #include <drmaa_utils/session.h> |
|---|
| 31 | |
|---|
| 32 | typedef struct pbsdrmaa_log_reader_s pbsdrmaa_log_reader_t; |
|---|
| 33 | |
|---|
| 34 | pbsdrmaa_log_reader_t * |
|---|
| 35 | pbsdrmaa_log_reader_new ( fsd_drmaa_session_t * session); |
|---|
| 36 | |
|---|
| 37 | void |
|---|
| 38 | pbsdrmaa_log_reader_destroy ( pbsdrmaa_log_reader_t * self ); |
|---|
| 39 | |
|---|
| 40 | struct pbsdrmaa_log_reader_s { |
|---|
| 41 | fsd_drmaa_session_t *volatile session ; |
|---|
| 42 | |
|---|
| 43 | void (*read_log) ( pbsdrmaa_log_reader_t * self ); |
|---|
| 44 | |
|---|
| 45 | void (*select_file) ( pbsdrmaa_log_reader_t * self ); |
|---|
| 46 | |
|---|
| 47 | void (*close) ( pbsdrmaa_log_reader_t * self ); |
|---|
| 48 | |
|---|
| 49 | void (*reopen) ( pbsdrmaa_log_reader_t * self ); |
|---|
| 50 | |
|---|
| 51 | |
|---|
| 52 | /* determines if function should run */ |
|---|
| 53 | bool run_flag; |
|---|
| 54 | |
|---|
| 55 | /* date of current file */ |
|---|
| 56 | time_t t; |
|---|
| 57 | |
|---|
| 58 | /* log file handle */ |
|---|
| 59 | FILE *fhandle; |
|---|
| 60 | |
|---|
| 61 | /* for wait_thread - day changed */ |
|---|
| 62 | bool volatile date_changed; |
|---|
| 63 | |
|---|
| 64 | /* for wait_thread - log file first open */ |
|---|
| 65 | bool volatile first_open; |
|---|
| 66 | |
|---|
| 67 | char *volatile log_path; |
|---|
| 68 | |
|---|
| 69 | off_t volatile current_offset; |
|---|
| 70 | }; |
|---|
| 71 | |
|---|
| 72 | #endif /* __PBS_DRMAA__LOG_READER_H */ |
|---|