diff --git a/src/modules/files/file.h b/src/modules/files/file.h
index 24ef11adfa96f833e2807640d07741dee69c2b02..8f78bf3e3e08084bbe09f0dcf31aa2a1a0f48d1d 100644
--- a/src/modules/files/file.h
+++ b/src/modules/files/file.h
@@ -5,7 +5,7 @@
 \*/
 
 /*
- * $Id: file.h,v 1.13 1999/09/29 14:55:44 mirar Exp $
+ * $Id: file.h,v 1.14 2000/01/27 15:35:22 grubba Exp $
  */
 
 #ifndef FILE_H
@@ -47,6 +47,52 @@ struct my_file
   struct object *myself;
 };
 
+#ifdef _REENTRANT
+
+#ifndef HAVE_STRUCT_IOVEC
+struct iovec {
+  void *iov_base;
+  int iov_len;
+};
+#endif /* !HAVE_STRUCT_IOVEC */
+
+
+struct pike_sendfile
+{
+  struct object *self;
+
+  int sent;
+
+  struct array *headers;
+  struct array *trailers;
+
+  struct object *from_file;
+  struct object *to_file;
+
+  struct svalue callback;
+  struct array *args;
+
+  int from_fd;
+  int to_fd;
+
+  struct my_file *from;
+  struct my_file *to;
+
+  INT_TYPE offset;
+  INT_TYPE len;
+
+  struct iovec *hd_iov;
+  struct iovec *tr_iov;
+
+  int hd_cnt;
+  int tr_cnt;
+
+  struct iovec *iovs;
+  char *buffer;
+};
+
+#endif /* _REENTRANT */
+
 extern struct program *file_program;
 extern struct program *file_ref_program;
 
@@ -58,6 +104,8 @@ static void PIKE_CONCAT(file_set_,X) (INT32 args);		\
 static void PIKE_CONCAT(file_query_,X) (INT32 args);		\
 
 
+void low_do_sendfile(struct pike_sendfile *);
+
 /* Prototypes begin here */
 void my_set_close_on_exec(int fd, int to);
 void do_set_close_on_exec(void);
diff --git a/src/modules/files/sendfile.c b/src/modules/files/sendfile.c
index 507c4446d469d4c3494b243a1f906447b893e980..89048e66b66608c6c2fa8cf6603f4f3a48415f34 100644
--- a/src/modules/files/sendfile.c
+++ b/src/modules/files/sendfile.c
@@ -1,5 +1,5 @@
 /*
- * $Id: sendfile.c,v 1.32 2000/01/24 21:42:59 grubba Exp $
+ * $Id: sendfile.c,v 1.33 2000/01/27 15:35:22 grubba Exp $
  *
  * Sends headers + from_fd[off..off+len-1] + trailers to to_fd asyncronously.
  *
@@ -97,53 +97,6 @@
  */
 #ifdef _REENTRANT
 
-
-/*
- * Struct's
- */
-
-#ifndef HAVE_STRUCT_IOVEC
-struct iovec {
-  void *iov_base;
-  int iov_len;
-};
-#endif /* !HAVE_STRUCT_IOVEC */
-
-
-struct pike_sendfile
-{
-  struct object *self;
-
-  int sent;
-
-  struct array *headers;
-  struct array *trailers;
-
-  struct object *from_file;
-  struct object *to_file;
-
-  struct svalue callback;
-  struct array *args;
-
-  int from_fd;
-  int to_fd;
-
-  struct my_file *from;
-  struct my_file *to;
-
-  INT_TYPE offset;
-  INT_TYPE len;
-
-  struct iovec *hd_iov;
-  struct iovec *tr_iov;
-
-  int hd_cnt;
-  int tr_cnt;
-
-  struct iovec *iovs;
-  char *buffer;
-};
-
 #undef THIS
 #define THIS	((struct pike_sendfile *)(fp->current_storage))
 
@@ -227,7 +180,7 @@ static int writev(int fd, struct iovec *iov, int n)
  * Helper functions
  */
 
-void sf_call_callback(struct pike_sendfile *this)
+static void sf_call_callback(struct pike_sendfile *this)
 {
   if (this->callback.type != T_INT) {
     int sz = this->args->size;
@@ -248,7 +201,7 @@ void sf_call_callback(struct pike_sendfile *this)
   }
 }
 
-void call_callback_and_free(struct callback *cb, void *this_, void *arg)
+static void call_callback_and_free(struct callback *cb, void *this_, void *arg)
 {
   struct pike_sendfile *this = this_;
   int sz;
@@ -276,7 +229,7 @@ void call_callback_and_free(struct callback *cb, void *this_, void *arg)
  */
 
 /* writev() without the IOV_MAX limit. */
-int send_iov(int fd, struct iovec *iov, int iovcnt)
+static int send_iov(int fd, struct iovec *iov, int iovcnt)
 {
   int sent = 0;
 
@@ -318,10 +271,8 @@ int send_iov(int fd, struct iovec *iov, int iovcnt)
   return sent;
 }
 
-void worker(void *this_)
+void low_do_sendfile(struct pike_sendfile *this)
 {
-  struct pike_sendfile *this = this_;
-
   /* Make sure we're using blocking I/O */
   set_nonblocking(this->to_fd, 0);
 
@@ -585,6 +536,13 @@ void worker(void *this_)
   SF_DFPRINTF((stderr,
 	      "sendfile: Done. Setting up callback\n"
 	      "%d bytes sent\n", this->sent));
+}
+
+static void worker(void *this_)
+{
+  struct pike_sendfile *this = this_;
+
+  low_do_sendfile(this);
 
   mt_lock(&interpreter_lock);