--- projects/pjob/pjob.c 2006/01/25 19:57:12 1.4 +++ projects/pjob/pjob.c 2006/01/30 21:46:59 1.6 @@ -27,6 +27,7 @@ #include #include #include +#include #define DEFNUMTHREAD 10 #define DEFTIMEOUT 60 @@ -168,7 +169,7 @@ void process_child(gpointer data, gpointer user_data){ poll(fds, fdssize, -1); /* For stdout and stderr see if there is any data, and read it */ for(x=0; x<2; x++){ - if((fds[x].revents & POLLIN) == 0){ + if((fds[x].revents & POLLIN) != 0){ /* We have data to read */ g_io_channel_read_line(sout[x], &readbuf, &rdatasize, NULL, NULL); if(rdatasize > 0){ @@ -331,6 +332,8 @@ int main(int argc, char **argv){ GError *pp_err = NULL, *err = NULL; gint x; + struct rlimit rlp; + GOptionContext *optcontext; optcontext = g_option_context_new(" - parallel job executer"); @@ -360,6 +363,14 @@ int main(int argc, char **argv){ }else{ g_printerr("Threading not supported\n"); } + + /* Up the number of FD's to the "hard" limit. + * This is mainly to get around the very small default + * solaris has, or 256 + */ + getrlimit(RLIMIT_NOFILE, &rlp); + rlp.rlim_cur = rlp.rlim_max; + setrlimit(RLIMIT_NOFILE, &rlp); if(verbose) g_printerr("Creating a threadpool %d in size\n", numthreads); procpool = g_thread_pool_new(process_child, NULL, numthreads, FALSE, &pp_err);