[ofa-general] Re: [PATCH] ibim/ibsim.c Fixed ibsim console so it doesn't eat up all CPU when creading from a pipe

Sasha Khapyorsky sashak at voltaire.com
Fri Mar 20 06:24:14 PDT 2009


On 13:59 Fri 20 Mar     , Nicolas Morey Chaisemartin wrote:
> @@ -618,7 +619,8 @@ static int sim_run(int con_fd)
>  	for (;;) {
>  		FD_ZERO(&rfds);
>  		FD_SET(simctl, &rfds);
> -		FD_SET(con_fd, &rfds);
> +		if(console)
> +			FD_SET(con_fd, &rfds);
>  		for (i = 0; i < IBSIM_MAX_CLIENTS; i++)
>  			if (clients[i].pid)
>  				FD_SET(clients[i].fd, &rfds);
> @@ -634,7 +636,8 @@ static int sim_run(int con_fd)
>  				sim_read_pkt(clients[i].fd, i);
>  
>  		if (FD_ISSET(con_fd, &rfds))
> -			sim_run_console(con_fd);
> +			if(sim_run_console(con_fd)<=0)
> +				console = 0;

Then one occasional failure will disable the console forever.
Wouldn't it be better to analyze HUP state (similar to as it is done
with OpenSM console)?

Sasha



More information about the general mailing list