David Krentzlin avatar David Krentzlin committed b826cf6

temporarily disabled fadvices

Comments (0)

Files changed (2)

strategies/sendfile.bsd.scm

 #include<sys/types.h>
 #include <sys/uio.h>")
 
-(cond-expand
-  (posix-fadvise
-   (foreign-declare "#define READ_AHEAD (4 * 1024 * 1024)")
-   (define %sendfile-implementation
-     (foreign-lambda* double ((integer src) (integer dst) (double offset) (unsigned-integer to_send))
-       "size_t res = 0;"
-       "off_t tmpoffset = (off_t)offset;"
-       "if((posix_fadvise(src,0,0,POSIX_FADV_SEQUENTIAL) < 0) && errno != ENOSYS){"
-       "  C_return(-1);"
-       "}"
-       "if(sendfile(src,dst,tmpoffset,to_send,NULL,&res,0) < 0){"
-       "  if(errno == EAGAIN){"
-       "    C_return(res == 0 ? -2 : (double)(tmpoffset + res));"
-       "  }else{"
-       "    C_return(-1);"
-       "  }"
-       "}"
-       " if(((off_t)offset & ~(READ_AHEAD - 1)) != (((off_t)offset + res) & ~(READ_AHEAD - 1))){"
-       "  if(posix_fadvise(src,((off_t)offset + res) & ~(READ_AHEAD - 1),READ_AHEAD,POSIX_FADV_NOREUSE) < 0){"
-       "    C_return(-1)"
-       "  }"
-       "}"
-       "C_return((double)(tmpoffset + res));")))
-  (else
-   (define %sendfile-implementation
-     (foreign-lambda*  double ((integer src) (integer dst) (double offset) (unsigned-integer to_send))
-       "size_t res = 0;"
-       "off_t tmpoffset = (off_t)offset;"
-       "if(sendfile(src,dst,tmpoffset,to_send,NULL,&res,0) < 0){"
-       "  if(errno == EAGAIN){"
-       "    C_return(res == 0 ? -2 : (double)(tmpoffset + res));"
-       "  }else{"
-       "    C_return(-1);"
-       "  }"
-       "}"
-       "C_return((double)(tmpoffset + res));"))))
+;; (cond-expand
+;;   (posix-fadvise
+;;    (foreign-declare "#define READ_AHEAD (4 * 1024 * 1024)")
+;;    (define %sendfile-implementation
+;;      (foreign-lambda* double ((integer src) (integer dst) (double offset) (unsigned-integer to_send))
+;;        "size_t res = 0;"
+;;        "off_t tmpoffset = (off_t)offset;"
+;;        "if((posix_fadvise(src,0,0,POSIX_FADV_SEQUENTIAL) < 0) && errno != ENOSYS){"
+;;        "  C_return(-1);"
+;;        "}"
+;;        "if(sendfile(src,dst,tmpoffset,to_send,NULL,&res,0) < 0){"
+;;        "  if(errno == EAGAIN){"
+;;        "    C_return(res == 0 ? -2 : (double)(tmpoffset + res));"
+;;        "  }else{"
+;;        "    C_return(-1);"
+;;        "  }"
+;;        "}"
+;;        " if(((off_t)offset & ~(READ_AHEAD - 1)) != (((off_t)offset + res) & ~(READ_AHEAD - 1))){"
+;;        "  if(posix_fadvise(src,((off_t)offset + res) & ~(READ_AHEAD - 1),READ_AHEAD,POSIX_FADV_NOREUSE) < 0){"
+;;        "    C_return(-1)"
+;;        "  }"
+;;        "}"
+;;        "C_return((double)(tmpoffset + res));")))
+;;   (else
+;;    (define %sendfile-implementation
+;;      (foreign-lambda*  double ((integer src) (integer dst) (double offset) (unsigned-integer to_send))
+;;        "size_t res = 0;"
+;;        "off_t tmpoffset = (off_t)offset;"
+;;        "if(sendfile(src,dst,tmpoffset,to_send,NULL,&res,0) < 0){"
+;;        "  if(errno == EAGAIN){"
+;;        "    C_return(res == 0 ? -2 : (double)(tmpoffset + res));"
+;;        "  }else{"
+;;        "    C_return(-1);"
+;;        "  }"
+;;        "}"
+;;        "C_return((double)(tmpoffset + res));"))))
+
+(define %sendfile-implementation
+  (foreign-lambda*  double ((integer src) (integer dst) (double offset) (unsigned-integer to_send))
+    "size_t res = 0;"
+    "off_t tmpoffset = (off_t)offset;"
+    "if(sendfile(src,dst,tmpoffset,to_send,NULL,&res,0) < 0){"
+    "  if(errno == EAGAIN){"
+    "    C_return(res == 0 ? -2 : (double)(tmpoffset + res));"
+    "  }else{"
+    "    C_return(-1);"
+    "  }"
+    "}"
+    "C_return((double)(tmpoffset + res));"))

strategies/sendfile.linux.scm

 #include <sys/sendfile.h>
 #include <fcntl.h>
 #include<errno.h>")
-(cond-expand
-  (posix-fadvise
-   (foreign-declare "#define READ_AHEAD (4 * 1024 * 1024)")
-   (define %sendfile-implementation
-     (foreign-lambda* double ((integer src) (integer dst) (double offset) (unsigned-integer to_send))
-       "size_t res = 0;"
-       "off_t curoffset = (off_t)offset;"
-       "if((posix_fadvise(src,0,0,POSIX_FADV_SEQUENTIAL) < 0) && errno != ENOSYS){ C_return(-1); }"
-       "if(sendfile(dst,src,&curoffset,to_send) < 0){"
-       "   if(errno == EAGAIN || errno == EINTR){ "
-       "     C_return(curoffset == 0 ? -2 : (double)(curoffset)); "
-       "   }else{"
-       "     C_return(-1);"
-       "   }"
-       "}"
-       " if(((off_t)offset & ~(READ_AHEAD - 1)) != (((off_t)offset + res) & ~(READ_AHEAD - 1))){"
-       "  if(posix_fadvise(src,((off_t)offset + res) & ~(READ_AHEAD - 1),READ_AHEAD,POSIX_FADV_NOREUSE) < 0){"
-       "    C_return(-1);"
-       "  }"
-       "}"
-       "C_return((double)curoffset);")))
-  (else
-   (define %sendfile-implementation
-     (foreign-lambda*  double ((integer src) (integer dst) (double offset) (unsigned-integer to_send))
-       "off_t curoffset = (off_t)offset;"
-       "if(sendfile(dst,src,&curoffset,to_send) < 0){"
-       "   if(errno == EAGAIN || errno == EINTR){    "
-       "     C_return(curoffset == 0 ? -2 : (double)(curoffset)); "
-       "   }else{ "
-       "     C_return(-1);"
-       "   }"
-       "}"
-       "C_return((double)curoffset);"))))
 
+;; This is temporarily disable until we find a way to reliably
+;; detect if this is supported
 
+;; (cond-expand
+;;   (posix-fadvise
+;;    (foreign-declare "#define READ_AHEAD (4 * 1024 * 1024)")
+;;    (define %sendfile-implementation
+;;      (foreign-lambda* double ((integer src) (integer dst) (double offset) (unsigned-integer to_send))
+;;        "size_t res = 0;"
+;;        "off_t curoffset = (off_t)offset;"
+;;        "if((posix_fadvise(src,0,0,POSIX_FADV_SEQUENTIAL) < 0) && errno != ENOSYS){ C_return(-1); }"
+;;        "if(sendfile(dst,src,&curoffset,to_send) < 0){"
+;;        "   if(errno == EAGAIN || errno == EINTR){ "
+;;        "     C_return(curoffset == 0 ? -2 : (double)(curoffset)); "
+;;        "   }else{"
+;;        "     C_return(-1);"
+;;        "   }"
+;;        "}"
+;;        " if(((off_t)offset & ~(READ_AHEAD - 1)) != (((off_t)offset + res) & ~(READ_AHEAD - 1))){"
+;;        "  if(posix_fadvise(src,((off_t)offset + res) & ~(READ_AHEAD - 1),READ_AHEAD,POSIX_FADV_NOREUSE) < 0){"
+;;        "    C_return(-1);"
+;;        "  }"
+;;        "}"
+;;        "C_return((double)curoffset);")))
+;;   (else
+;;    (define %sendfile-implementation
+;;      (foreign-lambda*  double ((integer src) (integer dst) (double offset) (unsigned-integer to_send))
+;;        "off_t curoffset = (off_t)offset;"
+;;        "if(sendfile(dst,src,&curoffset,to_send) < 0){"
+;;        "   if(errno == EAGAIN || errno == EINTR){    "
+;;        "     C_return(curoffset == 0 ? -2 : (double)(curoffset)); "
+;;        "   }else{ "
+;;        "     C_return(-1);"
+;;        "   }"
+;;        "}"
+;;        "C_return((double)curoffset);"))))
+
+(define %sendfile-implementation
+  (foreign-lambda*  double ((integer src) (integer dst) (double offset) (unsigned-integer to_send))
+    "off_t curoffset = (off_t)offset;"
+    "if(sendfile(dst,src,&curoffset,to_send) < 0){"
+    "   if(errno == EAGAIN || errno == EINTR){    "
+    "     C_return(curoffset == 0 ? -2 : (double)(curoffset)); "
+    "   }else{ "
+    "     C_return(-1);"
+    "   }"
+    "}"
+    "C_return((double)curoffset);"))
+
+
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.