]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
* nscd/connections.c (sendfileall): Define.
authorUlrich Drepper <drepper@redhat.com>
Tue, 22 Nov 2005 19:06:27 +0000 (19:06 +0000)
committerUlrich Drepper <drepper@redhat.com>
Tue, 22 Nov 2005 19:06:27 +0000 (19:06 +0000)
(handle_request): Use it instead of sendfile call.
* nscd/nscd-client.h: Declare sendfileall.
* nscd/aicache.c: Use sendfileall instead of sendfile.
* nscd/grpcache.c: Likewise.
* nscd/hstcache.c: Likewise.
* nscd/initgrcache.c: Likewise.
* nscd/pwdcache.c: Likewise.

ChangeLog
nscd/aicache.c
nscd/connections.c
nscd/grpcache.c
nscd/hstcache.c
nscd/initgrcache.c
nscd/nscd-client.h
nscd/pwdcache.c
sysdeps/generic/ldsodefs.h

index b27df1736f51dadaa8d435b370a514a84074a9f5..841a6254f2a549f56b2e3e3627ebfc74e332f037 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
 2005-11-22  Ulrich Drepper  <drepper@redhat.com>
 
+       * nscd/connections.c (sendfileall): Define.
+       (handle_request): Use it instead of sendfile call.
+       * nscd/nscd-client.h: Declare sendfileall.
+       * nscd/aicache.c: Use sendfileall instead of sendfile.
+       * nscd/grpcache.c: Likewise.
+       * nscd/hstcache.c: Likewise.
+       * nscd/initgrcache.c: Likewise.
+       * nscd/pwdcache.c: Likewise.
+
        [BZ #1908]
        * manual/install.texi (Tools for Compilation): Require gawk.
 
index 9b8a4e50f23ae4333bbefb0462ced2c0004191ff..59fa2df775e6f08ba97c88454bc4bce425caa82d 100644 (file)
@@ -26,9 +26,6 @@
 #include <time.h>
 #include <unistd.h>
 #include <sys/mman.h>
-#ifdef HAVE_SENDFILE
-# include <sys/sendfile.h>
-#endif
 
 #include "dbg_log.h"
 #include "nscd.h"
@@ -382,9 +379,10 @@ addhstaiX (struct database_dyn *db, int fd, request_header *req,
                              <= (sizeof (struct database_pers_head)
                                  + db->head->module * sizeof (ref_t)
                                  + db->head->data_size));
-                     off_t off = (char *) &dataset->resp - (char *) db->head;
                      ssize_t written;
-                     written = sendfile (fd, db->wr_fd, &off, total);
+                     written = sendfileall (fd, db->wr_fd,
+                                            (char *) &dataset->resp
+                                            - (char *) db->head, total);
 # ifndef __ASSUME_SENDFILE
                      if (written == -1 && errno == ENOSYS)
                        goto use_write;
index 0a1ca7783699412e29bc88b177742451d06ac335..a6d2a55e2fa62a912b2e7ebdc7041156478ea7cd 100644 (file)
@@ -204,6 +204,26 @@ writeall (int fd, const void *buf, size_t len)
 }
 
 
+#ifdef HAVE_SENDFILE
+ssize_t
+sendfileall (int tofd, int fromfd, off_t off, size_t len)
+{
+  ssize_t n = len;
+  ssize_t ret;
+
+  do
+    {
+      ret = TEMP_FAILURE_RETRY (sendfile (tofd, fromfd, &off, n));
+      if (ret <= 0)
+       break;
+      n -= ret;
+    }
+  while (n > 0);
+  return ret < 0 ? ret : len - n;
+}
+#endif
+
+
 enum usekey
   {
     use_not = 0,
@@ -957,8 +977,9 @@ cannot handle old request version %d; current version is %d"),
                      <= (sizeof (struct database_pers_head)
                          + db->head->module * sizeof (ref_t)
                          + db->head->data_size));
-             off_t off = (char *) cached->data - (char *) db->head;
-             nwritten = sendfile (fd, db->wr_fd, &off, cached->recsize);
+             nwritten = sendfileall (fd, db->wr_fd,
+                                     (char *) cached->data
+                                     - (char *) db->head, cached->recsize);
 # ifndef __ASSUME_SENDFILE
              if (nwritten == -1 && errno == ENOSYS)
                goto use_write;
index fb043152c61b46d71b52529c4945d9c9531ac6e8..81c61c7b6740314b62ca53fdf9c00974e5c890ad 100644 (file)
@@ -32,9 +32,6 @@
 #include <string.h>
 #include <unistd.h>
 #include <sys/mman.h>
-#ifdef HAVE_SENDFILE
-# include <sys/sendfile.h>
-#endif
 #include <sys/socket.h>
 #include <stackinfo.h>
 
@@ -310,8 +307,9 @@ cache_addgr (struct database_dyn *db, int fd, request_header *req,
                      <= (sizeof (struct database_pers_head)
                          + db->head->module * sizeof (ref_t)
                          + db->head->data_size));
-             off_t off = (char *) &dataset->resp - (char *) db->head;
-             written = sendfile (fd, db->wr_fd, &off, total);
+             written = sendfileall (fd, db->wr_fd,
+                                    (char *) &dataset->resp
+                                    - (char *) db->head, total);
 # ifndef __ASSUME_SENDFILE
              if (written == -1 && errno == ENOSYS)
                goto use_write;
index 29f14af66bec72f58df1d93cb75f4c940e8c757f..22f4d6d0a3e2edeb79e3cb9e2b5acd5955701ddf 100644 (file)
@@ -34,9 +34,6 @@
 #include <arpa/inet.h>
 #include <arpa/nameser.h>
 #include <sys/mman.h>
-#ifdef HAVE_SENDFILE
-# include <sys/sendfile.h>
-#endif
 #include <stackinfo.h>
 
 #include "nscd.h"
@@ -344,8 +341,9 @@ cache_addhst (struct database_dyn *db, int fd, request_header *req,
                      <= (sizeof (struct database_pers_head)
                          + db->head->module * sizeof (ref_t)
                          + db->head->data_size));
-             off_t off = (char *) &dataset->resp - (char *) db->head;
-             written = sendfile (fd, db->wr_fd, &off, total);
+             written = sendfileall (fd, db->wr_fd,
+                                    (char *) &dataset->resp
+                                    - (char *) db->head, total);
 # ifndef __ASSUME_SENDFILE
              if (written == -1 && errno == ENOSYS)
                goto use_write;
index eb03fc7a5d0b7084cf64f703735834aafa76dc9a..23d5d59a11039357c63bad10b9898c5361ed8bf5 100644 (file)
@@ -26,9 +26,6 @@
 #include <time.h>
 #include <unistd.h>
 #include <sys/mman.h>
-#ifdef HAVE_SENDFILE
-# include <sys/sendfile.h>
-#endif
 
 #include "dbg_log.h"
 #include "nscd.h"
@@ -361,8 +358,9 @@ addinitgroupsX (struct database_dyn *db, int fd, request_header *req,
                      <= (sizeof (struct database_pers_head)
                          + db->head->module * sizeof (ref_t)
                          + db->head->data_size));
-             off_t off = (char *) &dataset->resp - (char *) db->head;
-             written = sendfile (fd, db->wr_fd, &off, total);
+             written = sendfileall (fd, db->wr_fd,
+                                    (char *) &dataset->resp
+                                    - (char *) db->head, total);
 # ifndef __ASSUME_SENDFILE
              if (written == -1 && errno == ENOSYS)
                goto use_write;
index 1389f2da19fda0fcc1fd9e3500ded71f582d52d2..98c167eb622d58a26e850da51b920e1b761f92e0 100644 (file)
@@ -319,5 +319,7 @@ extern ssize_t __readvall (int fd, const struct iovec *iov, int iovcnt)
   attribute_hidden;
 extern ssize_t writeall (int fd, const void *buf, size_t len)
   attribute_hidden;
+extern ssize_t sendfileall (int tofd, int fromfd, off_t off, size_t len)
+  attribute_hidden;
 
 #endif /* nscd.h */
index 6f4b032d108298cd476051c2a00fc247696d2790..c3039c89c443d6180269fb331516a7daf61400bf 100644 (file)
@@ -32,9 +32,6 @@
 #include <time.h>
 #include <unistd.h>
 #include <sys/mman.h>
-#ifdef HAVE_SENDFILE
-# include <sys/sendfile.h>
-#endif
 #include <sys/socket.h>
 #include <stackinfo.h>
 
@@ -305,8 +302,9 @@ cache_addpw (struct database_dyn *db, int fd, request_header *req,
                      <= (sizeof (struct database_pers_head)
                           + db->head->module * sizeof (ref_t)
                           + db->head->data_size));
-             off_t off = (char *) &dataset->resp - (char *) db->head;
-             written = sendfile (fd, db->wr_fd, &off, total);
+             written = sendfileall (fd, db->wr_fd,
+                                    (char *) &dataset->resp
+                                    - (char *) db->head, total);
 # ifndef __ASSUME_SENDFILE
              if (written == -1 && errno == ENOSYS)
                goto use_write;
index b8333ed79c38d10fff39767c975cc0981a023ea7..67a20cea708146da7dd6875f840ef24eddc08c5c 100644 (file)
@@ -508,7 +508,6 @@ struct rtld_global
     struct dtv_slotinfo
     {
       size_t gen;
-      bool is_static;
       struct link_map *map;
     } slotinfo[0];
   } *_dl_tls_dtv_slotinfo_list;