MCPcopy Create free account
hub / github.com/acl-dev/acl / server_init

Function server_init

lib_fiber/cpp/src/fiber_server.cpp:918–976  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

916}
917
918static void server_init(const char *procname)
919{
920 const char *myname = "server_init";
921 static int inited = 0;
922 const char* ptr;
923
924 if (inited) {
925 return;
926 }
927
928 inited = 1;
929
930 /* Don't die when a process goes away unexpectedly. */
931#ifdef SIGPIPE
932 signal(SIGPIPE, SIG_IGN);
933#endif
934
935 /* Don't die for frivolous reasons. */
936#ifdef SIGXFSZ
937 signal(SIGXFSZ, SIG_IGN);
938#endif
939
940 /* May need this every now and then. */
941#if defined(_WIN32) || defined(_WIN64)
942 acl_var_fiber_pid = _getpid();
943#else
944 acl_var_fiber_pid = getpid();
945#endif
946 acl_var_fiber_procname = acl_mystrdup(acl_safe_basename(procname));
947
948 ptr = acl_getenv("SERVICE_LOG");
949 if ((ptr = acl_getenv("SERVICE_LOG")) != NULL && *ptr != 0) {
950 acl_var_fiber_log_file = acl_mystrdup(ptr);
951 } else {
952 acl_var_fiber_log_file = acl_mystrdup("acl_master.log");
953 acl_msg_info("%s(%d)->%s: can't get SERVICE_LOG's env value,"
954 " use %s log", __FILE__, __LINE__, myname,
955 acl_var_fiber_log_file);
956 }
957
958 acl_get_app_conf_int_table(__conf_int_tab);
959 acl_get_app_conf_str_table(__conf_str_tab);
960 acl_get_app_conf_bool_table(__conf_bool_tab);
961
962#define EQ !strcasecmp
963 if (EQ(acl_var_fiber_master_reuseport, "yes")
964 || EQ(acl_var_fiber_master_reuseport, "true")
965 || EQ(acl_var_fiber_master_reuseport, "on")) {
966
967 var_fiber_master_reuseport = 1;
968 }
969
970 if (__deny_info == NULL) {
971 __deny_info = acl_var_fiber_deny_banner;
972 }
973 if (acl_var_fiber_access_allow && *acl_var_fiber_access_allow) {
974 acl_access_add(acl_var_fiber_access_allow, ", \t", ":");
975 }

Callers 1

acl_fiber_server_mainFunction · 0.70

Calls 7

acl_safe_basenameFunction · 0.85
acl_getenvFunction · 0.85
acl_msg_infoFunction · 0.85
acl_access_addFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…