OSDN Git Service

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