]>
git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/ada/s-oscons-tmplt.c
2 ------------------------------------------------------------------------------
4 -- GNAT COMPILER COMPONENTS --
6 -- S Y S T E M . O S _ C O N S T A N T S --
10 -- Copyright (C) 2000-2009, Free Software Foundation, Inc. --
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. --
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. --
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/>. --
28 -- GNAT was originally developed by the GNAT team at New York University. --
29 -- Extensive contributions were provided by Ada Core Technologies Inc. --
31 ------------------------------------------------------------------------------
33 pragma Style_Checks ("M32766");
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
57 ** Two methods are supported to generate the list of constant values,
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
64 ** xgcc -DTARGET=\"$target\" -C -E s-oscons-tmplt.c > s-oscons-tmplt.i
65 ** xgcc -S s-oscons-tmplt.i
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
83 # error Please define TARGET
91 #if ! (defined (__vxworks) || defined (__VMS) || defined (__MINGW32__) || \
92 defined (__nucleus__))
103 # include <termios.h>
112 #define CND(name,comment) \
113 printf ("\n->CND:$%d:" #name ":$%d:" comment, __LINE__, ((int) name));
115 #define CNS(name,comment) \
116 printf ("\n->CNS:$%d:" #name ":" name ":" comment, __LINE__);
119 printf ("\n->TXT:$%d:" text, __LINE__);
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" */
128 #define CNS(name, comment) \
129 asm volatile("\n->CNS:%0:" #name ":" name ":" comment \
131 /* General expression constant */
134 asm volatile("\n->TXT:%0:" text \
141 unsigned int _CRT_fmode
= _O_BINARY
;
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.
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.
157 ** Do not change the format of the line below without also updating the
160 TXT("-- This is the version for " TARGET
)
165 ** The type definitions for struct hostent components uses Interfaces.C
168 TXT("with Interfaces.C;")
172 package System.OS_Constants is
178 ** General constants (all platforms)
190 # define IOV_MAX INT_MAX
192 CND(IOV_MAX
, "Maximum writev iovcnt")
196 ---------------------
197 -- File open modes --
198 ---------------------
205 CND(O_RDWR
, "Read/write")
210 CND(O_NOCTTY
, "Don't change ctrl tty")
215 CND(O_NDELAY
, "Nonblocking")
219 ----------------------
220 -- Fcntl operations --
221 ----------------------
228 CND(F_GETFL
, "Get flags")
233 CND(F_SETFL
, "Set flags")
246 CND(FNDELAY
, "Nonblocking")
250 ----------------------
251 -- Ioctl operations --
252 ----------------------
259 CND(FIONBIO
, "Set/clear non-blocking io")
264 CND(FIONREAD
, "How many bytes to read")
272 -- The following constants are defined from <errno.h>
278 CND(EAGAIN
, "Try again")
283 CND(ENOENT
, "File not found")
288 CND(ENOMEM
, "Out of memory")
293 -- The following constants are defined from <winsock2.h> (WSA*)
298 ** For sockets-related errno values on Windows, gsocket.h redefines
307 CND(EACCES
, "Permission denied")
310 # define EADDRINUSE -1
312 CND(EADDRINUSE
, "Address already in use")
314 #ifndef EADDRNOTAVAIL
315 # define EADDRNOTAVAIL -1
317 CND(EADDRNOTAVAIL
, "Cannot assign address")
320 # define EAFNOSUPPORT -1
322 CND(EAFNOSUPPORT
, "Addr family not supported")
327 CND(EALREADY
, "Operation in progress")
332 CND(EBADF
, "Bad file descriptor")
335 # define ECONNABORTED -1
337 CND(ECONNABORTED
, "Connection aborted")
340 # define ECONNREFUSED -1
342 CND(ECONNREFUSED
, "Connection refused")
345 # define ECONNRESET -1
347 CND(ECONNRESET
, "Connection reset by peer")
350 # define EDESTADDRREQ -1
352 CND(EDESTADDRREQ
, "Destination addr required")
357 CND(EFAULT
, "Bad address")
360 # define EHOSTDOWN -1
362 CND(EHOSTDOWN
, "Host is down")
365 # define EHOSTUNREACH -1
367 CND(EHOSTUNREACH
, "No route to host")
370 # define EINPROGRESS -1
372 CND(EINPROGRESS
, "Operation now in progress")
377 CND(EINTR
, "Interrupted system call")
382 CND(EINVAL
, "Invalid argument")
387 CND(EIO
, "Input output error")
392 CND(EISCONN
, "Socket already connected")
397 CND(ELOOP
, "Too many symbolic links")
402 CND(EMFILE
, "Too many open files")
407 CND(EMSGSIZE
, "Message too long")
410 # define ENAMETOOLONG -1
412 CND(ENAMETOOLONG
, "Name too long")
417 CND(ENETDOWN
, "Network is down")
420 # define ENETRESET -1
422 CND(ENETRESET
, "Disconn. on network reset")
425 # define ENETUNREACH -1
427 CND(ENETUNREACH
, "Network is unreachable")
432 CND(ENOBUFS
, "No buffer space available")
435 # define ENOPROTOOPT -1
437 CND(ENOPROTOOPT
, "Protocol not available")
442 CND(ENOTCONN
, "Socket not connected")
447 CND(ENOTSOCK
, "Operation on non socket")
450 # define EOPNOTSUPP -1
452 CND(EOPNOTSUPP
, "Operation not supported")
455 # define EPFNOSUPPORT -1
457 CND(EPFNOSUPPORT
, "Unknown protocol family")
459 #ifndef EPROTONOSUPPORT
460 # define EPROTONOSUPPORT -1
462 CND(EPROTONOSUPPORT
, "Unknown protocol")
465 # define EPROTOTYPE -1
467 CND(EPROTOTYPE
, "Unknown protocol type")
470 # define ESHUTDOWN -1
472 CND(ESHUTDOWN
, "Cannot send once shutdown")
474 #ifndef ESOCKTNOSUPPORT
475 # define ESOCKTNOSUPPORT -1
477 CND(ESOCKTNOSUPPORT
, "Socket type not supported")
480 # define ETIMEDOUT -1
482 CND(ETIMEDOUT
, "Connection timed out")
485 # define ETOOMANYREFS -1
487 CND(ETOOMANYREFS
, "Too many references")
490 # define EWOULDBLOCK -1
492 CND(EWOULDBLOCK
, "Operation would block")
495 ** Terminal I/O constants
502 ----------------------
503 -- Terminal control --
504 ----------------------
511 CND(TCSANOW
, "Immediate")
516 CND(TCIFLUSH
, "Flush input")
526 CND(CRTSCTS
, "Hardware flow control")
536 CND(CS5
, "5 data bits")
541 CND(CS6
, "6 data bits")
546 CND(CS7
, "7 data bits")
551 CND(CS8
, "8 data bits")
556 CND(CSTOPB
, "2 stop bits")
561 CND(PARENB
, "Parity enable")
566 CND(PARODD
, "Parity odd")
616 CND(B1200
, "1200 bps")
621 CND(B1800
, "1800 bps")
626 CND(B2400
, "2400 bps")
631 CND(B4800
, "4800 bps")
636 CND(B9600
, "9600 bps")
641 CND(B19200
, "19200 bps")
646 CND(B38400
, "38400 bps")
651 CND(B57600
, "57600 bps")
656 CND(B115200
, "115200 bps")
661 CND(B230400
, "230400 bps")
666 CND(B460800
, "460800 bps")
671 CND(B500000
, "500000 bps")
676 CND(B576000
, "576000 bps")
681 CND(B921600
, "921600 bps")
686 CND(B1000000
, "1000000 bps")
691 CND(B1152000
, "1152000 bps")
696 CND(B1500000
, "1500000 bps")
701 CND(B2000000
, "2000000 bps")
706 CND(B2500000
, "2500000 bps")
711 CND(B3000000
, "3000000 bps")
716 CND(B3500000
, "3500000 bps")
721 CND(B4000000
, "4000000 bps")
725 ---------------------------------
726 -- Terminal control characters --
727 ---------------------------------
734 CND(VINTR
, "Interrupt")
759 CND(VTIME
, "Read timeout")
764 CND(VMIN
, "Read min chars")
774 CND(VSTART
, "Flow control start")
779 CND(VSTOP
, "Flow control stop")
784 CND(VSUSP
, "Suspend")
794 CND(VREPRINT
, "Reprint unread")
799 CND(VDISCARD
, "Discard pending")
804 CND(VWERASE
, "Word erase")
809 CND(VLNEXT
, "Literal next")
814 CND(VEOL2
, "Alternative EOL")
816 #endif /* HAVE_TERMIOS */
835 CND(AF_INET
, "IPv4 address family")
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.
841 #if defined(__rtems__)
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.
850 #if defined(__osf__) && !defined(_SS_MAXSIZE)
857 # define HAVE_AF_INET6 1
859 CND(AF_INET6
, "IPv6 address family")
870 # define SOCK_STREAM -1
872 CND(SOCK_STREAM
, "Stream socket")
875 # define SOCK_DGRAM -1
877 CND(SOCK_DGRAM
, "Datagram socket")
887 #ifndef HOST_NOT_FOUND
888 # define HOST_NOT_FOUND -1
890 CND(HOST_NOT_FOUND
, "Unknown host")
893 # define TRY_AGAIN -1
895 CND(TRY_AGAIN
, "Host name lookup failure")
900 CND(NO_DATA
, "No data record for name")
903 # define NO_RECOVERY -1
905 CND(NO_RECOVERY
, "Non recoverable errors")
918 CND(SHUT_RD
, "No more recv")
923 CND(SHUT_WR
, "No more send")
926 # define SHUT_RDWR -1
928 CND(SHUT_RDWR
, "No more recv/send")
932 ---------------------
933 -- Protocol levels --
934 ---------------------
939 # define SOL_SOCKET -1
941 CND(SOL_SOCKET
, "Options for socket level")
944 # define IPPROTO_IP -1
946 CND(IPPROTO_IP
, "Dummy protocol for IP")
949 # define IPPROTO_UDP -1
951 CND(IPPROTO_UDP
, "UDP")
954 # define IPPROTO_TCP -1
956 CND(IPPROTO_TCP
, "TCP")
969 CND(MSG_OOB
, "Process out-of-band data")
974 CND(MSG_PEEK
, "Peek at incoming data")
979 CND(MSG_EOR
, "Send end of record")
982 # define MSG_WAITALL -1
984 CND(MSG_WAITALL
, "Wait for full reception")
987 # define MSG_NOSIGNAL -1
989 CND(MSG_NOSIGNAL
, "No SIGPIPE on send")
992 # define MSG_Forced_Flags "MSG_NOSIGNAL"
994 # define MSG_Forced_Flags "0"
996 CNS(MSG_Forced_Flags
, "")
998 -- Flags set on all send(2) calls
1003 --------------------
1004 -- Socket options --
1005 --------------------
1010 # define TCP_NODELAY -1
1012 CND(TCP_NODELAY
, "Do not coalesce packets")
1014 #ifndef SO_REUSEADDR
1015 # define SO_REUSEADDR -1
1017 CND(SO_REUSEADDR
, "Bind reuse local address")
1019 #ifndef SO_REUSEPORT
1020 # define SO_REUSEPORT -1
1022 CND(SO_REUSEPORT
, "Bind reuse port number")
1024 #ifndef SO_KEEPALIVE
1025 # define SO_KEEPALIVE -1
1027 CND(SO_KEEPALIVE
, "Enable keep-alive msgs")
1030 # define SO_LINGER -1
1032 CND(SO_LINGER
, "Defer close to flush data")
1034 #ifndef SO_BROADCAST
1035 # define SO_BROADCAST -1
1037 CND(SO_BROADCAST
, "Can send broadcast msgs")
1040 # define SO_SNDBUF -1
1042 CND(SO_SNDBUF
, "Set/get send buffer size")
1045 # define SO_RCVBUF -1
1047 CND(SO_RCVBUF
, "Set/get recv buffer size")
1050 # define SO_SNDTIMEO -1
1052 CND(SO_SNDTIMEO
, "Emission timeout")
1055 # define SO_RCVTIMEO -1
1057 CND(SO_RCVTIMEO
, "Reception timeout")
1060 # define SO_ERROR -1
1062 CND(SO_ERROR
, "Get/clear error status")
1064 #ifndef IP_MULTICAST_IF
1065 # define IP_MULTICAST_IF -1
1067 CND(IP_MULTICAST_IF
, "Set/get mcast interface")
1069 #ifndef IP_MULTICAST_TTL
1070 # define IP_MULTICAST_TTL -1
1072 CND(IP_MULTICAST_TTL
, "Set/get multicast TTL")
1074 #ifndef IP_MULTICAST_LOOP
1075 # define IP_MULTICAST_LOOP -1
1077 CND(IP_MULTICAST_LOOP
, "Set/get mcast loopback")
1079 #ifndef IP_ADD_MEMBERSHIP
1080 # define IP_ADD_MEMBERSHIP -1
1082 CND(IP_ADD_MEMBERSHIP
, "Join a multicast group")
1084 #ifndef IP_DROP_MEMBERSHIP
1085 # define IP_DROP_MEMBERSHIP -1
1087 CND(IP_DROP_MEMBERSHIP
, "Leave a multicast group")
1090 # define IP_PKTINFO -1
1092 CND(IP_PKTINFO
, "Get datagram info")
1096 ----------------------
1097 -- Type definitions --
1098 ----------------------
1105 -- Sizes (in bytes) of the components of struct timeval
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")
1114 -- Sizes of protocol specific address types (for sockaddr.sa_len)
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))
1122 # define SIZEOF_sockaddr_in6 0
1124 CND(SIZEOF_sockaddr_in6
, "struct sockaddr_in6")
1128 -- Size of file descriptor sets
1130 #define SIZEOF_fd_set (sizeof (fd_set))
1131 CND(SIZEOF_fd_set
, "fd_set");
1134 -- Fields of struct hostent
1138 # define h_addrtype_t "short"
1139 # define h_length_t "short"
1141 # define h_addrtype_t "int"
1142 # define h_length_t "int"
1145 TXT(" subtype H_Addrtype_T is Interfaces.C." h_addrtype_t
";")
1146 TXT(" subtype H_Length_T is Interfaces.C." h_length_t
";")
1150 ----------------------------------------
1151 -- Properties of supported interfaces --
1152 ----------------------------------------
1156 CND(Need_Netdb_Buffer
, "Need buffer for Netdb ops")
1157 CND(Has_Sockaddr_Len
, "Sockaddr has sa_len field")
1160 ** Do not change the format of the line below without also updating the
1163 TXT(" Thread_Blocking_IO : constant Boolean := True;")
1165 -- Set False for contexts where socket i/o are process blocking
1168 #endif /* HAVE_SOCKETS */
1171 ** System-specific constants follow
1178 --------------------------------
1179 -- VxWorks-specific constants --
1180 --------------------------------
1182 -- These constants may be used only within the VxWorks version of
1183 -- GNAT.Sockets.Thin.
1186 CND(OK
, "VxWorks generic success")
1187 CND(ERROR
, "VxWorks generic error")
1194 ------------------------------
1195 -- MinGW-specific constants --
1196 ------------------------------
1198 -- These constants may be used only within the MinGW version of
1199 -- GNAT.Sockets.Thin.
1202 CND(WSASYSNOTREADY
, "System not ready")
1203 CND(WSAVERNOTSUPPORTED
, "Version not supported")
1204 CND(WSANOTINITIALISED
, "Winsock not initialized")
1205 CND(WSAEDISCON
, "Disconnected")
1216 -------------------------------
1217 -- Darwin-specific constants --
1218 -------------------------------
1220 -- These constants may be used only within the Darwin version of the GNAT
1224 #define PTHREAD_SIZE __PTHREAD_SIZE__
1225 CND(PTHREAD_SIZE
, "Pad in pthread_t")
1227 #define PTHREAD_ATTR_SIZE __PTHREAD_ATTR_SIZE__
1228 CND(PTHREAD_ATTR_SIZE
, "Pad in pthread_attr_t")
1230 #define PTHREAD_MUTEXATTR_SIZE __PTHREAD_MUTEXATTR_SIZE__
1231 CND(PTHREAD_MUTEXATTR_SIZE
, "Pad in pthread_mutexattr_t")
1233 #define PTHREAD_MUTEX_SIZE __PTHREAD_MUTEX_SIZE__
1234 CND(PTHREAD_MUTEX_SIZE
, "Pad in pthread_mutex_t")
1236 #define PTHREAD_CONDATTR_SIZE __PTHREAD_CONDATTR_SIZE__
1237 CND(PTHREAD_CONDATTR_SIZE
, "Pad in pthread_condattr_t")
1239 #define PTHREAD_COND_SIZE __PTHREAD_COND_SIZE__
1240 CND(PTHREAD_COND_SIZE
, "Pad in pthread_cond_t")
1242 #define PTHREAD_RWLOCKATTR_SIZE __PTHREAD_RWLOCKATTR_SIZE__
1243 CND(PTHREAD_RWLOCKATTR_SIZE
, "Pad in pthread_rwlockattr_t")
1245 #define PTHREAD_RWLOCK_SIZE __PTHREAD_RWLOCK_SIZE__
1246 CND(PTHREAD_RWLOCK_SIZE
, "Pad in pthread_rwlock_t")
1248 #define PTHREAD_ONCE_SIZE __PTHREAD_ONCE_SIZE__
1249 CND(PTHREAD_ONCE_SIZE
, "Pad in pthread_once_t")
1255 end System.OS_Constants;