OSDN Git Service

FIRST REPOSITORY
[eos/hostdependOTHERS.git] / I386LINUX / util / I386LINUX / include / postgresql / internal / port.h
1 /*-------------------------------------------------------------------------
2  *
3  * port.h
4  *        Header for /port compatibility functions.
5  *
6  * Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
7  * Portions Copyright (c) 1994, Regents of the University of California
8  *
9  * $Id: port.h,v 1.14 2003/09/13 14:49:51 momjian Exp $
10  *
11  *-------------------------------------------------------------------------
12  */
13
14 #if !defined(_MSC_VER) && !defined(__BORLANDC__)
15 /* for thread.c */
16 #include <pwd.h>
17 #include <netdb.h>
18 #endif
19
20 /* Portable path handling for Unix/Win32 */
21 extern bool is_absolute_path(const char *filename);
22 extern char *first_path_separator(const char *filename);
23 extern char *last_path_separator(const char *filename);
24 extern char *get_progname(char *argv0);
25
26 extern char *simple_prompt(const char *prompt, int maxlen, bool echo);
27
28 #if defined(bsdi) || defined(netbsd)
29 extern int      fseeko(FILE *stream, off_t offset, int whence);
30 extern off_t ftello(FILE *stream);
31 #endif
32
33 #ifdef WIN32
34 /*
35  * Win32 doesn't have reliable rename/unlink during concurrent access
36  */
37 #ifndef FRONTEND
38 extern int      pgrename(const char *from, const char *to);
39 extern int      pgunlink(const char *path);
40
41 #define rename(from, to)        pgrename(from, to)
42 #define unlink(path)            pgunlink(path)
43 #endif
44
45 extern int      copydir(char *fromdir, char *todir);
46
47 /* Last parameter not used */
48 extern int      gettimeofday(struct timeval * tp, struct timezone * tzp);
49
50 #else
51
52 /*
53  *      Win32 requires a special close for sockets and pipes, while on Unix
54  *      close() does them all.
55  */
56 #define closesocket close
57 #endif
58
59 /*
60  * Default "extern" declarations or macro substitutes for library routines.
61  * When necessary, these routines are provided by files in src/port/.
62  */
63 #ifndef HAVE_CRYPT
64 extern char *crypt(const char *key, const char *setting);
65 #endif
66
67 #ifndef HAVE_FSEEKO
68 #define fseeko(a, b, c) fseek((a), (b), (c))
69 #define ftello(a) ftell((a))
70 #endif
71
72 #ifndef HAVE_GETOPT
73 extern int      getopt(int nargc, char *const * nargv, const char *ostr);
74 #endif
75
76 #ifndef HAVE_ISINF
77 extern int      isinf(double x);
78 #endif
79
80 #if !defined(HAVE_GETHOSTNAME) && defined(KRB4)
81 extern int      gethostname(char *name, int namelen);
82 #endif
83
84 #ifndef HAVE_RINT
85 extern double rint(double x);
86 #endif
87
88 #ifndef HAVE_INET_ATON
89 #if !defined(_MSC_VER) && !defined(__BORLANDC__)
90 #include <netinet/in.h>
91 #include <arpa/inet.h>
92 #endif
93 extern int      inet_aton(const char *cp, struct in_addr * addr);
94 #endif
95
96 #ifndef HAVE_STRCASECMP
97 extern int      strcasecmp(char *s1, char *s2);
98 #endif
99
100 #ifndef HAVE_STRDUP
101 extern char *strdup(char const *);
102 #endif
103
104 #ifndef HAVE_RANDOM
105 extern long random(void);
106 #endif
107
108 #ifndef HAVE_SRANDOM
109 extern void srandom(unsigned int seed);
110 #endif
111
112 /* thread.h */
113 extern char *pqStrerror(int errnum, char *strerrbuf, size_t buflen);
114
115 #ifndef WIN32
116 extern int pqGetpwuid(uid_t uid, struct passwd * resultbuf, char *buffer,
117                    size_t buflen, struct passwd **result);
118 #endif
119
120 extern int pqGethostbyname(const char *name,
121                                 struct hostent *resultbuf,
122                                 char *buffer, size_t buflen,
123                                 struct hostent **result,
124                                 int *herrno);