]> gcc.gnu.org Git - gcc.git/blob - gcc/ada/s-oscons-tmplt.c
[Ada] Add missed OS constant values
[gcc.git] / gcc / ada / s-oscons-tmplt.c
1 /*
2 ------------------------------------------------------------------------------
3 -- --
4 -- GNAT COMPILER COMPONENTS --
5 -- --
6 -- S Y S T E M . O S _ C O N S T A N T S --
7 -- --
8 -- S p e c --
9 -- --
10 -- Copyright (C) 2000-2021, 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__) || defined (__ANDROID__) */
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 #elif !defined(__MINGW32__)
125 #include <poll.h>
126 #endif
127
128 #include "adaint.h"
129
130 #ifdef DUMMY
131
132 # if defined (TARGET)
133 # error TARGET may not be defined when generating the dummy version
134 # else
135 # define TARGET "batch runtime compilation (dummy values)"
136 # endif
137
138 # if !(defined (HAVE_SOCKETS) && defined (HAVE_TERMIOS))
139 # error Features missing on platform
140 # endif
141
142 # define NATIVE
143
144 #endif /* DUMMY */
145
146 #ifndef TARGET
147 # error Please define TARGET
148 #endif
149
150 #ifndef HAVE_SOCKETS
151 # include <errno.h>
152 #endif
153
154 #ifdef HAVE_TERMIOS
155 # include <termios.h>
156 #endif
157
158 #ifdef __APPLE__
159 # include <_types.h>
160 #endif
161
162 #if defined (__linux__) || defined (__ANDROID__) || defined (__QNX__) \
163 || defined (__rtems__)
164 # include <pthread.h>
165 # include <signal.h>
166 #endif
167
168 #if defined(__MINGW32__) || defined(__CYGWIN__)
169 # include <windef.h>
170 # include <winbase.h>
171 #endif
172
173 #ifdef NATIVE
174 #include <stdio.h>
175
176 #ifdef DUMMY
177 int counter = 0;
178 # define _VAL(x) counter++
179 #else
180 # define _VAL(x) x
181 #endif
182
183 #define CND(name,comment) \
184 printf ("\n->CND:$%d:" #name ":$%d:" comment, __LINE__, ((int) _VAL (name)));
185
186 #define CNU(name,comment) \
187 printf ("\n->CNU:$%d:" #name ":$%u:" comment, __LINE__, ((unsigned int) _VAL (name)));
188
189 #define CNS(name,comment) \
190 printf ("\n->CNS:$%d:" #name ":" name ":" comment, __LINE__);
191
192 #define C(sname,type,value,comment)\
193 printf ("\n->C:$%d:" sname ":" #type ":" value ":" comment, __LINE__);
194
195 #define SUB(sname)\
196 printf ("\n->SUB:$%d:" #sname ":" sname, __LINE__);
197
198 #define TXT(text) \
199 printf ("\n->TXT:$%d:" text, __LINE__);
200
201 #else
202
203 #define CND(name, comment) \
204 asm volatile("\n->CND:%0:" #name ":%1:" comment \
205 : : "i" (__LINE__), "i" ((int) name));
206 /* Decimal constant in the range of type "int" */
207
208 #define CNU(name, comment) \
209 asm volatile("\n->CNU:%0:" #name ":%1:" comment \
210 : : "i" (__LINE__), "i" ((int) name));
211 /* Decimal constant in the range of type "unsigned int" (note, assembler
212 * always wants a signed int, we convert back in xoscons).
213 */
214
215 #define CNS(name, comment) \
216 asm volatile("\n->CNS:%0:" #name ":" name ":" comment \
217 : : "i" (__LINE__));
218 /* General expression named number */
219
220 #define C(sname, type, value, comment) \
221 asm volatile("\n->C:%0:" sname ":" #type ":" value ":" comment \
222 : : "i" (__LINE__));
223 /* Typed constant */
224
225 #define SUB(sname) \
226 asm volatile("\n->SUB:%0:" #sname ":" sname \
227 : : "i" (__LINE__));
228 /* Subtype */
229
230 #define TXT(text) \
231 asm volatile("\n->TXT:%0:" text \
232 : : "i" (__LINE__));
233 /* Freeform text */
234
235 #endif /* NATIVE */
236
237 #define CST(name,comment) C(#name,String,name,comment)
238 /* String constant */
239
240 #define STR(x) STR1(x)
241 #define STR1(x) #x
242
243 #ifdef __MINGW32__
244 unsigned int _CRT_fmode = _O_BINARY;
245 #endif
246
247 int
248 main (void) {
249
250 /*
251 -- This package provides target dependent definitions of constant for use
252 -- by the GNAT runtime library. This package should not be directly with'd
253 -- by an application program.
254
255 -- This file is generated automatically, do not modify it by hand! Instead,
256 -- make changes to s-oscons-tmplt.c and rebuild the GNAT runtime library.
257 */
258
259 /**
260 ** Do not change the format of the line below without also updating the
261 ** MaRTE Makefile.
262 **/
263 TXT("-- This is the version for " TARGET)
264 TXT("")
265 TXT("with Interfaces.C;")
266 #if defined (__MINGW32__) || defined (__CYGWIN__)
267 # define TARGET_OS "Windows"
268 # define Serial_Port_Descriptor "System.Win32.HANDLE"
269 TXT("with System.Win32;")
270 #else
271 # define TARGET_OS "Other_OS"
272 # define Serial_Port_Descriptor "Interfaces.C.int"
273 #endif
274
275 /*
276 package System.OS_Constants is
277
278 pragma Pure;
279 */
280
281 /**
282 ** General constants (all platforms)
283 **/
284
285 /*
286
287 ---------------------------------
288 -- General platform parameters --
289 ---------------------------------
290
291 type OS_Type is (Windows, Other_OS);
292 */
293 C("Target_OS", OS_Type, TARGET_OS, "")
294 /*
295 pragma Warnings (Off, Target_OS);
296 -- Suppress warnings on Target_OS since it is in general tested for
297 -- equality with a constant value to implement conditional compilation,
298 -- which normally generates a constant condition warning.
299
300 */
301 #define Target_Name TARGET
302 CST(Target_Name, "")
303
304 /**
305 ** Note: the name of the following constant is recognized specially by
306 ** xoscons (case sensitive).
307 **/
308 #define SIZEOF_unsigned_int sizeof (unsigned int)
309 CND(SIZEOF_unsigned_int, "Size of unsigned int")
310
311 SUB(Serial_Port_Descriptor)
312
313 /*
314
315 -------------------
316 -- System limits --
317 -------------------
318
319 */
320
321 #ifndef IOV_MAX
322 # define IOV_MAX INT_MAX
323 #endif
324 CND(IOV_MAX, "Maximum writev iovcnt")
325
326 /* NAME_MAX is used to compute the allocation size for a struct dirent
327 * passed to readdir() / readdir_r(). However on some systems it is not
328 * defined, as it is technically a filesystem dependent property that
329 * we should retrieve through pathconf(). In any case, we do not need a
330 * precise value but only an upper limit.
331 */
332 #ifndef NAME_MAX
333 # ifdef MAXNAMELEN
334 /* Solaris has no NAME_MAX but defines MAXNAMELEN */
335 # define NAME_MAX MAXNAMELEN
336 # elif defined(PATH_MAX)
337 /* PATH_MAX (maximum length of a full path name) is a safe fall back */
338 # define NAME_MAX PATH_MAX
339 # elif defined(FILENAME_MAX)
340 /* Similarly FILENAME_MAX can provide a safe fall back */
341 # define NAME_MAX FILENAME_MAX
342 # else
343 /* Hardcode a reasonably large value as a last chance fallback */
344 # define NAME_MAX 1024
345 # endif
346 #endif
347 CND(NAME_MAX, "Maximum file name length")
348
349 /*
350
351 ---------------------
352 -- File open modes --
353 ---------------------
354
355 */
356
357 #ifndef O_RDWR
358 # define O_RDWR -1
359 #endif
360 CND(O_RDWR, "Read/write")
361
362 #ifndef O_NOCTTY
363 # define O_NOCTTY -1
364 #endif
365 CND(O_NOCTTY, "Don't change ctrl tty")
366
367 #ifndef O_NDELAY
368 # define O_NDELAY -1
369 #endif
370 CND(O_NDELAY, "Nonblocking")
371
372 /*
373
374 ----------------------
375 -- Fcntl operations --
376 ----------------------
377
378 */
379
380 #ifndef F_GETFL
381 # define F_GETFL -1
382 #endif
383 CND(F_GETFL, "Get flags")
384
385 #ifndef F_SETFL
386 # define F_SETFL -1
387 #endif
388 CND(F_SETFL, "Set flags")
389
390 /*
391
392 -----------------
393 -- Fcntl flags --
394 -----------------
395
396 */
397
398 #ifndef FNDELAY
399 # define FNDELAY -1
400 #endif
401 CND(FNDELAY, "Nonblocking")
402
403 /*
404
405 ----------------------
406 -- Ioctl operations --
407 ----------------------
408
409 */
410
411 /* ioctl(2) requests are "int" in UNIX, but "unsigned long" on FreeBSD */
412
413 #if defined (__FreeBSD__) || defined (__DragonFly__)
414 # define CNI CNU
415 # define IOCTL_Req_T "Interfaces.C.unsigned"
416 #else
417 # define CNI CND
418 # define IOCTL_Req_T "Interfaces.C.int"
419 #endif
420
421 SUB(IOCTL_Req_T)
422
423 #ifndef FIONBIO
424 # define FIONBIO -1
425 #endif
426 CNI(FIONBIO, "Set/clear non-blocking io")
427
428 #ifndef FIONREAD
429 # define FIONREAD -1
430 #endif
431 CNI(FIONREAD, "How many bytes to read")
432
433 /*
434
435 ------------------
436 -- Errno values --
437 ------------------
438
439 -- The following constants are defined from <errno.h>
440
441 */
442 #ifndef EAGAIN
443 # define EAGAIN -1
444 #endif
445 CND(EAGAIN, "Try again")
446
447 #ifndef ENOENT
448 # define ENOENT -1
449 #endif
450 CND(ENOENT, "File not found")
451
452 #ifndef ENOMEM
453 # define ENOMEM -1
454 #endif
455 CND(ENOMEM, "Out of memory")
456
457 #ifdef __MINGW32__
458 /*
459
460 -- The following constants are defined from <winsock2.h> (WSA*)
461
462 */
463
464 /**
465 ** For sockets-related errno values on Windows, gsocket.h redefines
466 ** Exxx as WSAExxx.
467 **/
468
469 #endif
470
471 #ifndef EACCES
472 # define EACCES -1
473 #endif
474 CND(EACCES, "Permission denied")
475
476 #ifndef EADDRINUSE
477 # define EADDRINUSE -1
478 #endif
479 CND(EADDRINUSE, "Address already in use")
480
481 #ifndef EADDRNOTAVAIL
482 # define EADDRNOTAVAIL -1
483 #endif
484 CND(EADDRNOTAVAIL, "Cannot assign address")
485
486 #ifndef EAFNOSUPPORT
487 # define EAFNOSUPPORT -1
488 #endif
489 CND(EAFNOSUPPORT, "Addr family not supported")
490
491 #ifndef EALREADY
492 # define EALREADY -1
493 #endif
494 CND(EALREADY, "Operation in progress")
495
496 #ifndef EBADF
497 # define EBADF -1
498 #endif
499 CND(EBADF, "Bad file descriptor")
500
501 #ifndef ECONNABORTED
502 # define ECONNABORTED -1
503 #endif
504 CND(ECONNABORTED, "Connection aborted")
505
506 #ifndef ECONNREFUSED
507 # define ECONNREFUSED -1
508 #endif
509 CND(ECONNREFUSED, "Connection refused")
510
511 #ifndef ECONNRESET
512 # define ECONNRESET -1
513 #endif
514 CND(ECONNRESET, "Connection reset by peer")
515
516 #ifndef EDESTADDRREQ
517 # define EDESTADDRREQ -1
518 #endif
519 CND(EDESTADDRREQ, "Destination addr required")
520
521 #ifndef EFAULT
522 # define EFAULT -1
523 #endif
524 CND(EFAULT, "Bad address")
525
526 #ifndef EHOSTDOWN
527 # define EHOSTDOWN -1
528 #endif
529 CND(EHOSTDOWN, "Host is down")
530
531 #ifndef EHOSTUNREACH
532 # define EHOSTUNREACH -1
533 #endif
534 CND(EHOSTUNREACH, "No route to host")
535
536 #ifndef EINPROGRESS
537 # define EINPROGRESS -1
538 #endif
539 CND(EINPROGRESS, "Operation now in progress")
540
541 #ifndef EINTR
542 # define EINTR -1
543 #endif
544 CND(EINTR, "Interrupted system call")
545
546 #ifndef EINVAL
547 # define EINVAL -1
548 #endif
549 CND(EINVAL, "Invalid argument")
550
551 #ifndef EIO
552 # define EIO -1
553 #endif
554 CND(EIO, "Input output error")
555
556 #ifndef EISCONN
557 # define EISCONN -1
558 #endif
559 CND(EISCONN, "Socket already connected")
560
561 #ifndef ELOOP
562 # define ELOOP -1
563 #endif
564 CND(ELOOP, "Too many symbolic links")
565
566 #ifndef EMFILE
567 # define EMFILE -1
568 #endif
569 CND(EMFILE, "Too many open files")
570
571 #ifndef EMSGSIZE
572 # define EMSGSIZE -1
573 #endif
574 CND(EMSGSIZE, "Message too long")
575
576 #ifndef ENAMETOOLONG
577 # define ENAMETOOLONG -1
578 #endif
579 CND(ENAMETOOLONG, "Name too long")
580
581 #ifndef ENETDOWN
582 # define ENETDOWN -1
583 #endif
584 CND(ENETDOWN, "Network is down")
585
586 #ifndef ENETRESET
587 # define ENETRESET -1
588 #endif
589 CND(ENETRESET, "Disconn. on network reset")
590
591 #ifndef ENETUNREACH
592 # define ENETUNREACH -1
593 #endif
594 CND(ENETUNREACH, "Network is unreachable")
595
596 #ifndef ENOBUFS
597 # define ENOBUFS -1
598 #endif
599 CND(ENOBUFS, "No buffer space available")
600
601 #ifndef ENOPROTOOPT
602 # define ENOPROTOOPT -1
603 #endif
604 CND(ENOPROTOOPT, "Protocol not available")
605
606 #ifndef ENOTCONN
607 # define ENOTCONN -1
608 #endif
609 CND(ENOTCONN, "Socket not connected")
610
611 #ifndef ENOTSOCK
612 # define ENOTSOCK -1
613 #endif
614 CND(ENOTSOCK, "Operation on non socket")
615
616 #ifndef EOPNOTSUPP
617 # define EOPNOTSUPP -1
618 #endif
619 CND(EOPNOTSUPP, "Operation not supported")
620
621 #ifndef EPIPE
622 # define EPIPE -1
623 #endif
624 CND(EPIPE, "Broken pipe")
625
626 #ifndef EPFNOSUPPORT
627 # define EPFNOSUPPORT -1
628 #endif
629 CND(EPFNOSUPPORT, "Unknown protocol family")
630
631 #ifndef EPROTONOSUPPORT
632 # define EPROTONOSUPPORT -1
633 #endif
634 CND(EPROTONOSUPPORT, "Unknown protocol")
635
636 #ifndef EPROTOTYPE
637 # define EPROTOTYPE -1
638 #endif
639 CND(EPROTOTYPE, "Unknown protocol type")
640
641 #ifndef ERANGE
642 # define ERANGE -1
643 #endif
644 CND(ERANGE, "Result too large")
645
646 #ifndef ESHUTDOWN
647 # define ESHUTDOWN -1
648 #endif
649 CND(ESHUTDOWN, "Cannot send once shutdown")
650
651 #ifndef ESOCKTNOSUPPORT
652 # define ESOCKTNOSUPPORT -1
653 #endif
654 CND(ESOCKTNOSUPPORT, "Socket type not supported")
655
656 #ifndef ETIMEDOUT
657 # define ETIMEDOUT -1
658 #endif
659 CND(ETIMEDOUT, "Connection timed out")
660
661 #ifndef ETOOMANYREFS
662 # define ETOOMANYREFS -1
663 #endif
664 CND(ETOOMANYREFS, "Too many references")
665
666 #ifndef EWOULDBLOCK
667 # define EWOULDBLOCK -1
668 #endif
669 CND(EWOULDBLOCK, "Operation would block")
670
671 #ifndef E2BIG
672 # define E2BIG -1
673 #endif
674 CND(E2BIG, "Argument list too long")
675
676 #ifndef EILSEQ
677 # define EILSEQ -1
678 #endif
679 CND(EILSEQ, "Illegal byte sequence")
680
681 /**
682 ** Terminal/serial I/O constants
683 **/
684
685 #if defined(HAVE_TERMIOS) || defined(__MINGW32__)
686 /*
687
688 ----------------------
689 -- Terminal control --
690 ----------------------
691
692 */
693 #endif
694
695 #ifdef HAVE_TERMIOS
696
697 #ifndef TCSANOW
698 # define TCSANOW -1
699 #endif
700 CND(TCSANOW, "Immediate")
701
702 #ifndef TCIFLUSH
703 # define TCIFLUSH -1
704 #endif
705 CND(TCIFLUSH, "Flush input")
706
707 #ifndef IXON
708 # define IXON -1
709 #endif
710 CNU(IXON, "Output sw flow control")
711
712 #ifndef CLOCAL
713 # define CLOCAL -1
714 #endif
715 CNU(CLOCAL, "Local")
716
717 #ifndef CRTSCTS
718 # define CRTSCTS -1
719 #endif
720 CNU(CRTSCTS, "Output hw flow control")
721
722 #ifndef CREAD
723 # define CREAD -1
724 #endif
725 CNU(CREAD, "Read")
726
727 #ifndef ICANON
728 # define ICANON -1
729 #endif
730 CNU(ICANON, "canonical mode")
731
732 #ifndef CBAUD
733 # define CBAUD -1
734 #endif
735 CNU(CBAUD, "baud speed mask")
736
737 #ifndef ECHO
738 # define ECHO -1
739 #endif
740 CNU(ECHO, "echo input characters")
741
742 #ifndef ECHOE
743 # define ECHOE -1
744 #endif
745 CNU(ECHOE, "erase preceding characters")
746
747 #ifndef ECHOK
748 # define ECHOK -1
749 #endif
750 CNU(ECHOK, "kill character, erases current line")
751
752 #ifndef ECHOCTL
753 # define ECHOCTL -1
754 #endif
755 CNU(ECHOCTL, "echo special characters")
756
757 #ifndef ECHONL
758 # define ECHONL -1
759 #endif
760 CNU(ECHONL, "force echo NL character")
761
762 #ifndef CS5
763 # define CS5 -1
764 #endif
765 CNU(CS5, "5 data bits")
766
767 #ifndef CS6
768 # define CS6 -1
769 #endif
770 CNU(CS6, "6 data bits")
771
772 #ifndef CS7
773 # define CS7 -1
774 #endif
775 CNU(CS7, "7 data bits")
776
777 #ifndef CS8
778 # define CS8 -1
779 #endif
780 CNU(CS8, "8 data bits")
781
782 #ifndef CSTOPB
783 # define CSTOPB -1
784 #endif
785 CNU(CSTOPB, "2 stop bits")
786
787 #ifndef PARENB
788 # define PARENB -1
789 #endif
790 CNU(PARENB, "Parity enable")
791
792 #ifndef PARODD
793 # define PARODD -1
794 #endif
795 CNU(PARODD, "Parity odd")
796
797 #ifndef B0
798 # define B0 -1
799 #endif
800 CNU(B0, "0 bps")
801
802 #ifndef B50
803 # define B50 -1
804 #endif
805 CNU(B50, "50 bps")
806
807 #ifndef B75
808 # define B75 -1
809 #endif
810 CNU(B75, "75 bps")
811
812 #ifndef B110
813 # define B110 -1
814 #endif
815 CNU(B110, "110 bps")
816
817 #ifndef B134
818 # define B134 -1
819 #endif
820 CNU(B134, "134 bps")
821
822 #ifndef B150
823 # define B150 -1
824 #endif
825 CNU(B150, "150 bps")
826
827 #ifndef B200
828 # define B200 -1
829 #endif
830 CNU(B200, "200 bps")
831
832 #ifndef B300
833 # define B300 -1
834 #endif
835 CNU(B300, "300 bps")
836
837 #ifndef B600
838 # define B600 -1
839 #endif
840 CNU(B600, "600 bps")
841
842 #ifndef B1200
843 # define B1200 -1
844 #endif
845 CNU(B1200, "1200 bps")
846
847 #ifndef B1800
848 # define B1800 -1
849 #endif
850 CNU(B1800, "1800 bps")
851
852 #ifndef B2400
853 # define B2400 -1
854 #endif
855 CNU(B2400, "2400 bps")
856
857 #ifndef B4800
858 # define B4800 -1
859 #endif
860 CNU(B4800, "4800 bps")
861
862 #ifndef B9600
863 # define B9600 -1
864 #endif
865 CNU(B9600, "9600 bps")
866
867 #ifndef B19200
868 # define B19200 -1
869 #endif
870 CNU(B19200, "19200 bps")
871
872 #ifndef B38400
873 # define B38400 -1
874 #endif
875 CNU(B38400, "38400 bps")
876
877 #ifndef B57600
878 # define B57600 -1
879 #endif
880 CNU(B57600, "57600 bps")
881
882 #ifndef B115200
883 # define B115200 -1
884 #endif
885 CNU(B115200, "115200 bps")
886
887 #ifndef B230400
888 # define B230400 -1
889 #endif
890 CNU(B230400, "230400 bps")
891
892 #ifndef B460800
893 # define B460800 -1
894 #endif
895 CNU(B460800, "460800 bps")
896
897 #ifndef B500000
898 # define B500000 -1
899 #endif
900 CNU(B500000, "500000 bps")
901
902 #ifndef B576000
903 # define B576000 -1
904 #endif
905 CNU(B576000, "576000 bps")
906
907 #ifndef B921600
908 # define B921600 -1
909 #endif
910 CNU(B921600, "921600 bps")
911
912 #ifndef B1000000
913 # define B1000000 -1
914 #endif
915 CNU(B1000000, "1000000 bps")
916
917 #ifndef B1152000
918 # define B1152000 -1
919 #endif
920 CNU(B1152000, "1152000 bps")
921
922 #ifndef B1500000
923 # define B1500000 -1
924 #endif
925 CNU(B1500000, "1500000 bps")
926
927 #ifndef B2000000
928 # define B2000000 -1
929 #endif
930 CNU(B2000000, "2000000 bps")
931
932 #ifndef B2500000
933 # define B2500000 -1
934 #endif
935 CNU(B2500000, "2500000 bps")
936
937 #ifndef B3000000
938 # define B3000000 -1
939 #endif
940 CNU(B3000000, "3000000 bps")
941
942 #ifndef B3500000
943 # define B3500000 -1
944 #endif
945 CNU(B3500000, "3500000 bps")
946
947 #ifndef B4000000
948 # define B4000000 -1
949 #endif
950 CNU(B4000000, "4000000 bps")
951
952 /*
953
954 ---------------------------------
955 -- Terminal control characters --
956 ---------------------------------
957
958 */
959
960 #ifndef VINTR
961 # define VINTR -1
962 #endif
963 CND(VINTR, "Interrupt")
964
965 #ifndef VQUIT
966 # define VQUIT -1
967 #endif
968 CND(VQUIT, "Quit")
969
970 #ifndef VERASE
971 # define VERASE -1
972 #endif
973 CND(VERASE, "Erase")
974
975 #ifndef VKILL
976 # define VKILL -1
977 #endif
978 CND(VKILL, "Kill")
979
980 #ifndef VEOF
981 # define VEOF -1
982 #endif
983 CND(VEOF, "EOF")
984
985 #ifndef VTIME
986 # define VTIME -1
987 #endif
988 CND(VTIME, "Read timeout")
989
990 #ifndef VMIN
991 # define VMIN -1
992 #endif
993 CND(VMIN, "Read min chars")
994
995 #ifndef VSWTC
996 # define VSWTC -1
997 #endif
998 CND(VSWTC, "Switch")
999
1000 #ifndef VSTART
1001 # define VSTART -1
1002 #endif
1003 CND(VSTART, "Flow control start")
1004
1005 #ifndef VSTOP
1006 # define VSTOP -1
1007 #endif
1008 CND(VSTOP, "Flow control stop")
1009
1010 #ifndef VSUSP
1011 # define VSUSP -1
1012 #endif
1013 CND(VSUSP, "Suspend")
1014
1015 #ifndef VEOL
1016 # define VEOL -1
1017 #endif
1018 CND(VEOL, "EOL")
1019
1020 #ifndef VREPRINT
1021 # define VREPRINT -1
1022 #endif
1023 CND(VREPRINT, "Reprint unread")
1024
1025 #ifndef VDISCARD
1026 # define VDISCARD -1
1027 #endif
1028 CND(VDISCARD, "Discard pending")
1029
1030 #ifndef VWERASE
1031 # define VWERASE -1
1032 #endif
1033 CND(VWERASE, "Word erase")
1034
1035 #ifndef VLNEXT
1036 # define VLNEXT -1
1037 #endif
1038 CND(VLNEXT, "Literal next")
1039
1040 #ifndef VEOL2
1041 # define VEOL2 -1
1042 #endif
1043 CND(VEOL2, "Alternative EOL")
1044
1045 #endif /* HAVE_TERMIOS */
1046
1047 #if defined(__MINGW32__) || defined(__CYGWIN__)
1048 CNU(DTR_CONTROL_ENABLE, "Enable DTR flow ctrl")
1049 CNU(RTS_CONTROL_ENABLE, "Enable RTS flow ctrl")
1050 #endif
1051
1052 /*
1053
1054 -----------------------------
1055 -- Pseudo terminal library --
1056 -----------------------------
1057
1058 */
1059
1060 #if defined (__FreeBSD__) || defined (__linux__) || defined (__DragonFly__)
1061 # define PTY_Library "-lutil"
1062 #else
1063 # define PTY_Library ""
1064 #endif
1065 CST(PTY_Library, "for g-exptty")
1066
1067 /**
1068 ** Sockets constants
1069 **/
1070
1071 #ifdef HAVE_SOCKETS
1072
1073 /*
1074
1075 --------------
1076 -- Families --
1077 --------------
1078
1079 */
1080
1081 #ifndef AF_INET
1082 # define AF_INET -1
1083 #endif
1084 CND(AF_INET, "IPv4 address family")
1085
1086 #ifndef AF_INET6
1087 # define AF_INET6 -1
1088 #else
1089 # define HAVE_AF_INET6 1
1090 #endif
1091 CND(AF_INET6, "IPv6 address family")
1092
1093 #ifndef AF_UNIX
1094 # define AF_UNIX -1
1095 #endif
1096 CND(AF_UNIX, "Local unix family")
1097
1098 #ifndef AF_UNSPEC
1099 # define AF_UNSPEC -1
1100 #else
1101 # define HAVE_AF_UNSPEC 1
1102 #endif
1103 CND(AF_UNSPEC, "Unspecified address family")
1104
1105 /*
1106
1107 -----------------------------
1108 -- addrinfo fields offsets --
1109 -----------------------------
1110
1111 */
1112
1113 #ifdef AI_CANONNAME
1114 const struct addrinfo ai;
1115
1116 #define AI_FLAGS_OFFSET ((void *)&ai.ai_flags - (void *)&ai)
1117 #define AI_FAMILY_OFFSET ((void *)&ai.ai_family - (void *)&ai)
1118 #define AI_SOCKTYPE_OFFSET ((void *)&ai.ai_socktype - (void *)&ai)
1119 #define AI_PROTOCOL_OFFSET ((void *)&ai.ai_protocol - (void *)&ai)
1120 #define AI_ADDRLEN_OFFSET ((void *)&ai.ai_addrlen - (void *)&ai)
1121 #define AI_ADDR_OFFSET ((void *)&ai.ai_addr - (void *)&ai)
1122 #define AI_CANONNAME_OFFSET ((void *)&ai.ai_canonname - (void *)&ai)
1123 #define AI_NEXT_OFFSET ((void *)&ai.ai_next - (void *)&ai)
1124
1125 #else
1126
1127 #define AI_FLAGS_OFFSET 0
1128 #define AI_FAMILY_OFFSET 4
1129 #define AI_SOCKTYPE_OFFSET 8
1130 #define AI_PROTOCOL_OFFSET 12
1131 #define AI_ADDRLEN_OFFSET 16
1132 #define AI_CANONNAME_OFFSET 24
1133 #define AI_ADDR_OFFSET 32
1134 #define AI_NEXT_OFFSET 40
1135
1136 #endif
1137
1138 CND(AI_FLAGS_OFFSET, "Offset of ai_flags in addrinfo");
1139 CND(AI_FAMILY_OFFSET, "Offset of ai_family in addrinfo");
1140 CND(AI_SOCKTYPE_OFFSET, "Offset of ai_socktype in addrinfo");
1141 CND(AI_PROTOCOL_OFFSET, "Offset of ai_protocol in addrinfo");
1142 CND(AI_ADDRLEN_OFFSET, "Offset of ai_addrlen in addrinfo");
1143 CND(AI_ADDR_OFFSET, "Offset of ai_addr in addrinfo");
1144 CND(AI_CANONNAME_OFFSET, "Offset of ai_canonname in addrinfo");
1145 CND(AI_NEXT_OFFSET, "Offset of ai_next in addrinfo");
1146
1147 /*
1148
1149 ---------------------------------------
1150 -- getaddrinfo getnameinfo constants --
1151 ---------------------------------------
1152
1153 */
1154
1155 #ifndef AI_PASSIVE
1156 # define AI_PASSIVE -1
1157 #endif
1158 CND(AI_PASSIVE, "NULL nodename for accepting")
1159
1160 #ifndef AI_CANONNAME
1161 # define AI_CANONNAME -1
1162 #endif
1163 CND(AI_CANONNAME, "Get the host official name")
1164
1165 #ifndef AI_NUMERICSERV
1166 # define AI_NUMERICSERV -1
1167 #endif
1168 CND(AI_NUMERICSERV, "Service is a numeric string")
1169
1170 #ifndef AI_NUMERICHOST
1171 # define AI_NUMERICHOST -1
1172 #endif
1173 CND(AI_NUMERICHOST, "Node is a numeric IP address")
1174
1175 #ifndef AI_ADDRCONFIG
1176 # define AI_ADDRCONFIG -1
1177 #endif
1178 CND(AI_ADDRCONFIG, "Returns addresses for only locally configured families")
1179
1180 #ifndef AI_V4MAPPED
1181 # define AI_V4MAPPED -1
1182 #endif
1183 CND(AI_V4MAPPED, "Returns IPv4 mapped to IPv6")
1184
1185 #ifndef AI_ALL
1186 # define AI_ALL -1
1187 #endif
1188 CND(AI_ALL, "Change AI_V4MAPPED behavior for unavailavle IPv6 addresses")
1189
1190 #ifndef NI_NAMEREQD
1191 # define NI_NAMEREQD -1
1192 #endif
1193 CND(NI_NAMEREQD, "Error if the hostname cannot be determined")
1194
1195 #ifndef NI_DGRAM
1196 # define NI_DGRAM -1
1197 #endif
1198 CND(NI_DGRAM, "Service is datagram")
1199
1200 #ifndef NI_NOFQDN
1201 # define NI_NOFQDN -1
1202 #endif
1203 CND(NI_NOFQDN, "Return only the hostname part for local hosts")
1204
1205 #ifndef NI_NUMERICSERV
1206 # define NI_NUMERICSERV -1
1207 #endif
1208 CND(NI_NUMERICSERV, "Numeric form of the service")
1209
1210 #ifndef NI_NUMERICHOST
1211 # define NI_NUMERICHOST -1
1212 #endif
1213 CND(NI_NUMERICHOST, "Numeric form of the hostname")
1214
1215 #ifndef NI_MAXHOST
1216 # define NI_MAXHOST -1
1217 #endif
1218 CND(NI_MAXHOST, "Maximum size of hostname")
1219
1220 #ifndef NI_MAXSERV
1221 # define NI_MAXSERV -1
1222 #endif
1223 CND(NI_MAXSERV, "Maximum size of service name")
1224
1225 #ifndef EAI_SYSTEM
1226 # define EAI_SYSTEM -1
1227 #endif
1228 CND(EAI_SYSTEM, "Check errno for details")
1229
1230 /*
1231
1232 ------------------
1233 -- Socket modes --
1234 ------------------
1235
1236 */
1237
1238 #ifndef SOCK_STREAM
1239 # define SOCK_STREAM -1
1240 #endif
1241 CND(SOCK_STREAM, "Stream socket")
1242
1243 #ifndef SOCK_DGRAM
1244 # define SOCK_DGRAM -1
1245 #endif
1246 CND(SOCK_DGRAM, "Datagram socket")
1247
1248 #ifndef SOCK_RAW
1249 # define SOCK_RAW -1
1250 #endif
1251 CND(SOCK_RAW, "Raw socket")
1252
1253 /*
1254
1255 -----------------
1256 -- Host errors --
1257 -----------------
1258
1259 */
1260
1261 #ifndef HOST_NOT_FOUND
1262 # define HOST_NOT_FOUND -1
1263 #endif
1264 CND(HOST_NOT_FOUND, "Unknown host")
1265
1266 #ifndef TRY_AGAIN
1267 # define TRY_AGAIN -1
1268 #endif
1269 CND(TRY_AGAIN, "Host name lookup failure")
1270
1271 #ifndef NO_DATA
1272 # define NO_DATA -1
1273 #endif
1274 CND(NO_DATA, "No data record for name")
1275
1276 #ifndef NO_RECOVERY
1277 # define NO_RECOVERY -1
1278 #endif
1279 CND(NO_RECOVERY, "Non recoverable errors")
1280
1281 /*
1282
1283 --------------------
1284 -- Shutdown modes --
1285 --------------------
1286
1287 */
1288
1289 #ifndef SHUT_RD
1290 # define SHUT_RD -1
1291 #endif
1292 CND(SHUT_RD, "No more recv")
1293
1294 #ifndef SHUT_WR
1295 # define SHUT_WR -1
1296 #endif
1297 CND(SHUT_WR, "No more send")
1298
1299 #ifndef SHUT_RDWR
1300 # define SHUT_RDWR -1
1301 #endif
1302 CND(SHUT_RDWR, "No more recv/send")
1303
1304 /*
1305
1306 ---------------------
1307 -- Protocol levels --
1308 ---------------------
1309
1310 */
1311
1312 #ifndef SOL_SOCKET
1313 # define SOL_SOCKET -1
1314 #endif
1315 CND(SOL_SOCKET, "Options for socket level")
1316
1317 #ifndef IPPROTO_IP
1318 # define IPPROTO_IP -1
1319 #endif
1320 CND(IPPROTO_IP, "Dummy protocol for IP")
1321
1322 #ifndef IPPROTO_IPV6
1323 # define IPPROTO_IPV6 -1
1324 #endif
1325 CND(IPPROTO_IPV6, "IPv6 socket option level")
1326
1327 #ifndef IPPROTO_UDP
1328 # define IPPROTO_UDP -1
1329 #endif
1330 CND(IPPROTO_UDP, "UDP")
1331
1332 #ifndef IPPROTO_TCP
1333 # define IPPROTO_TCP -1
1334 #endif
1335 CND(IPPROTO_TCP, "TCP")
1336
1337 #ifndef IPPROTO_ICMP
1338 # define IPPROTO_ICMP -1
1339 #endif
1340 CND(IPPROTO_ICMP, "Internet Control Message Protocol")
1341
1342 #ifndef IPPROTO_IGMP
1343 # define IPPROTO_IGMP -1
1344 #endif
1345 CND(IPPROTO_IGMP, "Internet Group Management Protocol")
1346
1347 #ifndef IPPROTO_IPIP
1348 # define IPPROTO_IPIP -1
1349 #endif
1350 CND(IPPROTO_IPIP, "IPIP tunnels (older KA9Q tunnels use 94)")
1351
1352 #ifndef IPPROTO_EGP
1353 # define IPPROTO_EGP -1
1354 #endif
1355 CND(IPPROTO_EGP, "Exterior Gateway Protocol")
1356
1357 #ifndef IPPROTO_PUP
1358 # define IPPROTO_PUP -1
1359 #endif
1360 CND(IPPROTO_PUP, "PUP protocol")
1361
1362 #ifndef IPPROTO_IDP
1363 # define IPPROTO_IDP -1
1364 #endif
1365 CND(IPPROTO_IDP, "XNS IDP protocol")
1366
1367 #ifndef IPPROTO_TP
1368 # define IPPROTO_TP -1
1369 #endif
1370 CND(IPPROTO_TP, "SO Transport Protocol Class 4")
1371
1372 #ifndef IPPROTO_DCCP
1373 # define IPPROTO_DCCP -1
1374 #endif
1375 CND(IPPROTO_DCCP, "Datagram Congestion Control Protocol")
1376
1377 #ifndef IPPROTO_RSVP
1378 # define IPPROTO_RSVP -1
1379 #endif
1380 CND(IPPROTO_RSVP, "Reservation Protocol")
1381
1382 #ifndef IPPROTO_GRE
1383 # define IPPROTO_GRE -1
1384 #endif
1385 CND(IPPROTO_GRE, "General Routing Encapsulation")
1386
1387 #ifndef IPPROTO_ESP
1388 # define IPPROTO_ESP -1
1389 #endif
1390 CND(IPPROTO_ESP, "encapsulating security payload")
1391
1392 #ifndef IPPROTO_AH
1393 # define IPPROTO_AH -1
1394 #endif
1395 CND(IPPROTO_AH, "authentication header")
1396
1397 #ifndef IPPROTO_MTP
1398 # define IPPROTO_MTP -1
1399 #endif
1400 CND(IPPROTO_MTP, "Multicast Transport Protocol")
1401
1402 #ifndef IPPROTO_BEETPH
1403 # define IPPROTO_BEETPH -1
1404 #endif
1405 CND(IPPROTO_BEETPH, "IP option pseudo header for BEET")
1406
1407 #ifndef IPPROTO_ENCAP
1408 # define IPPROTO_ENCAP -1
1409 #endif
1410 CND(IPPROTO_ENCAP, "Encapsulation Header")
1411
1412 #ifndef IPPROTO_PIM
1413 # define IPPROTO_PIM -1
1414 #endif
1415 CND(IPPROTO_PIM, "Protocol Independent Multicast")
1416
1417 #ifndef IPPROTO_COMP
1418 # define IPPROTO_COMP -1
1419 #endif
1420 CND(IPPROTO_COMP, "Compression Header Protocol")
1421
1422 #ifndef IPPROTO_SCTP
1423 # define IPPROTO_SCTP -1
1424 #endif
1425 CND(IPPROTO_SCTP, "Stream Control Transmission Protocol")
1426
1427 #ifndef IPPROTO_UDPLITE
1428 # define IPPROTO_UDPLITE -1
1429 #endif
1430 CND(IPPROTO_UDPLITE, "UDP-Lite protocol")
1431
1432 #ifndef IPPROTO_MPLS
1433 # define IPPROTO_MPLS -1
1434 #endif
1435 CND(IPPROTO_MPLS, "MPLS in IP")
1436
1437 #ifndef IPPROTO_RAW
1438 # define IPPROTO_RAW -1
1439 #endif
1440 CND(IPPROTO_RAW, "Raw IP packets")
1441
1442 /*
1443
1444 -------------------
1445 -- Request flags --
1446 -------------------
1447
1448 */
1449
1450 #ifndef MSG_OOB
1451 # define MSG_OOB -1
1452 #endif
1453 CND(MSG_OOB, "Process out-of-band data")
1454
1455 #ifndef MSG_PEEK
1456 # define MSG_PEEK -1
1457 #endif
1458 CND(MSG_PEEK, "Peek at incoming data")
1459
1460 #ifndef MSG_EOR
1461 # define MSG_EOR -1
1462 #endif
1463 CND(MSG_EOR, "Send end of record")
1464
1465 #ifndef MSG_WAITALL
1466 # define MSG_WAITALL -1
1467 #endif
1468 CND(MSG_WAITALL, "Wait for full reception")
1469
1470 #ifndef MSG_NOSIGNAL
1471 # define MSG_NOSIGNAL -1
1472 #endif
1473 CND(MSG_NOSIGNAL, "No SIGPIPE on send")
1474
1475 #if defined (__linux__) || defined (__ANDROID__) || defined (__QNX__)
1476 # define MSG_Forced_Flags "MSG_NOSIGNAL"
1477 #else
1478 # define MSG_Forced_Flags "0"
1479 #endif
1480 CNS(MSG_Forced_Flags, "")
1481 /*
1482 -- Flags set on all send(2) calls
1483 */
1484
1485 /*
1486
1487 --------------------
1488 -- Socket options --
1489 --------------------
1490
1491 */
1492
1493 #ifndef TCP_NODELAY
1494 # define TCP_NODELAY -1
1495 #endif
1496 CND(TCP_NODELAY, "Do not coalesce packets")
1497
1498 #ifndef TCP_KEEPCNT
1499 #ifdef __MINGW32__
1500 /* Windows headers can be too old to have all available constants.
1501 * We know this one. */
1502 # define TCP_KEEPCNT 16
1503 #else
1504 # define TCP_KEEPCNT -1
1505 #endif
1506 #endif
1507 CND(TCP_KEEPCNT, "Maximum number of keepalive probes")
1508
1509 #ifndef TCP_KEEPIDLE
1510 #ifdef __MINGW32__
1511 /* Windows headers can be too old to have all available constants.
1512 * We know this one. */
1513 # define TCP_KEEPIDLE 3
1514 #else
1515 # define TCP_KEEPIDLE -1
1516 #endif
1517 #endif
1518 CND(TCP_KEEPIDLE, "Idle time before TCP starts sending keepalive probes")
1519
1520 #ifndef TCP_KEEPINTVL
1521 #ifdef __MINGW32__
1522 /* Windows headers can be too old to have all available constants.
1523 * We know this one. */
1524 # define TCP_KEEPINTVL 17
1525 #else
1526 # define TCP_KEEPINTVL -1
1527 #endif
1528 #endif
1529 CND(TCP_KEEPINTVL, "Time between individual keepalive probes")
1530
1531 #ifndef SO_REUSEADDR
1532 # define SO_REUSEADDR -1
1533 #endif
1534 CND(SO_REUSEADDR, "Bind reuse local address")
1535
1536 #ifndef SO_REUSEPORT
1537 # define SO_REUSEPORT -1
1538 #endif
1539 CND(SO_REUSEPORT, "Bind reuse port number")
1540
1541 #ifndef SO_KEEPALIVE
1542 # define SO_KEEPALIVE -1
1543 #endif
1544 CND(SO_KEEPALIVE, "Enable keep-alive msgs")
1545
1546 #ifndef SO_LINGER
1547 # define SO_LINGER -1
1548 #endif
1549 CND(SO_LINGER, "Defer close to flush data")
1550
1551 #ifndef SO_BROADCAST
1552 # define SO_BROADCAST -1
1553 #endif
1554 CND(SO_BROADCAST, "Can send broadcast msgs")
1555
1556 #ifndef SO_SNDBUF
1557 # define SO_SNDBUF -1
1558 #endif
1559 CND(SO_SNDBUF, "Set/get send buffer size")
1560
1561 #ifndef SO_RCVBUF
1562 # define SO_RCVBUF -1
1563 #endif
1564 CND(SO_RCVBUF, "Set/get recv buffer size")
1565
1566 #ifndef SO_SNDTIMEO
1567 # define SO_SNDTIMEO -1
1568 #endif
1569 CND(SO_SNDTIMEO, "Emission timeout")
1570
1571 #ifndef SO_RCVTIMEO
1572 # define SO_RCVTIMEO -1
1573 #endif
1574 CND(SO_RCVTIMEO, "Reception timeout")
1575
1576 #ifndef SO_ERROR
1577 # define SO_ERROR -1
1578 #endif
1579 CND(SO_ERROR, "Get/clear error status")
1580
1581 #ifndef SO_BUSY_POLL
1582 # define SO_BUSY_POLL -1
1583 #endif
1584 CND(SO_BUSY_POLL, "Busy polling")
1585
1586 #ifndef IP_MULTICAST_IF
1587 # define IP_MULTICAST_IF -1
1588 #endif
1589 CND(IP_MULTICAST_IF, "Set/get mcast interface")
1590
1591 #ifndef IP_MULTICAST_TTL
1592 # define IP_MULTICAST_TTL -1
1593 #endif
1594 CND(IP_MULTICAST_TTL, "Set/get multicast TTL")
1595
1596 #ifndef IP_MULTICAST_LOOP
1597 # define IP_MULTICAST_LOOP -1
1598 #endif
1599 CND(IP_MULTICAST_LOOP, "Set/get mcast loopback")
1600
1601 #ifndef IP_ADD_MEMBERSHIP
1602 # define IP_ADD_MEMBERSHIP -1
1603 #endif
1604 CND(IP_ADD_MEMBERSHIP, "Join a multicast group")
1605
1606 #ifndef IP_DROP_MEMBERSHIP
1607 # define IP_DROP_MEMBERSHIP -1
1608 #endif
1609 CND(IP_DROP_MEMBERSHIP, "Leave a multicast group")
1610
1611 #ifndef IP_PKTINFO
1612 # define IP_PKTINFO -1
1613 #endif
1614 CND(IP_PKTINFO, "Get datagram info")
1615
1616 #ifndef IP_RECVERR
1617 # define IP_RECVERR -1
1618 #endif
1619 CND(IP_RECVERR, "Extended reliable error message passing")
1620
1621 #ifndef IPV6_ADDRFORM
1622 # define IPV6_ADDRFORM -1
1623 #endif
1624 CND(IPV6_ADDRFORM, "Turn IPv6 socket into different address family")
1625
1626 #ifndef IPV6_ADD_MEMBERSHIP
1627 # define IPV6_ADD_MEMBERSHIP -1
1628 #endif
1629 CND(IPV6_ADD_MEMBERSHIP, "Join IPv6 multicast group")
1630
1631 #ifndef IPV6_DROP_MEMBERSHIP
1632 # define IPV6_DROP_MEMBERSHIP -1
1633 #endif
1634 CND(IPV6_DROP_MEMBERSHIP, "Leave IPv6 multicast group")
1635
1636 #ifndef IPV6_MTU
1637 # define IPV6_MTU -1
1638 #endif
1639 CND(IPV6_MTU, "Set/get MTU used for the socket")
1640
1641 #ifndef IPV6_MTU_DISCOVER
1642 # define IPV6_MTU_DISCOVER -1
1643 #endif
1644 CND(IPV6_MTU_DISCOVER, "Control path-MTU discovery on the socket")
1645
1646 #ifndef IPV6_MULTICAST_HOPS
1647 # define IPV6_MULTICAST_HOPS -1
1648 #endif
1649 CND(IPV6_MULTICAST_HOPS, "Set the multicast hop limit for the socket")
1650
1651 #ifndef IPV6_MULTICAST_IF
1652 # define IPV6_MULTICAST_IF -1
1653 #endif
1654 CND(IPV6_MULTICAST_IF, "Set/get IPv6 mcast interface")
1655
1656 #ifndef IPV6_MULTICAST_LOOP
1657 # define IPV6_MULTICAST_LOOP -1
1658 #endif
1659 CND(IPV6_MULTICAST_LOOP, "Set/get mcast loopback")
1660
1661 #ifndef IPV6_RECVPKTINFO
1662 # define IPV6_RECVPKTINFO -1
1663 #endif
1664 CND(IPV6_RECVPKTINFO, "Set delivery of the IPV6_PKTINFO")
1665
1666 #ifndef IPV6_PKTINFO
1667 # define IPV6_PKTINFO -1
1668 #endif
1669 CND(IPV6_PKTINFO, "Get IPv6datagram info")
1670
1671 #ifndef IPV6_RTHDR
1672 # define IPV6_RTHDR -1
1673 #endif
1674 CND(IPV6_RTHDR, "Set the routing header delivery")
1675
1676 #ifndef IPV6_AUTHHDR
1677 # define IPV6_AUTHHDR -1
1678 #endif
1679 CND(IPV6_AUTHHDR, "Set the authentication header delivery")
1680
1681 #ifndef IPV6_DSTOPTS
1682 # define IPV6_DSTOPTS -1
1683 #endif
1684 CND(IPV6_DSTOPTS, "Set the destination options delivery")
1685
1686 #ifndef IPV6_HOPOPTS
1687 # define IPV6_HOPOPTS -1
1688 #endif
1689 CND(IPV6_HOPOPTS, "Set the hop options delivery")
1690
1691 #ifndef IPV6_FLOWINFO
1692 #ifdef __linux__
1693 /* The IPV6_FLOWINFO is defined in linux/in6.h, but we can't include it because
1694 * of conflicts with other headers. */
1695 # define IPV6_FLOWINFO 11
1696 #else
1697 # define IPV6_FLOWINFO -1
1698 #endif
1699 #endif
1700 CND(IPV6_FLOWINFO, "Set the flow ID delivery")
1701
1702 #ifndef IPV6_HOPLIMIT
1703 # define IPV6_HOPLIMIT -1
1704 #endif
1705 CND(IPV6_HOPLIMIT, "Set the hop count of the packet delivery")
1706
1707 #ifndef IPV6_RECVERR
1708 # define IPV6_RECVERR -1
1709 #endif
1710 CND(IPV6_RECVERR, "Extended reliable error message passing")
1711
1712 #ifndef IPV6_ROUTER_ALERT
1713 # define IPV6_ROUTER_ALERT -1
1714 #endif
1715 CND(IPV6_ROUTER_ALERT, "Pass forwarded router alert hop-by-hop option")
1716
1717 #ifndef IPV6_UNICAST_HOPS
1718 # define IPV6_UNICAST_HOPS -1
1719 #endif
1720 CND(IPV6_UNICAST_HOPS, "Set the unicast hop limit")
1721
1722 #ifndef IPV6_V6ONLY
1723 # define IPV6_V6ONLY -1
1724 #endif
1725 CND(IPV6_V6ONLY, "Restricted to IPv6 communications only")
1726
1727 /*
1728
1729 ----------------------
1730 -- Type definitions --
1731 ----------------------
1732
1733 */
1734
1735 {
1736 struct timeval tv;
1737 /*
1738 -- Sizes (in bytes) of the components of struct timeval
1739 */
1740 #define SIZEOF_tv_sec (sizeof tv.tv_sec)
1741 CND(SIZEOF_tv_sec, "tv_sec")
1742 #define SIZEOF_tv_usec (sizeof tv.tv_usec)
1743 CND(SIZEOF_tv_usec, "tv_usec")
1744 /*
1745
1746 -- Maximum allowed value for tv_sec
1747 */
1748
1749 /**
1750 ** On Solaris, field tv_sec in struct timeval has an undocumented
1751 ** hard-wired limit of 100 million.
1752 ** On IA64 HP-UX the limit is 2**31 - 1.
1753 **/
1754 #if defined (__sun__)
1755 # define MAX_tv_sec "100_000_000"
1756
1757 #elif defined (__hpux__)
1758 # define MAX_tv_sec "16#7fffffff#"
1759
1760 #else
1761 # define MAX_tv_sec "2 ** (SIZEOF_tv_sec * 8 - 1) - 1"
1762 #endif
1763 CNS(MAX_tv_sec, "")
1764 }
1765 /*
1766
1767 -- Sizes of various data types
1768 */
1769
1770 #define SIZEOF_sockaddr_in (sizeof (struct sockaddr_in))
1771 CND(SIZEOF_sockaddr_in, "struct sockaddr_in")
1772 #ifdef HAVE_AF_INET6
1773 # define SIZEOF_sockaddr_in6 (sizeof (struct sockaddr_in6))
1774 #else
1775 # define SIZEOF_sockaddr_in6 0
1776 #endif
1777 CND(SIZEOF_sockaddr_in6, "struct sockaddr_in6")
1778
1779 /**
1780 ** The sockaddr_un structure is not defined in MINGW C headers
1781 ** but Windows supports it from build 17063.
1782 **/
1783 #if defined(__MINGW32__)
1784 struct sockaddr_un {
1785 ADDRESS_FAMILY sun_family; /* AF_UNIX */
1786 char sun_path[108]; /* Pathname */
1787 };
1788 #endif
1789 #define SIZEOF_sockaddr_un (sizeof (struct sockaddr_un))
1790 CND(SIZEOF_sockaddr_un, "struct sockaddr_un")
1791
1792 #define SIZEOF_fd_set (sizeof (fd_set))
1793 CND(SIZEOF_fd_set, "fd_set")
1794 CND(FD_SETSIZE, "Max fd value")
1795
1796 #define SIZEOF_struct_hostent (sizeof (struct hostent))
1797 CND(SIZEOF_struct_hostent, "struct hostent")
1798
1799 #define SIZEOF_struct_servent (sizeof (struct servent))
1800 CND(SIZEOF_struct_servent, "struct servent")
1801
1802 #if defined (__linux__) || defined (__ANDROID__) || defined (__QNX__)
1803 #define SIZEOF_sigset (sizeof (sigset_t))
1804 CND(SIZEOF_sigset, "sigset")
1805 #endif
1806
1807 #if defined(_WIN32) || defined(__vxworks)
1808 #define SIZEOF_nfds_t sizeof (int) * 8
1809 #define SIZEOF_socklen_t sizeof (size_t)
1810 #elif defined(__Lynx__)
1811 #define SIZEOF_nfds_t sizeof (unsigned long int) * 8
1812 #define SIZEOF_socklen_t sizeof (socklen_t)
1813 #else
1814 #define SIZEOF_nfds_t sizeof (nfds_t) * 8
1815 #define SIZEOF_socklen_t sizeof (socklen_t)
1816 #endif
1817 CND(SIZEOF_nfds_t, "Size of nfds_t");
1818 CND(SIZEOF_socklen_t, "Size of socklen_t");
1819
1820 {
1821 #if defined(__vxworks)
1822 #define SIZEOF_fd_type sizeof (int) * 8
1823 #define SIZEOF_pollfd_events sizeof (short) * 8
1824 #else
1825 const struct pollfd v_pollfd;
1826 #define SIZEOF_fd_type sizeof (v_pollfd.fd) * 8
1827 #define SIZEOF_pollfd_events sizeof (v_pollfd.events) * 8
1828 #endif
1829 CND(SIZEOF_fd_type, "Size of socket fd");
1830 CND(SIZEOF_pollfd_events, "Size of pollfd.events");
1831 }
1832
1833 #ifndef IF_NAMESIZE
1834 #ifdef IF_MAX_STRING_SIZE
1835 #define IF_NAMESIZE IF_MAX_STRING_SIZE
1836 #else
1837 #define IF_NAMESIZE -1
1838 #endif
1839 #endif
1840 CND(IF_NAMESIZE, "Max size of interface name with 0 terminator");
1841
1842 /*
1843
1844 -- Poll values
1845
1846 */
1847
1848 #if defined(__vxworks)
1849 #ifndef POLLIN
1850 #define POLLIN 1
1851 #endif
1852
1853 #ifndef POLLPRI
1854 #define POLLPRI 2
1855 #endif
1856
1857 #ifndef POLLOUT
1858 #define POLLOUT 4
1859 #endif
1860
1861 #ifndef POLLERR
1862 #define POLLERR 8
1863 #endif
1864
1865 #ifndef POLLHUP
1866 #define POLLHUP 16
1867 #endif
1868
1869 #ifndef POLLNVAL
1870 #define POLLNVAL 32
1871 #endif
1872
1873 #elif defined(_WIN32)
1874 #define POLLPRI 0
1875 /* If the POLLPRI flag is set on a socket for the Microsoft Winsock provider,
1876 * the WSAPoll function will fail. */
1877 #endif
1878
1879 CND(POLLIN, "There is data to read");
1880 CND(POLLPRI, "Urgent data to read");
1881 CND(POLLOUT, "Writing will not block");
1882 CND(POLLERR, "Error (output only)");
1883 CND(POLLHUP, "Hang up (output only)");
1884 CND(POLLNVAL, "Invalid request");
1885
1886 /*
1887
1888 -- Fields of struct msghdr
1889 */
1890
1891 #if defined (__sun__) || defined (__hpux__)
1892 # define Msg_Iovlen_T "Interfaces.C.int"
1893 #else
1894 # define Msg_Iovlen_T "Interfaces.C.size_t"
1895 #endif
1896
1897 SUB(Msg_Iovlen_T)
1898
1899 /*
1900
1901 ----------------------------------------
1902 -- Properties of supported interfaces --
1903 ----------------------------------------
1904
1905 */
1906
1907 CND(Need_Netdb_Buffer, "Need buffer for Netdb ops")
1908 CND(Need_Netdb_Lock, "Need lock for Netdb ops")
1909 CND(Has_Sockaddr_Len, "Sockaddr has sa_len field")
1910
1911 /**
1912 ** Do not change the format of the line below without also updating the
1913 ** MaRTE Makefile.
1914 **/
1915 C("Thread_Blocking_IO", Boolean, "True", "")
1916 /*
1917 -- Set False for contexts where socket i/o are process blocking
1918
1919 */
1920
1921 #ifdef HAVE_INET_PTON
1922 # define Inet_Pton_Linkname "inet_pton"
1923 #else
1924 # define Inet_Pton_Linkname "__gnat_inet_pton"
1925 #endif
1926 CST(Inet_Pton_Linkname, "")
1927
1928 #ifdef HAVE_INET_NTOP
1929 # define Inet_Ntop_Linkname "inet_ntop"
1930 #else
1931 # define Inet_Ntop_Linkname "__gnat_inet_ntop"
1932 #endif
1933 CST(Inet_Ntop_Linkname, "")
1934
1935 #if defined(_WIN32)
1936 # define Poll_Linkname "WSAPoll"
1937 #else
1938 # define Poll_Linkname "poll"
1939 #endif
1940 CST(Poll_Linkname, "")
1941
1942 #endif /* HAVE_SOCKETS */
1943
1944 /*
1945
1946 ---------------------
1947 -- Threads support --
1948 ---------------------
1949
1950 -- Clock identifier definitions
1951
1952 */
1953
1954 /* Note: On HP-UX, CLOCK_REALTIME is an enum, not a macro. */
1955
1956 #if !(defined(CLOCK_REALTIME) || defined (__hpux__))
1957 # define CLOCK_REALTIME (-1)
1958 #endif
1959 CND(CLOCK_REALTIME, "System realtime clock")
1960
1961 #ifdef CLOCK_MONOTONIC
1962 CND(CLOCK_MONOTONIC, "System monotonic clock")
1963 #endif
1964
1965 #ifdef CLOCK_FASTEST
1966 CND(CLOCK_FASTEST, "Fastest clock")
1967 #endif
1968
1969 #ifndef CLOCK_THREAD_CPUTIME_ID
1970 # define CLOCK_THREAD_CPUTIME_ID -1
1971 #endif
1972 CND(CLOCK_THREAD_CPUTIME_ID, "Thread CPU clock")
1973
1974 #if defined(__linux__) || defined(__FreeBSD__) \
1975 || (defined(_AIX) && defined(_AIXVERSION_530)) \
1976 || defined(__DragonFly__) || defined(__QNX__)
1977 /** On these platforms use system provided monotonic clock instead of
1978 ** the default CLOCK_REALTIME. We then need to set up cond var attributes
1979 ** appropriately (see thread.c).
1980 **
1981 ** Note that AIX 5.2 does not support CLOCK_MONOTONIC timestamps for
1982 ** pthread_cond_timedwait (and does not have pthread_condattr_setclock),
1983 ** hence the conditionalization on AIX version above). _AIXVERSION_530
1984 ** is defined in AIX 5.3 and more recent versions.
1985 **/
1986 # define CLOCK_RT_Ada "CLOCK_MONOTONIC"
1987
1988 #else
1989 /* By default use CLOCK_REALTIME */
1990 # define CLOCK_RT_Ada "CLOCK_REALTIME"
1991 #endif
1992
1993 #ifdef CLOCK_RT_Ada
1994 CNS(CLOCK_RT_Ada, "")
1995 #endif
1996
1997 #if defined (__APPLE__) || defined (__linux__) || defined (__ANDROID__) \
1998 || defined (__QNX__) || defined (__rtems__) || defined (DUMMY)
1999 /*
2000
2001 -- Sizes of pthread data types
2002 */
2003
2004 #if defined (__APPLE__) || defined (DUMMY)
2005 /*
2006 -- (on Darwin, these are just placeholders)
2007 */
2008 #define PTHREAD_SIZE __PTHREAD_SIZE__
2009 #define PTHREAD_ATTR_SIZE __PTHREAD_ATTR_SIZE__
2010 #define PTHREAD_MUTEXATTR_SIZE __PTHREAD_MUTEXATTR_SIZE__
2011 #define PTHREAD_MUTEX_SIZE __PTHREAD_MUTEX_SIZE__
2012 #define PTHREAD_CONDATTR_SIZE __PTHREAD_CONDATTR_SIZE__
2013 #define PTHREAD_COND_SIZE __PTHREAD_COND_SIZE__
2014 #define PTHREAD_RWLOCKATTR_SIZE __PTHREAD_RWLOCKATTR_SIZE__
2015 #define PTHREAD_RWLOCK_SIZE __PTHREAD_RWLOCK_SIZE__
2016 #define PTHREAD_ONCE_SIZE __PTHREAD_ONCE_SIZE__
2017 #else
2018 #define PTHREAD_SIZE (sizeof (pthread_t))
2019 #define PTHREAD_ATTR_SIZE (sizeof (pthread_attr_t))
2020 #define PTHREAD_MUTEXATTR_SIZE (sizeof (pthread_mutexattr_t))
2021 #define PTHREAD_MUTEX_SIZE (sizeof (pthread_mutex_t))
2022 #define PTHREAD_CONDATTR_SIZE (sizeof (pthread_condattr_t))
2023 #define PTHREAD_COND_SIZE (sizeof (pthread_cond_t))
2024 #define PTHREAD_RWLOCKATTR_SIZE (sizeof (pthread_rwlockattr_t))
2025 #define PTHREAD_RWLOCK_SIZE (sizeof (pthread_rwlock_t))
2026 #define PTHREAD_ONCE_SIZE (sizeof (pthread_once_t))
2027 #endif
2028 /*
2029
2030 */
2031 CND(PTHREAD_SIZE, "pthread_t")
2032 CND(PTHREAD_ATTR_SIZE, "pthread_attr_t")
2033 CND(PTHREAD_MUTEXATTR_SIZE, "pthread_mutexattr_t")
2034 CND(PTHREAD_MUTEX_SIZE, "pthread_mutex_t")
2035 CND(PTHREAD_CONDATTR_SIZE, "pthread_condattr_t")
2036 CND(PTHREAD_COND_SIZE, "pthread_cond_t")
2037 CND(PTHREAD_RWLOCKATTR_SIZE, "pthread_rwlockattr_t")
2038 CND(PTHREAD_RWLOCK_SIZE, "pthread_rwlock_t")
2039 CND(PTHREAD_ONCE_SIZE, "pthread_once_t")
2040
2041 #endif /* __APPLE__ || __linux__ || __ANDROID__ || __rtems__ */
2042
2043 /*
2044
2045 --------------------------------
2046 -- File and directory support --
2047 --------------------------------
2048
2049 */
2050
2051 /**
2052 ** Note: this constant can be used in the GNAT runtime library. In compiler
2053 ** units on the other hand, System.OS_Constants is not available, so we
2054 ** declare an Ada constant (Osint.File_Attributes_Size) independently, which
2055 ** is at least as large as sizeof (struct file_attributes), and we have an
2056 ** assertion at initialization of Osint checking that the size is indeed at
2057 ** least sufficient.
2058 **/
2059 #define SIZEOF_struct_file_attributes (sizeof (struct file_attributes))
2060 CND(SIZEOF_struct_file_attributes, "struct file_attributes")
2061
2062 /**
2063 ** Maximal size of buffer for struct dirent. Note: Since POSIX.1 does not
2064 ** specify the size of the d_name field, and other nonstandard fields may
2065 ** precede that field within the dirent structure, we must make a conservative
2066 ** computation.
2067 **/
2068 {
2069 struct dirent dent;
2070 #define SIZEOF_struct_dirent_alloc \
2071 ((char*) &dent.d_name - (char*) &dent) + NAME_MAX + 1
2072 CND(SIZEOF_struct_dirent_alloc, "struct dirent allocation")
2073 }
2074
2075 /**
2076 ** System-specific constants follow
2077 ** Each section should be activated if compiling for the corresponding
2078 ** platform *or* generating the dummy version for runtime test compilation.
2079 **/
2080
2081 #if defined (__vxworks) || defined (DUMMY)
2082
2083 /*
2084
2085 --------------------------------
2086 -- VxWorks-specific constants --
2087 --------------------------------
2088
2089 -- These constants may be used only within the VxWorks version of
2090 -- GNAT.Sockets.Thin.
2091 */
2092
2093 CND(OK, "VxWorks generic success")
2094 CND(ERROR, "VxWorks generic error")
2095
2096 #endif /* __vxworks */
2097
2098 #if defined (__MINGW32__) || defined (DUMMY)
2099 /*
2100
2101 ------------------------------
2102 -- MinGW-specific constants --
2103 ------------------------------
2104
2105 -- These constants may be used only within the MinGW version of
2106 -- GNAT.Sockets.Thin.
2107 */
2108
2109 CND(WSASYSNOTREADY, "System not ready")
2110 CND(WSAVERNOTSUPPORTED, "Version not supported")
2111 CND(WSANOTINITIALISED, "Winsock not initialized")
2112 CND(WSAEDISCON, "Disconnected")
2113
2114 #endif /* __MINGW32__ */
2115
2116 /**
2117 ** End of constants definitions
2118 **/
2119
2120 #ifdef NATIVE
2121 putchar ('\n');
2122 #endif
2123
2124 /*
2125
2126 end System.OS_Constants;
2127 */
2128 }
This page took 0.133879 seconds and 5 git commands to generate.