Back to home page

Nginx displayed by LXR

Source navigation ]
Diff markup ]
Identifier search ]
general search ]
 
 
Version: nginx-1.13.12 ]​[ nginx-1.12.2 ]​

0001 
0002 /*
0003  * Copyright (C) Igor Sysoev
0004  * Copyright (C) Nginx, Inc.
0005  */
0006 
0007 
0008 #ifndef _NGX_OS_H_INCLUDED_
0009 #define _NGX_OS_H_INCLUDED_
0010 
0011 
0012 #include <ngx_config.h>
0013 #include <ngx_core.h>
0014 
0015 
0016 #define NGX_IO_SENDFILE    1
0017 
0018 
0019 typedef ssize_t (*ngx_recv_pt)(ngx_connection_t *c, u_char *buf, size_t size);
0020 typedef ssize_t (*ngx_recv_chain_pt)(ngx_connection_t *c, ngx_chain_t *in,
0021     off_t limit);
0022 typedef ssize_t (*ngx_send_pt)(ngx_connection_t *c, u_char *buf, size_t size);
0023 typedef ngx_chain_t *(*ngx_send_chain_pt)(ngx_connection_t *c, ngx_chain_t *in,
0024     off_t limit);
0025 
0026 typedef struct {
0027     ngx_recv_pt        recv;
0028     ngx_recv_chain_pt  recv_chain;
0029     ngx_recv_pt        udp_recv;
0030     ngx_send_pt        send;
0031     ngx_send_pt        udp_send;
0032     ngx_send_chain_pt  udp_send_chain;
0033     ngx_send_chain_pt  send_chain;
0034     ngx_uint_t         flags;
0035 } ngx_os_io_t;
0036 
0037 
0038 ngx_int_t ngx_os_init(ngx_log_t *log);
0039 void ngx_os_status(ngx_log_t *log);
0040 ngx_int_t ngx_os_specific_init(ngx_log_t *log);
0041 void ngx_os_specific_status(ngx_log_t *log);
0042 ngx_int_t ngx_daemon(ngx_log_t *log);
0043 ngx_int_t ngx_os_signal_process(ngx_cycle_t *cycle, char *sig, ngx_pid_t pid);
0044 
0045 
0046 ssize_t ngx_unix_recv(ngx_connection_t *c, u_char *buf, size_t size);
0047 ssize_t ngx_readv_chain(ngx_connection_t *c, ngx_chain_t *entry, off_t limit);
0048 ssize_t ngx_udp_unix_recv(ngx_connection_t *c, u_char *buf, size_t size);
0049 ssize_t ngx_unix_send(ngx_connection_t *c, u_char *buf, size_t size);
0050 ngx_chain_t *ngx_writev_chain(ngx_connection_t *c, ngx_chain_t *in,
0051     off_t limit);
0052 ssize_t ngx_udp_unix_send(ngx_connection_t *c, u_char *buf, size_t size);
0053 ngx_chain_t *ngx_udp_unix_sendmsg_chain(ngx_connection_t *c, ngx_chain_t *in,
0054     off_t limit);
0055 
0056 
0057 #if (IOV_MAX > 64)
0058 #define NGX_IOVS_PREALLOCATE  64
0059 #else
0060 #define NGX_IOVS_PREALLOCATE  IOV_MAX
0061 #endif
0062 
0063 
0064 typedef struct {
0065     struct iovec  *iovs;
0066     ngx_uint_t     count;
0067     size_t         size;
0068     ngx_uint_t     nalloc;
0069 } ngx_iovec_t;
0070 
0071 ngx_chain_t *ngx_output_chain_to_iovec(ngx_iovec_t *vec, ngx_chain_t *in,
0072     size_t limit, ngx_log_t *log);
0073 
0074 
0075 ssize_t ngx_writev(ngx_connection_t *c, ngx_iovec_t *vec);
0076 
0077 
0078 extern ngx_os_io_t  ngx_os_io;
0079 extern ngx_int_t    ngx_ncpu;
0080 extern ngx_int_t    ngx_max_sockets;
0081 extern ngx_uint_t   ngx_inherited_nonblocking;
0082 extern ngx_uint_t   ngx_tcp_nodelay_and_tcp_nopush;
0083 
0084 
0085 #if (NGX_FREEBSD)
0086 #include <ngx_freebsd.h>
0087 
0088 
0089 #elif (NGX_LINUX)
0090 #include <ngx_linux.h>
0091 
0092 
0093 #elif (NGX_SOLARIS)
0094 #include <ngx_solaris.h>
0095 
0096 
0097 #elif (NGX_DARWIN)
0098 #include <ngx_darwin.h>
0099 #endif
0100 
0101 
0102 #endif /* _NGX_OS_H_INCLUDED_ */