Changeset 208:d93b6c1e83b7 in roaraudio


Ignore:
Timestamp:
07/21/08 13:08:11 (16 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

added roar_file_send_raw()

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • include/libroar/file.h

    r202 r208  
    66#include "libroar.h" 
    77 
     8#ifdef ROAR_HAVE_LINUX_SENDFILE 
     9#include <sys/sendfile.h> 
     10#endif 
     11 
     12ssize_t roar_file_send_raw (int out, int in); 
     13 
    814#endif 
    915 
  • libroar/file.c

    r202 r208  
    33#include "libroar.h" 
    44 
     5#define BUFSIZE 8192 
     6#define BUFMAX  65536 
     7 
     8ssize_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 
    527//ll 
Note: See TracChangeset for help on using the changeset viewer.