PostgreSQL Source Code  git master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
port.h
Go to the documentation of this file.
1 /*-------------------------------------------------------------------------
2  *
3  * port.h
4  * Header for src/port/ compatibility functions.
5  *
6  * Portions Copyright (c) 1996-2017, PostgreSQL Global Development Group
7  * Portions Copyright (c) 1994, Regents of the University of California
8  *
9  * src/include/port.h
10  *
11  *-------------------------------------------------------------------------
12  */
13 #ifndef PG_PORT_H
14 #define PG_PORT_H
15 
16 #include <ctype.h>
17 #include <netdb.h>
18 #include <pwd.h>
19 
20 /* socket has a different definition on WIN32 */
21 #ifndef WIN32
22 typedef int pgsocket;
23 
24 #define PGINVALID_SOCKET (-1)
25 #else
26 typedef SOCKET pgsocket;
27 
28 #define PGINVALID_SOCKET INVALID_SOCKET
29 #endif
30 
31 /* non-blocking */
32 extern bool pg_set_noblock(pgsocket sock);
33 extern bool pg_set_block(pgsocket sock);
34 
35 /* Portable path handling for Unix/Win32 (in path.c) */
36 
37 extern bool has_drive_prefix(const char *filename);
38 extern char *first_dir_separator(const char *filename);
39 extern char *last_dir_separator(const char *filename);
40 extern char *first_path_var_separator(const char *pathlist);
41 extern void join_path_components(char *ret_path,
42  const char *head, const char *tail);
43 extern void canonicalize_path(char *path);
44 extern void make_native_path(char *path);
45 extern void cleanup_path(char *path);
46 extern bool path_contains_parent_reference(const char *path);
47 extern bool path_is_relative_and_below_cwd(const char *path);
48 extern bool path_is_prefix_of_path(const char *path1, const char *path2);
49 extern char *make_absolute_path(const char *path);
50 extern const char *get_progname(const char *argv0);
51 extern void get_share_path(const char *my_exec_path, char *ret_path);
52 extern void get_etc_path(const char *my_exec_path, char *ret_path);
53 extern void get_include_path(const char *my_exec_path, char *ret_path);
54 extern void get_pkginclude_path(const char *my_exec_path, char *ret_path);
55 extern void get_includeserver_path(const char *my_exec_path, char *ret_path);
56 extern void get_lib_path(const char *my_exec_path, char *ret_path);
57 extern void get_pkglib_path(const char *my_exec_path, char *ret_path);
58 extern void get_locale_path(const char *my_exec_path, char *ret_path);
59 extern void get_doc_path(const char *my_exec_path, char *ret_path);
60 extern void get_html_path(const char *my_exec_path, char *ret_path);
61 extern void get_man_path(const char *my_exec_path, char *ret_path);
62 extern bool get_home_path(char *ret_path);
63 extern void get_parent_directory(char *path);
64 
65 /* common/pgfnames.c */
66 extern char **pgfnames(const char *path);
67 extern void pgfnames_cleanup(char **filenames);
68 
69 /*
70  * is_absolute_path
71  *
72  * By making this a macro we avoid needing to include path.c in libpq.
73  */
74 #ifndef WIN32
75 #define IS_DIR_SEP(ch) ((ch) == '/')
76 
77 #define is_absolute_path(filename) \
78 ( \
79  IS_DIR_SEP((filename)[0]) \
80 )
81 #else
82 #define IS_DIR_SEP(ch) ((ch) == '/' || (ch) == '\\')
83 
84 /* See path_is_relative_and_below_cwd() for how we handle 'E:abc'. */
85 #define is_absolute_path(filename) \
86 ( \
87  IS_DIR_SEP((filename)[0]) || \
88  (isalpha((unsigned char) ((filename)[0])) && (filename)[1] == ':' && \
89  IS_DIR_SEP((filename)[2])) \
90 )
91 #endif
92 
93 /* Portable locale initialization (in exec.c) */
94 extern void set_pglocale_pgservice(const char *argv0, const char *app);
95 
96 /* Portable way to find binaries (in exec.c) */
97 extern int find_my_exec(const char *argv0, char *retpath);
98 extern int find_other_exec(const char *argv0, const char *target,
99  const char *versionstr, char *retpath);
100 
101 /* Doesn't belong here, but this is used with find_other_exec(), so... */
102 #define PG_BACKEND_VERSIONSTR "postgres (PostgreSQL) " PG_VERSION "\n"
103 
104 /* Windows security token manipulation (in exec.c) */
105 #ifdef WIN32
106 extern BOOL AddUserToTokenDacl(HANDLE hToken);
107 #endif
108 
109 
110 #if defined(WIN32) || defined(__CYGWIN__)
111 #define EXE ".exe"
112 #else
113 #define EXE ""
114 #endif
115 
116 #if defined(WIN32) && !defined(__CYGWIN__)
117 #define DEVNULL "nul"
118 #else
119 #define DEVNULL "/dev/null"
120 #endif
121 
122 /* Portable delay handling */
123 extern void pg_usleep(long microsec);
124 
125 /* Portable SQL-like case-independent comparisons and conversions */
126 extern int pg_strcasecmp(const char *s1, const char *s2);
127 extern int pg_strncasecmp(const char *s1, const char *s2, size_t n);
128 extern unsigned char pg_toupper(unsigned char ch);
129 extern unsigned char pg_tolower(unsigned char ch);
130 extern unsigned char pg_ascii_toupper(unsigned char ch);
131 extern unsigned char pg_ascii_tolower(unsigned char ch);
132 
133 #ifdef USE_REPL_SNPRINTF
134 
135 /*
136  * Versions of libintl >= 0.13 try to replace printf() and friends with
137  * macros to their own versions that understand the %$ format. We do the
138  * same, so disable their macros, if they exist.
139  */
140 #ifdef vsnprintf
141 #undef vsnprintf
142 #endif
143 #ifdef snprintf
144 #undef snprintf
145 #endif
146 #ifdef sprintf
147 #undef sprintf
148 #endif
149 #ifdef vfprintf
150 #undef vfprintf
151 #endif
152 #ifdef fprintf
153 #undef fprintf
154 #endif
155 #ifdef printf
156 #undef printf
157 #endif
158 
159 extern int pg_vsnprintf(char *str, size_t count, const char *fmt, va_list args);
160 extern int pg_snprintf(char *str, size_t count, const char *fmt,...) pg_attribute_printf(3, 4);
161 extern int pg_sprintf(char *str, const char *fmt,...) pg_attribute_printf(2, 3);
162 extern int pg_vfprintf(FILE *stream, const char *fmt, va_list args);
163 extern int pg_fprintf(FILE *stream, const char *fmt,...) pg_attribute_printf(2, 3);
164 extern int pg_printf(const char *fmt,...) pg_attribute_printf(1, 2);
165 
166 /*
167  * The GCC-specific code below prevents the pg_attribute_printf above from
168  * being replaced, and this is required because gcc doesn't know anything
169  * about pg_printf.
170  */
171 #ifdef __GNUC__
172 #define vsnprintf(...) pg_vsnprintf(__VA_ARGS__)
173 #define snprintf(...) pg_snprintf(__VA_ARGS__)
174 #define sprintf(...) pg_sprintf(__VA_ARGS__)
175 #define vfprintf(...) pg_vfprintf(__VA_ARGS__)
176 #define fprintf(...) pg_fprintf(__VA_ARGS__)
177 #define printf(...) pg_printf(__VA_ARGS__)
178 #else
179 #define vsnprintf pg_vsnprintf
180 #define snprintf pg_snprintf
181 #define sprintf pg_sprintf
182 #define vfprintf pg_vfprintf
183 #define fprintf pg_fprintf
184 #define printf pg_printf
185 #endif
186 #endif /* USE_REPL_SNPRINTF */
187 
188 #if defined(WIN32)
189 /*
190  * Versions of libintl >= 0.18? try to replace setlocale() with a macro
191  * to their own versions. Remove the macro, if it exists, because it
192  * ends up calling the wrong version when the backend and libintl use
193  * different versions of msvcrt.
194  */
195 #if defined(setlocale)
196 #undef setlocale
197 #endif
198 
199 /*
200  * Define our own wrapper macro around setlocale() to work around bugs in
201  * Windows' native setlocale() function.
202  */
203 extern char *pgwin32_setlocale(int category, const char *locale);
204 
205 #define setlocale(a,b) pgwin32_setlocale(a,b)
206 #endif /* WIN32 */
207 
208 /* Portable prompt handling */
209 extern void simple_prompt(const char *prompt, char *destination, size_t destlen,
210  bool echo);
211 
212 #ifdef WIN32
213 #define PG_SIGNAL_COUNT 32
214 #define kill(pid,sig) pgkill(pid,sig)
215 extern int pgkill(int pid, int sig);
216 #endif
217 
218 extern int pclose_check(FILE *stream);
219 
220 /* Global variable holding time zone information. */
221 #if defined(WIN32) || defined(__CYGWIN__)
222 #define TIMEZONE_GLOBAL _timezone
223 #define TZNAME_GLOBAL _tzname
224 #else
225 #define TIMEZONE_GLOBAL timezone
226 #define TZNAME_GLOBAL tzname
227 #endif
228 
229 #if defined(WIN32) || defined(__CYGWIN__)
230 /*
231  * Win32 doesn't have reliable rename/unlink during concurrent access.
232  */
233 extern int pgrename(const char *from, const char *to);
234 extern int pgunlink(const char *path);
235 
236 /* Include this first so later includes don't see these defines */
237 #ifdef _MSC_VER
238 #include <io.h>
239 #endif
240 
241 #define rename(from, to) pgrename(from, to)
242 #define unlink(path) pgunlink(path)
243 #endif /* defined(WIN32) || defined(__CYGWIN__) */
244 
245 /*
246  * Win32 also doesn't have symlinks, but we can emulate them with
247  * junction points on newer Win32 versions.
248  *
249  * Cygwin has its own symlinks which work on Win95/98/ME where
250  * junction points don't, so use those instead. We have no way of
251  * knowing what type of system Cygwin binaries will be run on.
252  * Note: Some CYGWIN includes might #define WIN32.
253  */
254 #if defined(WIN32) && !defined(__CYGWIN__)
255 extern int pgsymlink(const char *oldpath, const char *newpath);
256 extern int pgreadlink(const char *path, char *buf, size_t size);
257 extern bool pgwin32_is_junction(const char *path);
258 
259 #define symlink(oldpath, newpath) pgsymlink(oldpath, newpath)
260 #define readlink(path, buf, size) pgreadlink(path, buf, size)
261 #endif
262 
263 extern bool rmtree(const char *path, bool rmtopdir);
264 
265 /*
266  * stat() is not guaranteed to set the st_size field on win32, so we
267  * redefine it to our own implementation that is.
268  *
269  * We must pull in sys/stat.h here so the system header definition
270  * goes in first, and we redefine that, and not the other way around.
271  *
272  * Some frontends don't need the size from stat, so if UNSAFE_STAT_OK
273  * is defined we don't bother with this.
274  */
275 #if defined(WIN32) && !defined(__CYGWIN__) && !defined(UNSAFE_STAT_OK)
276 #include <sys/stat.h>
277 extern int pgwin32_safestat(const char *path, struct stat *buf);
278 
279 #define stat(a,b) pgwin32_safestat(a,b)
280 #endif
281 
282 #if defined(WIN32) && !defined(__CYGWIN__)
283 
284 /*
285  * open() and fopen() replacements to allow deletion of open files and
286  * passing of other special options.
287  */
288 #define O_DIRECT 0x80000000
289 extern int pgwin32_open(const char *, int,...);
290 extern FILE *pgwin32_fopen(const char *, const char *);
291 
292 #ifndef FRONTEND
293 #define open(a,b,c) pgwin32_open(a,b,c)
294 #define fopen(a,b) pgwin32_fopen(a,b)
295 #endif
296 
297 /*
298  * Mingw-w64 headers #define popen and pclose to _popen and _pclose. We want
299  * to use our popen wrapper, rather than plain _popen, so override that. For
300  * consistency, use our version of pclose, too.
301  */
302 #ifdef popen
303 #undef popen
304 #endif
305 #ifdef pclose
306 #undef pclose
307 #endif
308 
309 /*
310  * system() and popen() replacements to enclose the command in an extra
311  * pair of quotes.
312  */
313 extern int pgwin32_system(const char *command);
314 extern FILE *pgwin32_popen(const char *command, const char *type);
315 
316 #define system(a) pgwin32_system(a)
317 #define popen(a,b) pgwin32_popen(a,b)
318 #define pclose(a) _pclose(a)
319 
320 /* New versions of MingW have gettimeofday, old mingw and msvc don't */
321 #ifndef HAVE_GETTIMEOFDAY
322 /* Last parameter not used */
323 extern int gettimeofday(struct timeval *tp, struct timezone *tzp);
324 #endif
325 #else /* !WIN32 */
326 
327 /*
328  * Win32 requires a special close for sockets and pipes, while on Unix
329  * close() does them all.
330  */
331 #define closesocket close
332 #endif /* WIN32 */
333 
334 /*
335  * On Windows, setvbuf() does not support _IOLBF mode, and interprets that
336  * as _IOFBF. To add insult to injury, setvbuf(file, NULL, _IOFBF, 0)
337  * crashes outright if "parameter validation" is enabled. Therefore, in
338  * places where we'd like to select line-buffered mode, we fall back to
339  * unbuffered mode instead on Windows. Always use PG_IOLBF not _IOLBF
340  * directly in order to implement this behavior.
341  */
342 #ifndef WIN32
343 #define PG_IOLBF _IOLBF
344 #else
345 #define PG_IOLBF _IONBF
346 #endif
347 
348 /*
349  * Default "extern" declarations or macro substitutes for library routines.
350  * When necessary, these routines are provided by files in src/port/.
351  */
352 #ifndef HAVE_CRYPT
353 extern char *crypt(const char *key, const char *setting);
354 #endif
355 
356 /* WIN32 handled in port/win32.h */
357 #ifndef WIN32
358 #define pgoff_t off_t
359 #ifdef __NetBSD__
360 extern int fseeko(FILE *stream, off_t offset, int whence);
361 extern off_t ftello(FILE *stream);
362 #endif
363 #endif
364 
365 extern double pg_erand48(unsigned short xseed[3]);
366 extern long pg_lrand48(void);
367 extern long pg_jrand48(unsigned short xseed[3]);
368 extern void pg_srand48(long seed);
369 
370 #ifndef HAVE_FLS
371 extern int fls(int mask);
372 #endif
373 
374 #ifndef HAVE_FSEEKO
375 #define fseeko(a, b, c) fseek(a, b, c)
376 #define ftello(a) ftell(a)
377 #endif
378 
379 #if !defined(HAVE_GETPEEREID) && !defined(WIN32)
380 extern int getpeereid(int sock, uid_t *uid, gid_t *gid);
381 #endif
382 
383 #ifndef HAVE_ISINF
384 extern int isinf(double x);
385 #endif
386 
387 #ifndef HAVE_MKDTEMP
388 extern char *mkdtemp(char *path);
389 #endif
390 
391 #ifndef HAVE_RINT
392 extern double rint(double x);
393 #endif
394 
395 #ifndef HAVE_INET_ATON
396 #include <netinet/in.h>
397 #include <arpa/inet.h>
398 extern int inet_aton(const char *cp, struct in_addr *addr);
399 #endif
400 
401 #if !HAVE_DECL_STRLCAT
402 extern size_t strlcat(char *dst, const char *src, size_t siz);
403 #endif
404 
405 #if !HAVE_DECL_STRLCPY
406 extern size_t strlcpy(char *dst, const char *src, size_t siz);
407 #endif
408 
409 #if !HAVE_DECL_STRNLEN
410 extern size_t strnlen(const char *str, size_t maxlen);
411 #endif
412 
413 #if !defined(HAVE_RANDOM)
414 extern long random(void);
415 #endif
416 
417 #ifndef HAVE_UNSETENV
418 extern void unsetenv(const char *name);
419 #endif
420 
421 #ifndef HAVE_SRANDOM
422 extern void srandom(unsigned int seed);
423 #endif
424 
425 #ifndef HAVE_SSL_GET_CURRENT_COMPRESSION
426 #define SSL_get_current_compression(x) 0
427 #endif
428 
429 /* thread.h */
430 extern char *pqStrerror(int errnum, char *strerrbuf, size_t buflen);
431 
432 #ifndef WIN32
433 extern int pqGetpwuid(uid_t uid, struct passwd *resultbuf, char *buffer,
434  size_t buflen, struct passwd **result);
435 #endif
436 
437 extern int pqGethostbyname(const char *name,
438  struct hostent *resultbuf,
439  char *buffer, size_t buflen,
440  struct hostent **result,
441  int *herrno);
442 
443 extern void pg_qsort(void *base, size_t nel, size_t elsize,
444  int (*cmp) (const void *, const void *));
445 extern int pg_qsort_strcmp(const void *a, const void *b);
446 
447 #define qsort(a,b,c,d) pg_qsort(a,b,c,d)
448 
449 typedef int (*qsort_arg_comparator) (const void *a, const void *b, void *arg);
450 
451 extern void qsort_arg(void *base, size_t nel, size_t elsize,
452  qsort_arg_comparator cmp, void *arg);
453 
454 /* port/chklocale.c */
455 extern int pg_get_encoding_from_locale(const char *ctype, bool write_message);
456 
457 #if defined(WIN32) && !defined(FRONTEND)
458 extern int pg_codepage_to_encoding(UINT cp);
459 #endif
460 
461 /* port/inet_net_ntop.c */
462 extern char *inet_net_ntop(int af, const void *src, int bits,
463  char *dst, size_t size);
464 
465 /* port/pg_strong_random.c */
466 #ifdef HAVE_STRONG_RANDOM
467 extern bool pg_strong_random(void *buf, size_t len);
468 #endif
469 
470 /* port/pgcheckdir.c */
471 extern int pg_check_dir(const char *dir);
472 
473 /* port/pgmkdirp.c */
474 extern int pg_mkdir_p(char *path, int omode);
475 
476 /* port/pqsignal.c */
477 typedef void (*pqsigfunc) (int signo);
478 extern pqsigfunc pqsignal(int signo, pqsigfunc func);
479 #ifndef WIN32
480 extern pqsigfunc pqsignal_no_restart(int signo, pqsigfunc func);
481 #else
482 #define pqsignal_no_restart(signo, func) pqsignal(signo, func)
483 #endif
484 
485 /* port/quotes.c */
486 extern char *escape_single_quotes_ascii(const char *src);
487 
488 /* port/wait_error.c */
489 extern char *wait_result_to_str(int exit_status);
490 
491 #endif /* PG_PORT_H */
char * make_absolute_path(const char *path)
Definition: path.c:608
static char * argv0
Definition: pg_ctl.c:101
int gettimeofday(struct timeval *tp, struct timezone *tzp)
Definition: gettimeofday.c:105
void pg_usleep(long microsec)
Definition: signal.c:53
void get_includeserver_path(const char *my_exec_path, char *ret_path)
Definition: path.c:740
char * wait_result_to_str(int exit_status)
Definition: wait_error.c:32
#define fseeko(a, b, c)
Definition: port.h:375
int pg_mkdir_p(char *path, int omode)
Definition: pgmkdirp.c:57
int gid_t
Definition: win32.h:251
int uid_t
Definition: win32.h:250
pqsigfunc pqsignal_no_restart(int signo, pqsigfunc func)
Definition: pqsignal.c:71
const char * get_progname(const char *argv0)
Definition: path.c:453
int getpeereid(int sock, uid_t *uid, gid_t *gid)
Definition: getpeereid.c:35
bool pg_set_block(pgsocket sock)
Definition: noblock.c:49
long random(void)
Definition: random.c:22
bool path_is_prefix_of_path(const char *path1, const char *path2)
Definition: path.c:438
int pg_snprintf(char *str, size_t count, const char *fmt,...)
Definition: snprintf.c:167
int pqGethostbyname(const char *name, struct hostent *resultbuf, char *buffer, size_t buflen, struct hostent **result, int *herrno)
Definition: thread.c:117
int pg_vfprintf(FILE *stream, const char *fmt, va_list args)
Definition: snprintf.c:208
unsigned char pg_ascii_tolower(unsigned char ch)
Definition: pgstrcasecmp.c:146
long pg_lrand48(void)
Definition: erand48.c:88
void make_native_path(char *path)
Definition: path.c:166
void pg_srand48(long seed)
Definition: erand48.c:102
char * pqStrerror(int errnum, char *strerrbuf, size_t buflen)
Definition: thread.c:61
bool pg_strong_random(void *buf, size_t len)
void canonicalize_path(char *path)
Definition: path.c:254
unsigned char pg_tolower(unsigned char ch)
Definition: pgstrcasecmp.c:122
unsigned char pg_ascii_toupper(unsigned char ch)
Definition: pgstrcasecmp.c:135
int pg_strcasecmp(const char *s1, const char *s2)
Definition: pgstrcasecmp.c:36
bool path_contains_parent_reference(const char *path)
Definition: path.c:376
void get_pkglib_path(const char *my_exec_path, char *ret_path)
Definition: path.c:758
#define pg_attribute_printf(f, a)
Definition: c.h:627
int fls(int mask)
Definition: fls.c:55
int pg_strncasecmp(const char *s1, const char *s2, size_t n)
Definition: pgstrcasecmp.c:69
bool has_drive_prefix(const char *filename)
Definition: path.c:87
char * escape_single_quotes_ascii(const char *src)
Definition: quotes.c:33
bool rmtree(const char *path, bool rmtopdir)
Definition: rmtree.c:36
pqsigfunc pqsignal(int signo, pqsigfunc func)
Definition: signal.c:168
void get_lib_path(const char *my_exec_path, char *ret_path)
Definition: path.c:749
char * s1
void get_pkginclude_path(const char *my_exec_path, char *ret_path)
Definition: path.c:731
void unsetenv(const char *name)
Definition: unsetenv.c:20
void get_doc_path(const char *my_exec_path, char *ret_path)
Definition: path.c:776
int isinf(double x)
void cleanup_path(char *path)
Definition: path.c:185
static char * buf
Definition: pg_test_fsync.c:67
void simple_prompt(const char *prompt, char *destination, size_t destlen, bool echo)
Definition: sprompt.c:37
int pg_printf(const char *fmt,...)
Definition: snprintf.c:242
void(* pqsigfunc)(int signo)
Definition: port.h:477
bool path_is_relative_and_below_cwd(const char *path)
Definition: path.c:405
void get_parent_directory(char *path)
Definition: path.c:854
int pclose_check(FILE *stream)
Definition: exec.c:510
int pgsocket
Definition: port.h:22
double rint(double x)
Definition: rint.c:22
int pg_sprintf(char *str, const char *fmt,...)
Definition: snprintf.c:196
char * inet_net_ntop(int af, const void *src, int bits, char *dst, size_t size)
Definition: inet_net_ntop.c:77
int inet_aton(const char *cp, struct in_addr *addr)
Definition: inet_aton.c:56
char * pgwin32_setlocale(int category, const char *locale)
void qsort_arg(void *base, size_t nel, size_t elsize, qsort_arg_comparator cmp, void *arg)
Definition: qsort_arg.c:113
char my_exec_path[MAXPGPATH]
Definition: globals.c:64
char * crypt(const char *key, const char *setting)
char * s2
int find_my_exec(const char *argv0, char *retpath)
Definition: exec.c:119
char * first_dir_separator(const char *filename)
Definition: path.c:103
int pg_vsnprintf(char *str, size_t count, const char *fmt, va_list args)
Definition: snprintf.c:150
static int sig
Definition: pg_ctl.c:88
double pg_erand48(unsigned short xseed[3])
Definition: erand48.c:79
char * last_dir_separator(const char *filename)
Definition: path.c:138
void get_etc_path(const char *my_exec_path, char *ret_path)
Definition: path.c:713
int pg_get_encoding_from_locale(const char *ctype, bool write_message)
Definition: chklocale.c:433
size_t strlcpy(char *dst, const char *src, size_t siz)
Definition: strlcpy.c:45
void set_pglocale_pgservice(const char *argv0, const char *app)
Definition: exec.c:550
bool pg_set_noblock(pgsocket sock)
Definition: noblock.c:25
void get_html_path(const char *my_exec_path, char *ret_path)
Definition: path.c:785
WalTimeSample buffer[LAG_TRACKER_BUFFER_SIZE]
Definition: walsender.c:214
void pg_qsort(void *base, size_t nel, size_t elsize, int(*cmp)(const void *, const void *))
Definition: qsort.c:113
char * mkdtemp(char *path)
Definition: mkdtemp.c:286
size_t strnlen(const char *str, size_t maxlen)
Definition: strnlen.c:26
int pg_qsort_strcmp(const void *a, const void *b)
Definition: qsort.c:232
char ** pgfnames(const char *path)
Definition: pgfnames.c:31
void join_path_components(char *ret_path, const char *head, const char *tail)
Definition: path.c:218
long pg_jrand48(unsigned short xseed[3])
Definition: erand48.c:95
const char * name
Definition: encode.c:521
void get_man_path(const char *my_exec_path, char *ret_path)
Definition: path.c:794
void get_include_path(const char *my_exec_path, char *ret_path)
Definition: path.c:722
static char * filename
Definition: pg_dumpall.c:90
int pqGetpwuid(uid_t uid, struct passwd *resultbuf, char *buffer, size_t buflen, struct passwd **result)
Definition: thread.c:95
#define ftello(a)
Definition: port.h:376
int pg_check_dir(const char *dir)
Definition: pgcheckdir.c:31
static char * locale
Definition: initdb.c:124
int(* qsort_arg_comparator)(const void *a, const void *b, void *arg)
Definition: port.h:449
void * arg
void srandom(unsigned int seed)
Definition: srandom.c:22
void get_locale_path(const char *my_exec_path, char *ret_path)
Definition: path.c:767
void get_share_path(const char *my_exec_path, char *ret_path)
Definition: path.c:704
typedef BOOL(WINAPI *MINIDUMPWRITEDUMP)(HANDLE hProcess
int find_other_exec(const char *argv0, const char *target, const char *versionstr, char *retpath)
Definition: exec.c:307
unsigned char pg_toupper(unsigned char ch)
Definition: pgstrcasecmp.c:105
int pg_fprintf(FILE *stream, const char *fmt,...)
Definition: snprintf.c:230
void pgfnames_cleanup(char **filenames)
Definition: pgfnames.c:99
char * first_path_var_separator(const char *pathlist)
Definition: path.c:120
size_t strlcat(char *dst, const char *src, size_t siz)
Definition: strlcat.c:33
bool get_home_path(char *ret_path)
Definition: path.c:807
static int cmp(const chr *x, const chr *y, size_t len)
Definition: regc_locale.c:742