mirror of
https://github.com/yann64/haikuports.git
synced 2026-05-05 14:38:51 +02:00
New patch for nginx
Worked around the maximum errno issue with a specific implementation.
This commit is contained in:
338
www-servers/nginx/patches/nginx-1.7.4_hg.diff
Normal file
338
www-servers/nginx/patches/nginx-1.7.4_hg.diff
Normal file
@@ -0,0 +1,338 @@
|
|||||||
|
diff -r 4d092aa2f463 auto/os/conf
|
||||||
|
--- a/auto/os/conf lun. juil. 28 12:27:57 2014 -0700
|
||||||
|
+++ b/auto/os/conf mer. juil. 30 15:59:06 2014 +0200
|
||||||
|
@@ -60,6 +60,24 @@
|
||||||
|
CORE_SRCS="$UNIX_SRCS"
|
||||||
|
;;
|
||||||
|
|
||||||
|
+ Haiku:*)
|
||||||
|
+ # Haiku
|
||||||
|
+ have=NGX_HAIKU . auto/have_headers
|
||||||
|
+ CORE_INCS="$UNIX_INCS"
|
||||||
|
+ CORE_DEPS="$UNIX_DEPS $POSIX_DEPS"
|
||||||
|
+ CORE_SRCS="$UNIX_SRCS $HAIKU_SRCS"
|
||||||
|
+ CORE_LIBS="$CORE_LIBS -lnetwork"
|
||||||
|
+ NGX_PREFIX="${NGX_PREFIX:-`finddir B_SYSTEM_NONPACKAGED_DIRECTORY`}"
|
||||||
|
+ NGX_SBIN_PATH="${NGX_SBIN_PATH:-`finddir B_SYSTEM_NONPACKAGED_BIN_DIRECTORY`/nginx}"
|
||||||
|
+ # XXX: move those to auto/options?
|
||||||
|
+ NGX_CONF_PREFIX="`finddir B_SYSTEM_SETTINGS_DIRECTORY`"
|
||||||
|
+ NGX_CONF_PATH="$NGX_CONF_PREFIX/nginx.conf"
|
||||||
|
+ NGX_PID_PATH="`finddir B_COMMON_VAR_DIRECTORY`/nginx.pid"
|
||||||
|
+ NGX_LOCK_PATH="`finddir B_COMMON_VAR_DIRECTORY`/nginx.lock"
|
||||||
|
+ NGX_ERROR_LOG_PATH="`finddir B_SYSTEM_LOG_DIRECTORY`/error.log"
|
||||||
|
+ NGX_HTTP_LOG_PATH="`finddir B_SYSTEM_LOG_DIRECTORY`/access.log"
|
||||||
|
+ ;;
|
||||||
|
+
|
||||||
|
*)
|
||||||
|
CORE_INCS="$UNIX_INCS"
|
||||||
|
CORE_DEPS="$UNIX_DEPS $POSIX_DEPS"
|
||||||
|
@@ -71,7 +89,7 @@
|
||||||
|
|
||||||
|
case "$NGX_MACHINE" in
|
||||||
|
|
||||||
|
- i386 | i686 | i86pc)
|
||||||
|
+ i386 | i686 | i86pc | BePC)
|
||||||
|
have=NGX_HAVE_NONALIGNED . auto/have
|
||||||
|
NGX_MACH_CACHE_LINE=32
|
||||||
|
;;
|
||||||
|
diff -r 4d092aa2f463 auto/sources
|
||||||
|
--- a/auto/sources lun. juil. 28 12:27:57 2014 -0700
|
||||||
|
+++ b/auto/sources mer. juil. 30 15:59:06 2014 +0200
|
||||||
|
@@ -217,6 +217,9 @@
|
||||||
|
DARWIN_SENDFILE_SRCS=src/os/unix/ngx_darwin_sendfile_chain.c
|
||||||
|
|
||||||
|
|
||||||
|
+HAIKU_SRCS=src/os/unix/ngx_haiku_errno.c
|
||||||
|
+
|
||||||
|
+
|
||||||
|
WIN32_INCS="$CORE_INCS $EVENT_INCS src/os/win32"
|
||||||
|
|
||||||
|
WIN32_DEPS="$CORE_DEPS $EVENT_DEPS \
|
||||||
|
diff -r 4d092aa2f463 auto/unix
|
||||||
|
--- a/auto/unix lun. juil. 28 12:27:57 2014 -0700
|
||||||
|
+++ b/auto/unix mer. juil. 30 15:59:06 2014 +0200
|
||||||
|
@@ -276,6 +276,18 @@
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
+ngx_feature="setpriority()"
|
||||||
|
+ngx_feature_name="NGX_HAVE_SETPRIORITY"
|
||||||
|
+ngx_feature_run=no
|
||||||
|
+ngx_feature_incs="#include <unistd.h>
|
||||||
|
+ #include <sys/types.h>
|
||||||
|
+ #include <sys/resource.h>"
|
||||||
|
+ngx_feature_path=
|
||||||
|
+ngx_feature_libs=
|
||||||
|
+ngx_feature_test="setpriority(PRIO_PROCESS, getpid(), 0)"
|
||||||
|
+. auto/feature
|
||||||
|
+
|
||||||
|
+
|
||||||
|
ngx_feature="sched_yield()"
|
||||||
|
ngx_feature_name="NGX_HAVE_SCHED_YIELD"
|
||||||
|
ngx_feature_run=no
|
||||||
|
diff -r 4d092aa2f463 src/os/unix/ngx_errno.c
|
||||||
|
--- a/src/os/unix/ngx_errno.c lun. juil. 28 12:27:57 2014 -0700
|
||||||
|
+++ b/src/os/unix/ngx_errno.c mer. juil. 30 15:59:06 2014 +0200
|
||||||
|
@@ -9,6 +9,7 @@
|
||||||
|
#include <ngx_core.h>
|
||||||
|
|
||||||
|
|
||||||
|
+#if !(NGX_HAIKU)
|
||||||
|
/*
|
||||||
|
* The strerror() messages are copied because:
|
||||||
|
*
|
||||||
|
@@ -85,3 +86,5 @@
|
||||||
|
|
||||||
|
return NGX_ERROR;
|
||||||
|
}
|
||||||
|
+
|
||||||
|
+#endif
|
||||||
|
diff -r 4d092aa2f463 src/os/unix/ngx_haiku_errno.c
|
||||||
|
--- /dev/null jeu. janv. 01 00:00:00 1970 +0000
|
||||||
|
+++ b/src/os/unix/ngx_haiku_errno.c mer. juil. 30 15:59:06 2014 +0200
|
||||||
|
@@ -0,0 +1,158 @@
|
||||||
|
+
|
||||||
|
+/*
|
||||||
|
+ * Copyright (C) Igor Sysoev
|
||||||
|
+ * Copyright (C) Nginx, Inc.
|
||||||
|
+ */
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+#include <ngx_config.h>
|
||||||
|
+#include <ngx_core.h>
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+/*
|
||||||
|
+ * The strerror() messages are copied because:
|
||||||
|
+ *
|
||||||
|
+ * 1) strerror() and strerror_r() functions are not Async-Signal-Safe,
|
||||||
|
+ * therefore, they cannot be used in signal handlers;
|
||||||
|
+ *
|
||||||
|
+ * 2) a direct sys_errlist[] array may be used instead of these functions,
|
||||||
|
+ * but Linux linker warns about its usage:
|
||||||
|
+ *
|
||||||
|
+ * warning: `sys_errlist' is deprecated; use `strerror' or `strerror_r' instead
|
||||||
|
+ * warning: `sys_nerr' is deprecated; use `strerror' or `strerror_r' instead
|
||||||
|
+ *
|
||||||
|
+ * causing false bug reports.
|
||||||
|
+ *
|
||||||
|
+ * We avoid using an indexed array because:
|
||||||
|
+ *
|
||||||
|
+ * 1) on Haiku at least, errors are declared as negative numbers.
|
||||||
|
+ *
|
||||||
|
+ * 2) even though there is a posix_error_mapper static library
|
||||||
|
+ * on Haiku that works around this, the converted errors are
|
||||||
|
+ * around 0x7fff0000 anyway.
|
||||||
|
+ *
|
||||||
|
+ * 3) the POSIX error codes are not all defined as B_POSIX_ERROR_BASE + n
|
||||||
|
+ * on Haiku anyway.
|
||||||
|
+ */
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+typedef struct {
|
||||||
|
+ int error;
|
||||||
|
+ ngx_str_t str;
|
||||||
|
+} ngx_errmap_t;
|
||||||
|
+
|
||||||
|
+static ngx_errmap_t ngx_sys_errmap[] = {
|
||||||
|
+/*
|
||||||
|
+ * This list should be kept in sync with src/os/unix/ngx_errno.h and
|
||||||
|
+ * is generated by:
|
||||||
|
+
|
||||||
|
+awk 'BEGIN {d=0}
|
||||||
|
+/define NGX_/ {print "{ " $2 ", ngx_null_string },"}
|
||||||
|
+/#if .*_HAVE_/ {d=1;print $0}
|
||||||
|
+/#endif/ && d {d=0;print}
|
||||||
|
+' src/os/unix/ngx_errno.h | uniq
|
||||||
|
+
|
||||||
|
+ */
|
||||||
|
+{ NGX_EPERM, ngx_null_string },
|
||||||
|
+{ NGX_ENOENT, ngx_null_string },
|
||||||
|
+{ NGX_ENOPATH, ngx_null_string },
|
||||||
|
+{ NGX_ESRCH, ngx_null_string },
|
||||||
|
+{ NGX_EINTR, ngx_null_string },
|
||||||
|
+{ NGX_ECHILD, ngx_null_string },
|
||||||
|
+{ NGX_ENOMEM, ngx_null_string },
|
||||||
|
+{ NGX_EACCES, ngx_null_string },
|
||||||
|
+{ NGX_EBUSY, ngx_null_string },
|
||||||
|
+{ NGX_EEXIST, ngx_null_string },
|
||||||
|
+{ NGX_EXDEV, ngx_null_string },
|
||||||
|
+{ NGX_ENOTDIR, ngx_null_string },
|
||||||
|
+{ NGX_EISDIR, ngx_null_string },
|
||||||
|
+{ NGX_EINVAL, ngx_null_string },
|
||||||
|
+{ NGX_ENFILE, ngx_null_string },
|
||||||
|
+{ NGX_EMFILE, ngx_null_string },
|
||||||
|
+{ NGX_ENOSPC, ngx_null_string },
|
||||||
|
+{ NGX_EPIPE, ngx_null_string },
|
||||||
|
+{ NGX_EINPROGRESS, ngx_null_string },
|
||||||
|
+{ NGX_ENOPROTOOPT, ngx_null_string },
|
||||||
|
+{ NGX_EOPNOTSUPP, ngx_null_string },
|
||||||
|
+{ NGX_EADDRINUSE, ngx_null_string },
|
||||||
|
+{ NGX_ECONNABORTED, ngx_null_string },
|
||||||
|
+{ NGX_ECONNRESET, ngx_null_string },
|
||||||
|
+{ NGX_ENOTCONN, ngx_null_string },
|
||||||
|
+{ NGX_ETIMEDOUT, ngx_null_string },
|
||||||
|
+{ NGX_ECONNREFUSED, ngx_null_string },
|
||||||
|
+{ NGX_ENAMETOOLONG, ngx_null_string },
|
||||||
|
+{ NGX_ENETDOWN, ngx_null_string },
|
||||||
|
+{ NGX_ENETUNREACH, ngx_null_string },
|
||||||
|
+{ NGX_EHOSTDOWN, ngx_null_string },
|
||||||
|
+{ NGX_EHOSTUNREACH, ngx_null_string },
|
||||||
|
+{ NGX_ENOSYS, ngx_null_string },
|
||||||
|
+{ NGX_ECANCELED, ngx_null_string },
|
||||||
|
+{ NGX_EILSEQ, ngx_null_string },
|
||||||
|
+{ NGX_ENOMOREFILES, ngx_null_string },
|
||||||
|
+{ NGX_ELOOP, ngx_null_string },
|
||||||
|
+{ NGX_EBADF, ngx_null_string },
|
||||||
|
+#if (NGX_HAVE_OPENAT)
|
||||||
|
+{ NGX_EMLINK, ngx_null_string },
|
||||||
|
+#endif
|
||||||
|
+{ NGX_EAGAIN, ngx_null_string },
|
||||||
|
+{ 0, ngx_null_string }
|
||||||
|
+};
|
||||||
|
+static ngx_str_t ngx_unknown_error = ngx_string("Unknown error");
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+u_char *
|
||||||
|
+ngx_strerror(ngx_err_t err, u_char *errstr, size_t size)
|
||||||
|
+{
|
||||||
|
+ ngx_str_t *msg = &ngx_unknown_error;
|
||||||
|
+ int i;
|
||||||
|
+
|
||||||
|
+ for (i = 0; ngx_sys_errmap[i].error != 0; i++) {
|
||||||
|
+ if (ngx_sys_errmap[i].error == err) {
|
||||||
|
+ msg = &ngx_sys_errmap[i].str;
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ size = ngx_min(size, msg->len);
|
||||||
|
+
|
||||||
|
+ return ngx_cpymem(errstr, msg->data, size);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+ngx_int_t
|
||||||
|
+ngx_strerror_init(void)
|
||||||
|
+{
|
||||||
|
+ char *msg;
|
||||||
|
+ u_char *p;
|
||||||
|
+ size_t len;
|
||||||
|
+ ngx_err_t err;
|
||||||
|
+ int i;
|
||||||
|
+
|
||||||
|
+ /*
|
||||||
|
+ * ngx_strerror() is not ready to work at this stage, therefore,
|
||||||
|
+ * malloc() is used and possible errors are logged using strerror().
|
||||||
|
+ */
|
||||||
|
+
|
||||||
|
+ for (i = 0; ngx_sys_errmap[i].error != 0; i++) {
|
||||||
|
+ msg = strerror(ngx_sys_errmap[i].error);
|
||||||
|
+ len = ngx_strlen(msg);
|
||||||
|
+
|
||||||
|
+ p = malloc(len);
|
||||||
|
+ if (p == NULL) {
|
||||||
|
+ goto failed;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ ngx_memcpy(p, msg, len);
|
||||||
|
+ ngx_sys_errmap[i].str.len = len;
|
||||||
|
+ ngx_sys_errmap[i].str.data = p;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ return NGX_OK;
|
||||||
|
+
|
||||||
|
+failed:
|
||||||
|
+
|
||||||
|
+ err = errno;
|
||||||
|
+ ngx_log_stderr(0, "malloc(%uz) failed (%d: %s)", len, err, strerror(err));
|
||||||
|
+
|
||||||
|
+ return NGX_ERROR;
|
||||||
|
+}
|
||||||
|
diff -r 4d092aa2f463 src/os/unix/ngx_process.c
|
||||||
|
--- a/src/os/unix/ngx_process.c lun. juil. 28 12:27:57 2014 -0700
|
||||||
|
+++ b/src/os/unix/ngx_process.c mer. juil. 30 15:59:06 2014 +0200
|
||||||
|
@@ -71,7 +71,9 @@
|
||||||
|
|
||||||
|
{ SIGINT, "SIGINT", "", ngx_signal_handler },
|
||||||
|
|
||||||
|
+#ifdef SIGIO
|
||||||
|
{ SIGIO, "SIGIO", "", ngx_signal_handler },
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
{ SIGCHLD, "SIGCHLD", "", ngx_signal_handler },
|
||||||
|
|
||||||
|
@@ -143,19 +145,23 @@
|
||||||
|
}
|
||||||
|
|
||||||
|
on = 1;
|
||||||
|
+#ifdef FIOASYNC
|
||||||
|
if (ioctl(ngx_processes[s].channel[0], FIOASYNC, &on) == -1) {
|
||||||
|
ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
|
||||||
|
"ioctl(FIOASYNC) failed while spawning \"%s\"", name);
|
||||||
|
ngx_close_channel(ngx_processes[s].channel, cycle->log);
|
||||||
|
return NGX_INVALID_PID;
|
||||||
|
}
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
+#ifdef F_SETOWN
|
||||||
|
if (fcntl(ngx_processes[s].channel[0], F_SETOWN, ngx_pid) == -1) {
|
||||||
|
ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
|
||||||
|
"fcntl(F_SETOWN) failed while spawning \"%s\"", name);
|
||||||
|
ngx_close_channel(ngx_processes[s].channel, cycle->log);
|
||||||
|
return NGX_INVALID_PID;
|
||||||
|
}
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
if (fcntl(ngx_processes[s].channel[0], F_SETFD, FD_CLOEXEC) == -1) {
|
||||||
|
ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
|
||||||
|
@@ -385,9 +391,11 @@
|
||||||
|
ngx_sigalrm = 1;
|
||||||
|
break;
|
||||||
|
|
||||||
|
+#ifdef SIGIO
|
||||||
|
case SIGIO:
|
||||||
|
ngx_sigio = 1;
|
||||||
|
break;
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
case SIGCHLD:
|
||||||
|
ngx_reap = 1;
|
||||||
|
@@ -423,7 +431,9 @@
|
||||||
|
|
||||||
|
case ngx_signal_value(NGX_RECONFIGURE_SIGNAL):
|
||||||
|
case ngx_signal_value(NGX_CHANGEBIN_SIGNAL):
|
||||||
|
+#ifdef SIGIO
|
||||||
|
case SIGIO:
|
||||||
|
+#endif
|
||||||
|
action = ", ignoring";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
diff -r 4d092aa2f463 src/os/unix/ngx_process_cycle.c
|
||||||
|
--- a/src/os/unix/ngx_process_cycle.c lun. juil. 28 12:27:57 2014 -0700
|
||||||
|
+++ b/src/os/unix/ngx_process_cycle.c mer. juil. 30 15:59:06 2014 +0200
|
||||||
|
@@ -97,7 +97,9 @@
|
||||||
|
sigemptyset(&set);
|
||||||
|
sigaddset(&set, SIGCHLD);
|
||||||
|
sigaddset(&set, SIGALRM);
|
||||||
|
+#ifdef SIGIO
|
||||||
|
sigaddset(&set, SIGIO);
|
||||||
|
+#endif
|
||||||
|
sigaddset(&set, SIGINT);
|
||||||
|
sigaddset(&set, ngx_signal_value(NGX_RECONFIGURE_SIGNAL));
|
||||||
|
sigaddset(&set, ngx_signal_value(NGX_REOPEN_SIGNAL));
|
||||||
|
@@ -862,12 +864,14 @@
|
||||||
|
|
||||||
|
ccf = (ngx_core_conf_t *) ngx_get_conf(cycle->conf_ctx, ngx_core_module);
|
||||||
|
|
||||||
|
+#if (NGX_HAVE_SETPRIORITY)
|
||||||
|
if (worker >= 0 && ccf->priority != 0) {
|
||||||
|
if (setpriority(PRIO_PROCESS, 0, ccf->priority) == -1) {
|
||||||
|
ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
|
||||||
|
"setpriority(%d) failed", ccf->priority);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
if (ccf->rlimit_nofile != NGX_CONF_UNSET) {
|
||||||
|
rlmt.rlim_cur = (rlim_t) ccf->rlimit_nofile;
|
||||||
Reference in New Issue
Block a user