PostgreSQL的initdb 源代码分析之五
接前面,继续分析: putenv("TZ=GMT") 设置了时区信息。
find_other_exec(argv[0], "postgres", PG_BACKEND_VERSIONSTR, backend_exec))
就是要找到同目录下、同版本的postgres备用。initdb 执行后期,很多事情要依赖 postgres来处理的。
/*
* Also ensure that TZ is set, so that we don't waste time identifying the
* system timezone each of the many times we start a standalone backend.
* It's okay to use a hard-wired value here because nothing done during
* initdb cares about the timezone setting.
*/
putenv("TZ=GMT"); if ((ret = find_other_exec(argv[], "postgres", PG_BACKEND_VERSIONSTR,
backend_exec)) < )
{
char full_path[MAXPGPATH]; if (find_my_exec(argv[], full_path) < )
strlcpy(full_path, progname, sizeof(full_path)); if (ret == -)
fprintf(stderr,
_("The program \"postgres\" is needed by %s "
"but was not found in the\n"
"same directory as \"%s\".\n"
"Check your installation.\n"),
progname, full_path);
else
fprintf(stderr,
_("The program \"postgres\" was found by \"%s\"\n"
"but was not the same version as %s.\n"
"Check your installation.\n"),
full_path, progname);
exit();
}
接下来,获得路径:
一个是 bin_path: 就是initdb执行的路径。我运行的结果是: /home/pgsql/project/bin
一个是 share_path: 就是一些共享用信息的路径。我运行的结果是: /home/pgsql/project/share
/* store binary directory */
strcpy(bin_path, backend_exec);
*last_dir_separator(bin_path) = '\0';
canonicalize_path(bin_path); fprintf(stderr,"bin_path is: %s \n",bin_path); if (!share_path)
{
share_path = pg_malloc(MAXPGPATH);
get_share_path(backend_exec, share_path);
}
else if (!is_absolute_path(share_path))
{
fprintf(stderr, _("%s: input file location must be an absolute path\n"), progname);
exit();
} canonicalize_path(share_path); fprintf(stderr,"share_path is: %s \n",share_path);
PostgreSQL的initdb 源代码分析之五的更多相关文章
- PostgreSQL的initdb 源代码分析之六
继续分析 下面的是获取运行此程序的用户名称,主要还是为了防止在linux下用root来运行的情形. effective_user = get_id(); ) username = effective_ ...
- PostgreSQL的 initdb 源代码分析之二
继续分析 下面这一段,当 initdb --version 或者 initdb --help 才有意义. ) { ], || strcmp(argv[], ) { usage(progname); ...
- PostgreSQL的 initdb 源代码分析之二十四
继续分析: make_template0(); 展开: 无需再作解释,就是创建template0数据库 /* * copy template1 to template0 */ static void ...
- PostgreSQL的 initdb 源代码分析之十五
继续分析: if (pwprompt || pwfilename) get_set_pwd(); 由于我启动initdb的时候,没有设置口令相关的选项,故此略过. 接下来: setup_depend( ...
- PostgreSQL的 initdb 源代码分析之十三
继续分析: /* Bootstrap template1 */ bootstrap_template1(); 展开: 我这里读入的文件是:/home/pgsql/project/share/postg ...
- PostgreSQL的 initdb 源代码分析之十二
继续分析 /* Now create all the text config files */ setup_config(); 将其展开: 实质就是,确定各种参数,分别写入 postgresql.co ...
- PostgreSQL的 initdb 源代码分析之十一
继续分析: /* Top level PG_VERSION is checked by bootstrapper, so make it first */ write_version_file(NUL ...
- PostgreSQL的 initdb 源代码分析之七
继续分析:由于我使用initdb的时候,没有指定 locale,所以会使用OS的缺省locale,这里是 en_US.UTF-8 printf(_("The files belonging ...
- PostgreSQL的 initdb 源代码分析之四
继续分析: if (pwprompt && pwfilename) { fprintf(stderr, _("%s: password prompt and password ...
随机推荐
- 3732 Ahui Writes Word
// N个物品 放进容量为C的背包里面 要求价值最大// 一看 第一反应是0 1背包 不过 N=100000 C=10000// 注意到 v,c在 10以内// 那么 最多就100种组合了 然后就转化 ...
- <一>面向对象分析之面向对象和面向过程
面向对象 ---->注重的是拆分,组装. ---->封装,继承,多态,复用(只是现象) ---->面向对象变成的目标从来就不是复用.相反,对 ...
- java运用FFMPEG视频转码技术
基于windows系统安装FFMPEG转码技术 http://wenku.baidu.com/link?url=z4Tv3CUXxxzLpa5QPI-FmfFtrIQeiCYNq6Uhe6QCHkU- ...
- [Everyday Mathematics]20150203
设 $f$ 在 $\bbR$ 上连续可导, 且 $\dps{f'\sex{\frac{1}{2}}=0}$. 试证: $$\bex \exists\ \xi\in \sex{0,\frac{1}{2} ...
- 翻译【ElasticSearch Server】第一章:开始使用ElasticSearch集群(4)
停止ElasticSearch(Shutting down ElasticSearch) 尽管我们期望集群(或节点)终生完美运行,我们最终可能需要重启或者正确的停止它(例如,维护).有三种方式来停止E ...
- hdu 3746 Cyclic Nacklace(KMP)
题意: 求最少需要在后面补几个字符能凑成两个循环. 分析: 最小循环节的应用,i-next[i]为最小循环节. #include <map> #include <set> #i ...
- bjfu1109 最小公倍数和
这题真是过了n年才a.最早是在2010年北大培训比赛上看到的这题,当时我不会,竹教主也不会,但他记下来了,研究一段时间后就会了,还把这题加到我校oj上.过了这么多年,我上网搜,关于这个问题的解题报告还 ...
- linux的文件属性介绍、目录及路径表示方法
一.认识linux文件 认识linux下的文件需要先学习命令:ls. 该命令用于显示指定目录下的内容,其中最常用的参数有: -l显示目录和文件的完整属性信息 -a显示所有文件和目录,包含隐藏文件和目录 ...
- 【C# C++】C#中调用msvcr100.dll中的_beginthreadex函数
msvcr100.dll是VS2010的C运行时库DLL, _beginthreadex开启子线程的函数就在这个DLL里面实现 unsigned long _beginthreadex( voi ...
- qt 在指定区域添加图片
博客出处:http://www.devdiv.com/thread-39111-1-1.html 折腾了几天,终于实现了图片的淡出淡入的效果. 其实也应该是说实现了图片的淡入效果,因为淡出效果我暂时还 ...