接前面,继续分析: 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[0], "postgres", PG_BACKEND_VERSIONSTR,backend_exec)) < 0){char        full_path[MAXPGPATH];if (find_my_exec(argv[0], full_path) < 0)strlcpy(full_path, progname, sizeof(full_path));if (ret == -1)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);elsefprintf(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(1);}    

接下来,获得路径:

一个是 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(1);}canonicalize_path(share_path);fprintf(stderr,"share_path is: %s \n",share_path);
本文转自健哥的数据花园博客园博客,原文链接:http://www.cnblogs.com/gaojian/p/3174020.html,如需转载请自行联系原作者

PostgreSQL的initdb 源代码分析之五相关推荐

  1. PostgreSQL的 initdb 源代码分析之九

    继续:下面的是定义信号处理函数. /** now we are starting to do real work, trap signals so we can clean up*//* some o ...

  2. PostgreSQL的 initdb 源代码分析之二十三

    继续分析: vacuum_db(); 展开: cmd是:/home/pgsql/project/bin/postgres" --single -F -O -c search_path=pg_ ...

  3. PostgreSQL的 initdb 源代码分析之二十一

    继续分析: setup_schema(); 展开: 实质就是创建info_schema. cmd 是: "/home/pgsql/project/bin/postgres" --s ...

  4. PostgreSQL的 initdb 源代码分析之十六

    继续分析 setup_description(); 展开后: 就是要把 share/postgres.description 文件的内容读入到 pg_description 和 pg_shdescri ...

  5. PostgreSQL的 initdb 源代码分析之十

    继续分析, 如下这段,因为条件不成立,被跳过: /* Create transaction log symlink, if required */if (strcmp(xlog_dir, " ...

  6. Druid连接池源代码分析之五-starter

    详细分析: 待完善.

  7. Druid连接池源代码分析之五-编程知识点

    主要来自于:com.alibaba.druid.pool.DruidDataSource 类 1: AtomicLongFieldUpdater的用法 AtomicLongFieldUpdater&l ...

  8. Android系统默认Home应用程序(Launcher)的启动过程源代码分析

    在前面一篇文章中,我们分析了Android系统在启动时安装应用程序的过程,这些应用程序安装好之后,还需要有一个Home应用程序来负责把它们在桌面上展示出来,在Android系统中,这个默认的Home应 ...

  9. 《LINUX3.0内核源代码分析》第一章:内存寻址

    https://blog.csdn.net/ekenlinbing/article/details/7613334 摘要:本章主要介绍了LINUX3.0内存寻址方面的内容,重点对follow_page ...

最新文章

  1. pathview包绘制富集的kegg图
  2. python是用c 写的吗_我能用python写一个c语言出来吗?
  3. 阿里云nginx配置ssl证书
  4. 重大通知:社交系统ThinkSNS+ 发布公告!
  5. matlab的支持向量机调参,支持向量机(2)-应用
  6. poj 1905 Expanding Rods(二分)
  7. flask-sqlalchemy mysql_Flask SQLAlchemy连接到MySQL数据库
  8. Git的基本概念/常用命令及实例
  9. 【C语言】数据结构C语言版 实验3 带头结点的单链表
  10. Java_String
  11. linux traceroute命令详解_详解Linux系统路由跟踪指令traceroute语法、工作原理和实例说明...
  12. PLC数据采集之协议转换桥接器
  13. 对抗样本(三)FGSM
  14. 卧槽!字节跳动的面试算法题,实在太变态了
  15. python删除一行代码_python基础教程:python3.7 openpyxl 删除指定一列或者一行的代码...
  16. visual studio 2019 无法启动程序 系统找不到指定文件
  17. linux服务器通过代理连接网络
  18. mysql ansi unicode_ANSI与Unicode编码
  19. 计算机考研中的编号,考研科目前边的编号是什么意思
  20. [从头读历史] 第258节 左传和东周列国志

热门文章

  1. JPA连接Mysql数据库时提示:Table 'jpa.sequence' dosen't exisit
  2. 最容易理解的计算机网络 基础知识概论(下)
  3. 5、Dcoker 容器数据卷用-v命令添加
  4. ios查看ipa是否函数特定字符_iOS 中基础字符判断函数收集(如判断大小写、数字等)...
  5. led显示屏背景墙设计_室内LED 显示屏室内安装设计
  6. 计算机二级web前端,web前端:原生js之Math对象
  7. 策划文档html,html代码整理.doc
  8. java h5在线音频_[语音技术]java+H5的录音类实例(1)
  9. consul 1.2 支持service mesh
  10. 美征信巨头Equifax因Struts漏洞导致数据大规模泄露