Mercurial > hg > CbC > CbC_gcc
comparison gcc/ada/s-oscons-tmplt.c @ 111:04ced10e8804
gcc 7
author | kono |
---|---|
date | Fri, 27 Oct 2017 22:46:09 +0900 |
parents | |
children | 84e7813d76e9 |
comparison
equal
deleted
inserted
replaced
68:561a7518be6b | 111:04ced10e8804 |
---|---|
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-2017, 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 ** built 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 /* Feature macro definitions */ | |
82 | |
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 **/ | |
88 | |
89 #if defined (__linux__) || defined (__ANDROID__) | |
90 | |
91 /* Define _XOPEN_SOURCE to get IOV_MAX */ | |
92 # if !defined (_XOPEN_SOURCE) | |
93 # define _XOPEN_SOURCE 500 | |
94 # endif | |
95 | |
96 /* Define _BSD_SOURCE to get CRTSCTS */ | |
97 # define _BSD_SOURCE | |
98 | |
99 #endif /* defined (__linux__) */ | |
100 | |
101 /* Include gsocket.h before any system header so it can redefine FD_SETSIZE */ | |
102 | |
103 #include "gsocket.h" | |
104 | |
105 #include <stdlib.h> | |
106 #include <string.h> | |
107 #include <limits.h> | |
108 #include <fcntl.h> | |
109 #include <time.h> | |
110 | |
111 #if ! (defined (__vxworks) || defined (__MINGW32__)) | |
112 # define HAVE_TERMIOS | |
113 #endif | |
114 | |
115 #if defined (__vxworks) | |
116 | |
117 /** | |
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. | |
121 **/ | |
122 | |
123 # include <vxWorks.h> | |
124 #endif | |
125 | |
126 #include "adaint.h" | |
127 | |
128 #ifdef DUMMY | |
129 | |
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 | |
135 | |
136 # if !(defined (HAVE_SOCKETS) && defined (HAVE_TERMIOS)) | |
137 # error Features missing on platform | |
138 # endif | |
139 | |
140 # define NATIVE | |
141 | |
142 #endif /* DUMMY */ | |
143 | |
144 #ifndef TARGET | |
145 # error Please define TARGET | |
146 #endif | |
147 | |
148 #ifndef HAVE_SOCKETS | |
149 # include <errno.h> | |
150 #endif | |
151 | |
152 #ifdef HAVE_TERMIOS | |
153 # include <termios.h> | |
154 #endif | |
155 | |
156 #ifdef __APPLE__ | |
157 # include <_types.h> | |
158 #endif | |
159 | |
160 #if defined (__linux__) || defined (__ANDROID__) || defined (__rtems__) | |
161 # include <pthread.h> | |
162 # include <signal.h> | |
163 #endif | |
164 | |
165 #if defined(__MINGW32__) || defined(__CYGWIN__) | |
166 # include <windef.h> | |
167 # include <winbase.h> | |
168 #endif | |
169 | |
170 #ifdef NATIVE | |
171 #include <stdio.h> | |
172 | |
173 #ifdef DUMMY | |
174 int counter = 0; | |
175 # define _VAL(x) counter++ | |
176 #else | |
177 # define _VAL(x) x | |
178 #endif | |
179 | |
180 #define CND(name,comment) \ | |
181 printf ("\n->CND:$%d:" #name ":$%d:" comment, __LINE__, ((int) _VAL (name))); | |
182 | |
183 #define CNU(name,comment) \ | |
184 printf ("\n->CNU:$%d:" #name ":$%u:" comment, __LINE__, ((unsigned int) _VAL (name))); | |
185 | |
186 #define CNS(name,comment) \ | |
187 printf ("\n->CNS:$%d:" #name ":" name ":" comment, __LINE__); | |
188 | |
189 #define C(sname,type,value,comment)\ | |
190 printf ("\n->C:$%d:" sname ":" #type ":" value ":" comment, __LINE__); | |
191 | |
192 #define SUB(sname)\ | |
193 printf ("\n->SUB:$%d:" #sname ":" sname, __LINE__); | |
194 | |
195 #define TXT(text) \ | |
196 printf ("\n->TXT:$%d:" text, __LINE__); | |
197 | |
198 #else | |
199 | |
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" */ | |
204 | |
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). | |
210 */ | |
211 | |
212 #define CNS(name, comment) \ | |
213 asm volatile("\n->CNS:%0:" #name ":" name ":" comment \ | |
214 : : "i" (__LINE__)); | |
215 /* General expression named number */ | |
216 | |
217 #define C(sname, type, value, comment) \ | |
218 asm volatile("\n->C:%0:" sname ":" #type ":" value ":" comment \ | |
219 : : "i" (__LINE__)); | |
220 /* Typed constant */ | |
221 | |
222 #define SUB(sname) \ | |
223 asm volatile("\n->SUB:%0:" #sname ":" sname \ | |
224 : : "i" (__LINE__)); | |
225 /* Subtype */ | |
226 | |
227 #define TXT(text) \ | |
228 asm volatile("\n->TXT:%0:" text \ | |
229 : : "i" (__LINE__)); | |
230 /* Freeform text */ | |
231 | |
232 #endif /* NATIVE */ | |
233 | |
234 #define CST(name,comment) C(#name,String,name,comment) | |
235 /* String constant */ | |
236 | |
237 #define STR(x) STR1(x) | |
238 #define STR1(x) #x | |
239 | |
240 #ifdef __MINGW32__ | |
241 unsigned int _CRT_fmode = _O_BINARY; | |
242 #endif | |
243 | |
244 int | |
245 main (void) { | |
246 | |
247 /* | |
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. | |
251 | |
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. | |
254 */ | |
255 | |
256 /** | |
257 ** Do not change the format of the line below without also updating the | |
258 ** MaRTE Makefile. | |
259 **/ | |
260 TXT("-- This is the version for " TARGET) | |
261 TXT("") | |
262 TXT("with Interfaces.C;") | |
263 | |
264 /* | |
265 package System.OS_Constants is | |
266 | |
267 pragma Pure; | |
268 */ | |
269 | |
270 /** | |
271 ** General constants (all platforms) | |
272 **/ | |
273 | |
274 /* | |
275 | |
276 --------------------------------- | |
277 -- General platform parameters -- | |
278 --------------------------------- | |
279 | |
280 type OS_Type is (Windows, Other_OS); | |
281 */ | |
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, "") | |
288 /* | |
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. | |
293 | |
294 */ | |
295 #define Target_Name TARGET | |
296 CST(Target_Name, "") | |
297 | |
298 /** | |
299 ** Note: the name of the following constant is recognized specially by | |
300 ** xoscons (case sensitive). | |
301 **/ | |
302 #define SIZEOF_unsigned_int sizeof (unsigned int) | |
303 CND(SIZEOF_unsigned_int, "Size of unsigned int") | |
304 | |
305 /* | |
306 | |
307 ------------------- | |
308 -- System limits -- | |
309 ------------------- | |
310 | |
311 */ | |
312 | |
313 #ifndef IOV_MAX | |
314 # define IOV_MAX INT_MAX | |
315 #endif | |
316 CND(IOV_MAX, "Maximum writev iovcnt") | |
317 | |
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. | |
323 */ | |
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") | |
340 | |
341 /* | |
342 | |
343 --------------------- | |
344 -- File open modes -- | |
345 --------------------- | |
346 | |
347 */ | |
348 | |
349 #ifndef O_RDWR | |
350 # define O_RDWR -1 | |
351 #endif | |
352 CND(O_RDWR, "Read/write") | |
353 | |
354 #ifndef O_NOCTTY | |
355 # define O_NOCTTY -1 | |
356 #endif | |
357 CND(O_NOCTTY, "Don't change ctrl tty") | |
358 | |
359 #ifndef O_NDELAY | |
360 # define O_NDELAY -1 | |
361 #endif | |
362 CND(O_NDELAY, "Nonblocking") | |
363 | |
364 /* | |
365 | |
366 ---------------------- | |
367 -- Fcntl operations -- | |
368 ---------------------- | |
369 | |
370 */ | |
371 | |
372 #ifndef F_GETFL | |
373 # define F_GETFL -1 | |
374 #endif | |
375 CND(F_GETFL, "Get flags") | |
376 | |
377 #ifndef F_SETFL | |
378 # define F_SETFL -1 | |
379 #endif | |
380 CND(F_SETFL, "Set flags") | |
381 | |
382 /* | |
383 | |
384 ----------------- | |
385 -- Fcntl flags -- | |
386 ----------------- | |
387 | |
388 */ | |
389 | |
390 #ifndef FNDELAY | |
391 # define FNDELAY -1 | |
392 #endif | |
393 CND(FNDELAY, "Nonblocking") | |
394 | |
395 /* | |
396 | |
397 ---------------------- | |
398 -- Ioctl operations -- | |
399 ---------------------- | |
400 | |
401 */ | |
402 | |
403 /* ioctl(2) requests are "int" in UNIX, but "unsigned long" on FreeBSD */ | |
404 | |
405 #if defined (__FreeBSD__) || defined (__DragonFly__) | |
406 # define CNI CNU | |
407 # define IOCTL_Req_T "unsigned" | |
408 #else | |
409 # define CNI CND | |
410 # define IOCTL_Req_T "int" | |
411 #endif | |
412 | |
413 SUB(IOCTL_Req_T) | |
414 | |
415 #ifndef FIONBIO | |
416 # define FIONBIO -1 | |
417 #endif | |
418 CNI(FIONBIO, "Set/clear non-blocking io") | |
419 | |
420 #ifndef FIONREAD | |
421 # define FIONREAD -1 | |
422 #endif | |
423 CNI(FIONREAD, "How many bytes to read") | |
424 | |
425 /* | |
426 | |
427 ------------------ | |
428 -- Errno values -- | |
429 ------------------ | |
430 | |
431 -- The following constants are defined from <errno.h> | |
432 | |
433 */ | |
434 #ifndef EAGAIN | |
435 # define EAGAIN -1 | |
436 #endif | |
437 CND(EAGAIN, "Try again") | |
438 | |
439 #ifndef ENOENT | |
440 # define ENOENT -1 | |
441 #endif | |
442 CND(ENOENT, "File not found") | |
443 | |
444 #ifndef ENOMEM | |
445 # define ENOMEM -1 | |
446 #endif | |
447 CND(ENOMEM, "Out of memory") | |
448 | |
449 #ifdef __MINGW32__ | |
450 /* | |
451 | |
452 -- The following constants are defined from <winsock2.h> (WSA*) | |
453 | |
454 */ | |
455 | |
456 /** | |
457 ** For sockets-related errno values on Windows, gsocket.h redefines | |
458 ** Exxx as WSAExxx. | |
459 **/ | |
460 | |
461 #endif | |
462 | |
463 #ifndef EACCES | |
464 # define EACCES -1 | |
465 #endif | |
466 CND(EACCES, "Permission denied") | |
467 | |
468 #ifndef EADDRINUSE | |
469 # define EADDRINUSE -1 | |
470 #endif | |
471 CND(EADDRINUSE, "Address already in use") | |
472 | |
473 #ifndef EADDRNOTAVAIL | |
474 # define EADDRNOTAVAIL -1 | |
475 #endif | |
476 CND(EADDRNOTAVAIL, "Cannot assign address") | |
477 | |
478 #ifndef EAFNOSUPPORT | |
479 # define EAFNOSUPPORT -1 | |
480 #endif | |
481 CND(EAFNOSUPPORT, "Addr family not supported") | |
482 | |
483 #ifndef EALREADY | |
484 # define EALREADY -1 | |
485 #endif | |
486 CND(EALREADY, "Operation in progress") | |
487 | |
488 #ifndef EBADF | |
489 # define EBADF -1 | |
490 #endif | |
491 CND(EBADF, "Bad file descriptor") | |
492 | |
493 #ifndef ECONNABORTED | |
494 # define ECONNABORTED -1 | |
495 #endif | |
496 CND(ECONNABORTED, "Connection aborted") | |
497 | |
498 #ifndef ECONNREFUSED | |
499 # define ECONNREFUSED -1 | |
500 #endif | |
501 CND(ECONNREFUSED, "Connection refused") | |
502 | |
503 #ifndef ECONNRESET | |
504 # define ECONNRESET -1 | |
505 #endif | |
506 CND(ECONNRESET, "Connection reset by peer") | |
507 | |
508 #ifndef EDESTADDRREQ | |
509 # define EDESTADDRREQ -1 | |
510 #endif | |
511 CND(EDESTADDRREQ, "Destination addr required") | |
512 | |
513 #ifndef EFAULT | |
514 # define EFAULT -1 | |
515 #endif | |
516 CND(EFAULT, "Bad address") | |
517 | |
518 #ifndef EHOSTDOWN | |
519 # define EHOSTDOWN -1 | |
520 #endif | |
521 CND(EHOSTDOWN, "Host is down") | |
522 | |
523 #ifndef EHOSTUNREACH | |
524 # define EHOSTUNREACH -1 | |
525 #endif | |
526 CND(EHOSTUNREACH, "No route to host") | |
527 | |
528 #ifndef EINPROGRESS | |
529 # define EINPROGRESS -1 | |
530 #endif | |
531 CND(EINPROGRESS, "Operation now in progress") | |
532 | |
533 #ifndef EINTR | |
534 # define EINTR -1 | |
535 #endif | |
536 CND(EINTR, "Interrupted system call") | |
537 | |
538 #ifndef EINVAL | |
539 # define EINVAL -1 | |
540 #endif | |
541 CND(EINVAL, "Invalid argument") | |
542 | |
543 #ifndef EIO | |
544 # define EIO -1 | |
545 #endif | |
546 CND(EIO, "Input output error") | |
547 | |
548 #ifndef EISCONN | |
549 # define EISCONN -1 | |
550 #endif | |
551 CND(EISCONN, "Socket already connected") | |
552 | |
553 #ifndef ELOOP | |
554 # define ELOOP -1 | |
555 #endif | |
556 CND(ELOOP, "Too many symbolic links") | |
557 | |
558 #ifndef EMFILE | |
559 # define EMFILE -1 | |
560 #endif | |
561 CND(EMFILE, "Too many open files") | |
562 | |
563 #ifndef EMSGSIZE | |
564 # define EMSGSIZE -1 | |
565 #endif | |
566 CND(EMSGSIZE, "Message too long") | |
567 | |
568 #ifndef ENAMETOOLONG | |
569 # define ENAMETOOLONG -1 | |
570 #endif | |
571 CND(ENAMETOOLONG, "Name too long") | |
572 | |
573 #ifndef ENETDOWN | |
574 # define ENETDOWN -1 | |
575 #endif | |
576 CND(ENETDOWN, "Network is down") | |
577 | |
578 #ifndef ENETRESET | |
579 # define ENETRESET -1 | |
580 #endif | |
581 CND(ENETRESET, "Disconn. on network reset") | |
582 | |
583 #ifndef ENETUNREACH | |
584 # define ENETUNREACH -1 | |
585 #endif | |
586 CND(ENETUNREACH, "Network is unreachable") | |
587 | |
588 #ifndef ENOBUFS | |
589 # define ENOBUFS -1 | |
590 #endif | |
591 CND(ENOBUFS, "No buffer space available") | |
592 | |
593 #ifndef ENOPROTOOPT | |
594 # define ENOPROTOOPT -1 | |
595 #endif | |
596 CND(ENOPROTOOPT, "Protocol not available") | |
597 | |
598 #ifndef ENOTCONN | |
599 # define ENOTCONN -1 | |
600 #endif | |
601 CND(ENOTCONN, "Socket not connected") | |
602 | |
603 #ifndef ENOTSOCK | |
604 # define ENOTSOCK -1 | |
605 #endif | |
606 CND(ENOTSOCK, "Operation on non socket") | |
607 | |
608 #ifndef EOPNOTSUPP | |
609 # define EOPNOTSUPP -1 | |
610 #endif | |
611 CND(EOPNOTSUPP, "Operation not supported") | |
612 | |
613 #ifndef EPIPE | |
614 # define EPIPE -1 | |
615 #endif | |
616 CND(EPIPE, "Broken pipe") | |
617 | |
618 #ifndef EPFNOSUPPORT | |
619 # define EPFNOSUPPORT -1 | |
620 #endif | |
621 CND(EPFNOSUPPORT, "Unknown protocol family") | |
622 | |
623 #ifndef EPROTONOSUPPORT | |
624 # define EPROTONOSUPPORT -1 | |
625 #endif | |
626 CND(EPROTONOSUPPORT, "Unknown protocol") | |
627 | |
628 #ifndef EPROTOTYPE | |
629 # define EPROTOTYPE -1 | |
630 #endif | |
631 CND(EPROTOTYPE, "Unknown protocol type") | |
632 | |
633 #ifndef ERANGE | |
634 # define ERANGE -1 | |
635 #endif | |
636 CND(ERANGE, "Result too large") | |
637 | |
638 #ifndef ESHUTDOWN | |
639 # define ESHUTDOWN -1 | |
640 #endif | |
641 CND(ESHUTDOWN, "Cannot send once shutdown") | |
642 | |
643 #ifndef ESOCKTNOSUPPORT | |
644 # define ESOCKTNOSUPPORT -1 | |
645 #endif | |
646 CND(ESOCKTNOSUPPORT, "Socket type not supported") | |
647 | |
648 #ifndef ETIMEDOUT | |
649 # define ETIMEDOUT -1 | |
650 #endif | |
651 CND(ETIMEDOUT, "Connection timed out") | |
652 | |
653 #ifndef ETOOMANYREFS | |
654 # define ETOOMANYREFS -1 | |
655 #endif | |
656 CND(ETOOMANYREFS, "Too many references") | |
657 | |
658 #ifndef EWOULDBLOCK | |
659 # define EWOULDBLOCK -1 | |
660 #endif | |
661 CND(EWOULDBLOCK, "Operation would block") | |
662 | |
663 #ifndef E2BIG | |
664 # define E2BIG -1 | |
665 #endif | |
666 CND(E2BIG, "Argument list too long") | |
667 | |
668 #ifndef EILSEQ | |
669 # define EILSEQ -1 | |
670 #endif | |
671 CND(EILSEQ, "Illegal byte sequence") | |
672 | |
673 /** | |
674 ** Terminal/serial I/O constants | |
675 **/ | |
676 | |
677 #if defined(HAVE_TERMIOS) || defined(__MINGW32__) | |
678 /* | |
679 | |
680 ---------------------- | |
681 -- Terminal control -- | |
682 ---------------------- | |
683 | |
684 */ | |
685 #endif | |
686 | |
687 #ifdef HAVE_TERMIOS | |
688 | |
689 #ifndef TCSANOW | |
690 # define TCSANOW -1 | |
691 #endif | |
692 CND(TCSANOW, "Immediate") | |
693 | |
694 #ifndef TCIFLUSH | |
695 # define TCIFLUSH -1 | |
696 #endif | |
697 CND(TCIFLUSH, "Flush input") | |
698 | |
699 #ifndef IXON | |
700 # define IXON -1 | |
701 #endif | |
702 CNU(IXON, "Output sw flow control") | |
703 | |
704 #ifndef CLOCAL | |
705 # define CLOCAL -1 | |
706 #endif | |
707 CNU(CLOCAL, "Local") | |
708 | |
709 #ifndef CRTSCTS | |
710 # define CRTSCTS -1 | |
711 #endif | |
712 CNU(CRTSCTS, "Output hw flow control") | |
713 | |
714 #ifndef CREAD | |
715 # define CREAD -1 | |
716 #endif | |
717 CNU(CREAD, "Read") | |
718 | |
719 #ifndef CS5 | |
720 # define CS5 -1 | |
721 #endif | |
722 CNU(CS5, "5 data bits") | |
723 | |
724 #ifndef CS6 | |
725 # define CS6 -1 | |
726 #endif | |
727 CNU(CS6, "6 data bits") | |
728 | |
729 #ifndef CS7 | |
730 # define CS7 -1 | |
731 #endif | |
732 CNU(CS7, "7 data bits") | |
733 | |
734 #ifndef CS8 | |
735 # define CS8 -1 | |
736 #endif | |
737 CNU(CS8, "8 data bits") | |
738 | |
739 #ifndef CSTOPB | |
740 # define CSTOPB -1 | |
741 #endif | |
742 CNU(CSTOPB, "2 stop bits") | |
743 | |
744 #ifndef PARENB | |
745 # define PARENB -1 | |
746 #endif | |
747 CNU(PARENB, "Parity enable") | |
748 | |
749 #ifndef PARODD | |
750 # define PARODD -1 | |
751 #endif | |
752 CNU(PARODD, "Parity odd") | |
753 | |
754 #ifndef B0 | |
755 # define B0 -1 | |
756 #endif | |
757 CNU(B0, "0 bps") | |
758 | |
759 #ifndef B50 | |
760 # define B50 -1 | |
761 #endif | |
762 CNU(B50, "50 bps") | |
763 | |
764 #ifndef B75 | |
765 # define B75 -1 | |
766 #endif | |
767 CNU(B75, "75 bps") | |
768 | |
769 #ifndef B110 | |
770 # define B110 -1 | |
771 #endif | |
772 CNU(B110, "110 bps") | |
773 | |
774 #ifndef B134 | |
775 # define B134 -1 | |
776 #endif | |
777 CNU(B134, "134 bps") | |
778 | |
779 #ifndef B150 | |
780 # define B150 -1 | |
781 #endif | |
782 CNU(B150, "150 bps") | |
783 | |
784 #ifndef B200 | |
785 # define B200 -1 | |
786 #endif | |
787 CNU(B200, "200 bps") | |
788 | |
789 #ifndef B300 | |
790 # define B300 -1 | |
791 #endif | |
792 CNU(B300, "300 bps") | |
793 | |
794 #ifndef B600 | |
795 # define B600 -1 | |
796 #endif | |
797 CNU(B600, "600 bps") | |
798 | |
799 #ifndef B1200 | |
800 # define B1200 -1 | |
801 #endif | |
802 CNU(B1200, "1200 bps") | |
803 | |
804 #ifndef B1800 | |
805 # define B1800 -1 | |
806 #endif | |
807 CNU(B1800, "1800 bps") | |
808 | |
809 #ifndef B2400 | |
810 # define B2400 -1 | |
811 #endif | |
812 CNU(B2400, "2400 bps") | |
813 | |
814 #ifndef B4800 | |
815 # define B4800 -1 | |
816 #endif | |
817 CNU(B4800, "4800 bps") | |
818 | |
819 #ifndef B9600 | |
820 # define B9600 -1 | |
821 #endif | |
822 CNU(B9600, "9600 bps") | |
823 | |
824 #ifndef B19200 | |
825 # define B19200 -1 | |
826 #endif | |
827 CNU(B19200, "19200 bps") | |
828 | |
829 #ifndef B38400 | |
830 # define B38400 -1 | |
831 #endif | |
832 CNU(B38400, "38400 bps") | |
833 | |
834 #ifndef B57600 | |
835 # define B57600 -1 | |
836 #endif | |
837 CNU(B57600, "57600 bps") | |
838 | |
839 #ifndef B115200 | |
840 # define B115200 -1 | |
841 #endif | |
842 CNU(B115200, "115200 bps") | |
843 | |
844 #ifndef B230400 | |
845 # define B230400 -1 | |
846 #endif | |
847 CNU(B230400, "230400 bps") | |
848 | |
849 #ifndef B460800 | |
850 # define B460800 -1 | |
851 #endif | |
852 CNU(B460800, "460800 bps") | |
853 | |
854 #ifndef B500000 | |
855 # define B500000 -1 | |
856 #endif | |
857 CNU(B500000, "500000 bps") | |
858 | |
859 #ifndef B576000 | |
860 # define B576000 -1 | |
861 #endif | |
862 CNU(B576000, "576000 bps") | |
863 | |
864 #ifndef B921600 | |
865 # define B921600 -1 | |
866 #endif | |
867 CNU(B921600, "921600 bps") | |
868 | |
869 #ifndef B1000000 | |
870 # define B1000000 -1 | |
871 #endif | |
872 CNU(B1000000, "1000000 bps") | |
873 | |
874 #ifndef B1152000 | |
875 # define B1152000 -1 | |
876 #endif | |
877 CNU(B1152000, "1152000 bps") | |
878 | |
879 #ifndef B1500000 | |
880 # define B1500000 -1 | |
881 #endif | |
882 CNU(B1500000, "1500000 bps") | |
883 | |
884 #ifndef B2000000 | |
885 # define B2000000 -1 | |
886 #endif | |
887 CNU(B2000000, "2000000 bps") | |
888 | |
889 #ifndef B2500000 | |
890 # define B2500000 -1 | |
891 #endif | |
892 CNU(B2500000, "2500000 bps") | |
893 | |
894 #ifndef B3000000 | |
895 # define B3000000 -1 | |
896 #endif | |
897 CNU(B3000000, "3000000 bps") | |
898 | |
899 #ifndef B3500000 | |
900 # define B3500000 -1 | |
901 #endif | |
902 CNU(B3500000, "3500000 bps") | |
903 | |
904 #ifndef B4000000 | |
905 # define B4000000 -1 | |
906 #endif | |
907 CNU(B4000000, "4000000 bps") | |
908 | |
909 /* | |
910 | |
911 --------------------------------- | |
912 -- Terminal control characters -- | |
913 --------------------------------- | |
914 | |
915 */ | |
916 | |
917 #ifndef VINTR | |
918 # define VINTR -1 | |
919 #endif | |
920 CND(VINTR, "Interrupt") | |
921 | |
922 #ifndef VQUIT | |
923 # define VQUIT -1 | |
924 #endif | |
925 CND(VQUIT, "Quit") | |
926 | |
927 #ifndef VERASE | |
928 # define VERASE -1 | |
929 #endif | |
930 CND(VERASE, "Erase") | |
931 | |
932 #ifndef VKILL | |
933 # define VKILL -1 | |
934 #endif | |
935 CND(VKILL, "Kill") | |
936 | |
937 #ifndef VEOF | |
938 # define VEOF -1 | |
939 #endif | |
940 CND(VEOF, "EOF") | |
941 | |
942 #ifndef VTIME | |
943 # define VTIME -1 | |
944 #endif | |
945 CND(VTIME, "Read timeout") | |
946 | |
947 #ifndef VMIN | |
948 # define VMIN -1 | |
949 #endif | |
950 CND(VMIN, "Read min chars") | |
951 | |
952 #ifndef VSWTC | |
953 # define VSWTC -1 | |
954 #endif | |
955 CND(VSWTC, "Switch") | |
956 | |
957 #ifndef VSTART | |
958 # define VSTART -1 | |
959 #endif | |
960 CND(VSTART, "Flow control start") | |
961 | |
962 #ifndef VSTOP | |
963 # define VSTOP -1 | |
964 #endif | |
965 CND(VSTOP, "Flow control stop") | |
966 | |
967 #ifndef VSUSP | |
968 # define VSUSP -1 | |
969 #endif | |
970 CND(VSUSP, "Suspend") | |
971 | |
972 #ifndef VEOL | |
973 # define VEOL -1 | |
974 #endif | |
975 CND(VEOL, "EOL") | |
976 | |
977 #ifndef VREPRINT | |
978 # define VREPRINT -1 | |
979 #endif | |
980 CND(VREPRINT, "Reprint unread") | |
981 | |
982 #ifndef VDISCARD | |
983 # define VDISCARD -1 | |
984 #endif | |
985 CND(VDISCARD, "Discard pending") | |
986 | |
987 #ifndef VWERASE | |
988 # define VWERASE -1 | |
989 #endif | |
990 CND(VWERASE, "Word erase") | |
991 | |
992 #ifndef VLNEXT | |
993 # define VLNEXT -1 | |
994 #endif | |
995 CND(VLNEXT, "Literal next") | |
996 | |
997 #ifndef VEOL2 | |
998 # define VEOL2 -1 | |
999 #endif | |
1000 CND(VEOL2, "Alternative EOL") | |
1001 | |
1002 #endif /* HAVE_TERMIOS */ | |
1003 | |
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 | |
1008 | |
1009 /* | |
1010 | |
1011 ----------------------------- | |
1012 -- Pseudo terminal library -- | |
1013 ----------------------------- | |
1014 | |
1015 */ | |
1016 | |
1017 #if defined (__FreeBSD__) || defined (__linux__) || defined (__DragonFly__) | |
1018 # define PTY_Library "-lutil" | |
1019 #else | |
1020 # define PTY_Library "" | |
1021 #endif | |
1022 CST(PTY_Library, "for g-exptty") | |
1023 | |
1024 /** | |
1025 ** Sockets constants | |
1026 **/ | |
1027 | |
1028 #ifdef HAVE_SOCKETS | |
1029 | |
1030 /* | |
1031 | |
1032 -------------- | |
1033 -- Families -- | |
1034 -------------- | |
1035 | |
1036 */ | |
1037 | |
1038 #ifndef AF_INET | |
1039 # define AF_INET -1 | |
1040 #endif | |
1041 CND(AF_INET, "IPv4 address family") | |
1042 | |
1043 /** | |
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. | |
1046 **/ | |
1047 #if defined(__rtems__) | |
1048 # undef AF_INET6 | |
1049 #endif | |
1050 | |
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") | |
1057 | |
1058 /* | |
1059 | |
1060 ------------------ | |
1061 -- Socket modes -- | |
1062 ------------------ | |
1063 | |
1064 */ | |
1065 | |
1066 #ifndef SOCK_STREAM | |
1067 # define SOCK_STREAM -1 | |
1068 #endif | |
1069 CND(SOCK_STREAM, "Stream socket") | |
1070 | |
1071 #ifndef SOCK_DGRAM | |
1072 # define SOCK_DGRAM -1 | |
1073 #endif | |
1074 CND(SOCK_DGRAM, "Datagram socket") | |
1075 | |
1076 /* | |
1077 | |
1078 ----------------- | |
1079 -- Host errors -- | |
1080 ----------------- | |
1081 | |
1082 */ | |
1083 | |
1084 #ifndef HOST_NOT_FOUND | |
1085 # define HOST_NOT_FOUND -1 | |
1086 #endif | |
1087 CND(HOST_NOT_FOUND, "Unknown host") | |
1088 | |
1089 #ifndef TRY_AGAIN | |
1090 # define TRY_AGAIN -1 | |
1091 #endif | |
1092 CND(TRY_AGAIN, "Host name lookup failure") | |
1093 | |
1094 #ifndef NO_DATA | |
1095 # define NO_DATA -1 | |
1096 #endif | |
1097 CND(NO_DATA, "No data record for name") | |
1098 | |
1099 #ifndef NO_RECOVERY | |
1100 # define NO_RECOVERY -1 | |
1101 #endif | |
1102 CND(NO_RECOVERY, "Non recoverable errors") | |
1103 | |
1104 /* | |
1105 | |
1106 -------------------- | |
1107 -- Shutdown modes -- | |
1108 -------------------- | |
1109 | |
1110 */ | |
1111 | |
1112 #ifndef SHUT_RD | |
1113 # define SHUT_RD -1 | |
1114 #endif | |
1115 CND(SHUT_RD, "No more recv") | |
1116 | |
1117 #ifndef SHUT_WR | |
1118 # define SHUT_WR -1 | |
1119 #endif | |
1120 CND(SHUT_WR, "No more send") | |
1121 | |
1122 #ifndef SHUT_RDWR | |
1123 # define SHUT_RDWR -1 | |
1124 #endif | |
1125 CND(SHUT_RDWR, "No more recv/send") | |
1126 | |
1127 /* | |
1128 | |
1129 --------------------- | |
1130 -- Protocol levels -- | |
1131 --------------------- | |
1132 | |
1133 */ | |
1134 | |
1135 #ifndef SOL_SOCKET | |
1136 # define SOL_SOCKET -1 | |
1137 #endif | |
1138 CND(SOL_SOCKET, "Options for socket level") | |
1139 | |
1140 #ifndef IPPROTO_IP | |
1141 # define IPPROTO_IP -1 | |
1142 #endif | |
1143 CND(IPPROTO_IP, "Dummy protocol for IP") | |
1144 | |
1145 #ifndef IPPROTO_UDP | |
1146 # define IPPROTO_UDP -1 | |
1147 #endif | |
1148 CND(IPPROTO_UDP, "UDP") | |
1149 | |
1150 #ifndef IPPROTO_TCP | |
1151 # define IPPROTO_TCP -1 | |
1152 #endif | |
1153 CND(IPPROTO_TCP, "TCP") | |
1154 | |
1155 /* | |
1156 | |
1157 ------------------- | |
1158 -- Request flags -- | |
1159 ------------------- | |
1160 | |
1161 */ | |
1162 | |
1163 #ifndef MSG_OOB | |
1164 # define MSG_OOB -1 | |
1165 #endif | |
1166 CND(MSG_OOB, "Process out-of-band data") | |
1167 | |
1168 #ifndef MSG_PEEK | |
1169 # define MSG_PEEK -1 | |
1170 #endif | |
1171 CND(MSG_PEEK, "Peek at incoming data") | |
1172 | |
1173 #ifndef MSG_EOR | |
1174 # define MSG_EOR -1 | |
1175 #endif | |
1176 CND(MSG_EOR, "Send end of record") | |
1177 | |
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") | |
1188 | |
1189 #ifndef MSG_NOSIGNAL | |
1190 # define MSG_NOSIGNAL -1 | |
1191 #endif | |
1192 CND(MSG_NOSIGNAL, "No SIGPIPE on send") | |
1193 | |
1194 #if defined (__linux__) || defined (__ANDROID__) | |
1195 # define MSG_Forced_Flags "MSG_NOSIGNAL" | |
1196 #else | |
1197 # define MSG_Forced_Flags "0" | |
1198 #endif | |
1199 CNS(MSG_Forced_Flags, "") | |
1200 /* | |
1201 -- Flags set on all send(2) calls | |
1202 */ | |
1203 | |
1204 /* | |
1205 | |
1206 -------------------- | |
1207 -- Socket options -- | |
1208 -------------------- | |
1209 | |
1210 */ | |
1211 | |
1212 #ifndef TCP_NODELAY | |
1213 # define TCP_NODELAY -1 | |
1214 #endif | |
1215 CND(TCP_NODELAY, "Do not coalesce packets") | |
1216 | |
1217 #ifndef SO_REUSEADDR | |
1218 # define SO_REUSEADDR -1 | |
1219 #endif | |
1220 CND(SO_REUSEADDR, "Bind reuse local address") | |
1221 | |
1222 #ifndef SO_REUSEPORT | |
1223 # define SO_REUSEPORT -1 | |
1224 #endif | |
1225 CND(SO_REUSEPORT, "Bind reuse port number") | |
1226 | |
1227 #ifndef SO_KEEPALIVE | |
1228 # define SO_KEEPALIVE -1 | |
1229 #endif | |
1230 CND(SO_KEEPALIVE, "Enable keep-alive msgs") | |
1231 | |
1232 #ifndef SO_LINGER | |
1233 # define SO_LINGER -1 | |
1234 #endif | |
1235 CND(SO_LINGER, "Defer close to flush data") | |
1236 | |
1237 #ifndef SO_BROADCAST | |
1238 # define SO_BROADCAST -1 | |
1239 #endif | |
1240 CND(SO_BROADCAST, "Can send broadcast msgs") | |
1241 | |
1242 #ifndef SO_SNDBUF | |
1243 # define SO_SNDBUF -1 | |
1244 #endif | |
1245 CND(SO_SNDBUF, "Set/get send buffer size") | |
1246 | |
1247 #ifndef SO_RCVBUF | |
1248 # define SO_RCVBUF -1 | |
1249 #endif | |
1250 CND(SO_RCVBUF, "Set/get recv buffer size") | |
1251 | |
1252 #ifndef SO_SNDTIMEO | |
1253 # define SO_SNDTIMEO -1 | |
1254 #endif | |
1255 CND(SO_SNDTIMEO, "Emission timeout") | |
1256 | |
1257 #ifndef SO_RCVTIMEO | |
1258 # define SO_RCVTIMEO -1 | |
1259 #endif | |
1260 CND(SO_RCVTIMEO, "Reception timeout") | |
1261 | |
1262 #ifndef SO_ERROR | |
1263 # define SO_ERROR -1 | |
1264 #endif | |
1265 CND(SO_ERROR, "Get/clear error status") | |
1266 | |
1267 #ifndef SO_BUSY_POLL | |
1268 # define SO_BUSY_POLL -1 | |
1269 #endif | |
1270 CND(SO_BUSY_POLL, "Busy polling") | |
1271 | |
1272 #ifndef IP_MULTICAST_IF | |
1273 # define IP_MULTICAST_IF -1 | |
1274 #endif | |
1275 CND(IP_MULTICAST_IF, "Set/get mcast interface") | |
1276 | |
1277 #ifndef IP_MULTICAST_TTL | |
1278 # define IP_MULTICAST_TTL -1 | |
1279 #endif | |
1280 CND(IP_MULTICAST_TTL, "Set/get multicast TTL") | |
1281 | |
1282 #ifndef IP_MULTICAST_LOOP | |
1283 # define IP_MULTICAST_LOOP -1 | |
1284 #endif | |
1285 CND(IP_MULTICAST_LOOP, "Set/get mcast loopback") | |
1286 | |
1287 #ifndef IP_ADD_MEMBERSHIP | |
1288 # define IP_ADD_MEMBERSHIP -1 | |
1289 #endif | |
1290 CND(IP_ADD_MEMBERSHIP, "Join a multicast group") | |
1291 | |
1292 #ifndef IP_DROP_MEMBERSHIP | |
1293 # define IP_DROP_MEMBERSHIP -1 | |
1294 #endif | |
1295 CND(IP_DROP_MEMBERSHIP, "Leave a multicast group") | |
1296 | |
1297 #ifndef IP_PKTINFO | |
1298 # define IP_PKTINFO -1 | |
1299 #endif | |
1300 CND(IP_PKTINFO, "Get datagram info") | |
1301 | |
1302 /* | |
1303 | |
1304 ---------------------- | |
1305 -- Type definitions -- | |
1306 ---------------------- | |
1307 | |
1308 */ | |
1309 | |
1310 { | |
1311 struct timeval tv; | |
1312 /* | |
1313 -- Sizes (in bytes) of the components of struct timeval | |
1314 */ | |
1315 #define SIZEOF_tv_sec (sizeof tv.tv_sec) | |
1316 CND(SIZEOF_tv_sec, "tv_sec") | |
1317 #define SIZEOF_tv_usec (sizeof tv.tv_usec) | |
1318 CND(SIZEOF_tv_usec, "tv_usec") | |
1319 /* | |
1320 | |
1321 -- Maximum allowed value for tv_sec | |
1322 */ | |
1323 | |
1324 /** | |
1325 ** On Solaris, field tv_sec in struct timeval has an undocumented | |
1326 ** hard-wired limit of 100 million. | |
1327 ** On IA64 HP-UX the limit is 2**31 - 1. | |
1328 **/ | |
1329 #if defined (__sun__) | |
1330 # define MAX_tv_sec "100_000_000" | |
1331 | |
1332 #elif defined (__hpux__) | |
1333 # define MAX_tv_sec "16#7fffffff#" | |
1334 | |
1335 #else | |
1336 # define MAX_tv_sec "2 ** (SIZEOF_tv_sec * 8 - 1) - 1" | |
1337 #endif | |
1338 CNS(MAX_tv_sec, "") | |
1339 } | |
1340 /* | |
1341 | |
1342 -- Sizes of various data types | |
1343 */ | |
1344 | |
1345 #define SIZEOF_sockaddr_in (sizeof (struct sockaddr_in)) | |
1346 CND(SIZEOF_sockaddr_in, "struct sockaddr_in") | |
1347 #ifdef HAVE_AF_INET6 | |
1348 # define SIZEOF_sockaddr_in6 (sizeof (struct sockaddr_in6)) | |
1349 #else | |
1350 # define SIZEOF_sockaddr_in6 0 | |
1351 #endif | |
1352 CND(SIZEOF_sockaddr_in6, "struct sockaddr_in6") | |
1353 | |
1354 #define SIZEOF_fd_set (sizeof (fd_set)) | |
1355 CND(SIZEOF_fd_set, "fd_set") | |
1356 CND(FD_SETSIZE, "Max fd value") | |
1357 | |
1358 #define SIZEOF_struct_hostent (sizeof (struct hostent)) | |
1359 CND(SIZEOF_struct_hostent, "struct hostent") | |
1360 | |
1361 #define SIZEOF_struct_servent (sizeof (struct servent)) | |
1362 CND(SIZEOF_struct_servent, "struct servent") | |
1363 | |
1364 #if defined (__linux__) || defined (__ANDROID__) | |
1365 #define SIZEOF_sigset (sizeof (sigset_t)) | |
1366 CND(SIZEOF_sigset, "sigset") | |
1367 #endif | |
1368 | |
1369 /* | |
1370 | |
1371 -- Fields of struct msghdr | |
1372 */ | |
1373 | |
1374 #if defined (__sun__) || defined (__hpux__) | |
1375 # define Msg_Iovlen_T "int" | |
1376 #else | |
1377 # define Msg_Iovlen_T "size_t" | |
1378 #endif | |
1379 | |
1380 SUB(Msg_Iovlen_T) | |
1381 | |
1382 /* | |
1383 | |
1384 ---------------------------------------- | |
1385 -- Properties of supported interfaces -- | |
1386 ---------------------------------------- | |
1387 | |
1388 */ | |
1389 | |
1390 CND(Need_Netdb_Buffer, "Need buffer for Netdb ops") | |
1391 CND(Need_Netdb_Lock, "Need lock for Netdb ops") | |
1392 CND(Has_Sockaddr_Len, "Sockaddr has sa_len field") | |
1393 | |
1394 /** | |
1395 ** Do not change the format of the line below without also updating the | |
1396 ** MaRTE Makefile. | |
1397 **/ | |
1398 C("Thread_Blocking_IO", Boolean, "True", "") | |
1399 /* | |
1400 -- Set False for contexts where socket i/o are process blocking | |
1401 | |
1402 */ | |
1403 | |
1404 #ifdef HAVE_INET_PTON | |
1405 # define Inet_Pton_Linkname "inet_pton" | |
1406 #else | |
1407 # define Inet_Pton_Linkname "__gnat_inet_pton" | |
1408 #endif | |
1409 CST(Inet_Pton_Linkname, "") | |
1410 | |
1411 #endif /* HAVE_SOCKETS */ | |
1412 | |
1413 /* | |
1414 | |
1415 --------------------- | |
1416 -- Threads support -- | |
1417 --------------------- | |
1418 | |
1419 -- Clock identifier definitions | |
1420 | |
1421 */ | |
1422 | |
1423 /* Note: On HP-UX, CLOCK_REALTIME is an enum, not a macro. */ | |
1424 | |
1425 #if !(defined(CLOCK_REALTIME) || defined (__hpux__)) | |
1426 # define CLOCK_REALTIME (-1) | |
1427 #endif | |
1428 CND(CLOCK_REALTIME, "System realtime clock") | |
1429 | |
1430 #ifdef CLOCK_MONOTONIC | |
1431 CND(CLOCK_MONOTONIC, "System monotonic clock") | |
1432 #endif | |
1433 | |
1434 #ifdef CLOCK_FASTEST | |
1435 CND(CLOCK_FASTEST, "Fastest clock") | |
1436 #endif | |
1437 | |
1438 #ifndef CLOCK_THREAD_CPUTIME_ID | |
1439 # define CLOCK_THREAD_CPUTIME_ID -1 | |
1440 #endif | |
1441 CND(CLOCK_THREAD_CPUTIME_ID, "Thread CPU clock") | |
1442 | |
1443 #if defined(__linux__) || defined(__FreeBSD__) \ | |
1444 || (defined(_AIX) && defined(_AIXVERSION_530)) \ | |
1445 || defined(__DragonFly__) | |
1446 /** On these platforms use system provided monotonic clock instead of | |
1447 ** the default CLOCK_REALTIME. We then need to set up cond var attributes | |
1448 ** appropriately (see thread.c). | |
1449 ** | |
1450 ** Note that AIX 5.2 does not support CLOCK_MONOTONIC timestamps for | |
1451 ** pthread_cond_timedwait (and does not have pthread_condattr_setclock), | |
1452 ** hence the conditionalization on AIX version above). _AIXVERSION_530 | |
1453 ** is defined in AIX 5.3 and more recent versions. | |
1454 **/ | |
1455 # define CLOCK_RT_Ada "CLOCK_MONOTONIC" | |
1456 | |
1457 #else | |
1458 /* By default use CLOCK_REALTIME */ | |
1459 # define CLOCK_RT_Ada "CLOCK_REALTIME" | |
1460 #endif | |
1461 | |
1462 #ifdef CLOCK_RT_Ada | |
1463 CNS(CLOCK_RT_Ada, "") | |
1464 #endif | |
1465 | |
1466 #if defined (__APPLE__) || defined (__linux__) || defined (__ANDROID__) \ | |
1467 || defined (__rtems__) || defined (DUMMY) | |
1468 /* | |
1469 | |
1470 -- Sizes of pthread data types | |
1471 */ | |
1472 | |
1473 #if defined (__APPLE__) || defined (DUMMY) | |
1474 /* | |
1475 -- (on Darwin, these are just placeholders) | |
1476 */ | |
1477 #define PTHREAD_SIZE __PTHREAD_SIZE__ | |
1478 #define PTHREAD_ATTR_SIZE __PTHREAD_ATTR_SIZE__ | |
1479 #define PTHREAD_MUTEXATTR_SIZE __PTHREAD_MUTEXATTR_SIZE__ | |
1480 #define PTHREAD_MUTEX_SIZE __PTHREAD_MUTEX_SIZE__ | |
1481 #define PTHREAD_CONDATTR_SIZE __PTHREAD_CONDATTR_SIZE__ | |
1482 #define PTHREAD_COND_SIZE __PTHREAD_COND_SIZE__ | |
1483 #define PTHREAD_RWLOCKATTR_SIZE __PTHREAD_RWLOCKATTR_SIZE__ | |
1484 #define PTHREAD_RWLOCK_SIZE __PTHREAD_RWLOCK_SIZE__ | |
1485 #define PTHREAD_ONCE_SIZE __PTHREAD_ONCE_SIZE__ | |
1486 #else | |
1487 #define PTHREAD_SIZE (sizeof (pthread_t)) | |
1488 #define PTHREAD_ATTR_SIZE (sizeof (pthread_attr_t)) | |
1489 #define PTHREAD_MUTEXATTR_SIZE (sizeof (pthread_mutexattr_t)) | |
1490 #define PTHREAD_MUTEX_SIZE (sizeof (pthread_mutex_t)) | |
1491 #define PTHREAD_CONDATTR_SIZE (sizeof (pthread_condattr_t)) | |
1492 #define PTHREAD_COND_SIZE (sizeof (pthread_cond_t)) | |
1493 #define PTHREAD_RWLOCKATTR_SIZE (sizeof (pthread_rwlockattr_t)) | |
1494 #define PTHREAD_RWLOCK_SIZE (sizeof (pthread_rwlock_t)) | |
1495 #define PTHREAD_ONCE_SIZE (sizeof (pthread_once_t)) | |
1496 #endif | |
1497 /* | |
1498 | |
1499 */ | |
1500 CND(PTHREAD_SIZE, "pthread_t") | |
1501 CND(PTHREAD_ATTR_SIZE, "pthread_attr_t") | |
1502 CND(PTHREAD_MUTEXATTR_SIZE, "pthread_mutexattr_t") | |
1503 CND(PTHREAD_MUTEX_SIZE, "pthread_mutex_t") | |
1504 CND(PTHREAD_CONDATTR_SIZE, "pthread_condattr_t") | |
1505 CND(PTHREAD_COND_SIZE, "pthread_cond_t") | |
1506 CND(PTHREAD_RWLOCKATTR_SIZE, "pthread_rwlockattr_t") | |
1507 CND(PTHREAD_RWLOCK_SIZE, "pthread_rwlock_t") | |
1508 CND(PTHREAD_ONCE_SIZE, "pthread_once_t") | |
1509 | |
1510 #endif /* __APPLE__ || __linux__ || __ANDROID__ || __rtems__ */ | |
1511 | |
1512 /* | |
1513 | |
1514 -------------------------------- | |
1515 -- File and directory support -- | |
1516 -------------------------------- | |
1517 | |
1518 */ | |
1519 | |
1520 /** | |
1521 ** Note: this constant can be used in the GNAT runtime library. In compiler | |
1522 ** units on the other hand, System.OS_Constants is not available, so we | |
1523 ** declare an Ada constant (Osint.File_Attributes_Size) independently, which | |
1524 ** is at least as large as sizeof (struct file_attributes), and we have an | |
1525 ** assertion at initialization of Osint checking that the size is indeed at | |
1526 ** least sufficient. | |
1527 **/ | |
1528 #define SIZEOF_struct_file_attributes (sizeof (struct file_attributes)) | |
1529 CND(SIZEOF_struct_file_attributes, "struct file_attributes") | |
1530 | |
1531 /** | |
1532 ** Maximal size of buffer for struct dirent. Note: Since POSIX.1 does not | |
1533 ** specify the size of the d_name field, and other nonstandard fields may | |
1534 ** precede that field within the dirent structure, we must make a conservative | |
1535 ** computation. | |
1536 **/ | |
1537 { | |
1538 struct dirent dent; | |
1539 #define SIZEOF_struct_dirent_alloc \ | |
1540 ((char*) &dent.d_name - (char*) &dent) + NAME_MAX + 1 | |
1541 CND(SIZEOF_struct_dirent_alloc, "struct dirent allocation") | |
1542 } | |
1543 | |
1544 /** | |
1545 ** System-specific constants follow | |
1546 ** Each section should be activated if compiling for the corresponding | |
1547 ** platform *or* generating the dummy version for runtime test compilation. | |
1548 **/ | |
1549 | |
1550 #if defined (__vxworks) || defined (DUMMY) | |
1551 | |
1552 /* | |
1553 | |
1554 -------------------------------- | |
1555 -- VxWorks-specific constants -- | |
1556 -------------------------------- | |
1557 | |
1558 -- These constants may be used only within the VxWorks version of | |
1559 -- GNAT.Sockets.Thin. | |
1560 */ | |
1561 | |
1562 CND(OK, "VxWorks generic success") | |
1563 CND(ERROR, "VxWorks generic error") | |
1564 | |
1565 #endif /* __vxworks */ | |
1566 | |
1567 #if defined (__MINGW32__) || defined (DUMMY) | |
1568 /* | |
1569 | |
1570 ------------------------------ | |
1571 -- MinGW-specific constants -- | |
1572 ------------------------------ | |
1573 | |
1574 -- These constants may be used only within the MinGW version of | |
1575 -- GNAT.Sockets.Thin. | |
1576 */ | |
1577 | |
1578 CND(WSASYSNOTREADY, "System not ready") | |
1579 CND(WSAVERNOTSUPPORTED, "Version not supported") | |
1580 CND(WSANOTINITIALISED, "Winsock not initialized") | |
1581 CND(WSAEDISCON, "Disconnected") | |
1582 | |
1583 #endif /* __MINGW32__ */ | |
1584 | |
1585 /** | |
1586 ** End of constants definitions | |
1587 **/ | |
1588 | |
1589 #ifdef NATIVE | |
1590 putchar ('\n'); | |
1591 #endif | |
1592 | |
1593 /* | |
1594 | |
1595 end System.OS_Constants; | |
1596 */ | |
1597 } |