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 11, 2024
1 parent 2df5a46 commit 1127f41
Show file tree
Hide file tree
Showing 21 changed files with 212 additions and 143 deletions.
50 changes: 25 additions & 25 deletions gram/jobmanager/lrms/fork/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_fork],[3.3],[https://github.com/gridcf/gct/issues])
AC_INIT([globus_gram_job_manager_fork],[3.4],[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 @@ -38,33 +38,33 @@ AC_ARG_WITH(softenv-dir,
AC_SUBST(SOFTENV_DIR)

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)
SEG_CLAUSE="-seg-module fork"
;;
no)
SEG_CLAUSE=""
;;
*)
AC_MSG_ERROR([Invalid argument to --with-seg])
;;
yes)
SEG_CLAUSE="-seg-module fork"
;;
no)
SEG_CLAUSE=""
;;
*)
AC_MSG_ERROR([Invalid argument to --with-seg])
;;
esac

AC_SUBST(SEG_CLAUSE)
Expand All @@ -89,9 +89,9 @@ AC_SUBST(perlmoduledir)
AC_CONFIG_FILES(
globus-gram-job-manager-fork-uninstalled.pc
globus-gram-job-manager-fork.pc
Makefile
globus-fork.conf
starter/Makefile
seg/Makefile
version.h)
Makefile
globus-fork.conf
starter/Makefile
seg/Makefile
version.h)
AC_OUTPUT
7 changes: 5 additions & 2 deletions gram/jobmanager/lrms/fork/source/seg/seg_fork_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -688,6 +688,7 @@ globus_l_fork_parse_events(
char * p;
int protocol_msg_type;
time_t stamp;
long long tmp_stamp;
char * jobid;
int job_state;
int exit_code;
Expand All @@ -711,9 +712,9 @@ globus_l_fork_parse_events(

exit_code = EXIT_CODE_UNASSIGNED;

rc = sscanf(p, "%d;%ld;%n%*[^;]%n;%d;%d",
rc = sscanf(p, "%d;%lld;%n%*[^;]%n;%d;%d",
&protocol_msg_type,
&stamp,
&tmp_stamp,
&jobid_start,
&jobid_end,
&job_state,
Expand All @@ -724,6 +725,8 @@ globus_l_fork_parse_events(
goto bad_line;
}

stamp = (time_t) tmp_stamp;

jobid = p + jobid_start;
*(p + jobid_end) = '\0';

Expand Down
4 changes: 2 additions & 2 deletions gram/jobmanager/lrms/fork/source/starter/fork_starter.c
Original file line number Diff line number Diff line change
Expand Up @@ -1230,8 +1230,8 @@ globus_l_fork_log_state_change(
return;
}
fprintf(logfile,
"001;%lu;%s:%lu;%d;%d\n",
(unsigned long) now,
"001;%lld;%s:%lu;%d;%d\n",
(long long) now,
task->jobid_prefix,
(unsigned long) pid,
(int) job_state,
Expand Down
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
4 changes: 2 additions & 2 deletions gram/jobmanager/scheduler_event_generator/source/configure.ac
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
AC_PREREQ([2.60])

AC_INIT([globus_scheduler_event_generator],[6.5],[https://github.com/gridcf/gct/issues])
AC_INIT([globus_scheduler_event_generator],[6.6],[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 @@ -134,7 +134,7 @@ AC_CONFIG_FILES(
init/globus-scheduler-event-generator-lsb
init/Makefile
test/Makefile
version.h)
version.h)
AC_CONFIG_FILES([globus-scheduler-event-generator-admin],
[chmod a+x globus-scheduler-event-generator-admin])
AC_OUTPUT
Loading

0 comments on commit 1127f41

Please sign in to comment.