* Initialize the basic environment for a standalone process. * * argv0 has to be suitable to find the program's executable. */
| 172 | * argv0 has to be suitable to find the program's executable. |
| 173 | */ |
| 174 | void |
| 175 | InitStandaloneProcess(const char *argv0) |
| 176 | { |
| 177 | Assert(!IsPostmasterEnvironment); |
| 178 | |
| 179 | InitProcessGlobals(); |
| 180 | |
| 181 | /* Initialize process-local latch support */ |
| 182 | InitializeLatchSupport(); |
| 183 | MyLatch = &LocalLatchData; |
| 184 | InitLatch(MyLatch); |
| 185 | InitializeLatchWaitSet(); |
| 186 | |
| 187 | /* |
| 188 | * For consistency with InitPostmasterChild, initialize signal mask here. |
| 189 | * But we don't unblock SIGQUIT or provide a default handler for it. |
| 190 | */ |
| 191 | pqinitmask(); |
| 192 | PG_SETMASK(&BlockSig); |
| 193 | |
| 194 | /* Compute paths, no postmaster to inherit from */ |
| 195 | if (my_exec_path[0] == '\0') |
| 196 | { |
| 197 | if (find_my_exec(argv0, my_exec_path) < 0) |
| 198 | elog(FATAL, "%s: could not locate my own executable path", |
| 199 | argv0); |
| 200 | } |
| 201 | |
| 202 | if (pkglib_path[0] == '\0') |
| 203 | get_pkglib_path(my_exec_path, pkglib_path); |
| 204 | } |
| 205 | |
| 206 | void |
| 207 | SwitchToSharedLatch(void) |
no test coverage detected