Changeset 208:d93b6c1e83b7 in roaraudio
- Timestamp:
- 07/21/08 13:08:11 (16 years ago)
- Branch:
- default
- Phase:
- public
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
include/libroar/file.h
r202 r208 6 6 #include "libroar.h" 7 7 8 #ifdef ROAR_HAVE_LINUX_SENDFILE 9 #include <sys/sendfile.h> 10 #endif 11 12 ssize_t roar_file_send_raw (int out, int in); 13 8 14 #endif 9 15 -
libroar/file.c
r202 r208 3 3 #include "libroar.h" 4 4 5 #define BUFSIZE 8192 6 #define BUFMAX 65536 7 8 ssize_t roar_file_send_raw (int out, int in) { 9 ssize_t r = 0; 10 ssize_t ret; 11 int len; 12 char buf[BUFSIZE]; 13 14 #ifdef ROAR_HAVE_LINUX_SENDFILE 15 while ((ret = sendfile(out, in, NULL, BUFMAX)) > 0) 16 r += ret; 17 #endif 18 19 // TODO: try mmap here! 20 21 while ((len = read(in, buf, BUFSIZE)) > 0) 22 r += write(out, buf, len); 23 24 return r; 25 } 26 5 27 //ll
Note: See TracChangeset
for help on using the changeset viewer.