upstream nginx-0.7.31
[nginx.git] / nginx / src / os / unix / ngx_os.h
1
2 /*
3  * Copyright (C) Igor Sysoev
4  */
5
6
7 #ifndef _NGX_OS_H_INCLUDED_
8 #define _NGX_OS_H_INCLUDED_
9
10
11 #include <ngx_config.h>
12 #include <ngx_core.h>
13
14
15 #define NGX_IO_SENDFILE    1
16
17
18 typedef ssize_t (*ngx_recv_pt)(ngx_connection_t *c, u_char *buf, size_t size);
19 typedef ssize_t (*ngx_recv_chain_pt)(ngx_connection_t *c, ngx_chain_t *in);
20 typedef ssize_t (*ngx_send_pt)(ngx_connection_t *c, u_char *buf, size_t size);
21 typedef ngx_chain_t *(*ngx_send_chain_pt)(ngx_connection_t *c, ngx_chain_t *in,
22     off_t limit);
23
24 typedef struct {
25     ngx_recv_pt        recv;
26     ngx_recv_chain_pt  recv_chain;
27     ngx_recv_pt        udp_recv;
28     ngx_send_pt        send;
29     ngx_send_chain_pt  send_chain;
30     ngx_uint_t         flags;
31 } ngx_os_io_t;
32
33
34 void ngx_debug_init(void);
35 ngx_int_t ngx_os_init(ngx_log_t *log);
36 void ngx_os_status(ngx_log_t *log);
37 ngx_int_t ngx_os_specific_init(ngx_log_t *log);
38 void ngx_os_specific_status(ngx_log_t *log);
39 ngx_int_t ngx_daemon(ngx_log_t *log);
40
41
42 ssize_t ngx_unix_recv(ngx_connection_t *c, u_char *buf, size_t size);
43 ssize_t ngx_readv_chain(ngx_connection_t *c, ngx_chain_t *entry);
44 ssize_t ngx_udp_unix_recv(ngx_connection_t *c, u_char *buf, size_t size);
45 ssize_t ngx_unix_send(ngx_connection_t *c, u_char *buf, size_t size);
46 ngx_chain_t *ngx_writev_chain(ngx_connection_t *c, ngx_chain_t *in,
47     off_t limit);
48
49
50 extern ngx_os_io_t  ngx_os_io;
51 extern ngx_int_t    ngx_ncpu;
52 extern ngx_int_t    ngx_max_sockets;
53 extern ngx_uint_t   ngx_inherited_nonblocking;
54 extern ngx_uint_t   ngx_tcp_nodelay_and_tcp_nopush;
55
56 #define ngx_stderr_fileno  STDERR_FILENO
57
58 #if (NGX_FREEBSD)
59 #include <ngx_freebsd.h>
60
61
62 #elif (NGX_LINUX)
63 #include <ngx_linux.h>
64
65
66 #elif (NGX_SOLARIS)
67 #include <ngx_solaris.h>
68
69
70 #elif (NGX_DARWIN)
71 #include <ngx_darwin.h>
72 #endif
73
74
75 #endif /* _NGX_OS_H_INCLUDED_ */