Mercurial > hg > nginx
comparison src/os/unix/freebsd/ngx_sendfile.c @ 8:708f8bb772ec
nginx-0.0.1-2002-09-02-18:48:24 import
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Mon, 02 Sep 2002 14:48:24 +0000 |
parents | 669801705ab1 |
children | 6a0b3d6e9c13 |
comparison
equal
deleted
inserted
replaced
7:b5481d6fbbd4 | 8:708f8bb772ec |
---|---|
1 | 1 |
2 #include <ngx_config.h> | 2 #include <ngx_config.h> |
3 #include <ngx_core.h> | |
3 #include <ngx_types.h> | 4 #include <ngx_types.h> |
4 #include <ngx_file.h> | 5 #include <ngx_file.h> |
5 #include <ngx_socket.h> | 6 #include <ngx_socket.h> |
6 #include <ngx_errno.h> | 7 #include <ngx_errno.h> |
7 #include <ngx_log.h> | 8 #include <ngx_log.h> |
10 | 11 |
11 /* | 12 /* |
12 TODO: | 13 TODO: |
13 FreeBSD: | 14 FreeBSD: |
14 check sent if errno == EINTR then should return right sent. | 15 check sent if errno == EINTR then should return right sent. |
15 */ | |
16 | |
17 /* | |
18 returns | |
19 0 done | |
20 -1 error | |
21 */ | 16 */ |
22 | 17 |
23 #if (HAVE_FREEBSD_SENDFILE) | 18 #if (HAVE_FREEBSD_SENDFILE) |
24 | 19 |
25 int ngx_sendfile(ngx_socket_t s, | 20 int ngx_sendfile(ngx_socket_t s, |
48 if (rc == -1) { | 43 if (rc == -1) { |
49 err = ngx_socket_errno; | 44 err = ngx_socket_errno; |
50 if (err != NGX_EAGAIN && err != NGX_EINTR) { | 45 if (err != NGX_EAGAIN && err != NGX_EINTR) { |
51 ngx_log_error(NGX_LOG_ERR, log, err, | 46 ngx_log_error(NGX_LOG_ERR, log, err, |
52 "ngx_sendfile: sendfile failed"); | 47 "ngx_sendfile: sendfile failed"); |
53 return -1; | 48 return NGX_ERROR; |
54 | 49 |
55 } else { | 50 } else { |
56 ngx_log_error(NGX_LOG_INFO, log, err, | 51 ngx_log_error(NGX_LOG_INFO, log, err, |
57 "ngx_sendfile: sendfile sent only %qd bytes", *sent); | 52 "ngx_sendfile: sendfile sent only %qd bytes", *sent); |
58 } | 53 } |
59 } | 54 } |
60 | 55 |
61 ngx_log_debug(log, "ngx_sendfile: %d, @%qd %qd:%d" _ | 56 ngx_log_debug(log, "ngx_sendfile: %d, @%qd %qd:%d" _ |
62 rc _ offset _ *sent _ nbytes); | 57 rc _ offset _ *sent _ nbytes); |
63 | 58 |
64 return 0; | 59 return NGX_OK; |
65 } | 60 } |
66 | 61 |
67 #endif | 62 #endif |