Skip to content

Commit

Permalink
Handle 64 bit time_t on 32 bit systems
Browse files Browse the repository at this point in the history
  • Loading branch information
ellert committed Mar 10, 2024
1 parent bf7f2c4 commit a07ad6f
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 46 deletions.
40 changes: 20 additions & 20 deletions gram/jobmanager/lrms/lsf/source/configure.ac
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
AC_PREREQ([2.60])

AC_INIT([globus_gram_job_manager_lsf],[3.0],[https://github.com/gridcf/gct/issues])
AC_INIT([globus_gram_job_manager_lsf],[3.1],[https://github.com/gridcf/gct/issues])
AC_CONFIG_MACRO_DIR([m4])
AC_SUBST([MAJOR_VERSION], [${PACKAGE_VERSION%%.*}])
AC_SUBST([MINOR_VERSION], [${PACKAGE_VERSION##*.}])
Expand Down Expand Up @@ -29,11 +29,11 @@ fi

AC_ARG_WITH([lsf-profile],
AC_HELP_STRING(
[--with-lsf-profile=FILE],
[--with-lsf-profile=FILE],
[Use LSF profile located at PATH ${LSF_ENVDIR:-/etc}/profile.lsf]),
[LSF_PROFILE=$withval],
[LSF_PROFILE="${LSF_ENVDIR:-/etc}/profile.lsf"
AC_MSG_WARN([Using default lsf profile of $LSF_PROFILE])])
[LSF_PROFILE=$withval],
[LSF_PROFILE="${LSF_ENVDIR:-/etc}/profile.lsf"
AC_MSG_WARN([Using default lsf profile of $LSF_PROFILE])])

AC_SUBST(LSF_PROFILE)

Expand Down Expand Up @@ -88,30 +88,30 @@ AC_ARG_WITH(log-path,
AC_SUBST(LSF_LOG_PATH)

AC_ARG_WITH(globus-state-dir,
AC_HELP_STRING(
[--with-globus-state-dir=PATH],
[Path to Globus state files]),
globusstatedir="$withval",
globusstatedir=$localstatedir)
AC_HELP_STRING(
[--with-globus-state-dir=PATH],
[Path to Globus state files]),
globusstatedir="$withval",
globusstatedir=$localstatedir)

# GRAM-333: SEG config in installer has variables that aren't resolved at
# runtime
globusstatedir="`eval echo $globusstatedir`"
AC_SUBST(globusstatedir)

AC_ARG_WITH(seg,
AC_HELP_STRING(
[--with-seg=yes|no],
[Enable GRAM configuration with the SEG module]),
SEG_ENABLED="$withval",
SEG_ENABLED="no")
AC_HELP_STRING(
[--with-seg=yes|no],
[Enable GRAM configuration with the SEG module]),
SEG_ENABLED="$withval",
SEG_ENABLED="no")
case "$SEG_ENABLED" in
yes|no)
yes|no)
:
;;
*)
AC_MSG_ERROR([Invalid argument to --with-seg])
;;
*)
AC_MSG_ERROR([Invalid argument to --with-seg])
;;
esac

AC_ARG_WITH([perlmoduledir],
Expand All @@ -137,5 +137,5 @@ AC_CONFIG_FILES(
globus-lsf.conf
Makefile
seg/Makefile
version.h)
version.h)
AC_OUTPUT
53 changes: 29 additions & 24 deletions gram/jobmanager/lrms/lsf/source/seg/seg_lsf_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -628,6 +628,7 @@ globus_l_lsf_find_logfile(
const char lsf_idx_name[] = "lsb.events.1";
int i;
time_t most_recent_event;
long long tmp_most_recent_event;
GlobusFuncName(globus_l_lsf_find_logfile);

SEGLsfEnter();
Expand Down Expand Up @@ -683,7 +684,8 @@ globus_l_lsf_find_logfile(
}
else
{
fscanf(state->fp, "#%ld", &most_recent_event);
fscanf(state->fp, "#%lld", &tmp_most_recent_event);
most_recent_event = tmp_most_recent_event;
fclose(state->fp);
state->fp = NULL;
}
Expand Down Expand Up @@ -805,6 +807,7 @@ globus_l_lsf_parse_events(
{
char * eol;
time_t event_timestamp;
long long tmp_timestamp;
char event_type_buffer[64];
char job_id_buffer[32];
int rc;
Expand Down Expand Up @@ -848,15 +851,17 @@ globus_l_lsf_parse_events(
* the parsing timestamp to match that when we hit EOF.
*/
sscanf(state->buffer + state->buffer_point + 1,
"%ld", &state->end_of_file_timestamp);
"%lld", &tmp_timestamp);
state->end_of_file_timestamp = tmp_timestamp;
goto next_line;
}
}
sscanf(state->buffer + state->buffer_point,
"\"%[^\"]\" \"%*[^\"]\" %ld %s",
"\"%[^\"]\" \"%*[^\"]\" %lld %s",
event_type_buffer,
&event_timestamp,
&tmp_timestamp,
job_id_buffer);
event_timestamp = tmp_timestamp;

if (event_timestamp < state->start_timestamp)
{
Expand Down Expand Up @@ -895,25 +900,25 @@ globus_l_lsf_parse_events(
*/

SEGLsfDebug(SEG_LSF_DEBUG_TRACE,
("ignoring JOB_STATUS: job %s in PEND state (%ld)\n",
job_id_buffer, event_timestamp));
("ignoring JOB_STATUS: job %s in PEND state (%lld)\n",
job_id_buffer, (long long) event_timestamp));
break;
case JOB_STAT_PSUSP:
/*
* The job has been suspended, either by its owner or
* the LSF administrator, while pending.
*/
SEGLsfDebug(SEG_LSF_DEBUG_TRACE,
("ignoring JOB_STATUS: job %s in PSUSP state (%ld)\n",
job_id_buffer, event_timestamp));
("ignoring JOB_STATUS: job %s in PSUSP state (%lld)\n",
job_id_buffer, (long long) event_timestamp));
break;
case JOB_STAT_RUN:
/*
* the job is currently running.
*/
SEGLsfDebug(SEG_LSF_DEBUG_TRACE,
("ignoring JOB_STATUS: job %s in RUN state (%ld)\n",
job_id_buffer, event_timestamp));
("ignoring JOB_STATUS: job %s in RUN state (%lld)\n",
job_id_buffer, (long long) event_timestamp));
break;

case JOB_STAT_SSUSP:
Expand All @@ -928,17 +933,17 @@ globus_l_lsf_parse_events(
* bqueues(1),
*/
SEGLsfDebug(SEG_LSF_DEBUG_TRACE,
("ignoring JOB_STATUS: job %s in SSUSP state (%ld)\n",
job_id_buffer, event_timestamp));
("ignoring JOB_STATUS: job %s in SSUSP state (%lld)\n",
job_id_buffer, (long long) event_timestamp));
break;
case JOB_STAT_USUSP:
/*
* The job has been suspended, either by its owner or
* the LSF administrator, while running.
*/
SEGLsfDebug(SEG_LSF_DEBUG_TRACE,
("ignoring JOB_STATUS: job %s in SSUSP state (%ld)\n",
job_id_buffer, event_timestamp));
("ignoring JOB_STATUS: job %s in SSUSP state (%lld)\n",
job_id_buffer, (long long) event_timestamp));
break;
case JOB_STAT_EXIT:
/*
Expand Down Expand Up @@ -1000,36 +1005,36 @@ globus_l_lsf_parse_events(
* Post job process done successfully
*/
SEGLsfDebug(SEG_LSF_DEBUG_TRACE,
("ignoring JOB_STATUS: job %s in PDONE state (%ld)\n",
job_id_buffer, event_timestamp));
("ignoring JOB_STATUS: job %s in PDONE state (%lld)\n",
job_id_buffer, (long long) event_timestamp));
break;
case JOB_STAT_PERR:
/*
* Post job process has error
*/
SEGLsfDebug(SEG_LSF_DEBUG_TRACE,
("ignoring JOB_STATUS: job %s in PERR state (%ld)\n",
job_id_buffer, event_timestamp));
("ignoring JOB_STATUS: job %s in PERR state (%lld)\n",
job_id_buffer, (long long) event_timestamp));
break;
case JOB_STAT_WAIT:
/*
* For jobs submitted to a chunk job queue, members of a
* chunk job that are waiting to run.
*/
SEGLsfDebug(SEG_LSF_DEBUG_TRACE,
("ignoring JOB_STATUS: job %s in WAIT state (%ld)\n",
job_id_buffer, event_timestamp));
("ignoring JOB_STATUS: job %s in WAIT state (%lld)\n",
job_id_buffer, (long long) event_timestamp));
break;
case JOB_STAT_UNKWN:
SEGLsfDebug(SEG_LSF_DEBUG_TRACE,
("ignoring JOB_STATUS: job %s in UNKNWN state "
"(%ld)\n",
job_id_buffer, event_timestamp));
"(%lld)\n",
job_id_buffer, (long long) event_timestamp));
break;
case JOB_STAT_NULL:
SEGLsfDebug(SEG_LSF_DEBUG_TRACE,
("ignoring JOB_STATUS: job %s in NULL state (%ld)\n",
job_id_buffer, event_timestamp));
("ignoring JOB_STATUS: job %s in NULL state (%lld)\n",
job_id_buffer, (long long) event_timestamp));
break;
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
globus-gram-job-manager-lsf (3.1-1+gct.@distro@) @distro@; urgency=medium

* Handle 64 bit time_t on 32 bit systems

-- Mattias Ellert <[email protected]> Sun, 10 Mar 2024 20:41:04 +0100

globus-gram-job-manager-lsf (3.0-1+gct.@distro@) @distro@; urgency=medium

* First Grid Community Toolkit release
Expand Down
7 changes: 5 additions & 2 deletions packaging/fedora/globus-gram-job-manager-lsf.spec
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

Name: globus-gram-job-manager-lsf
%global _name %(echo %{name} | tr - _)
Version: 3.0
Release: 2%{?dist}
Version: 3.1
Release: 1%{?dist}
Summary: Grid Community Toolkit - LSF Job Manager Support

Group: Applications/Internet
Expand Down Expand Up @@ -170,6 +170,9 @@ fi
%config(noreplace) %{_sysconfdir}/globus/scheduler-event-generator/available/lsf

%changelog
* Sun Mar 10 2024 Mattias Ellert <[email protected]> - 3.1-1
- Handle 64 bit time_t on 32 bit systems

* Thu Mar 12 2020 Mattias Ellert <[email protected]> - 3.0-2
- Add BuildRequires perl-interpreter

Expand Down

0 comments on commit a07ad6f

Please sign in to comment.