]> granicus.if.org Git - postgresql/blob - src/include/c.h
Use standard macro for psql binary file open. Add comment explaining
[postgresql] / src / include / c.h
1 /*-------------------------------------------------------------------------
2  *
3  * c.h
4  *        Fundamental C definitions.  This is included by every .c file in
5  *        PostgreSQL (via either postgres.h or postgres_fe.h, as appropriate).
6  *
7  *        Note that the definitions here are not intended to be exposed to clients
8  *        of the frontend interface libraries --- so we don't worry much about
9  *        polluting the namespace with lots of stuff...
10  *
11  *
12  * Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
13  * Portions Copyright (c) 1994, Regents of the University of California
14  *
15  * $PostgreSQL: pgsql/src/include/c.h,v 1.166 2004/07/11 13:29:16 momjian Exp $
16  *
17  *-------------------------------------------------------------------------
18  */
19 /*
20  *----------------------------------------------------------------
21  *       TABLE OF CONTENTS
22  *
23  *              When adding stuff to this file, please try to put stuff
24  *              into the relevant section, or add new sections as appropriate.
25  *
26  *        section       description
27  *        -------       ------------------------------------------------
28  *              0)              pg_config.h and standard system headers
29  *              1)              hacks to cope with non-ANSI C compilers
30  *              2)              bool, true, false, TRUE, FALSE, NULL
31  *              3)              standard system types
32  *              4)              IsValid macros for system types
33  *              5)              offsetof, lengthof, endof, alignment
34  *              6)              widely useful macros
35  *              7)              random stuff
36  *              8)              system-specific hacks
37  *
38  * NOTE: since this file is included by both frontend and backend modules, it's
39  * almost certainly wrong to put an "extern" declaration here.  typedefs and
40  * macros are the kind of thing that might go here.
41  *
42  *----------------------------------------------------------------
43  */
44 #ifndef C_H
45 #define C_H
46
47 /*
48  * We have to include stdlib.h here because it defines many of these macros
49  * on some platforms, and we only want our definitions used if stdlib.h doesn't
50  * have its own.  The same goes for stddef and stdarg if present.
51  */
52
53 #include "pg_config.h"
54 #include "pg_config_manual.h"   /* must be after pg_config.h */
55 #ifndef WIN32
56 #include "pg_config_os.h"               /* must be before any system header files */
57 #endif
58 #include "postgres_ext.h"
59
60 #include <stdio.h>
61 #include <stdlib.h>
62 #include <string.h>
63 #include <stddef.h>
64 #include <stdarg.h>
65 #ifdef HAVE_STRINGS_H
66 #include <strings.h>
67 #endif
68 #include <sys/types.h>
69
70 #include <errno.h>
71 #if defined(__CYGWIN__) || defined(WIN32)
72 #include <fcntl.h>                              /* ensure O_BINARY is available */
73 #endif
74 #ifdef HAVE_SUPPORTDEFS_H
75 #include <SupportDefs.h>
76 #endif
77
78 #if defined(WIN32) && !defined(_MSC_VER) && !defined(__BORLANDC__)
79 /* We have to redefine some system functions after they are included above */
80 #include "pg_config_os.h"
81 #endif
82
83 /* Must be before gettext() games below */
84 #include <locale.h>
85
86 #ifdef ENABLE_NLS
87 #include <libintl.h>
88 #else
89 #define gettext(x) (x)
90 #endif
91 #define gettext_noop(x) (x)
92
93
94 /* ----------------------------------------------------------------
95  *                              Section 1: hacks to cope with non-ANSI C compilers
96  *
97  * type prefixes (const, signed, volatile, inline) are handled in pg_config.h.
98  * ----------------------------------------------------------------
99  */
100
101 /*
102  * CppAsString
103  *              Convert the argument to a string, using the C preprocessor.
104  * CppConcat
105  *              Concatenate two arguments together, using the C preprocessor.
106  *
107  * Note: the standard Autoconf macro AC_C_STRINGIZE actually only checks
108  * whether #identifier works, but if we have that we likely have ## too.
109  */
110 #if defined(HAVE_STRINGIZE)
111
112 #define CppAsString(identifier) #identifier
113 #define CppConcat(x, y)                 x##y
114
115 #else                                                   /* !HAVE_STRINGIZE */
116
117 #define CppAsString(identifier) "identifier"
118
119 /*
120  * CppIdentity -- On Reiser based cpp's this is used to concatenate
121  *              two tokens.  That is
122  *                              CppIdentity(A)B ==> AB
123  *              We renamed it to _private_CppIdentity because it should not
124  *              be referenced outside this file.  On other cpp's it
125  *              produces  A  B.
126  */
127 #define _priv_CppIdentity(x)x
128 #define CppConcat(x, y)                 _priv_CppIdentity(x)y
129 #endif   /* !HAVE_STRINGIZE */
130
131 /*
132  * dummyret is used to set return values in macros that use ?: to make
133  * assignments.  gcc wants these to be void, other compilers like char
134  */
135 #ifdef __GNUC__                                 /* GNU cc */
136 #define dummyret        void
137 #else
138 #define dummyret        char
139 #endif
140
141 #ifndef __GNUC__
142 #define __attribute__(_arg_)
143 #endif
144
145 /* ----------------------------------------------------------------
146  *                              Section 2:      bool, true, false, TRUE, FALSE, NULL
147  * ----------------------------------------------------------------
148  */
149
150 /*
151  * bool
152  *              Boolean value, either true or false.
153  *
154  * XXX for C++ compilers, we assume the compiler has a compatible
155  * built-in definition of bool.
156  */
157
158 /* BeOS defines bool already, but the compiler chokes on the
159  * #ifndef unless we wrap it in this check.
160  */
161 #ifndef __BEOS__
162
163 #ifndef __cplusplus
164
165 #ifndef bool
166 typedef char bool;
167 #endif
168
169 #ifndef true
170 #define true    ((bool) 1)
171 #endif
172
173 #ifndef false
174 #define false   ((bool) 0)
175 #endif
176 #endif   /* not C++ */
177 #endif   /* __BEOS__ */
178
179 typedef bool *BoolPtr;
180
181 #ifndef TRUE
182 #define TRUE    1
183 #endif
184
185 #ifndef FALSE
186 #define FALSE   0
187 #endif
188
189 /*
190  * NULL
191  *              Null pointer.
192  */
193 #ifndef NULL
194 #define NULL    ((void *) 0)
195 #endif
196
197
198 /* ----------------------------------------------------------------
199  *                              Section 3:      standard system types
200  * ----------------------------------------------------------------
201  */
202
203 /*
204  * Pointer
205  *              Variable holding address of any memory resident object.
206  *
207  *              XXX Pointer arithmetic is done with this, so it can't be void *
208  *              under "true" ANSI compilers.
209  */
210 typedef char *Pointer;
211
212 /*
213  * intN
214  *              Signed integer, EXACTLY N BITS IN SIZE,
215  *              used for numerical computations and the
216  *              frontend/backend protocol.
217  */
218 #ifndef HAVE_INT8
219 typedef signed char int8;               /* == 8 bits */
220 typedef signed short int16;             /* == 16 bits */
221 typedef signed int int32;               /* == 32 bits */
222 #endif   /* not HAVE_INT8 */
223
224 /*
225  * uintN
226  *              Unsigned integer, EXACTLY N BITS IN SIZE,
227  *              used for numerical computations and the
228  *              frontend/backend protocol.
229  */
230 /* Also defined in interfaces/odbc/md5.h */
231 #ifndef HAVE_UINT8
232 typedef unsigned char uint8;    /* == 8 bits */
233 typedef unsigned short uint16;  /* == 16 bits */
234 typedef unsigned int uint32;    /* == 32 bits */
235 #endif   /* not HAVE_UINT8 */
236
237 /*
238  * bitsN
239  *              Unit of bitwise operation, AT LEAST N BITS IN SIZE.
240  */
241 typedef uint8 bits8;                    /* >= 8 bits */
242 typedef uint16 bits16;                  /* >= 16 bits */
243 typedef uint32 bits32;                  /* >= 32 bits */
244
245 /*
246  * floatN
247  *              Floating point number, AT LEAST N BITS IN SIZE,
248  *              used for numerical computations.
249  *
250  *              Since sizeof(floatN) may be > sizeof(char *), always pass
251  *              floatN by reference.
252  *
253  * XXX: these typedefs are now deprecated in favor of float4 and float8.
254  * They will eventually go away.
255  */
256 typedef float float32data;
257 typedef double float64data;
258 typedef float *float32;
259 typedef double *float64;
260
261 /*
262  * 64-bit integers
263  */
264 #ifdef HAVE_LONG_INT_64
265 /* Plain "long int" fits, use it */
266
267 #ifndef HAVE_INT64
268 typedef long int int64;
269 #endif
270 #ifndef HAVE_UINT64
271 typedef unsigned long int uint64;
272 #endif
273
274 #elif defined(HAVE_LONG_LONG_INT_64)
275 /* We have working support for "long long int", use that */
276
277 #ifndef HAVE_INT64
278 typedef long long int int64;
279 #endif
280 #ifndef HAVE_UINT64
281 typedef unsigned long long int uint64;
282 #endif
283
284 #else   /* not HAVE_LONG_INT_64 and not HAVE_LONG_LONG_INT_64 */
285
286 /* Won't actually work, but fall back to long int so that code compiles */
287 #ifndef HAVE_INT64
288 typedef long int int64;
289 #endif
290 #ifndef HAVE_UINT64
291 typedef unsigned long int uint64;
292 #endif
293
294 #define INT64_IS_BUSTED
295 #endif   /* not HAVE_LONG_INT_64 and not HAVE_LONG_LONG_INT_64 */
296
297 /* Decide if we need to decorate 64-bit constants */
298 #ifdef HAVE_LL_CONSTANTS
299 #define INT64CONST(x)  ((int64) x##LL)
300 #define UINT64CONST(x) ((uint64) x##LL)
301 #else
302 #define INT64CONST(x)  ((int64) x)
303 #define UINT64CONST(x) ((uint64) x)
304 #endif
305
306
307 /* Select timestamp representation (float8 or int64) */
308 #if defined(USE_INTEGER_DATETIMES) && !defined(INT64_IS_BUSTED)
309 #define HAVE_INT64_TIMESTAMP
310 #endif
311
312 /* sig_atomic_t is required by ANSI C, but may be missing on old platforms */
313 #ifndef HAVE_SIG_ATOMIC_T
314 typedef int sig_atomic_t;
315 #endif
316
317 /*
318  * Size
319  *              Size of any memory resident object, as returned by sizeof.
320  */
321 typedef size_t Size;
322
323 /*
324  * Index
325  *              Index into any memory resident array.
326  *
327  * Note:
328  *              Indices are non negative.
329  */
330 typedef unsigned int Index;
331
332 /*
333  * Offset
334  *              Offset into any memory resident array.
335  *
336  * Note:
337  *              This differs from an Index in that an Index is always
338  *              non negative, whereas Offset may be negative.
339  */
340 typedef signed int Offset;
341
342 /*
343  * Common Postgres datatype names (as used in the catalogs)
344  */
345 typedef int16 int2;
346 typedef int32 int4;
347 typedef float float4;
348 typedef double float8;
349
350 /*
351  * Oid, RegProcedure, TransactionId, CommandId, AclId
352  */
353
354 /* typedef Oid is in postgres_ext.h */
355
356 /*
357  * regproc is the type name used in the include/catalog headers, but
358  * RegProcedure is the preferred name in C code.
359  */
360 typedef Oid regproc;
361 typedef regproc RegProcedure;
362
363 typedef uint32 TransactionId;
364
365 typedef uint32 CommandId;
366
367 #define FirstCommandId  ((CommandId) 0)
368
369 typedef int32 AclId;                    /* user and group identifiers */
370
371 /*
372  * Array indexing support
373  */
374 #define MAXDIM 6
375 typedef struct
376 {
377         int                     indx[MAXDIM];
378 } IntArray;
379
380 /* ----------------
381  *              Variable-length datatypes all share the 'struct varlena' header.
382  *
383  * NOTE: for TOASTable types, this is an oversimplification, since the value
384  * may be compressed or moved out-of-line.      However datatype-specific routines
385  * are mostly content to deal with de-TOASTed values only, and of course
386  * client-side routines should never see a TOASTed value.  See postgres.h for
387  * details of the TOASTed form.
388  * ----------------
389  */
390 struct varlena
391 {
392         int32           vl_len;
393         char            vl_dat[1];
394 };
395
396 #define VARHDRSZ                ((int32) sizeof(int32))
397
398 /*
399  * These widely-used datatypes are just a varlena header and the data bytes.
400  * There is no terminating null or anything like that --- the data length is
401  * always VARSIZE(ptr) - VARHDRSZ.
402  */
403 typedef struct varlena bytea;
404 typedef struct varlena text;
405 typedef struct varlena BpChar;  /* blank-padded char, ie SQL char(n) */
406 typedef struct varlena VarChar; /* var-length char, ie SQL varchar(n) */
407
408 /*
409  * Fixed-length array types (these are not varlena's!)
410  */
411
412 typedef int2 int2vector[INDEX_MAX_KEYS];
413 typedef Oid oidvector[INDEX_MAX_KEYS];
414
415 /*
416  * We want NameData to have length NAMEDATALEN and int alignment,
417  * because that's how the data type 'name' is defined in pg_type.
418  * Use a union to make sure the compiler agrees.  Note that NAMEDATALEN
419  * must be a multiple of sizeof(int), else sizeof(NameData) will probably
420  * not come out equal to NAMEDATALEN.
421  */
422 typedef union nameData
423 {
424         char            data[NAMEDATALEN];
425         int                     alignmentDummy;
426 } NameData;
427 typedef NameData *Name;
428
429 #define NameStr(name)   ((name).data)
430
431
432 /* ----------------------------------------------------------------
433  *                              Section 4:      IsValid macros for system types
434  * ----------------------------------------------------------------
435  */
436 /*
437  * BoolIsValid
438  *              True iff bool is valid.
439  */
440 #define BoolIsValid(boolean)    ((boolean) == false || (boolean) == true)
441
442 /*
443  * PointerIsValid
444  *              True iff pointer is valid.
445  */
446 #define PointerIsValid(pointer) ((void*)(pointer) != NULL)
447
448 /*
449  * PointerIsAligned
450  *              True iff pointer is properly aligned to point to the given type.
451  */
452 #define PointerIsAligned(pointer, type) \
453                 (((long)(pointer) % (sizeof (type))) == 0)
454
455 #define OidIsValid(objectId)  ((bool) ((objectId) != InvalidOid))
456
457 #define AclIdIsValid(aclId)  ((bool) ((aclId) != 0))
458
459 #define RegProcedureIsValid(p)  OidIsValid(p)
460
461
462 /* ----------------------------------------------------------------
463  *                              Section 5:      offsetof, lengthof, endof, alignment
464  * ----------------------------------------------------------------
465  */
466 /*
467  * offsetof
468  *              Offset of a structure/union field within that structure/union.
469  *
470  *              XXX This is supposed to be part of stddef.h, but isn't on
471  *              some systems (like SunOS 4).
472  */
473 #ifndef offsetof
474 #define offsetof(type, field)   ((long) &((type *)0)->field)
475 #endif   /* offsetof */
476
477 /*
478  * lengthof
479  *              Number of elements in an array.
480  */
481 #define lengthof(array) (sizeof (array) / sizeof ((array)[0]))
482
483 /*
484  * endof
485  *              Address of the element one past the last in an array.
486  */
487 #define endof(array)    (&array[lengthof(array)])
488
489 /* ----------------
490  * Alignment macros: align a length or address appropriately for a given type.
491  *
492  * There used to be some incredibly crufty platform-dependent hackery here,
493  * but now we rely on the configure script to get the info for us. Much nicer.
494  *
495  * NOTE: TYPEALIGN will not work if ALIGNVAL is not a power of 2.
496  * That case seems extremely unlikely to occur in practice, however.
497  * ----------------
498  */
499
500 #define TYPEALIGN(ALIGNVAL,LEN)  \
501         (((long) (LEN) + (ALIGNVAL-1)) & ~((long) (ALIGNVAL-1)))
502
503 #define SHORTALIGN(LEN)                 TYPEALIGN(ALIGNOF_SHORT, (LEN))
504 #define INTALIGN(LEN)                   TYPEALIGN(ALIGNOF_INT, (LEN))
505 #define LONGALIGN(LEN)                  TYPEALIGN(ALIGNOF_LONG, (LEN))
506 #define DOUBLEALIGN(LEN)                TYPEALIGN(ALIGNOF_DOUBLE, (LEN))
507 #define MAXALIGN(LEN)                   TYPEALIGN(MAXIMUM_ALIGNOF, (LEN))
508 /* MAXALIGN covers only built-in types, not buffers */
509 #define BUFFERALIGN(LEN)                TYPEALIGN(ALIGNOF_BUFFER, (LEN))
510
511
512 /* ----------------------------------------------------------------
513  *                              Section 6:      widely useful macros
514  * ----------------------------------------------------------------
515  */
516 /*
517  * Max
518  *              Return the maximum of two numbers.
519  */
520 #define Max(x, y)               ((x) > (y) ? (x) : (y))
521
522 /*
523  * Min
524  *              Return the minimum of two numbers.
525  */
526 #define Min(x, y)               ((x) < (y) ? (x) : (y))
527
528 /*
529  * Abs
530  *              Return the absolute value of the argument.
531  */
532 #define Abs(x)                  ((x) >= 0 ? (x) : -(x))
533
534 /*
535  * StrNCpy
536  *      Like standard library function strncpy(), except that result string
537  *      is guaranteed to be null-terminated --- that is, at most N-1 bytes
538  *      of the source string will be kept.
539  *      Also, the macro returns no result (too hard to do that without
540  *      evaluating the arguments multiple times, which seems worse).
541  *
542  *      BTW: when you need to copy a non-null-terminated string (like a text
543  *      datum) and add a null, do not do it with StrNCpy(..., len+1).  That
544  *      might seem to work, but it fetches one byte more than there is in the
545  *      text object.  One fine day you'll have a SIGSEGV because there isn't
546  *      another byte before the end of memory.  Don't laugh, we've had real
547  *      live bug reports from real live users over exactly this mistake.
548  *      Do it honestly with "memcpy(dst,src,len); dst[len] = '\0';", instead.
549  */
550 #define StrNCpy(dst,src,len) \
551         do \
552         { \
553                 char * _dst = (dst); \
554                 Size _len = (len); \
555 \
556                 if (_len > 0) \
557                 { \
558                         strncpy(_dst, (src), _len); \
559                         _dst[_len-1] = '\0'; \
560                 } \
561         } while (0)
562
563
564 /* Get a bit mask of the bits set in non-int32 aligned addresses */
565 #define INT_ALIGN_MASK (sizeof(int32) - 1)
566
567 /*
568  * MemSet
569  *      Exactly the same as standard library function memset(), but considerably
570  *      faster for zeroing small word-aligned structures (such as parsetree nodes).
571  *      This has to be a macro because the main point is to avoid function-call
572  *      overhead.       However, we have also found that the loop is faster than
573  *      native libc memset() on some platforms, even those with assembler
574  *      memset() functions.  More research needs to be done, perhaps with
575  *      platform-specific MEMSET_LOOP_LIMIT values or tests in configure.
576  *
577  *      bjm 2002-10-08
578  */
579 #define MemSet(start, val, len) \
580         do \
581         { \
582                 int32 * _start = (int32 *) (start); \
583                 int             _val = (val); \
584                 Size    _len = (len); \
585 \
586                 if ((((long) _start) & INT_ALIGN_MASK) == 0 && \
587                         (_len & INT_ALIGN_MASK) == 0 && \
588                         _val == 0 && \
589                         _len <= MEMSET_LOOP_LIMIT) \
590                 { \
591                         int32 * _stop = (int32 *) ((char *) _start + _len); \
592                         while (_start < _stop) \
593                                 *_start++ = 0; \
594                 } \
595                 else \
596                         memset((char *) _start, _val, _len); \
597         } while (0)
598
599 #define MEMSET_LOOP_LIMIT  1024
600
601 /*
602  * MemSetAligned is the same as MemSet except it omits the test to see if
603  * "start" is word-aligned.  This is okay to use if the caller knows a-priori
604  * that the pointer is suitably aligned (typically, because he just got it
605  * from palloc(), which always delivers a max-aligned pointer).
606  */
607 #define MemSetAligned(start, val, len) \
608         do \
609         { \
610                 int32 * _start = (int32 *) (start); \
611                 int             _val = (val); \
612                 Size    _len = (len); \
613 \
614                 if ((_len & INT_ALIGN_MASK) == 0 && \
615                         _val == 0 && \
616                         _len <= MEMSET_LOOP_LIMIT) \
617                 { \
618                         int32 * _stop = (int32 *) ((char *) _start + _len); \
619                         while (_start < _stop) \
620                                 *_start++ = 0; \
621                 } \
622                 else \
623                         memset((char *) _start, _val, _len); \
624         } while (0)
625
626
627 /*
628  * MemSetTest/MemSetLoop are a variant version that allow all the tests in
629  * MemSet to be done at compile time in cases where "val" and "len" are
630  * constants *and* we know the "start" pointer must be word-aligned.
631  * If MemSetTest succeeds, then it is okay to use MemSetLoop, otherwise use
632  * MemSetAligned.  Beware of multiple evaluations of the arguments when using
633  * this approach.
634  */
635 #define MemSetTest(val, len) \
636         ( ((len) & INT_ALIGN_MASK) == 0 && \
637         (len) <= MEMSET_LOOP_LIMIT && \
638         (val) == 0 )
639
640 #define MemSetLoop(start, val, len) \
641         do \
642         { \
643                 int32 * _start = (int32 *) (start); \
644                 int32 * _stop = (int32 *) ((char *) _start + (Size) (len)); \
645         \
646                 while (_start < _stop) \
647                         *_start++ = 0; \
648         } while (0)
649
650
651 /* ----------------------------------------------------------------
652  *                              Section 7:      random stuff
653  * ----------------------------------------------------------------
654  */
655
656 /* msb for char */
657 #define CSIGNBIT (0x80)
658
659 #define STATUS_OK                               (0)
660 #define STATUS_ERROR                    (-1)
661 #define STATUS_EOF                              (-2)
662 #define STATUS_FOUND                    (1)
663
664
665 /* ----------------------------------------------------------------
666  *                              Section 8: system-specific hacks
667  *
668  *              This should be limited to things that absolutely have to be
669  *              included in every source file.  The port-specific header file
670  *              is usually a better place for this sort of thing.
671  * ----------------------------------------------------------------
672  */
673
674 /*
675  *      NOTE:  this is also used for opening text files.
676  *  WIN32 treats Control-Z as EOF in files opened in text mode.
677  *  Therefore, we open files in binary mode on Win32 so we can read
678  *  literal control-Z.  The other affect is that we see CRLF, but
679  *  that is OK because we can already handle those cleanly.
680  */
681 #if defined(__CYGWIN__) || defined(WIN32)
682 #define PG_BINARY       O_BINARY
683 #define PG_BINARY_R "rb"
684 #define PG_BINARY_W "wb"
685 #else
686 #define PG_BINARY       0
687 #define PG_BINARY_R "r"
688 #define PG_BINARY_W "w"
689 #endif
690
691 #if defined(sun) && defined(__sparc__) && !defined(__SVR4)
692 #include <unistd.h>
693 #endif
694
695 /* These are for things that are one way on Unix and another on NT */
696 #define NULL_DEV                "/dev/null"
697
698 /*
699  * Provide prototypes for routines not present in a particular machine's
700  * standard C library.
701  */
702
703 #if !HAVE_DECL_SNPRINTF
704 extern int
705 snprintf(char *str, size_t count, const char *fmt,...)
706 /* This extension allows gcc to check the format string */
707 __attribute__((format(printf, 3, 4)));
708 #endif
709
710 #if !HAVE_DECL_VSNPRINTF
711 extern int      vsnprintf(char *str, size_t count, const char *fmt, va_list args);
712 #endif
713
714 #if !defined(HAVE_MEMMOVE) && !defined(memmove)
715 #define memmove(d, s, c)                bcopy(s, d, c)
716 #endif
717
718 #ifndef DLLIMPORT
719 #define DLLIMPORT                               /* no special DLL markers on most ports */
720 #endif
721
722 /*
723  * The following is used as the arg list for signal handlers.  Any ports
724  * that take something other than an int argument should override this in
725  * their pg_config_os.h file.  Note that variable names are required
726  * because it is used in both the prototypes as well as the definitions.
727  * Note also the long name.  We expect that this won't collide with
728  * other names causing compiler warnings.
729  */
730
731 #ifndef SIGNAL_ARGS
732 #define SIGNAL_ARGS  int postgres_signal_arg
733 #endif
734
735 /*
736  * When there is no sigsetjmp, its functionality is provided by plain
737  * setjmp. Incidentally, nothing provides setjmp's functionality in
738  * that case.
739  */
740 #ifndef HAVE_SIGSETJMP
741 #define sigjmp_buf jmp_buf
742 #define sigsetjmp(x,y) setjmp(x)
743 #define siglongjmp longjmp
744 #endif
745
746 #if defined(HAVE_FDATASYNC) && !HAVE_DECL_FDATASYNC
747 extern int      fdatasync(int fildes);
748 #endif
749
750 /* If strtoq() exists, rename it to the more standard strtoll() */
751 #if defined(HAVE_LONG_LONG_INT_64) && !defined(HAVE_STRTOLL) && defined(HAVE_STRTOQ)
752 #define strtoll strtoq
753 #define HAVE_STRTOLL 1
754 #endif
755
756 /* If strtouq() exists, rename it to the more standard strtoull() */
757 #if defined(HAVE_LONG_LONG_INT_64) && !defined(HAVE_STRTOULL) && defined(HAVE_STRTOUQ)
758 #define strtoull strtouq
759 #define HAVE_STRTOULL 1
760 #endif
761
762 /* EXEC_BACKEND defines */
763 #ifdef EXEC_BACKEND
764 #define NON_EXEC_STATIC
765 #else
766 #define NON_EXEC_STATIC static
767 #endif
768
769 /* /port compatibility functions */
770 #include "port.h"
771
772 #endif   /* C_H */