OSDN Git Service

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