mysql_init 崩溃_mysql_init调用卡住原因分析

/*

Initialize the MySQL client library

SYNOPSIS

mysql_server_init()

NOTES

Should be called before doing any other calls to the MySQL

client library to initialize thread specific variables etc.

It's called by mysql_init() to ensure that things will work for

old not threaded applications that doesn't call mysql_server_init()

directly.

RETURN

0  ok

1  could not initialize environment (out of memory or thread keys)

*/

int STDCALL mysql_server_init(int argc __attribute__((unused)),

char **argv __attribute__((unused)),

char **groups __attribute__((unused)))

{

int result= 0;

if (!mysql_client_init)

{

mysql_client_init=1;

org_my_init_done=my_init_done;

if (my_init()) /* Will init threads */

return 1;

init_client_errs();

if (mysql_client_plugin_init())

return 1;

if (!mysql_port)

{

char *env;

struct servent *serv_ptr __attribute__((unused));

mysql_port = MYSQL_PORT;

/*

if builder specifically requested a default port, use that

(even if it coincides with our factory default).

only if they didn't do we check /etc/services (and, failing

on that, fall back to the factory default of 3306).

either default can be overridden by the environment variable

MYSQL_TCP_PORT, which in turn can be overridden with command

line options.

*/

#if MYSQL_PORT_DEFAULT == 0

if ((serv_ptr= getservbyname("mysql", "tcp")))

mysql_port= (uint) ntohs((ushort) serv_ptr->s_port);

#endif

if ((env= getenv("MYSQL_TCP_PORT")))

mysql_port=(uint) atoi(env);

}

if (!mysql_unix_port)

{

char *env;

#ifdef __WIN__

mysql_unix_port = (char*) MYSQL_NAMEDPIPE;

#else

mysql_unix_port = (char*) MYSQL_UNIX_ADDR;

#endif

if ((env = getenv("MYSQL_UNIX_PORT")))

mysql_unix_port = env;

}

mysql_debug(NullS);

#if defined(SIGPIPE) && !defined(__WIN__)

(void) signal(SIGPIPE, SIG_IGN);

#endif

#ifdef EMBEDDED_LIBRARY

if (argc > -1)

result= init_embedded_server(argc, argv, groups);

#endif

}

else

result= (int)my_thread_init();         /* Init if new thread */

return result;

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值