Exemple #1
0
static	void 	Send_status_query()
{

	int32	proc_id;
	proc	p;
	int	proc_index;
	int	i,j;

	Pack.type    = STATUS_TYPE;
	Pack.type    = Set_endian( Pack.type );
        Pack.conf_hash = MONITOR_HASH;
	Pack.data_len= 0;

	Pack_scat.num_elements    = 1;

	Alarm( PRINT  , "Monitor: send status query\n");
	for( i=0; i < Cn.num_segments ; i++ )
	{
	    for( j=0; j < Cn.segments[i].num_procs; j++ )
	    {
		proc_id = Cn.segments[i].procs[j]->id;
		proc_index = Conf_proc_by_id( proc_id, &p );
		if( Status_vector[proc_index] )
		{
			DL_send( SendChan, p.id, p.port, &Pack_scat );
		}
	    }
	}
#ifndef _REENTRANT
	E_queue( Send_status_query, 0, NULL, Send_status_timeout );
#endif
}
Exemple #2
0
static	void	Send_flow_control()
{
	int32	proc_id;
	proc	p;
	int	proc_index;
	int	i,j;

	Pack.type    = FC_TYPE;
	Pack.type    = Set_endian( Pack.type );
        Pack.conf_hash = MONITOR_HASH;
	Pack.data_len= sizeof( Fc_buf );;

	Pack_scat.num_elements    = 2;
	Pack_scat.elements[1].len = sizeof( Fc_buf );
	Pack_scat.elements[1].buf = (char *)&Fc_buf;

	Alarm( PRINT  , "Monitor: send flow control params\n");
	for( i=0; i < Cn.num_segments ; i++ )
	{
	    for( j=0; j < Cn.segments[i].num_procs; j++ )
	    {
		proc_id = Cn.segments[i].procs[j]->id;
		proc_index = Conf_proc_by_id( proc_id, &p );
		DL_send( SendChan, p.id, p.port, &Pack_scat );
		DL_send( SendChan, p.id, p.port, &Pack_scat );
	    }
	}
}
Exemple #3
0
static	void	Send_partition()
{
	int32	proc_id;
	proc	p;
	int	proc_index;
	int	i,j;

	Pack.type    = PARTITION_TYPE;
	Pack.type    = Set_endian( Pack.type );
        Pack.conf_hash = MONITOR_HASH;
	Pack.data_len= sizeof( Partition );;

	Pack_scat.num_elements    = 2;
	Pack_scat.elements[1].len = sizeof( Partition );
	Pack_scat.elements[1].buf = (char *)&Partition;

	Alarm( PRINT  , "Monitor: send partition\n");
	for( i=0; i < Cn.num_segments ; i++ )
	{
	    for( j=0; j < Cn.segments[i].num_procs; j++ )
	    {
		proc_id = Cn.segments[i].procs[j]->id;
		proc_index = Conf_proc_by_id( proc_id, &p );
		DL_send( SendChan, p.id, p.port, &Pack_scat );
		DL_send( SendChan, p.id, p.port, &Pack_scat );
	    }
	}
#ifndef _REENTRANT
	E_queue( Send_partition, 0, NULL, Send_partition_timeout );
#endif
}
Exemple #4
0
void	Stat_init()
{
	int16	dummy_port = 0;

	Start_time = E_get_time();

	Report_channel = DL_init_channel( SEND_CHANNEL, dummy_port, 0, Conf_my().id );

	Report_scat.num_elements = 2;
	Report_scat.elements[0].len = sizeof( packet_header );
	Report_scat.elements[0].buf = (char *)&Pack;
	Report_scat.elements[1].len = sizeof( status );
	Report_scat.elements[1].buf = (char *)&GlobalStatus;

	Pack.type = STATUS_TYPE;
	Pack.type = Set_endian( Pack.type );
	Pack.data_len = sizeof( status );
	Pack.proc_id = Conf_my().id;

	GlobalStatus.major_version = SP_MAJOR_VERSION;
	GlobalStatus.minor_version = SP_MINOR_VERSION;
	GlobalStatus.patch_version = SP_PATCH_VERSION;

	Alarm( STATUS, "Stat_init: went ok\n" );

}
Exemple #5
0
static	void	Kill_spreads()
{
	int16	Kill_partition[MAX_PROCS_RING];
	proc	p;
	int	proc_index;
	int32	proc_id;
	char	str[80];
	int	legal, ret;
	int	i, j;
	int	end;

	for( i=0; i < MAX_PROCS_RING; i++ )
		Kill_partition[i] = 0;

        end = 0;
        while( !end )
        {
                for( legal=0; !legal; )
                {
                    printf("\tEnter Proc Name to Terminate: ");

                    if( fgets( str, 70, stdin ) == NULL )
                    {
                        printf("Bye.\n");
                        exit(0);
                    }
                    ret = sscanf(str, "%s", p.name );
                    if( ret > 0  || str[0] == '\n' ) legal = 1;
                    else printf("Please enter a legal proc name, none, or all\n");
                }
                if( str[0] == '\n' ){
                        end = 1;
                }else if( !strcmp( p.name, "all" ) ){
                        for( i=0; i < Conf_num_procs( &Cn ); i++ )
                                Kill_partition[i] = -1;
                }else if( !strcmp( p.name, "none" ) ){
                        for( i=0; i < Conf_num_procs( &Cn ); i++ )
                                Kill_partition[i] = 0;
                }else{
                        proc_index = Conf_proc_by_name( p.name, &p );
                        if( proc_index != -1 ){
                                Kill_partition[proc_index] = -1;
                        }else printf("Please! enter a legal proc name, none, or all\n");
                }
        }
	for( i=0; i < Conf_num_procs( &Cn ); i++ )
	{
		if( Kill_partition[i] != -1 ) Kill_partition[i] = Partition[i];
	}
	Pack.type    = PARTITION_TYPE;
	Pack.type    = Set_endian( Pack.type );
        Pack.conf_hash = MONITOR_HASH;
	Pack.data_len= sizeof( Kill_partition );;

	Pack_scat.num_elements    = 2;
	Pack_scat.elements[1].len = sizeof( Kill_partition );
	Pack_scat.elements[1].buf = (char *)&Kill_partition;

	for( i=0; i < Cn.num_segments ; i++ )
	{
	    for( j=0; j < Cn.segments[i].num_procs; j++ )
	    {
		proc_id = Cn.segments[i].procs[j]->id;
		proc_index = Conf_proc_by_id( proc_id, &p );
		if( Kill_partition[proc_index] == -1 )
		{
			Alarm( PRINT  , "Monitor: Terminating %s\n", p.name );
			DL_send( SendChan, p.id, p.port, &Pack_scat );
			DL_send( SendChan, p.id, p.port, &Pack_scat );
		}
	    }
	}
}
Exemple #6
0
/* Send message to all daemons to reload their configuration files to change the set of daemons */
static  void    Reload_Conf()
{
       	int32	proc_id;
	proc	p;
	int	proc_index;
	int	i,j;

	Pack.type    = RELOAD_TYPE;
	Pack.type    = Set_endian( Pack.type );
        Pack.conf_hash = MONITOR_HASH;
	Pack.data_len = 0;

	Pack_scat.num_elements    = 1;

        Alarm( PRINT, "Old configuration hash is: %u\n", Cn.hash_code);

	Alarm( PRINT  , "Monitor: send conf reload command\n");
	for( i=0; i < Cn.num_segments ; i++ )
	{
	    for( j=0; j < Cn.segments[i].num_procs; j++ )
	    {
		proc_id = Cn.segments[i].procs[j]->id;
		proc_index = Conf_proc_by_id( proc_id, &p );
		DL_send( SendChan, p.id, p.port, &Pack_scat );
	    }
	}
        /* Now reload monitor's configuration 
         * and clear all Partition, Status, FC arrays as they are now inaccurate
         */

        read_configuration();

        for( i=0; i < Conf_num_procs( &Cn ); i++ )
	{
            Partition[i] = 0;
            Work_partition[i] = 0;
            Fc_buf[i][0] = 0;
            Fc_buf[i][1] = 0;
            Work_fc_buf[i][0] = 0;
            Work_fc_buf[i][1] = 0;
            Status_vector[i] = 0;
	}
        Mutex_lock( &Partition_mutex );
        Partition_active = 0;
        Mutex_unlock( &Partition_mutex );
        
#ifndef _REENTRANT
        E_dequeue( Send_partition, 0, NULL );
#endif

        Mutex_lock( &Status_mutex );
        Status_active = 0;
        Mutex_unlock( &Status_mutex );

#ifndef _REENTRANT
	E_dequeue( Send_status_query, 0, NULL );
#endif

        Alarm( PRINT, "New configuration hash is: %u\n", Cn.hash_code);
        Alarm( PRINT, "All Status, Partition, FC, etc commands are reset by configuration reload!\n");

}