From 00c46ce5ed6698358296c9c70f8a748c2000426c Mon Sep 17 00:00:00 2001
From: Morris Jette <jette@schedmd.com>
Date: Wed, 13 Mar 2013 14:32:47 -0700
Subject: [PATCH] Add "--enable-rfc5424time-secs" configure parameter

Add milliseconds to default log message header with the (default)
RFC5424 time format. Disable milliseconds logging using the configure
parameter "--enable-rfc5424time-secs". Sample time stamp format is as
follows: "2013-03-13T14:28:17.767-07:00".
---
 NEWS                                       |  4 +++
 RELEASE_NOTES                              |  4 +++
 auxdir/x_ac_rfc5424_time.m4                | 23 +++++++++++++++
 config.h.in                                |  3 ++
 configure                                  | 34 ++++++++++++++++++++++
 src/plugins/slurmctld/dynalloc/Makefile.in | 11 +++++--
 6 files changed, 76 insertions(+), 3 deletions(-)

diff --git a/NEWS b/NEWS
index 1e755c8d037..ff96126f0a5 100644
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,10 @@ documents those changes that are of interest to users and admins.
 
 * Changes in Slurm 2.6.0pre3
 ============================
+ -- Add milliseconds to default log message header with the (default)
+    RFC5424 time format. Disable milliseconds logging using the configure
+    parameter "--enable-rfc5424time-secs". Sample time stamp format is as
+    follows: "2013-03-13T14:28:17.767-07:00".
 
 * Changes in Slurm 2.6.0pre2
 ============================
diff --git a/RELEASE_NOTES b/RELEASE_NOTES
index c99e91fa72e..aeda79b8246 100644
--- a/RELEASE_NOTES
+++ b/RELEASE_NOTES
@@ -92,6 +92,10 @@ OTHER CHANGES
  - Added SLURM_SUBMIT_HOST to salloc, sbatch and srun job environment.
  - Added SLURM_ARRAY_TASK_ID and SLURM_ARRAY_TASK_ID to environment of job
    array.
+ - Added milliseconds to default log message header with the (default)
+   RFC5424 time format. Disable milliseconds logging using the configure
+   parameter "--enable-rfc5424time-secs". Sample time stamp format is as
+   follows: "2013-03-13T14:28:17.767-07:00".
 
 API CHANGES
 ===========
diff --git a/auxdir/x_ac_rfc5424_time.m4 b/auxdir/x_ac_rfc5424_time.m4
index 010cec41a7d..c33706b98ff 100644
--- a/auxdir/x_ac_rfc5424_time.m4
+++ b/auxdir/x_ac_rfc5424_time.m4
@@ -30,5 +30,28 @@ AC_DEFUN([X_AC_RFC5424_TIME], [
   else
     AC_MSG_RESULT([no])
   fi
+
+  if test "$x_ac_rfc5424time" = yes; then
+    AC_MSG_CHECKING([resolution of RFC 5424 time to the second])
+    AC_ARG_ENABLE(
+      [rfc5424time-secs],
+      AS_HELP_STRING(--enable-rfc5424time-secs, record RFC 5424 time to second resolution),
+      [ case "$enableval" in
+          yes) x_ac_rfc5424time_secs=yes ;;
+           no) x_ac_rfc5424time_secs=no ;;
+            *) AC_MSG_RESULT([doh!])
+               AC_MSG_ERROR([bad value "$enableval" for --enable-rfc5424time-secs]) ;;
+        esac
+      ],
+      [x_ac_rfc5424time_secs=no]
+    )
+
+    if test "$x_ac_rfc5424time_secs" = yes; then
+      AC_MSG_RESULT([yes])
+      AC_DEFINE(USE_RFC5424_TIME_SECS,,[RFC 5424 time format to second resolution])
+    else
+      AC_MSG_RESULT([no])
+    fi
+  fi
 ])
 
diff --git a/config.h.in b/config.h.in
index 42c757a45ba..2e1ac08b490 100644
--- a/config.h.in
+++ b/config.h.in
@@ -506,6 +506,9 @@
 /* define if using RFC 5424 time format */
 #undef USE_RFC5424_TIME
 
+/* RFC 5424 time format to second resolution */
+#undef USE_RFC5424_TIME_SECS
+
 /* Version number of package */
 #undef VERSION
 
diff --git a/configure b/configure
index a1d2df1f4f4..0c59d39809c 100755
--- a/configure
+++ b/configure
@@ -943,6 +943,7 @@ with_cpusetdir
 enable_pam
 with_pam_dir
 enable_rfc5424time
+enable_rfc5424time_secs
 enable_iso8601
 enable_load_env_no_login
 enable_sun_const
@@ -1630,6 +1631,8 @@ Optional Features:
   --enable-pam            enable PAM (Pluggable Authentication Modules)
                           support
   --disable-rfc5424time   disable RFC 5424 time format support
+  --enable-rfc5424time-secs
+                          record RFC 5424 time to second resolution
   --disable-iso8601       disable ISO 8601 time format support
   --enable-load-env-no-login
                           enable --get-user-env option to load user
@@ -18769,6 +18772,37 @@ $as_echo "#define USE_RFC5424_TIME /**/" >>confdefs.h
 $as_echo "no" >&6; }
   fi
 
+  if test "$x_ac_rfc5424time" = yes; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking resolution of RFC 5424 time to the second" >&5
+$as_echo_n "checking resolution of RFC 5424 time to the second... " >&6; }
+    # Check whether --enable-rfc5424time-secs was given.
+if test "${enable_rfc5424time_secs+set}" = set; then :
+  enableval=$enable_rfc5424time_secs;  case "$enableval" in
+          yes) x_ac_rfc5424time_secs=yes ;;
+           no) x_ac_rfc5424time_secs=no ;;
+            *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: doh!" >&5
+$as_echo "doh!" >&6; }
+               as_fn_error $? "bad value \"$enableval\" for --enable-rfc5424time-secs" "$LINENO" 5 ;;
+        esac
+
+else
+  x_ac_rfc5424time_secs=no
+
+fi
+
+
+    if test "$x_ac_rfc5424time_secs" = yes; then
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+$as_echo "#define USE_RFC5424_TIME_SECS /**/" >>confdefs.h
+
+    else
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+    fi
+  fi
+
 
 
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable ISO 8601 time format support" >&5
diff --git a/src/plugins/slurmctld/dynalloc/Makefile.in b/src/plugins/slurmctld/dynalloc/Makefile.in
index 965e6cf58ef..93cebfae5e9 100644
--- a/src/plugins/slurmctld/dynalloc/Makefile.in
+++ b/src/plugins/slurmctld/dynalloc/Makefile.in
@@ -133,14 +133,16 @@ LTLIBRARIES = $(pkglib_LTLIBRARIES)
 slurmctld_dynalloc_la_LIBADD =
 am__slurmctld_dynalloc_la_SOURCES_DIST = allocate.c allocate.h \
 	allocator.c allocator.h argv.c argv.h deallocate.c \
-	deallocate.h info.c info.h msg.c msg.h slurmctld_dynalloc.c
+	deallocate.h info.c info.h job_ports_list.c job_ports_list.h \
+	msg.c msg.h slurmctld_dynalloc.c
 am__objects_1 = allocate.lo allocator.lo argv.lo deallocate.lo info.lo \
-	msg.lo slurmctld_dynalloc.lo
+	job_ports_list.lo msg.lo slurmctld_dynalloc.lo
 @SLURM_ENABLE_DYNAMIC_ALLOCATION_TRUE@am_slurmctld_dynalloc_la_OBJECTS =  \
 @SLURM_ENABLE_DYNAMIC_ALLOCATION_TRUE@	$(am__objects_1)
 am__EXTRA_slurmctld_dynalloc_la_SOURCES_DIST = allocate.c allocate.h \
 	allocator.c allocator.h argv.c argv.h deallocate.c \
-	deallocate.h info.c info.h msg.c msg.h slurmctld_dynalloc.c
+	deallocate.h info.c info.h job_ports_list.c job_ports_list.h \
+	msg.c msg.h slurmctld_dynalloc.c
 slurmctld_dynalloc_la_OBJECTS = $(am_slurmctld_dynalloc_la_OBJECTS)
 slurmctld_dynalloc_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
 	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
@@ -399,6 +401,8 @@ AS_DYNALLOC_SOURCES = \
 	deallocate.h \
 	info.c	\
 	info.h	\
+	job_ports_list.c \
+	job_ports_list.h \
 	msg.c	\
 	msg.h	\
 	slurmctld_dynalloc.c
@@ -487,6 +491,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/argv.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/deallocate.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/info.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/job_ports_list.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/msg.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/slurmctld_dynalloc.Plo@am__quote@
 
-- 
GitLab