int output_block(int socket, char *filename)
{
int fd, count = 0;
size_t total_bytes = 0;
/*size_t buf_cnt = 1460;*/
size_t buf_cnt = 512;
char buffer[buf_cnt];
fd_set rfds;
struct timeval tv;
if ((fd = open(filename, O_RDONLY)) < 0) {
//fprintf(stderr, "Unable to open filename: %s\n", filename);
return(-1);
}
while ((count = read(fd, &buffer, buf_cnt)) > 0) {
FD_ZERO(&rfds);
FD_SET(socket, &rfds);
tv.tv_sec = 10;
tv.tv_usec = 0;
if (select(socket+1, NULL, &rfds, NULL, &tv) <= 0) {
//fprintf(stderr, "Output_block timeout\n");
break;
}
if (writen(socket, buffer, count) <= 0)
break;
total_bytes += count;
}
close(fd);
return(total_bytes);
The application is a single threaded app using a multiprocess pre forking
model if that helps any. I'm really baffled as to why using the 2.4
kernel is slowing us down. Any help is appreciated. Sorry if this has
come up before. I really have been looking for help for quite some time
before posting this.
Hayden Myers
Support Manager
Skyline Network Technologies
hayden@spinbox.com
(410)583-1337 option 2
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/