cfgloopmanip.c (copy_loop_info): New function.
[official-gcc.git] / gcc / ada / s-oscons-tmplt.c
blob50a55e43d231f493c0efc070b5853896a5975f37
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-2012, 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 #if defined (__linux__) && !defined (_XOPEN_SOURCE)
84 /** For Linux _XOPEN_SOURCE must be defined, otherwise IOV_MAX is not defined
85 **/
86 #define _XOPEN_SOURCE 500
87 #endif
89 /* Include gsocket.h before any system header so it can redefine FD_SETSIZE */
91 #include "gsocket.h"
93 #include <stdlib.h>
94 #include <string.h>
95 #include <limits.h>
96 #include <fcntl.h>
97 #include <time.h>
99 #if defined (__VMS)
100 /** VMS is unable to do vector IO operations with default value of IOV_MAX,
101 ** so its value is redefined to a small one which is known to work properly.
103 #undef IOV_MAX
104 #define IOV_MAX 16
105 #endif
107 #if ! (defined (__vxworks) || defined (__VMS) || defined (__MINGW32__) || \
108 defined (__nucleus__))
109 # define HAVE_TERMIOS
110 #endif
112 #if defined (__vxworks)
115 ** For VxWorks, always include vxWorks.h (gsocket.h provides it only for
116 ** the case of runtime libraries that support sockets).
119 # include <vxWorks.h>
120 #endif
122 #ifdef DUMMY
124 # if defined (TARGET)
125 # error TARGET may not be defined when generating the dummy version
126 # else
127 # define TARGET "batch runtime compilation (dummy values)"
128 # endif
130 # if !(defined (HAVE_SOCKETS) && defined (HAVE_TERMIOS))
131 # error Features missing on platform
132 # endif
134 # define NATIVE
136 #endif /* DUMMY */
138 #ifndef TARGET
139 # error Please define TARGET
140 #endif
142 #ifndef HAVE_SOCKETS
143 # include <errno.h>
144 #endif
146 #ifdef HAVE_TERMIOS
147 # include <termios.h>
148 #endif
150 #ifdef __APPLE__
151 # include <_types.h>
152 #endif
154 #ifdef __linux__
155 # include <pthread.h>
156 # include <signal.h>
157 #endif
159 #ifdef __MINGW32__
160 # include <winbase.h>
161 #endif
163 #ifdef NATIVE
164 #include <stdio.h>
166 #ifdef DUMMY
167 int counter = 0;
168 # define _VAL(x) counter++
169 #else
170 # define _VAL(x) x
171 #endif
173 #define CND(name,comment) \
174 printf ("\n->CND:$%d:" #name ":$%d:" comment, __LINE__, ((int) _VAL (name)));
176 #define CNU(name,comment) \
177 printf ("\n->CNU:$%d:" #name ":$%u:" comment, __LINE__, ((unsigned int) _VAL (name)));
179 #define CNS(name,comment) \
180 printf ("\n->CNS:$%d:" #name ":" name ":" comment, __LINE__);
182 #define C(sname,type,value,comment)\
183 printf ("\n->C:$%d:" sname ":" #type ":" value ":" comment, __LINE__);
185 #define TXT(text) \
186 printf ("\n->TXT:$%d:" text, __LINE__);
188 #else
190 #define CND(name, comment) \
191 asm volatile("\n->CND:%0:" #name ":%1:" comment \
192 : : "i" (__LINE__), "i" ((int) name));
193 /* Decimal constant in the range of type "int" */
195 #define CNU(name, comment) \
196 asm volatile("\n->CNU:%0:" #name ":%1:" comment \
197 : : "i" (__LINE__), "i" ((int) name));
198 /* Decimal constant in the range of type "unsigned int" (note, assembler
199 * always wants a signed int, we convert back in xoscons).
202 #define CNS(name, comment) \
203 asm volatile("\n->CNS:%0:" #name ":" name ":" comment \
204 : : "i" (__LINE__));
205 /* General expression named number */
207 #define C(sname, type, value, comment) \
208 asm volatile("\n->C:%0:" sname ":" #type ":" value ":" comment \
209 : : "i" (__LINE__));
210 /* Typed constant */
212 #define TXT(text) \
213 asm volatile("\n->TXT:%0:" text \
214 : : "i" (__LINE__));
215 /* Freeform text */
217 #endif /* NATIVE */
219 #define CST(name,comment) C(#name,String,name,comment)
221 #define STR(x) STR1(x)
222 #define STR1(x) #x
224 #ifdef __MINGW32__
225 unsigned int _CRT_fmode = _O_BINARY;
226 #endif
229 main (void) {
232 -- This package provides target dependent definitions of constant for use
233 -- by the GNAT runtime library. This package should not be directly with'd
234 -- by an application program.
236 -- This file is generated automatically, do not modify it by hand! Instead,
237 -- make changes to s-oscons-tmplt.c and rebuild the GNAT runtime library.
241 ** Do not change the format of the line below without also updating the
242 ** MaRTE Makefile.
244 TXT("-- This is the version for " TARGET)
245 TXT("")
247 #ifdef HAVE_SOCKETS
249 ** The type definitions for struct hostent components uses Interfaces.C
252 TXT("with Interfaces.C;")
253 #endif
256 package System.OS_Constants is
258 pragma Pure;
262 ** General constants (all platforms)
267 ---------------------------------
268 -- General platform parameters --
269 ---------------------------------
271 type OS_Type is (Windows, VMS, Other_OS);
273 #if defined (__MINGW32__)
274 # define TARGET_OS "Windows"
275 #elif defined (__VMS)
276 # define TARGET_OS "VMS"
277 #else
278 # define TARGET_OS "Other_OS"
279 #endif
280 C("Target_OS", OS_Type, TARGET_OS, "")
282 pragma Warnings (Off, Target_OS);
283 -- Suppress warnings on Target_OS since it is in general tested for
284 -- equality with a constant value to implement conditional compilation,
285 -- which normally generates a constant condition warning.
288 #define Target_Name TARGET
289 CST(Target_Name, "")
292 ** Note: the name of the following constant is recognized specially by
293 ** xoscons (case sensitive).
295 #define SIZEOF_unsigned_int sizeof (unsigned int)
296 CND(SIZEOF_unsigned_int, "Size of unsigned int")
300 -------------------
301 -- System limits --
302 -------------------
306 #ifndef IOV_MAX
307 # define IOV_MAX INT_MAX
308 #endif
309 CND(IOV_MAX, "Maximum writev iovcnt")
313 ---------------------
314 -- File open modes --
315 ---------------------
319 #ifndef O_RDWR
320 # define O_RDWR -1
321 #endif
322 CND(O_RDWR, "Read/write")
324 #ifndef O_NOCTTY
325 # define O_NOCTTY -1
326 #endif
327 CND(O_NOCTTY, "Don't change ctrl tty")
329 #ifndef O_NDELAY
330 # define O_NDELAY -1
331 #endif
332 CND(O_NDELAY, "Nonblocking")
336 ----------------------
337 -- Fcntl operations --
338 ----------------------
342 #ifndef F_GETFL
343 # define F_GETFL -1
344 #endif
345 CND(F_GETFL, "Get flags")
347 #ifndef F_SETFL
348 # define F_SETFL -1
349 #endif
350 CND(F_SETFL, "Set flags")
354 -----------------
355 -- Fcntl flags --
356 -----------------
360 #ifndef FNDELAY
361 # define FNDELAY -1
362 #endif
363 CND(FNDELAY, "Nonblocking")
367 ----------------------
368 -- Ioctl operations --
369 ----------------------
373 #ifndef FIONBIO
374 # define FIONBIO -1
375 #endif
376 CND(FIONBIO, "Set/clear non-blocking io")
378 #ifndef FIONREAD
379 # define FIONREAD -1
380 #endif
381 CND(FIONREAD, "How many bytes to read")
385 ------------------
386 -- Errno values --
387 ------------------
389 -- The following constants are defined from <errno.h>
392 #ifndef EAGAIN
393 # define EAGAIN -1
394 #endif
395 CND(EAGAIN, "Try again")
397 #ifndef ENOENT
398 # define ENOENT -1
399 #endif
400 CND(ENOENT, "File not found")
402 #ifndef ENOMEM
403 # define ENOMEM -1
404 #endif
405 CND(ENOMEM, "Out of memory")
407 #ifdef __MINGW32__
410 -- The following constants are defined from <winsock2.h> (WSA*)
415 ** For sockets-related errno values on Windows, gsocket.h redefines
416 ** Exxx as WSAExxx.
419 #endif
421 #ifndef EACCES
422 # define EACCES -1
423 #endif
424 CND(EACCES, "Permission denied")
426 #ifndef EADDRINUSE
427 # define EADDRINUSE -1
428 #endif
429 CND(EADDRINUSE, "Address already in use")
431 #ifndef EADDRNOTAVAIL
432 # define EADDRNOTAVAIL -1
433 #endif
434 CND(EADDRNOTAVAIL, "Cannot assign address")
436 #ifndef EAFNOSUPPORT
437 # define EAFNOSUPPORT -1
438 #endif
439 CND(EAFNOSUPPORT, "Addr family not supported")
441 #ifndef EALREADY
442 # define EALREADY -1
443 #endif
444 CND(EALREADY, "Operation in progress")
446 #ifndef EBADF
447 # define EBADF -1
448 #endif
449 CND(EBADF, "Bad file descriptor")
451 #ifndef ECONNABORTED
452 # define ECONNABORTED -1
453 #endif
454 CND(ECONNABORTED, "Connection aborted")
456 #ifndef ECONNREFUSED
457 # define ECONNREFUSED -1
458 #endif
459 CND(ECONNREFUSED, "Connection refused")
461 #ifndef ECONNRESET
462 # define ECONNRESET -1
463 #endif
464 CND(ECONNRESET, "Connection reset by peer")
466 #ifndef EDESTADDRREQ
467 # define EDESTADDRREQ -1
468 #endif
469 CND(EDESTADDRREQ, "Destination addr required")
471 #ifndef EFAULT
472 # define EFAULT -1
473 #endif
474 CND(EFAULT, "Bad address")
476 #ifndef EHOSTDOWN
477 # define EHOSTDOWN -1
478 #endif
479 CND(EHOSTDOWN, "Host is down")
481 #ifndef EHOSTUNREACH
482 # define EHOSTUNREACH -1
483 #endif
484 CND(EHOSTUNREACH, "No route to host")
486 #ifndef EINPROGRESS
487 # define EINPROGRESS -1
488 #endif
489 CND(EINPROGRESS, "Operation now in progress")
491 #ifndef EINTR
492 # define EINTR -1
493 #endif
494 CND(EINTR, "Interrupted system call")
496 #ifndef EINVAL
497 # define EINVAL -1
498 #endif
499 CND(EINVAL, "Invalid argument")
501 #ifndef EIO
502 # define EIO -1
503 #endif
504 CND(EIO, "Input output error")
506 #ifndef EISCONN
507 # define EISCONN -1
508 #endif
509 CND(EISCONN, "Socket already connected")
511 #ifndef ELOOP
512 # define ELOOP -1
513 #endif
514 CND(ELOOP, "Too many symbolic links")
516 #ifndef EMFILE
517 # define EMFILE -1
518 #endif
519 CND(EMFILE, "Too many open files")
521 #ifndef EMSGSIZE
522 # define EMSGSIZE -1
523 #endif
524 CND(EMSGSIZE, "Message too long")
526 #ifndef ENAMETOOLONG
527 # define ENAMETOOLONG -1
528 #endif
529 CND(ENAMETOOLONG, "Name too long")
531 #ifndef ENETDOWN
532 # define ENETDOWN -1
533 #endif
534 CND(ENETDOWN, "Network is down")
536 #ifndef ENETRESET
537 # define ENETRESET -1
538 #endif
539 CND(ENETRESET, "Disconn. on network reset")
541 #ifndef ENETUNREACH
542 # define ENETUNREACH -1
543 #endif
544 CND(ENETUNREACH, "Network is unreachable")
546 #ifndef ENOBUFS
547 # define ENOBUFS -1
548 #endif
549 CND(ENOBUFS, "No buffer space available")
551 #ifndef ENOPROTOOPT
552 # define ENOPROTOOPT -1
553 #endif
554 CND(ENOPROTOOPT, "Protocol not available")
556 #ifndef ENOTCONN
557 # define ENOTCONN -1
558 #endif
559 CND(ENOTCONN, "Socket not connected")
561 #ifndef ENOTSOCK
562 # define ENOTSOCK -1
563 #endif
564 CND(ENOTSOCK, "Operation on non socket")
566 #ifndef EOPNOTSUPP
567 # define EOPNOTSUPP -1
568 #endif
569 CND(EOPNOTSUPP, "Operation not supported")
571 #ifndef EPIPE
572 # define EPIPE -1
573 #endif
574 CND(EPIPE, "Broken pipe")
576 #ifndef EPFNOSUPPORT
577 # define EPFNOSUPPORT -1
578 #endif
579 CND(EPFNOSUPPORT, "Unknown protocol family")
581 #ifndef EPROTONOSUPPORT
582 # define EPROTONOSUPPORT -1
583 #endif
584 CND(EPROTONOSUPPORT, "Unknown protocol")
586 #ifndef EPROTOTYPE
587 # define EPROTOTYPE -1
588 #endif
589 CND(EPROTOTYPE, "Unknown protocol type")
591 #ifndef ERANGE
592 # define ERANGE -1
593 #endif
594 CND(ERANGE, "Result too large")
596 #ifndef ESHUTDOWN
597 # define ESHUTDOWN -1
598 #endif
599 CND(ESHUTDOWN, "Cannot send once shutdown")
601 #ifndef ESOCKTNOSUPPORT
602 # define ESOCKTNOSUPPORT -1
603 #endif
604 CND(ESOCKTNOSUPPORT, "Socket type not supported")
606 #ifndef ETIMEDOUT
607 # define ETIMEDOUT -1
608 #endif
609 CND(ETIMEDOUT, "Connection timed out")
611 #ifndef ETOOMANYREFS
612 # define ETOOMANYREFS -1
613 #endif
614 CND(ETOOMANYREFS, "Too many references")
616 #ifndef EWOULDBLOCK
617 # define EWOULDBLOCK -1
618 #endif
619 CND(EWOULDBLOCK, "Operation would block")
621 #ifndef E2BIG
622 # define E2BIG -1
623 #endif
624 CND(E2BIG, "Argument list too long")
626 #ifndef EILSEQ
627 # define EILSEQ -1
628 #endif
629 CND(EILSEQ, "Illegal byte sequence")
632 ** Terminal/serial I/O constants
635 #if defined(HAVE_TERMIOS) || defined(__MINGW32__)
638 ----------------------
639 -- Terminal control --
640 ----------------------
643 #endif
645 #ifdef HAVE_TERMIOS
647 #ifndef TCSANOW
648 # define TCSANOW -1
649 #endif
650 CND(TCSANOW, "Immediate")
652 #ifndef TCIFLUSH
653 # define TCIFLUSH -1
654 #endif
655 CND(TCIFLUSH, "Flush input")
657 #ifndef IXON
658 # define IXON -1
659 #endif
660 CNU(IXON, "Output sw flow control")
662 #ifndef CLOCAL
663 # define CLOCAL -1
664 #endif
665 CNU(CLOCAL, "Local")
667 #ifndef CRTSCTS
668 # define CRTSCTS -1
669 #endif
670 CNU(CRTSCTS, "Output hw flow control")
672 #ifndef CREAD
673 # define CREAD -1
674 #endif
675 CNU(CREAD, "Read")
677 #ifndef CS5
678 # define CS5 -1
679 #endif
680 CNU(CS5, "5 data bits")
682 #ifndef CS6
683 # define CS6 -1
684 #endif
685 CNU(CS6, "6 data bits")
687 #ifndef CS7
688 # define CS7 -1
689 #endif
690 CNU(CS7, "7 data bits")
692 #ifndef CS8
693 # define CS8 -1
694 #endif
695 CNU(CS8, "8 data bits")
697 #ifndef CSTOPB
698 # define CSTOPB -1
699 #endif
700 CNU(CSTOPB, "2 stop bits")
702 #ifndef PARENB
703 # define PARENB -1
704 #endif
705 CNU(PARENB, "Parity enable")
707 #ifndef PARODD
708 # define PARODD -1
709 #endif
710 CNU(PARODD, "Parity odd")
712 #ifndef B0
713 # define B0 -1
714 #endif
715 CNU(B0, "0 bps")
717 #ifndef B50
718 # define B50 -1
719 #endif
720 CNU(B50, "50 bps")
722 #ifndef B75
723 # define B75 -1
724 #endif
725 CNU(B75, "75 bps")
727 #ifndef B110
728 # define B110 -1
729 #endif
730 CNU(B110, "110 bps")
732 #ifndef B134
733 # define B134 -1
734 #endif
735 CNU(B134, "134 bps")
737 #ifndef B150
738 # define B150 -1
739 #endif
740 CNU(B150, "150 bps")
742 #ifndef B200
743 # define B200 -1
744 #endif
745 CNU(B200, "200 bps")
747 #ifndef B300
748 # define B300 -1
749 #endif
750 CNU(B300, "300 bps")
752 #ifndef B600
753 # define B600 -1
754 #endif
755 CNU(B600, "600 bps")
757 #ifndef B1200
758 # define B1200 -1
759 #endif
760 CNU(B1200, "1200 bps")
762 #ifndef B1800
763 # define B1800 -1
764 #endif
765 CNU(B1800, "1800 bps")
767 #ifndef B2400
768 # define B2400 -1
769 #endif
770 CNU(B2400, "2400 bps")
772 #ifndef B4800
773 # define B4800 -1
774 #endif
775 CNU(B4800, "4800 bps")
777 #ifndef B9600
778 # define B9600 -1
779 #endif
780 CNU(B9600, "9600 bps")
782 #ifndef B19200
783 # define B19200 -1
784 #endif
785 CNU(B19200, "19200 bps")
787 #ifndef B38400
788 # define B38400 -1
789 #endif
790 CNU(B38400, "38400 bps")
792 #ifndef B57600
793 # define B57600 -1
794 #endif
795 CNU(B57600, "57600 bps")
797 #ifndef B115200
798 # define B115200 -1
799 #endif
800 CNU(B115200, "115200 bps")
802 #ifndef B230400
803 # define B230400 -1
804 #endif
805 CNU(B230400, "230400 bps")
807 #ifndef B460800
808 # define B460800 -1
809 #endif
810 CNU(B460800, "460800 bps")
812 #ifndef B500000
813 # define B500000 -1
814 #endif
815 CNU(B500000, "500000 bps")
817 #ifndef B576000
818 # define B576000 -1
819 #endif
820 CNU(B576000, "576000 bps")
822 #ifndef B921600
823 # define B921600 -1
824 #endif
825 CNU(B921600, "921600 bps")
827 #ifndef B1000000
828 # define B1000000 -1
829 #endif
830 CNU(B1000000, "1000000 bps")
832 #ifndef B1152000
833 # define B1152000 -1
834 #endif
835 CNU(B1152000, "1152000 bps")
837 #ifndef B1500000
838 # define B1500000 -1
839 #endif
840 CNU(B1500000, "1500000 bps")
842 #ifndef B2000000
843 # define B2000000 -1
844 #endif
845 CNU(B2000000, "2000000 bps")
847 #ifndef B2500000
848 # define B2500000 -1
849 #endif
850 CNU(B2500000, "2500000 bps")
852 #ifndef B3000000
853 # define B3000000 -1
854 #endif
855 CNU(B3000000, "3000000 bps")
857 #ifndef B3500000
858 # define B3500000 -1
859 #endif
860 CNU(B3500000, "3500000 bps")
862 #ifndef B4000000
863 # define B4000000 -1
864 #endif
865 CNU(B4000000, "4000000 bps")
869 ---------------------------------
870 -- Terminal control characters --
871 ---------------------------------
875 #ifndef VINTR
876 # define VINTR -1
877 #endif
878 CND(VINTR, "Interrupt")
880 #ifndef VQUIT
881 # define VQUIT -1
882 #endif
883 CND(VQUIT, "Quit")
885 #ifndef VERASE
886 # define VERASE -1
887 #endif
888 CND(VERASE, "Erase")
890 #ifndef VKILL
891 # define VKILL -1
892 #endif
893 CND(VKILL, "Kill")
895 #ifndef VEOF
896 # define VEOF -1
897 #endif
898 CND(VEOF, "EOF")
900 #ifndef VTIME
901 # define VTIME -1
902 #endif
903 CND(VTIME, "Read timeout")
905 #ifndef VMIN
906 # define VMIN -1
907 #endif
908 CND(VMIN, "Read min chars")
910 #ifndef VSWTC
911 # define VSWTC -1
912 #endif
913 CND(VSWTC, "Switch")
915 #ifndef VSTART
916 # define VSTART -1
917 #endif
918 CND(VSTART, "Flow control start")
920 #ifndef VSTOP
921 # define VSTOP -1
922 #endif
923 CND(VSTOP, "Flow control stop")
925 #ifndef VSUSP
926 # define VSUSP -1
927 #endif
928 CND(VSUSP, "Suspend")
930 #ifndef VEOL
931 # define VEOL -1
932 #endif
933 CND(VEOL, "EOL")
935 #ifndef VREPRINT
936 # define VREPRINT -1
937 #endif
938 CND(VREPRINT, "Reprint unread")
940 #ifndef VDISCARD
941 # define VDISCARD -1
942 #endif
943 CND(VDISCARD, "Discard pending")
945 #ifndef VWERASE
946 # define VWERASE -1
947 #endif
948 CND(VWERASE, "Word erase")
950 #ifndef VLNEXT
951 # define VLNEXT -1
952 #endif
953 CND(VLNEXT, "Literal next")
955 #ifndef VEOL2
956 # define VEOL2 -1
957 #endif
958 CND(VEOL2, "Alternative EOL")
960 #endif /* HAVE_TERMIOS */
962 #ifdef __MINGW32__
963 CNU(DTR_CONTROL_ENABLE, "Enable DTR flow ctrl")
964 CNU(RTS_CONTROL_ENABLE, "Enable RTS flow ctrl")
965 #endif
969 -----------------------------
970 -- Pseudo terminal library --
971 -----------------------------
975 #if defined (__FreeBSD__) || defined (linux)
976 # define PTY_Library "-lutil"
977 #else
978 # define PTY_Library ""
979 #endif
980 CST(PTY_Library, "for g-exptty")
983 ** Sockets constants
986 #ifdef HAVE_SOCKETS
990 --------------
991 -- Families --
992 --------------
996 #ifndef AF_INET
997 # define AF_INET -1
998 #endif
999 CND(AF_INET, "IPv4 address family")
1002 ** RTEMS lies and defines AF_INET6 even though there is no IPV6 support.
1003 ** Its TCP/IP stack is in transition. It has newer .h files but no IPV6 yet.
1005 #if defined(__rtems__)
1006 # undef AF_INET6
1007 #endif
1009 #ifndef AF_INET6
1010 # define AF_INET6 -1
1011 #else
1012 # define HAVE_AF_INET6 1
1013 #endif
1014 CND(AF_INET6, "IPv6 address family")
1018 ------------------
1019 -- Socket modes --
1020 ------------------
1024 #ifndef SOCK_STREAM
1025 # define SOCK_STREAM -1
1026 #endif
1027 CND(SOCK_STREAM, "Stream socket")
1029 #ifndef SOCK_DGRAM
1030 # define SOCK_DGRAM -1
1031 #endif
1032 CND(SOCK_DGRAM, "Datagram socket")
1036 -----------------
1037 -- Host errors --
1038 -----------------
1042 #ifndef HOST_NOT_FOUND
1043 # define HOST_NOT_FOUND -1
1044 #endif
1045 CND(HOST_NOT_FOUND, "Unknown host")
1047 #ifndef TRY_AGAIN
1048 # define TRY_AGAIN -1
1049 #endif
1050 CND(TRY_AGAIN, "Host name lookup failure")
1052 #ifndef NO_DATA
1053 # define NO_DATA -1
1054 #endif
1055 CND(NO_DATA, "No data record for name")
1057 #ifndef NO_RECOVERY
1058 # define NO_RECOVERY -1
1059 #endif
1060 CND(NO_RECOVERY, "Non recoverable errors")
1064 --------------------
1065 -- Shutdown modes --
1066 --------------------
1070 #ifndef SHUT_RD
1071 # define SHUT_RD -1
1072 #endif
1073 CND(SHUT_RD, "No more recv")
1075 #ifndef SHUT_WR
1076 # define SHUT_WR -1
1077 #endif
1078 CND(SHUT_WR, "No more send")
1080 #ifndef SHUT_RDWR
1081 # define SHUT_RDWR -1
1082 #endif
1083 CND(SHUT_RDWR, "No more recv/send")
1087 ---------------------
1088 -- Protocol levels --
1089 ---------------------
1093 #ifndef SOL_SOCKET
1094 # define SOL_SOCKET -1
1095 #endif
1096 CND(SOL_SOCKET, "Options for socket level")
1098 #ifndef IPPROTO_IP
1099 # define IPPROTO_IP -1
1100 #endif
1101 CND(IPPROTO_IP, "Dummy protocol for IP")
1103 #ifndef IPPROTO_UDP
1104 # define IPPROTO_UDP -1
1105 #endif
1106 CND(IPPROTO_UDP, "UDP")
1108 #ifndef IPPROTO_TCP
1109 # define IPPROTO_TCP -1
1110 #endif
1111 CND(IPPROTO_TCP, "TCP")
1115 -------------------
1116 -- Request flags --
1117 -------------------
1121 #ifndef MSG_OOB
1122 # define MSG_OOB -1
1123 #endif
1124 CND(MSG_OOB, "Process out-of-band data")
1126 #ifndef MSG_PEEK
1127 # define MSG_PEEK -1
1128 #endif
1129 CND(MSG_PEEK, "Peek at incoming data")
1131 #ifndef MSG_EOR
1132 # define MSG_EOR -1
1133 #endif
1134 CND(MSG_EOR, "Send end of record")
1136 #ifndef MSG_WAITALL
1137 #ifdef __MINWGW32__
1138 /* The value of MSG_WAITALL is 8. Nevertheless winsock.h doesn't
1139 define it, but it is still usable as we link to winsock2 API. */
1140 # define MSG_WAITALL (1 << 3)
1141 #else
1142 # define MSG_WAITALL -1
1143 #endif
1144 #endif
1145 CND(MSG_WAITALL, "Wait for full reception")
1147 #ifndef MSG_NOSIGNAL
1148 # define MSG_NOSIGNAL -1
1149 #endif
1150 CND(MSG_NOSIGNAL, "No SIGPIPE on send")
1152 #ifdef __linux__
1153 # define MSG_Forced_Flags "MSG_NOSIGNAL"
1154 #else
1155 # define MSG_Forced_Flags "0"
1156 #endif
1157 CNS(MSG_Forced_Flags, "")
1159 -- Flags set on all send(2) calls
1164 --------------------
1165 -- Socket options --
1166 --------------------
1170 #ifndef TCP_NODELAY
1171 # define TCP_NODELAY -1
1172 #endif
1173 CND(TCP_NODELAY, "Do not coalesce packets")
1175 #ifndef SO_REUSEADDR
1176 # define SO_REUSEADDR -1
1177 #endif
1178 CND(SO_REUSEADDR, "Bind reuse local address")
1180 #ifndef SO_REUSEPORT
1181 # define SO_REUSEPORT -1
1182 #endif
1183 CND(SO_REUSEPORT, "Bind reuse port number")
1185 #ifndef SO_KEEPALIVE
1186 # define SO_KEEPALIVE -1
1187 #endif
1188 CND(SO_KEEPALIVE, "Enable keep-alive msgs")
1190 #ifndef SO_LINGER
1191 # define SO_LINGER -1
1192 #endif
1193 CND(SO_LINGER, "Defer close to flush data")
1195 #ifndef SO_BROADCAST
1196 # define SO_BROADCAST -1
1197 #endif
1198 CND(SO_BROADCAST, "Can send broadcast msgs")
1200 #ifndef SO_SNDBUF
1201 # define SO_SNDBUF -1
1202 #endif
1203 CND(SO_SNDBUF, "Set/get send buffer size")
1205 #ifndef SO_RCVBUF
1206 # define SO_RCVBUF -1
1207 #endif
1208 CND(SO_RCVBUF, "Set/get recv buffer size")
1210 #ifndef SO_SNDTIMEO
1211 # define SO_SNDTIMEO -1
1212 #endif
1213 CND(SO_SNDTIMEO, "Emission timeout")
1215 #ifndef SO_RCVTIMEO
1216 # define SO_RCVTIMEO -1
1217 #endif
1218 CND(SO_RCVTIMEO, "Reception timeout")
1220 #ifndef SO_ERROR
1221 # define SO_ERROR -1
1222 #endif
1223 CND(SO_ERROR, "Get/clear error status")
1225 #ifndef IP_MULTICAST_IF
1226 # define IP_MULTICAST_IF -1
1227 #endif
1228 CND(IP_MULTICAST_IF, "Set/get mcast interface")
1230 #ifndef IP_MULTICAST_TTL
1231 # define IP_MULTICAST_TTL -1
1232 #endif
1233 CND(IP_MULTICAST_TTL, "Set/get multicast TTL")
1235 #ifndef IP_MULTICAST_LOOP
1236 # define IP_MULTICAST_LOOP -1
1237 #endif
1238 CND(IP_MULTICAST_LOOP, "Set/get mcast loopback")
1240 #ifndef IP_ADD_MEMBERSHIP
1241 # define IP_ADD_MEMBERSHIP -1
1242 #endif
1243 CND(IP_ADD_MEMBERSHIP, "Join a multicast group")
1245 #ifndef IP_DROP_MEMBERSHIP
1246 # define IP_DROP_MEMBERSHIP -1
1247 #endif
1248 CND(IP_DROP_MEMBERSHIP, "Leave a multicast group")
1250 #ifndef IP_PKTINFO
1251 # define IP_PKTINFO -1
1252 #endif
1253 CND(IP_PKTINFO, "Get datagram info")
1257 ----------------------
1258 -- Type definitions --
1259 ----------------------
1264 struct timeval tv;
1266 -- Sizes (in bytes) of the components of struct timeval
1268 #define SIZEOF_tv_sec (sizeof tv.tv_sec)
1269 CND(SIZEOF_tv_sec, "tv_sec")
1270 #define SIZEOF_tv_usec (sizeof tv.tv_usec)
1271 CND(SIZEOF_tv_usec, "tv_usec")
1274 -- Maximum allowed value for tv_sec
1278 ** On Solaris, field tv_sec in struct timeval has an undocumented
1279 ** hard-wired limit of 100 million.
1280 ** On IA64 HP-UX the limit is 2**31 - 1.
1282 #if defined (sun)
1283 # define MAX_tv_sec "100_000_000"
1285 #elif defined (__hpux__)
1286 # define MAX_tv_sec "16#7fffffff#"
1288 #else
1289 # define MAX_tv_sec "2 ** (SIZEOF_tv_sec * 8 - 1) - 1"
1290 #endif
1291 CNS(MAX_tv_sec, "")
1295 -- Sizes of various data types
1298 #define SIZEOF_sockaddr_in (sizeof (struct sockaddr_in))
1299 CND(SIZEOF_sockaddr_in, "struct sockaddr_in")
1300 #ifdef HAVE_AF_INET6
1301 # define SIZEOF_sockaddr_in6 (sizeof (struct sockaddr_in6))
1302 #else
1303 # define SIZEOF_sockaddr_in6 0
1304 #endif
1305 CND(SIZEOF_sockaddr_in6, "struct sockaddr_in6")
1307 #define SIZEOF_fd_set (sizeof (fd_set))
1308 CND(SIZEOF_fd_set, "fd_set");
1309 CND(FD_SETSIZE, "Max fd value");
1311 #define SIZEOF_struct_hostent (sizeof (struct hostent))
1312 CND(SIZEOF_struct_hostent, "struct hostent");
1314 #define SIZEOF_struct_servent (sizeof (struct servent))
1315 CND(SIZEOF_struct_servent, "struct servent");
1317 #if defined (__linux__)
1318 #define SIZEOF_sigset (sizeof (sigset_t))
1319 CND(SIZEOF_sigset, "sigset");
1320 #endif
1323 -- Fields of struct msghdr
1326 #if defined (__sun__) || defined (__hpux__)
1327 # define msg_iovlen_t "int"
1328 #else
1329 # define msg_iovlen_t "size_t"
1330 #endif
1332 TXT(" subtype Msg_Iovlen_T is Interfaces.C." msg_iovlen_t ";")
1336 ----------------------------------------
1337 -- Properties of supported interfaces --
1338 ----------------------------------------
1342 CND(Need_Netdb_Buffer, "Need buffer for Netdb ops")
1343 CND(Need_Netdb_Lock, "Need lock for Netdb ops")
1344 CND(Has_Sockaddr_Len, "Sockaddr has sa_len field")
1347 ** Do not change the format of the line below without also updating the
1348 ** MaRTE Makefile.
1350 C("Thread_Blocking_IO", Boolean, "True", "")
1352 -- Set False for contexts where socket i/o are process blocking
1356 #ifdef HAVE_INET_PTON
1357 # define Inet_Pton_Linkname "inet_pton"
1358 #else
1359 # define Inet_Pton_Linkname "__gnat_inet_pton"
1360 #endif
1361 CST(Inet_Pton_Linkname, "")
1363 #endif /* HAVE_SOCKETS */
1367 ---------------------
1368 -- Threads support --
1369 ---------------------
1371 -- Clock identifier definitions
1375 /* Note: On HP-UX, CLOCK_REALTIME is an enum, not a macro. */
1377 #if defined(CLOCK_REALTIME) || defined (__hpux__)
1378 # define HAVE_CLOCK_REALTIME
1379 #endif
1381 #ifdef HAVE_CLOCK_REALTIME
1382 CND(CLOCK_REALTIME, "System realtime clock")
1383 #endif
1385 #ifdef CLOCK_MONOTONIC
1386 CND(CLOCK_MONOTONIC, "System monotonic clock")
1387 #endif
1389 #ifdef CLOCK_FASTEST
1390 CND(CLOCK_FASTEST, "Fastest clock")
1391 #endif
1393 #ifndef CLOCK_THREAD_CPUTIME_ID
1394 # define CLOCK_THREAD_CPUTIME_ID -1
1395 #endif
1396 CND(CLOCK_THREAD_CPUTIME_ID, "Thread CPU clock")
1398 #if defined(__APPLE__)
1399 /* There's no clock_gettime or clock_id's on Darwin, generate a dummy value */
1400 # define CLOCK_RT_Ada "-1"
1402 #elif defined(FreeBSD) || defined(_AIX)
1403 /** On these platforms use system provided monotonic clock instead of
1404 ** the default CLOCK_REALTIME. We then need to set up cond var attributes
1405 ** appropriately (see thread.c).
1407 # define CLOCK_RT_Ada "CLOCK_MONOTONIC"
1408 # define NEED_PTHREAD_CONDATTR_SETCLOCK
1410 #elif defined(HAVE_CLOCK_REALTIME)
1411 /* By default use CLOCK_REALTIME */
1412 # define CLOCK_RT_Ada "CLOCK_REALTIME"
1413 #endif
1415 #ifdef CLOCK_RT_Ada
1416 CNS(CLOCK_RT_Ada, "")
1417 #endif
1419 #if defined (__APPLE__) || defined (__linux__) || defined (DUMMY)
1422 -- Sizes of pthread data types
1426 #if defined (__APPLE__) || defined (DUMMY)
1428 -- (on Darwin, these are just placeholders)
1431 #define PTHREAD_SIZE __PTHREAD_SIZE__
1432 #define PTHREAD_ATTR_SIZE __PTHREAD_ATTR_SIZE__
1433 #define PTHREAD_MUTEXATTR_SIZE __PTHREAD_MUTEXATTR_SIZE__
1434 #define PTHREAD_MUTEX_SIZE __PTHREAD_MUTEX_SIZE__
1435 #define PTHREAD_CONDATTR_SIZE __PTHREAD_CONDATTR_SIZE__
1436 #define PTHREAD_COND_SIZE __PTHREAD_COND_SIZE__
1437 #define PTHREAD_RWLOCKATTR_SIZE __PTHREAD_RWLOCKATTR_SIZE__
1438 #define PTHREAD_RWLOCK_SIZE __PTHREAD_RWLOCK_SIZE__
1439 #define PTHREAD_ONCE_SIZE __PTHREAD_ONCE_SIZE__
1440 #else
1441 #define PTHREAD_SIZE (sizeof (pthread_t))
1442 #define PTHREAD_ATTR_SIZE (sizeof (pthread_attr_t))
1443 #define PTHREAD_MUTEXATTR_SIZE (sizeof (pthread_mutexattr_t))
1444 #define PTHREAD_MUTEX_SIZE (sizeof (pthread_mutex_t))
1445 #define PTHREAD_CONDATTR_SIZE (sizeof (pthread_condattr_t))
1446 #define PTHREAD_COND_SIZE (sizeof (pthread_cond_t))
1447 #define PTHREAD_RWLOCKATTR_SIZE (sizeof (pthread_rwlockattr_t))
1448 #define PTHREAD_RWLOCK_SIZE (sizeof (pthread_rwlock_t))
1449 #define PTHREAD_ONCE_SIZE (sizeof (pthread_once_t))
1450 #endif
1452 CND(PTHREAD_SIZE, "pthread_t")
1453 CND(PTHREAD_ATTR_SIZE, "pthread_attr_t")
1454 CND(PTHREAD_MUTEXATTR_SIZE, "pthread_mutexattr_t")
1455 CND(PTHREAD_MUTEX_SIZE, "pthread_mutex_t")
1456 CND(PTHREAD_CONDATTR_SIZE, "pthread_condattr_t")
1457 CND(PTHREAD_COND_SIZE, "pthread_cond_t")
1458 CND(PTHREAD_RWLOCKATTR_SIZE, "pthread_rwlockattr_t")
1459 CND(PTHREAD_RWLOCK_SIZE, "pthread_rwlock_t")
1460 CND(PTHREAD_ONCE_SIZE, "pthread_once_t")
1462 #endif /* __APPLE__ || __linux__ */
1465 ** System-specific constants follow
1466 ** Each section should be activated if compiling for the corresponding
1467 ** platform *or* generating the dummy version for runtime test compilation.
1470 #if defined (__vxworks) || defined (DUMMY)
1474 --------------------------------
1475 -- VxWorks-specific constants --
1476 --------------------------------
1478 -- These constants may be used only within the VxWorks version of
1479 -- GNAT.Sockets.Thin.
1482 CND(OK, "VxWorks generic success")
1483 CND(ERROR, "VxWorks generic error")
1485 #endif /* __vxworks */
1487 #if defined (__MINGW32__) || defined (DUMMY)
1490 ------------------------------
1491 -- MinGW-specific constants --
1492 ------------------------------
1494 -- These constants may be used only within the MinGW version of
1495 -- GNAT.Sockets.Thin.
1498 CND(WSASYSNOTREADY, "System not ready")
1499 CND(WSAVERNOTSUPPORTED, "Version not supported")
1500 CND(WSANOTINITIALISED, "Winsock not initialized")
1501 CND(WSAEDISCON, "Disconnected")
1503 #endif /* __MINGW32__ */
1506 ** End of constants definitions
1509 #ifdef NATIVE
1510 putchar ('\n');
1511 #endif
1515 end System.OS_Constants;