acl  3.5.3.0
acl_master_proto.h
浏览该文件的文档.
1 #ifndef __ACL_MASTER_PROTO_INCLUDE_H__
2 #define __ACL_MASTER_PROTO_INCLUDE_H__
3 
4 #include "../stdlib/acl_define.h"
5 
6 #ifndef ACL_CLIENT_ONLY
7 
8 #ifdef __cplusplus
9 extern "C" {
10 #endif
11 
12 #ifdef ACL_UNIX
13 
14  /*
15  * Well-known socket or FIFO directories. The main difference is in file
16  * access permissions.
17  */
18 #define ACL_MASTER_CLASS_PUBLIC "public"
19 #define ACL_MASTER_CLASS_PRIVATE "private"
20 
21  /*
22  * Generic triggers.
23  */
24 #define ACL_TRIGGER_REQ_WAKEUP 'W' /* wakeup */
25 
26  /*
27  * Transport names. The master passes the transport name on the command
28  * line, and thus the name is part of the master to child protocol.
29  */
30 #define ACL_MASTER_XPORT_NAME_UNIX "unix" /* local IPC */
31 #define ACL_MASTER_XPORT_NAME_FIFO "fifo" /* local IPC */
32 #define ACL_MASTER_XPORT_NAME_INET "inet" /* non-local IPC */
33 #define ACL_MASTER_XPORT_NAME_SOCK "sock" /* inet/unix IPC */
34 #define ACL_MASTER_XPORT_NAME_UDP "udp" /* udp IPC */
35 /*#define ACL_MASTER_XPORT_NAME_PASS "pass" local IPC */
36 
37  /*
38  * Format of a status message sent by a child process to the process
39  * manager. Since this is between processes on the same machine we need not
40  * worry about byte order and word length.
41  */
42 typedef struct ACL_MASTER_STATUS {
43  int pid; /* process ID */
44  unsigned gen; /* child generation number */
45  int status; /* availability */
46 } ACL_MASTER_STATUS;
47 
48 #define ACL_MASTER_GEN_NAME "GENERATION" /* passed via environment */
49 
50 #define ACL_MASTER_STAT_TAKEN 0 /* this one is occupied */
51 #define ACL_MASTER_STAT_AVAIL 1 /* this process is idle */
52 #define ACL_MASTER_STAT_SIGHUP_OK 2
53 #define ACL_MASTER_STAT_SIGHUP_ERR 3
54 #define ACL_MASTER_STAT_START_OK 4
55 #define ACL_MASTER_STAT_START_ERR 5
56 
57 int acl_master_notify(int, unsigned, int); /* encapsulate status msg */
58 
59  /*
60  * File descriptors inherited from the master process. The flow control pipe
61  * is read by receive processes and is written to by send processes. If
62  * receive processes get too far ahead they will pause for a brief moment.
63  */
64 #define ACL_MASTER_FLOW_READ 3
65 #define ACL_MASTER_FLOW_WRITE 4
66 
67  /*
68  * File descriptors inherited from the master process. All processes that
69  * provide a given service share the same status file descriptor, and listen
70  * on the same service socket(s). The kernel decides what process gets the
71  * next connection. Usually the number of listening processes is small, so
72  * one connection will not cause a "thundering herd" effect. When no process
73  * listens on a given socket, the master process will. ACL_MASTER_LISTEN_FD is
74  * actually the lowest-numbered descriptor of a sequence of descriptors to
75  * listen on.
76  */
77 #define ACL_MASTER_STATUS_FD 5 /* shared channel to parent */
78 #define ACL_MASTER_LISTEN_FD 6 /* accept connections here */
79 
80 #endif /* ACL_UNIX */
81 
82 #ifdef __cplusplus
83 }
84 #endif
85 
86 #endif /* ACL_CLIENT_ONLY */
87 #endif