OSDN Git Service

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