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-2014, 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 ** built 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
81 /* Feature macro definitions */
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.
89 #if defined (__linux__)
91 /* Define _XOPEN_SOURCE to get IOV_MAX */
92 # if !defined (_XOPEN_SOURCE)
93 # define _XOPEN_SOURCE 500
96 /* Define _BSD_SOURCE to get CRTSCTS */
99 #endif /* defined (__linux__) */
101 /* Include gsocket.h before any system header so it can redefine FD_SETSIZE */
112 /** VMS is unable to do vector IO operations with default value of IOV_MAX,
113 ** so its value is redefined to a small one which is known to work properly.
119 #if ! (defined (__vxworks) || defined (__VMS) || defined (__MINGW32__) || \
120 defined (__nucleus__))
121 # define HAVE_TERMIOS
124 #if defined (__vxworks)
127 ** For VxWorks, always include vxWorks.h (gsocket.h provides it only for
128 ** the case of runtime libraries that support sockets). Note: this must
129 ** be done before including adaint.h.
132 # include <vxWorks.h>
139 # if defined (TARGET)
140 # error TARGET may not be defined when generating the dummy version
142 # define TARGET "batch runtime compilation (dummy values)"
145 # if !(defined (HAVE_SOCKETS) && defined (HAVE_TERMIOS))
146 # error Features missing on platform
154 # error Please define TARGET
162 # include <termios.h>
170 # include <pthread.h>
174 #if defined(__MINGW32__) || defined(__CYGWIN__)
176 # include <winbase.h>
184 # define _VAL(x) counter++
189 #define CND(name,comment) \
190 printf ("\n->CND:$%d:" #name ":$%d:" comment, __LINE__, ((int) _VAL (name)));
192 #define CNU(name,comment) \
193 printf ("\n->CNU:$%d:" #name ":$%u:" comment, __LINE__, ((unsigned int) _VAL (name)));
195 #define CNS(name,comment) \
196 printf ("\n->CNS:$%d:" #name ":" name ":" comment, __LINE__);
198 #define C(sname,type,value,comment)\
199 printf ("\n->C:$%d:" sname ":" #type ":" value ":" comment, __LINE__);
202 printf ("\n->SUB:$%d:" #sname ":" sname, __LINE__);
205 printf ("\n->TXT:$%d:" text, __LINE__);
209 #define CND(name, comment) \
210 asm volatile("\n->CND:%0:" #name ":%1:" comment \
211 : : "i" (__LINE__), "i" ((int) name));
212 /* Decimal constant in the range of type "int" */
214 #define CNU(name, comment) \
215 asm volatile("\n->CNU:%0:" #name ":%1:" comment \
216 : : "i" (__LINE__), "i" ((int) name));
217 /* Decimal constant in the range of type "unsigned int" (note, assembler
218 * always wants a signed int, we convert back in xoscons).
221 #define CNS(name, comment) \
222 asm volatile("\n->CNS:%0:" #name ":" name ":" comment \
224 /* General expression named number */
226 #define C(sname, type, value, comment) \
227 asm volatile("\n->C:%0:" sname ":" #type ":" value ":" comment \
232 asm volatile("\n->SUB:%0:" #sname ":" sname \
237 asm volatile("\n->TXT:%0:" text \
243 #define CST(name,comment) C(#name,String,name,comment)
244 /* String constant */
246 #define STR(x) STR1(x)
250 unsigned int _CRT_fmode
= _O_BINARY
;
257 -- This package provides target dependent definitions of constant for use
258 -- by the GNAT runtime library. This package should not be directly with'd
259 -- by an application program.
261 -- This file is generated automatically, do not modify it by hand! Instead,
262 -- make changes to s-oscons-tmplt.c and rebuild the GNAT runtime library.
266 ** Do not change the format of the line below without also updating the
269 TXT("-- This is the version for " TARGET
)
271 TXT("with Interfaces.C;")
274 package System.OS_Constants is
280 ** General constants (all platforms)
285 ---------------------------------
286 -- General platform parameters --
287 ---------------------------------
289 type OS_Type is (Windows, VMS, Other_OS);
291 #if defined (__MINGW32__)
292 # define TARGET_OS "Windows"
293 #elif defined (__VMS)
294 # define TARGET_OS "VMS"
296 # define TARGET_OS "Other_OS"
298 C("Target_OS", OS_Type
, TARGET_OS
, "")
300 pragma Warnings (Off, Target_OS);
301 -- Suppress warnings on Target_OS since it is in general tested for
302 -- equality with a constant value to implement conditional compilation,
303 -- which normally generates a constant condition warning.
306 #define Target_Name TARGET
310 ** Note: the name of the following constant is recognized specially by
311 ** xoscons (case sensitive).
313 #define SIZEOF_unsigned_int sizeof (unsigned int)
314 CND(SIZEOF_unsigned_int
, "Size of unsigned int")
325 # define IOV_MAX INT_MAX
327 CND(IOV_MAX
, "Maximum writev iovcnt")
329 /* NAME_MAX is used to compute the allocation size for a struct dirent
330 * passed to readdir() / readdir_r(). However on some systems it is not
331 * defined, as it is technically a filesystem dependent property that
332 * we should retrieve through pathconf(). In any case, we do not need a
333 * precise value but only an upper limit.
337 /* Solaris has no NAME_MAX but defines MAXNAMELEN */
338 # define NAME_MAX MAXNAMELEN
339 # elif defined(PATH_MAX)
340 /* PATH_MAX (maximum length of a full path name) is a safe fall back */
341 # define NAME_MAX PATH_MAX
342 # elif defined(FILENAME_MAX)
343 /* Similarly FILENAME_MAX can provide a safe fall back */
344 # define NAME_MAX FILENAME_MAX
346 /* Hardcode a reasonably large value as a last chance fallback */
347 # define NAME_MAX 1024
350 CND(NAME_MAX
, "Maximum file name length")
354 ---------------------
355 -- File open modes --
356 ---------------------
363 CND(O_RDWR
, "Read/write")
368 CND(O_NOCTTY
, "Don't change ctrl tty")
373 CND(O_NDELAY
, "Nonblocking")
377 ----------------------
378 -- Fcntl operations --
379 ----------------------
386 CND(F_GETFL
, "Get flags")
391 CND(F_SETFL
, "Set flags")
404 CND(FNDELAY
, "Nonblocking")
408 ----------------------
409 -- Ioctl operations --
410 ----------------------
414 /* ioctl(2) requests are "int" in UNIX, but "unsigned long" on FreeBSD */
418 # define IOCTL_Req_T "unsigned"
421 # define IOCTL_Req_T "int"
429 CNI(FIONBIO
, "Set/clear non-blocking io")
434 CNI(FIONREAD
, "How many bytes to read")
442 -- The following constants are defined from <errno.h>
448 CND(EAGAIN
, "Try again")
453 CND(ENOENT
, "File not found")
458 CND(ENOMEM
, "Out of memory")
463 -- The following constants are defined from <winsock2.h> (WSA*)
468 ** For sockets-related errno values on Windows, gsocket.h redefines
477 CND(EACCES
, "Permission denied")
480 # define EADDRINUSE -1
482 CND(EADDRINUSE
, "Address already in use")
484 #ifndef EADDRNOTAVAIL
485 # define EADDRNOTAVAIL -1
487 CND(EADDRNOTAVAIL
, "Cannot assign address")
490 # define EAFNOSUPPORT -1
492 CND(EAFNOSUPPORT
, "Addr family not supported")
497 CND(EALREADY
, "Operation in progress")
502 CND(EBADF
, "Bad file descriptor")
505 # define ECONNABORTED -1
507 CND(ECONNABORTED
, "Connection aborted")
510 # define ECONNREFUSED -1
512 CND(ECONNREFUSED
, "Connection refused")
515 # define ECONNRESET -1
517 CND(ECONNRESET
, "Connection reset by peer")
520 # define EDESTADDRREQ -1
522 CND(EDESTADDRREQ
, "Destination addr required")
527 CND(EFAULT
, "Bad address")
530 # define EHOSTDOWN -1
532 CND(EHOSTDOWN
, "Host is down")
535 # define EHOSTUNREACH -1
537 CND(EHOSTUNREACH
, "No route to host")
540 # define EINPROGRESS -1
542 CND(EINPROGRESS
, "Operation now in progress")
547 CND(EINTR
, "Interrupted system call")
552 CND(EINVAL
, "Invalid argument")
557 CND(EIO
, "Input output error")
562 CND(EISCONN
, "Socket already connected")
567 CND(ELOOP
, "Too many symbolic links")
572 CND(EMFILE
, "Too many open files")
577 CND(EMSGSIZE
, "Message too long")
580 # define ENAMETOOLONG -1
582 CND(ENAMETOOLONG
, "Name too long")
587 CND(ENETDOWN
, "Network is down")
590 # define ENETRESET -1
592 CND(ENETRESET
, "Disconn. on network reset")
595 # define ENETUNREACH -1
597 CND(ENETUNREACH
, "Network is unreachable")
602 CND(ENOBUFS
, "No buffer space available")
605 # define ENOPROTOOPT -1
607 CND(ENOPROTOOPT
, "Protocol not available")
612 CND(ENOTCONN
, "Socket not connected")
617 CND(ENOTSOCK
, "Operation on non socket")
620 # define EOPNOTSUPP -1
622 CND(EOPNOTSUPP
, "Operation not supported")
627 CND(EPIPE
, "Broken pipe")
630 # define EPFNOSUPPORT -1
632 CND(EPFNOSUPPORT
, "Unknown protocol family")
634 #ifndef EPROTONOSUPPORT
635 # define EPROTONOSUPPORT -1
637 CND(EPROTONOSUPPORT
, "Unknown protocol")
640 # define EPROTOTYPE -1
642 CND(EPROTOTYPE
, "Unknown protocol type")
647 CND(ERANGE
, "Result too large")
650 # define ESHUTDOWN -1
652 CND(ESHUTDOWN
, "Cannot send once shutdown")
654 #ifndef ESOCKTNOSUPPORT
655 # define ESOCKTNOSUPPORT -1
657 CND(ESOCKTNOSUPPORT
, "Socket type not supported")
660 # define ETIMEDOUT -1
662 CND(ETIMEDOUT
, "Connection timed out")
665 # define ETOOMANYREFS -1
667 CND(ETOOMANYREFS
, "Too many references")
670 # define EWOULDBLOCK -1
672 CND(EWOULDBLOCK
, "Operation would block")
677 CND(E2BIG
, "Argument list too long")
682 CND(EILSEQ
, "Illegal byte sequence")
685 ** Terminal/serial I/O constants
688 #if defined(HAVE_TERMIOS) || defined(__MINGW32__)
691 ----------------------
692 -- Terminal control --
693 ----------------------
703 CND(TCSANOW
, "Immediate")
708 CND(TCIFLUSH
, "Flush input")
713 CNU(IXON
, "Output sw flow control")
723 CNU(CRTSCTS
, "Output hw flow control")
733 CNU(CS5
, "5 data bits")
738 CNU(CS6
, "6 data bits")
743 CNU(CS7
, "7 data bits")
748 CNU(CS8
, "8 data bits")
753 CNU(CSTOPB
, "2 stop bits")
758 CNU(PARENB
, "Parity enable")
763 CNU(PARODD
, "Parity odd")
813 CNU(B1200
, "1200 bps")
818 CNU(B1800
, "1800 bps")
823 CNU(B2400
, "2400 bps")
828 CNU(B4800
, "4800 bps")
833 CNU(B9600
, "9600 bps")
838 CNU(B19200
, "19200 bps")
843 CNU(B38400
, "38400 bps")
848 CNU(B57600
, "57600 bps")
853 CNU(B115200
, "115200 bps")
858 CNU(B230400
, "230400 bps")
863 CNU(B460800
, "460800 bps")
868 CNU(B500000
, "500000 bps")
873 CNU(B576000
, "576000 bps")
878 CNU(B921600
, "921600 bps")
883 CNU(B1000000
, "1000000 bps")
888 CNU(B1152000
, "1152000 bps")
893 CNU(B1500000
, "1500000 bps")
898 CNU(B2000000
, "2000000 bps")
903 CNU(B2500000
, "2500000 bps")
908 CNU(B3000000
, "3000000 bps")
913 CNU(B3500000
, "3500000 bps")
918 CNU(B4000000
, "4000000 bps")
922 ---------------------------------
923 -- Terminal control characters --
924 ---------------------------------
931 CND(VINTR
, "Interrupt")
956 CND(VTIME
, "Read timeout")
961 CND(VMIN
, "Read min chars")
971 CND(VSTART
, "Flow control start")
976 CND(VSTOP
, "Flow control stop")
981 CND(VSUSP
, "Suspend")
991 CND(VREPRINT
, "Reprint unread")
996 CND(VDISCARD
, "Discard pending")
1001 CND(VWERASE
, "Word erase")
1006 CND(VLNEXT
, "Literal next")
1011 CND(VEOL2
, "Alternative EOL")
1013 #endif /* HAVE_TERMIOS */
1015 #if defined(__MINGW32__) || defined(__CYGWIN__)
1016 CNU(DTR_CONTROL_ENABLE
, "Enable DTR flow ctrl")
1017 CNU(RTS_CONTROL_ENABLE
, "Enable RTS flow ctrl")
1022 -----------------------------
1023 -- Pseudo terminal library --
1024 -----------------------------
1028 #if defined (__FreeBSD__) || defined (linux)
1029 # define PTY_Library "-lutil"
1031 # define PTY_Library ""
1033 CST(PTY_Library
, "for g-exptty")
1036 ** Sockets constants
1052 CND(AF_INET
, "IPv4 address family")
1055 ** RTEMS lies and defines AF_INET6 even though there is no IPV6 support.
1056 ** Its TCP/IP stack is in transition. It has newer .h files but no IPV6 yet.
1058 #if defined(__rtems__)
1063 # define AF_INET6 -1
1065 # define HAVE_AF_INET6 1
1067 CND(AF_INET6
, "IPv6 address family")
1078 # define SOCK_STREAM -1
1080 CND(SOCK_STREAM
, "Stream socket")
1083 # define SOCK_DGRAM -1
1085 CND(SOCK_DGRAM
, "Datagram socket")
1095 #ifndef HOST_NOT_FOUND
1096 # define HOST_NOT_FOUND -1
1098 CND(HOST_NOT_FOUND
, "Unknown host")
1101 # define TRY_AGAIN -1
1103 CND(TRY_AGAIN
, "Host name lookup failure")
1108 CND(NO_DATA
, "No data record for name")
1111 # define NO_RECOVERY -1
1113 CND(NO_RECOVERY
, "Non recoverable errors")
1117 --------------------
1118 -- Shutdown modes --
1119 --------------------
1126 CND(SHUT_RD
, "No more recv")
1131 CND(SHUT_WR
, "No more send")
1134 # define SHUT_RDWR -1
1136 CND(SHUT_RDWR
, "No more recv/send")
1140 ---------------------
1141 -- Protocol levels --
1142 ---------------------
1147 # define SOL_SOCKET -1
1149 CND(SOL_SOCKET
, "Options for socket level")
1152 # define IPPROTO_IP -1
1154 CND(IPPROTO_IP
, "Dummy protocol for IP")
1157 # define IPPROTO_UDP -1
1159 CND(IPPROTO_UDP
, "UDP")
1162 # define IPPROTO_TCP -1
1164 CND(IPPROTO_TCP
, "TCP")
1177 CND(MSG_OOB
, "Process out-of-band data")
1180 # define MSG_PEEK -1
1182 CND(MSG_PEEK
, "Peek at incoming data")
1187 CND(MSG_EOR
, "Send end of record")
1191 /* The value of MSG_WAITALL is 8. Nevertheless winsock.h doesn't
1192 define it, but it is still usable as we link to winsock2 API. */
1193 # define MSG_WAITALL (1 << 3)
1195 # define MSG_WAITALL -1
1198 CND(MSG_WAITALL
, "Wait for full reception")
1200 #ifndef MSG_NOSIGNAL
1201 # define MSG_NOSIGNAL -1
1203 CND(MSG_NOSIGNAL
, "No SIGPIPE on send")
1206 # define MSG_Forced_Flags "MSG_NOSIGNAL"
1208 # define MSG_Forced_Flags "0"
1210 CNS(MSG_Forced_Flags
, "")
1212 -- Flags set on all send(2) calls
1217 --------------------
1218 -- Socket options --
1219 --------------------
1224 # define TCP_NODELAY -1
1226 CND(TCP_NODELAY
, "Do not coalesce packets")
1228 #ifndef SO_REUSEADDR
1229 # define SO_REUSEADDR -1
1231 CND(SO_REUSEADDR
, "Bind reuse local address")
1233 #ifndef SO_REUSEPORT
1234 # define SO_REUSEPORT -1
1236 CND(SO_REUSEPORT
, "Bind reuse port number")
1238 #ifndef SO_KEEPALIVE
1239 # define SO_KEEPALIVE -1
1241 CND(SO_KEEPALIVE
, "Enable keep-alive msgs")
1244 # define SO_LINGER -1
1246 CND(SO_LINGER
, "Defer close to flush data")
1248 #ifndef SO_BROADCAST
1249 # define SO_BROADCAST -1
1251 CND(SO_BROADCAST
, "Can send broadcast msgs")
1254 # define SO_SNDBUF -1
1256 CND(SO_SNDBUF
, "Set/get send buffer size")
1259 # define SO_RCVBUF -1
1261 CND(SO_RCVBUF
, "Set/get recv buffer size")
1264 # define SO_SNDTIMEO -1
1266 CND(SO_SNDTIMEO
, "Emission timeout")
1269 # define SO_RCVTIMEO -1
1271 CND(SO_RCVTIMEO
, "Reception timeout")
1274 # define SO_ERROR -1
1276 CND(SO_ERROR
, "Get/clear error status")
1278 #ifndef IP_MULTICAST_IF
1279 # define IP_MULTICAST_IF -1
1281 CND(IP_MULTICAST_IF
, "Set/get mcast interface")
1283 #ifndef IP_MULTICAST_TTL
1284 # define IP_MULTICAST_TTL -1
1286 CND(IP_MULTICAST_TTL
, "Set/get multicast TTL")
1288 #ifndef IP_MULTICAST_LOOP
1289 # define IP_MULTICAST_LOOP -1
1291 CND(IP_MULTICAST_LOOP
, "Set/get mcast loopback")
1293 #ifndef IP_ADD_MEMBERSHIP
1294 # define IP_ADD_MEMBERSHIP -1
1296 CND(IP_ADD_MEMBERSHIP
, "Join a multicast group")
1298 #ifndef IP_DROP_MEMBERSHIP
1299 # define IP_DROP_MEMBERSHIP -1
1301 CND(IP_DROP_MEMBERSHIP
, "Leave a multicast group")
1304 # define IP_PKTINFO -1
1306 CND(IP_PKTINFO
, "Get datagram info")
1310 ----------------------
1311 -- Type definitions --
1312 ----------------------
1319 -- Sizes (in bytes) of the components of struct timeval
1321 #define SIZEOF_tv_sec (sizeof tv.tv_sec)
1322 CND(SIZEOF_tv_sec
, "tv_sec")
1323 #define SIZEOF_tv_usec (sizeof tv.tv_usec)
1324 CND(SIZEOF_tv_usec
, "tv_usec")
1327 -- Maximum allowed value for tv_sec
1331 ** On Solaris, field tv_sec in struct timeval has an undocumented
1332 ** hard-wired limit of 100 million.
1333 ** On IA64 HP-UX the limit is 2**31 - 1.
1336 # define MAX_tv_sec "100_000_000"
1338 #elif defined (__hpux__)
1339 # define MAX_tv_sec "16#7fffffff#"
1342 # define MAX_tv_sec "2 ** (SIZEOF_tv_sec * 8 - 1) - 1"
1348 -- Sizes of various data types
1351 #define SIZEOF_sockaddr_in (sizeof (struct sockaddr_in))
1352 CND(SIZEOF_sockaddr_in
, "struct sockaddr_in")
1353 #ifdef HAVE_AF_INET6
1354 # define SIZEOF_sockaddr_in6 (sizeof (struct sockaddr_in6))
1356 # define SIZEOF_sockaddr_in6 0
1358 CND(SIZEOF_sockaddr_in6
, "struct sockaddr_in6")
1360 #define SIZEOF_fd_set (sizeof (fd_set))
1361 CND(SIZEOF_fd_set
, "fd_set")
1362 CND(FD_SETSIZE
, "Max fd value")
1364 #define SIZEOF_struct_hostent (sizeof (struct hostent))
1365 CND(SIZEOF_struct_hostent
, "struct hostent")
1367 #define SIZEOF_struct_servent (sizeof (struct servent))
1368 CND(SIZEOF_struct_servent
, "struct servent")
1370 #if defined (__linux__)
1371 #define SIZEOF_sigset (sizeof (sigset_t))
1372 CND(SIZEOF_sigset
, "sigset")
1377 -- Fields of struct msghdr
1380 #if defined (__sun__) || defined (__hpux__)
1381 # define Msg_Iovlen_T "int"
1383 # define Msg_Iovlen_T "size_t"
1390 ----------------------------------------
1391 -- Properties of supported interfaces --
1392 ----------------------------------------
1396 CND(Need_Netdb_Buffer
, "Need buffer for Netdb ops")
1397 CND(Need_Netdb_Lock
, "Need lock for Netdb ops")
1398 CND(Has_Sockaddr_Len
, "Sockaddr has sa_len field")
1401 ** Do not change the format of the line below without also updating the
1404 C("Thread_Blocking_IO", Boolean
, "True", "")
1406 -- Set False for contexts where socket i/o are process blocking
1410 #ifdef HAVE_INET_PTON
1411 # define Inet_Pton_Linkname "inet_pton"
1413 # define Inet_Pton_Linkname "__gnat_inet_pton"
1415 CST(Inet_Pton_Linkname
, "")
1417 #endif /* HAVE_SOCKETS */
1421 ---------------------
1422 -- Threads support --
1423 ---------------------
1425 -- Clock identifier definitions
1429 /* Note: On HP-UX, CLOCK_REALTIME is an enum, not a macro. */
1431 #if !(defined(CLOCK_REALTIME) || defined (__hpux__))
1432 # define CLOCK_REALTIME (-1)
1434 CND(CLOCK_REALTIME
, "System realtime clock")
1436 #ifdef CLOCK_MONOTONIC
1437 CND(CLOCK_MONOTONIC
, "System monotonic clock")
1440 #ifdef CLOCK_FASTEST
1441 CND(CLOCK_FASTEST
, "Fastest clock")
1444 #ifndef CLOCK_THREAD_CPUTIME_ID
1445 # define CLOCK_THREAD_CPUTIME_ID -1
1447 CND(CLOCK_THREAD_CPUTIME_ID
, "Thread CPU clock")
1449 #if defined(__FreeBSD__) || (defined(_AIX) && defined(_AIXVERSION_530))
1450 /** On these platforms use system provided monotonic clock instead of
1451 ** the default CLOCK_REALTIME. We then need to set up cond var attributes
1452 ** appropriately (see thread.c).
1454 ** Note that AIX 5.2 does not support CLOCK_MONOTONIC timestamps for
1455 ** pthread_cond_timedwait (and does not have pthread_condattr_setclock),
1456 ** hence the conditionalization on AIX version above). _AIXVERSION_530
1457 ** is defined in AIX 5.3 and more recent versions.
1459 # define CLOCK_RT_Ada "CLOCK_MONOTONIC"
1462 /* By default use CLOCK_REALTIME */
1463 # define CLOCK_RT_Ada "CLOCK_REALTIME"
1467 CNS(CLOCK_RT_Ada
, "")
1470 #if defined (__APPLE__) || defined (__linux__) || defined (DUMMY)
1473 -- Sizes of pthread data types
1476 #if defined (__APPLE__) || defined (DUMMY)
1478 -- (on Darwin, these are just placeholders)
1480 #define PTHREAD_SIZE __PTHREAD_SIZE__
1481 #define PTHREAD_ATTR_SIZE __PTHREAD_ATTR_SIZE__
1482 #define PTHREAD_MUTEXATTR_SIZE __PTHREAD_MUTEXATTR_SIZE__
1483 #define PTHREAD_MUTEX_SIZE __PTHREAD_MUTEX_SIZE__
1484 #define PTHREAD_CONDATTR_SIZE __PTHREAD_CONDATTR_SIZE__
1485 #define PTHREAD_COND_SIZE __PTHREAD_COND_SIZE__
1486 #define PTHREAD_RWLOCKATTR_SIZE __PTHREAD_RWLOCKATTR_SIZE__
1487 #define PTHREAD_RWLOCK_SIZE __PTHREAD_RWLOCK_SIZE__
1488 #define PTHREAD_ONCE_SIZE __PTHREAD_ONCE_SIZE__
1490 #define PTHREAD_SIZE (sizeof (pthread_t))
1491 #define PTHREAD_ATTR_SIZE (sizeof (pthread_attr_t))
1492 #define PTHREAD_MUTEXATTR_SIZE (sizeof (pthread_mutexattr_t))
1493 #define PTHREAD_MUTEX_SIZE (sizeof (pthread_mutex_t))
1494 #define PTHREAD_CONDATTR_SIZE (sizeof (pthread_condattr_t))
1495 #define PTHREAD_COND_SIZE (sizeof (pthread_cond_t))
1496 #define PTHREAD_RWLOCKATTR_SIZE (sizeof (pthread_rwlockattr_t))
1497 #define PTHREAD_RWLOCK_SIZE (sizeof (pthread_rwlock_t))
1498 #define PTHREAD_ONCE_SIZE (sizeof (pthread_once_t))
1503 CND(PTHREAD_SIZE
, "pthread_t")
1504 CND(PTHREAD_ATTR_SIZE
, "pthread_attr_t")
1505 CND(PTHREAD_MUTEXATTR_SIZE
, "pthread_mutexattr_t")
1506 CND(PTHREAD_MUTEX_SIZE
, "pthread_mutex_t")
1507 CND(PTHREAD_CONDATTR_SIZE
, "pthread_condattr_t")
1508 CND(PTHREAD_COND_SIZE
, "pthread_cond_t")
1509 CND(PTHREAD_RWLOCKATTR_SIZE
, "pthread_rwlockattr_t")
1510 CND(PTHREAD_RWLOCK_SIZE
, "pthread_rwlock_t")
1511 CND(PTHREAD_ONCE_SIZE
, "pthread_once_t")
1513 #endif /* __APPLE__ || __linux__ */
1517 --------------------------------
1518 -- File and directory support --
1519 --------------------------------
1524 ** Note: this constant can be used in the GNAT runtime library. In compiler
1525 ** units on the other hand, System.OS_Constants is not available, so we
1526 ** declare an Ada constant (Osint.File_Attributes_Size) independently, which
1527 ** is at least as large as sizeof (struct file_attributes), and we have an
1528 ** assertion at initialization of Osint checking that the size is indeed at
1529 ** least sufficient.
1531 #define SIZEOF_struct_file_attributes (sizeof (struct file_attributes))
1532 CND(SIZEOF_struct_file_attributes
, "struct file_attributes")
1535 ** Maximal size of buffer for struct dirent. Note: Since POSIX.1 does not
1536 ** specify the size of the d_name field, and other nonstandard fields may
1537 ** precede that field within the dirent structure, we must make a conservative
1542 #define SIZEOF_struct_dirent_alloc \
1543 ((char*) &dent.d_name - (char*) &dent) + NAME_MAX + 1
1544 CND(SIZEOF_struct_dirent_alloc
, "struct dirent allocation")
1548 ** System-specific constants follow
1549 ** Each section should be activated if compiling for the corresponding
1550 ** platform *or* generating the dummy version for runtime test compilation.
1553 #if defined (__vxworks) || defined (DUMMY)
1557 --------------------------------
1558 -- VxWorks-specific constants --
1559 --------------------------------
1561 -- These constants may be used only within the VxWorks version of
1562 -- GNAT.Sockets.Thin.
1565 CND(OK
, "VxWorks generic success")
1566 CND(ERROR
, "VxWorks generic error")
1568 #endif /* __vxworks */
1570 #if defined (__MINGW32__) || defined (DUMMY)
1573 ------------------------------
1574 -- MinGW-specific constants --
1575 ------------------------------
1577 -- These constants may be used only within the MinGW version of
1578 -- GNAT.Sockets.Thin.
1581 CND(WSASYSNOTREADY
, "System not ready")
1582 CND(WSAVERNOTSUPPORTED
, "Version not supported")
1583 CND(WSANOTINITIALISED
, "Winsock not initialized")
1584 CND(WSAEDISCON
, "Disconnected")
1586 #endif /* __MINGW32__ */
1589 ** End of constants definitions
1598 end System.OS_Constants;