mirror of
git://sourceware.org/git/glibc.git
synced 2025-03-19 13:40:59 +08:00
* 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.
This commit is contained in:
parent
8522a05394
commit
bd547139c7
@ -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.
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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 */
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user