[nginx] Core: added support for writing to stdout.

Vladimir Homutov vl at nginx.com
Tue Jun 16 12:48:58 UTC 2015


details:   http://hg.nginx.org/nginx/rev/db138b3b645e
branches:  
changeset: 6186:db138b3b645e
user:      Vladimir Homutov <vl at nginx.com>
date:      Tue Jun 16 15:47:40 2015 +0300
description:
Core: added support for writing to stdout.

diffstat:

 src/core/ngx_log.h       |  7 +++++++
 src/os/unix/ngx_files.h  |  1 +
 src/os/win32/ngx_files.h |  1 +
 3 files changed, 9 insertions(+), 0 deletions(-)

diffs (39 lines):

diff -r a420cb1c170b -r db138b3b645e src/core/ngx_log.h
--- a/src/core/ngx_log.h	Tue Jun 16 13:45:19 2015 +0300
+++ b/src/core/ngx_log.h	Tue Jun 16 15:47:40 2015 +0300
@@ -255,6 +255,13 @@ ngx_write_stderr(char *text)
 }
 
 
+static ngx_inline void
+ngx_write_stdout(char *text)
+{
+    (void) ngx_write_fd(ngx_stdout, text, ngx_strlen(text));
+}
+
+
 extern ngx_module_t  ngx_errlog_module;
 extern ngx_uint_t    ngx_use_stderr;
 
diff -r a420cb1c170b -r db138b3b645e src/os/unix/ngx_files.h
--- a/src/os/unix/ngx_files.h	Tue Jun 16 13:45:19 2015 +0300
+++ b/src/os/unix/ngx_files.h	Tue Jun 16 15:47:40 2015 +0300
@@ -368,6 +368,7 @@ size_t ngx_fs_bsize(u_char *name);
 #endif
 
 
+#define ngx_stdout               STDOUT_FILENO
 #define ngx_stderr               STDERR_FILENO
 #define ngx_set_stderr(fd)       dup2(fd, STDERR_FILENO)
 #define ngx_set_stderr_n         "dup2(STDERR_FILENO)"
diff -r a420cb1c170b -r db138b3b645e src/os/win32/ngx_files.h
--- a/src/os/win32/ngx_files.h	Tue Jun 16 13:45:19 2015 +0300
+++ b/src/os/win32/ngx_files.h	Tue Jun 16 15:47:40 2015 +0300
@@ -264,6 +264,7 @@ ngx_int_t ngx_directio_off(ngx_fd_t fd);
 size_t ngx_fs_bsize(u_char *name);
 
 
+#define ngx_stdout               GetStdHandle(STD_OUTPUT_HANDLE)
 #define ngx_stderr               GetStdHandle(STD_ERROR_HANDLE)
 #define ngx_set_stderr(fd)       SetStdHandle(STD_ERROR_HANDLE, fd)
 #define ngx_set_stderr_n         "SetStdHandle(STD_ERROR_HANDLE)"



More information about the nginx-devel mailing list