aboutsummaryrefslogtreecommitdiff
path: root/src/os/unix
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2002-09-07 10:14:25 +0000
committerIgor Sysoev <igor@sysoev.ru>2002-09-07 10:14:25 +0000
commit96f8377fd89b8735027ccfebea8ad9e77f40f51c (patch)
tree14e7de7a0e7c7d9815184a1e9bb95edab0617990 /src/os/unix
parenta58e3ca14300fce97b2124233afe140c8d59199f (diff)
downloadnginx-96f8377fd89b8735027ccfebea8ad9e77f40f51c.tar.gz
nginx-96f8377fd89b8735027ccfebea8ad9e77f40f51c.zip
nginx-0.0.1-2002-09-07-14:14:25 import
Diffstat (limited to 'src/os/unix')
-rw-r--r--src/os/unix/ngx_files.c4
-rw-r--r--src/os/unix/ngx_sendv.c22
-rw-r--r--src/os/unix/ngx_sendv.h4
3 files changed, 21 insertions, 9 deletions
diff --git a/src/os/unix/ngx_files.c b/src/os/unix/ngx_files.c
index a3dc36ddb..5058bac34 100644
--- a/src/os/unix/ngx_files.c
+++ b/src/os/unix/ngx_files.c
@@ -10,8 +10,10 @@ ssize_t ngx_read_file(ngx_file_t *file, char *buf, size_t size, off_t offset)
n = pread(file->fd, buf, size, offset);
- if (n == NGX_ERROR)
+ if (n == -1) {
ngx_log_error(NGX_LOG_ERR, file->log, ngx_errno, "read() failed");
+ return NGX_ERROR;
+ }
return n;
}
diff --git a/src/os/unix/ngx_sendv.c b/src/os/unix/ngx_sendv.c
index dec16a1bc..409456890 100644
--- a/src/os/unix/ngx_sendv.c
+++ b/src/os/unix/ngx_sendv.c
@@ -1,18 +1,28 @@
#include <ngx_core.h>
#include <ngx_types.h>
-#include <ngx_socket.h>
+#include <ngx_errno.h>
+#include <ngx_connection.h>
+#include <ngx_log.h>
#include <ngx_sendv.h>
-ssize_t ngx_sendv(ngx_socket_t s, ngx_iovec_t *iovec, int n, size_t *sent)
+ssize_t ngx_sendv(ngx_connection_t *c, ngx_iovec_t *iovec, int n)
{
ssize_t rc;
+ ngx_err_t err;
- rc = writev(s, iovec, n);
+ rc = writev(c->fd, iovec, n);
- if (rc == -1)
+ if (rc == -1) {
+ err = ngx_socket_errno;
+ if (err == NGX_EAGAIN) {
+ ngx_log_error(NGX_LOG_INFO, c->log, err, "sendv() eagain");
+ return NGX_AGAIN;
+ }
+
+ ngx_log_error(NGX_LOG_ERR, c->log, err, "sendv() failed");
return NGX_ERROR;
+ }
- *sent = rc;
- return NGX_OK;
+ return rc;
}
diff --git a/src/os/unix/ngx_sendv.h b/src/os/unix/ngx_sendv.h
index 5906e423b..0859a2500 100644
--- a/src/os/unix/ngx_sendv.h
+++ b/src/os/unix/ngx_sendv.h
@@ -3,13 +3,13 @@
#include <ngx_types.h>
-#include <ngx_socket.h>
+#include <ngx_connection.h>
typedef struct iovec ngx_iovec_t;
#define ngx_iov_base iov_base
#define ngx_iov_len iov_len
-ssize_t ngx_sendv(ngx_socket_t s, ngx_iovec_t *iovec, int n, size_t *sent);
+ssize_t ngx_sendv(ngx_connection_t *c, ngx_iovec_t *iovec, int n);
#endif /* _NGX_SENDV_H_INCLUDED_ */