aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2003-11-26 15:42:18 +0000
committerIgor Sysoev <igor@sysoev.ru>2003-11-26 15:42:18 +0000
commitc0f8d91bde06aeeb53ff16d6c26490f5961f5a31 (patch)
tree034ba6291b7d4975868371dae533e4ab985c63f5 /src
parenta8fa0a6a37b6e90324e0dcbf4733324199623841 (diff)
downloadnginx-c0f8d91bde06aeeb53ff16d6c26490f5961f5a31.tar.gz
nginx-c0f8d91bde06aeeb53ff16d6c26490f5961f5a31.zip
nginx-0.0.1-2003-11-26-18:42:18 import
Diffstat (limited to 'src')
-rw-r--r--src/event/modules/ngx_kqueue_module.c7
-rw-r--r--src/os/unix/ngx_files.c2
-rw-r--r--src/os/unix/ngx_freebsd_config.h1
-rw-r--r--src/os/unix/ngx_freebsd_init.c2
-rw-r--r--src/os/unix/ngx_linux.h2
-rw-r--r--src/os/unix/ngx_linux_config.h5
-rw-r--r--src/os/unix/ngx_linux_init.c4
-rw-r--r--src/os/unix/ngx_linux_sendfile_chain.c15
-rw-r--r--src/os/unix/ngx_os.h5
-rw-r--r--src/os/unix/ngx_solaris_config.h14
-rw-r--r--src/os/unix/ngx_solaris_init.c4
11 files changed, 34 insertions, 27 deletions
diff --git a/src/event/modules/ngx_kqueue_module.c b/src/event/modules/ngx_kqueue_module.c
index 1f069792a..9371ecee1 100644
--- a/src/event/modules/ngx_kqueue_module.c
+++ b/src/event/modules/ngx_kqueue_module.c
@@ -311,7 +311,12 @@ static int ngx_kqueue_set_event(ngx_event_t *ev, int filter, u_int flags)
if (filter == EVFILT_VNODE) {
change_list[nchanges].fflags = NOTE_DELETE|NOTE_WRITE|NOTE_EXTEND
- |NOTE_ATTRIB|NOTE_RENAME|NOTE_REVOKE;
+ |NOTE_ATTRIB|NOTE_RENAME
+#if (__FreeBSD__ == 4 && __FreeBSD_version >= 430000) \
+ || __FreeBSD_version >= 500018
+ |NOTE_REVOKE
+#endif
+ ;
change_list[nchanges].data = 0;
} else {
diff --git a/src/os/unix/ngx_files.c b/src/os/unix/ngx_files.c
index 7563009da..5d0cd380e 100644
--- a/src/os/unix/ngx_files.c
+++ b/src/os/unix/ngx_files.c
@@ -11,7 +11,7 @@ ssize_t ngx_read_file(ngx_file_t *file, char *buf, size_t size, off_t offset)
{
ssize_t n;
- ngx_log_debug(file->log, "read: %d, %x, %d, %qd" _
+ ngx_log_debug(file->log, "read: %d, %x, %d, " OFF_T_FMT _
file->fd _ buf _ size _ offset);
#if (HAVE_PREAD)
diff --git a/src/os/unix/ngx_freebsd_config.h b/src/os/unix/ngx_freebsd_config.h
index 24fb7b0e8..f208bf16c 100644
--- a/src/os/unix/ngx_freebsd_config.h
+++ b/src/os/unix/ngx_freebsd_config.h
@@ -79,4 +79,5 @@
#define HAVE_LITTLE_ENDIAN 1
+
#endif /* _NGX_FREEBSD_CONFIG_H_INCLUDED_ */
diff --git a/src/os/unix/ngx_freebsd_init.c b/src/os/unix/ngx_freebsd_init.c
index 3446382fe..c755a3ec6 100644
--- a/src/os/unix/ngx_freebsd_init.c
+++ b/src/os/unix/ngx_freebsd_init.c
@@ -22,7 +22,7 @@ ngx_os_io_t ngx_os_io = {
NULL,
#if (HAVE_SENDFILE)
ngx_freebsd_sendfile_chain,
- NGX_HAVE_SENDFILE
+ NGX_IO_SENDFILE
#else
ngx_writev_chain,
0
diff --git a/src/os/unix/ngx_linux.h b/src/os/unix/ngx_linux.h
index 12ccb97d4..0cbb677c8 100644
--- a/src/os/unix/ngx_linux.h
+++ b/src/os/unix/ngx_linux.h
@@ -2,7 +2,7 @@
#define _NGX_LINUX_H_INCLUDED_
-ngx_chain_t *ngx_linux_sendfile_chain(ngx_connection_t *c, ngx_chain_t *in)
+ngx_chain_t *ngx_linux_sendfile_chain(ngx_connection_t *c, ngx_chain_t *in);
#endif /* _NGX_LINUX_H_INCLUDED_ */
diff --git a/src/os/unix/ngx_linux_config.h b/src/os/unix/ngx_linux_config.h
index 761263f57..59e1b0976 100644
--- a/src/os/unix/ngx_linux_config.h
+++ b/src/os/unix/ngx_linux_config.h
@@ -4,8 +4,10 @@
#define _GNU_SOURCE /* pread(), pwrite(), gethostname() */
+#if 0
#define _FILE_OFFSET_BITS 64
#define _LARGEFILE_SOURCE
+#endif
#include <unistd.h>
@@ -24,8 +26,11 @@
#include <sys/ioctl.h>
#include <sys/resource.h>
#include <sys/sysctl.h>
+#include <sys/wait.h>
#include <sys/socket.h>
+#include <sys/sendfile.h>
#include <netinet/in.h>
+#include <netinet/tcp.h> /* TCP_CORK */
#include <arpa/inet.h>
#include <dirent.h>
#include <netdb.h>
diff --git a/src/os/unix/ngx_linux_init.c b/src/os/unix/ngx_linux_init.c
index 86b98aa80..387a49143 100644
--- a/src/os/unix/ngx_linux_init.c
+++ b/src/os/unix/ngx_linux_init.c
@@ -11,8 +11,8 @@ ngx_os_io_t ngx_os_io = {
ngx_unix_recv,
NULL,
NULL,
- ngx_writev_chain,
- NGX_HAVE_ZEROCOPY
+ ngx_linux_sendfile_chain,
+ NGX_IO_SENDFILE
};
diff --git a/src/os/unix/ngx_linux_sendfile_chain.c b/src/os/unix/ngx_linux_sendfile_chain.c
index 31bcf3d6a..0b8e41792 100644
--- a/src/os/unix/ngx_linux_sendfile_chain.c
+++ b/src/os/unix/ngx_linux_sendfile_chain.c
@@ -8,7 +8,7 @@ ngx_chain_t *ngx_linux_sendfile_chain(ngx_connection_t *c, ngx_chain_t *in)
{
int rc;
char *prev;
- off_t fprev;
+ off_t offset;
size_t size, fsize, sent;
ngx_int_t use_cork, eintr;
struct iovec *iov;
@@ -16,7 +16,7 @@ ngx_chain_t *ngx_linux_sendfile_chain(ngx_connection_t *c, ngx_chain_t *in)
ngx_hunk_t *file;
ngx_array_t header;
ngx_event_t *wev;
- ngx_chain_t *cl;
+ ngx_chain_t *cl, *tail;
wev = c->write;
@@ -24,8 +24,6 @@ ngx_chain_t *ngx_linux_sendfile_chain(ngx_connection_t *c, ngx_chain_t *in)
return in;
}
- cork = 0;
-
do {
file = NULL;
fsize = 0;
@@ -84,20 +82,20 @@ ngx_log_debug(c->log, "CORK");
file = cl->hunk;
fsize = (size_t) (file->file_last - file->file_pos);
- fprev = file->file_last;
+ offset = file->file_last;
cl = cl->next;
/* coalesce the neighbouring file hunks */
while (cl && (cl->hunk->type & NGX_HUNK_FILE)) {
if (file->file->fd != cl->hunk->file->fd
- || fprev != cl->hunk->file_pos)
+ || offset != cl->hunk->file_pos)
{
break;
}
fsize += (size_t) (cl->hunk->file_last - cl->hunk->file_pos);
- fprev = cl->hunk->file_last;
+ offset = cl->hunk->file_last;
cl = cl->next;
}
}
@@ -110,7 +108,8 @@ ngx_log_debug(c->log, "CORK");
tail = cl;
if (fsize) {
- rc = sendfile(c->fd, file->file->fd, file->file_pos, fsize);
+ offset = file->file_pos;
+ rc = sendfile(c->fd, file->file->fd, &offset, fsize);
if (rc == -1) {
err = ngx_errno;
diff --git a/src/os/unix/ngx_os.h b/src/os/unix/ngx_os.h
index 658c0a400..1cc597b20 100644
--- a/src/os/unix/ngx_os.h
+++ b/src/os/unix/ngx_os.h
@@ -57,4 +57,9 @@ extern int rotate;
#endif
+#ifdef __linux__
+#include <ngx_linux.h>
+#endif
+
+
#endif /* _NGX_OS_H_INCLUDED_ */
diff --git a/src/os/unix/ngx_solaris_config.h b/src/os/unix/ngx_solaris_config.h
index 57ef672e5..078d8d07c 100644
--- a/src/os/unix/ngx_solaris_config.h
+++ b/src/os/unix/ngx_solaris_config.h
@@ -17,8 +17,9 @@
#include <fcntl.h>
#include <signal.h>
#include <strings.h>
-
#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/wait.h>
#include <sys/filio.h> /* FIONBIO */
#include <sys/stropts.h> /* INFTIM */
#include <sys/socket.h>
@@ -26,16 +27,7 @@
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
-
-
-#if 0
-#define OFF_FMT "%lld"
-#define SIZE_FMT "%d"
-#define SIZEX_FMT "%x"
-#define TIME_FMT "%ld"
-#define PID_FMT "%ld"
-#define RLIM_FMT "%lu"
-#endif
+#include <dirent.h>
#ifndef HAVE_SELECT
diff --git a/src/os/unix/ngx_solaris_init.c b/src/os/unix/ngx_solaris_init.c
index c593ed936..3b1383887 100644
--- a/src/os/unix/ngx_solaris_init.c
+++ b/src/os/unix/ngx_solaris_init.c
@@ -13,7 +13,7 @@ ngx_os_io_t ngx_os_io = {
NULL,
NULL,
ngx_writev_chain,
- NGX_HAVE_ZEROCOPY
+ 0
};
@@ -40,7 +40,7 @@ int ngx_os_init(ngx_log_t *log)
return NGX_ERROR;
}
- ngx_log_error(NGX_LOG_INFO, log, 0, "OS: %s %s"
+ ngx_log_error(NGX_LOG_INFO, log, 0, "OS: %s %s",
ngx_solaris_sysname, ngx_solaris_release);
ngx_log_error(NGX_LOG_INFO, log, 0, "version: %s",