]> arthur.barton.de Git - netatalk.git/blobdiff - libatalk/adouble/ad_sendfile.c
- added a cache for directories offspring count.
[netatalk.git] / libatalk / adouble / ad_sendfile.c
index 9a5ac2a8220d1898bf47cc9176f834c49ac224c5..35a9bccc0b0aa15b3b75ab4846d0bd7762cf5dd3 100644 (file)
@@ -1,4 +1,6 @@
 /*
+ * $Id: ad_sendfile.c,v 1.5 2002-10-11 14:18:38 didg Exp $
+ *
  * Copyright (c) 1999 Adrian Sun (asun@zoology.washington.edu)
  * All rights reserved. See COPYRIGHT.
  *
@@ -8,8 +10,14 @@
  * 
  */
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif /* HAVE_CONFIG_H */
+
 #include <stdio.h>
+#ifdef HAVE_UNISTD_H
 #include <unistd.h>
+#endif /* HAVE_UNISTD_H */
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <sys/socket.h>
 
 #include <atalk/adouble.h>
 
-#include <syslog.h>
+#include <atalk/logger.h>
 
 #include "ad_private.h"
 
 static int _ad_sendfile_dummy;
 
+#ifdef ATACC
+
+#if defined(HAVE_SENDFILE_READ)
+#ifdef __NR_sendfile
+int sendfile(int fdout, int fdin, off_t *off, size_t count)
+{
+#if _FILE_OFFSET_BITS == 64 
+#error sendfile
+  return syscall(__NR_sendfile64, fdout, fdin, off, count);
+#else
+  return syscall(__NR_sendfile, fdout, fdin, off, count);
+#endif
+}
+#endif
+#endif
+#endif
+
 #if defined(HAVE_SENDFILE_READ) || defined(HAVE_SENDFILE_WRITE)
 static __inline__ int ad_sendfile_init(const struct adouble *ad, 
                                       const int eid, off_t *off,
@@ -57,16 +82,16 @@ ssize_t ad_readfile(const struct adouble *ad, const int eid,
   fd = ad_sendfile_init(ad, eid, &off, 0);
 #ifdef __linux__
   cc = sendfile(sock, fd, &off, len);
-#endif
+#endif /* __linux__ */
 
 #ifdef BSD4_4
   if (sendfile(fd, sock, off, len, NULL, &cc, 0) < 0)
     return -1;
-#endif
+#endif /* BSD4_4 */
 
   return cc;
 }
-#endif
+#endif /* HAVE_SENDFILE_READ */
 
 #if 0
 #ifdef HAVE_SENDFILE_WRITE
@@ -87,7 +112,7 @@ ssize_t ad_writefile(struct adouble *ad, const int eid,
     ad_setentrylen(ad, eid, off);
 
   return cc;
-#endif
+#endif /* __linux__ */
 }
-#endif
-#endif
+#endif /* HAVE_SENDFILE_WRITE */
+#endif /* 0 */