IBM Z: Fix usage of "f" constraint with long doubles
[official-gcc.git] / gcc / ada / s-oscons-tmplt.c
blob582c35ef7db094482fbf7bf59e4d95a5374775a3
1 /*
2 ------------------------------------------------------------------------------
3 -- --
4 -- GNAT COMPILER COMPONENTS --
5 -- --
6 -- S Y S T E M . O S _ C O N S T A N T S --
7 -- --
8 -- S p e c --
9 -- --
10 -- Copyright (C) 2000-2020, Free Software Foundation, Inc. --
11 -- --
12 -- GNAT is free software; you can redistribute it and/or modify it under --
13 -- terms of the GNU General Public License as published by the Free Soft- --
14 -- ware Foundation; either version 3, or (at your option) any later ver- --
15 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
16 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
17 -- or FITNESS FOR A PARTICULAR PURPOSE. --
18 -- --
19 -- As a special exception under Section 7 of GPL version 3, you are granted --
20 -- additional permissions described in the GCC Runtime Library Exception, --
21 -- version 3.1, as published by the Free Software Foundation. --
22 -- --
23 -- You should have received a copy of the GNU General Public License and --
24 -- a copy of the GCC Runtime Library Exception along with this program; --
25 -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
26 -- <http://www.gnu.org/licenses/>. --
27 -- --
28 -- GNAT was originally developed by the GNAT team at New York University. --
29 -- Extensive contributions were provided by Ada Core Technologies Inc. --
30 -- --
31 ------------------------------------------------------------------------------
33 pragma Style_Checks ("M32766");
34 -- Allow long lines
38 /**
39 ** This template file is used while building the GNAT runtime library to
40 ** generate package System.OS_Constants (s-oscons.ads).
42 ** The generation process is:
43 ** 1. the platform-independent extraction tool xoscons is built with the
44 ** base native compiler
45 ** 2. this template is processed by the cross C compiler to produce
46 ** a list of constant values
47 ** 3. the comments in this template and the list of values are processed
48 ** by xoscons to generate s-oscons.ads.
50 ** Any comment occurring in this file whose start and end markers are on
51 ** a line by themselves (see above) is copied verbatim to s-oscons.ads.
52 ** All other comments are ignored. Note that the build process first passes
53 ** this file through the C preprocessor, so comments that occur in a section
54 ** that is conditioned by a #if directive will be copied to the output only
55 ** when it applies.
57 ** Two methods are supported to generate the list of constant values,
58 ** s-oscons-tmpl.s.
60 ** The default one assumes that the template can be compiled by the newly-
61 ** built cross compiler. It uses markup produced in the (pseudo-)assembly
62 ** listing:
64 ** xgcc -DTARGET=\"$target\" -C -E s-oscons-tmplt.c > s-oscons-tmplt.i
65 ** xgcc -S s-oscons-tmplt.i
66 ** xoscons
68 ** Alternatively, if s-oscons-tmplt.c must be compiled with a proprietary
69 ** compiler (e.g. the native DEC CC on OpenVMS), the NATIVE macro should
70 ** be defined, and the resulting program executed:
72 ** $ CC/DEFINE=("TARGET=""OpenVMS""",NATIVE)
73 ** /PREPROCESS_ONLY /COMMENTS=AS_IS s-oscons-tmplt
74 ** $ CC/DEFINE=("TARGET=""OpenVMS""",NATIVE) s-oscons-tmplt
75 ** $ LINK s-oscons-tmplt
76 ** $ DEFINE/USER SYS$OUTPUT s-oscons-tmplt.s
77 ** $ RUN s-oscons-tmplt
78 ** $ RUN xoscons
79 **/
81 /* Feature macro definitions */
83 /**
84 ** Note: we deliberately do not define _POSIX_SOURCE / _POSIX_C_SOURCE
85 ** unconditionally, as on many platforms these macros actually disable
86 ** a number of non-POSIX but useful/required features.
87 **/
89 #if defined (__linux__) || defined (__ANDROID__)
91 /* Define _XOPEN_SOURCE to get IOV_MAX */
92 # if !defined (_XOPEN_SOURCE)
93 # define _XOPEN_SOURCE 500
94 # endif
96 /* Define _BSD_SOURCE to get CRTSCTS */
97 # define _BSD_SOURCE
99 #endif /* defined (__linux__) || defined (__ANDROID__) */
101 /* Include gsocket.h before any system header so it can redefine FD_SETSIZE */
103 #include "gsocket.h"
105 #include <stdlib.h>
106 #include <string.h>
107 #include <limits.h>
108 #include <fcntl.h>
109 #include <time.h>
111 #if ! (defined (__vxworks) || defined (__MINGW32__))
112 # define HAVE_TERMIOS
113 #endif
115 #if defined (__vxworks)
118 ** For VxWorks, always include vxWorks.h (gsocket.h provides it only for
119 ** the case of runtime libraries that support sockets). Note: this must
120 ** be done before including adaint.h.
123 # include <vxWorks.h>
124 #elif !defined(__MINGW32__)
125 #include <poll.h>
126 #endif
128 #include "adaint.h"
130 #ifdef DUMMY
132 # if defined (TARGET)
133 # error TARGET may not be defined when generating the dummy version
134 # else
135 # define TARGET "batch runtime compilation (dummy values)"
136 # endif
138 # if !(defined (HAVE_SOCKETS) && defined (HAVE_TERMIOS))
139 # error Features missing on platform
140 # endif
142 # define NATIVE
144 #endif /* DUMMY */
146 #ifndef TARGET
147 # error Please define TARGET
148 #endif
150 #ifndef HAVE_SOCKETS
151 # include <errno.h>
152 #endif
154 #ifdef HAVE_TERMIOS
155 # include <termios.h>
156 #endif
158 #ifdef __APPLE__
159 # include <_types.h>
160 #endif
162 #if defined (__linux__) || defined (__ANDROID__) || defined (__QNX__) \
163 || defined (__rtems__)
164 # include <pthread.h>
165 # include <signal.h>
166 #endif
168 #if defined(__MINGW32__) || defined(__CYGWIN__)
169 # include <windef.h>
170 # include <winbase.h>
171 #endif
173 #ifdef NATIVE
174 #include <stdio.h>
176 #ifdef DUMMY
177 int counter = 0;
178 # define _VAL(x) counter++
179 #else
180 # define _VAL(x) x
181 #endif
183 #define CND(name,comment) \
184 printf ("\n->CND:$%d:" #name ":$%d:" comment, __LINE__, ((int) _VAL (name)));
186 #define CNU(name,comment) \
187 printf ("\n->CNU:$%d:" #name ":$%u:" comment, __LINE__, ((unsigned int) _VAL (name)));
189 #define CNS(name,comment) \
190 printf ("\n->CNS:$%d:" #name ":" name ":" comment, __LINE__);
192 #define C(sname,type,value,comment)\
193 printf ("\n->C:$%d:" sname ":" #type ":" value ":" comment, __LINE__);
195 #define SUB(sname)\
196 printf ("\n->SUB:$%d:" #sname ":" sname, __LINE__);
198 #define TXT(text) \
199 printf ("\n->TXT:$%d:" text, __LINE__);
201 #else
203 #define CND(name, comment) \
204 asm volatile("\n->CND:%0:" #name ":%1:" comment \
205 : : "i" (__LINE__), "i" ((int) name));
206 /* Decimal constant in the range of type "int" */
208 #define CNU(name, comment) \
209 asm volatile("\n->CNU:%0:" #name ":%1:" comment \
210 : : "i" (__LINE__), "i" ((int) name));
211 /* Decimal constant in the range of type "unsigned int" (note, assembler
212 * always wants a signed int, we convert back in xoscons).
215 #define CNS(name, comment) \
216 asm volatile("\n->CNS:%0:" #name ":" name ":" comment \
217 : : "i" (__LINE__));
218 /* General expression named number */
220 #define C(sname, type, value, comment) \
221 asm volatile("\n->C:%0:" sname ":" #type ":" value ":" comment \
222 : : "i" (__LINE__));
223 /* Typed constant */
225 #define SUB(sname) \
226 asm volatile("\n->SUB:%0:" #sname ":" sname \
227 : : "i" (__LINE__));
228 /* Subtype */
230 #define TXT(text) \
231 asm volatile("\n->TXT:%0:" text \
232 : : "i" (__LINE__));
233 /* Freeform text */
235 #endif /* NATIVE */
237 #define CST(name,comment) C(#name,String,name,comment)
238 /* String constant */
240 #define STR(x) STR1(x)
241 #define STR1(x) #x
243 #ifdef __MINGW32__
244 unsigned int _CRT_fmode = _O_BINARY;
245 #endif
248 main (void) {
251 -- This package provides target dependent definitions of constant for use
252 -- by the GNAT runtime library. This package should not be directly with'd
253 -- by an application program.
255 -- This file is generated automatically, do not modify it by hand! Instead,
256 -- make changes to s-oscons-tmplt.c and rebuild the GNAT runtime library.
260 ** Do not change the format of the line below without also updating the
261 ** MaRTE Makefile.
263 TXT("-- This is the version for " TARGET)
264 TXT("")
265 TXT("with Interfaces.C;")
266 #if defined (__MINGW32__) || defined (__CYGWIN__)
267 # define TARGET_OS "Windows"
268 # define Serial_Port_Descriptor "System.Win32.HANDLE"
269 TXT("with System.Win32;")
270 #else
271 # define TARGET_OS "Other_OS"
272 # define Serial_Port_Descriptor "Interfaces.C.int"
273 #endif
276 package System.OS_Constants is
278 pragma Pure;
282 ** General constants (all platforms)
287 ---------------------------------
288 -- General platform parameters --
289 ---------------------------------
291 type OS_Type is (Windows, Other_OS);
293 C("Target_OS", OS_Type, TARGET_OS, "")
295 pragma Warnings (Off, Target_OS);
296 -- Suppress warnings on Target_OS since it is in general tested for
297 -- equality with a constant value to implement conditional compilation,
298 -- which normally generates a constant condition warning.
301 #define Target_Name TARGET
302 CST(Target_Name, "")
305 ** Note: the name of the following constant is recognized specially by
306 ** xoscons (case sensitive).
308 #define SIZEOF_unsigned_int sizeof (unsigned int)
309 CND(SIZEOF_unsigned_int, "Size of unsigned int")
311 SUB(Serial_Port_Descriptor)
315 -------------------
316 -- System limits --
317 -------------------
321 #ifndef IOV_MAX
322 # define IOV_MAX INT_MAX
323 #endif
324 CND(IOV_MAX, "Maximum writev iovcnt")
326 /* NAME_MAX is used to compute the allocation size for a struct dirent
327 * passed to readdir() / readdir_r(). However on some systems it is not
328 * defined, as it is technically a filesystem dependent property that
329 * we should retrieve through pathconf(). In any case, we do not need a
330 * precise value but only an upper limit.
332 #ifndef NAME_MAX
333 # ifdef MAXNAMELEN
334 /* Solaris has no NAME_MAX but defines MAXNAMELEN */
335 # define NAME_MAX MAXNAMELEN
336 # elif defined(PATH_MAX)
337 /* PATH_MAX (maximum length of a full path name) is a safe fall back */
338 # define NAME_MAX PATH_MAX
339 # elif defined(FILENAME_MAX)
340 /* Similarly FILENAME_MAX can provide a safe fall back */
341 # define NAME_MAX FILENAME_MAX
342 # else
343 /* Hardcode a reasonably large value as a last chance fallback */
344 # define NAME_MAX 1024
345 # endif
346 #endif
347 CND(NAME_MAX, "Maximum file name length")
351 ---------------------
352 -- File open modes --
353 ---------------------
357 #ifndef O_RDWR
358 # define O_RDWR -1
359 #endif
360 CND(O_RDWR, "Read/write")
362 #ifndef O_NOCTTY
363 # define O_NOCTTY -1
364 #endif
365 CND(O_NOCTTY, "Don't change ctrl tty")
367 #ifndef O_NDELAY
368 # define O_NDELAY -1
369 #endif
370 CND(O_NDELAY, "Nonblocking")
374 ----------------------
375 -- Fcntl operations --
376 ----------------------
380 #ifndef F_GETFL
381 # define F_GETFL -1
382 #endif
383 CND(F_GETFL, "Get flags")
385 #ifndef F_SETFL
386 # define F_SETFL -1
387 #endif
388 CND(F_SETFL, "Set flags")
392 -----------------
393 -- Fcntl flags --
394 -----------------
398 #ifndef FNDELAY
399 # define FNDELAY -1
400 #endif
401 CND(FNDELAY, "Nonblocking")
405 ----------------------
406 -- Ioctl operations --
407 ----------------------
411 /* ioctl(2) requests are "int" in UNIX, but "unsigned long" on FreeBSD */
413 #if defined (__FreeBSD__) || defined (__DragonFly__)
414 # define CNI CNU
415 # define IOCTL_Req_T "Interfaces.C.unsigned"
416 #else
417 # define CNI CND
418 # define IOCTL_Req_T "Interfaces.C.int"
419 #endif
421 SUB(IOCTL_Req_T)
423 #ifndef FIONBIO
424 # define FIONBIO -1
425 #endif
426 CNI(FIONBIO, "Set/clear non-blocking io")
428 #ifndef FIONREAD
429 # define FIONREAD -1
430 #endif
431 CNI(FIONREAD, "How many bytes to read")
435 ------------------
436 -- Errno values --
437 ------------------
439 -- The following constants are defined from <errno.h>
442 #ifndef EAGAIN
443 # define EAGAIN -1
444 #endif
445 CND(EAGAIN, "Try again")
447 #ifndef ENOENT
448 # define ENOENT -1
449 #endif
450 CND(ENOENT, "File not found")
452 #ifndef ENOMEM
453 # define ENOMEM -1
454 #endif
455 CND(ENOMEM, "Out of memory")
457 #ifdef __MINGW32__
460 -- The following constants are defined from <winsock2.h> (WSA*)
465 ** For sockets-related errno values on Windows, gsocket.h redefines
466 ** Exxx as WSAExxx.
469 #endif
471 #ifndef EACCES
472 # define EACCES -1
473 #endif
474 CND(EACCES, "Permission denied")
476 #ifndef EADDRINUSE
477 # define EADDRINUSE -1
478 #endif
479 CND(EADDRINUSE, "Address already in use")
481 #ifndef EADDRNOTAVAIL
482 # define EADDRNOTAVAIL -1
483 #endif
484 CND(EADDRNOTAVAIL, "Cannot assign address")
486 #ifndef EAFNOSUPPORT
487 # define EAFNOSUPPORT -1
488 #endif
489 CND(EAFNOSUPPORT, "Addr family not supported")
491 #ifndef EALREADY
492 # define EALREADY -1
493 #endif
494 CND(EALREADY, "Operation in progress")
496 #ifndef EBADF
497 # define EBADF -1
498 #endif
499 CND(EBADF, "Bad file descriptor")
501 #ifndef ECONNABORTED
502 # define ECONNABORTED -1
503 #endif
504 CND(ECONNABORTED, "Connection aborted")
506 #ifndef ECONNREFUSED
507 # define ECONNREFUSED -1
508 #endif
509 CND(ECONNREFUSED, "Connection refused")
511 #ifndef ECONNRESET
512 # define ECONNRESET -1
513 #endif
514 CND(ECONNRESET, "Connection reset by peer")
516 #ifndef EDESTADDRREQ
517 # define EDESTADDRREQ -1
518 #endif
519 CND(EDESTADDRREQ, "Destination addr required")
521 #ifndef EFAULT
522 # define EFAULT -1
523 #endif
524 CND(EFAULT, "Bad address")
526 #ifndef EHOSTDOWN
527 # define EHOSTDOWN -1
528 #endif
529 CND(EHOSTDOWN, "Host is down")
531 #ifndef EHOSTUNREACH
532 # define EHOSTUNREACH -1
533 #endif
534 CND(EHOSTUNREACH, "No route to host")
536 #ifndef EINPROGRESS
537 # define EINPROGRESS -1
538 #endif
539 CND(EINPROGRESS, "Operation now in progress")
541 #ifndef EINTR
542 # define EINTR -1
543 #endif
544 CND(EINTR, "Interrupted system call")
546 #ifndef EINVAL
547 # define EINVAL -1
548 #endif
549 CND(EINVAL, "Invalid argument")
551 #ifndef EIO
552 # define EIO -1
553 #endif
554 CND(EIO, "Input output error")
556 #ifndef EISCONN
557 # define EISCONN -1
558 #endif
559 CND(EISCONN, "Socket already connected")
561 #ifndef ELOOP
562 # define ELOOP -1
563 #endif
564 CND(ELOOP, "Too many symbolic links")
566 #ifndef EMFILE
567 # define EMFILE -1
568 #endif
569 CND(EMFILE, "Too many open files")
571 #ifndef EMSGSIZE
572 # define EMSGSIZE -1
573 #endif
574 CND(EMSGSIZE, "Message too long")
576 #ifndef ENAMETOOLONG
577 # define ENAMETOOLONG -1
578 #endif
579 CND(ENAMETOOLONG, "Name too long")
581 #ifndef ENETDOWN
582 # define ENETDOWN -1
583 #endif
584 CND(ENETDOWN, "Network is down")
586 #ifndef ENETRESET
587 # define ENETRESET -1
588 #endif
589 CND(ENETRESET, "Disconn. on network reset")
591 #ifndef ENETUNREACH
592 # define ENETUNREACH -1
593 #endif
594 CND(ENETUNREACH, "Network is unreachable")
596 #ifndef ENOBUFS
597 # define ENOBUFS -1
598 #endif
599 CND(ENOBUFS, "No buffer space available")
601 #ifndef ENOPROTOOPT
602 # define ENOPROTOOPT -1
603 #endif
604 CND(ENOPROTOOPT, "Protocol not available")
606 #ifndef ENOTCONN
607 # define ENOTCONN -1
608 #endif
609 CND(ENOTCONN, "Socket not connected")
611 #ifndef ENOTSOCK
612 # define ENOTSOCK -1
613 #endif
614 CND(ENOTSOCK, "Operation on non socket")
616 #ifndef EOPNOTSUPP
617 # define EOPNOTSUPP -1
618 #endif
619 CND(EOPNOTSUPP, "Operation not supported")
621 #ifndef EPIPE
622 # define EPIPE -1
623 #endif
624 CND(EPIPE, "Broken pipe")
626 #ifndef EPFNOSUPPORT
627 # define EPFNOSUPPORT -1
628 #endif
629 CND(EPFNOSUPPORT, "Unknown protocol family")
631 #ifndef EPROTONOSUPPORT
632 # define EPROTONOSUPPORT -1
633 #endif
634 CND(EPROTONOSUPPORT, "Unknown protocol")
636 #ifndef EPROTOTYPE
637 # define EPROTOTYPE -1
638 #endif
639 CND(EPROTOTYPE, "Unknown protocol type")
641 #ifndef ERANGE
642 # define ERANGE -1
643 #endif
644 CND(ERANGE, "Result too large")
646 #ifndef ESHUTDOWN
647 # define ESHUTDOWN -1
648 #endif
649 CND(ESHUTDOWN, "Cannot send once shutdown")
651 #ifndef ESOCKTNOSUPPORT
652 # define ESOCKTNOSUPPORT -1
653 #endif
654 CND(ESOCKTNOSUPPORT, "Socket type not supported")
656 #ifndef ETIMEDOUT
657 # define ETIMEDOUT -1
658 #endif
659 CND(ETIMEDOUT, "Connection timed out")
661 #ifndef ETOOMANYREFS
662 # define ETOOMANYREFS -1
663 #endif
664 CND(ETOOMANYREFS, "Too many references")
666 #ifndef EWOULDBLOCK
667 # define EWOULDBLOCK -1
668 #endif
669 CND(EWOULDBLOCK, "Operation would block")
671 #ifndef E2BIG
672 # define E2BIG -1
673 #endif
674 CND(E2BIG, "Argument list too long")
676 #ifndef EILSEQ
677 # define EILSEQ -1
678 #endif
679 CND(EILSEQ, "Illegal byte sequence")
682 ** Terminal/serial I/O constants
685 #if defined(HAVE_TERMIOS) || defined(__MINGW32__)
688 ----------------------
689 -- Terminal control --
690 ----------------------
693 #endif
695 #ifdef HAVE_TERMIOS
697 #ifndef TCSANOW
698 # define TCSANOW -1
699 #endif
700 CND(TCSANOW, "Immediate")
702 #ifndef TCIFLUSH
703 # define TCIFLUSH -1
704 #endif
705 CND(TCIFLUSH, "Flush input")
707 #ifndef IXON
708 # define IXON -1
709 #endif
710 CNU(IXON, "Output sw flow control")
712 #ifndef CLOCAL
713 # define CLOCAL -1
714 #endif
715 CNU(CLOCAL, "Local")
717 #ifndef CRTSCTS
718 # define CRTSCTS -1
719 #endif
720 CNU(CRTSCTS, "Output hw flow control")
722 #ifndef CREAD
723 # define CREAD -1
724 #endif
725 CNU(CREAD, "Read")
727 #ifndef ICANON
728 # define ICANON -1
729 #endif
730 CNU(ICANON, "canonical mode")
732 #ifndef CBAUD
733 # define CBAUD -1
734 #endif
735 CNU(CBAUD, "baud speed mask")
737 #ifndef ECHO
738 # define ECHO -1
739 #endif
740 CNU(ECHO, "echo input characters")
742 #ifndef ECHOE
743 # define ECHOE -1
744 #endif
745 CNU(ECHOE, "erase preceding characters")
747 #ifndef ECHOK
748 # define ECHOK -1
749 #endif
750 CNU(ECHOK, "kill character, erases current line")
752 #ifndef ECHOCTL
753 # define ECHOCTL -1
754 #endif
755 CNU(ECHOCTL, "echo special characters")
757 #ifndef ECHONL
758 # define ECHONL -1
759 #endif
760 CNU(ECHONL, "force echo NL character")
762 #ifndef CS5
763 # define CS5 -1
764 #endif
765 CNU(CS5, "5 data bits")
767 #ifndef CS6
768 # define CS6 -1
769 #endif
770 CNU(CS6, "6 data bits")
772 #ifndef CS7
773 # define CS7 -1
774 #endif
775 CNU(CS7, "7 data bits")
777 #ifndef CS8
778 # define CS8 -1
779 #endif
780 CNU(CS8, "8 data bits")
782 #ifndef CSTOPB
783 # define CSTOPB -1
784 #endif
785 CNU(CSTOPB, "2 stop bits")
787 #ifndef PARENB
788 # define PARENB -1
789 #endif
790 CNU(PARENB, "Parity enable")
792 #ifndef PARODD
793 # define PARODD -1
794 #endif
795 CNU(PARODD, "Parity odd")
797 #ifndef B0
798 # define B0 -1
799 #endif
800 CNU(B0, "0 bps")
802 #ifndef B50
803 # define B50 -1
804 #endif
805 CNU(B50, "50 bps")
807 #ifndef B75
808 # define B75 -1
809 #endif
810 CNU(B75, "75 bps")
812 #ifndef B110
813 # define B110 -1
814 #endif
815 CNU(B110, "110 bps")
817 #ifndef B134
818 # define B134 -1
819 #endif
820 CNU(B134, "134 bps")
822 #ifndef B150
823 # define B150 -1
824 #endif
825 CNU(B150, "150 bps")
827 #ifndef B200
828 # define B200 -1
829 #endif
830 CNU(B200, "200 bps")
832 #ifndef B300
833 # define B300 -1
834 #endif
835 CNU(B300, "300 bps")
837 #ifndef B600
838 # define B600 -1
839 #endif
840 CNU(B600, "600 bps")
842 #ifndef B1200
843 # define B1200 -1
844 #endif
845 CNU(B1200, "1200 bps")
847 #ifndef B1800
848 # define B1800 -1
849 #endif
850 CNU(B1800, "1800 bps")
852 #ifndef B2400
853 # define B2400 -1
854 #endif
855 CNU(B2400, "2400 bps")
857 #ifndef B4800
858 # define B4800 -1
859 #endif
860 CNU(B4800, "4800 bps")
862 #ifndef B9600
863 # define B9600 -1
864 #endif
865 CNU(B9600, "9600 bps")
867 #ifndef B19200
868 # define B19200 -1
869 #endif
870 CNU(B19200, "19200 bps")
872 #ifndef B38400
873 # define B38400 -1
874 #endif
875 CNU(B38400, "38400 bps")
877 #ifndef B57600
878 # define B57600 -1
879 #endif
880 CNU(B57600, "57600 bps")
882 #ifndef B115200
883 # define B115200 -1
884 #endif
885 CNU(B115200, "115200 bps")
887 #ifndef B230400
888 # define B230400 -1
889 #endif
890 CNU(B230400, "230400 bps")
892 #ifndef B460800
893 # define B460800 -1
894 #endif
895 CNU(B460800, "460800 bps")
897 #ifndef B500000
898 # define B500000 -1
899 #endif
900 CNU(B500000, "500000 bps")
902 #ifndef B576000
903 # define B576000 -1
904 #endif
905 CNU(B576000, "576000 bps")
907 #ifndef B921600
908 # define B921600 -1
909 #endif
910 CNU(B921600, "921600 bps")
912 #ifndef B1000000
913 # define B1000000 -1
914 #endif
915 CNU(B1000000, "1000000 bps")
917 #ifndef B1152000
918 # define B1152000 -1
919 #endif
920 CNU(B1152000, "1152000 bps")
922 #ifndef B1500000
923 # define B1500000 -1
924 #endif
925 CNU(B1500000, "1500000 bps")
927 #ifndef B2000000
928 # define B2000000 -1
929 #endif
930 CNU(B2000000, "2000000 bps")
932 #ifndef B2500000
933 # define B2500000 -1
934 #endif
935 CNU(B2500000, "2500000 bps")
937 #ifndef B3000000
938 # define B3000000 -1
939 #endif
940 CNU(B3000000, "3000000 bps")
942 #ifndef B3500000
943 # define B3500000 -1
944 #endif
945 CNU(B3500000, "3500000 bps")
947 #ifndef B4000000
948 # define B4000000 -1
949 #endif
950 CNU(B4000000, "4000000 bps")
954 ---------------------------------
955 -- Terminal control characters --
956 ---------------------------------
960 #ifndef VINTR
961 # define VINTR -1
962 #endif
963 CND(VINTR, "Interrupt")
965 #ifndef VQUIT
966 # define VQUIT -1
967 #endif
968 CND(VQUIT, "Quit")
970 #ifndef VERASE
971 # define VERASE -1
972 #endif
973 CND(VERASE, "Erase")
975 #ifndef VKILL
976 # define VKILL -1
977 #endif
978 CND(VKILL, "Kill")
980 #ifndef VEOF
981 # define VEOF -1
982 #endif
983 CND(VEOF, "EOF")
985 #ifndef VTIME
986 # define VTIME -1
987 #endif
988 CND(VTIME, "Read timeout")
990 #ifndef VMIN
991 # define VMIN -1
992 #endif
993 CND(VMIN, "Read min chars")
995 #ifndef VSWTC
996 # define VSWTC -1
997 #endif
998 CND(VSWTC, "Switch")
1000 #ifndef VSTART
1001 # define VSTART -1
1002 #endif
1003 CND(VSTART, "Flow control start")
1005 #ifndef VSTOP
1006 # define VSTOP -1
1007 #endif
1008 CND(VSTOP, "Flow control stop")
1010 #ifndef VSUSP
1011 # define VSUSP -1
1012 #endif
1013 CND(VSUSP, "Suspend")
1015 #ifndef VEOL
1016 # define VEOL -1
1017 #endif
1018 CND(VEOL, "EOL")
1020 #ifndef VREPRINT
1021 # define VREPRINT -1
1022 #endif
1023 CND(VREPRINT, "Reprint unread")
1025 #ifndef VDISCARD
1026 # define VDISCARD -1
1027 #endif
1028 CND(VDISCARD, "Discard pending")
1030 #ifndef VWERASE
1031 # define VWERASE -1
1032 #endif
1033 CND(VWERASE, "Word erase")
1035 #ifndef VLNEXT
1036 # define VLNEXT -1
1037 #endif
1038 CND(VLNEXT, "Literal next")
1040 #ifndef VEOL2
1041 # define VEOL2 -1
1042 #endif
1043 CND(VEOL2, "Alternative EOL")
1045 #endif /* HAVE_TERMIOS */
1047 #if defined(__MINGW32__) || defined(__CYGWIN__)
1048 CNU(DTR_CONTROL_ENABLE, "Enable DTR flow ctrl")
1049 CNU(RTS_CONTROL_ENABLE, "Enable RTS flow ctrl")
1050 #endif
1054 -----------------------------
1055 -- Pseudo terminal library --
1056 -----------------------------
1060 #if defined (__FreeBSD__) || defined (__linux__) || defined (__DragonFly__)
1061 # define PTY_Library "-lutil"
1062 #else
1063 # define PTY_Library ""
1064 #endif
1065 CST(PTY_Library, "for g-exptty")
1068 ** Sockets constants
1071 #ifdef HAVE_SOCKETS
1075 --------------
1076 -- Families --
1077 --------------
1081 #ifndef AF_INET
1082 # define AF_INET -1
1083 #endif
1084 CND(AF_INET, "IPv4 address family")
1086 #ifndef AF_INET6
1087 # define AF_INET6 -1
1088 #else
1089 # define HAVE_AF_INET6 1
1090 #endif
1091 CND(AF_INET6, "IPv6 address family")
1093 #ifndef AF_UNIX
1094 # define AF_UNIX -1
1095 #endif
1096 CND(AF_UNIX, "Local unix family")
1098 #ifndef AF_UNSPEC
1099 # define AF_UNSPEC -1
1100 #else
1101 # define HAVE_AF_UNSPEC 1
1102 #endif
1103 CND(AF_UNSPEC, "Unspecified address family")
1107 -----------------------------
1108 -- addrinfo fields offsets --
1109 -----------------------------
1113 #ifdef AI_CANONNAME
1114 const struct addrinfo ai;
1116 #define AI_FLAGS_OFFSET ((void *)&ai.ai_flags - (void *)&ai)
1117 #define AI_FAMILY_OFFSET ((void *)&ai.ai_family - (void *)&ai)
1118 #define AI_SOCKTYPE_OFFSET ((void *)&ai.ai_socktype - (void *)&ai)
1119 #define AI_PROTOCOL_OFFSET ((void *)&ai.ai_protocol - (void *)&ai)
1120 #define AI_ADDRLEN_OFFSET ((void *)&ai.ai_addrlen - (void *)&ai)
1121 #define AI_ADDR_OFFSET ((void *)&ai.ai_addr - (void *)&ai)
1122 #define AI_CANONNAME_OFFSET ((void *)&ai.ai_canonname - (void *)&ai)
1123 #define AI_NEXT_OFFSET ((void *)&ai.ai_next - (void *)&ai)
1125 #else
1127 #define AI_FLAGS_OFFSET 0
1128 #define AI_FAMILY_OFFSET 4
1129 #define AI_SOCKTYPE_OFFSET 8
1130 #define AI_PROTOCOL_OFFSET 12
1131 #define AI_ADDRLEN_OFFSET 16
1132 #define AI_CANONNAME_OFFSET 24
1133 #define AI_ADDR_OFFSET 32
1134 #define AI_NEXT_OFFSET 40
1136 #endif
1138 CND(AI_FLAGS_OFFSET, "Offset of ai_flags in addrinfo");
1139 CND(AI_FAMILY_OFFSET, "Offset of ai_family in addrinfo");
1140 CND(AI_SOCKTYPE_OFFSET, "Offset of ai_socktype in addrinfo");
1141 CND(AI_PROTOCOL_OFFSET, "Offset of ai_protocol in addrinfo");
1142 CND(AI_ADDRLEN_OFFSET, "Offset of ai_addrlen in addrinfo");
1143 CND(AI_ADDR_OFFSET, "Offset of ai_addr in addrinfo");
1144 CND(AI_CANONNAME_OFFSET, "Offset of ai_canonname in addrinfo");
1145 CND(AI_NEXT_OFFSET, "Offset of ai_next in addrinfo");
1149 ---------------------------------------
1150 -- getaddrinfo getnameinfo constants --
1151 ---------------------------------------
1155 #ifndef AI_PASSIVE
1156 # define AI_PASSIVE -1
1157 #endif
1158 CND(AI_PASSIVE, "NULL nodename for accepting")
1160 #ifndef AI_CANONNAME
1161 # define AI_CANONNAME -1
1162 #endif
1163 CND(AI_CANONNAME, "Get the host official name")
1165 #ifndef AI_NUMERICSERV
1166 # define AI_NUMERICSERV -1
1167 #endif
1168 CND(AI_NUMERICSERV, "Service is a numeric string")
1170 #ifndef AI_NUMERICHOST
1171 # define AI_NUMERICHOST -1
1172 #endif
1173 CND(AI_NUMERICHOST, "Node is a numeric IP address")
1175 #ifndef AI_ADDRCONFIG
1176 # define AI_ADDRCONFIG -1
1177 #endif
1178 CND(AI_ADDRCONFIG, "Returns addresses for only locally configured families")
1180 #ifndef AI_V4MAPPED
1181 # define AI_V4MAPPED -1
1182 #endif
1183 CND(AI_V4MAPPED, "Returns IPv4 mapped to IPv6")
1185 #ifndef AI_ALL
1186 # define AI_ALL -1
1187 #endif
1188 CND(AI_ALL, "Change AI_V4MAPPED behavior for unavailavle IPv6 addresses")
1190 #ifndef NI_NAMEREQD
1191 # define NI_NAMEREQD -1
1192 #endif
1193 CND(NI_NAMEREQD, "Error if the hostname cannot be determined")
1195 #ifndef NI_DGRAM
1196 # define NI_DGRAM -1
1197 #endif
1198 CND(NI_DGRAM, "Service is datagram")
1200 #ifndef NI_NOFQDN
1201 # define NI_NOFQDN -1
1202 #endif
1203 CND(NI_NOFQDN, "Return only the hostname part for local hosts")
1205 #ifndef NI_NUMERICSERV
1206 # define NI_NUMERICSERV -1
1207 #endif
1208 CND(NI_NUMERICSERV, "Numeric form of the service")
1210 #ifndef NI_NUMERICHOST
1211 # define NI_NUMERICHOST -1
1212 #endif
1213 CND(NI_NUMERICHOST, "Numeric form of the hostname")
1215 #ifndef NI_MAXHOST
1216 # define NI_MAXHOST -1
1217 #endif
1218 CND(NI_MAXHOST, "Maximum size of hostname")
1220 #ifndef NI_MAXSERV
1221 # define NI_MAXSERV -1
1222 #endif
1223 CND(NI_MAXSERV, "Maximum size of service name")
1225 #ifndef EAI_SYSTEM
1226 # define EAI_SYSTEM -1
1227 #endif
1228 CND(EAI_SYSTEM, "Check errno for details")
1232 ------------------
1233 -- Socket modes --
1234 ------------------
1238 #ifndef SOCK_STREAM
1239 # define SOCK_STREAM -1
1240 #endif
1241 CND(SOCK_STREAM, "Stream socket")
1243 #ifndef SOCK_DGRAM
1244 # define SOCK_DGRAM -1
1245 #endif
1246 CND(SOCK_DGRAM, "Datagram socket")
1248 #ifndef SOCK_RAW
1249 # define SOCK_RAW -1
1250 #endif
1251 CND(SOCK_RAW, "Raw socket")
1255 -----------------
1256 -- Host errors --
1257 -----------------
1261 #ifndef HOST_NOT_FOUND
1262 # define HOST_NOT_FOUND -1
1263 #endif
1264 CND(HOST_NOT_FOUND, "Unknown host")
1266 #ifndef TRY_AGAIN
1267 # define TRY_AGAIN -1
1268 #endif
1269 CND(TRY_AGAIN, "Host name lookup failure")
1271 #ifndef NO_DATA
1272 # define NO_DATA -1
1273 #endif
1274 CND(NO_DATA, "No data record for name")
1276 #ifndef NO_RECOVERY
1277 # define NO_RECOVERY -1
1278 #endif
1279 CND(NO_RECOVERY, "Non recoverable errors")
1283 --------------------
1284 -- Shutdown modes --
1285 --------------------
1289 #ifndef SHUT_RD
1290 # define SHUT_RD -1
1291 #endif
1292 CND(SHUT_RD, "No more recv")
1294 #ifndef SHUT_WR
1295 # define SHUT_WR -1
1296 #endif
1297 CND(SHUT_WR, "No more send")
1299 #ifndef SHUT_RDWR
1300 # define SHUT_RDWR -1
1301 #endif
1302 CND(SHUT_RDWR, "No more recv/send")
1306 ---------------------
1307 -- Protocol levels --
1308 ---------------------
1312 #ifndef SOL_SOCKET
1313 # define SOL_SOCKET -1
1314 #endif
1315 CND(SOL_SOCKET, "Options for socket level")
1317 #ifndef IPPROTO_IP
1318 # define IPPROTO_IP -1
1319 #endif
1320 CND(IPPROTO_IP, "Dummy protocol for IP")
1322 #ifndef IPPROTO_IPV6
1323 # define IPPROTO_IPV6 -1
1324 #endif
1325 CND(IPPROTO_IPV6, "IPv6 socket option level")
1327 #ifndef IPPROTO_UDP
1328 # define IPPROTO_UDP -1
1329 #endif
1330 CND(IPPROTO_UDP, "UDP")
1332 #ifndef IPPROTO_TCP
1333 # define IPPROTO_TCP -1
1334 #endif
1335 CND(IPPROTO_TCP, "TCP")
1337 #ifndef IPPROTO_ICMP
1338 # define IPPROTO_ICMP -1
1339 #endif
1340 CND(IPPROTO_ICMP, "Internet Control Message Protocol")
1342 #ifndef IPPROTO_IGMP
1343 # define IPPROTO_IGMP -1
1344 #endif
1345 CND(IPPROTO_IGMP, "Internet Group Management Protocol")
1347 #ifndef IPPROTO_IPIP
1348 # define IPPROTO_IPIP -1
1349 #endif
1350 CND(IPPROTO_IPIP, "IPIP tunnels (older KA9Q tunnels use 94)")
1352 #ifndef IPPROTO_EGP
1353 # define IPPROTO_EGP -1
1354 #endif
1355 CND(IPPROTO_EGP, "Exterior Gateway Protocol")
1357 #ifndef IPPROTO_PUP
1358 # define IPPROTO_PUP -1
1359 #endif
1360 CND(IPPROTO_PUP, "PUP protocol")
1362 #ifndef IPPROTO_IDP
1363 # define IPPROTO_IDP -1
1364 #endif
1365 CND(IPPROTO_IDP, "XNS IDP protocol")
1367 #ifndef IPPROTO_TP
1368 # define IPPROTO_TP -1
1369 #endif
1370 CND(IPPROTO_TP, "SO Transport Protocol Class 4")
1372 #ifndef IPPROTO_DCCP
1373 # define IPPROTO_DCCP -1
1374 #endif
1375 CND(IPPROTO_DCCP, "Datagram Congestion Control Protocol")
1377 #ifndef IPPROTO_RSVP
1378 # define IPPROTO_RSVP -1
1379 #endif
1380 CND(IPPROTO_RSVP, "Reservation Protocol")
1382 #ifndef IPPROTO_GRE
1383 # define IPPROTO_GRE -1
1384 #endif
1385 CND(IPPROTO_GRE, "General Routing Encapsulation")
1387 #ifndef IPPROTO_ESP
1388 # define IPPROTO_ESP -1
1389 #endif
1390 CND(IPPROTO_ESP, "encapsulating security payload")
1392 #ifndef IPPROTO_AH
1393 # define IPPROTO_AH -1
1394 #endif
1395 CND(IPPROTO_AH, "authentication header")
1397 #ifndef IPPROTO_MTP
1398 # define IPPROTO_MTP -1
1399 #endif
1400 CND(IPPROTO_MTP, "Multicast Transport Protocol")
1402 #ifndef IPPROTO_BEETPH
1403 # define IPPROTO_BEETPH -1
1404 #endif
1405 CND(IPPROTO_BEETPH, "IP option pseudo header for BEET")
1407 #ifndef IPPROTO_ENCAP
1408 # define IPPROTO_ENCAP -1
1409 #endif
1410 CND(IPPROTO_ENCAP, "Encapsulation Header")
1412 #ifndef IPPROTO_PIM
1413 # define IPPROTO_PIM -1
1414 #endif
1415 CND(IPPROTO_PIM, "Protocol Independent Multicast")
1417 #ifndef IPPROTO_COMP
1418 # define IPPROTO_COMP -1
1419 #endif
1420 CND(IPPROTO_COMP, "Compression Header Protocol")
1422 #ifndef IPPROTO_SCTP
1423 # define IPPROTO_SCTP -1
1424 #endif
1425 CND(IPPROTO_SCTP, "Stream Control Transmission Protocol")
1427 #ifndef IPPROTO_UDPLITE
1428 # define IPPROTO_UDPLITE -1
1429 #endif
1430 CND(IPPROTO_UDPLITE, "UDP-Lite protocol")
1432 #ifndef IPPROTO_MPLS
1433 # define IPPROTO_MPLS -1
1434 #endif
1435 CND(IPPROTO_MPLS, "MPLS in IP")
1437 #ifndef IPPROTO_RAW
1438 # define IPPROTO_RAW -1
1439 #endif
1440 CND(IPPROTO_RAW, "Raw IP packets")
1444 -------------------
1445 -- Request flags --
1446 -------------------
1450 #ifndef MSG_OOB
1451 # define MSG_OOB -1
1452 #endif
1453 CND(MSG_OOB, "Process out-of-band data")
1455 #ifndef MSG_PEEK
1456 # define MSG_PEEK -1
1457 #endif
1458 CND(MSG_PEEK, "Peek at incoming data")
1460 #ifndef MSG_EOR
1461 # define MSG_EOR -1
1462 #endif
1463 CND(MSG_EOR, "Send end of record")
1465 #ifndef MSG_WAITALL
1466 #ifdef __MINWGW32__
1467 /* The value of MSG_WAITALL is 8. Nevertheless winsock.h doesn't
1468 define it, but it is still usable as we link to winsock2 API. */
1469 # define MSG_WAITALL (1 << 3)
1470 #else
1471 # define MSG_WAITALL -1
1472 #endif
1473 #endif
1474 CND(MSG_WAITALL, "Wait for full reception")
1476 #ifndef MSG_NOSIGNAL
1477 # define MSG_NOSIGNAL -1
1478 #endif
1479 CND(MSG_NOSIGNAL, "No SIGPIPE on send")
1481 #if defined (__linux__) || defined (__ANDROID__) || defined (__QNX__)
1482 # define MSG_Forced_Flags "MSG_NOSIGNAL"
1483 #else
1484 # define MSG_Forced_Flags "0"
1485 #endif
1486 CNS(MSG_Forced_Flags, "")
1488 -- Flags set on all send(2) calls
1493 --------------------
1494 -- Socket options --
1495 --------------------
1499 #ifndef TCP_NODELAY
1500 # define TCP_NODELAY -1
1501 #endif
1502 CND(TCP_NODELAY, "Do not coalesce packets")
1504 #ifndef SO_REUSEADDR
1505 # define SO_REUSEADDR -1
1506 #endif
1507 CND(SO_REUSEADDR, "Bind reuse local address")
1509 #ifndef SO_REUSEPORT
1510 # define SO_REUSEPORT -1
1511 #endif
1512 CND(SO_REUSEPORT, "Bind reuse port number")
1514 #ifndef SO_KEEPALIVE
1515 # define SO_KEEPALIVE -1
1516 #endif
1517 CND(SO_KEEPALIVE, "Enable keep-alive msgs")
1519 #ifndef SO_LINGER
1520 # define SO_LINGER -1
1521 #endif
1522 CND(SO_LINGER, "Defer close to flush data")
1524 #ifndef SO_BROADCAST
1525 # define SO_BROADCAST -1
1526 #endif
1527 CND(SO_BROADCAST, "Can send broadcast msgs")
1529 #ifndef SO_SNDBUF
1530 # define SO_SNDBUF -1
1531 #endif
1532 CND(SO_SNDBUF, "Set/get send buffer size")
1534 #ifndef SO_RCVBUF
1535 # define SO_RCVBUF -1
1536 #endif
1537 CND(SO_RCVBUF, "Set/get recv buffer size")
1539 #ifndef SO_SNDTIMEO
1540 # define SO_SNDTIMEO -1
1541 #endif
1542 CND(SO_SNDTIMEO, "Emission timeout")
1544 #ifndef SO_RCVTIMEO
1545 # define SO_RCVTIMEO -1
1546 #endif
1547 CND(SO_RCVTIMEO, "Reception timeout")
1549 #ifndef SO_ERROR
1550 # define SO_ERROR -1
1551 #endif
1552 CND(SO_ERROR, "Get/clear error status")
1554 #ifndef SO_BUSY_POLL
1555 # define SO_BUSY_POLL -1
1556 #endif
1557 CND(SO_BUSY_POLL, "Busy polling")
1559 #ifndef IP_MULTICAST_IF
1560 # define IP_MULTICAST_IF -1
1561 #endif
1562 CND(IP_MULTICAST_IF, "Set/get mcast interface")
1564 #ifndef IP_MULTICAST_TTL
1565 # define IP_MULTICAST_TTL -1
1566 #endif
1567 CND(IP_MULTICAST_TTL, "Set/get multicast TTL")
1569 #ifndef IP_MULTICAST_LOOP
1570 # define IP_MULTICAST_LOOP -1
1571 #endif
1572 CND(IP_MULTICAST_LOOP, "Set/get mcast loopback")
1574 #ifndef IP_ADD_MEMBERSHIP
1575 # define IP_ADD_MEMBERSHIP -1
1576 #endif
1577 CND(IP_ADD_MEMBERSHIP, "Join a multicast group")
1579 #ifndef IP_DROP_MEMBERSHIP
1580 # define IP_DROP_MEMBERSHIP -1
1581 #endif
1582 CND(IP_DROP_MEMBERSHIP, "Leave a multicast group")
1584 #ifndef IP_PKTINFO
1585 # define IP_PKTINFO -1
1586 #endif
1587 CND(IP_PKTINFO, "Get datagram info")
1589 #ifndef IP_RECVERR
1590 # define IP_RECVERR -1
1591 #endif
1592 CND(IP_RECVERR, "Extended reliable error message passing")
1594 #ifndef IPV6_ADDRFORM
1595 # define IPV6_ADDRFORM -1
1596 #endif
1597 CND(IPV6_ADDRFORM, "Turn IPv6 socket into different address family")
1599 #ifndef IPV6_ADD_MEMBERSHIP
1600 # define IPV6_ADD_MEMBERSHIP -1
1601 #endif
1602 CND(IPV6_ADD_MEMBERSHIP, "Join IPv6 multicast group")
1604 #ifndef IPV6_DROP_MEMBERSHIP
1605 # define IPV6_DROP_MEMBERSHIP -1
1606 #endif
1607 CND(IPV6_DROP_MEMBERSHIP, "Leave IPv6 multicast group")
1609 #ifndef IPV6_MTU
1610 # define IPV6_MTU -1
1611 #endif
1612 CND(IPV6_MTU, "Set/get MTU used for the socket")
1614 #ifndef IPV6_MTU_DISCOVER
1615 # define IPV6_MTU_DISCOVER -1
1616 #endif
1617 CND(IPV6_MTU_DISCOVER, "Control path-MTU discovery on the socket")
1619 #ifndef IPV6_MULTICAST_HOPS
1620 # define IPV6_MULTICAST_HOPS -1
1621 #endif
1622 CND(IPV6_MULTICAST_HOPS, "Set the multicast hop limit for the socket")
1624 #ifndef IPV6_MULTICAST_IF
1625 # define IPV6_MULTICAST_IF -1
1626 #endif
1627 CND(IPV6_MULTICAST_IF, "Set/get IPv6 mcast interface")
1629 #ifndef IPV6_MULTICAST_LOOP
1630 # define IPV6_MULTICAST_LOOP -1
1631 #endif
1632 CND(IPV6_MULTICAST_LOOP, "Set/get mcast loopback")
1634 #ifndef IPV6_RECVPKTINFO
1635 # define IPV6_RECVPKTINFO -1
1636 #endif
1637 CND(IPV6_RECVPKTINFO, "Set delivery of the IPV6_PKTINFO")
1639 #ifndef IPV6_PKTINFO
1640 # define IPV6_PKTINFO -1
1641 #endif
1642 CND(IPV6_PKTINFO, "Get IPv6datagram info")
1644 #ifndef IPV6_RTHDR
1645 # define IPV6_RTHDR -1
1646 #endif
1647 CND(IPV6_RTHDR, "Set the routing header delivery")
1649 #ifndef IPV6_AUTHHDR
1650 # define IPV6_AUTHHDR -1
1651 #endif
1652 CND(IPV6_AUTHHDR, "Set the authentication header delivery")
1654 #ifndef IPV6_DSTOPTS
1655 # define IPV6_DSTOPTS -1
1656 #endif
1657 CND(IPV6_DSTOPTS, "Set the destination options delivery")
1659 #ifndef IPV6_HOPOPTS
1660 # define IPV6_HOPOPTS -1
1661 #endif
1662 CND(IPV6_HOPOPTS, "Set the hop options delivery")
1664 #ifndef IPV6_FLOWINFO
1665 # define IPV6_FLOWINFO -1
1666 #endif
1667 CND(IPV6_FLOWINFO, "Set the flow ID delivery")
1669 #ifndef IPV6_HOPLIMIT
1670 # define IPV6_HOPLIMIT -1
1671 #endif
1672 CND(IPV6_HOPLIMIT, "Set the hop count of the packet delivery")
1674 #ifndef IPV6_RECVERR
1675 # define IPV6_RECVERR -1
1676 #endif
1677 CND(IPV6_RECVERR, "Extended reliable error message passing")
1679 #ifndef IPV6_ROUTER_ALERT
1680 # define IPV6_ROUTER_ALERT -1
1681 #endif
1682 CND(IPV6_ROUTER_ALERT, "Pass forwarded router alert hop-by-hop option")
1684 #ifndef IPV6_UNICAST_HOPS
1685 # define IPV6_UNICAST_HOPS -1
1686 #endif
1687 CND(IPV6_UNICAST_HOPS, "Set the unicast hop limit")
1689 #ifndef IPV6_V6ONLY
1690 # define IPV6_V6ONLY -1
1691 #endif
1692 CND(IPV6_V6ONLY, "Restricted to IPv6 communications only")
1696 ----------------------
1697 -- Type definitions --
1698 ----------------------
1703 struct timeval tv;
1705 -- Sizes (in bytes) of the components of struct timeval
1707 #define SIZEOF_tv_sec (sizeof tv.tv_sec)
1708 CND(SIZEOF_tv_sec, "tv_sec")
1709 #define SIZEOF_tv_usec (sizeof tv.tv_usec)
1710 CND(SIZEOF_tv_usec, "tv_usec")
1713 -- Maximum allowed value for tv_sec
1717 ** On Solaris, field tv_sec in struct timeval has an undocumented
1718 ** hard-wired limit of 100 million.
1719 ** On IA64 HP-UX the limit is 2**31 - 1.
1721 #if defined (__sun__)
1722 # define MAX_tv_sec "100_000_000"
1724 #elif defined (__hpux__)
1725 # define MAX_tv_sec "16#7fffffff#"
1727 #else
1728 # define MAX_tv_sec "2 ** (SIZEOF_tv_sec * 8 - 1) - 1"
1729 #endif
1730 CNS(MAX_tv_sec, "")
1734 -- Sizes of various data types
1737 #define SIZEOF_sockaddr_in (sizeof (struct sockaddr_in))
1738 CND(SIZEOF_sockaddr_in, "struct sockaddr_in")
1739 #ifdef HAVE_AF_INET6
1740 # define SIZEOF_sockaddr_in6 (sizeof (struct sockaddr_in6))
1741 #else
1742 # define SIZEOF_sockaddr_in6 0
1743 #endif
1744 CND(SIZEOF_sockaddr_in6, "struct sockaddr_in6")
1747 ** The sockaddr_un structure is not defined in MINGW C headers
1748 ** but Windows supports it from build 17063.
1750 #if defined(__MINGW32__)
1751 struct sockaddr_un {
1752 ADDRESS_FAMILY sun_family; /* AF_UNIX */
1753 char sun_path[108]; /* Pathname */
1755 #endif
1756 #define SIZEOF_sockaddr_un (sizeof (struct sockaddr_un))
1757 CND(SIZEOF_sockaddr_un, "struct sockaddr_un")
1759 #define SIZEOF_fd_set (sizeof (fd_set))
1760 CND(SIZEOF_fd_set, "fd_set")
1761 CND(FD_SETSIZE, "Max fd value")
1763 #define SIZEOF_struct_hostent (sizeof (struct hostent))
1764 CND(SIZEOF_struct_hostent, "struct hostent")
1766 #define SIZEOF_struct_servent (sizeof (struct servent))
1767 CND(SIZEOF_struct_servent, "struct servent")
1769 #if defined (__linux__) || defined (__ANDROID__) || defined (__QNX__)
1770 #define SIZEOF_sigset (sizeof (sigset_t))
1771 CND(SIZEOF_sigset, "sigset")
1772 #endif
1774 #if defined(_WIN32) || defined(__vxworks)
1775 #define SIZEOF_nfds_t sizeof (int) * 8
1776 #define SIZEOF_socklen_t sizeof (size_t)
1777 #elif defined(__Lynx__)
1778 #define SIZEOF_nfds_t sizeof (unsigned long int) * 8
1779 #define SIZEOF_socklen_t sizeof (socklen_t)
1780 #else
1781 #define SIZEOF_nfds_t sizeof (nfds_t) * 8
1782 #define SIZEOF_socklen_t sizeof (socklen_t)
1783 #endif
1784 CND(SIZEOF_nfds_t, "Size of nfds_t");
1785 CND(SIZEOF_socklen_t, "Size of socklen_t");
1788 #if defined(__vxworks)
1789 #define SIZEOF_fd_type sizeof (int) * 8
1790 #define SIZEOF_pollfd_events sizeof (short) * 8
1791 #else
1792 const struct pollfd v_pollfd;
1793 #define SIZEOF_fd_type sizeof (v_pollfd.fd) * 8
1794 #define SIZEOF_pollfd_events sizeof (v_pollfd.events) * 8
1795 #endif
1796 CND(SIZEOF_fd_type, "Size of socket fd");
1797 CND(SIZEOF_pollfd_events, "Size of pollfd.events");
1800 #ifndef IF_NAMESIZE
1801 #ifdef IF_MAX_STRING_SIZE
1802 #define IF_NAMESIZE IF_MAX_STRING_SIZE
1803 #else
1804 #define IF_NAMESIZE -1
1805 #endif
1806 #endif
1807 CND(IF_NAMESIZE, "Max size of interface name with 0 terminator");
1811 -- Poll values
1815 #if defined(__vxworks)
1816 #ifndef POLLIN
1817 #define POLLIN 1
1818 #endif
1820 #ifndef POLLPRI
1821 #define POLLPRI 2
1822 #endif
1824 #ifndef POLLOUT
1825 #define POLLOUT 4
1826 #endif
1828 #ifndef POLLERR
1829 #define POLLERR 8
1830 #endif
1832 #ifndef POLLHUP
1833 #define POLLHUP 16
1834 #endif
1836 #ifndef POLLNVAL
1837 #define POLLNVAL 32
1838 #endif
1840 #elif defined(_WIN32)
1841 #define POLLPRI 0
1842 /* If the POLLPRI flag is set on a socket for the Microsoft Winsock provider,
1843 * the WSAPoll function will fail. */
1844 #endif
1846 CND(POLLIN, "There is data to read");
1847 CND(POLLPRI, "Urgent data to read");
1848 CND(POLLOUT, "Writing will not block");
1849 CND(POLLERR, "Error (output only)");
1850 CND(POLLHUP, "Hang up (output only)");
1851 CND(POLLNVAL, "Invalid request");
1855 -- Fields of struct msghdr
1858 #if defined (__sun__) || defined (__hpux__)
1859 # define Msg_Iovlen_T "Interfaces.C.int"
1860 #else
1861 # define Msg_Iovlen_T "Interfaces.C.size_t"
1862 #endif
1864 SUB(Msg_Iovlen_T)
1868 ----------------------------------------
1869 -- Properties of supported interfaces --
1870 ----------------------------------------
1874 CND(Need_Netdb_Buffer, "Need buffer for Netdb ops")
1875 CND(Need_Netdb_Lock, "Need lock for Netdb ops")
1876 CND(Has_Sockaddr_Len, "Sockaddr has sa_len field")
1879 ** Do not change the format of the line below without also updating the
1880 ** MaRTE Makefile.
1882 C("Thread_Blocking_IO", Boolean, "True", "")
1884 -- Set False for contexts where socket i/o are process blocking
1888 #ifdef HAVE_INET_PTON
1889 # define Inet_Pton_Linkname "inet_pton"
1890 #else
1891 # define Inet_Pton_Linkname "__gnat_inet_pton"
1892 #endif
1893 CST(Inet_Pton_Linkname, "")
1895 #ifdef HAVE_INET_NTOP
1896 # define Inet_Ntop_Linkname "inet_ntop"
1897 #else
1898 # define Inet_Ntop_Linkname "__gnat_inet_ntop"
1899 #endif
1900 CST(Inet_Ntop_Linkname, "")
1902 #if defined(_WIN32)
1903 # define Poll_Linkname "WSAPoll"
1904 #else
1905 # define Poll_Linkname "poll"
1906 #endif
1907 CST(Poll_Linkname, "")
1909 #endif /* HAVE_SOCKETS */
1913 ---------------------
1914 -- Threads support --
1915 ---------------------
1917 -- Clock identifier definitions
1921 /* Note: On HP-UX, CLOCK_REALTIME is an enum, not a macro. */
1923 #if !(defined(CLOCK_REALTIME) || defined (__hpux__))
1924 # define CLOCK_REALTIME (-1)
1925 #endif
1926 CND(CLOCK_REALTIME, "System realtime clock")
1928 #ifdef CLOCK_MONOTONIC
1929 CND(CLOCK_MONOTONIC, "System monotonic clock")
1930 #endif
1932 #ifdef CLOCK_FASTEST
1933 CND(CLOCK_FASTEST, "Fastest clock")
1934 #endif
1936 #ifndef CLOCK_THREAD_CPUTIME_ID
1937 # define CLOCK_THREAD_CPUTIME_ID -1
1938 #endif
1939 CND(CLOCK_THREAD_CPUTIME_ID, "Thread CPU clock")
1941 #if defined(__linux__) || defined(__FreeBSD__) \
1942 || (defined(_AIX) && defined(_AIXVERSION_530)) \
1943 || defined(__DragonFly__) || defined(__QNX__)
1944 /** On these platforms use system provided monotonic clock instead of
1945 ** the default CLOCK_REALTIME. We then need to set up cond var attributes
1946 ** appropriately (see thread.c).
1948 ** Note that AIX 5.2 does not support CLOCK_MONOTONIC timestamps for
1949 ** pthread_cond_timedwait (and does not have pthread_condattr_setclock),
1950 ** hence the conditionalization on AIX version above). _AIXVERSION_530
1951 ** is defined in AIX 5.3 and more recent versions.
1953 # define CLOCK_RT_Ada "CLOCK_MONOTONIC"
1955 #else
1956 /* By default use CLOCK_REALTIME */
1957 # define CLOCK_RT_Ada "CLOCK_REALTIME"
1958 #endif
1960 #ifdef CLOCK_RT_Ada
1961 CNS(CLOCK_RT_Ada, "")
1962 #endif
1964 #if defined (__APPLE__) || defined (__linux__) || defined (__ANDROID__) \
1965 || defined (__QNX__) || defined (__rtems__) || defined (DUMMY)
1968 -- Sizes of pthread data types
1971 #if defined (__APPLE__) || defined (DUMMY)
1973 -- (on Darwin, these are just placeholders)
1975 #define PTHREAD_SIZE __PTHREAD_SIZE__
1976 #define PTHREAD_ATTR_SIZE __PTHREAD_ATTR_SIZE__
1977 #define PTHREAD_MUTEXATTR_SIZE __PTHREAD_MUTEXATTR_SIZE__
1978 #define PTHREAD_MUTEX_SIZE __PTHREAD_MUTEX_SIZE__
1979 #define PTHREAD_CONDATTR_SIZE __PTHREAD_CONDATTR_SIZE__
1980 #define PTHREAD_COND_SIZE __PTHREAD_COND_SIZE__
1981 #define PTHREAD_RWLOCKATTR_SIZE __PTHREAD_RWLOCKATTR_SIZE__
1982 #define PTHREAD_RWLOCK_SIZE __PTHREAD_RWLOCK_SIZE__
1983 #define PTHREAD_ONCE_SIZE __PTHREAD_ONCE_SIZE__
1984 #else
1985 #define PTHREAD_SIZE (sizeof (pthread_t))
1986 #define PTHREAD_ATTR_SIZE (sizeof (pthread_attr_t))
1987 #define PTHREAD_MUTEXATTR_SIZE (sizeof (pthread_mutexattr_t))
1988 #define PTHREAD_MUTEX_SIZE (sizeof (pthread_mutex_t))
1989 #define PTHREAD_CONDATTR_SIZE (sizeof (pthread_condattr_t))
1990 #define PTHREAD_COND_SIZE (sizeof (pthread_cond_t))
1991 #define PTHREAD_RWLOCKATTR_SIZE (sizeof (pthread_rwlockattr_t))
1992 #define PTHREAD_RWLOCK_SIZE (sizeof (pthread_rwlock_t))
1993 #define PTHREAD_ONCE_SIZE (sizeof (pthread_once_t))
1994 #endif
1998 CND(PTHREAD_SIZE, "pthread_t")
1999 CND(PTHREAD_ATTR_SIZE, "pthread_attr_t")
2000 CND(PTHREAD_MUTEXATTR_SIZE, "pthread_mutexattr_t")
2001 CND(PTHREAD_MUTEX_SIZE, "pthread_mutex_t")
2002 CND(PTHREAD_CONDATTR_SIZE, "pthread_condattr_t")
2003 CND(PTHREAD_COND_SIZE, "pthread_cond_t")
2004 CND(PTHREAD_RWLOCKATTR_SIZE, "pthread_rwlockattr_t")
2005 CND(PTHREAD_RWLOCK_SIZE, "pthread_rwlock_t")
2006 CND(PTHREAD_ONCE_SIZE, "pthread_once_t")
2008 #endif /* __APPLE__ || __linux__ || __ANDROID__ || __rtems__ */
2012 --------------------------------
2013 -- File and directory support --
2014 --------------------------------
2019 ** Note: this constant can be used in the GNAT runtime library. In compiler
2020 ** units on the other hand, System.OS_Constants is not available, so we
2021 ** declare an Ada constant (Osint.File_Attributes_Size) independently, which
2022 ** is at least as large as sizeof (struct file_attributes), and we have an
2023 ** assertion at initialization of Osint checking that the size is indeed at
2024 ** least sufficient.
2026 #define SIZEOF_struct_file_attributes (sizeof (struct file_attributes))
2027 CND(SIZEOF_struct_file_attributes, "struct file_attributes")
2030 ** Maximal size of buffer for struct dirent. Note: Since POSIX.1 does not
2031 ** specify the size of the d_name field, and other nonstandard fields may
2032 ** precede that field within the dirent structure, we must make a conservative
2033 ** computation.
2036 struct dirent dent;
2037 #define SIZEOF_struct_dirent_alloc \
2038 ((char*) &dent.d_name - (char*) &dent) + NAME_MAX + 1
2039 CND(SIZEOF_struct_dirent_alloc, "struct dirent allocation")
2043 ** System-specific constants follow
2044 ** Each section should be activated if compiling for the corresponding
2045 ** platform *or* generating the dummy version for runtime test compilation.
2048 #if defined (__vxworks) || defined (DUMMY)
2052 --------------------------------
2053 -- VxWorks-specific constants --
2054 --------------------------------
2056 -- These constants may be used only within the VxWorks version of
2057 -- GNAT.Sockets.Thin.
2060 CND(OK, "VxWorks generic success")
2061 CND(ERROR, "VxWorks generic error")
2063 #endif /* __vxworks */
2065 #if defined (__MINGW32__) || defined (DUMMY)
2068 ------------------------------
2069 -- MinGW-specific constants --
2070 ------------------------------
2072 -- These constants may be used only within the MinGW version of
2073 -- GNAT.Sockets.Thin.
2076 CND(WSASYSNOTREADY, "System not ready")
2077 CND(WSAVERNOTSUPPORTED, "Version not supported")
2078 CND(WSANOTINITIALISED, "Winsock not initialized")
2079 CND(WSAEDISCON, "Disconnected")
2081 #endif /* __MINGW32__ */
2084 ** End of constants definitions
2087 #ifdef NATIVE
2088 putchar ('\n');
2089 #endif
2093 end System.OS_Constants;