<commit_before>#include <stdio.h>
#include <sys/select.h>

/* pselect loop test */
int main(int argc, char *argv[])
{
	struct timespec timeout;
	fd_set readfds;
	int fdcount;
	char buf[1024];

	while(1){
		FD_ZERO(&readfds);
		FD_SET(0, &readfds);
		timeout.tv_sec = 1;
		timeout.tv_nsec = 0;

		fdcount = pselect(1, &readfds, NULL, NULL, &timeout, NULL);
		printf("loop %d\n", fdcount);

		if(FD_ISSET(0, &readfds)){
			read(0, buf, 1024);
			printf("buf: %s\n", buf);
		}
	}
	return 0;
}
<commit_msg>Add a bit of error checking to loop test.<commit_after>#include <errno.h>
#include <stdio.h>
#include <sys/select.h>
#include <unistd.h>

/* pselect loop test */
int main(int argc, char *argv[])
{
	struct timespec timeout;
	fd_set readfds, writefds;
	int fdcount;
	char buf[1024];
	int run = 1;

	while(run){
		FD_ZERO(&readfds);
		FD_SET(0, &readfds);
		FD_ZERO(&writefds);
		//FD_SET(0, &writefds);
		timeout.tv_sec = 1;
		timeout.tv_nsec = 0;

		fdcount = pselect(1, &readfds, &writefds, NULL, &timeout, NULL);
		if(fdcount == -1){
			fprintf(stderr, "Error in pselect: %s\n", strerror(errno));
			run = 0;
		}else if(fdcount == 0){
			printf("loop timeout\n");
		}else{
			printf("fdcount=%d\n", fdcount);

			if(FD_ISSET(0, &readfds)){
				read(0, buf, 1024);
				printf("buf: %s\n", buf);
			}
		}
	}
	return 0;
}

{'fraction_non_alphanumeric': 0.18305597579425115, 'fraction_numerical': 0.02723146747352496, 'mean_word_length': 3.810909090909091, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5644650', 'n_tokens_mistral': 634, 'n_tokens_neox': 565, 'n_words': 132}