[ofa-general] [PATCH] ibim/ibsim.c Fixed ibsim console so it doesn't eat up all CPU when creading from a pipe
Nicolas Morey Chaisemartin
nicolas.morey-chaisemartin at ext.bull.net
Fri Mar 20 05:59:01 PDT 2009
Signed-off-by: Nicolas Morey-Chaisemartin <nicolas.morey-chaisemartin at ext.bull.net>
---
ibsim/ibsim.c | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/ibsim/ibsim.c b/ibsim/ibsim.c
index e720f0d..5fc3b99 100644
--- a/ibsim/ibsim.c
+++ b/ibsim/ibsim.c
@@ -597,13 +597,14 @@ static int sim_run_console(int fd)
fprintf(simout, "sim%s> ", netstarted ? "" : " (inactive)");
fflush(simout);
- return 0;
+ return ret;
}
static int sim_run(int con_fd)
{
fd_set rfds;
int i;
+ int console = 1;
socket_basename=getenv("IBSIM_SOCKNAME");
if(!socket_basename)
@@ -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;
}
return 0;
--
1.6.2-rc2.GIT
More information about the general
mailing list