OSDN Git Service

PR middle-end/49875
[pf3gnuchains/gcc-fork.git] / gcc / ada / s-oscons-tmplt.c
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 ------------------------------------------------------------------------------
32
33 pragma Style_Checks ("M32766");
34 --  Allow long lines
35
36 */
37
38 /**
39  **  This template file is used while building the GNAT runtime library to
40  **  generate package System.OS_Constants (s-oscons.ads).
41  **
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.
49  **
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.
56  **
57  **  Two methods are supported to generate the list of constant values,
58  **  s-oscons-tmpl.s.
59  **
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:
63  **
64  **     xgcc -DTARGET=\"$target\" -C -E s-oscons-tmplt.c > s-oscons-tmplt.i
65  **     xgcc -S s-oscons-tmplt.i
66  **     xoscons
67  **
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:
71  **
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  **/
80
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
85
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
95
96 #include <stdlib.h>
97 #include <string.h>
98 #include <limits.h>
99 #include <fcntl.h>
100
101 #if defined (__alpha__) && defined (__osf__)
102 /** Tru64 is unable to do vector IO operations with default value of IOV_MAX,
103  ** so its value is redefined to a small one which is known to work properly.
104  **/
105 #undef IOV_MAX
106 #define IOV_MAX 16
107 #endif
108
109 #if defined (__VMS)
110 /** VMS is unable to do vector IO operations with default value of IOV_MAX,
111  ** so its value is redefined to a small one which is known to work properly.
112  **/
113 #undef IOV_MAX
114 #define IOV_MAX 16
115 #endif
116
117 #if ! (defined (__vxworks) || defined (__VMS) || defined (__MINGW32__) || \
118        defined (__nucleus__))
119 # define HAVE_TERMIOS
120 #endif
121
122 #if defined (__vxworks)
123
124 /**
125  ** For VxWorks, always include vxWorks.h (gsocket.h provides it only for
126  ** the case of runtime libraries that support sockets).
127  **/
128
129 # include <vxWorks.h>
130 #endif
131
132 #include "gsocket.h"
133
134 #ifdef DUMMY
135
136 # if defined (TARGET)
137 #   error TARGET may not be defined when generating the dummy version
138 # else
139 #   define TARGET "batch runtime compilation (dummy values)"
140 # endif
141
142 # if !(defined (HAVE_SOCKETS) && defined (HAVE_TERMIOS))
143 #   error Features missing on platform
144 # endif
145
146 # define NATIVE
147
148 #endif
149
150 #ifndef TARGET
151 # error Please define TARGET
152 #endif
153
154 #ifndef HAVE_SOCKETS
155 # include <errno.h>
156 #endif
157
158 #ifdef HAVE_TERMIOS
159 # include <termios.h>
160 #endif
161
162 #ifdef __APPLE__
163 # include <_types.h>
164 #endif
165
166 #ifdef NATIVE
167 #include <stdio.h>
168
169 #ifdef DUMMY
170 int counter = 0;
171 # define _VAL(x) counter++
172 #else
173 # define _VAL(x) x
174 #endif
175
176 #define CND(name,comment) \
177   printf ("\n->CND:$%d:" #name ":$%d:" comment, __LINE__, ((int) _VAL (name)));
178
179 #define CNS(name,comment) \
180   printf ("\n->CNS:$%d:" #name ":" name ":" comment, __LINE__);
181
182 #define C(sname,type,value,comment)\
183   printf ("\n->C:$%d:" sname ":" #type ":" value ":" comment, __LINE__);
184
185 #define TXT(text) \
186   printf ("\n->TXT:$%d:" text, __LINE__);
187
188 #else
189
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" */
194
195 #define CNS(name, comment) \
196   asm volatile("\n->CNS:%0:" #name ":" name ":" comment \
197   : : "i" (__LINE__));
198 /* General expression named number */
199
200 #define C(sname, type, value, comment) \
201   asm volatile("\n->C:%0:" sname ":" #type ":" value ":" comment \
202   : : "i" (__LINE__));
203 /* Typed constant */
204
205 #define TXT(text) \
206   asm volatile("\n->TXT:%0:" text \
207   : : "i" (__LINE__));
208 /* Freeform text */
209
210 #endif
211
212 #define CST(name,comment) C(#name,String,name,comment)
213
214 #define STR(x) STR1(x)
215 #define STR1(x) #x
216
217 #ifdef __MINGW32__
218 unsigned int _CRT_fmode = _O_BINARY;
219 #endif
220
221 int
222 main (void) {
223
224 /*
225 --  This package provides target dependent definitions of constant for use
226 --  by the GNAT runtime library. This package should not be directly with'd
227 --  by an application program.
228
229 --  This file is generated automatically, do not modify it by hand! Instead,
230 --  make changes to s-oscons-tmplt.c and rebuild the GNAT runtime library.
231 */
232
233 /**
234  ** Do not change the format of the line below without also updating the
235  ** MaRTE Makefile.
236  **/
237 TXT("--  This is the version for " TARGET)
238 TXT("")
239
240 #ifdef HAVE_SOCKETS
241 /**
242  **  The type definitions for struct hostent components uses Interfaces.C
243  **/
244
245 TXT("with Interfaces.C;")
246 #endif
247
248 /*
249 package System.OS_Constants is
250
251    pragma Pure;
252 */
253
254 /**
255  **  General constants (all platforms)
256  **/
257
258 /*
259
260    -----------------------------
261    -- Platform identification --
262    -----------------------------
263
264    type OS_Type is (Windows, VMS, Other_OS);
265 */
266 #if defined (__MINGW32__)
267 # define TARGET_OS "Windows"
268 #elif defined (__VMS)
269 # define TARGET_OS "VMS"
270 #else
271 # define TARGET_OS "Other_OS"
272 #endif
273 C("Target_OS", OS_Type, TARGET_OS, "")
274 #define Target_Name TARGET
275 CST(Target_Name, "")
276 /*
277
278    -------------------
279    -- System limits --
280    -------------------
281
282 */
283
284 #ifndef IOV_MAX
285 # define IOV_MAX INT_MAX
286 #endif
287 CND(IOV_MAX, "Maximum writev iovcnt")
288
289 /*
290
291    ---------------------
292    -- File open modes --
293    ---------------------
294
295 */
296
297 #ifndef O_RDWR
298 # define O_RDWR -1
299 #endif
300 CND(O_RDWR, "Read/write")
301
302 #ifndef O_NOCTTY
303 # define O_NOCTTY -1
304 #endif
305 CND(O_NOCTTY, "Don't change ctrl tty")
306
307 #ifndef O_NDELAY
308 # define O_NDELAY -1
309 #endif
310 CND(O_NDELAY, "Nonblocking")
311
312 /*
313
314    ----------------------
315    -- Fcntl operations --
316    ----------------------
317
318 */
319
320 #ifndef F_GETFL
321 # define F_GETFL -1
322 #endif
323 CND(F_GETFL, "Get flags")
324
325 #ifndef F_SETFL
326 # define F_SETFL -1
327 #endif
328 CND(F_SETFL, "Set flags")
329
330 /*
331
332    -----------------
333    -- Fcntl flags --
334    -----------------
335
336 */
337
338 #ifndef FNDELAY
339 # define FNDELAY -1
340 #endif
341 CND(FNDELAY, "Nonblocking")
342
343 /*
344
345    ----------------------
346    -- Ioctl operations --
347    ----------------------
348
349 */
350
351 #ifndef FIONBIO
352 # define FIONBIO -1
353 #endif
354 CND(FIONBIO, "Set/clear non-blocking io")
355
356 #ifndef FIONREAD
357 # define FIONREAD -1
358 #endif
359 CND(FIONREAD, "How many bytes to read")
360
361 /*
362
363    ------------------
364    -- Errno values --
365    ------------------
366
367    --  The following constants are defined from <errno.h>
368
369 */
370 #ifndef EAGAIN
371 # define EAGAIN -1
372 #endif
373 CND(EAGAIN, "Try again")
374
375 #ifndef ENOENT
376 # define ENOENT -1
377 #endif
378 CND(ENOENT, "File not found")
379
380 #ifndef ENOMEM
381 # define ENOMEM -1
382 #endif
383 CND(ENOMEM, "Out of memory")
384
385 #ifdef __MINGW32__
386 /*
387
388    --  The following constants are defined from <winsock2.h> (WSA*)
389
390 */
391
392 /**
393  **  For sockets-related errno values on Windows, gsocket.h redefines
394  **  Exxx as WSAExxx.
395  **/
396
397 #endif
398
399 #ifndef EACCES
400 # define EACCES -1
401 #endif
402 CND(EACCES, "Permission denied")
403
404 #ifndef EADDRINUSE
405 # define EADDRINUSE -1
406 #endif
407 CND(EADDRINUSE, "Address already in use")
408
409 #ifndef EADDRNOTAVAIL
410 # define EADDRNOTAVAIL -1
411 #endif
412 CND(EADDRNOTAVAIL, "Cannot assign address")
413
414 #ifndef EAFNOSUPPORT
415 # define EAFNOSUPPORT -1
416 #endif
417 CND(EAFNOSUPPORT, "Addr family not supported")
418
419 #ifndef EALREADY
420 # define EALREADY -1
421 #endif
422 CND(EALREADY, "Operation in progress")
423
424 #ifndef EBADF
425 # define EBADF -1
426 #endif
427 CND(EBADF, "Bad file descriptor")
428
429 #ifndef ECONNABORTED
430 # define ECONNABORTED -1
431 #endif
432 CND(ECONNABORTED, "Connection aborted")
433
434 #ifndef ECONNREFUSED
435 # define ECONNREFUSED -1
436 #endif
437 CND(ECONNREFUSED, "Connection refused")
438
439 #ifndef ECONNRESET
440 # define ECONNRESET -1
441 #endif
442 CND(ECONNRESET, "Connection reset by peer")
443
444 #ifndef EDESTADDRREQ
445 # define EDESTADDRREQ -1
446 #endif
447 CND(EDESTADDRREQ, "Destination addr required")
448
449 #ifndef EFAULT
450 # define EFAULT -1
451 #endif
452 CND(EFAULT, "Bad address")
453
454 #ifndef EHOSTDOWN
455 # define EHOSTDOWN -1
456 #endif
457 CND(EHOSTDOWN, "Host is down")
458
459 #ifndef EHOSTUNREACH
460 # define EHOSTUNREACH -1
461 #endif
462 CND(EHOSTUNREACH, "No route to host")
463
464 #ifndef EINPROGRESS
465 # define EINPROGRESS -1
466 #endif
467 CND(EINPROGRESS, "Operation now in progress")
468
469 #ifndef EINTR
470 # define EINTR -1
471 #endif
472 CND(EINTR, "Interrupted system call")
473
474 #ifndef EINVAL
475 # define EINVAL -1
476 #endif
477 CND(EINVAL, "Invalid argument")
478
479 #ifndef EIO
480 # define EIO -1
481 #endif
482 CND(EIO, "Input output error")
483
484 #ifndef EISCONN
485 # define EISCONN -1
486 #endif
487 CND(EISCONN, "Socket already connected")
488
489 #ifndef ELOOP
490 # define ELOOP -1
491 #endif
492 CND(ELOOP, "Too many symbolic links")
493
494 #ifndef EMFILE
495 # define EMFILE -1
496 #endif
497 CND(EMFILE, "Too many open files")
498
499 #ifndef EMSGSIZE
500 # define EMSGSIZE -1
501 #endif
502 CND(EMSGSIZE, "Message too long")
503
504 #ifndef ENAMETOOLONG
505 # define ENAMETOOLONG -1
506 #endif
507 CND(ENAMETOOLONG, "Name too long")
508
509 #ifndef ENETDOWN
510 # define ENETDOWN -1
511 #endif
512 CND(ENETDOWN, "Network is down")
513
514 #ifndef ENETRESET
515 # define ENETRESET -1
516 #endif
517 CND(ENETRESET, "Disconn. on network reset")
518
519 #ifndef ENETUNREACH
520 # define ENETUNREACH -1
521 #endif
522 CND(ENETUNREACH, "Network is unreachable")
523
524 #ifndef ENOBUFS
525 # define ENOBUFS -1
526 #endif
527 CND(ENOBUFS, "No buffer space available")
528
529 #ifndef ENOPROTOOPT
530 # define ENOPROTOOPT -1
531 #endif
532 CND(ENOPROTOOPT, "Protocol not available")
533
534 #ifndef ENOTCONN
535 # define ENOTCONN -1
536 #endif
537 CND(ENOTCONN, "Socket not connected")
538
539 #ifndef ENOTSOCK
540 # define ENOTSOCK -1
541 #endif
542 CND(ENOTSOCK, "Operation on non socket")
543
544 #ifndef EOPNOTSUPP
545 # define EOPNOTSUPP -1
546 #endif
547 CND(EOPNOTSUPP, "Operation not supported")
548
549 #ifndef EPIPE
550 # define EPIPE -1
551 #endif
552 CND(EPIPE, "Broken pipe")
553
554 #ifndef EPFNOSUPPORT
555 # define EPFNOSUPPORT -1
556 #endif
557 CND(EPFNOSUPPORT, "Unknown protocol family")
558
559 #ifndef EPROTONOSUPPORT
560 # define EPROTONOSUPPORT -1
561 #endif
562 CND(EPROTONOSUPPORT, "Unknown protocol")
563
564 #ifndef EPROTOTYPE
565 # define EPROTOTYPE -1
566 #endif
567 CND(EPROTOTYPE, "Unknown protocol type")
568
569 #ifndef ERANGE
570 # define ERANGE -1
571 #endif
572 CND(ERANGE, "Result too large")
573
574 #ifndef ESHUTDOWN
575 # define ESHUTDOWN -1
576 #endif
577 CND(ESHUTDOWN, "Cannot send once shutdown")
578
579 #ifndef ESOCKTNOSUPPORT
580 # define ESOCKTNOSUPPORT -1
581 #endif
582 CND(ESOCKTNOSUPPORT, "Socket type not supported")
583
584 #ifndef ETIMEDOUT
585 # define ETIMEDOUT -1
586 #endif
587 CND(ETIMEDOUT, "Connection timed out")
588
589 #ifndef ETOOMANYREFS
590 # define ETOOMANYREFS -1
591 #endif
592 CND(ETOOMANYREFS, "Too many references")
593
594 #ifndef EWOULDBLOCK
595 # define EWOULDBLOCK -1
596 #endif
597 CND(EWOULDBLOCK, "Operation would block")
598
599 /**
600  **  Terminal I/O constants
601  **/
602
603 #ifdef HAVE_TERMIOS
604
605 /*
606
607    ----------------------
608    -- Terminal control --
609    ----------------------
610
611 */
612
613 #ifndef TCSANOW
614 # define TCSANOW -1
615 #endif
616 CND(TCSANOW, "Immediate")
617
618 #ifndef TCIFLUSH
619 # define TCIFLUSH -1
620 #endif
621 CND(TCIFLUSH, "Flush input")
622
623 #ifndef CLOCAL
624 # define CLOCAL -1
625 #endif
626 CND(CLOCAL, "Local")
627
628 #ifndef CRTSCTS
629 # define CRTSCTS -1
630 #endif
631 CND(CRTSCTS, "Hardware flow control")
632
633 #ifndef CREAD
634 # define CREAD -1
635 #endif
636 CND(CREAD, "Read")
637
638 #ifndef CS5
639 # define CS5 -1
640 #endif
641 CND(CS5, "5 data bits")
642
643 #ifndef CS6
644 # define CS6 -1
645 #endif
646 CND(CS6, "6 data bits")
647
648 #ifndef CS7
649 # define CS7 -1
650 #endif
651 CND(CS7, "7 data bits")
652
653 #ifndef CS8
654 # define CS8 -1
655 #endif
656 CND(CS8, "8 data bits")
657
658 #ifndef CSTOPB
659 # define CSTOPB -1
660 #endif
661 CND(CSTOPB, "2 stop bits")
662
663 #ifndef PARENB
664 # define PARENB -1
665 #endif
666 CND(PARENB, "Parity enable")
667
668 #ifndef PARODD
669 # define PARODD -1
670 #endif
671 CND(PARODD, "Parity odd")
672
673 #ifndef B0
674 # define B0 -1
675 #endif
676 CND(B0, "0 bps")
677
678 #ifndef B50
679 # define B50 -1
680 #endif
681 CND(B50, "50 bps")
682
683 #ifndef B75
684 # define B75 -1
685 #endif
686 CND(B75, "75 bps")
687
688 #ifndef B110
689 # define B110 -1
690 #endif
691 CND(B110, "110 bps")
692
693 #ifndef B134
694 # define B134 -1
695 #endif
696 CND(B134, "134 bps")
697
698 #ifndef B150
699 # define B150 -1
700 #endif
701 CND(B150, "150 bps")
702
703 #ifndef B200
704 # define B200 -1
705 #endif
706 CND(B200, "200 bps")
707
708 #ifndef B300
709 # define B300 -1
710 #endif
711 CND(B300, "300 bps")
712
713 #ifndef B600
714 # define B600 -1
715 #endif
716 CND(B600, "600 bps")
717
718 #ifndef B1200
719 # define B1200 -1
720 #endif
721 CND(B1200, "1200 bps")
722
723 #ifndef B1800
724 # define B1800 -1
725 #endif
726 CND(B1800, "1800 bps")
727
728 #ifndef B2400
729 # define B2400 -1
730 #endif
731 CND(B2400, "2400 bps")
732
733 #ifndef B4800
734 # define B4800 -1
735 #endif
736 CND(B4800, "4800 bps")
737
738 #ifndef B9600
739 # define B9600 -1
740 #endif
741 CND(B9600, "9600 bps")
742
743 #ifndef B19200
744 # define B19200 -1
745 #endif
746 CND(B19200, "19200 bps")
747
748 #ifndef B38400
749 # define B38400 -1
750 #endif
751 CND(B38400, "38400 bps")
752
753 #ifndef B57600
754 # define B57600 -1
755 #endif
756 CND(B57600, "57600 bps")
757
758 #ifndef B115200
759 # define B115200 -1
760 #endif
761 CND(B115200, "115200 bps")
762
763 #ifndef B230400
764 # define B230400 -1
765 #endif
766 CND(B230400, "230400 bps")
767
768 #ifndef B460800
769 # define B460800 -1
770 #endif
771 CND(B460800, "460800 bps")
772
773 #ifndef B500000
774 # define B500000 -1
775 #endif
776 CND(B500000, "500000 bps")
777
778 #ifndef B576000
779 # define B576000 -1
780 #endif
781 CND(B576000, "576000 bps")
782
783 #ifndef B921600
784 # define B921600 -1
785 #endif
786 CND(B921600, "921600 bps")
787
788 #ifndef B1000000
789 # define B1000000 -1
790 #endif
791 CND(B1000000, "1000000 bps")
792
793 #ifndef B1152000
794 # define B1152000 -1
795 #endif
796 CND(B1152000, "1152000 bps")
797
798 #ifndef B1500000
799 # define B1500000 -1
800 #endif
801 CND(B1500000, "1500000 bps")
802
803 #ifndef B2000000
804 # define B2000000 -1
805 #endif
806 CND(B2000000, "2000000 bps")
807
808 #ifndef B2500000
809 # define B2500000 -1
810 #endif
811 CND(B2500000, "2500000 bps")
812
813 #ifndef B3000000
814 # define B3000000 -1
815 #endif
816 CND(B3000000, "3000000 bps")
817
818 #ifndef B3500000
819 # define B3500000 -1
820 #endif
821 CND(B3500000, "3500000 bps")
822
823 #ifndef B4000000
824 # define B4000000 -1
825 #endif
826 CND(B4000000, "4000000 bps")
827
828 /*
829
830    ---------------------------------
831    -- Terminal control characters --
832    ---------------------------------
833
834 */
835
836 #ifndef VINTR
837 # define VINTR -1
838 #endif
839 CND(VINTR, "Interrupt")
840
841 #ifndef VQUIT
842 # define VQUIT -1
843 #endif
844 CND(VQUIT, "Quit")
845
846 #ifndef VERASE
847 # define VERASE -1
848 #endif
849 CND(VERASE, "Erase")
850
851 #ifndef VKILL
852 # define VKILL -1
853 #endif
854 CND(VKILL, "Kill")
855
856 #ifndef VEOF
857 # define VEOF -1
858 #endif
859 CND(VEOF, "EOF")
860
861 #ifndef VTIME
862 # define VTIME -1
863 #endif
864 CND(VTIME, "Read timeout")
865
866 #ifndef VMIN
867 # define VMIN -1
868 #endif
869 CND(VMIN, "Read min chars")
870
871 #ifndef VSWTC
872 # define VSWTC -1
873 #endif
874 CND(VSWTC, "Switch")
875
876 #ifndef VSTART
877 # define VSTART -1
878 #endif
879 CND(VSTART, "Flow control start")
880
881 #ifndef VSTOP
882 # define VSTOP -1
883 #endif
884 CND(VSTOP, "Flow control stop")
885
886 #ifndef VSUSP
887 # define VSUSP -1
888 #endif
889 CND(VSUSP, "Suspend")
890
891 #ifndef VEOL
892 # define VEOL -1
893 #endif
894 CND(VEOL, "EOL")
895
896 #ifndef VREPRINT
897 # define VREPRINT -1
898 #endif
899 CND(VREPRINT, "Reprint unread")
900
901 #ifndef VDISCARD
902 # define VDISCARD -1
903 #endif
904 CND(VDISCARD, "Discard pending")
905
906 #ifndef VWERASE
907 # define VWERASE -1
908 #endif
909 CND(VWERASE, "Word erase")
910
911 #ifndef VLNEXT
912 # define VLNEXT -1
913 #endif
914 CND(VLNEXT, "Literal next")
915
916 #ifndef VEOL2
917 # define VEOL2 -1
918 #endif
919 CND(VEOL2, "Alternative EOL")
920
921 #endif /* HAVE_TERMIOS */
922
923 /**
924  **  Sockets constants
925  **/
926
927 #ifdef HAVE_SOCKETS
928
929 /*
930
931    --------------
932    -- Families --
933    --------------
934
935 */
936
937 #ifndef AF_INET
938 # define AF_INET -1
939 #endif
940 CND(AF_INET, "IPv4 address family")
941
942 /**
943  ** RTEMS lies and defines AF_INET6 even though there is no IPV6 support.
944  ** Its TCP/IP stack is in transition.  It has newer .h files but no IPV6 yet.
945  **/
946 #if defined(__rtems__)
947 # undef AF_INET6
948 #endif
949
950 /**
951  ** Tru64 UNIX V4.0F defines AF_INET6 without IPv6 support, specifically
952  ** without struct sockaddr_in6.  We use _SS_MAXSIZE (used for the definition
953  ** of struct sockaddr_storage on Tru64 UNIX V5.1) to detect this.
954  **/
955 #if defined(__osf__) && !defined(_SS_MAXSIZE)
956 # undef AF_INET6
957 #endif
958
959 #ifndef AF_INET6
960 # define AF_INET6 -1
961 #else
962 # define HAVE_AF_INET6 1
963 #endif
964 CND(AF_INET6, "IPv6 address family")
965
966 /*
967
968    ------------------
969    -- Socket modes --
970    ------------------
971
972 */
973
974 #ifndef SOCK_STREAM
975 # define SOCK_STREAM -1
976 #endif
977 CND(SOCK_STREAM, "Stream socket")
978
979 #ifndef SOCK_DGRAM
980 # define SOCK_DGRAM -1
981 #endif
982 CND(SOCK_DGRAM, "Datagram socket")
983
984 /*
985
986    -----------------
987    -- Host errors --
988    -----------------
989
990 */
991
992 #ifndef HOST_NOT_FOUND
993 # define HOST_NOT_FOUND -1
994 #endif
995 CND(HOST_NOT_FOUND, "Unknown host")
996
997 #ifndef TRY_AGAIN
998 # define TRY_AGAIN -1
999 #endif
1000 CND(TRY_AGAIN, "Host name lookup failure")
1001
1002 #ifndef NO_DATA
1003 # define NO_DATA -1
1004 #endif
1005 CND(NO_DATA, "No data record for name")
1006
1007 #ifndef NO_RECOVERY
1008 # define NO_RECOVERY -1
1009 #endif
1010 CND(NO_RECOVERY, "Non recoverable errors")
1011
1012 /*
1013
1014    --------------------
1015    -- Shutdown modes --
1016    --------------------
1017
1018 */
1019
1020 #ifndef SHUT_RD
1021 # define SHUT_RD -1
1022 #endif
1023 CND(SHUT_RD, "No more recv")
1024
1025 #ifndef SHUT_WR
1026 # define SHUT_WR -1
1027 #endif
1028 CND(SHUT_WR, "No more send")
1029
1030 #ifndef SHUT_RDWR
1031 # define SHUT_RDWR -1
1032 #endif
1033 CND(SHUT_RDWR, "No more recv/send")
1034
1035 /*
1036
1037    ---------------------
1038    -- Protocol levels --
1039    ---------------------
1040
1041 */
1042
1043 #ifndef SOL_SOCKET
1044 # define SOL_SOCKET -1
1045 #endif
1046 CND(SOL_SOCKET, "Options for socket level")
1047
1048 #ifndef IPPROTO_IP
1049 # define IPPROTO_IP -1
1050 #endif
1051 CND(IPPROTO_IP, "Dummy protocol for IP")
1052
1053 #ifndef IPPROTO_UDP
1054 # define IPPROTO_UDP -1
1055 #endif
1056 CND(IPPROTO_UDP, "UDP")
1057
1058 #ifndef IPPROTO_TCP
1059 # define IPPROTO_TCP -1
1060 #endif
1061 CND(IPPROTO_TCP, "TCP")
1062
1063 /*
1064
1065    -------------------
1066    -- Request flags --
1067    -------------------
1068
1069 */
1070
1071 #ifndef MSG_OOB
1072 # define MSG_OOB -1
1073 #endif
1074 CND(MSG_OOB, "Process out-of-band data")
1075
1076 #ifndef MSG_PEEK
1077 # define MSG_PEEK -1
1078 #endif
1079 CND(MSG_PEEK, "Peek at incoming data")
1080
1081 #ifndef MSG_EOR
1082 # define MSG_EOR -1
1083 #endif
1084 CND(MSG_EOR, "Send end of record")
1085
1086 #ifndef MSG_WAITALL
1087 #ifdef __MINWGW32__
1088 /* The value of MSG_WAITALL is 8.  Nevertheless winsock.h doesn't
1089    define it, but it is still usable as we link to winsock2 API.  */
1090 # define MSG_WAITALL (1 << 3)
1091 #else
1092 # define MSG_WAITALL -1
1093 #endif
1094 #endif
1095 CND(MSG_WAITALL, "Wait for full reception")
1096
1097 #ifndef MSG_NOSIGNAL
1098 # define MSG_NOSIGNAL -1
1099 #endif
1100 CND(MSG_NOSIGNAL, "No SIGPIPE on send")
1101
1102 #ifdef __linux__
1103 # define MSG_Forced_Flags "MSG_NOSIGNAL"
1104 #else
1105 # define MSG_Forced_Flags "0"
1106 #endif
1107 CNS(MSG_Forced_Flags, "")
1108 /*
1109    --  Flags set on all send(2) calls
1110 */
1111
1112 /*
1113
1114    --------------------
1115    -- Socket options --
1116    --------------------
1117
1118 */
1119
1120 #ifndef TCP_NODELAY
1121 # define TCP_NODELAY -1
1122 #endif
1123 CND(TCP_NODELAY, "Do not coalesce packets")
1124
1125 #ifndef SO_REUSEADDR
1126 # define SO_REUSEADDR -1
1127 #endif
1128 CND(SO_REUSEADDR, "Bind reuse local address")
1129
1130 #ifndef SO_REUSEPORT
1131 # define SO_REUSEPORT -1
1132 #endif
1133 CND(SO_REUSEPORT, "Bind reuse port number")
1134
1135 #ifndef SO_KEEPALIVE
1136 # define SO_KEEPALIVE -1
1137 #endif
1138 CND(SO_KEEPALIVE, "Enable keep-alive msgs")
1139
1140 #ifndef SO_LINGER
1141 # define SO_LINGER -1
1142 #endif
1143 CND(SO_LINGER, "Defer close to flush data")
1144
1145 #ifndef SO_BROADCAST
1146 # define SO_BROADCAST -1
1147 #endif
1148 CND(SO_BROADCAST, "Can send broadcast msgs")
1149
1150 #ifndef SO_SNDBUF
1151 # define SO_SNDBUF -1
1152 #endif
1153 CND(SO_SNDBUF, "Set/get send buffer size")
1154
1155 #ifndef SO_RCVBUF
1156 # define SO_RCVBUF -1
1157 #endif
1158 CND(SO_RCVBUF, "Set/get recv buffer size")
1159
1160 #ifndef SO_SNDTIMEO
1161 # define SO_SNDTIMEO -1
1162 #endif
1163 CND(SO_SNDTIMEO, "Emission timeout")
1164
1165 #ifndef SO_RCVTIMEO
1166 # define SO_RCVTIMEO -1
1167 #endif
1168 CND(SO_RCVTIMEO, "Reception timeout")
1169
1170 #ifndef SO_ERROR
1171 # define SO_ERROR -1
1172 #endif
1173 CND(SO_ERROR, "Get/clear error status")
1174
1175 #ifndef IP_MULTICAST_IF
1176 # define IP_MULTICAST_IF -1
1177 #endif
1178 CND(IP_MULTICAST_IF, "Set/get mcast interface")
1179
1180 #ifndef IP_MULTICAST_TTL
1181 # define IP_MULTICAST_TTL -1
1182 #endif
1183 CND(IP_MULTICAST_TTL, "Set/get multicast TTL")
1184
1185 #ifndef IP_MULTICAST_LOOP
1186 # define IP_MULTICAST_LOOP -1
1187 #endif
1188 CND(IP_MULTICAST_LOOP, "Set/get mcast loopback")
1189
1190 #ifndef IP_ADD_MEMBERSHIP
1191 # define IP_ADD_MEMBERSHIP -1
1192 #endif
1193 CND(IP_ADD_MEMBERSHIP, "Join a multicast group")
1194
1195 #ifndef IP_DROP_MEMBERSHIP
1196 # define IP_DROP_MEMBERSHIP -1
1197 #endif
1198 CND(IP_DROP_MEMBERSHIP, "Leave a multicast group")
1199
1200 #ifndef IP_PKTINFO
1201 # define IP_PKTINFO -1
1202 #endif
1203 CND(IP_PKTINFO, "Get datagram info")
1204
1205 /*
1206
1207    ----------------------
1208    -- Type definitions --
1209    ----------------------
1210
1211 */
1212
1213 {
1214   struct timeval tv;
1215 /*
1216    --  Sizes (in bytes) of the components of struct timeval
1217 */
1218 #define SIZEOF_tv_sec (sizeof tv.tv_sec)
1219 CND(SIZEOF_tv_sec, "tv_sec")
1220 #define SIZEOF_tv_usec (sizeof tv.tv_usec)
1221 CND(SIZEOF_tv_usec, "tv_usec")
1222 }
1223 /*
1224
1225    --  Sizes of various data types
1226 */
1227
1228 #define SIZEOF_sockaddr_in (sizeof (struct sockaddr_in))
1229 CND(SIZEOF_sockaddr_in, "struct sockaddr_in")
1230 #ifdef HAVE_AF_INET6
1231 # define SIZEOF_sockaddr_in6 (sizeof (struct sockaddr_in6))
1232 #else
1233 # define SIZEOF_sockaddr_in6 0
1234 #endif
1235 CND(SIZEOF_sockaddr_in6, "struct sockaddr_in6")
1236
1237 #define SIZEOF_fd_set (sizeof (fd_set))
1238 CND(SIZEOF_fd_set, "fd_set");
1239
1240 #define SIZEOF_struct_hostent (sizeof (struct hostent))
1241 CND(SIZEOF_struct_hostent, "struct hostent");
1242
1243 #define SIZEOF_struct_servent (sizeof (struct servent))
1244 CND(SIZEOF_struct_servent, "struct servent");
1245 /*
1246
1247    --  Fields of struct msghdr
1248 */
1249
1250 #if defined (__sun__) || defined (__hpux__)
1251 # define msg_iovlen_t "int"
1252 #else
1253 # define msg_iovlen_t "size_t"
1254 #endif
1255
1256 TXT("   subtype Msg_Iovlen_T is Interfaces.C." msg_iovlen_t ";")
1257
1258 /*
1259
1260    ----------------------------------------
1261    -- Properties of supported interfaces --
1262    ----------------------------------------
1263
1264 */
1265
1266 CND(Need_Netdb_Buffer, "Need buffer for Netdb ops")
1267 CND(Need_Netdb_Lock,   "Need lock for Netdb ops")
1268 CND(Has_Sockaddr_Len,  "Sockaddr has sa_len field")
1269
1270 /**
1271  ** Do not change the format of the line below without also updating the
1272  ** MaRTE Makefile.
1273  **/
1274 C("Thread_Blocking_IO", Boolean, "True", "")
1275 /*
1276    --  Set False for contexts where socket i/o are process blocking
1277
1278 */
1279
1280 #ifdef HAVE_INET_PTON
1281 # define Inet_Pton_Linkname "inet_pton"
1282 #else
1283 # define Inet_Pton_Linkname "__gnat_inet_pton"
1284 #endif
1285 CST(Inet_Pton_Linkname, "")
1286
1287 #endif /* HAVE_SOCKETS */
1288
1289 /**
1290  **  System-specific constants follow
1291  **  Each section should be activated if compiling for the corresponding
1292  **  platform *or* generating the dummy version for runtime test compilation.
1293  **/
1294
1295 #if defined (__vxworks) || defined (DUMMY)
1296
1297 /*
1298
1299    --------------------------------
1300    -- VxWorks-specific constants --
1301    --------------------------------
1302
1303    --  These constants may be used only within the VxWorks version of
1304    --  GNAT.Sockets.Thin.
1305 */
1306
1307 CND(OK,    "VxWorks generic success")
1308 CND(ERROR, "VxWorks generic error")
1309
1310 #endif
1311
1312 #if defined (__MINGW32__) || defined (DUMMY)
1313 /*
1314
1315    ------------------------------
1316    -- MinGW-specific constants --
1317    ------------------------------
1318
1319    --  These constants may be used only within the MinGW version of
1320    --  GNAT.Sockets.Thin.
1321 */
1322
1323 CND(WSASYSNOTREADY,     "System not ready")
1324 CND(WSAVERNOTSUPPORTED, "Version not supported")
1325 CND(WSANOTINITIALISED,  "Winsock not initialized")
1326 CND(WSAEDISCON,         "Disconnected")
1327
1328 #endif
1329
1330 #ifdef NATIVE
1331    putchar ('\n');
1332 #endif
1333
1334 #if defined (__APPLE__) || defined (DUMMY)
1335 /*
1336
1337    -------------------------------
1338    -- Darwin-specific constants --
1339    -------------------------------
1340
1341    --  These constants may be used only within the Darwin version of the GNAT
1342    --  runtime library.
1343 */
1344
1345 #define PTHREAD_SIZE __PTHREAD_SIZE__
1346 CND(PTHREAD_SIZE, "Pad in pthread_t")
1347
1348 #define PTHREAD_ATTR_SIZE __PTHREAD_ATTR_SIZE__
1349 CND(PTHREAD_ATTR_SIZE, "Pad in pthread_attr_t")
1350
1351 #define PTHREAD_MUTEXATTR_SIZE __PTHREAD_MUTEXATTR_SIZE__
1352 CND(PTHREAD_MUTEXATTR_SIZE, "Pad in pthread_mutexattr_t")
1353
1354 #define PTHREAD_MUTEX_SIZE __PTHREAD_MUTEX_SIZE__
1355 CND(PTHREAD_MUTEX_SIZE, "Pad in pthread_mutex_t")
1356
1357 #define PTHREAD_CONDATTR_SIZE __PTHREAD_CONDATTR_SIZE__
1358 CND(PTHREAD_CONDATTR_SIZE, "Pad in pthread_condattr_t")
1359
1360 #define PTHREAD_COND_SIZE __PTHREAD_COND_SIZE__
1361 CND(PTHREAD_COND_SIZE, "Pad in pthread_cond_t")
1362
1363 #define PTHREAD_RWLOCKATTR_SIZE __PTHREAD_RWLOCKATTR_SIZE__
1364 CND(PTHREAD_RWLOCKATTR_SIZE, "Pad in pthread_rwlockattr_t")
1365
1366 #define PTHREAD_RWLOCK_SIZE __PTHREAD_RWLOCK_SIZE__
1367 CND(PTHREAD_RWLOCK_SIZE, "Pad in pthread_rwlock_t")
1368
1369 #define PTHREAD_ONCE_SIZE __PTHREAD_ONCE_SIZE__
1370 CND(PTHREAD_ONCE_SIZE, "Pad in pthread_once_t")
1371
1372 #endif
1373
1374 /*
1375
1376 end System.OS_Constants;
1377 */
1378 }