24#define _DARWIN_BETTER_REALPATH
38#if defined(HAVE_SYS_PERSONALITY_H)
39#include <sys/personality.h>
40#elif defined(HAVE_SYS_PROCCTL_H)
41#include <sys/procctl.h>
48#if defined(WIN32) && !defined(_MSC_VER)
66#define log_error(errcodefn, ...) \
67 ereport(LOG, (errcodefn, errmsg_internal(__VA_ARGS__)))
69#define log_error(errcodefn, ...) \
70 (fprintf(stderr, __VA_ARGS__), fputc('\n', stderr))
175 _(
"invalid binary \"%s\": %m"),
retpath);
189 if ((path =
getenv(
"PATH")) && *path)
218 _(
"could not read binary \"%s\": %m"),
226 _(
"could not find a \"%s\" to execute"),
argv0);
253 _(
"could not resolve path \"%s\" to absolute form: %m"),
326 "/%s%s", target,
EXE);
364 _(
"could not execute command \"%s\": %m"), cmd);
376 _(
"could not read from command \"%s\": %m"), cmd);
379 _(
"no data was returned by command \"%s\""), cmd);
406 _(
"%s() failed: %m"),
"pclose");
459 setenv(
"PGLOCALEDIR", path, 0);
466 setenv(
"PGSYSCONFDIR", path, 0);
482#if defined(HAVE_SYS_PERSONALITY_H)
484#elif defined(HAVE_SYS_PROCCTL_H) && defined(PROC_ASLR_FORCE_DISABLE)
551 "could not get token information: error code %lu",
559 "could not get token information buffer size: error code %lu",
571 "could not get ACL information: error code %lu",
596 "could not initialize ACL: error code %lu",
GetLastError());
622 "could not add access allowed ACE: error code %lu",
633 "could not set token information: error code %lu",
688 "could not get token information buffer size: error code %lu",
704 "could not get token information: error code %lu",
static void cleanup(void)
#define PG_TEXTDOMAIN(domain)
int find_my_exec(const char *argv0, char *retpath)
#define log_error(errcodefn,...)
int validate_exec(const char *path)
char * pipe_read_line(char *cmd)
int pclose_check(FILE *stream)
void set_pglocale_pgservice(const char *argv0, const char *app)
static char * pg_realpath(const char *fname)
int find_other_exec(const char *argv0, const char *target, const char *versionstr, char *retpath)
static int normalize_exec_path(char *path)
int errcode_for_file_access(void)
int errcode(int sqlerrcode)
char my_exec_path[MAXPGPATH]
void pfree(void *pointer)
char * pg_get_line(FILE *stream, PromptInterruptContext *prompt_ctx)
static char buf[DEFAULT_XLOG_SEG_SIZE]
void get_locale_path(const char *my_exec_path, char *ret_path)
void join_path_components(char *ret_path, const char *head, const char *tail)
char * last_dir_separator(const char *filename)
int pg_strcasecmp(const char *s1, const char *s2)
char * first_path_var_separator(const char *pathlist)
void canonicalize_path(char *path)
void get_etc_path(const char *my_exec_path, char *ret_path)
char * first_dir_separator(const char *filename)
size_t strlcpy(char *dst, const char *src, size_t siz)
char * wait_result_to_str(int exitstatus)
BOOL AddUserToTokenDacl(HANDLE hToken)