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