00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #include "../../str.h"
00029 #include "../../sr_module.h"
00030 #include "../../error.h"
00031 #include "../../mem/mem.h"
00032 #include "../../parser/msg_parser.h"
00033 #include "../../ut.h"
00034 #include "../../dprint.h"
00035 #include "../../pt.h"
00036 #include "unixsock_server.h"
00037
00038 MODULE_VERSION
00039
00040 static int mod_init(void);
00041 static int child_init(int rank);
00042
00043
00044
00045
00046 static cmd_export_t cmds[] = {
00047 {0, 0, 0, 0, 0}
00048 };
00049
00050
00051
00052
00053 static param_export_t params[] = {
00054 {"socket", PARAM_STRING, &unixsock_name },
00055 {"children", PARAM_INT, &unixsock_children },
00056 {"send_timeout", PARAM_INT, &unixsock_tx_timeout},
00057 {"socket_user", PARAM_STRING, &unixsock_user },
00058 {"socket_mode", PARAM_STRING, &unixsock_mode },
00059 {"socket_group", PARAM_STRING, &unixsock_group },
00060 {0, 0, 0}
00061 };
00062
00063
00064 struct module_exports exports = {
00065 "unixsock",
00066 cmds,
00067 0,
00068 params,
00069 mod_init,
00070 0,
00071 0,
00072 0,
00073 child_init
00074 };
00075
00076
00077 static int mod_init(void)
00078 {
00079 if (init_unixsock_socket() < 0) return -1;
00080
00081
00082
00083 if (unixsock_name) register_procs(unixsock_children);
00084 return 0;
00085 }
00086
00087
00088 static int child_init(int rank)
00089 {
00090 if (rank == PROC_MAIN) {
00091 if (init_unixsock_children() < 0) return -1;
00092 }
00093 return 0;
00094 }