Back to home page

Nginx displayed by LXR

Source navigation ]
Diff markup ]
Identifier search ]
general search ]
 
 
Version: nginx-1.15.11 ]​[ nginx-1.14.2 ]​

0001 
0002 /*
0003  * Copyright (C) Igor Sysoev
0004  * Copyright (C) Nginx, Inc.
0005  */
0006 
0007 
0008 #ifndef _NGX_SOCKET_H_INCLUDED_
0009 #define _NGX_SOCKET_H_INCLUDED_
0010 
0011 
0012 #include <ngx_config.h>
0013 
0014 
0015 #define NGX_WRITE_SHUTDOWN SHUT_WR
0016 
0017 typedef int  ngx_socket_t;
0018 
0019 #define ngx_socket          socket
0020 #define ngx_socket_n        "socket()"
0021 
0022 
0023 #if (NGX_HAVE_FIONBIO)
0024 
0025 int ngx_nonblocking(ngx_socket_t s);
0026 int ngx_blocking(ngx_socket_t s);
0027 
0028 #define ngx_nonblocking_n   "ioctl(FIONBIO)"
0029 #define ngx_blocking_n      "ioctl(!FIONBIO)"
0030 
0031 #else
0032 
0033 #define ngx_nonblocking(s)  fcntl(s, F_SETFL, fcntl(s, F_GETFL) | O_NONBLOCK)
0034 #define ngx_nonblocking_n   "fcntl(O_NONBLOCK)"
0035 
0036 #define ngx_blocking(s)     fcntl(s, F_SETFL, fcntl(s, F_GETFL) & ~O_NONBLOCK)
0037 #define ngx_blocking_n      "fcntl(!O_NONBLOCK)"
0038 
0039 #endif
0040 
0041 int ngx_tcp_nopush(ngx_socket_t s);
0042 int ngx_tcp_push(ngx_socket_t s);
0043 
0044 #if (NGX_LINUX)
0045 
0046 #define ngx_tcp_nopush_n   "setsockopt(TCP_CORK)"
0047 #define ngx_tcp_push_n     "setsockopt(!TCP_CORK)"
0048 
0049 #else
0050 
0051 #define ngx_tcp_nopush_n   "setsockopt(TCP_NOPUSH)"
0052 #define ngx_tcp_push_n     "setsockopt(!TCP_NOPUSH)"
0053 
0054 #endif
0055 
0056 
0057 #define ngx_shutdown_socket    shutdown
0058 #define ngx_shutdown_socket_n  "shutdown()"
0059 
0060 #define ngx_close_socket    close
0061 #define ngx_close_socket_n  "close() socket"
0062 
0063 
0064 #endif /* _NGX_SOCKET_H_INCLUDED_ */