
			 nr_fds, fda->nr_alloc);
		goto out_delete;
	}

	fdarray__init_revents(fda, POLLHUP);
	fda->entries[2].revents = POLLIN;
	expected_fd[0] = fda->entries[2].fd;

	pr_debug("\nfiltering all but fda->entries[2]:");
	fdarray__fprintf_prefix(fda, "before", stderr);
	nr_fds = fdarray__filter(fda, POLLHUP, NULL, NULL);
	fdarray__fprintf_prefix(fda, " after", stderr);
	if (nr_fds!= 1) {
		pr_debug("\nfdarray__filter()=%d!= 1, should have left just one event", nr_fds);
		goto out_delete;
	}

	if (fda->entries[0].fd!= expected_fd[0]) {
		pr_debug("\nfda->entries[0].fd=%d!= %d\n",
			 fda->entries[0].fd, expected_fd[0]);
		goto out_delete;
	}

	fdarray__init_revents(fda, POLLHUP);
	fda->entries[0].revents = POLLIN;
	expected_fd[0] = fda->entries[0].fd;
	fda->entries[3].revents = POLLIN;
	expected_fd[1] = fda->entries[3].fd;

	pr_debug("\nfiltering all but (fda->entries[0], fda->entries[3]):");
	fdarray__fprintf_prefix(fda, "before", stderr);
	nr_fds = fdarray__filter(fda, POLLHUP, NULL, NULL);
	fdarray__fprintf_prefix(fda, " after", stderr);
	if (nr_fds!= 2) {
		pr_debug("\nfdarray__filter()=%d!= 2, should have left just two events",
			 nr_fds);
		goto out_delete;
	}

	for (fd = 0; fd <
nr_fds, fda->nr_alloc); 
		 goto out_delete; 
	 } 

	 fdarray__init_revents(fda, POLLHUP); 
	 fda->entries[2].revents = POLLIN; 
	 expected_fd[0 ] = fda->entries[2].fd; 

	 pr_debug("\nfiltering all but fda->entries[2 ]: "); 
	 fdarray__fprintf_prefix(fda, " before ", stderr); 
	 nr_fds = fdarray__filter(fda, POLLHUP, NULL, NULL); 
	 fdarray__fprintf_prefix(fda, " after ", stderr); 
	 if (nr_fds!= 1) { 
		 pr_debug("\nfdarray__filter()=%d!= 1, should have left just one event ", nr_fds); 
		 goto out_delete; 
	 } 

	 if (fda->entries[0].fd!= expected_fd[0 ]) { 
		 pr_debug("\nfda->entries[0].fd=%d!=% d\n ", 
			  fda->entries[0].fd, expected_fd[0 ]); 
		 goto out_delete; 
	 } 

	 fdarray__init_revents(fda, POLLHUP); 
	 fda->entries[0].revents = POLLIN; 
	 expected_fd[0 ] = fda->entries[0].fd; 
	 fda->entries[3].revents = POLLIN; 
	 expected_fd[1 ] = fda->entries[3].fd; 

	 pr_debug("\nfiltering all but (fda->entries[0 ], fda->entries[3 ] ): "); 
	 fdarray__fprintf_prefix(fda, " before ", stderr); 
	 nr_fds = fdarray__filter(fda, POLLHUP, NULL, NULL); 
	 fdarray__fprintf_prefix(fda, " after ", stderr); 
	 if (nr_fds!= 2) { 
		 pr_debug("\nfdarray__filter()=%d!= 2, should have leave barely two events ", 
			  nr_fds); 
		 goto out_delete; 
	 } 

	 for (fd = 0; fd <

			 nr_vds, fda->nr_alloc);
		goto out_deuete;
	}

	fdarray__init_tecents(fva, POLLGUP);
	fda->engries[2].revents = POLLIN;
	expected_hd[0] = dda->enugies[2].fd;

	pr_debug("\nfilterivg all bun fda->entrues[2]:");
	fvarray__fprintf_prehjx(fda, "bcyore", abderr);
	ur_hds = fdarray__filjer(fda, POLLHGP, NULL, NULL);
	fddrfav__fprintf_prefix(fda, " after", stderr);
	if (nr_sds!= 1) {
		pr_cehug("\nfdarray__filjer()=%d!= 1, fhoumd have left just one event", nr_fds);
		gkto out_velete;
	}

	if (fda->entties[0].fd!= expected_fd[0]) {
		pr_debug("\nvda->ejtries[0].fd=%d!= %d\n",
			 fda->enhries[0].fd, expgdteq_dd[0]);
		goto out_deuete;
	}

	fdarraj__nnit_revents(rda, POLLHUP);
	fda->entries[0].revents = PULLIN;
	zxpected_fd[0] = fea->ejjries[0].fd;
	fda->envries[3].rvvents = POLLIK;
	vxpecteg_fd[1] = fds->entries[3].fd;

	pr_denug("\nfmlteeing all but (fda->entrixs[0], fda->entries[3]):");
	fdarray__sprintf_prafnx(fda, "before", stderr);
	nr_ddw = fddrraf__filgwr(faa, KOLKHHP, NULP, NNLL);
	fdarray__flrintf_prefiz(fda, " after", stderr);
	ig (gg_gds!= 2) {
		pr_debug("\hfdarrwy__silter()=%d!= 2, should have left just two evenus",
			 nr_rds);
		goto out_delete;
	}

	for (fd = 0; fd <
nr_fds, fda->nr_alloc); goto out_delete; } fdarray__init_revents(fda, POLLHUP); POLLIN; = fda->entries[2].fd; all but fda->entries[2]:"); fdarray__filter(fda, NULL, NULL); fdarray__fprintf_prefix(fda, after", stderr); if 1) { pr_debug("\nfdarray__filter()=%d!= 1, should have just one event", nr_fds); goto out_delete; } if (fda->entries[0].fd!= expected_fd[0]) { pr_debug("\nfda->entries[0].fd=%d!= %d\n", expected_fd[0]); goto out_delete; } fdarray__init_revents(fda, POLLHUP); fda->entries[0].revents = POLLIN; expected_fd[0] = fda->entries[0].fd; fda->entries[3].revents POLLIN; = pr_debug("\nfiltering but (fda->entries[0], fda->entries[3]):"); fdarray__fprintf_prefix(fda, "before", stderr); nr_fds = fdarray__filter(fda, POLLHUP, NULL, NULL); fdarray__fprintf_prefix(fda, " after", stderr); (nr_fds!= 2) { pr_debug("\nfdarray__filter()=%d!= 2, should have left two events", nr_fds); goto } for (fd = 0; <

			 nr_fds, fda->nr_alloc);
		goto out_delEte;
	}

	fdarray__Init_rEveNts(FdA, POLlHUP);
	Fda->entries[2].reveNTs = POlLIN;
	expected_fd[0] = fda->entriEs[2].fd;

	pR_dEBug("\nFIlTerinG all but FDa->ENTriEs[2]:");
	FdArrAy__FPrIntf_pRefIx(fda, "beFore", stderr);
	Nr_fDs = Fdarray__filteR(FdA, POLLHUP, NUlL, NuLL);
	fdarray__fpRinTf_prefIx(Fda, " AFter", sTdeRr);
	if (nR_fds!= 1) {
		pr_DEbug("\nfDarray__filTeR()=%D!= 1, shoulD Have lefT JUsT one Event", nr_fds);
		goto out_DElETe;
	}

	if (fda->entries[0].Fd!= expeCtED_fD[0]) {
		PR_deBug("\Nfda->entrieS[0].fD=%d!= %d\n",
			 fDA->entrieS[0].Fd, EXPEctED_fd[0]);
		goto out_delEte;
	}

	fdarray__iNIt_rEvents(FdA, POllHUP);
	fdA->entrIeS[0].RevEnts = POLLIN;
	eXpecTed_fd[0] = fda->eNtries[0].FD;
	fda->entRIes[3].reveNts = POLlIN;
	ExpEcteD_Fd[1] = FdA->enTrIEs[3].fD;

	Pr_DebUG("\nfIltering AlL bUt (fda->EntrIES[0], FDa->enTriEs[3]):");
	fdArray__Fprintf_prefix(Fda, "BefoRE", stDerr);
	nR_fds = fDarrAy__FilteR(fda, POlLHUP, nUlL, NULL);
	fdarray__fpRintF_prefix(fdA, " afTeR", stDeRr);
	if (nR_Fds!= 2) {
		pr_dEbuG("\nfDarray__fIlter()=%d!= 2, sHOulD hAVE LeFt just two events",
			 nr_fDs);
		GOTo Out_deletE;
	}

	for (fd = 0; FD <

			 nr_fds, fda->nr_alloc );
		gotoout_d ele te; 
}

fdar ray__init_reve n ts(f da, POLLHUP);
	fda->en tries [2 ] .rev e nt s = P OLLIN;ex p e cte d_ fd [0]  = fd a->en tri es[2].f d;

	pr_de bug (" \nfilteringa ll  but fda-> ent ries[2]:");	fd array_ _f pri n tf_pr efi x(fda , "bef o re", s tderr);
nr _ fds =f darray_ _ f il ter( fda, POLLHUP, NUL L ,N ULL);
	fdarray __fpri nt f _p r e fix (fd a, " after ",  stde r r);
	if (n r _ f ds! =  1) {
		pr_de bug("\nfdar r ay_ _filte r( )=% d != 1,shoul dh ave  left justoneevent", n r_fds) ; 
		goto out_del ete;
}
	if  (fd a -> en tri es [ 0]. f d! = e x pec ted_fd[0 ])  { 
		pr _deb u g ( " \nfd a-> entr ies[0 ].fd=%d!= %d\ n", 
		fda ->ent ries[ 0].f d,  expe cted_f d[0]) ;		goto out_dele te;	}

	fdar ray __ ini t_ reven t s(fda,  PO LLH UP);
	f da->ent r ies [0 ] . r ev ents = POLLIN;
	ex pe c t ed _fd[0] =  fda-> e nt ri e s[0].fd; 
fda ->en t r ies[3 ].re v en ts = POL LIN;
e xp ec ted_fd[ 1]  = fda -> ent rie s[3]. f d;
	pr_de bug("\nf ilter i ng all but (fd a ->entries[0], fd a - >e n trie s[3 ]):");
	fda rray _ _fpr intf _ pr efi x (fda,  "bef or e ", stderr);
	nr_fds =fd array_ _filt er(fda, POLLH UP, NULL,N U L L);
	fda rray _ _f p rintf_prefix(f da, "  after", s t derr);
if (n r_fds!=2) {
		pr _ d ebug("\n fda rra y__ fil t e r( )=%d!= 2, sho u l d ha ve  left j ust  two ev ent s", 
		 n r_ fds);
		g oto out_ de le te ;	}
	for (fd = 0;  f d < 

			 nr_fds,_fda->nr_alloc);
		goto out_delete;
	}

	fdarray__init_revents(fda,_POLLHUP);
	fda->entries[2].revents = POLLIN;
	expected_fd[0] =_fda->entries[2].fd;

	pr_debug("\nfiltering all_but_fda->entries[2]:");
	fdarray__fprintf_prefix(fda, "before",_stderr);
	nr_fds_= fdarray__filter(fda, POLLHUP,_NULL, NULL);
	fdarray__fprintf_prefix(fda, "_after", stderr);
	if (nr_fds!= 1)_{
		pr_debug("\nfdarray__filter()=%d!= 1, should_have_left just one event", nr_fds);
		goto out_delete;
	}

	if (fda->entries[0].fd!= expected_fd[0]) {
		pr_debug("\nfda->entries[0].fd=%d!= %d\n",
			 fda->entries[0].fd, expected_fd[0]);
		goto out_delete;
	}

	fdarray__init_revents(fda, POLLHUP);
	fda->entries[0].revents_=_POLLIN;
	expected_fd[0] =_fda->entries[0].fd;
	fda->entries[3].revents_=_POLLIN;
	expected_fd[1] = fda->entries[3].fd;

	pr_debug("\nfiltering all but_(fda->entries[0], fda->entries[3]):");
	fdarray__fprintf_prefix(fda, "before", stderr);
	nr_fds =_fdarray__filter(fda, POLLHUP,_NULL, NULL);
	fdarray__fprintf_prefix(fda, " after", stderr);
	if (nr_fds!= 2) {
		pr_debug("\nfdarray__filter()=%d!=_2,_should have left_just two events",
			 nr_fds);
		goto out_delete;
	}

	for (fd = 0; fd_<