* config/linux/x86/futex_bits.h (sys_futex0) [__x86_64__]: Change
[official-gcc.git] / gcc / ada / s-oscons-tmplt.c
blob053d4a71bbaced3748748526ca99322f458cb524
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-2015, 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 ------------------------------------------------------------------------------
33 pragma Style_Checks ("M32766");
34 -- Allow long lines
38 /**
39 ** This template file is used while building the GNAT runtime library to
40 ** generate package System.OS_Constants (s-oscons.ads).
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.
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.
57 ** Two methods are supported to generate the list of constant values,
58 ** s-oscons-tmpl.s.
60 ** The default one assumes that the template can be compiled by the newly-
61 ** built cross compiler. It uses markup produced in the (pseudo-)assembly
62 ** listing:
64 ** xgcc -DTARGET=\"$target\" -C -E s-oscons-tmplt.c > s-oscons-tmplt.i
65 ** xgcc -S s-oscons-tmplt.i
66 ** xoscons
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:
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 **/
81 /* Feature macro definitions */
83 /**
84 ** Note: we deliberately do not define _POSIX_SOURCE / _POSIX_C_SOURCE
85 ** unconditionally, as on many platforms these macros actually disable
86 ** a number of non-POSIX but useful/required features.
87 **/
89 #if defined (__linux__)
91 /* Define _XOPEN_SOURCE to get IOV_MAX */
92 # if !defined (_XOPEN_SOURCE)
93 # define _XOPEN_SOURCE 500
94 # endif
96 /* Define _BSD_SOURCE to get CRTSCTS */
97 # define _BSD_SOURCE
99 #endif /* defined (__linux__) */
101 /* Include gsocket.h before any system header so it can redefine FD_SETSIZE */
103 #include "gsocket.h"
105 #include <stdlib.h>
106 #include <string.h>
107 #include <limits.h>
108 #include <fcntl.h>
109 #include <time.h>
111 #if ! (defined (__vxworks) || defined (__MINGW32__))
112 # define HAVE_TERMIOS
113 #endif
115 #if defined (__vxworks)
118 ** For VxWorks, always include vxWorks.h (gsocket.h provides it only for
119 ** the case of runtime libraries that support sockets). Note: this must
120 ** be done before including adaint.h.
123 # include <vxWorks.h>
124 #endif
126 #include "adaint.h"
128 #ifdef DUMMY
130 # if defined (TARGET)
131 # error TARGET may not be defined when generating the dummy version
132 # else
133 # define TARGET "batch runtime compilation (dummy values)"
134 # endif
136 # if !(defined (HAVE_SOCKETS) && defined (HAVE_TERMIOS))
137 # error Features missing on platform
138 # endif
140 # define NATIVE
142 #endif /* DUMMY */
144 #ifndef TARGET
145 # error Please define TARGET
146 #endif
148 #ifndef HAVE_SOCKETS
149 # include <errno.h>
150 #endif
152 #ifdef HAVE_TERMIOS
153 # include <termios.h>
154 #endif
156 #ifdef __APPLE__
157 # include <_types.h>
158 #endif
160 #ifdef __linux__
161 # include <pthread.h>
162 # include <signal.h>
163 #endif
165 #if defined(__MINGW32__) || defined(__CYGWIN__)
166 # include <windef.h>
167 # include <winbase.h>
168 #endif
170 #ifdef NATIVE
171 #include <stdio.h>
173 #ifdef DUMMY
174 int counter = 0;
175 # define _VAL(x) counter++
176 #else
177 # define _VAL(x) x
178 #endif
180 #define CND(name,comment) \
181 printf ("\n->CND:$%d:" #name ":$%d:" comment, __LINE__, ((int) _VAL (name)));
183 #define CNU(name,comment) \
184 printf ("\n->CNU:$%d:" #name ":$%u:" comment, __LINE__, ((unsigned int) _VAL (name)));
186 #define CNS(name,comment) \
187 printf ("\n->CNS:$%d:" #name ":" name ":" comment, __LINE__);
189 #define C(sname,type,value,comment)\
190 printf ("\n->C:$%d:" sname ":" #type ":" value ":" comment, __LINE__);
192 #define SUB(sname)\
193 printf ("\n->SUB:$%d:" #sname ":" sname, __LINE__);
195 #define TXT(text) \
196 printf ("\n->TXT:$%d:" text, __LINE__);
198 #else
200 #define CND(name, comment) \
201 asm volatile("\n->CND:%0:" #name ":%1:" comment \
202 : : "i" (__LINE__), "i" ((int) name));
203 /* Decimal constant in the range of type "int" */
205 #define CNU(name, comment) \
206 asm volatile("\n->CNU:%0:" #name ":%1:" comment \
207 : : "i" (__LINE__), "i" ((int) name));
208 /* Decimal constant in the range of type "unsigned int" (note, assembler
209 * always wants a signed int, we convert back in xoscons).
212 #define CNS(name, comment) \
213 asm volatile("\n->CNS:%0:" #name ":" name ":" comment \
214 : : "i" (__LINE__));
215 /* General expression named number */
217 #define C(sname, type, value, comment) \
218 asm volatile("\n->C:%0:" sname ":" #type ":" value ":" comment \
219 : : "i" (__LINE__));
220 /* Typed constant */
222 #define SUB(sname) \
223 asm volatile("\n->SUB:%0:" #sname ":" sname \
224 : : "i" (__LINE__));
225 /* Subtype */
227 #define TXT(text) \
228 asm volatile("\n->TXT:%0:" text \
229 : : "i" (__LINE__));
230 /* Freeform text */
232 #endif /* NATIVE */
234 #define CST(name,comment) C(#name,String,name,comment)
235 /* String constant */
237 #define STR(x) STR1(x)
238 #define STR1(x) #x
240 #ifdef __MINGW32__
241 unsigned int _CRT_fmode = _O_BINARY;
242 #endif
245 main (void) {
248 -- This package provides target dependent definitions of constant for use
249 -- by the GNAT runtime library. This package should not be directly with'd
250 -- by an application program.
252 -- This file is generated automatically, do not modify it by hand! Instead,
253 -- make changes to s-oscons-tmplt.c and rebuild the GNAT runtime library.
257 ** Do not change the format of the line below without also updating the
258 ** MaRTE Makefile.
260 TXT("-- This is the version for " TARGET)
261 TXT("")
262 TXT("with Interfaces.C;")
265 package System.OS_Constants is
267 pragma Pure;
271 ** General constants (all platforms)
276 ---------------------------------
277 -- General platform parameters --
278 ---------------------------------
280 type OS_Type is (Windows, Other_OS);
282 #if defined (__MINGW32__)
283 # define TARGET_OS "Windows"
284 #else
285 # define TARGET_OS "Other_OS"
286 #endif
287 C("Target_OS", OS_Type, TARGET_OS, "")
289 pragma Warnings (Off, Target_OS);
290 -- Suppress warnings on Target_OS since it is in general tested for
291 -- equality with a constant value to implement conditional compilation,
292 -- which normally generates a constant condition warning.
295 #define Target_Name TARGET
296 CST(Target_Name, "")
299 ** Note: the name of the following constant is recognized specially by
300 ** xoscons (case sensitive).
302 #define SIZEOF_unsigned_int sizeof (unsigned int)
303 CND(SIZEOF_unsigned_int, "Size of unsigned int")
307 -------------------
308 -- System limits --
309 -------------------
313 #ifndef IOV_MAX
314 # define IOV_MAX INT_MAX
315 #endif
316 CND(IOV_MAX, "Maximum writev iovcnt")
318 /* NAME_MAX is used to compute the allocation size for a struct dirent
319 * passed to readdir() / readdir_r(). However on some systems it is not
320 * defined, as it is technically a filesystem dependent property that
321 * we should retrieve through pathconf(). In any case, we do not need a
322 * precise value but only an upper limit.
324 #ifndef NAME_MAX
325 # ifdef MAXNAMELEN
326 /* Solaris has no NAME_MAX but defines MAXNAMELEN */
327 # define NAME_MAX MAXNAMELEN
328 # elif defined(PATH_MAX)
329 /* PATH_MAX (maximum length of a full path name) is a safe fall back */
330 # define NAME_MAX PATH_MAX
331 # elif defined(FILENAME_MAX)
332 /* Similarly FILENAME_MAX can provide a safe fall back */
333 # define NAME_MAX FILENAME_MAX
334 # else
335 /* Hardcode a reasonably large value as a last chance fallback */
336 # define NAME_MAX 1024
337 # endif
338 #endif
339 CND(NAME_MAX, "Maximum file name length")
343 ---------------------
344 -- File open modes --
345 ---------------------
349 #ifndef O_RDWR
350 # define O_RDWR -1
351 #endif
352 CND(O_RDWR, "Read/write")
354 #ifndef O_NOCTTY
355 # define O_NOCTTY -1
356 #endif
357 CND(O_NOCTTY, "Don't change ctrl tty")
359 #ifndef O_NDELAY
360 # define O_NDELAY -1
361 #endif
362 CND(O_NDELAY, "Nonblocking")
366 ----------------------
367 -- Fcntl operations --
368 ----------------------
372 #ifndef F_GETFL
373 # define F_GETFL -1
374 #endif
375 CND(F_GETFL, "Get flags")
377 #ifndef F_SETFL
378 # define F_SETFL -1
379 #endif
380 CND(F_SETFL, "Set flags")
384 -----------------
385 -- Fcntl flags --
386 -----------------
390 #ifndef FNDELAY
391 # define FNDELAY -1
392 #endif
393 CND(FNDELAY, "Nonblocking")
397 ----------------------
398 -- Ioctl operations --
399 ----------------------
403 /* ioctl(2) requests are "int" in UNIX, but "unsigned long" on FreeBSD */
405 #ifdef __FreeBSD__
406 # define CNI CNU
407 # define IOCTL_Req_T "unsigned"
408 #else
409 # define CNI CND
410 # define IOCTL_Req_T "int"
411 #endif
413 SUB(IOCTL_Req_T)
415 #ifndef FIONBIO
416 # define FIONBIO -1
417 #endif
418 CNI(FIONBIO, "Set/clear non-blocking io")
420 #ifndef FIONREAD
421 # define FIONREAD -1
422 #endif
423 CNI(FIONREAD, "How many bytes to read")
427 ------------------
428 -- Errno values --
429 ------------------
431 -- The following constants are defined from <errno.h>
434 #ifndef EAGAIN
435 # define EAGAIN -1
436 #endif
437 CND(EAGAIN, "Try again")
439 #ifndef ENOENT
440 # define ENOENT -1
441 #endif
442 CND(ENOENT, "File not found")
444 #ifndef ENOMEM
445 # define ENOMEM -1
446 #endif
447 CND(ENOMEM, "Out of memory")
449 #ifdef __MINGW32__
452 -- The following constants are defined from <winsock2.h> (WSA*)
457 ** For sockets-related errno values on Windows, gsocket.h redefines
458 ** Exxx as WSAExxx.
461 #endif
463 #ifndef EACCES
464 # define EACCES -1
465 #endif
466 CND(EACCES, "Permission denied")
468 #ifndef EADDRINUSE
469 # define EADDRINUSE -1
470 #endif
471 CND(EADDRINUSE, "Address already in use")
473 #ifndef EADDRNOTAVAIL
474 # define EADDRNOTAVAIL -1
475 #endif
476 CND(EADDRNOTAVAIL, "Cannot assign address")
478 #ifndef EAFNOSUPPORT
479 # define EAFNOSUPPORT -1
480 #endif
481 CND(EAFNOSUPPORT, "Addr family not supported")
483 #ifndef EALREADY
484 # define EALREADY -1
485 #endif
486 CND(EALREADY, "Operation in progress")
488 #ifndef EBADF
489 # define EBADF -1
490 #endif
491 CND(EBADF, "Bad file descriptor")
493 #ifndef ECONNABORTED
494 # define ECONNABORTED -1
495 #endif
496 CND(ECONNABORTED, "Connection aborted")
498 #ifndef ECONNREFUSED
499 # define ECONNREFUSED -1
500 #endif
501 CND(ECONNREFUSED, "Connection refused")
503 #ifndef ECONNRESET
504 # define ECONNRESET -1
505 #endif
506 CND(ECONNRESET, "Connection reset by peer")
508 #ifndef EDESTADDRREQ
509 # define EDESTADDRREQ -1
510 #endif
511 CND(EDESTADDRREQ, "Destination addr required")
513 #ifndef EFAULT
514 # define EFAULT -1
515 #endif
516 CND(EFAULT, "Bad address")
518 #ifndef EHOSTDOWN
519 # define EHOSTDOWN -1
520 #endif
521 CND(EHOSTDOWN, "Host is down")
523 #ifndef EHOSTUNREACH
524 # define EHOSTUNREACH -1
525 #endif
526 CND(EHOSTUNREACH, "No route to host")
528 #ifndef EINPROGRESS
529 # define EINPROGRESS -1
530 #endif
531 CND(EINPROGRESS, "Operation now in progress")
533 #ifndef EINTR
534 # define EINTR -1
535 #endif
536 CND(EINTR, "Interrupted system call")
538 #ifndef EINVAL
539 # define EINVAL -1
540 #endif
541 CND(EINVAL, "Invalid argument")
543 #ifndef EIO
544 # define EIO -1
545 #endif
546 CND(EIO, "Input output error")
548 #ifndef EISCONN
549 # define EISCONN -1
550 #endif
551 CND(EISCONN, "Socket already connected")
553 #ifndef ELOOP
554 # define ELOOP -1
555 #endif
556 CND(ELOOP, "Too many symbolic links")
558 #ifndef EMFILE
559 # define EMFILE -1
560 #endif
561 CND(EMFILE, "Too many open files")
563 #ifndef EMSGSIZE
564 # define EMSGSIZE -1
565 #endif
566 CND(EMSGSIZE, "Message too long")
568 #ifndef ENAMETOOLONG
569 # define ENAMETOOLONG -1
570 #endif
571 CND(ENAMETOOLONG, "Name too long")
573 #ifndef ENETDOWN
574 # define ENETDOWN -1
575 #endif
576 CND(ENETDOWN, "Network is down")
578 #ifndef ENETRESET
579 # define ENETRESET -1
580 #endif
581 CND(ENETRESET, "Disconn. on network reset")
583 #ifndef ENETUNREACH
584 # define ENETUNREACH -1
585 #endif
586 CND(ENETUNREACH, "Network is unreachable")
588 #ifndef ENOBUFS
589 # define ENOBUFS -1
590 #endif
591 CND(ENOBUFS, "No buffer space available")
593 #ifndef ENOPROTOOPT
594 # define ENOPROTOOPT -1
595 #endif
596 CND(ENOPROTOOPT, "Protocol not available")
598 #ifndef ENOTCONN
599 # define ENOTCONN -1
600 #endif
601 CND(ENOTCONN, "Socket not connected")
603 #ifndef ENOTSOCK
604 # define ENOTSOCK -1
605 #endif
606 CND(ENOTSOCK, "Operation on non socket")
608 #ifndef EOPNOTSUPP
609 # define EOPNOTSUPP -1
610 #endif
611 CND(EOPNOTSUPP, "Operation not supported")
613 #ifndef EPIPE
614 # define EPIPE -1
615 #endif
616 CND(EPIPE, "Broken pipe")
618 #ifndef EPFNOSUPPORT
619 # define EPFNOSUPPORT -1
620 #endif
621 CND(EPFNOSUPPORT, "Unknown protocol family")
623 #ifndef EPROTONOSUPPORT
624 # define EPROTONOSUPPORT -1
625 #endif
626 CND(EPROTONOSUPPORT, "Unknown protocol")
628 #ifndef EPROTOTYPE
629 # define EPROTOTYPE -1
630 #endif
631 CND(EPROTOTYPE, "Unknown protocol type")
633 #ifndef ERANGE
634 # define ERANGE -1
635 #endif
636 CND(ERANGE, "Result too large")
638 #ifndef ESHUTDOWN
639 # define ESHUTDOWN -1
640 #endif
641 CND(ESHUTDOWN, "Cannot send once shutdown")
643 #ifndef ESOCKTNOSUPPORT
644 # define ESOCKTNOSUPPORT -1
645 #endif
646 CND(ESOCKTNOSUPPORT, "Socket type not supported")
648 #ifndef ETIMEDOUT
649 # define ETIMEDOUT -1
650 #endif
651 CND(ETIMEDOUT, "Connection timed out")
653 #ifndef ETOOMANYREFS
654 # define ETOOMANYREFS -1
655 #endif
656 CND(ETOOMANYREFS, "Too many references")
658 #ifndef EWOULDBLOCK
659 # define EWOULDBLOCK -1
660 #endif
661 CND(EWOULDBLOCK, "Operation would block")
663 #ifndef E2BIG
664 # define E2BIG -1
665 #endif
666 CND(E2BIG, "Argument list too long")
668 #ifndef EILSEQ
669 # define EILSEQ -1
670 #endif
671 CND(EILSEQ, "Illegal byte sequence")
674 ** Terminal/serial I/O constants
677 #if defined(HAVE_TERMIOS) || defined(__MINGW32__)
680 ----------------------
681 -- Terminal control --
682 ----------------------
685 #endif
687 #ifdef HAVE_TERMIOS
689 #ifndef TCSANOW
690 # define TCSANOW -1
691 #endif
692 CND(TCSANOW, "Immediate")
694 #ifndef TCIFLUSH
695 # define TCIFLUSH -1
696 #endif
697 CND(TCIFLUSH, "Flush input")
699 #ifndef IXON
700 # define IXON -1
701 #endif
702 CNU(IXON, "Output sw flow control")
704 #ifndef CLOCAL
705 # define CLOCAL -1
706 #endif
707 CNU(CLOCAL, "Local")
709 #ifndef CRTSCTS
710 # define CRTSCTS -1
711 #endif
712 CNU(CRTSCTS, "Output hw flow control")
714 #ifndef CREAD
715 # define CREAD -1
716 #endif
717 CNU(CREAD, "Read")
719 #ifndef CS5
720 # define CS5 -1
721 #endif
722 CNU(CS5, "5 data bits")
724 #ifndef CS6
725 # define CS6 -1
726 #endif
727 CNU(CS6, "6 data bits")
729 #ifndef CS7
730 # define CS7 -1
731 #endif
732 CNU(CS7, "7 data bits")
734 #ifndef CS8
735 # define CS8 -1
736 #endif
737 CNU(CS8, "8 data bits")
739 #ifndef CSTOPB
740 # define CSTOPB -1
741 #endif
742 CNU(CSTOPB, "2 stop bits")
744 #ifndef PARENB
745 # define PARENB -1
746 #endif
747 CNU(PARENB, "Parity enable")
749 #ifndef PARODD
750 # define PARODD -1
751 #endif
752 CNU(PARODD, "Parity odd")
754 #ifndef B0
755 # define B0 -1
756 #endif
757 CNU(B0, "0 bps")
759 #ifndef B50
760 # define B50 -1
761 #endif
762 CNU(B50, "50 bps")
764 #ifndef B75
765 # define B75 -1
766 #endif
767 CNU(B75, "75 bps")
769 #ifndef B110
770 # define B110 -1
771 #endif
772 CNU(B110, "110 bps")
774 #ifndef B134
775 # define B134 -1
776 #endif
777 CNU(B134, "134 bps")
779 #ifndef B150
780 # define B150 -1
781 #endif
782 CNU(B150, "150 bps")
784 #ifndef B200
785 # define B200 -1
786 #endif
787 CNU(B200, "200 bps")
789 #ifndef B300
790 # define B300 -1
791 #endif
792 CNU(B300, "300 bps")
794 #ifndef B600
795 # define B600 -1
796 #endif
797 CNU(B600, "600 bps")
799 #ifndef B1200
800 # define B1200 -1
801 #endif
802 CNU(B1200, "1200 bps")
804 #ifndef B1800
805 # define B1800 -1
806 #endif
807 CNU(B1800, "1800 bps")
809 #ifndef B2400
810 # define B2400 -1
811 #endif
812 CNU(B2400, "2400 bps")
814 #ifndef B4800
815 # define B4800 -1
816 #endif
817 CNU(B4800, "4800 bps")
819 #ifndef B9600
820 # define B9600 -1
821 #endif
822 CNU(B9600, "9600 bps")
824 #ifndef B19200
825 # define B19200 -1
826 #endif
827 CNU(B19200, "19200 bps")
829 #ifndef B38400
830 # define B38400 -1
831 #endif
832 CNU(B38400, "38400 bps")
834 #ifndef B57600
835 # define B57600 -1
836 #endif
837 CNU(B57600, "57600 bps")
839 #ifndef B115200
840 # define B115200 -1
841 #endif
842 CNU(B115200, "115200 bps")
844 #ifndef B230400
845 # define B230400 -1
846 #endif
847 CNU(B230400, "230400 bps")
849 #ifndef B460800
850 # define B460800 -1
851 #endif
852 CNU(B460800, "460800 bps")
854 #ifndef B500000
855 # define B500000 -1
856 #endif
857 CNU(B500000, "500000 bps")
859 #ifndef B576000
860 # define B576000 -1
861 #endif
862 CNU(B576000, "576000 bps")
864 #ifndef B921600
865 # define B921600 -1
866 #endif
867 CNU(B921600, "921600 bps")
869 #ifndef B1000000
870 # define B1000000 -1
871 #endif
872 CNU(B1000000, "1000000 bps")
874 #ifndef B1152000
875 # define B1152000 -1
876 #endif
877 CNU(B1152000, "1152000 bps")
879 #ifndef B1500000
880 # define B1500000 -1
881 #endif
882 CNU(B1500000, "1500000 bps")
884 #ifndef B2000000
885 # define B2000000 -1
886 #endif
887 CNU(B2000000, "2000000 bps")
889 #ifndef B2500000
890 # define B2500000 -1
891 #endif
892 CNU(B2500000, "2500000 bps")
894 #ifndef B3000000
895 # define B3000000 -1
896 #endif
897 CNU(B3000000, "3000000 bps")
899 #ifndef B3500000
900 # define B3500000 -1
901 #endif
902 CNU(B3500000, "3500000 bps")
904 #ifndef B4000000
905 # define B4000000 -1
906 #endif
907 CNU(B4000000, "4000000 bps")
911 ---------------------------------
912 -- Terminal control characters --
913 ---------------------------------
917 #ifndef VINTR
918 # define VINTR -1
919 #endif
920 CND(VINTR, "Interrupt")
922 #ifndef VQUIT
923 # define VQUIT -1
924 #endif
925 CND(VQUIT, "Quit")
927 #ifndef VERASE
928 # define VERASE -1
929 #endif
930 CND(VERASE, "Erase")
932 #ifndef VKILL
933 # define VKILL -1
934 #endif
935 CND(VKILL, "Kill")
937 #ifndef VEOF
938 # define VEOF -1
939 #endif
940 CND(VEOF, "EOF")
942 #ifndef VTIME
943 # define VTIME -1
944 #endif
945 CND(VTIME, "Read timeout")
947 #ifndef VMIN
948 # define VMIN -1
949 #endif
950 CND(VMIN, "Read min chars")
952 #ifndef VSWTC
953 # define VSWTC -1
954 #endif
955 CND(VSWTC, "Switch")
957 #ifndef VSTART
958 # define VSTART -1
959 #endif
960 CND(VSTART, "Flow control start")
962 #ifndef VSTOP
963 # define VSTOP -1
964 #endif
965 CND(VSTOP, "Flow control stop")
967 #ifndef VSUSP
968 # define VSUSP -1
969 #endif
970 CND(VSUSP, "Suspend")
972 #ifndef VEOL
973 # define VEOL -1
974 #endif
975 CND(VEOL, "EOL")
977 #ifndef VREPRINT
978 # define VREPRINT -1
979 #endif
980 CND(VREPRINT, "Reprint unread")
982 #ifndef VDISCARD
983 # define VDISCARD -1
984 #endif
985 CND(VDISCARD, "Discard pending")
987 #ifndef VWERASE
988 # define VWERASE -1
989 #endif
990 CND(VWERASE, "Word erase")
992 #ifndef VLNEXT
993 # define VLNEXT -1
994 #endif
995 CND(VLNEXT, "Literal next")
997 #ifndef VEOL2
998 # define VEOL2 -1
999 #endif
1000 CND(VEOL2, "Alternative EOL")
1002 #endif /* HAVE_TERMIOS */
1004 #if defined(__MINGW32__) || defined(__CYGWIN__)
1005 CNU(DTR_CONTROL_ENABLE, "Enable DTR flow ctrl")
1006 CNU(RTS_CONTROL_ENABLE, "Enable RTS flow ctrl")
1007 #endif
1011 -----------------------------
1012 -- Pseudo terminal library --
1013 -----------------------------
1017 #if defined (__FreeBSD__) || defined (linux)
1018 # define PTY_Library "-lutil"
1019 #else
1020 # define PTY_Library ""
1021 #endif
1022 CST(PTY_Library, "for g-exptty")
1025 ** Sockets constants
1028 #ifdef HAVE_SOCKETS
1032 --------------
1033 -- Families --
1034 --------------
1038 #ifndef AF_INET
1039 # define AF_INET -1
1040 #endif
1041 CND(AF_INET, "IPv4 address family")
1044 ** RTEMS lies and defines AF_INET6 even though there is no IPV6 support.
1045 ** Its TCP/IP stack is in transition. It has newer .h files but no IPV6 yet.
1047 #if defined(__rtems__)
1048 # undef AF_INET6
1049 #endif
1051 #ifndef AF_INET6
1052 # define AF_INET6 -1
1053 #else
1054 # define HAVE_AF_INET6 1
1055 #endif
1056 CND(AF_INET6, "IPv6 address family")
1060 ------------------
1061 -- Socket modes --
1062 ------------------
1066 #ifndef SOCK_STREAM
1067 # define SOCK_STREAM -1
1068 #endif
1069 CND(SOCK_STREAM, "Stream socket")
1071 #ifndef SOCK_DGRAM
1072 # define SOCK_DGRAM -1
1073 #endif
1074 CND(SOCK_DGRAM, "Datagram socket")
1078 -----------------
1079 -- Host errors --
1080 -----------------
1084 #ifndef HOST_NOT_FOUND
1085 # define HOST_NOT_FOUND -1
1086 #endif
1087 CND(HOST_NOT_FOUND, "Unknown host")
1089 #ifndef TRY_AGAIN
1090 # define TRY_AGAIN -1
1091 #endif
1092 CND(TRY_AGAIN, "Host name lookup failure")
1094 #ifndef NO_DATA
1095 # define NO_DATA -1
1096 #endif
1097 CND(NO_DATA, "No data record for name")
1099 #ifndef NO_RECOVERY
1100 # define NO_RECOVERY -1
1101 #endif
1102 CND(NO_RECOVERY, "Non recoverable errors")
1106 --------------------
1107 -- Shutdown modes --
1108 --------------------
1112 #ifndef SHUT_RD
1113 # define SHUT_RD -1
1114 #endif
1115 CND(SHUT_RD, "No more recv")
1117 #ifndef SHUT_WR
1118 # define SHUT_WR -1
1119 #endif
1120 CND(SHUT_WR, "No more send")
1122 #ifndef SHUT_RDWR
1123 # define SHUT_RDWR -1
1124 #endif
1125 CND(SHUT_RDWR, "No more recv/send")
1129 ---------------------
1130 -- Protocol levels --
1131 ---------------------
1135 #ifndef SOL_SOCKET
1136 # define SOL_SOCKET -1
1137 #endif
1138 CND(SOL_SOCKET, "Options for socket level")
1140 #ifndef IPPROTO_IP
1141 # define IPPROTO_IP -1
1142 #endif
1143 CND(IPPROTO_IP, "Dummy protocol for IP")
1145 #ifndef IPPROTO_UDP
1146 # define IPPROTO_UDP -1
1147 #endif
1148 CND(IPPROTO_UDP, "UDP")
1150 #ifndef IPPROTO_TCP
1151 # define IPPROTO_TCP -1
1152 #endif
1153 CND(IPPROTO_TCP, "TCP")
1157 -------------------
1158 -- Request flags --
1159 -------------------
1163 #ifndef MSG_OOB
1164 # define MSG_OOB -1
1165 #endif
1166 CND(MSG_OOB, "Process out-of-band data")
1168 #ifndef MSG_PEEK
1169 # define MSG_PEEK -1
1170 #endif
1171 CND(MSG_PEEK, "Peek at incoming data")
1173 #ifndef MSG_EOR
1174 # define MSG_EOR -1
1175 #endif
1176 CND(MSG_EOR, "Send end of record")
1178 #ifndef MSG_WAITALL
1179 #ifdef __MINWGW32__
1180 /* The value of MSG_WAITALL is 8. Nevertheless winsock.h doesn't
1181 define it, but it is still usable as we link to winsock2 API. */
1182 # define MSG_WAITALL (1 << 3)
1183 #else
1184 # define MSG_WAITALL -1
1185 #endif
1186 #endif
1187 CND(MSG_WAITALL, "Wait for full reception")
1189 #ifndef MSG_NOSIGNAL
1190 # define MSG_NOSIGNAL -1
1191 #endif
1192 CND(MSG_NOSIGNAL, "No SIGPIPE on send")
1194 #ifdef __linux__
1195 # define MSG_Forced_Flags "MSG_NOSIGNAL"
1196 #else
1197 # define MSG_Forced_Flags "0"
1198 #endif
1199 CNS(MSG_Forced_Flags, "")
1201 -- Flags set on all send(2) calls
1206 --------------------
1207 -- Socket options --
1208 --------------------
1212 #ifndef TCP_NODELAY
1213 # define TCP_NODELAY -1
1214 #endif
1215 CND(TCP_NODELAY, "Do not coalesce packets")
1217 #ifndef SO_REUSEADDR
1218 # define SO_REUSEADDR -1
1219 #endif
1220 CND(SO_REUSEADDR, "Bind reuse local address")
1222 #ifndef SO_REUSEPORT
1223 # define SO_REUSEPORT -1
1224 #endif
1225 CND(SO_REUSEPORT, "Bind reuse port number")
1227 #ifndef SO_KEEPALIVE
1228 # define SO_KEEPALIVE -1
1229 #endif
1230 CND(SO_KEEPALIVE, "Enable keep-alive msgs")
1232 #ifndef SO_LINGER
1233 # define SO_LINGER -1
1234 #endif
1235 CND(SO_LINGER, "Defer close to flush data")
1237 #ifndef SO_BROADCAST
1238 # define SO_BROADCAST -1
1239 #endif
1240 CND(SO_BROADCAST, "Can send broadcast msgs")
1242 #ifndef SO_SNDBUF
1243 # define SO_SNDBUF -1
1244 #endif
1245 CND(SO_SNDBUF, "Set/get send buffer size")
1247 #ifndef SO_RCVBUF
1248 # define SO_RCVBUF -1
1249 #endif
1250 CND(SO_RCVBUF, "Set/get recv buffer size")
1252 #ifndef SO_SNDTIMEO
1253 # define SO_SNDTIMEO -1
1254 #endif
1255 CND(SO_SNDTIMEO, "Emission timeout")
1257 #ifndef SO_RCVTIMEO
1258 # define SO_RCVTIMEO -1
1259 #endif
1260 CND(SO_RCVTIMEO, "Reception timeout")
1262 #ifndef SO_ERROR
1263 # define SO_ERROR -1
1264 #endif
1265 CND(SO_ERROR, "Get/clear error status")
1267 #ifndef IP_MULTICAST_IF
1268 # define IP_MULTICAST_IF -1
1269 #endif
1270 CND(IP_MULTICAST_IF, "Set/get mcast interface")
1272 #ifndef IP_MULTICAST_TTL
1273 # define IP_MULTICAST_TTL -1
1274 #endif
1275 CND(IP_MULTICAST_TTL, "Set/get multicast TTL")
1277 #ifndef IP_MULTICAST_LOOP
1278 # define IP_MULTICAST_LOOP -1
1279 #endif
1280 CND(IP_MULTICAST_LOOP, "Set/get mcast loopback")
1282 #ifndef IP_ADD_MEMBERSHIP
1283 # define IP_ADD_MEMBERSHIP -1
1284 #endif
1285 CND(IP_ADD_MEMBERSHIP, "Join a multicast group")
1287 #ifndef IP_DROP_MEMBERSHIP
1288 # define IP_DROP_MEMBERSHIP -1
1289 #endif
1290 CND(IP_DROP_MEMBERSHIP, "Leave a multicast group")
1292 #ifndef IP_PKTINFO
1293 # define IP_PKTINFO -1
1294 #endif
1295 CND(IP_PKTINFO, "Get datagram info")
1299 ----------------------
1300 -- Type definitions --
1301 ----------------------
1306 struct timeval tv;
1308 -- Sizes (in bytes) of the components of struct timeval
1310 #define SIZEOF_tv_sec (sizeof tv.tv_sec)
1311 CND(SIZEOF_tv_sec, "tv_sec")
1312 #define SIZEOF_tv_usec (sizeof tv.tv_usec)
1313 CND(SIZEOF_tv_usec, "tv_usec")
1316 -- Maximum allowed value for tv_sec
1320 ** On Solaris, field tv_sec in struct timeval has an undocumented
1321 ** hard-wired limit of 100 million.
1322 ** On IA64 HP-UX the limit is 2**31 - 1.
1324 #if defined (sun)
1325 # define MAX_tv_sec "100_000_000"
1327 #elif defined (__hpux__)
1328 # define MAX_tv_sec "16#7fffffff#"
1330 #else
1331 # define MAX_tv_sec "2 ** (SIZEOF_tv_sec * 8 - 1) - 1"
1332 #endif
1333 CNS(MAX_tv_sec, "")
1337 -- Sizes of various data types
1340 #define SIZEOF_sockaddr_in (sizeof (struct sockaddr_in))
1341 CND(SIZEOF_sockaddr_in, "struct sockaddr_in")
1342 #ifdef HAVE_AF_INET6
1343 # define SIZEOF_sockaddr_in6 (sizeof (struct sockaddr_in6))
1344 #else
1345 # define SIZEOF_sockaddr_in6 0
1346 #endif
1347 CND(SIZEOF_sockaddr_in6, "struct sockaddr_in6")
1349 #define SIZEOF_fd_set (sizeof (fd_set))
1350 CND(SIZEOF_fd_set, "fd_set")
1351 CND(FD_SETSIZE, "Max fd value")
1353 #define SIZEOF_struct_hostent (sizeof (struct hostent))
1354 CND(SIZEOF_struct_hostent, "struct hostent")
1356 #define SIZEOF_struct_servent (sizeof (struct servent))
1357 CND(SIZEOF_struct_servent, "struct servent")
1359 #if defined (__linux__)
1360 #define SIZEOF_sigset (sizeof (sigset_t))
1361 CND(SIZEOF_sigset, "sigset")
1362 #endif
1366 -- Fields of struct msghdr
1369 #if defined (__sun__) || defined (__hpux__)
1370 # define Msg_Iovlen_T "int"
1371 #else
1372 # define Msg_Iovlen_T "size_t"
1373 #endif
1375 SUB(Msg_Iovlen_T)
1379 ----------------------------------------
1380 -- Properties of supported interfaces --
1381 ----------------------------------------
1385 CND(Need_Netdb_Buffer, "Need buffer for Netdb ops")
1386 CND(Need_Netdb_Lock, "Need lock for Netdb ops")
1387 CND(Has_Sockaddr_Len, "Sockaddr has sa_len field")
1390 ** Do not change the format of the line below without also updating the
1391 ** MaRTE Makefile.
1393 C("Thread_Blocking_IO", Boolean, "True", "")
1395 -- Set False for contexts where socket i/o are process blocking
1399 #ifdef HAVE_INET_PTON
1400 # define Inet_Pton_Linkname "inet_pton"
1401 #else
1402 # define Inet_Pton_Linkname "__gnat_inet_pton"
1403 #endif
1404 CST(Inet_Pton_Linkname, "")
1406 #endif /* HAVE_SOCKETS */
1410 ---------------------
1411 -- Threads support --
1412 ---------------------
1414 -- Clock identifier definitions
1418 /* Note: On HP-UX, CLOCK_REALTIME is an enum, not a macro. */
1420 #if !(defined(CLOCK_REALTIME) || defined (__hpux__))
1421 # define CLOCK_REALTIME (-1)
1422 #endif
1423 CND(CLOCK_REALTIME, "System realtime clock")
1425 #ifdef CLOCK_MONOTONIC
1426 CND(CLOCK_MONOTONIC, "System monotonic clock")
1427 #endif
1429 #ifdef CLOCK_FASTEST
1430 CND(CLOCK_FASTEST, "Fastest clock")
1431 #endif
1433 #ifndef CLOCK_THREAD_CPUTIME_ID
1434 # define CLOCK_THREAD_CPUTIME_ID -1
1435 #endif
1436 CND(CLOCK_THREAD_CPUTIME_ID, "Thread CPU clock")
1438 #if defined(__FreeBSD__) || (defined(_AIX) && defined(_AIXVERSION_530))
1439 /** On these platforms use system provided monotonic clock instead of
1440 ** the default CLOCK_REALTIME. We then need to set up cond var attributes
1441 ** appropriately (see thread.c).
1443 ** Note that AIX 5.2 does not support CLOCK_MONOTONIC timestamps for
1444 ** pthread_cond_timedwait (and does not have pthread_condattr_setclock),
1445 ** hence the conditionalization on AIX version above). _AIXVERSION_530
1446 ** is defined in AIX 5.3 and more recent versions.
1448 # define CLOCK_RT_Ada "CLOCK_MONOTONIC"
1450 #else
1451 /* By default use CLOCK_REALTIME */
1452 # define CLOCK_RT_Ada "CLOCK_REALTIME"
1453 #endif
1455 #ifdef CLOCK_RT_Ada
1456 CNS(CLOCK_RT_Ada, "")
1457 #endif
1459 #if defined (__APPLE__) || defined (__linux__) || defined (DUMMY)
1462 -- Sizes of pthread data types
1465 #if defined (__APPLE__) || defined (DUMMY)
1467 -- (on Darwin, these are just placeholders)
1469 #define PTHREAD_SIZE __PTHREAD_SIZE__
1470 #define PTHREAD_ATTR_SIZE __PTHREAD_ATTR_SIZE__
1471 #define PTHREAD_MUTEXATTR_SIZE __PTHREAD_MUTEXATTR_SIZE__
1472 #define PTHREAD_MUTEX_SIZE __PTHREAD_MUTEX_SIZE__
1473 #define PTHREAD_CONDATTR_SIZE __PTHREAD_CONDATTR_SIZE__
1474 #define PTHREAD_COND_SIZE __PTHREAD_COND_SIZE__
1475 #define PTHREAD_RWLOCKATTR_SIZE __PTHREAD_RWLOCKATTR_SIZE__
1476 #define PTHREAD_RWLOCK_SIZE __PTHREAD_RWLOCK_SIZE__
1477 #define PTHREAD_ONCE_SIZE __PTHREAD_ONCE_SIZE__
1478 #else
1479 #define PTHREAD_SIZE (sizeof (pthread_t))
1480 #define PTHREAD_ATTR_SIZE (sizeof (pthread_attr_t))
1481 #define PTHREAD_MUTEXATTR_SIZE (sizeof (pthread_mutexattr_t))
1482 #define PTHREAD_MUTEX_SIZE (sizeof (pthread_mutex_t))
1483 #define PTHREAD_CONDATTR_SIZE (sizeof (pthread_condattr_t))
1484 #define PTHREAD_COND_SIZE (sizeof (pthread_cond_t))
1485 #define PTHREAD_RWLOCKATTR_SIZE (sizeof (pthread_rwlockattr_t))
1486 #define PTHREAD_RWLOCK_SIZE (sizeof (pthread_rwlock_t))
1487 #define PTHREAD_ONCE_SIZE (sizeof (pthread_once_t))
1488 #endif
1492 CND(PTHREAD_SIZE, "pthread_t")
1493 CND(PTHREAD_ATTR_SIZE, "pthread_attr_t")
1494 CND(PTHREAD_MUTEXATTR_SIZE, "pthread_mutexattr_t")
1495 CND(PTHREAD_MUTEX_SIZE, "pthread_mutex_t")
1496 CND(PTHREAD_CONDATTR_SIZE, "pthread_condattr_t")
1497 CND(PTHREAD_COND_SIZE, "pthread_cond_t")
1498 CND(PTHREAD_RWLOCKATTR_SIZE, "pthread_rwlockattr_t")
1499 CND(PTHREAD_RWLOCK_SIZE, "pthread_rwlock_t")
1500 CND(PTHREAD_ONCE_SIZE, "pthread_once_t")
1502 #endif /* __APPLE__ || __linux__ */
1506 --------------------------------
1507 -- File and directory support --
1508 --------------------------------
1513 ** Note: this constant can be used in the GNAT runtime library. In compiler
1514 ** units on the other hand, System.OS_Constants is not available, so we
1515 ** declare an Ada constant (Osint.File_Attributes_Size) independently, which
1516 ** is at least as large as sizeof (struct file_attributes), and we have an
1517 ** assertion at initialization of Osint checking that the size is indeed at
1518 ** least sufficient.
1520 #define SIZEOF_struct_file_attributes (sizeof (struct file_attributes))
1521 CND(SIZEOF_struct_file_attributes, "struct file_attributes")
1524 ** Maximal size of buffer for struct dirent. Note: Since POSIX.1 does not
1525 ** specify the size of the d_name field, and other nonstandard fields may
1526 ** precede that field within the dirent structure, we must make a conservative
1527 ** computation.
1530 struct dirent dent;
1531 #define SIZEOF_struct_dirent_alloc \
1532 ((char*) &dent.d_name - (char*) &dent) + NAME_MAX + 1
1533 CND(SIZEOF_struct_dirent_alloc, "struct dirent allocation")
1537 ** System-specific constants follow
1538 ** Each section should be activated if compiling for the corresponding
1539 ** platform *or* generating the dummy version for runtime test compilation.
1542 #if defined (__vxworks) || defined (DUMMY)
1546 --------------------------------
1547 -- VxWorks-specific constants --
1548 --------------------------------
1550 -- These constants may be used only within the VxWorks version of
1551 -- GNAT.Sockets.Thin.
1554 CND(OK, "VxWorks generic success")
1555 CND(ERROR, "VxWorks generic error")
1557 #endif /* __vxworks */
1559 #if defined (__MINGW32__) || defined (DUMMY)
1562 ------------------------------
1563 -- MinGW-specific constants --
1564 ------------------------------
1566 -- These constants may be used only within the MinGW version of
1567 -- GNAT.Sockets.Thin.
1570 CND(WSASYSNOTREADY, "System not ready")
1571 CND(WSAVERNOTSUPPORTED, "Version not supported")
1572 CND(WSANOTINITIALISED, "Winsock not initialized")
1573 CND(WSAEDISCON, "Disconnected")
1575 #endif /* __MINGW32__ */
1578 ** End of constants definitions
1581 #ifdef NATIVE
1582 putchar ('\n');
1583 #endif
1587 end System.OS_Constants;