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-2008, 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 #ifndef AF_INET6
841 # define AF_INET6 -1
842 #else
843 # define HAVE_AF_INET6 1
844 #endif
845 CND(AF_INET6, "IPv6 address family")
846
847 /*
848
849    ------------------
850    -- Socket modes --
851    ------------------
852
853 */
854
855 #ifndef SOCK_STREAM
856 # define SOCK_STREAM -1
857 #endif
858 CND(SOCK_STREAM, "Stream socket")
859
860 #ifndef SOCK_DGRAM
861 # define SOCK_DGRAM -1
862 #endif
863 CND(SOCK_DGRAM, "Datagram socket")
864
865 /*
866
867    -----------------
868    -- Host errors --
869    -----------------
870
871 */
872
873 #ifndef HOST_NOT_FOUND
874 # define HOST_NOT_FOUND -1
875 #endif
876 CND(HOST_NOT_FOUND, "Unknown host")
877
878 #ifndef TRY_AGAIN
879 # define TRY_AGAIN -1
880 #endif
881 CND(TRY_AGAIN, "Host name lookup failure")
882
883 #ifndef NO_DATA
884 # define NO_DATA -1
885 #endif
886 CND(NO_DATA, "No data record for name")
887
888 #ifndef NO_RECOVERY
889 # define NO_RECOVERY -1
890 #endif
891 CND(NO_RECOVERY, "Non recoverable errors")
892
893 /*
894
895    --------------------
896    -- Shutdown modes --
897    --------------------
898
899 */
900
901 #ifndef SHUT_RD
902 # define SHUT_RD -1
903 #endif
904 CND(SHUT_RD, "No more recv")
905
906 #ifndef SHUT_WR
907 # define SHUT_WR -1
908 #endif
909 CND(SHUT_WR, "No more send")
910
911 #ifndef SHUT_RDWR
912 # define SHUT_RDWR -1
913 #endif
914 CND(SHUT_RDWR, "No more recv/send")
915
916 /*
917
918    ---------------------
919    -- Protocol levels --
920    ---------------------
921
922 */
923
924 #ifndef SOL_SOCKET
925 # define SOL_SOCKET -1
926 #endif
927 CND(SOL_SOCKET, "Options for socket level")
928
929 #ifndef IPPROTO_IP
930 # define IPPROTO_IP -1
931 #endif
932 CND(IPPROTO_IP, "Dummy protocol for IP")
933
934 #ifndef IPPROTO_UDP
935 # define IPPROTO_UDP -1
936 #endif
937 CND(IPPROTO_UDP, "UDP")
938
939 #ifndef IPPROTO_TCP
940 # define IPPROTO_TCP -1
941 #endif
942 CND(IPPROTO_TCP, "TCP")
943
944 /*
945
946    -------------------
947    -- Request flags --
948    -------------------
949
950 */
951
952 #ifndef MSG_OOB
953 # define MSG_OOB -1
954 #endif
955 CND(MSG_OOB, "Process out-of-band data")
956
957 #ifndef MSG_PEEK
958 # define MSG_PEEK -1
959 #endif
960 CND(MSG_PEEK, "Peek at incoming data")
961
962 #ifndef MSG_EOR
963 # define MSG_EOR -1
964 #endif
965 CND(MSG_EOR, "Send end of record")
966
967 #ifndef MSG_WAITALL
968 # define MSG_WAITALL -1
969 #endif
970 CND(MSG_WAITALL, "Wait for full reception")
971
972 #ifndef MSG_NOSIGNAL
973 # define MSG_NOSIGNAL -1
974 #endif
975 CND(MSG_NOSIGNAL, "No SIGPIPE on send")
976
977 #ifdef __linux__
978 # define MSG_Forced_Flags "MSG_NOSIGNAL"
979 #else
980 # define MSG_Forced_Flags "0"
981 #endif
982 CNS(MSG_Forced_Flags, "")
983 /*
984    --  Flags set on all send(2) calls
985 */
986
987 /*
988
989    --------------------
990    -- Socket options --
991    --------------------
992
993 */
994
995 #ifndef TCP_NODELAY
996 # define TCP_NODELAY -1
997 #endif
998 CND(TCP_NODELAY, "Do not coalesce packets")
999
1000 #ifndef SO_REUSEADDR
1001 # define SO_REUSEADDR -1
1002 #endif
1003 CND(SO_REUSEADDR, "Bind reuse local address")
1004
1005 #ifndef SO_REUSEPORT
1006 # define SO_REUSEPORT -1
1007 #endif
1008 CND(SO_REUSEPORT, "Bind reuse port number")
1009
1010 #ifndef SO_KEEPALIVE
1011 # define SO_KEEPALIVE -1
1012 #endif
1013 CND(SO_KEEPALIVE, "Enable keep-alive msgs")
1014
1015 #ifndef SO_LINGER
1016 # define SO_LINGER -1
1017 #endif
1018 CND(SO_LINGER, "Defer close to flush data")
1019
1020 #ifndef SO_BROADCAST
1021 # define SO_BROADCAST -1
1022 #endif
1023 CND(SO_BROADCAST, "Can send broadcast msgs")
1024
1025 #ifndef SO_SNDBUF
1026 # define SO_SNDBUF -1
1027 #endif
1028 CND(SO_SNDBUF, "Set/get send buffer size")
1029
1030 #ifndef SO_RCVBUF
1031 # define SO_RCVBUF -1
1032 #endif
1033 CND(SO_RCVBUF, "Set/get recv buffer size")
1034
1035 #ifndef SO_SNDTIMEO
1036 # define SO_SNDTIMEO -1
1037 #endif
1038 CND(SO_SNDTIMEO, "Emission timeout")
1039
1040 #ifndef SO_RCVTIMEO
1041 # define SO_RCVTIMEO -1
1042 #endif
1043 CND(SO_RCVTIMEO, "Reception timeout")
1044
1045 #ifndef SO_ERROR
1046 # define SO_ERROR -1
1047 #endif
1048 CND(SO_ERROR, "Get/clear error status")
1049
1050 #ifndef IP_MULTICAST_IF
1051 # define IP_MULTICAST_IF -1
1052 #endif
1053 CND(IP_MULTICAST_IF, "Set/get mcast interface")
1054
1055 #ifndef IP_MULTICAST_TTL
1056 # define IP_MULTICAST_TTL -1
1057 #endif
1058 CND(IP_MULTICAST_TTL, "Set/get multicast TTL")
1059
1060 #ifndef IP_MULTICAST_LOOP
1061 # define IP_MULTICAST_LOOP -1
1062 #endif
1063 CND(IP_MULTICAST_LOOP, "Set/get mcast loopback")
1064
1065 #ifndef IP_ADD_MEMBERSHIP
1066 # define IP_ADD_MEMBERSHIP -1
1067 #endif
1068 CND(IP_ADD_MEMBERSHIP, "Join a multicast group")
1069
1070 #ifndef IP_DROP_MEMBERSHIP
1071 # define IP_DROP_MEMBERSHIP -1
1072 #endif
1073 CND(IP_DROP_MEMBERSHIP, "Leave a multicast group")
1074
1075 #ifndef IP_PKTINFO
1076 # define IP_PKTINFO -1
1077 #endif
1078 CND(IP_PKTINFO, "Get datagram info")
1079
1080 /*
1081
1082    ----------------------
1083    -- Type definitions --
1084    ----------------------
1085
1086 */
1087
1088 {
1089   struct timeval tv;
1090 /*
1091    --  Sizes (in bytes) of the components of struct timeval
1092 */
1093 #define SIZEOF_tv_sec (sizeof tv.tv_sec)
1094 CND(SIZEOF_tv_sec, "tv_sec")
1095 #define SIZEOF_tv_usec (sizeof tv.tv_usec)
1096 CND(SIZEOF_tv_usec, "tv_usec")
1097 }
1098 /*
1099
1100    --  Sizes of protocol specific address types (for sockaddr.sa_len)
1101 */
1102
1103 #define SIZEOF_sockaddr_in (sizeof (struct sockaddr_in))
1104 CND(SIZEOF_sockaddr_in, "struct sockaddr_in")
1105 #ifdef HAVE_AF_INET6
1106 # define SIZEOF_sockaddr_in6 (sizeof (struct sockaddr_in6))
1107 #else
1108 # define SIZEOF_sockaddr_in6 0
1109 #endif
1110 CND(SIZEOF_sockaddr_in6, "struct sockaddr_in6")
1111
1112 /*
1113
1114    --  Size of file descriptor sets
1115 */
1116 #define SIZEOF_fd_set (sizeof (fd_set))
1117 CND(SIZEOF_fd_set, "fd_set");
1118 /*
1119
1120    --  Fields of struct hostent
1121 */
1122
1123 #ifdef __MINGW32__
1124 # define h_addrtype_t "short"
1125 # define h_length_t   "short"
1126 #else
1127 # define h_addrtype_t "int"
1128 # define h_length_t   "int"
1129 #endif
1130
1131 TXT("   subtype H_Addrtype_T is Interfaces.C." h_addrtype_t ";")
1132 TXT("   subtype H_Length_T   is Interfaces.C." h_length_t ";")
1133
1134 /*
1135
1136    ----------------------------------------
1137    -- Properties of supported interfaces --
1138    ----------------------------------------
1139
1140 */
1141
1142 CND(Need_Netdb_Buffer, "Need buffer for Netdb ops")
1143 CND(Has_Sockaddr_Len,  "Sockaddr has sa_len field")
1144
1145 /**
1146  ** Do not change the format of the line below without also updating the
1147  ** MaRTE Makefile.
1148  **/
1149 TXT("   Thread_Blocking_IO  : constant Boolean := True;")
1150 /*
1151    --  Set False for contexts where socket i/o are process blocking
1152 */
1153
1154 #endif /* HAVE_SOCKETS */
1155
1156 /**
1157  **  System-specific constants follow
1158  **/
1159
1160 #ifdef __vxworks
1161
1162 /*
1163
1164    --------------------------------
1165    -- VxWorks-specific constants --
1166    --------------------------------
1167
1168    --  These constants may be used only within the VxWorks version of
1169    --  GNAT.Sockets.Thin.
1170 */
1171
1172 CND(OK,    "VxWorks generic success")
1173 CND(ERROR, "VxWorks generic error")
1174
1175 #endif
1176
1177 #ifdef __MINGW32__
1178 /*
1179
1180    ------------------------------
1181    -- MinGW-specific constants --
1182    ------------------------------
1183
1184    --  These constants may be used only within the MinGW version of
1185    --  GNAT.Sockets.Thin.
1186 */
1187
1188 CND(WSASYSNOTREADY,     "System not ready")
1189 CND(WSAVERNOTSUPPORTED, "Version not supported")
1190 CND(WSANOTINITIALISED,  "Winsock not initialized")
1191 CND(WSAEDISCON,         "Disconnected")
1192
1193 #endif
1194
1195 #ifdef NATIVE
1196    putchar ('\n');
1197 #endif
1198
1199 /*
1200
1201 end System.OS_Constants;
1202 */
1203 }