OSDN Git Service

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