[Spread-cvs] commit: r907 - libspreadutil/trunk/src

jschultz at spread.org jschultz at spread.org
Mon Aug 20 17:38:12 EDT 2018


Author: jschultz
Date: 2018-08-20 17:38:12 -0400 (Mon, 20 Aug 2018)
New Revision: 907

Modified:
   libspreadutil/trunk/src/alarm.c
   libspreadutil/trunk/src/events.c
Log:
Increased default / static Alarm print length
Changed events back to exit if gettimeofday or clock_gettime fail


Modified: libspreadutil/trunk/src/alarm.c
===================================================================
--- libspreadutil/trunk/src/alarm.c	2018-08-20 21:16:48 UTC (rev 906)
+++ libspreadutil/trunk/src/alarm.c	2018-08-20 21:38:12 UTC (rev 907)
@@ -61,7 +61,7 @@
 #include "spu_alarm.h"
 #include "spu_events.h"
 
-#define MAX_ALARM_MESSAGE_BUF 512
+#define MAX_ALARM_MESSAGE_BUF 1024
 
 static const char Alarm_Warning_High_Res[]  = "*** WARNING *** Alarmp: High precision timestamp output failed!\n";
 static const char Alarm_Warning_Timestamp[] = "*** WARNING *** Alarmp: Timestamp didn't fit in default size buffer!\n";

Modified: libspreadutil/trunk/src/events.c
===================================================================
--- libspreadutil/trunk/src/events.c	2018-08-20 21:16:48 UTC (rev 906)
+++ libspreadutil/trunk/src/events.c	2018-08-20 21:38:12 UTC (rev 907)
@@ -162,7 +162,9 @@
         struct timeval read_time;
         sp_time        t;
 
-	gettimeofday( &read_time, NULL );
+	if ( gettimeofday( &read_time, NULL ) )
+            Alarmp( SPLOG_FATAL, EVENTS, "E_get_time: gettimeofday failed with %d '%s'\n", errno, strerror( errno ) );
+        
         t.sec  = read_time.tv_sec;
         t.usec = read_time.tv_usec;
 
@@ -191,7 +193,9 @@
 {
         struct timespec t;
 
-        clock_gettime( CLOCK_MONOTONIC, &t );
+        if ( clock_gettime( CLOCK_MONOTONIC, &t ) )
+            Alarmp( SPLOG_FATAL, EVENTS, "E_get_time_monotonic: clock_gettime failed with %d '%s'\n", errno, strerror( errno ) );
+        
         Now.sec  = (long) t.tv_sec;
         Now.usec = (long) ( ( t.tv_nsec + 500 ) / 1000 );
 
@@ -306,7 +310,7 @@
 			Time_queue = Time_queue->next;
 			dispose( t_pre );
 			deleted = 1;
-			Alarmp( SPLOG_INFO, EVENTS, "E_queue: dequeued a (first) simillar event\n" );
+			Alarmp( SPLOG_INFO, EVENTS, "E_queue: dequeued a (first) similar event\n" );
 		}
 	}
 	if( Time_queue == NULL )
@@ -601,9 +605,9 @@
 	/* Windows bug: Reports FD_SETSIZE of 64 but select works on all
 	 * fd's even ones with numbers greater then 64.
 	 */
-        if( fd < 0 || fd > FD_SETSIZE )
+        if( fd < 0 || fd >= FD_SETSIZE )
         {
-                Alarmp( SPLOG_PRINT, EVENTS, "E_attach_fd: invalid fd %d (max %d) with fd_type %d with priority %d\n", fd, FD_SETSIZE, fd_type, priority );
+                Alarmp( SPLOG_PRINT, EVENTS, "E_attach_fd: invalid fd %d (max %d) with fd_type %d with priority %d\n", fd, FD_SETSIZE - 1, fd_type, priority );
                 return( -1 );
         }
 #endif




More information about the Spread-cvs mailing list