]> arthur.barton.de Git - netatalk.git/commitdiff
Implement sendfile() as macro.
authorsrittau <srittau>
Fri, 6 Jun 2003 20:43:14 +0000 (20:43 +0000)
committersrittau <srittau>
Fri, 6 Jun 2003 20:43:14 +0000 (20:43 +0000)
include/atalk/adouble.h
libatalk/adouble/ad_sendfile.c

index 1e72258f6ff87b118eb7a14a67d076f97d89212e..d8904ba4e24b274d0e5e129c1e7c946ed41e2d7c 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: adouble.h,v 1.21 2003-03-09 19:55:35 didg Exp $
+ * $Id: adouble.h,v 1.22 2003-06-06 20:43:14 srittau Exp $
  * Copyright (c) 1990,1991 Regents of The University of Michigan.
  * All Rights Reserved.
  *
@@ -68,7 +68,7 @@
 #include <sys/mman.h>
 #include <netatalk/endian.h>
 
-/* XXX: this is the wrong place to put this. 
+/* FIXME: this is the wrong place to put this. 
  * NOTE: as of 2.2.1, linux can't do a sendfile from a socket. 
  * and it doesn't have 64 bits sendfile
  */
 #include <asm/unistd.h>
 
 #ifdef __NR_sendfile
-#ifdef ATACC
-extern int sendfile __P((int , int , off_t *, size_t ));
-#else /* !ATACC */
-static __inline__ int sendfile(int fdout, int fdin, off_t *off, size_t count)
-{
-  return syscall(__NR_sendfile, fdout, fdin, off, count);
-}
-#endif /* ATACC */
+
+extern long int syscall (long int __sysno, ...) __THROW;
+#if _FILE_OFFSET_BITS == 64
+#  error sendfile
+#  define sendfile(fdout, fdin, off, count) \
+       syscall(__NR_sendfile64, (fdout), (fdin), (off), (count))
+#else /* _FILE_OFFSET_BITS == 64 */
+#  define sendfile(fdout, fdin, off, count) \
+       syscall(__NR_sendfile, (fdout), (fdin), (off), (count))
+#endif /* _FILE_OFFSET_BITS == 64 */
 
 #else /* !__NR_sendfile */
 #include <sys/sendfile.h>
index 21e4126f86eed247ff96bee45eddf9dfc9ad3d55..1803d71e564ffd9e933b97f83ec868faf8125f18 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: ad_sendfile.c,v 1.6 2003-02-17 01:51:07 srittau Exp $
+ * $Id: ad_sendfile.c,v 1.7 2003-06-06 20:43:14 srittau Exp $
  *
  * Copyright (c) 1999 Adrian Sun (asun@zoology.washington.edu)
  * All rights reserved. See COPYRIGHT.
 
 #include "ad_private.h"
 
-#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,