1 /* $NetBSD: master_proto.h,v 1.1.1.1 2009/06/23 10:08:49 tron Exp $ */ 2 3 /*++ 4 /* NAME 5 /* master_proto 3h 6 /* SUMMARY 7 /* master process protocol 8 /* SYNOPSIS 9 /* #include <master_proto.h> 10 /* DESCRIPTION 11 /* .nf 12 13 /* 14 * Transport names. The master passes the transport name on the command 15 * line, and thus the name is part of the master to child protocol. 16 */ 17 #define MASTER_XPORT_NAME_UNIX "unix" /* local IPC */ 18 #define MASTER_XPORT_NAME_FIFO "fifo" /* local IPC */ 19 #define MASTER_XPORT_NAME_INET "inet" /* non-local IPC */ 20 #define MASTER_XPORT_NAME_PASS "pass" /* local IPC */ 21 22 /* 23 * Format of a status message sent by a child process to the process 24 * manager. Since this is between processes on the same machine we need not 25 * worry about byte order and word length. 26 */ 27 typedef struct MASTER_STATUS { 28 int pid; /* process ID */ 29 unsigned gen; /* child generation number */ 30 int avail; /* availability */ 31 } MASTER_STATUS; 32 33 #define MASTER_GEN_NAME "GENERATION" /* passed via environment */ 34 35 #define MASTER_STAT_TAKEN 0 /* this one is occupied */ 36 #define MASTER_STAT_AVAIL 1 /* this process is idle */ 37 38 extern int master_notify(int, unsigned, int); /* encapsulate status msg */ 39 40 /* 41 * File descriptors inherited from the master process. The flow control pipe 42 * is read by receive processes and is written to by send processes. If 43 * receive processes get too far ahead they will pause for a brief moment. 44 */ 45 #define MASTER_FLOW_READ 3 46 #define MASTER_FLOW_WRITE 4 47 48 /* 49 * File descriptors inherited from the master process. All processes that 50 * provide a given service share the same status file descriptor, and listen 51 * on the same service socket(s). The kernel decides what process gets the 52 * next connection. Usually the number of listening processes is small, so 53 * one connection will not cause a "thundering herd" effect. When no process 54 * listens on a given socket, the master process will. MASTER_LISTEN_FD is 55 * actually the lowest-numbered descriptor of a sequence of descriptors to 56 * listen on. 57 */ 58 #define MASTER_STATUS_FD 5 /* shared channel to parent */ 59 #define MASTER_LISTEN_FD 6 /* accept connections here */ 60 61 /* LICENSE 62 /* .ad 63 /* .fi 64 /* The Secure Mailer license must be distributed with this software. 65 /* AUTHOR(S) 66 /* Wietse Venema 67 /* IBM T.J. Watson Research 68 /* P.O. Box 704 69 /* Yorktown Heights, NY 10598, USA 70 /*--*/ 71 72