继续分析 /* Now create all the text config files */ setup_config(); 将其展开: 实质就是,确定各种参数,分别写入 postgresql.conf .pg_hba.conf.pg_indent.conf 文件. /* * set up all the config files */ static void setup_config(void) { char **conflines; ]; char path[MAXPGPATH]; fpu…
继续分析: /* Top level PG_VERSION is checked by bootstrapper, so make it first */ write_version_file(NULL); 就是建立了一个 PG_VERSION的文件 在我系统里,可以看到: [pgsql@localhost DemoDir]$ cat PG_VERSION 9.1 [pgsql@localhost DemoDir]$ 接下来: 我先看看 set_null_conf 函数 /* Select su…
继续分析:由于我使用initdb的时候,没有指定 locale,所以会使用OS的缺省locale,这里是 en_US.UTF-8 printf(_("The files belonging to this database system will be owned " "by user \"%s\".\n" "This user must also own the server process.\n\n"), effectiv…
接前面,继续分析: 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 iden…
继续分析: /* * Make the per-database PG_VERSION for template1 only after init'ing it */ write_version_file("base/1"); 就是在base/1目录下,生成一个 PG_VERSION 文件. [pgsql@localhost ]$ pwd /home/pgsql/DemoDir/ [pgsql@localhost ]$ cat PG_VERSION 9.1 [pgsql@localh…
继续:下面的是定义信号处理函数. /* * now we are starting to do real work, trap signals so we can clean up */ /* some of these are not valid on Windows */ #ifdef SIGHUP pqsignal(SIGHUP, trapsig); #endif #ifdef SIGINT pqsignal(SIGINT, trapsig); #endif #ifdef SIGQUIT…
开始第一段: int main(int argc, char *argv[]) { /* * options with no short version return a low integer, the rest return * their short version value */ static struct option long_options[] = { {"pgdata", required_argument, NULL, 'D'}, {"encoding&q…
android-plugmgr是一个Android插件加载框架,它最大的特点就是对插件不需要进行任何约束.关于这个类库的介绍见作者博客,市面上也有一些插件加载框架,但是感觉没有这个好.在这篇文章中,我们将不仅止于原理,对源代码的具体实现进行分析.文章中涉及的代码可从https://github.com/kissazi2/AndroidDemo/tree/master/PlugLoadDemo下载,基于Android Studio 1.2编译. 在正式开始分析源代码之前,我们首先需要有一些动态加载…