[Spread-cvs] commit: r880 - in trunk: daemon libspread libspread-util/buildtools libspread-util/src
jschultz at spread.org
jschultz at spread.org
Mon Jan 23 06:30:41 EST 2017
Author: jschultz
Date: 2017-01-23 06:30:41 -0500 (Mon, 23 Jan 2017)
New Revision: 880
Modified:
trunk/daemon/Makefile.in
trunk/daemon/arch.h
trunk/daemon/ip_enum.c
trunk/daemon/log.c
trunk/daemon/network.c
trunk/daemon/spread.c
trunk/libspread-util/buildtools/fixpaths
trunk/libspread-util/src/data_link.c
trunk/libspread/sp.c
Log:
daemon/Makefile.in: Don't hardcode -ldl in $LIBSPREADUTIL_LIBS, if needed configure should put it in LIBS.
daemon/arch.h: Addded #include <stdint.h> to pick up INT32_MAX
daemon/ip_enum.c: Special case FreeBsd to not override scope id from getifaddrs
daemon/log.c: Reworked logic to only use append mode, not use fseek and ftell, and not add (and overwrite) alive timestamps
daemon/spread.c: Moved Log_init() to be after any chdir.
daemon/network.c: Put back special case to not bind to segment address if it is a singleton segment. Was breaking some old configuration files.
Added check to commit suicide if on reconfiguration we are going from singleton to non singleton segment bc on *nix we aren't already bound to segment addr.
libspread/sp.c: Allow a non-empty send to return 0. Could cause infinite loop if OS is misbehaving, but other send call was already allowing it.
libspread-util/buildtools/fixpaths: Removed deprecated defined checks.
libspread-util/src/data_link.c: Changed IPV6_MULTICAST_HOPS to use an int. Changed IPV6_MULTICAST_LOOP to use an int, but special case sun to use a char.
Thanks to Daniel Savarese for these patches
Modified: trunk/daemon/Makefile.in
===================================================================
--- trunk/daemon/Makefile.in 2017-01-23 09:08:43 UTC (rev 879)
+++ trunk/daemon/Makefile.in 2017-01-23 11:30:41 UTC (rev 880)
@@ -30,7 +30,7 @@
LIBSPREADUTIL_DIR=../libspread-util
LIBSPREADUTIL_PATHS=-I$(LIBSPREADUTIL_DIR)/include -I$(top_srcdir)/libspread-util/include
LIBSPREADUTIL_LDFLAGS=-rdynamic
-LIBSPREADUTIL_LIBS=-ldl
+LIBSPREADUTIL_LIBS=
CC=@CC@
LD=@LD@
Modified: trunk/daemon/arch.h
===================================================================
--- trunk/daemon/arch.h 2017-01-23 09:08:43 UTC (rev 879)
+++ trunk/daemon/arch.h 2017-01-23 11:30:41 UTC (rev 880)
@@ -36,6 +36,8 @@
#ifndef INC_ARCH
#define INC_ARCH
+#include <stdint.h>
+
/*
* Each record in this file represents an architecture.
* Each record contains the following fields:
Modified: trunk/daemon/ip_enum.c
===================================================================
--- trunk/daemon/ip_enum.c 2017-01-23 09:08:43 UTC (rev 879)
+++ trunk/daemon/ip_enum.c 2017-01-23 11:30:41 UTC (rev 880)
@@ -295,8 +295,12 @@
if (spu_addr_from_sockaddr_known(&addr, curr->ifa_addr))
Alarmp(SPLOG_FATAL, CONF_SYS, SPLOC ": ip_enum_getifaddrs: BUG! spu_addr_from_sockaddr_known failed?!");
+ /* FreeBSD fills in proper scope id, so don't override it */
+
+# if !defined(__FreeBSD__)
if (curr->ifa_addr->sa_family == AF_INET6)
addr.ipv6.sin6_scope_id = if_nametoindex(curr->ifa_name);
+# endif
add_ip(array, &addr);
}
Modified: trunk/daemon/log.c
===================================================================
--- trunk/daemon/log.c 2017-01-23 09:08:43 UTC (rev 879)
+++ trunk/daemon/log.c 2017-01-23 11:30:41 UTC (rev 880)
@@ -66,7 +66,6 @@
void Log_init()
{
- long start_file_pos;
proc my;
Is_inited = 1;
@@ -77,45 +76,24 @@
fd = fopen( My_name, "a" );
if( fd == NULL )
Alarm( EXIT, "Log_init: error (%s) could not open file %s\n",strerror(errno), My_name );
- start_file_pos = ftell(fd);
- if (start_file_pos == -1)
- Alarm( EXIT, "Log_init: failed to find end of file %s\n", My_name );
- fclose(fd);
- fd = fopen( My_name, "r+" );
- if( fd == NULL )
- Alarm( EXIT, "Log_init: error (%s) could not open file %s\n",strerror(errno), My_name );
- fseek( fd, start_file_pos, SEEK_SET );
-
+
alive_time.sec = 10;
alive_time.usec = 0;
+ fprintf( fd, "B %13ld\n", E_get_time().sec );
Log_alive(0, NULL);
- fprintf( fd, "B %13ld\n",E_get_time().sec );
- fflush( fd );
}
static void Log_alive(int dummy, void *dummy_p)
{
- long file_pos;
-
if( !Is_inited ) return;
-#if ( SPREAD_PROTOCOL == 3 )
- fprintf( fd, "A %13ld %11d\n",E_get_time().sec, Highest_seq );
-#else
- fprintf( fd, "A %13ld \n",E_get_time().sec );
-#endif
- if( fseek( fd, -28, SEEK_CUR ) )
- Alarm( EXIT, "Log_alive: error (%s) in fseek -28 on %s\n", strerror(errno), My_name);
- file_pos = ftell(fd);
- if( fseek( fd, 28, SEEK_CUR ) )
- Alarm( EXIT, "Log_alive: error (%s) in fseek 28 on %s\n", strerror(errno), My_name);
- fclose(fd);
- fd = fopen( My_name, "r+" );
+
+ fclose(fd);
+ fd = fopen( My_name, "a" );
+
if( fd == NULL )
Alarm( EXIT, "Log_alive: error (%s) could not open file %s\n",strerror(errno), My_name );
- if( fseek( fd, file_pos, SEEK_SET ) )
- Alarm( EXIT, "Log_alive: error (%s) in fseek file_pos (%ld) on %s\n", strerror(errno), file_pos, My_name);
-
+
E_queue( Log_alive, 0, NULL, alive_time );
}
@@ -128,6 +106,7 @@
int found;
if( !Is_inited ) return;
+
#if ( SPREAD_PROTOCOL == 3 )
fprintf( fd, "M %13ld %13d %11d > ",
E_get_time().sec, Memb_id().time, Highest_seq );
Modified: trunk/daemon/network.c
===================================================================
--- trunk/daemon/network.c 2017-01-23 09:08:43 UTC (rev 879)
+++ trunk/daemon/network.c 2017-01-23 11:30:41 UTC (rev 880)
@@ -58,7 +58,7 @@
static int Num_bcast_channels;
static int Num_token_channels;
-static bool Bcast_needed;
+static int Bcast_needed = -1;
static int Bcast_addrs_num;
static spu_addr Bcast_addrs[MAX_ADDRS_SEGMENT];
@@ -129,6 +129,7 @@
void Net_signal_conf_reload(void)
{
+ int old_bcast_needed = Bcast_needed;
proc dummy_proc;
int i;
@@ -152,6 +153,9 @@
else
Alarmp(SPLOG_INFO, NETWORK, "Net_signal_conf_reload: Bcast is not needed\n");
+
+ if (old_bcast_needed != -1 && Bcast_needed && !old_bcast_needed)
+ Alarmp(SPLOG_FATAL, NETWORK, "Net_signal_conf_reload: Bcast now needed when it wasn't originally; sockets need to be reestablished\n");
}
/********************************************************************************
@@ -287,7 +291,12 @@
*/
#ifndef ARCH_PC_WIN95
- for (i = 0; i < Bcast_addrs_num; ++i)
+ /* NOTE: for backwards compatability with old configurations we don't do this for singleton segments */
+ /* TODO: figure out a better way because not setting up this
+ * socket here means that if a singleton segment is reconfigured
+ * to have multiple daemons then this daemon needs to reboot */
+
+ for (i = 0; Bcast_needed && i < Bcast_addrs_num; ++i)
if (!bcast_bound[i]) /* didn't already explicity or implicitly bind to Bcast_addrs[i] above */
{
if_addr = Bcast_addrs[i];
Modified: trunk/daemon/spread.c
===================================================================
--- trunk/daemon/spread.c 2017-01-23 09:08:43 UTC (rev 879)
+++ trunk/daemon/spread.c 2017-01-23 11:30:41 UTC (rev 880)
@@ -207,7 +207,6 @@
Sess_init();
Stat_init();
- if( Log ) Log_init();
#ifndef ARCH_PC_WIN95
@@ -235,6 +234,8 @@
#endif /* ARCH_PC_WIN95 */
+ if( Log ) Log_init();
+
E_handle_events();
Sess_fini();
Modified: trunk/libspread/sp.c
===================================================================
--- trunk/libspread/sp.c 2017-01-23 09:08:43 UTC (rev 879)
+++ trunk/libspread/sp.c 2017-01-23 11:30:41 UTC (rev 880)
@@ -1444,7 +1444,7 @@
while(((ret=send( mbox, &head_buf[buf_len], sizeof(message_header)+MAX_GROUP_NAME*num_groups - buf_len, 0 )) == -1)
&& ((sock_errno == EINTR) || (sock_errno == EAGAIN) || (sock_errno == EWOULDBLOCK)) )
;
- if( ret <=0 )
+ if( ret < 0 )
{
Alarm( SESSION, "SP_internal_multicast: error %d sending header and groups on mailbox %d: %s \n", ret, mbox, sock_strerror(sock_errno));
Mutex_lock( &Struct_mutex );
Modified: trunk/libspread-util/buildtools/fixpaths
===================================================================
--- trunk/libspread-util/buildtools/fixpaths 2017-01-23 09:08:43 UTC (rev 879)
+++ trunk/libspread-util/buildtools/fixpaths 2017-01-23 11:30:41 UTC (rev 880)
@@ -5,7 +5,7 @@
$usage = "Usage: $0 [-Dstring=replacement] [[infile] ...]\n";
-if (!defined(@ARGV)) { die ("$usage"); }
+if (! @ARGV) { die ("$usage"); }
# read in the command line and get some definitions
while ($_=$ARGV[0], /^-/) {
@@ -23,7 +23,7 @@
}
} # while parsing arguments
-if (!defined(%def)) {
+if (! %def) {
die ("$0: nothing to do - no substitutions listed!\n");
}
Modified: trunk/libspread-util/src/data_link.c
===================================================================
--- trunk/libspread-util/src/data_link.c 2017-01-23 09:08:43 UTC (rev 879)
+++ trunk/libspread-util/src/data_link.c 2017-01-23 11:30:41 UTC (rev 880)
@@ -219,15 +219,19 @@
{
Alarmp(SPLOG_INFO, DATA_LINK, "DL_init_channel_gen: setting IPv6 mulitcast hops to 1 for send channel\n");
- if (setsockopt(chan, IPPROTO_IPV6, IPV6_MULTICAST_HOPS, (tmp_uchar = 1, &tmp_uchar), sizeof(tmp_uchar)))
+ if (setsockopt(chan, IPPROTO_IPV6, IPV6_MULTICAST_HOPS, (tmp_int = 1, &tmp_int), sizeof(tmp_int)))
Alarmp(SPLOG_FATAL, DATA_LINK, "DL_init_channel_gen: problem (%d: %s) in setsockopt of multicast hops = 1; ignore on Windows\n",
sock_errno, sock_strerror(sock_errno));
if (channel_type & NO_LOOP)
{
Alarmp(SPLOG_INFO, DATA_LINK, "DL_init_channel_gen: Disabling IPv6 multicast loopback\n");
-
+
+#ifdef __sun
if (setsockopt(chan, IPPROTO_IPV6, IPV6_MULTICAST_LOOP, (tmp_uchar = 0, &tmp_uchar), sizeof(tmp_uchar)))
+#else
+ if (setsockopt(chan, IPPROTO_IPV6, IPV6_MULTICAST_LOOP, (tmp_int = 0, &tmp_int), sizeof(tmp_int)))
+#endif
Alarmp(SPLOG_FATAL, DATA_LINK, "DL_init_channel_gen: error (%d: %s) in disabling ipv6 loopback!\n", sock_errno, sock_strerror(sock_errno));
}
}
More information about the Spread-cvs
mailing list