MySQL:如何编写daemon plugin(14)
usage.ru_msgsnd,
usage.ru_msgrcv,
usage.ru_nsignals,
usage.ru_nvcsw,
usage.ru_nivcsw);
/*写入monitoring_file文件*/
write(monitoring_file, buffer,strlen(buffer));
}
}
}
/*系统启动或加载插件时时调用该函数,用于创建后台线程*/
static int monitoring_plugin_init(void*p)
{
pthread_attr_t attr;
char monitoring_filename[FN_REFLEN];
char buffer[MONITORING_BUFFER];
char time_str[20];
monitor_num = 0;
/*format the filename
*The fn_format() function is designed tobuild a filename and path compatible
with the current operating system given aset of parameters. More details on its
functionality can be found inmysys/mf_format.c.
* */
fn_format(monitoring_filename,"monitor", "", ".log",
MY_REPLACE_EXT |MY_UNPACK_FILENAME);
unlink(monitoring_filename);
monitoring_file = open(monitoring_filename,
O_CREAT | O_RDWR, 0644);
if (monitoring_file < 0)
{
fprintf(stderr, "Plugin'monitoring': "
"Could not create file '%s'\n",
monitoring_filename);
相关新闻>>
- 发表评论
-
- 最新评论 更多>>