fixing pr42337
[official-gcc.git] / gcc / ada / s-oscons-tmplt.c
blob1e8bd520ceb970322cc25b20f797022b0ce552f1
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-2009, 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 #if defined (__linux__) && !defined (_XOPEN_SOURCE)
82 /** For Linux _XOPEN_SOURCE must be defined, otherwise IOV_MAX is not defined
83 **/
84 #define _XOPEN_SOURCE 500
86 #elif defined (__mips) && defined (__sgi)
87 /** For IRIX 6, _XOPEN5 must be defined and _XOPEN_IOV_MAX must be used as
88 ** IOV_MAX, otherwise IOV_MAX is not defined. IRIX 5 has neither.
89 **/
90 #ifdef _XOPEN_IOV_MAX
91 #define _XOPEN5
92 #define IOV_MAX _XOPEN_IOV_MAX
93 #endif
94 #endif
96 #include <stdlib.h>
97 #include <string.h>
98 #include <limits.h>
99 #include <fcntl.h>
101 #if ! (defined (__vxworks) || defined (__VMS) || defined (__MINGW32__) || \
102 defined (__nucleus__))
103 # define HAVE_TERMIOS
104 #endif
106 #if defined (__vxworks)
109 ** For VxWorks, always include vxWorks.h (gsocket.h provides it only for
110 ** the case of runtime libraries that support sockets).
113 # include <vxWorks.h>
114 #endif
116 #include "gsocket.h"
118 #ifdef DUMMY
120 # if defined (TARGET)
121 # error TARGET may not be defined when generating the dummy version
122 # else
123 # define TARGET "batch runtime compilation (dummy values)"
124 # endif
126 # if !(defined (HAVE_SOCKETS) && defined (HAVE_TERMIOS))
127 # error Features missing on platform
128 # endif
130 # define NATIVE
132 #endif
134 #ifndef TARGET
135 # error Please define TARGET
136 #endif
138 #ifndef HAVE_SOCKETS
139 # include <errno.h>
140 #endif
142 #ifdef HAVE_TERMIOS
143 # include <termios.h>
144 #endif
146 #ifdef __APPLE__
147 # include <_types.h>
148 #endif
150 #ifdef NATIVE
151 #include <stdio.h>
153 #ifdef DUMMY
154 int counter = 0;
155 # define _VAL(x) counter++
156 #else
157 # define _VAL(x) x
158 #endif
160 #define CND(name,comment) \
161 printf ("\n->CND:$%d:" #name ":$%d:" comment, __LINE__, ((int) _VAL (name)));
163 #define CNS(name,comment) \
164 printf ("\n->CNS:$%d:" #name ":" name ":" comment, __LINE__);
166 #define C(sname,type,value,comment)\
167 printf ("\n->C:$%d:" sname ":" #type ":" value ":" comment, __LINE__);
169 #define TXT(text) \
170 printf ("\n->TXT:$%d:" text, __LINE__);
172 #else
174 #define CND(name, comment) \
175 asm volatile("\n->CND:%0:" #name ":%1:" comment \
176 : : "i" (__LINE__), "i" ((int) name));
177 /* Decimal constant in the range of type "int" */
179 #define CNS(name, comment) \
180 asm volatile("\n->CNS:%0:" #name ":" name ":" comment \
181 : : "i" (__LINE__));
182 /* General expression named number */
184 #define C(sname, type, value, comment) \
185 asm volatile("\n->C:%0:" sname ":" #type ":" value ":" comment \
186 : : "i" (__LINE__));
187 /* Typed constant */
189 #define TXT(text) \
190 asm volatile("\n->TXT:%0:" text \
191 : : "i" (__LINE__));
192 /* Freeform text */
194 #endif
196 #define CST(name,comment) C(#name,String,name,comment)
198 #define STR(x) STR1(x)
199 #define STR1(x) #x
201 #ifdef __MINGW32__
202 unsigned int _CRT_fmode = _O_BINARY;
203 #endif
206 main (void) {
209 -- This package provides target dependent definitions of constant for use
210 -- by the GNAT runtime library. This package should not be directly with'd
211 -- by an application program.
213 -- This file is generated automatically, do not modify it by hand! Instead,
214 -- make changes to s-oscons-tmplt.c and rebuild the GNAT runtime library.
218 ** Do not change the format of the line below without also updating the
219 ** MaRTE Makefile.
221 TXT("-- This is the version for " TARGET)
222 TXT("")
224 #ifdef HAVE_SOCKETS
226 ** The type definitions for struct hostent components uses Interfaces.C
229 TXT("with Interfaces.C;")
230 #endif
233 package System.OS_Constants is
235 pragma Pure;
239 ** General constants (all platforms)
244 -----------------------------
245 -- Platform identification --
246 -----------------------------
248 type OS_Type is (Windows, VMS, Other_OS);
250 #if defined (__MINGW32__)
251 # define TARGET_OS "Windows"
252 #elif defined (__VMS)
253 # define TARGET_OS "VMS"
254 #else
255 # define TARGET_OS "Other_OS"
256 #endif
257 C("Target_OS", OS_Type, TARGET_OS, "")
258 #define Target_Name TARGET
259 CST(Target_Name, "")
262 -------------------
263 -- System limits --
264 -------------------
268 #ifndef IOV_MAX
269 # define IOV_MAX INT_MAX
270 #endif
271 CND(IOV_MAX, "Maximum writev iovcnt")
275 ---------------------
276 -- File open modes --
277 ---------------------
281 #ifndef O_RDWR
282 # define O_RDWR -1
283 #endif
284 CND(O_RDWR, "Read/write")
286 #ifndef O_NOCTTY
287 # define O_NOCTTY -1
288 #endif
289 CND(O_NOCTTY, "Don't change ctrl tty")
291 #ifndef O_NDELAY
292 # define O_NDELAY -1
293 #endif
294 CND(O_NDELAY, "Nonblocking")
298 ----------------------
299 -- Fcntl operations --
300 ----------------------
304 #ifndef F_GETFL
305 # define F_GETFL -1
306 #endif
307 CND(F_GETFL, "Get flags")
309 #ifndef F_SETFL
310 # define F_SETFL -1
311 #endif
312 CND(F_SETFL, "Set flags")
316 -----------------
317 -- Fcntl flags --
318 -----------------
322 #ifndef FNDELAY
323 # define FNDELAY -1
324 #endif
325 CND(FNDELAY, "Nonblocking")
329 ----------------------
330 -- Ioctl operations --
331 ----------------------
335 #ifndef FIONBIO
336 # define FIONBIO -1
337 #endif
338 CND(FIONBIO, "Set/clear non-blocking io")
340 #ifndef FIONREAD
341 # define FIONREAD -1
342 #endif
343 CND(FIONREAD, "How many bytes to read")
347 ------------------
348 -- Errno values --
349 ------------------
351 -- The following constants are defined from <errno.h>
354 #ifndef EAGAIN
355 # define EAGAIN -1
356 #endif
357 CND(EAGAIN, "Try again")
359 #ifndef ENOENT
360 # define ENOENT -1
361 #endif
362 CND(ENOENT, "File not found")
364 #ifndef ENOMEM
365 # define ENOMEM -1
366 #endif
367 CND(ENOMEM, "Out of memory")
369 #ifdef __MINGW32__
372 -- The following constants are defined from <winsock2.h> (WSA*)
377 ** For sockets-related errno values on Windows, gsocket.h redefines
378 ** Exxx as WSAExxx.
381 #endif
383 #ifndef EACCES
384 # define EACCES -1
385 #endif
386 CND(EACCES, "Permission denied")
388 #ifndef EADDRINUSE
389 # define EADDRINUSE -1
390 #endif
391 CND(EADDRINUSE, "Address already in use")
393 #ifndef EADDRNOTAVAIL
394 # define EADDRNOTAVAIL -1
395 #endif
396 CND(EADDRNOTAVAIL, "Cannot assign address")
398 #ifndef EAFNOSUPPORT
399 # define EAFNOSUPPORT -1
400 #endif
401 CND(EAFNOSUPPORT, "Addr family not supported")
403 #ifndef EALREADY
404 # define EALREADY -1
405 #endif
406 CND(EALREADY, "Operation in progress")
408 #ifndef EBADF
409 # define EBADF -1
410 #endif
411 CND(EBADF, "Bad file descriptor")
413 #ifndef ECONNABORTED
414 # define ECONNABORTED -1
415 #endif
416 CND(ECONNABORTED, "Connection aborted")
418 #ifndef ECONNREFUSED
419 # define ECONNREFUSED -1
420 #endif
421 CND(ECONNREFUSED, "Connection refused")
423 #ifndef ECONNRESET
424 # define ECONNRESET -1
425 #endif
426 CND(ECONNRESET, "Connection reset by peer")
428 #ifndef EDESTADDRREQ
429 # define EDESTADDRREQ -1
430 #endif
431 CND(EDESTADDRREQ, "Destination addr required")
433 #ifndef EFAULT
434 # define EFAULT -1
435 #endif
436 CND(EFAULT, "Bad address")
438 #ifndef EHOSTDOWN
439 # define EHOSTDOWN -1
440 #endif
441 CND(EHOSTDOWN, "Host is down")
443 #ifndef EHOSTUNREACH
444 # define EHOSTUNREACH -1
445 #endif
446 CND(EHOSTUNREACH, "No route to host")
448 #ifndef EINPROGRESS
449 # define EINPROGRESS -1
450 #endif
451 CND(EINPROGRESS, "Operation now in progress")
453 #ifndef EINTR
454 # define EINTR -1
455 #endif
456 CND(EINTR, "Interrupted system call")
458 #ifndef EINVAL
459 # define EINVAL -1
460 #endif
461 CND(EINVAL, "Invalid argument")
463 #ifndef EIO
464 # define EIO -1
465 #endif
466 CND(EIO, "Input output error")
468 #ifndef EISCONN
469 # define EISCONN -1
470 #endif
471 CND(EISCONN, "Socket already connected")
473 #ifndef ELOOP
474 # define ELOOP -1
475 #endif
476 CND(ELOOP, "Too many symbolic links")
478 #ifndef EMFILE
479 # define EMFILE -1
480 #endif
481 CND(EMFILE, "Too many open files")
483 #ifndef EMSGSIZE
484 # define EMSGSIZE -1
485 #endif
486 CND(EMSGSIZE, "Message too long")
488 #ifndef ENAMETOOLONG
489 # define ENAMETOOLONG -1
490 #endif
491 CND(ENAMETOOLONG, "Name too long")
493 #ifndef ENETDOWN
494 # define ENETDOWN -1
495 #endif
496 CND(ENETDOWN, "Network is down")
498 #ifndef ENETRESET
499 # define ENETRESET -1
500 #endif
501 CND(ENETRESET, "Disconn. on network reset")
503 #ifndef ENETUNREACH
504 # define ENETUNREACH -1
505 #endif
506 CND(ENETUNREACH, "Network is unreachable")
508 #ifndef ENOBUFS
509 # define ENOBUFS -1
510 #endif
511 CND(ENOBUFS, "No buffer space available")
513 #ifndef ENOPROTOOPT
514 # define ENOPROTOOPT -1
515 #endif
516 CND(ENOPROTOOPT, "Protocol not available")
518 #ifndef ENOTCONN
519 # define ENOTCONN -1
520 #endif
521 CND(ENOTCONN, "Socket not connected")
523 #ifndef ENOTSOCK
524 # define ENOTSOCK -1
525 #endif
526 CND(ENOTSOCK, "Operation on non socket")
528 #ifndef EOPNOTSUPP
529 # define EOPNOTSUPP -1
530 #endif
531 CND(EOPNOTSUPP, "Operation not supported")
533 #ifndef EPIPE
534 # define EPIPE -1
535 #endif
536 CND(EPIPE, "Broken pipe")
538 #ifndef EPFNOSUPPORT
539 # define EPFNOSUPPORT -1
540 #endif
541 CND(EPFNOSUPPORT, "Unknown protocol family")
543 #ifndef EPROTONOSUPPORT
544 # define EPROTONOSUPPORT -1
545 #endif
546 CND(EPROTONOSUPPORT, "Unknown protocol")
548 #ifndef EPROTOTYPE
549 # define EPROTOTYPE -1
550 #endif
551 CND(EPROTOTYPE, "Unknown protocol type")
553 #ifndef ERANGE
554 # define ERANGE -1
555 #endif
556 CND(ERANGE, "Result too large")
558 #ifndef ESHUTDOWN
559 # define ESHUTDOWN -1
560 #endif
561 CND(ESHUTDOWN, "Cannot send once shutdown")
563 #ifndef ESOCKTNOSUPPORT
564 # define ESOCKTNOSUPPORT -1
565 #endif
566 CND(ESOCKTNOSUPPORT, "Socket type not supported")
568 #ifndef ETIMEDOUT
569 # define ETIMEDOUT -1
570 #endif
571 CND(ETIMEDOUT, "Connection timed out")
573 #ifndef ETOOMANYREFS
574 # define ETOOMANYREFS -1
575 #endif
576 CND(ETOOMANYREFS, "Too many references")
578 #ifndef EWOULDBLOCK
579 # define EWOULDBLOCK -1
580 #endif
581 CND(EWOULDBLOCK, "Operation would block")
584 ** Terminal I/O constants
587 #ifdef HAVE_TERMIOS
591 ----------------------
592 -- Terminal control --
593 ----------------------
597 #ifndef TCSANOW
598 # define TCSANOW -1
599 #endif
600 CND(TCSANOW, "Immediate")
602 #ifndef TCIFLUSH
603 # define TCIFLUSH -1
604 #endif
605 CND(TCIFLUSH, "Flush input")
607 #ifndef CLOCAL
608 # define CLOCAL -1
609 #endif
610 CND(CLOCAL, "Local")
612 #ifndef CRTSCTS
613 # define CRTSCTS -1
614 #endif
615 CND(CRTSCTS, "Hardware flow control")
617 #ifndef CREAD
618 # define CREAD -1
619 #endif
620 CND(CREAD, "Read")
622 #ifndef CS5
623 # define CS5 -1
624 #endif
625 CND(CS5, "5 data bits")
627 #ifndef CS6
628 # define CS6 -1
629 #endif
630 CND(CS6, "6 data bits")
632 #ifndef CS7
633 # define CS7 -1
634 #endif
635 CND(CS7, "7 data bits")
637 #ifndef CS8
638 # define CS8 -1
639 #endif
640 CND(CS8, "8 data bits")
642 #ifndef CSTOPB
643 # define CSTOPB -1
644 #endif
645 CND(CSTOPB, "2 stop bits")
647 #ifndef PARENB
648 # define PARENB -1
649 #endif
650 CND(PARENB, "Parity enable")
652 #ifndef PARODD
653 # define PARODD -1
654 #endif
655 CND(PARODD, "Parity odd")
657 #ifndef B0
658 # define B0 -1
659 #endif
660 CND(B0, "0 bps")
662 #ifndef B50
663 # define B50 -1
664 #endif
665 CND(B50, "50 bps")
667 #ifndef B75
668 # define B75 -1
669 #endif
670 CND(B75, "75 bps")
672 #ifndef B110
673 # define B110 -1
674 #endif
675 CND(B110, "110 bps")
677 #ifndef B134
678 # define B134 -1
679 #endif
680 CND(B134, "134 bps")
682 #ifndef B150
683 # define B150 -1
684 #endif
685 CND(B150, "150 bps")
687 #ifndef B200
688 # define B200 -1
689 #endif
690 CND(B200, "200 bps")
692 #ifndef B300
693 # define B300 -1
694 #endif
695 CND(B300, "300 bps")
697 #ifndef B600
698 # define B600 -1
699 #endif
700 CND(B600, "600 bps")
702 #ifndef B1200
703 # define B1200 -1
704 #endif
705 CND(B1200, "1200 bps")
707 #ifndef B1800
708 # define B1800 -1
709 #endif
710 CND(B1800, "1800 bps")
712 #ifndef B2400
713 # define B2400 -1
714 #endif
715 CND(B2400, "2400 bps")
717 #ifndef B4800
718 # define B4800 -1
719 #endif
720 CND(B4800, "4800 bps")
722 #ifndef B9600
723 # define B9600 -1
724 #endif
725 CND(B9600, "9600 bps")
727 #ifndef B19200
728 # define B19200 -1
729 #endif
730 CND(B19200, "19200 bps")
732 #ifndef B38400
733 # define B38400 -1
734 #endif
735 CND(B38400, "38400 bps")
737 #ifndef B57600
738 # define B57600 -1
739 #endif
740 CND(B57600, "57600 bps")
742 #ifndef B115200
743 # define B115200 -1
744 #endif
745 CND(B115200, "115200 bps")
747 #ifndef B230400
748 # define B230400 -1
749 #endif
750 CND(B230400, "230400 bps")
752 #ifndef B460800
753 # define B460800 -1
754 #endif
755 CND(B460800, "460800 bps")
757 #ifndef B500000
758 # define B500000 -1
759 #endif
760 CND(B500000, "500000 bps")
762 #ifndef B576000
763 # define B576000 -1
764 #endif
765 CND(B576000, "576000 bps")
767 #ifndef B921600
768 # define B921600 -1
769 #endif
770 CND(B921600, "921600 bps")
772 #ifndef B1000000
773 # define B1000000 -1
774 #endif
775 CND(B1000000, "1000000 bps")
777 #ifndef B1152000
778 # define B1152000 -1
779 #endif
780 CND(B1152000, "1152000 bps")
782 #ifndef B1500000
783 # define B1500000 -1
784 #endif
785 CND(B1500000, "1500000 bps")
787 #ifndef B2000000
788 # define B2000000 -1
789 #endif
790 CND(B2000000, "2000000 bps")
792 #ifndef B2500000
793 # define B2500000 -1
794 #endif
795 CND(B2500000, "2500000 bps")
797 #ifndef B3000000
798 # define B3000000 -1
799 #endif
800 CND(B3000000, "3000000 bps")
802 #ifndef B3500000
803 # define B3500000 -1
804 #endif
805 CND(B3500000, "3500000 bps")
807 #ifndef B4000000
808 # define B4000000 -1
809 #endif
810 CND(B4000000, "4000000 bps")
814 ---------------------------------
815 -- Terminal control characters --
816 ---------------------------------
820 #ifndef VINTR
821 # define VINTR -1
822 #endif
823 CND(VINTR, "Interrupt")
825 #ifndef VQUIT
826 # define VQUIT -1
827 #endif
828 CND(VQUIT, "Quit")
830 #ifndef VERASE
831 # define VERASE -1
832 #endif
833 CND(VERASE, "Erase")
835 #ifndef VKILL
836 # define VKILL -1
837 #endif
838 CND(VKILL, "Kill")
840 #ifndef VEOF
841 # define VEOF -1
842 #endif
843 CND(VEOF, "EOF")
845 #ifndef VTIME
846 # define VTIME -1
847 #endif
848 CND(VTIME, "Read timeout")
850 #ifndef VMIN
851 # define VMIN -1
852 #endif
853 CND(VMIN, "Read min chars")
855 #ifndef VSWTC
856 # define VSWTC -1
857 #endif
858 CND(VSWTC, "Switch")
860 #ifndef VSTART
861 # define VSTART -1
862 #endif
863 CND(VSTART, "Flow control start")
865 #ifndef VSTOP
866 # define VSTOP -1
867 #endif
868 CND(VSTOP, "Flow control stop")
870 #ifndef VSUSP
871 # define VSUSP -1
872 #endif
873 CND(VSUSP, "Suspend")
875 #ifndef VEOL
876 # define VEOL -1
877 #endif
878 CND(VEOL, "EOL")
880 #ifndef VREPRINT
881 # define VREPRINT -1
882 #endif
883 CND(VREPRINT, "Reprint unread")
885 #ifndef VDISCARD
886 # define VDISCARD -1
887 #endif
888 CND(VDISCARD, "Discard pending")
890 #ifndef VWERASE
891 # define VWERASE -1
892 #endif
893 CND(VWERASE, "Word erase")
895 #ifndef VLNEXT
896 # define VLNEXT -1
897 #endif
898 CND(VLNEXT, "Literal next")
900 #ifndef VEOL2
901 # define VEOL2 -1
902 #endif
903 CND(VEOL2, "Alternative EOL")
905 #endif /* HAVE_TERMIOS */
908 ** Sockets constants
911 #ifdef HAVE_SOCKETS
915 --------------
916 -- Families --
917 --------------
921 #ifndef AF_INET
922 # define AF_INET -1
923 #endif
924 CND(AF_INET, "IPv4 address family")
927 ** RTEMS lies and defines AF_INET6 even though there is no IPV6 support.
928 ** Its TCP/IP stack is in transition. It has newer .h files but no IPV6 yet.
930 #if defined(__rtems__)
931 # undef AF_INET6
932 #endif
935 ** Tru64 UNIX V4.0F defines AF_INET6 without IPv6 support, specificially
936 ** without struct sockaddr_in6. We use _SS_MAXSIZE (used for the definition
937 ** of struct sockaddr_storage on Tru64 UNIX V5.1) to detect this.
939 #if defined(__osf__) && !defined(_SS_MAXSIZE)
940 # undef AF_INET6
941 #endif
943 #ifndef AF_INET6
944 # define AF_INET6 -1
945 #else
946 # define HAVE_AF_INET6 1
947 #endif
948 CND(AF_INET6, "IPv6 address family")
952 ------------------
953 -- Socket modes --
954 ------------------
958 #ifndef SOCK_STREAM
959 # define SOCK_STREAM -1
960 #endif
961 CND(SOCK_STREAM, "Stream socket")
963 #ifndef SOCK_DGRAM
964 # define SOCK_DGRAM -1
965 #endif
966 CND(SOCK_DGRAM, "Datagram socket")
970 -----------------
971 -- Host errors --
972 -----------------
976 #ifndef HOST_NOT_FOUND
977 # define HOST_NOT_FOUND -1
978 #endif
979 CND(HOST_NOT_FOUND, "Unknown host")
981 #ifndef TRY_AGAIN
982 # define TRY_AGAIN -1
983 #endif
984 CND(TRY_AGAIN, "Host name lookup failure")
986 #ifndef NO_DATA
987 # define NO_DATA -1
988 #endif
989 CND(NO_DATA, "No data record for name")
991 #ifndef NO_RECOVERY
992 # define NO_RECOVERY -1
993 #endif
994 CND(NO_RECOVERY, "Non recoverable errors")
998 --------------------
999 -- Shutdown modes --
1000 --------------------
1004 #ifndef SHUT_RD
1005 # define SHUT_RD -1
1006 #endif
1007 CND(SHUT_RD, "No more recv")
1009 #ifndef SHUT_WR
1010 # define SHUT_WR -1
1011 #endif
1012 CND(SHUT_WR, "No more send")
1014 #ifndef SHUT_RDWR
1015 # define SHUT_RDWR -1
1016 #endif
1017 CND(SHUT_RDWR, "No more recv/send")
1021 ---------------------
1022 -- Protocol levels --
1023 ---------------------
1027 #ifndef SOL_SOCKET
1028 # define SOL_SOCKET -1
1029 #endif
1030 CND(SOL_SOCKET, "Options for socket level")
1032 #ifndef IPPROTO_IP
1033 # define IPPROTO_IP -1
1034 #endif
1035 CND(IPPROTO_IP, "Dummy protocol for IP")
1037 #ifndef IPPROTO_UDP
1038 # define IPPROTO_UDP -1
1039 #endif
1040 CND(IPPROTO_UDP, "UDP")
1042 #ifndef IPPROTO_TCP
1043 # define IPPROTO_TCP -1
1044 #endif
1045 CND(IPPROTO_TCP, "TCP")
1049 -------------------
1050 -- Request flags --
1051 -------------------
1055 #ifndef MSG_OOB
1056 # define MSG_OOB -1
1057 #endif
1058 CND(MSG_OOB, "Process out-of-band data")
1060 #ifndef MSG_PEEK
1061 # define MSG_PEEK -1
1062 #endif
1063 CND(MSG_PEEK, "Peek at incoming data")
1065 #ifndef MSG_EOR
1066 # define MSG_EOR -1
1067 #endif
1068 CND(MSG_EOR, "Send end of record")
1070 #ifndef MSG_WAITALL
1071 # define MSG_WAITALL -1
1072 #endif
1073 CND(MSG_WAITALL, "Wait for full reception")
1075 #ifndef MSG_NOSIGNAL
1076 # define MSG_NOSIGNAL -1
1077 #endif
1078 CND(MSG_NOSIGNAL, "No SIGPIPE on send")
1080 #ifdef __linux__
1081 # define MSG_Forced_Flags "MSG_NOSIGNAL"
1082 #else
1083 # define MSG_Forced_Flags "0"
1084 #endif
1085 CNS(MSG_Forced_Flags, "")
1087 -- Flags set on all send(2) calls
1092 --------------------
1093 -- Socket options --
1094 --------------------
1098 #ifndef TCP_NODELAY
1099 # define TCP_NODELAY -1
1100 #endif
1101 CND(TCP_NODELAY, "Do not coalesce packets")
1103 #ifndef SO_REUSEADDR
1104 # define SO_REUSEADDR -1
1105 #endif
1106 CND(SO_REUSEADDR, "Bind reuse local address")
1108 #ifndef SO_REUSEPORT
1109 # define SO_REUSEPORT -1
1110 #endif
1111 CND(SO_REUSEPORT, "Bind reuse port number")
1113 #ifndef SO_KEEPALIVE
1114 # define SO_KEEPALIVE -1
1115 #endif
1116 CND(SO_KEEPALIVE, "Enable keep-alive msgs")
1118 #ifndef SO_LINGER
1119 # define SO_LINGER -1
1120 #endif
1121 CND(SO_LINGER, "Defer close to flush data")
1123 #ifndef SO_BROADCAST
1124 # define SO_BROADCAST -1
1125 #endif
1126 CND(SO_BROADCAST, "Can send broadcast msgs")
1128 #ifndef SO_SNDBUF
1129 # define SO_SNDBUF -1
1130 #endif
1131 CND(SO_SNDBUF, "Set/get send buffer size")
1133 #ifndef SO_RCVBUF
1134 # define SO_RCVBUF -1
1135 #endif
1136 CND(SO_RCVBUF, "Set/get recv buffer size")
1138 #ifndef SO_SNDTIMEO
1139 # define SO_SNDTIMEO -1
1140 #endif
1141 CND(SO_SNDTIMEO, "Emission timeout")
1143 #ifndef SO_RCVTIMEO
1144 # define SO_RCVTIMEO -1
1145 #endif
1146 CND(SO_RCVTIMEO, "Reception timeout")
1148 #ifndef SO_ERROR
1149 # define SO_ERROR -1
1150 #endif
1151 CND(SO_ERROR, "Get/clear error status")
1153 #ifndef IP_MULTICAST_IF
1154 # define IP_MULTICAST_IF -1
1155 #endif
1156 CND(IP_MULTICAST_IF, "Set/get mcast interface")
1158 #ifndef IP_MULTICAST_TTL
1159 # define IP_MULTICAST_TTL -1
1160 #endif
1161 CND(IP_MULTICAST_TTL, "Set/get multicast TTL")
1163 #ifndef IP_MULTICAST_LOOP
1164 # define IP_MULTICAST_LOOP -1
1165 #endif
1166 CND(IP_MULTICAST_LOOP, "Set/get mcast loopback")
1168 #ifndef IP_ADD_MEMBERSHIP
1169 # define IP_ADD_MEMBERSHIP -1
1170 #endif
1171 CND(IP_ADD_MEMBERSHIP, "Join a multicast group")
1173 #ifndef IP_DROP_MEMBERSHIP
1174 # define IP_DROP_MEMBERSHIP -1
1175 #endif
1176 CND(IP_DROP_MEMBERSHIP, "Leave a multicast group")
1178 #ifndef IP_PKTINFO
1179 # define IP_PKTINFO -1
1180 #endif
1181 CND(IP_PKTINFO, "Get datagram info")
1185 ----------------------
1186 -- Type definitions --
1187 ----------------------
1192 struct timeval tv;
1194 -- Sizes (in bytes) of the components of struct timeval
1196 #define SIZEOF_tv_sec (sizeof tv.tv_sec)
1197 CND(SIZEOF_tv_sec, "tv_sec")
1198 #define SIZEOF_tv_usec (sizeof tv.tv_usec)
1199 CND(SIZEOF_tv_usec, "tv_usec")
1203 -- Sizes of various data types
1206 #define SIZEOF_sockaddr_in (sizeof (struct sockaddr_in))
1207 CND(SIZEOF_sockaddr_in, "struct sockaddr_in")
1208 #ifdef HAVE_AF_INET6
1209 # define SIZEOF_sockaddr_in6 (sizeof (struct sockaddr_in6))
1210 #else
1211 # define SIZEOF_sockaddr_in6 0
1212 #endif
1213 CND(SIZEOF_sockaddr_in6, "struct sockaddr_in6")
1215 #define SIZEOF_fd_set (sizeof (fd_set))
1216 CND(SIZEOF_fd_set, "fd_set");
1218 #define SIZEOF_struct_servent (sizeof (struct servent))
1219 CND(SIZEOF_struct_servent, "struct servent");
1222 -- Fields of struct hostent
1225 #ifdef __MINGW32__
1226 # define h_addrtype_t "short"
1227 # define h_length_t "short"
1228 #else
1229 # define h_addrtype_t "int"
1230 # define h_length_t "int"
1231 #endif
1233 TXT(" subtype H_Addrtype_T is Interfaces.C." h_addrtype_t ";")
1234 TXT(" subtype H_Length_T is Interfaces.C." h_length_t ";")
1238 -- Fields of struct msghdr
1241 #if defined (__sun__) || defined (__hpux__)
1242 # define msg_iovlen_t "int"
1243 #else
1244 # define msg_iovlen_t "size_t"
1245 #endif
1247 TXT(" subtype Msg_Iovlen_T is Interfaces.C." msg_iovlen_t ";")
1251 ----------------------------------------
1252 -- Properties of supported interfaces --
1253 ----------------------------------------
1257 CND(Need_Netdb_Buffer, "Need buffer for Netdb ops")
1258 CND(Has_Sockaddr_Len, "Sockaddr has sa_len field")
1261 ** Do not change the format of the line below without also updating the
1262 ** MaRTE Makefile.
1264 C("Thread_Blocking_IO", Boolean, "True", "")
1266 -- Set False for contexts where socket i/o are process blocking
1270 #ifdef HAVE_INET_PTON
1271 # define Inet_Pton_Linkname "inet_pton"
1272 #else
1273 # define Inet_Pton_Linkname "__gnat_inet_pton"
1274 #endif
1275 CST(Inet_Pton_Linkname, "")
1277 #endif /* HAVE_SOCKETS */
1280 ** System-specific constants follow
1281 ** Each section should be activated if compiling for the corresponding
1282 ** platform *or* generating the dummy version for runtime test compilation.
1285 #if defined (__vxworks) || defined (DUMMY)
1289 --------------------------------
1290 -- VxWorks-specific constants --
1291 --------------------------------
1293 -- These constants may be used only within the VxWorks version of
1294 -- GNAT.Sockets.Thin.
1297 CND(OK, "VxWorks generic success")
1298 CND(ERROR, "VxWorks generic error")
1300 #endif
1302 #if defined (__MINGW32__) || defined (DUMMY)
1305 ------------------------------
1306 -- MinGW-specific constants --
1307 ------------------------------
1309 -- These constants may be used only within the MinGW version of
1310 -- GNAT.Sockets.Thin.
1313 CND(WSASYSNOTREADY, "System not ready")
1314 CND(WSAVERNOTSUPPORTED, "Version not supported")
1315 CND(WSANOTINITIALISED, "Winsock not initialized")
1316 CND(WSAEDISCON, "Disconnected")
1318 #endif
1320 #ifdef NATIVE
1321 putchar ('\n');
1322 #endif
1324 #if defined (__APPLE__) || defined (DUMMY)
1327 -------------------------------
1328 -- Darwin-specific constants --
1329 -------------------------------
1331 -- These constants may be used only within the Darwin version of the GNAT
1332 -- runtime library.
1335 #define PTHREAD_SIZE __PTHREAD_SIZE__
1336 CND(PTHREAD_SIZE, "Pad in pthread_t")
1338 #define PTHREAD_ATTR_SIZE __PTHREAD_ATTR_SIZE__
1339 CND(PTHREAD_ATTR_SIZE, "Pad in pthread_attr_t")
1341 #define PTHREAD_MUTEXATTR_SIZE __PTHREAD_MUTEXATTR_SIZE__
1342 CND(PTHREAD_MUTEXATTR_SIZE, "Pad in pthread_mutexattr_t")
1344 #define PTHREAD_MUTEX_SIZE __PTHREAD_MUTEX_SIZE__
1345 CND(PTHREAD_MUTEX_SIZE, "Pad in pthread_mutex_t")
1347 #define PTHREAD_CONDATTR_SIZE __PTHREAD_CONDATTR_SIZE__
1348 CND(PTHREAD_CONDATTR_SIZE, "Pad in pthread_condattr_t")
1350 #define PTHREAD_COND_SIZE __PTHREAD_COND_SIZE__
1351 CND(PTHREAD_COND_SIZE, "Pad in pthread_cond_t")
1353 #define PTHREAD_RWLOCKATTR_SIZE __PTHREAD_RWLOCKATTR_SIZE__
1354 CND(PTHREAD_RWLOCKATTR_SIZE, "Pad in pthread_rwlockattr_t")
1356 #define PTHREAD_RWLOCK_SIZE __PTHREAD_RWLOCK_SIZE__
1357 CND(PTHREAD_RWLOCK_SIZE, "Pad in pthread_rwlock_t")
1359 #define PTHREAD_ONCE_SIZE __PTHREAD_ONCE_SIZE__
1360 CND(PTHREAD_ONCE_SIZE, "Pad in pthread_once_t")
1362 #endif
1366 end System.OS_Constants;